@dodoex/api 3.0.6 → 3.0.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types/chainConfig/chain.d.ts +2 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{arbsepolia as e,plume as t,plumeTestnet as r,neox as n,morph as i,riseTestnet as o,nero as s,bitlayer as a,zircuitMainnet as l,xLayer as c,zeroMainnet as u,hashkey as d,hemi as h,pharosTestnet as f,monadTestnet as p,fetchUniswapV2PairTotalSupply as m,fetchUniswapV2PairBalanceOf as g,fetchUniswapV2PairGetReserves as E,getUniswapV2Router02ContractAddressByChainId as y,getUniswapV2FactoryContractAddressByChainId as A,fetchUniswapV2PairFeeRate as b}from"@dodoex/dodo-contract-request";export{setContractRequests}from"@dodoex/dodo-contract-request";import v from"js-sha3";import w from"bn.js";import O from"hash.js";import N from"bech32";import{chunk as T,merge as _}from"lodash";import P,{BigNumber as R}from"bignumber.js";import*as D from"cross-fetch";import I from"cross-fetch";import C from"qs";import{formatUnits as S}from"@dodoex/contract-request";var k;!function(e){e[e.MAINNET=1]="MAINNET",e[e.GOERLI=5]="GOERLI",e[e.SEPOLIA=11155111]="SEPOLIA",e[e.BSC=56]="BSC",e[e.POLYGON=137]="POLYGON",e[e.ARBITRUM_ONE=42161]="ARBITRUM_ONE",e[e.ARBITRUM_SEPOLIA=421614]="ARBITRUM_SEPOLIA",e[e.AURORA=1313161554]="AURORA",e[e.OKCHAIN=66]="OKCHAIN",e[e.OPTIMISM=10]="OPTIMISM",e[e.AVALANCHE=43114]="AVALANCHE",e[e.CONFLUX=1030]="CONFLUX",e[e.BASE=8453]="BASE",e[e.LINEA=59144]="LINEA",e[e.SCROLL=534352]="SCROLL",e[e.MANTA=169]="MANTA",e[e.MANTLE=5e3]="MANTLE",e[e.DODO_CHAIN_TESTNET=53457]="DODO_CHAIN_TESTNET",e[e.TAIKO=167e3]="TAIKO",e[e.PLUME=98866]="PLUME",e[e.PLUME_TESTNET=98864]="PLUME_TESTNET",e[e.NEOX=47763]="NEOX",e[e.MORPH=2818]="MORPH",e[e.RISE_TESTNET=11155931]="RISE_TESTNET",e[e.NEROCHAIN=1689]="NEROCHAIN",e[e.BITLAYER=200901]="BITLAYER",e[e.ZIRCUIT=48900]="ZIRCUIT",e[e.X_LAYER=196]="X_LAYER",e[e.ZERO=543210]="ZERO",e[e.HASHKEY=177]="HASHKEY",e[e.HEMI=43111]="HEMI",e[e.PHAROS_TESTNET=688688]="PHAROS_TESTNET",e[e.MONAD_TESTNET=10143]="MONAD_TESTNET"}(k||(k={}));const B="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",x={symbol:"ETH",address:B,name:"Ether",decimals:18,showDecimals:4,wrappedTokenSymbol:"WETH"},L={[k.MAINNET]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}),[k.GOERLI]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6"}),[k.SEPOLIA]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0x7B07164ecFaF0F0D85DFC062Bc205a4674c75Aa0"}),[k.OPTIMISM]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[k.CONFLUX]:Object.assign(Object.assign({},x),{symbol:"CFX",name:"CFX",wrappedTokenSymbol:"WCFX",wrappedTokenAddress:"0x14b2d3bc65e74dae1030eafd8ac30c533c976a9b"}),[k.BSC]:Object.assign(Object.assign({},x),{symbol:"BNB",name:"BNB",wrappedTokenSymbol:"WBNB",wrappedTokenAddress:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}),[k.OKCHAIN]:Object.assign(Object.assign({},x),{symbol:"OKT",name:"OKT",wrappedTokenSymbol:"WOKT",wrappedTokenAddress:"0x8F8526dbfd6E38E3D8307702cA8469Bae6C56C15"}),[k.POLYGON]:Object.assign(Object.assign({},x),{symbol:"MATIC",name:"MATIC",showDecimals:6,wrappedTokenSymbol:"WMATIC",wrappedTokenAddress:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"}),[k.ARBITRUM_ONE]:Object.assign(Object.assign({},x),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"}),[k.ARBITRUM_SEPOLIA]:Object.assign(Object.assign({},x),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0xfd6fFee92D25158b29315C71b0Bb4dE727530FaF"}),[k.AURORA]:Object.assign(Object.assign({},x),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB"}),[k.AVALANCHE]:Object.assign(Object.assign({},x),{symbol:"AVAX",name:"Avalanche",showDecimals:6,wrappedTokenSymbol:"WAVAX",wrappedTokenAddress:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"}),[k.BASE]:Object.assign(Object.assign({},x),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[k.LINEA]:Object.assign(Object.assign({},x),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f"}),[k.SCROLL]:Object.assign(Object.assign({},x),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x5300000000000000000000000000000000000004"}),[k.MANTA]:Object.assign(Object.assign({},x),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x0Dc808adcE2099A9F62AA87D9670745AbA741746"}),[k.MANTLE]:Object.assign(Object.assign({},x),{wrappedTokenSymbol:"WMNT",wrappedTokenAddress:"0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8"}),[k.DODO_CHAIN_TESTNET]:Object.assign(Object.assign({},x),{symbol:"dodo",name:"Wrapped Berd",wrappedTokenSymbol:"WBERD",wrappedTokenAddress:"0x3a64Ec3606FF7310E8fAd6FcC008e39705fB496d"}),[k.TAIKO]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0xA51894664A773981C6C112C43ce576f315d5b1B6"}),[k.PLUME]:Object.assign(Object.assign({},x),{symbol:"PLUME",name:"PLUME",wrappedTokenSymbol:"WPLUME",wrappedTokenAddress:"0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1"}),[k.PLUME_TESTNET]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0xaA6210015fbf0855F0D9fDA3C415c1B12776Ae74"}),[k.NEOX]:Object.assign(Object.assign({},x),{symbol:"GAS",name:"GAS",showDecimals:6,wrappedTokenSymbol:"WGAS10",wrappedTokenAddress:"0xdE41591ED1f8ED1484aC2CD8ca0876428de60EfF"}),[k.MORPH]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0x5300000000000000000000000000000000000011"}),[k.RISE_TESTNET]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[k.NEROCHAIN]:Object.assign(Object.assign({},x),{symbol:"NERO",name:"NERO",wrappedTokenSymbol:"WNERO",wrappedTokenAddress:"0x252ba4a6efb0d91bd7108d91a067c14592a56f17"}),[k.BITLAYER]:Object.assign(Object.assign({},x),{symbol:"BTC",name:"BTC",wrappedTokenSymbol:"WBTC",wrappedTokenAddress:"0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f"}),[k.ZIRCUIT]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[k.X_LAYER]:Object.assign(Object.assign({},x),{symbol:"OKB",name:"OKB",wrappedTokenSymbol:"WOKB",wrappedTokenAddress:"0xe538905cf8410324e03a5a23c1c177a474d59b2b"}),[k.ZERO]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0xAc98B49576B1C892ba6BFae08fE1BB0d80Cf599c"}),[k.HASHKEY]:Object.assign(Object.assign({},x),{symbol:"HSK",name:"HSK",wrappedTokenSymbol:"WHSK",wrappedTokenAddress:"0xB210D2120d57b758EE163cFfb43e73728c471Cf1"}),[k.HEMI]:Object.assign(Object.assign({},x),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[k.PHAROS_TESTNET]:Object.assign(Object.assign({},x),{symbol:"PHRS",name:"PHRS",wrappedTokenSymbol:"WPHRS",wrappedTokenAddress:"0x3019b247381c850ab53dc0ee53bce7a07ea9155f"}),[k.MONAD_TESTNET]:Object.assign(Object.assign({},x),{symbol:"MON",name:"MON",wrappedTokenSymbol:"WMON",wrappedTokenAddress:"0x0246DffDa649e877CFd0951837332B4690fAD1EB"})},F={[k.MAINNET]:{MULTI_CALL:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",DODO_APPROVE:"0xCB859eA579b28e02B87A1FDE08d087ab9dbE5149",ERC20_HELPER:"0x4F99cba8aAEad26fc970dc6CC4ea435779Fa9016",ROUTE_V2_DATA_FETCH:"0x9337cA090c390667984869193e10c3D4f9a17da8",ROUTE_V1_DATA_FETCH:"0x6373ceB657C83C91088d328622573FB766064Ac4",CALLEE_HELPER:"0x45a7E2E9D780613E047f7e78a9d3902ff854B522",DODO_PROXY:"0xa356867fDCEa8e71AEaF87805808803806231FdC",DODO_DSP_PROXY:"0x4599ed18F34cFE06820E3684bF0aACB8D75c644d",DODO_DPP_PROXY:"0xfF7C8F518e6f1435957ed3d3E0692C94676dAE7a",DODO_V1_PAIR_PROXY:"0x8dD0Fea5FA2f7df535F87f312641Cc15d8B151BA",DODO_MINEV3_PROXY:"0x0d9685D4037580F68D9F77B08971f17E1000bBdc"},[k.GOERLI]:{MULTI_CALL:"0x696E25A5e2AEd1C55E6d6Cfa0532Bbda9020165d",DODO_APPROVE:"0xC9143e54021f4a6d33b9b89DBB9F458AaEdd56FB",ERC20_HELPER:"0x24549FC74B3076A962624A26370ed556c467F74C",ROUTE_V2_DATA_FETCH:"0x7E9c460d0A10bd0605B15F0d0388e307d34a62E6",ROUTE_V1_DATA_FETCH:"0xAC716E87b0853C0712674e8E3a8435a489F276b4",CALLEE_HELPER:"0x5B2fd46E6E3Ff1E479d651ec0b210882Aa9871dF",DODO_PROXY:"0xbce44767af0a53A108b3B7ba4F740E03D228Ec0A",DODO_DSP_PROXY:"0x8d9ccc26CbF3D49bbA76E9920C3E6ed29e06b5cc",DODO_DPP_PROXY:"0xc4A1a152812dE96b2B1861E433f42290CDD7f113",DODO_MINEV3_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b"},[k.SEPOLIA]:{MULTI_CALL:"0x0fcB5237A1997C4700Ffa2BB4522EA38d4F851Fc",DODO_APPROVE:"0x66c45FF040e86DC613F239123A5E21FFdC3A3fEC",ERC20_HELPER:"0x297da061D1dE0132D241Fafed224288B34d81005",ROUTE_V2_DATA_FETCH:"0x03e89fC55A5ad0531576E5a502c4CA52c8bf391B",ROUTE_V1_DATA_FETCH:"0x3dD629473A2eD7f3C6299FFD9F3e0C283d073f11",CALLEE_HELPER:"0xCD536b4DECFD2fa0443666B6becD145F8aDe2E48",DODO_PROXY:"0x6292e8f7647b3b9dDf5795b1Fb77D0187e30E0F9",DODO_DSP_PROXY:"0x987bFBE33c9cF18cAA665B792Db66339a9c16D32",DODO_DPP_PROXY:"0x5e1251f4873248a030e1c92FFEB133AF1513277f",DODO_MINEV3_PROXY:"0xBbD59b9316eE65526DbBdEc2A748Cc05A285d54C"},[k.BSC]:{MULTI_CALL:"0x1Ee38d535d541c55C9dae27B12edf090C608E6Fb",DODO_APPROVE:"0xa128Ba44B2738A558A1fdC06d6303d52D3Cef8c1",ERC20_HELPER:"0x5B9E4c3056227C316a3da3296031DdC7a8d6a867",ROUTE_V2_DATA_FETCH:"0x35b8F92AcFE368afb90d37555f6d075Fc569a6BA",ROUTE_V1_DATA_FETCH:"0x2BBD66fC4898242BDBD2583BBe1d76E8b8f71445",CALLEE_HELPER:"0x2673E5333620bb22BD1bFB3af9Fc7012008E3b4B",DODO_PROXY:"0x8F8Dd7DB1bDA5eD3da8C9daf3bfa471c12d58486",DODO_DSP_PROXY:"0x2442A8B5cdf1E659F3F949A7E454Caa554D4E65a",DODO_DPP_PROXY:"0x624FC8368fE11BE00D8B2F3fE0B9D0053BEc21b9",DODO_V1_PAIR_PROXY:"0x4Fc222194862081866FC636893DDeCB3E4341A10",DODO_MINEV3_PROXY:"0x8f3fB1f9148dC473453163bF31de1d830Eb5c590"},[k.POLYGON]:{MULTI_CALL:"0xc9eD9B18e447e600238fe50e944B9062B664DEa4",DODO_APPROVE:"0x6D310348d5c12009854DFCf72e0DF9027e8cb4f4",ERC20_HELPER:"0xfd24312Ec7871A6D1a31e454D5AbB16c6c25a9b3",ROUTE_V2_DATA_FETCH:"0x1870854754d1E76C58B0a56a153E12Ff868eE3C6",ROUTE_V1_DATA_FETCH:"0x18DFdE99F578A0735410797e949E8D3e2AFCB9D2",CALLEE_HELPER:"0x261F6cF4dF0e5c1432739cDAFD9299150FEd3dFc",DODO_PROXY:"0xa222e6a71D1A1Dd5F279805fbe38d5329C1d0e70",DODO_DSP_PROXY:"0xA3dfF6ae0F73f0970E31Da63B3736F7D3CEF683e",DODO_DPP_PROXY:"0xF6f1A1Ef2f5b56bb289993F75C12Eb41e4abC2f7",DODO_V1_PAIR_PROXY:"0x58E27C46c162F2a781d750BbE1119E1b2DfE82e0",DODO_MINEV3_PROXY:"0x47a65e74dd6b6B5E3243dBb01EDEd9D55ba234Ad"},[k.ARBITRUM_ONE]:{MULTI_CALL:"0xF718F2bd590E5621e53f7b89398e52f7Acced8ca",DODO_APPROVE:"0xA867241cDC8d3b0C07C85cC06F25a0cD3b5474d8",ERC20_HELPER:"0x7C062B9C584fA6eC2504270790D38240A2c5fE72",ROUTE_V2_DATA_FETCH:"0x0C420970b2e5efcBB6e833601772D6E707155eA6",ROUTE_V1_DATA_FETCH:"0x4EE6398898F7FC3e648b3f6bA458310ac29cD352",CALLEE_HELPER:"0xe3B40F8D8346d428EAB28d9Fd672b784d921cfBD",DODO_PROXY:"0x88CBf433471A0CD8240D2a12354362988b4593E5",DODO_DSP_PROXY:"0x36E5238B4479d1ba0bFE47550B0B8e4f4f500EAA",DODO_DPP_PROXY:"0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25",DODO_V1_PAIR_PROXY:"0x49186E32fEd50fd6B5604A2618c7B0b03Cd41414",DODO_MINEV3_PROXY:"0x7E820457780Ac99B9A042Cd5f875b274855A1eE9"},[k.ARBITRUM_SEPOLIA]:{MULTI_CALL:e.MulticallWithValid,DODO_APPROVE:e.DODOApprove,ERC20_HELPER:e.ERC20Helper,ROUTE_V2_DATA_FETCH:e.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:e.DODOV1PmmHelper,CALLEE_HELPER:e.DODOCalleeHelper,DODO_PROXY:e.DODOV2Proxy02,DODO_DSP_PROXY:e.DODODspProxy,DODO_DPP_PROXY:e.DODODppProxy,DODO_MINEV3_PROXY:e.DODOMineV3ProxyWithoutPlatform},[k.AURORA]:{MULTI_CALL:"0x989DcAA95801C527C5B73AA65d3962dF9aCe1b0C",DODO_APPROVE:"0x335aC99bb3E51BDbF22025f092Ebc1Cf2c5cC619",ERC20_HELPER:"0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25",ROUTE_V2_DATA_FETCH:"0x49eAB58AAE044F31d3b136212058a00b282b2845",ROUTE_V1_DATA_FETCH:"0xbAb9F4ff4A19a0e8EEBC56b06750253228ffAc6E",CALLEE_HELPER:"0x738Ebf387A0CE0eb46b0eF8Fa5DEa2EaE6B1Df51",DODO_PROXY:"0xd9deC7c3C06e62a4c1BeEB07CadF568f496b14c2",DODO_DSP_PROXY:"0x53233ABD9108761258a4B6B7822abFD6716B129B",DODO_DPP_PROXY:"0x357c5E9cfA8B834EDcef7C7aAbD8F9Db09119d11",DODO_MINEV3_PROXY:"0x4775b1858f1e417C9609D455C3Ad8751ec01daC4"},[k.OKCHAIN]:{MULTI_CALL:"0x5e84190a270333aCe5B9202a3F4ceBf11b81bB01",DODO_APPROVE:"0x7737fd30535c69545deeEa54AB8Dd590ccaEBD3c",ERC20_HELPER:"0x4775b1858f1e417C9609D455C3Ad8751ec01daC4",ROUTE_V2_DATA_FETCH:"0x10Dd6d8A29D489BEDE472CC1b22dc695c144c5c7",ROUTE_V1_DATA_FETCH:"0xDfaf9584F5d229A9DBE5978523317820A8897C5A",CALLEE_HELPER:"0x3CD6D7F5fF977bf8069548eA1F9441b061162b42",DODO_PROXY:"0x6B4Fa0bc61Eddc928e0Df9c7f01e407BfcD3e5EF",DODO_DSP_PROXY:"0x5515363c0412AdD5c72d3E302fE1bD7dCBCF93Fe",DODO_DPP_PROXY:"0xa222e6a71D1A1Dd5F279805fbe38d5329C1d0e70",DODO_MINEV3_PROXY:"0x958f79e2998DFe417208b9A07D799265B0298e58"},[k.OPTIMISM]:{MULTI_CALL:"0xb98Ac2fEFc8b73aeAE33D02BB00c26E12afCa9Df",DODO_APPROVE:"0xa492d6eABcdc3E204676f15B950bBdD448080364",ERC20_HELPER:"0x42E456ea0dd7538ea103fBb1d0388D14C97bB5b2",ROUTE_V2_DATA_FETCH:"0xC48A8e689a644de96F80786ACb69E6F76D057F25",ROUTE_V1_DATA_FETCH:"0x6281E0628eb2B37fE9943279EA39725D5f0E0dBe",CALLEE_HELPER:"0x0BD7426f008737FeeD575ED8e2aA1bd4Fc49112D",DODO_PROXY:"0xfD9D2827AD469B72B69329dAA325ba7AfbDb3C98",DODO_DSP_PROXY:"0x61721e89a498dADa7aD579482BDC2aE60a9C5D54",DODO_DPP_PROXY:"0x51A70a33655FE1c5fae3286890DcE3bE332E85dD",DODO_MINEV3_PROXY:"0xaEdbD08D92ECccaA9A93b1A8D66D1d356e470c78"},[k.AVALANCHE]:{MULTI_CALL:"0x97f0153E7F5749640aDF3Ff9CFC518b79D6Fe53b",DODO_APPROVE:"0xCFea63e3DE31De53D68780Dd65675F169439e470",ERC20_HELPER:"0xC3528D128CC227fd60793007b5e3FdF7c2945282",ROUTE_V2_DATA_FETCH:"0x686984f0aa37585504f51DEbA0Eb45B0f0CB7e4a",ROUTE_V1_DATA_FETCH:"0x790B4A80Fb1094589A3c0eFC8740aA9b0C1733fB",CALLEE_HELPER:"0x4EfF1D851366b8cc51d553a87e2d12dA8Da46F2a",DODO_PROXY:"0x2cD18557E14aF72DAA8090BcAA95b231ffC9ea26",DODO_DSP_PROXY:"0xeCEaDe494FD5F913Fd937C5CAc4577236395Dc32",DODO_DPP_PROXY:"0xe44F14BFDe673B7339734a28152cCd6b821753C9",DODO_MINEV3_PROXY:"0x5D6e6A0BFB2176AFCc4FB809822D8e009216b245"},[k.CONFLUX]:{MULTI_CALL:"0x696e25a5e2aed1c55e6d6cfa0532bbda9020165d",DODO_APPROVE:"0x5BaF16d57620Cb361F622232F3cb4090e35F3da2",ERC20_HELPER:"0x24549FC74B3076A962624A26370ed556c467F74C",ROUTE_V2_DATA_FETCH:"0x7E9c460d0A10bd0605B15F0d0388e307d34a62E6",ROUTE_V1_DATA_FETCH:"0xAC716E87b0853C0712674e8E3a8435a489F276b4",CALLEE_HELPER:"0x5B2fd46E6E3Ff1E479d651ec0b210882Aa9871dF",DODO_PROXY:"0xbce44767af0a53A108b3B7ba4F740E03D228Ec0A",DODO_DSP_PROXY:"0x8d9ccc26cbf3d49bba76e9920c3e6ed29e06b5cc",DODO_DPP_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b",DODO_MINEV3_PROXY:"0x14F7B8Fb0c1447DdE7bcf92a8d9BB058c8A5FE64"},[k.BASE]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x89872650fA1A391f58B4E144222bB02e44db7e3B",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",DODO_DSP_PROXY:"0x49186E32fEd50fd6B5604A2618c7B0b03Cd41414",DODO_DPP_PROXY:"0x0B1467f71c082D8d410aF4376C685D9A6893cF36",DODO_MINEV3_PROXY:"0x2F66C5aAF006Bd9c51615D617589C16c0ed35fD3"},[k.LINEA]:{MULTI_CALL:"0xa7b9C3a116b20bEDDdBE4d90ff97157f67F0bD97",DODO_APPROVE:"0x6de4d882a84A98f4CCD5D33ea6b3C99A07BAbeB1",ERC20_HELPER:"0xbcd2FDC3B884Cf0dfD932f55Ec2Fe1fB7e8c62Da",ROUTE_V2_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",ROUTE_V1_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",CALLEE_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",DODO_PROXY:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",DODO_DSP_PROXY:"0x6D3bd005A8a75d6522C9cFE7d309BB1Cf9650e03",DODO_DPP_PROXY:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",DODO_MINEV3_PROXY:"0xA6d0066328Edbcf3220cf8F61e8527e589DD9719"},[k.SCROLL]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x20E77aD760eC9E922Fd2dA8847ABFbB2471B92CD",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xf5048d8F9163AF17Db522Abe9FaF37735C911320",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0xe49781e6186214d88aACFd9eBc8cE40E3CDc066D",DODO_DSP_PROXY:"0x7Dd8c909E1F48a68FfEF03492761AF17B1496EDc",DODO_DPP_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b",DODO_MINEV3_PROXY:"0x14F7B8Fb0c1447DdE7bcf92a8d9BB058c8A5FE64"},[k.MANTA]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x0226fCE8c969604C3A0AD19c37d1FAFac73e13c2",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0x2F86652dAEF5f1728c54191C955F065Ec3C188c7",DODO_DSP_PROXY:"0x0B1467f71c082D8d410aF4376C685D9A6893cF36",DODO_DPP_PROXY:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",DODO_MINEV3_PROXY:"0xA6d0066328Edbcf3220cf8F61e8527e589DD9719"},[k.MANTLE]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0xa71415675F68f29259ddD63215E5518d2735bf0a",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",ROUTE_V1_DATA_FETCH:"0xa1609A1fa7DC16c025feA194c02b2822441b8c10",CALLEE_HELPER:"0x4aAe1d041C01078725dB016BA4D4F72455CaF931",DODO_PROXY:"0xe7979E2F3e77196Bb2AB206eaa67Ea278A3E33A2",DODO_DSP_PROXY:"0x2933c0374089D7D98BA0C71c5E02E1A0e09deBEE",DODO_DPP_PROXY:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",DODO_MINEV3_PROXY:"0x6D3bd005A8a75d6522C9cFE7d309BB1Cf9650e03"},[k.DODO_CHAIN_TESTNET]:{MULTI_CALL:"0xD0CF7dfbF09CAfaB8AEf00e0Ce19a4638004a364",DODO_APPROVE:"0x82B26eb18382f7532015248078AB1f6030413396",ERC20_HELPER:"0xE6cecb7460c9E52aA483cb1f0E87d78D7085686F",ROUTE_V2_DATA_FETCH:"0xA3148a1765897EC0A9bCA57f855C0B4718060b78",ROUTE_V1_DATA_FETCH:"0x2e50e3e18c19C7d80B81888a961A13aEE49b962E",CALLEE_HELPER:"0x2Ba2696c63fA8b67b395de6D12F849b17C3515F9",DODO_PROXY:"0x464518e33F7Bd5E61a92b98b4332782915442580",DODO_DSP_PROXY:"0x886F677605512351e554AA53BA77eA493058b460",DODO_DPP_PROXY:"0xB4f2E70DE64F94116A6e93ff4dF2D020E91e7a63",DODO_MINEV3_PROXY:"0x391f8D754E4BaC453d059BA7D2137C4905bF48d4"},[k.TAIKO]:{MULTI_CALL:"0x388371233439cF57bB8C9f2e4835954841cfCb15",DODO_APPROVE:"0x2629E610dB4AC081c108cCDf8b19ED39D702df43",ERC20_HELPER:"0x0c76F95a2952DC171B26b152f2b30cA8968e79D5",ROUTE_V2_DATA_FETCH:"0xC7EaBEc77Be175432DC20c0056Cce4c2C78B84F3",ROUTE_V1_DATA_FETCH:"0x187210CE04F5B3179F0e483FCf292c34BA7568Dd",CALLEE_HELPER:"0x94B66F3156353a12A6004d098A16F2fCfF9E8348",DODO_PROXY:"0xfcd8EF54A4dA96dE6B2DDF67C6265C7405a3A9c6",DODO_DSP_PROXY:"0x928e9762B5223d5A2ac1F5b13E8A61907aCaa9Bd",DODO_DPP_PROXY:"0x38886EDE1Fc92886F9a11C37a1f5e75474858eaa",DODO_MINEV3_PROXY:"0x1dFd36964e21a2eb633991f0B95b4241c20e1db3"},[k.PLUME]:{MULTI_CALL:t.MulticallWithValid,DODO_APPROVE:t.DODOApprove,ERC20_HELPER:t.ERC20Helper,ROUTE_V2_DATA_FETCH:t.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:t.DODOV1PmmHelper,CALLEE_HELPER:t.DODOCalleeHelper,DODO_PROXY:t.DODOV2Proxy02,DODO_DSP_PROXY:t.DODODspProxy,DODO_DPP_PROXY:t.DODODppProxy,DODO_MINEV3_PROXY:t.DODOMineV3Proxy},[k.PLUME_TESTNET]:{MULTI_CALL:r.MulticallWithValid,DODO_APPROVE:r.DODOApprove,ERC20_HELPER:r.ERC20Helper,ROUTE_V2_DATA_FETCH:r.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:r.DODOV1PmmHelper,CALLEE_HELPER:r.DODOCalleeHelper,DODO_PROXY:r.DODOV2Proxy02,DODO_DSP_PROXY:r.DODODspProxy,DODO_DPP_PROXY:r.DODODppProxy,DODO_MINEV3_PROXY:r.DODOMineV3Proxy},[k.NEOX]:{MULTI_CALL:n.MulticallWithValid,DODO_APPROVE:n.DODOApprove,ERC20_HELPER:n.ERC20Helper,ROUTE_V2_DATA_FETCH:n.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:n.DODOV1PmmHelper,CALLEE_HELPER:n.DODOCalleeHelper,DODO_PROXY:n.DODOV2Proxy02,DODO_DSP_PROXY:n.DODODspProxy,DODO_DPP_PROXY:n.DODODppProxy,DODO_MINEV3_PROXY:n.DODOMineV3Proxy},[k.MORPH]:{MULTI_CALL:i.MulticallWithValid,DODO_APPROVE:i.DODOApprove,ERC20_HELPER:i.ERC20Helper,ROUTE_V2_DATA_FETCH:i.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:i.DODOV1PmmHelper,CALLEE_HELPER:i.DODOCalleeHelper,DODO_PROXY:i.DODOV2Proxy02,DODO_DSP_PROXY:i.DODODspProxy,DODO_DPP_PROXY:i.DODODppProxy,DODO_MINEV3_PROXY:i.DODOMineV3Proxy},[k.RISE_TESTNET]:{MULTI_CALL:o.MulticallWithValid,DODO_APPROVE:o.DODOApprove,ERC20_HELPER:o.ERC20Helper,ROUTE_V2_DATA_FETCH:o.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:o.DODOV1PmmHelper,CALLEE_HELPER:o.DODOCalleeHelper,DODO_PROXY:o.DODOV2Proxy02,DODO_DSP_PROXY:o.DODODspProxy,DODO_DPP_PROXY:o.DODODppProxy,DODO_MINEV3_PROXY:o.DODOMineV3Proxy},[k.NEROCHAIN]:{MULTI_CALL:s.MulticallWithValid,DODO_APPROVE:s.DODOApprove,ERC20_HELPER:s.ERC20Helper,ROUTE_V2_DATA_FETCH:s.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:s.DODOV1PmmHelper,CALLEE_HELPER:s.DODOCalleeHelper,DODO_PROXY:s.DODOV2Proxy02,DODO_DSP_PROXY:s.DODODspProxy,DODO_DPP_PROXY:s.DODODppProxy,DODO_MINEV3_PROXY:s.DODOMineV3Proxy},[k.BITLAYER]:{MULTI_CALL:a.MulticallWithValid,DODO_APPROVE:a.DODOApprove,ERC20_HELPER:a.ERC20Helper,ROUTE_V2_DATA_FETCH:a.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:a.DODOV1PmmHelper,CALLEE_HELPER:a.DODOCalleeHelper,DODO_PROXY:a.DODOV2Proxy02,DODO_DSP_PROXY:a.DODODspProxyWithoutGSP,DODO_DPP_PROXY:a.DODODppProxy,DODO_MINEV3_PROXY:a.DODOMineV3Proxy},[k.ZIRCUIT]:{MULTI_CALL:l.MulticallWithValid,DODO_APPROVE:l.DODOApprove,ERC20_HELPER:l.ERC20Helper,ROUTE_V2_DATA_FETCH:l.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:l.DODOV1PmmHelper,CALLEE_HELPER:l.DODOCalleeHelper,DODO_PROXY:l.DODOV2Proxy02,DODO_DSP_PROXY:l.DODODspProxyWithoutGSP,DODO_DPP_PROXY:l.DODODppProxy,DODO_MINEV3_PROXY:l.DODOMineV3Proxy},[k.X_LAYER]:{MULTI_CALL:c.MulticallWithValid,DODO_APPROVE:c.DODOApprove,ERC20_HELPER:c.ERC20Helper,ROUTE_V2_DATA_FETCH:c.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:c.DODOV1PmmHelper,CALLEE_HELPER:c.DODOCalleeHelper,DODO_PROXY:c.DODOV2Proxy02,DODO_DSP_PROXY:c.DODODspProxy,DODO_DPP_PROXY:c.DODODppProxy,DODO_MINEV3_PROXY:c.DODOMineV3Proxy},[k.ZERO]:{MULTI_CALL:u.MulticallWithValid,DODO_APPROVE:u.DODOApprove,ERC20_HELPER:u.ERC20Helper,ROUTE_V2_DATA_FETCH:u.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:u.DODOV1PmmHelper,CALLEE_HELPER:u.DODOCalleeHelper,DODO_PROXY:u.DODOV2Proxy02,DODO_DSP_PROXY:u.DODODspProxy,DODO_DPP_PROXY:u.DODODppProxy,DODO_MINEV3_PROXY:u.DODOMineV3Proxy},[k.HASHKEY]:{MULTI_CALL:d.MulticallWithValid,DODO_APPROVE:d.DODOApprove,ERC20_HELPER:d.ERC20Helper,ROUTE_V2_DATA_FETCH:d.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:d.DODOV1PmmHelper,CALLEE_HELPER:d.DODOCalleeHelper,DODO_PROXY:d.DODOV2Proxy02,DODO_DSP_PROXY:d.DODODspProxyWithoutGSP,DODO_DPP_PROXY:d.DODODppProxy,DODO_MINEV3_PROXY:d.DODOMineV3Proxy},[k.HEMI]:{MULTI_CALL:h.MulticallWithValid,DODO_APPROVE:h.DODOApprove,ERC20_HELPER:h.ERC20Helper,ROUTE_V2_DATA_FETCH:h.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:h.DODOV1PmmHelper,CALLEE_HELPER:h.DODOCalleeHelper,DODO_PROXY:h.DODOV2Proxy02,DODO_DSP_PROXY:h.DODODspProxyWithoutGSP,DODO_DPP_PROXY:h.DODODppProxy,DODO_MINEV3_PROXY:h.DODOMineV3Proxy},[k.PHAROS_TESTNET]:{MULTI_CALL:f.MulticallWithValid,DODO_APPROVE:f.DODOApprove,ERC20_HELPER:f.ERC20Helper,ROUTE_V2_DATA_FETCH:f.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:f.DODOV1PmmHelper,CALLEE_HELPER:f.DODOCalleeHelper,DODO_PROXY:f.DODOV2Proxy02,DODO_DSP_PROXY:f.DODODspProxy,DODO_DPP_PROXY:f.DODODppProxy,DODO_MINEV3_PROXY:f.DODOMineV3Proxy},[k.MONAD_TESTNET]:{MULTI_CALL:p.MulticallWithValid,DODO_APPROVE:p.DODOApprove,ERC20_HELPER:p.ERC20Helper,ROUTE_V2_DATA_FETCH:p.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:p.DODOV1PmmHelper,CALLEE_HELPER:p.DODOCalleeHelper,DODO_PROXY:p.DODOV2Proxy02,DODO_DSP_PROXY:p.DODODspProxyWithoutGSP,DODO_DPP_PROXY:p.DODODppProxy,DODO_MINEV3_PROXY:p.DODOMineV3Proxy}},U={[k.MAINNET]:"ethereum",[k.GOERLI]:"goerli",[k.OPTIMISM]:"optimism",[k.CONFLUX]:"cfx",[k.BSC]:"bsc",[k.OKCHAIN]:"okex-chain",[k.POLYGON]:"polygon",[k.ARBITRUM_ONE]:"arbitrum",[k.ARBITRUM_SEPOLIA]:"arb-sep",[k.AURORA]:"aurora",[k.AVALANCHE]:"avalanche",[k.BASE]:"base",[k.LINEA]:"linea",[k.SCROLL]:"scr",[k.MANTA]:"manta",[k.MANTLE]:"mantle",[k.SEPOLIA]:"sepolia",[k.DODO_CHAIN_TESTNET]:"dodochain-testnet",[k.TAIKO]:"taiko",[k.PLUME]:"plume",[k.PLUME_TESTNET]:"plume-testnet",[k.NEOX]:"neox",[k.MORPH]:"morph",[k.RISE_TESTNET]:"rise-testnet",[k.NEROCHAIN]:"nero",[k.BITLAYER]:"btr",[k.ZIRCUIT]:"zircuit-mainnet",[k.X_LAYER]:"okb",[k.ZERO]:"zero-mainnet",[k.HASHKEY]:"hashkey",[k.HEMI]:"hemi",[k.PHAROS_TESTNET]:"pharos-testnet",[k.MONAD_TESTNET]:"monad-testnet"};function M(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))}let q=!1,V=!1;const G={debug:1,default:2,info:2,warning:3,error:4,off:5};let j=G.default,H=null;const Q=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),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 X,Y;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(X||(X={})),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"}(Y||(Y={}));const K="0123456789abcdef";let $=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==G[r]&&this.throwArgumentError("invalid log level name","logLevel",e),j>G[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(V)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=K[t[e]>>4],r+=K[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=t;let s="";switch(r){case Y.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case Y.CALL_EXCEPTION:case Y.INSUFFICIENT_FUNDS:case Y.MISSING_NEW:case Y.NONCE_EXPIRED:case Y.REPLACEMENT_UNDERPRICED:case Y.TRANSACTION_REPLACED:case Y.UNPREDICTABLE_GAS_LIMIT:s=r}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const a=new Error(t);return a.reason=o,a.code=r,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){Q&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Q})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return H||(H=new e("logger/5.7.0")),H}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),q){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}V=!!t,q=!!r}static setLogLevel(t){const r=G[t.toLowerCase()];null!=r?j=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};$.errors=Y,$.levels=X;const z=new $("bytes/5.7.0");function W(e){return!!e.toHexString}function J(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return J(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Z(e){return oe(e)&&!(e.length%2)||te(e)}function ee(e){return"number"==typeof e&&e==e&&e%1==0}function te(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!ee(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!ee(r)||r<0||r>=256)return!1}return!0}function re(e,t){if(t||(t={}),"number"==typeof e){z.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),J(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),W(e)&&(e=e.toHexString()),oe(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":z.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return J(new Uint8Array(n))}return te(e)?J(new Uint8Array(e)):z.throwArgumentError("invalid arrayify value","value",e)}function ne(e){const t=e.map((e=>re(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),J(n)}function ie(e){let t=re(e);if(0===t.length)return t;let r=0;for(;r<t.length&&0===t[r];)r++;return r&&(t=t.slice(r)),t}function oe(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const se="0123456789abcdef";function ae(e,t){if(t||(t={}),"number"==typeof e){z.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=se[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),W(e))return e.toHexString();if(oe(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":z.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(te(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=se[(240&n)>>4]+se[15&n]}return t}return z.throwArgumentError("invalid hexlify value","value",e)}function le(e){if("string"!=typeof e)e=ae(e);else if(!oe(e)||e.length%2)return null;return(e.length-2)/2}function ce(e,t,r){return"string"!=typeof e?e=ae(e):(!oe(e)||e.length%2)&&z.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function ue(e){let t="0x";return e.forEach((e=>{t+=ae(e).substring(2)})),t}function de(e){const t=function(e){"string"!=typeof e&&(e=ae(e));oe(e)||z.throwArgumentError("invalid hex string","value",e);e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}(ae(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function he(e,t){for("string"!=typeof e?e=ae(e):oe(e)||z.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&z.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function fe(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Z(e)){let r=re(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=ae(r.slice(0,32)),t.s=ae(r.slice(32,64))):65===r.length?(t.r=ae(r.slice(0,32)),t.s=ae(r.slice(32,64)),t.v=r[64]):z.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:z.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=ae(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=function(e,t){(e=re(e)).length>t&&z.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),J(r)}(re(t._vs),32);t._vs=ae(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&z.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=ae(r);null==t.s?t.s=i:t.s!==i&&z.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?z.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&z.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&oe(t.r)?t.r=he(t.r,32):z.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&oe(t.s)?t.s=he(t.s,32):z.throwArgumentError("signature missing or invalid s","signature",e);const r=re(t.s);r[0]>=128&&z.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=ae(r);t._vs&&(oe(t._vs)||z.throwArgumentError("signature invalid _vs","signature",e),t._vs=he(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&z.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}var pe=w.BN;const me=new $("bignumber/5.7.0"),ge={},Ee=9007199254740991;let ye=!1,Ae=class e{constructor(e,t){e!==ge&&me.throwError("cannot call constructor directly; use BigNumber.from",$.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return ve(we(this).fromTwos(e))}toTwos(e){return ve(we(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return ve(we(this).add(we(e)))}sub(e){return ve(we(this).sub(we(e)))}div(t){return e.from(t).isZero()&&Oe("division-by-zero","div"),ve(we(this).div(we(t)))}mul(e){return ve(we(this).mul(we(e)))}mod(e){const t=we(e);return t.isNeg()&&Oe("division-by-zero","mod"),ve(we(this).umod(t))}pow(e){const t=we(e);return t.isNeg()&&Oe("negative-power","pow"),ve(we(this).pow(t))}and(e){const t=we(e);return(this.isNegative()||t.isNeg())&&Oe("unbound-bitwise-result","and"),ve(we(this).and(t))}or(e){const t=we(e);return(this.isNegative()||t.isNeg())&&Oe("unbound-bitwise-result","or"),ve(we(this).or(t))}xor(e){const t=we(e);return(this.isNegative()||t.isNeg())&&Oe("unbound-bitwise-result","xor"),ve(we(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Oe("negative-width","mask"),ve(we(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Oe("negative-width","shl"),ve(we(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Oe("negative-width","shr"),ve(we(this).shrn(e))}eq(e){return we(this).eq(we(e))}lt(e){return we(this).lt(we(e))}lte(e){return we(this).lte(we(e))}gt(e){return we(this).gt(we(e))}gte(e){return we(this).gte(we(e))}isNegative(){return"-"===this._hex[0]}isZero(){return we(this).isZero()}toNumber(){try{return we(this).toNumber()}catch(e){Oe("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return me.throwError("this platform does not support BigInt",$.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ye||(ye=!0,me.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?me.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",$.errors.UNEXPECTED_ARGUMENT,{}):me.throwError("BigNumber.toString does not accept parameters",$.errors.UNEXPECTED_ARGUMENT,{})),we(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(ge,be(t)):t.match(/^-?[0-9]+$/)?new e(ge,be(new pe(t))):me.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Oe("underflow","BigNumber.from",t),(t>=Ee||t<=-Ee)&&Oe("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(te(r))return e.from(ae(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(oe(t)||"-"===t[0]&&oe(t.substring(1))))return e.from(t)}return me.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function be(e){if("string"!=typeof e)return be(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&me.throwArgumentError("invalid hex","value",e),"0x00"===(e=be(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function ve(e){return Ae.from(be(e))}function we(e){const t=Ae.from(e).toHexString();return"-"===t[0]?new pe("-"+t.substring(3),16):new pe(t.substring(2),16)}function Oe(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),me.throwError(e,$.errors.NUMERIC_FAULT,n)}var Ne=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const Te=new $("properties/5.7.0");function _e(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function Pe(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function Re(e){return Ne(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function De(e){const t={};for(const r in e)t[r]=e[r];return t}const Ie={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Ce(e){if(null==e||Ie[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!Ce(n))return!1}return!0}return Te.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Se(e){if(Ce(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>ke(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&_e(t,r,ke(n))}return t}return Te.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function ke(e){return Se(e)}let Be=class{constructor(e){for(const t in e)this[t]=ke(e[t])}};var xe=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const Le=new $("abstract-provider/5.7.0");class Fe extends Be{static isForkEvent(e){return!(!e||!e._isForkEvent)}}let Ue=class e{constructor(){Le.checkAbstract(new.target,e),_e(this,"_isProvider",!0)}getFeeData(){return xe(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield Re({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let r=null,n=null,i=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,i=Ae.from("1500000000"),n=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:r,maxFeePerGas:n,maxPriorityFeePerGas:i,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}};const Me=new $("networks/5.7.1");function qe(e){const t=function(t,r){null==r&&(r={});const n=[];if(t.InfuraProvider&&"-"!==r.infura)try{n.push(new t.InfuraProvider(e,r.infura))}catch(e){}if(t.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new t.EtherscanProvider(e,r.etherscan))}catch(e){}if(t.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new t.AlchemyProvider(e,r.alchemy))}catch(e){}if(t.PocketProvider&&"-"!==r.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(e,r.pocket);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(e){}}if(t.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new t.CloudflareProvider(e))}catch(e){}if(t.AnkrProvider&&"-"!==r.ankr)try{const i=["ropsten"],o=new t.AnkrProvider(e,r.ankr);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(e){}if(0===n.length)return null;if(t.FallbackProvider){let i=1;return null!=r.quorum?i=r.quorum:"homestead"===e&&(i=2),new t.FallbackProvider(n,i)}return n[0]};return t.renetwork=function(e){return qe(e)},t}function Ve(e,t){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return Ve(e,t)},r}const Ge={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:qe("homestead")},je={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:qe("ropsten")},He={chainId:63,name:"classicMordor",_defaultProvider:Ve("https://www.ethercluster.com/mordor","classicMordor")},Qe={unspecified:{chainId:0,name:"unspecified"},homestead:Ge,mainnet:Ge,morden:{chainId:2,name:"morden"},ropsten:je,testnet:je,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:qe("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:qe("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:qe("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:qe("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:Ve("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:He,classicTestnet:He,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Ve("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:qe("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:qe("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};class Xe{constructor(e){_e(this,"alphabet",e),_e(this,"base",e.length),_e(this,"_alphabetMap",{}),_e(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=re(e);if(0===t.length)return"";let r=[0];for(let e=0;e<t.length;++e){let n=t[e];for(let e=0;e<r.length;++e)n+=r[e]<<8,r[e]=n%this.base,n=n/this.base|0;for(;n>0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let e=0;0===t[e]&&e<t.length-1;++e)n+=this._leader;for(let e=r.length-1;e>=0;--e)n+=this.alphabet[r[e]];return n}decode(e){if("string"!=typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let r=0;r<e.length;r++){let n=this._alphabetMap[e[r]];if(void 0===n)throw new Error("Non-base"+this.base+" character");let i=n;for(let e=0;e<t.length;++e)i+=t[e]*this.base,t[e]=255&i,i>>=8;for(;i>0;)t.push(255&i),i>>=8}for(let r=0;e[r]===this._leader&&r<e.length-1;++r)t.push(0);return re(new Uint8Array(t.reverse()))}}new Xe("abcdefghijklmnopqrstuvwxyz234567");const Ye=new Xe("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Ke=Ae.from(0);function $e(e){return"0x"+v.keccak_256(re(e))}const ze=new $("strings/5.7.0");var We,Je;function Ze(e,t,r,n,i){if(e===Je.BAD_PREFIX||e===Je.UNEXPECTED_CONTINUE){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return e===Je.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(We||(We={})),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"}(Je||(Je={}));const et=Object.freeze({error:function(e,t,r,n,i){return ze.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:Ze,replace:function(e,t,r,n,i){return e===Je.OVERLONG?(n.push(i),0):(n.push(65533),Ze(e,t,r))}});function tt(e,t){null==t&&(t=et.error),e=re(e);const r=[];let n=0;for(;n<e.length;){const i=e[n++];if(!(i>>7)){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=t(128==(192&i)?Je.UNEXPECTED_CONTINUE:Je.BAD_PREFIX,n-1,e,r);continue}o=3,s=65535}if(n-1+o>=e.length){n+=t(Je.OVERRUN,n-1,e,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=e[n];if(128!=(192&i)){n+=t(Je.MISSING_CONTINUE,n,e,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=t(Je.OUT_OF_RANGE,n-1-o,e,r,a):a>=55296&&a<=57343?n+=t(Je.UTF16_SURROGATE,n-1-o,e,r,a):a<=s?n+=t(Je.OVERLONG,n-1-o,e,r,a):r.push(a))}return r}function rt(e,t=We.current){t!=We.current&&(ze.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return re(r)}function nt(e,t){return tt(e,t).map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function it(e){return $e(rt(e))}const ot="hash/5.7.0";function st(e,t){null==t&&(t=1);const r=[],n=r.forEach,i=function(e,t){n.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):r.push(e)}))};return i(e,t),r}function at(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,o=[0,1];for(let e=1;e<n;e++)o.push(i+=r());let s=r(),a=t;t+=s;let l=0,c=0;function u(){return 0==l&&(c=c<<8|e[t++],l=8),c>>--l&1}const d=Math.pow(2,31),h=d>>>1,f=h>>1,p=d-1;let m=0;for(let e=0;e<31;e++)m=m<<1|u();let g=[],E=0,y=d;for(;;){let e=Math.floor(((m-E+1)*i-1)/y),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e<o[n]?r=n:t=n}if(0==t)break;g.push(t);let s=E+Math.floor(y*o[t]/i),a=E+Math.floor(y*o[t+1]/i)-1;for(;!((s^a)&h);)m=m<<1&p|u(),s=s<<1&p,a=a<<1&p|1;for(;s&~a&f;)m=m&h|m<<1&p>>>1|u(),s=s<<1^h,a=(a^h)<<1|h|1;E=s,y=1+a-s}let A=n-4;return g.map((t=>{switch(t-A){case 3:return A+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return A+256+(e[a++]<<8|e[a++]);case 1:return A+e[a++];default:return t-1}}))}(e))}function lt(e){return 1&e?~e>>1:e>>1}function ct(e,t){let r=Array(e);for(let n=0,i=-1;n<e;n++)r[n]=i+=1+t();return r}function ut(e,t){let r=Array(e);for(let n=0,i=0;n<e;n++)r[n]=i+=lt(t());return r}function dt(e,t){let r=ct(e(),e),n=e(),i=ct(n,e),o=function(e,t){let r=Array(e);for(let n=0;n<e;n++)r[n]=1+t();return r}(n,e);for(let e=0;e<n;e++)for(let t=0;t<o[e];t++)r.push(i[e]+t);return t?r.map((e=>t[e])):r}function ht(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let i=0;i<t;i++)ut(e,r).forEach(((e,t)=>n[t].push(e)));return n}function ft(e,t){let r=1+t(),n=t(),i=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}(t);return st(ht(i.length,1+e,t).map(((e,t)=>{const o=e[0],s=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*n;return[o+t*r,s.map((e=>e+i))]}))})))}function pt(e,t){return ht(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const mt=at(function(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return re(t)}("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),gt=new Set(dt(mt)),Et=new Set(dt(mt)),yt=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(ft(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(pt(r,e))}return function(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[n[0]]=n[1]}return t}(st(t))}(mt),At=function(e){let t=dt(e).sort(((e,t)=>e-t));return function r(){let n=[];for(;;){let i=dt(e,t);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort(((e,t)=>t.set.size-e.set.size));let i=e(),o=i%3;i=i/3|0;let s=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:s,save:1==i,check:2==i}}()}(mt),bt=45,vt=95;function wt(e){return function(e,t=We.current){return tt(rt(e,t))}(e)}function Ot(e){return e.filter((e=>65039!=e))}function Nt(e){for(let t of e.split(".")){let e=wt(t);try{for(let t=e.lastIndexOf(vt)-1;t>=0;t--)if(e[t]!==vt)throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&e[2]===bt&&e[3]===bt)throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function Tt(e){return Nt(function(e,t){let r=wt(e).reverse(),n=[];for(;r.length;){let e=_t(r);if(e){n.push(...t(e));continue}let i=r.pop();if(gt.has(i)){n.push(i);continue}if(Et.has(i))continue;let o=yt[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...o)}return Nt((i=String.fromCodePoint(...n),i.normalize("NFC")));var i}(e,Ot))}function _t(e,t){var r;let n,i,o=At,s=[],a=e.length;for(;a;){let t=e[--a];if(o=null===(r=o.branches.find((e=>e.set.has(t))))||void 0===r?void 0:r.node,!o)break;if(o.save)i=t;else if(o.check&&t===i)break;s.push(t),o.fe0f&&(s.push(65039),a>0&&65039==e[a-1]&&a--),o.valid&&(n=s.slice(),2==o.valid&&n.splice(1,1),e.length=a)}return n}const Pt=new $(ot),Rt=new Uint8Array(32);function Dt(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function It(e){const t=rt(Tt(e)),r=[];if(0===e.length)return r;let n=0;for(let e=0;e<t.length;e++){46===t[e]&&(r.push(Dt(t.slice(n,e))),n=e+1)}if(n>=t.length)throw new Error("invalid ENS name; empty component");return r.push(Dt(t.slice(n))),r}function Ct(e){"string"!=typeof e&&Pt.throwArgumentError("invalid ENS name; not a string","name",e);let t=Rt;const r=It(e);for(;r.length;)t=$e(ne([t,$e(r.pop())]));return ae(t)}Rt.fill(0);let St=!1,kt=!1;const Bt={debug:1,default:2,info:2,warning:3,error:4,off:5};let xt=Bt.default,Lt=null;const Ft=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),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,Mt;!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"}(Mt||(Mt={}));const qt="0123456789abcdef";let Vt=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==Bt[r]&&this.throwArgumentError("invalid log level name","logLevel",e),xt>Bt[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(kt)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=qt[t[e]>>4],r+=qt[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=t;let s="";switch(r){case Mt.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case Mt.CALL_EXCEPTION:case Mt.INSUFFICIENT_FUNDS:case Mt.MISSING_NEW:case Mt.NONCE_EXPIRED:case Mt.REPLACEMENT_UNDERPRICED:case Mt.TRANSACTION_REPLACED:case Mt.UNPREDICTABLE_GAS_LIMIT:s=r}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const a=new Error(t);return a.reason=o,a.code=r,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){Ft&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Ft})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Lt||(Lt=new e("logger/5.7.0")),Lt}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),St){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}kt=!!t,St=!!r}static setLogLevel(t){const r=Bt[t.toLowerCase()];null!=r?xt=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};Vt.errors=Mt,Vt.levels=Ut;const Gt=new Vt("bytes/5.7.0");function jt(e){return!!e.toHexString}function Ht(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return Ht(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Qt(e){return"number"==typeof e&&e==e&&e%1==0}function Xt(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Qt(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Qt(r)||r<0||r>=256)return!1}return!0}function Yt(e,t){if(t||(t={}),"number"==typeof e){Gt.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),Ht(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),jt(e)&&(e=e.toHexString()),Kt(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Gt.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return Ht(new Uint8Array(n))}return Xt(e)?Ht(new Uint8Array(e)):Gt.throwArgumentError("invalid arrayify value","value",e)}function Kt(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const $t="0123456789abcdef";function zt(e,t){if(t||(t={}),"number"==typeof e){Gt.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=$t[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),jt(e))return e.toHexString();if(Kt(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Gt.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Xt(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=$t[(240&n)>>4]+$t[15&n]}return t}return Gt.throwArgumentError("invalid hexlify value","value",e)}var Wt=w.BN;const Jt=new Vt("bignumber/5.7.0"),Zt={},er=9007199254740991;let tr=!1,rr=class e{constructor(e,t){e!==Zt&&Jt.throwError("cannot call constructor directly; use BigNumber.from",Vt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return ir(or(this).fromTwos(e))}toTwos(e){return ir(or(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return ir(or(this).add(or(e)))}sub(e){return ir(or(this).sub(or(e)))}div(t){return e.from(t).isZero()&&sr("division-by-zero","div"),ir(or(this).div(or(t)))}mul(e){return ir(or(this).mul(or(e)))}mod(e){const t=or(e);return t.isNeg()&&sr("division-by-zero","mod"),ir(or(this).umod(t))}pow(e){const t=or(e);return t.isNeg()&&sr("negative-power","pow"),ir(or(this).pow(t))}and(e){const t=or(e);return(this.isNegative()||t.isNeg())&&sr("unbound-bitwise-result","and"),ir(or(this).and(t))}or(e){const t=or(e);return(this.isNegative()||t.isNeg())&&sr("unbound-bitwise-result","or"),ir(or(this).or(t))}xor(e){const t=or(e);return(this.isNegative()||t.isNeg())&&sr("unbound-bitwise-result","xor"),ir(or(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&sr("negative-width","mask"),ir(or(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&sr("negative-width","shl"),ir(or(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&sr("negative-width","shr"),ir(or(this).shrn(e))}eq(e){return or(this).eq(or(e))}lt(e){return or(this).lt(or(e))}lte(e){return or(this).lte(or(e))}gt(e){return or(this).gt(or(e))}gte(e){return or(this).gte(or(e))}isNegative(){return"-"===this._hex[0]}isZero(){return or(this).isZero()}toNumber(){try{return or(this).toNumber()}catch(e){sr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Jt.throwError("this platform does not support BigInt",Vt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?tr||(tr=!0,Jt.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Jt.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Vt.errors.UNEXPECTED_ARGUMENT,{}):Jt.throwError("BigNumber.toString does not accept parameters",Vt.errors.UNEXPECTED_ARGUMENT,{})),or(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(Zt,nr(t)):t.match(/^-?[0-9]+$/)?new e(Zt,nr(new Wt(t))):Jt.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&sr("underflow","BigNumber.from",t),(t>=er||t<=-er)&&sr("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(Xt(r))return e.from(zt(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Kt(t)||"-"===t[0]&&Kt(t.substring(1))))return e.from(t)}return Jt.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function nr(e){if("string"!=typeof e)return nr(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Jt.throwArgumentError("invalid hex","value",e),"0x00"===(e=nr(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function ir(e){return rr.from(nr(e))}function or(e){const t=rr.from(e).toHexString();return"-"===t[0]?new Wt("-"+t.substring(3),16):new Wt(t.substring(2),16)}function sr(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Jt.throwError(e,Vt.errors.NUMERIC_FAULT,n)}function ar(e){return"0x"+v.keccak_256(Yt(e))}const lr=new Vt("rlp/5.7.0");function cr(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function ur(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(ur(e))})),t.length<=55)return t.unshift(192+t.length),t;const r=cr(t.length);return r.unshift(247+r.length),r.concat(t)}var t;Kt(t=e)&&!(t.length%2)||Xt(t)||lr.throwArgumentError("RLP object must be BytesLike","object",e);const r=Array.prototype.slice.call(Yt(e));if(1===r.length&&r[0]<=127)return r;if(r.length<=55)return r.unshift(128+r.length),r;const n=cr(r.length);return n.unshift(183+n.length),n.concat(r)}const dr=new Vt("address/5.7.0");function hr(e){Kt(e,20)||dr.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let e=0;e<40;e++)r[e]=t[e].charCodeAt(0);const n=Yt(ar(r));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 fr={};for(let e=0;e<10;e++)fr[String(e)]=String(e);for(let e=0;e<26;e++)fr[String.fromCharCode(65+e)]=String(10+e);const pr=Math.floor((mr=9007199254740991,Math.log10?Math.log10(mr):Math.log(mr)/Math.LN10));var mr;function gr(e){let t=null;if("string"!=typeof e&&dr.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=hr(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&dr.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==function(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>fr[e])).join("");for(;t.length>=pr;){let e=t.substring(0,pr);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}(e)&&dr.throwArgumentError("bad icap checksum","address",e),r=e.substring(4),t=new Wt(r,36).toString(16);t.length<40;)t="0"+t;t=hr("0x"+t)}else dr.throwArgumentError("invalid address","address",e);var r;return t}function Er(e){let t=null;try{t=gr(e.from)}catch(t){dr.throwArgumentError("missing from address","transaction",e)}const r=function(e){let t=Yt(e);if(0===t.length)return t;let r=0;for(;r<t.length&&0===t[r];)r++;return r&&(t=t.slice(r)),t}(Yt(rr.from(e.nonce).toHexString()));return gr((n=ar(zt(ur([t,r]))),i=12,"string"!=typeof n?n=zt(n):(!Kt(n)||n.length%2)&&Gt.throwArgumentError("invalid hexData","value",n),i=2+2*i,"0x"+n.substring(i)));var n,i}var yr=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const Ar=new $(ot),br=new Uint8Array(32);br.fill(0);const vr=Ae.from(-1),wr=Ae.from(0),Or=Ae.from(1),Nr=Ae.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Tr=he(Or.toHexString(),32),_r=he(wr.toHexString(),32),Pr={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Rr=["name","version","chainId","verifyingContract","salt"];function Dr(e){return function(t){return"string"!=typeof t&&Ar.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const Ir={name:Dr("name"),version:Dr("version"),chainId:function(e){try{return Ae.from(e).toString()}catch(e){}return Ar.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return gr(e).toLowerCase()}catch(e){}return Ar.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=re(e);if(32!==t.length)throw new Error("bad length");return ae(t)}catch(e){}return Ar.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function Cr(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const r=""===t[1],n=parseInt(t[2]||"256");(n%8!=0||n>256||t[2]&&t[2]!==String(n))&&Ar.throwArgumentError("invalid numeric width","type",e);const i=Nr.mask(r?n-1:n),o=r?i.add(Or).mul(vr):wr;return function(t){const r=Ae.from(t);return(r.lt(o)||r.gt(i))&&Ar.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),he(r.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&Ar.throwArgumentError("invalid bytes width","type",e),function(t){return re(t).length!==r&&Ar.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=re(e),r=t.length%32;return r?ue([t,br.slice(r)]):ae(t)}(t)}}}switch(e){case"address":return function(e){return he(gr(e),32)};case"bool":return function(e){return e?Tr:_r};case"bytes":return function(e){return $e(e)};case"string":return function(e){return it(e)}}return null}function Sr(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class kr{constructor(e){_e(this,"types",Object.freeze(ke(e))),_e(this,"_encoderCache",{}),_e(this,"_types",{});const t={},r={},n={};Object.keys(e).forEach((e=>{t[e]={},r[e]=[],n[e]={}}));for(const n in e){const i={};e[n].forEach((o=>{i[o.name]&&Ar.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",e),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&Ar.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e);Cr(s)||(r[s]||Ar.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",e),r[s].push(n),t[n][s]=!0)}))}const i=Object.keys(r).filter((e=>0===r[e].length));0===i.length?Ar.throwArgumentError("missing primary type","types",e):i.length>1&&Ar.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),_e(this,"primaryType",i[0]),function i(o,s){s[o]&&Ar.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e),s[o]=!0,Object.keys(t[o]).forEach((e=>{r[e]&&(i(e,s),Object.keys(s).forEach((t=>{n[t][e]=!0})))})),delete s[o]}(this.primaryType,{});for(const t in n){const r=Object.keys(n[t]);r.sort(),this._types[t]=Sr(t,e[t])+r.map((t=>Sr(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=Cr(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],r=this.getEncoder(e),n=parseInt(t[3]);return t=>{n>=0&&t.length!==n&&Ar.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(r);return this._types[e]&&(i=i.map($e)),$e(ue(i))}}const r=this.types[e];if(r){const t=it(this._types[e]);return e=>{const n=r.map((({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this._types[r]?$e(n):n}));return n.unshift(t),ue(n)}}return Ar.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Ar.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return $e(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(Cr(e))return r(e,t);const n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const e=n[1],i=parseInt(n[3]);return i>=0&&t.length!==i&&Ar.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,r)))}const i=this.types[e];return i?i.reduce(((e,{name:n,type:i})=>(e[n]=this._visit(i,t[n],r),e)),{}):Ar.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new kr(e)}static getPrimaryType(e){return kr.from(e).primaryType}static hashStruct(e,t,r){return kr.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const n=Pr[r];n||Ar.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort(((e,t)=>Rr.indexOf(e.name)-Rr.indexOf(t.name))),kr.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return ue(["0x1901",kr.hashDomain(e),kr.from(t).hash(r)])}static hash(e,t,r){return $e(kr.encode(e,t,r))}static resolveNames(e,t,r,n){return yr(this,void 0,void 0,(function*(){e=De(e);const i={};e.verifyingContract&&!oe(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=kr.from(t);o.visit(r,((e,t)=>("address"!==e||oe(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield n(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=o.visit(r,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:r}}))}static getPayload(e,t,r){kr.hashDomain(e);const n={},i=[];Rr.forEach((t=>{const r=e[t];null!=r&&(n[t]=Ir[t](r),i.push({name:t,type:Pr[t]}))}));const o=kr.from(t),s=De(t);return s.EIP712Domain?Ar.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):s.EIP712Domain=i,o.encode(r),{types:s,domain:n,primaryType:o.primaryType,message:o.visit(r,((e,t)=>{if(e.match(/^bytes(\d*)/))return ae(re(t));if(e.match(/^u?int/))return Ae.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&Ar.throwArgumentError("invalid string","value",t),t}return Ar.throwArgumentError("unsupported type","type",e)}))}}}function Br(e){return"0x"+O.sha256().update(re(e)).digest("hex")}let xr=!1,Lr=!1;const Fr={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ur=Fr.default,Mr=null;const qr=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),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 Vr,Gr;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(Vr||(Vr={})),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"}(Gr||(Gr={}));const jr="0123456789abcdef";let Hr=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==Fr[r]&&this.throwArgumentError("invalid log level name","logLevel",e),Ur>Fr[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(Lr)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=jr[t[e]>>4],r+=jr[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=t;let s="";switch(r){case Gr.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case Gr.CALL_EXCEPTION:case Gr.INSUFFICIENT_FUNDS:case Gr.MISSING_NEW:case Gr.NONCE_EXPIRED:case Gr.REPLACEMENT_UNDERPRICED:case Gr.TRANSACTION_REPLACED:case Gr.UNPREDICTABLE_GAS_LIMIT:s=r}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const a=new Error(t);return a.reason=o,a.code=r,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){qr&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:qr})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Mr||(Mr=new e("logger/5.7.0")),Mr}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),xr){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Lr=!!t,xr=!!r}static setLogLevel(t){const r=Fr[t.toLowerCase()];null!=r?Ur=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};Hr.errors=Gr,Hr.levels=Vr;const Qr=new Hr("bytes/5.7.0");function Xr(e){return!!e.toHexString}function Yr(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return Yr(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Kr(e){return"number"==typeof e&&e==e&&e%1==0}function $r(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Kr(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Kr(r)||r<0||r>=256)return!1}return!0}function zr(e,t){if(t||(t={}),"number"==typeof e){Qr.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),Yr(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Xr(e)&&(e=e.toHexString()),Wr(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Qr.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return Yr(new Uint8Array(n))}return $r(e)?Yr(new Uint8Array(e)):Qr.throwArgumentError("invalid arrayify value","value",e)}function Wr(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))}const Jr="0123456789abcdef";function Zr(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return zr(t)}function en(e){e=zr(e);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function tn(e){const t={};for(const r in e)t[r]=e[r];return t}const rn=new Hr("strings/5.7.0");var nn,on;function sn(e,t,r,n,i){if(e===on.BAD_PREFIX||e===on.UNEXPECTED_CONTINUE){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return e===on.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(nn||(nn={})),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"}(on||(on={}));const an=Object.freeze({error:function(e,t,r,n,i){return rn.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:sn,replace:function(e,t,r,n,i){return e===on.OVERLONG?(n.push(i),0):(n.push(65533),sn(e,t,r))}});function ln(e,t=nn.current){t!=nn.current&&(rn.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return zr(r)}function cn(e,t){return r=function(e,t){null==t&&(t=an.error),e=zr(e);const r=[];let n=0;for(;n<e.length;){const i=e[n++];if(!(i>>7)){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=t(128==(192&i)?on.UNEXPECTED_CONTINUE:on.BAD_PREFIX,n-1,e,r);continue}o=3,s=65535}if(n-1+o>=e.length){n+=t(on.OVERRUN,n-1,e,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=e[n];if(128!=(192&i)){n+=t(on.MISSING_CONTINUE,n,e,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=t(on.OUT_OF_RANGE,n-1-o,e,r,a):a>=55296&&a<=57343?n+=t(on.UTF16_SURROGATE,n-1-o,e,r,a):a<=s?n+=t(on.OVERLONG,n-1-o,e,r,a):r.push(a))}return r}(e,t),r.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("");var r}var un=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};function dn(e,t){return un(this,void 0,void 0,(function*(){null==t&&(t={});const r={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(r.mode=e.mode),e.cache&&(r.cache=e.cache),e.credentials&&(r.credentials=e.credentials),e.redirect&&(r.redirect=e.redirect),e.referrer&&(r.referrer=e.referrer)}const n=yield fetch(e,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach(((e,t)=>{o[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{o[e.toLowerCase()]=n.headers.get(e)})),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:zr(new Uint8Array(i))}}))}var hn=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const fn=new Hr("web/5.7.1");function pn(e){return new Promise((t=>{setTimeout(t,e)}))}function mn(e,t){if(null==e)return null;if("string"==typeof e)return e;if(function(e){return Wr(e)&&!(e.length%2)||$r(e)}(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return cn(e)}catch(e){}return function(e,t){if(t||(t={}),"number"==typeof e){Qr.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Jr[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Xr(e))return e.toHexString();if(Wr(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Qr.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if($r(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Jr[(240&n)>>4]+Jr[15&n]}return t}return Qr.throwArgumentError("invalid hexlify value","value",e)}(e)}return e}function gn(e,t,r){let n=null;if(null!=t){n=ln(t);const r="string"==typeof e?{url:e}:tn(e);if(r.headers){0!==Object.keys(r.headers).filter((e=>"content-type"===e.toLowerCase())).length||(r.headers=tn(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return function(e,t,r){const n="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;fn.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"==typeof e?e.throttleCallback:null,o="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;fn.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s="object"==typeof e&&!!e.errorPassThrough,a={};let l=null;const c={method:"GET"};let u=!1,d=12e4;if("string"==typeof e)l=e;else if("object"==typeof e){if(null!=e&&null!=e.url||fn.throwArgumentError("missing URL","connection.url",e),l=e.url,"number"==typeof e.timeout&&e.timeout>0&&(d=e.timeout),e.headers)for(const t in e.headers)a[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(u=!0);if(c.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==l.substring(0,6)&&!0!==e.allowInsecureAuthentication&&fn.throwError("basic authentication requires a secure https url",Hr.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;a.authorization={key:"Authorization",value:"Basic "+en(ln(t))}}null!=e.skipFetchSetup&&(c.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(c.fetchOptions=tn(e.fetchOptions))}const h=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=l?l.match(h):null;if(f)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?Zr(f[3]):(p=f[3],ln(p.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){fn.throwError("processing response error",Hr.errors.SERVER_ERROR,{body:mn(f[1],f[2]),error:e,requestBody:null,requestMethod:"GET",url:l})}var p;t&&(c.method="POST",c.body=t,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(t.length)}));const m={};Object.keys(a).forEach((e=>{const t=a[e];m[t.key]=t.value})),c.headers=m;const g=function(){let e=null;return{promise:new Promise((function(t,r){d&&(e=setTimeout((()=>{null!=e&&(e=null,r(fn.makeError("timeout",Hr.errors.TIMEOUT,{requestBody:mn(c.body,m["content-type"]),requestMethod:c.method,timeout:d,url:l})))}),d))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),E=function(){return hn(this,void 0,void 0,(function*(){for(let e=0;e<n;e++){let t=null;try{if(t=yield dn(l,c),e<n)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===c.method&&e.match(/^https:/)){l=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(i&&(r=yield i(e,l)),r){let r=0;const n=t.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):o*parseInt(String(Math.random()*Math.pow(2,e))),yield pn(r);continue}}}catch(e){t=e.response,null==t&&(g.cancel(),fn.throwError("missing response",Hr.errors.SERVER_ERROR,{requestBody:mn(c.body,m["content-type"]),requestMethod:c.method,serverError:e,url:l}))}let a=t.body;if(u&&304===t.statusCode?a=null:!s&&(t.statusCode<200||t.statusCode>=300)&&(g.cancel(),fn.throwError("bad response",Hr.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:mn(a,t.headers?t.headers["content-type"]:null),requestBody:mn(c.body,m["content-type"]),requestMethod:c.method,url:l})),r)try{const e=yield r(a,t);return g.cancel(),e}catch(r){if(r.throttleRetry&&e<n){let t=!0;if(i&&(t=yield i(e,l)),t){const t=o*parseInt(String(Math.random()*Math.pow(2,e)));yield pn(t);continue}}g.cancel(),fn.throwError("processing response error",Hr.errors.SERVER_ERROR,{body:mn(a,t.headers?t.headers["content-type"]:null),error:r,requestBody:mn(c.body,m["content-type"]),requestMethod:c.method,url:l})}return g.cancel(),a}return fn.throwError("failed response",Hr.errors.SERVER_ERROR,{requestBody:mn(c.body,m["content-type"]),requestMethod:c.method,url:l})}))}();return Promise.race([g.promise,E])}(e,n,((e,t)=>{let n=null;if(null!=e)try{n=JSON.parse(cn(e))}catch(t){fn.throwError("invalid JSON",Hr.errors.SERVER_ERROR,{body:e,error:t})}return r&&(n=r(n,t)),n}))}function En(e,t){return t||(t={}),null==(t=tn(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,n){let i=null,o=!1;const s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{s()&&n(new Error("timeout"))}),t.timeout));const a=t.retryLimit;let l=0;!function i(){return e().then((function(e){if(void 0!==e)s()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!o){if(l++,l>a)return void(s()&&n(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,l)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){s()&&n(e)}))}()}))}const yn="providers/5.7.2",An=new $("rlp/5.7.0");function bn(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function vn(e,t,r){let n=0;for(let i=0;i<r;i++)n=256*n+e[t+i];return n}function wn(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(wn(e))})),t.length<=55)return t.unshift(192+t.length),t;const r=bn(t.length);return r.unshift(247+r.length),r.concat(t)}Z(e)||An.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(re(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=bn(t.length);return r.unshift(183+r.length),r.concat(t)}function On(e){return ae(wn(e))}function Nn(e,t,r,n){const i=[];for(;r<t+1+n;){const o=Tn(e,r);i.push(o.result),(r+=o.consumed)>t+1+n&&An.throwError("child data too short",$.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function Tn(e,t){if(0===e.length&&An.throwError("data too short",$.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&An.throwError("data short segment too short",$.errors.BUFFER_OVERRUN,{});const n=vn(e,t+1,r);return t+1+r+n>e.length&&An.throwError("data long segment too short",$.errors.BUFFER_OVERRUN,{}),Nn(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&An.throwError("data array too short",$.errors.BUFFER_OVERRUN,{}),Nn(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&An.throwError("data array too short",$.errors.BUFFER_OVERRUN,{});const n=vn(e,t+1,r);t+1+r+n>e.length&&An.throwError("data array too short",$.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:ae(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&An.throwError("data too short",$.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:ae(e.slice(t+1,t+1+r))}}return{consumed:1,result:ae(e[t])}}function _n(e){const t=re(e),r=Tn(t,0);return r.consumed!==t.length&&An.throwArgumentError("invalid rlp data","data",e),r.result}function Pn(e,t,r){return r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},e(r,r.exports),r.exports}var Rn=Dn;function Dn(e,t){if(!e)throw new Error(t||"Assertion failed")}Dn.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var In=Pn((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),Cn=Pn((function(e,t){var r=t;r.assert=Rn,r.toArray=In.toArray,r.zero2=In.zero2,r.toHex=In.toHex,r.encode=In.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<<t+1,o=e.clone(),s=0;s<n.length;s++){var a,l=o.andln(i-1);o.isOdd()?(a=l>(i>>1)-1?(i>>1)-l:l,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,l=e.andln(3)+i&3,c=t.andln(3)+o&3;3===l&&(l=-1),3===c&&(c=-1),s=1&l?3!==(n=e.andln(7)+i&7)&&5!==n||2!==c?l:-l:0,r[0].push(s),a=1&c?3!==(n=t.andln(7)+o&7)&&5!==n||2!==l?c:-c:0,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new w(e,"hex","le")}})),Sn=Cn.getNAF,kn=Cn.getJSF,Bn=Cn.assert;function xn(e,t){this.type=e,this.p=new w(t.p,16),this.red=t.prime?w.red(t.prime):w.mont(this.p),this.zero=new w(0).toRed(this.red),this.one=new w(1).toRed(this.red),this.two=new w(2).toRed(this.red),this.n=t.n&&new w(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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 r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ln=xn;function Fn(e,t){this.curve=e,this.type=t,this.precomputed=null}xn.prototype.point=function(){throw new Error("Not implemented")},xn.prototype.validate=function(){throw new Error("Not implemented")},xn.prototype._fixedNafMul=function(e,t){Bn(e.precomputed);var r=e._getDoubles(),n=Sn(t,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var o,s,a=[];for(o=0;o<n.length;o+=r.step){s=0;for(var l=o+r.step-1;l>=o;l--)s=(s<<1)+n[l];a.push(s)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o<a.length;o++)(s=a[o])===d?u=u.mixedAdd(r.points[o]):s===-d&&(u=u.mixedAdd(r.points[o].neg()));c=c.add(u)}return c.toP()},xn.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=Sn(t,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var l=0;a>=0&&0===o[a];a--)l++;if(a>=0&&l++,s=s.dblp(l),a<0)break;var c=o[a];Bn(0!==c),s="affine"===e.type?c>0?s.mixedAdd(i[c-1>>1]):s.mixedAdd(i[-c-1>>1].neg()):c>0?s.add(i[c-1>>1]):s.add(i[-c-1>>1].neg())}return"affine"===e.type?s.toP():s},xn.prototype._wnafMulAdd=function(e,t,r,n,i){var o,s,a,l=this._wnafT1,c=this._wnafT2,u=this._wnafT3,d=0;for(o=0;o<n;o++){var h=(a=t[o])._getNAFPoints(e);l[o]=h.wnd,c[o]=h.points}for(o=n-1;o>=1;o-=2){var f=o-1,p=o;if(1===l[f]&&1===l[p]){var m=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(m[1]=t[f].add(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].add(t[p].neg())):(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],E=kn(r[f],r[p]);for(d=Math.max(E[0].length,d),u[f]=new Array(d),u[p]=new Array(d),s=0;s<d;s++){var y=0|E[0][s],A=0|E[1][s];u[f][s]=g[3*(y+1)+(A+1)],u[p][s]=0,c[f]=m}}else u[f]=Sn(r[f],l[f],this._bitLength),u[p]=Sn(r[p],l[p],this._bitLength),d=Math.max(u[f].length,d),d=Math.max(u[p].length,d)}var b=this.jpoint(null,null,null),v=this._wnafT4;for(o=d;o>=0;o--){for(var w=0;o>=0;){var O=!0;for(s=0;s<n;s++)v[s]=0|u[s][o],0!==v[s]&&(O=!1);if(!O)break;w++,o--}if(o>=0&&w++,b=b.dblp(w),o<0)break;for(s=0;s<n;s++){var N=v[s];0!==N&&(N>0?a=c[s][N-1>>1]:N<0&&(a=c[s][-N-1>>1].neg()),b="affine"===a.type?b.mixedAdd(a):b.add(a))}}for(o=0;o<n;o++)c[o]=null;return i?b:b.toP()},xn.BasePoint=Fn,Fn.prototype.eq=function(){throw new Error("Not implemented")},Fn.prototype.validate=function(){return this.curve.validate(this)},xn.prototype.decodePoint=function(e,t){e=Cn.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?Bn(e[e.length-1]%2==0):7===e[0]&&Bn(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},Fn.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Fn.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Fn.prototype.encode=function(e,t){return Cn.encode(this._encode(t),e)},Fn.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Fn.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Fn.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)n=n.dbl();r.push(n)}return{step:e,points:r}},Fn.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},Fn.prototype._getBeta=function(){return null},Fn.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var Un=Pn((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),Mn=Cn.assert;function qn(e){Ln.call(this,"short",e),this.a=new w(e.a,16).toRed(this.red),this.b=new w(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)}Un(qn,Ln);var Vn=qn;function Gn(e,t,r,n){Ln.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new w(t,16),this.y=new w(r,16),n&&(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 jn(e,t,r,n){Ln.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new w(0)):(this.x=new w(t,16),this.y=new w(r,16),this.z=new w(n,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}qn.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new w(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new w(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],Mn(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new w(e.a,16),b:new w(e.b,16)}})):this._getEndoBasis(r)}}},qn.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:w.mont(e),r=new w(2).toRed(t).redInvm(),n=r.redNeg(),i=new w(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},qn.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,s,a,l,c,u=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),f=new w(1),p=new w(0),m=new w(0),g=new w(1),E=0;0!==d.cmpn(0);){var y=h.div(d);l=h.sub(y.mul(d)),c=m.sub(y.mul(f));var A=g.sub(y.mul(p));if(!n&&l.cmp(u)<0)t=a.neg(),r=f,n=l.neg(),i=c;else if(n&&2==++E)break;a=l,h=d,d=l,m=f,f=c,g=p,p=A}o=l.neg(),s=c;var b=n.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(b)>=0&&(o=t,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},qn.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),l=i.mul(r.b),c=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:l.add(c).neg()}},qn.prototype.pointFromX=function(e,t){(e=new w(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},qn.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},qn.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var s=this._endoSplit(t[o]),a=e[o],l=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),l=l.neg(!0)),n[2*o]=a,n[2*o+1]=l,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var c=this._wnafMulAdd(1,n,i,2*o,r),u=0;u<2*o;u++)n[u]=null,i[u]=null;return c},Un(Gn,Ln.BasePoint),qn.prototype.point=function(e,t,r){return new Gn(this,e,t,r)},qn.prototype.pointFromJSON=function(e,t){return Gn.fromJSON(this,e,t)},Gn.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Gn.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Gn.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var o=t[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},Gn.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Gn.prototype.isInfinity=function(){return this.inf},Gn.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 t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Gn.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 t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},Gn.prototype.getX=function(){return this.x.fromRed()},Gn.prototype.getY=function(){return this.y.fromRed()},Gn.prototype.mul=function(e){return e=new w(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)},Gn.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},Gn.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},Gn.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))},Gn.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Gn.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Un(jn,Ln.BasePoint),qn.prototype.jpoint=function(e,t,r){return new jn(this,e,t,r)},jn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},jn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jn.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),l=o.redSub(s);if(0===a.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),d=n.redMul(c),h=l.redSqr().redIAdd(u).redISub(d).redISub(d),f=l.redMul(d.redISub(h)).redISub(o.redMul(u)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,f,p)},jn.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=s.redSqr(),c=l.redMul(s),u=r.redMul(l),d=a.redSqr().redIAdd(c).redISub(u).redISub(u),h=a.redMul(u.redISub(d)).redISub(i.redMul(c)),f=this.z.redMul(s);return this.curve.jpoint(d,h,f)},jn.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,l=a.redSqr().redSqr(),c=s.redAdd(s);for(t=0;t<e;t++){var u=o.redSqr(),d=c.redSqr(),h=d.redSqr(),f=u.redAdd(u).redIAdd(u).redIAdd(n.redMul(l)),p=o.redMul(d),m=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),E=f.redMul(g);E=E.redIAdd(E).redISub(h);var y=c.redMul(a);t+1<e&&(l=l.redMul(h)),o=m,a=y,c=E}return this.curve.jpoint(o,c.redMul(i),a)},jn.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},jn.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),l=a.redSqr().redISub(s).redISub(s),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=l,t=a.redMul(s.redISub(l)).redISub(c),r=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),f=this.x.redAdd(d).redSqr().redISub(u).redISub(h);f=f.redIAdd(f);var p=u.redAdd(u).redIAdd(u),m=p.redSqr(),g=h.redIAdd(h);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},jn.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),l=a.redSqr().redISub(s).redISub(s);e=l;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(s.redISub(l)).redISub(c),r=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),f=this.x.redSub(u).redMul(this.x.redAdd(u));f=f.redAdd(f).redIAdd(f);var p=h.redIAdd(h),m=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(u);var g=d.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=f.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},jn.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=t.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),l=t.redAdd(t),c=(l=l.redIAdd(l)).redMul(s),u=a.redSqr().redISub(c.redAdd(c)),d=c.redISub(u),h=s.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=a.redMul(d).redISub(h),p=r.redAdd(r).redMul(n);return this.curve.jpoint(u,f,p)},jn.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),s=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),l=n.redIAdd(n);l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var c=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(l),u=t.redMul(c);u=(u=u.redIAdd(u)).redIAdd(u);var d=this.x.redMul(a).redISub(u);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(c.redMul(l.redISub(c)).redISub(s.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(d,h,f)},jn.prototype.mul=function(e,t){return e=new w(e,t),this.curve._wnafMul(this,e)},jn.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},jn.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},jn.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},jn.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Hn=Pn((function(e,t){var r=t;r.base=Ln,r.short=Vn,r.mont=null,r.edwards=null})),Qn=Pn((function(e,t){var r,n=t,i=Cn.assert;function o(e){"short"===e.type?this.curve=new Hn.short(e):"edwards"===e.type?this.curve=new Hn.edwards(e):this.curve=new Hn.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 s(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new o(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,s("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:O.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("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:O.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("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:O.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("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:O.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"]}),s("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:O.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"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:O.sha256,gRed:!1,g:["9"]}),s("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:O.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=void 0}s("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:O.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function Xn(e){if(!(this instanceof Xn))return new Xn(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 t=In.toArray(e.entropy,e.entropyEnc||"hex"),r=In.toArray(e.nonce,e.nonceEnc||"hex"),n=In.toArray(e.pers,e.persEnc||"hex");Rn(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Yn=Xn;Xn.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Xn.prototype._hmac=function(){return new O.hmac(this.hash,this.K)},Xn.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Xn.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=In.toArray(e,t),r=In.toArray(r,n),Rn(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},Xn.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=In.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(r),this._reseed++,In.encode(o,t)};var Kn=Cn.assert;function $n(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var zn=$n;$n.fromPublic=function(e,t,r){return t instanceof $n?t:new $n(e,{pub:t,pubEnc:r})},$n.fromPrivate=function(e,t,r){return t instanceof $n?t:new $n(e,{priv:t,privEnc:r})},$n.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"}},$n.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},$n.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},$n.prototype._importPrivate=function(e,t){this.priv=new w(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},$n.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Kn(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Kn(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,t)},$n.prototype.derive=function(e){return e.validate()||Kn(e.validate(),"public point not validated"),e.mul(this.priv).getX()},$n.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},$n.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},$n.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Wn=Cn.assert;function Jn(e,t){if(e instanceof Jn)return e;this._importDER(e,t)||(Wn(e.r&&e.s,"Signature without r or s"),this.r=new w(e.r,16),this.s=new w(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var Zn=Jn;function ei(){this.place=0}function ti(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=t.place;o<n;o++,s++)i<<=8,i|=e[s],i>>>=0;return!(i<=127)&&(t.place=s,i)}function ri(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function ni(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Jn.prototype._importDER=function(e,t){e=Cn.toArray(e,t);var r=new ei;if(48!==e[r.place++])return!1;var n=ti(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=ti(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var s=ti(e,r);if(!1===s)return!1;if(e.length!==s+r.place)return!1;var a=e.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new w(o),this.s=new w(a),this.recoveryParam=null,!0},Jn.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=ri(t),r=ri(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];ni(n,t.length),(n=n.concat(t)).push(2),ni(n,r.length);var i=n.concat(r),o=[48];return ni(o,i.length),o=o.concat(i),Cn.encode(o,e)};var ii=function(){throw new Error("unsupported")},oi=Cn.assert;function si(e){if(!(this instanceof si))return new si(e);"string"==typeof e&&(oi(Object.prototype.hasOwnProperty.call(Qn,e),"Unknown curve "+e),e=Qn[e]),e instanceof Qn.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}var ai=si;si.prototype.keyPair=function(e){return new zn(this,e)},si.prototype.keyFromPrivate=function(e,t){return zn.fromPrivate(this,e,t)},si.prototype.keyFromPublic=function(e,t){return zn.fromPublic(this,e,t)},si.prototype.genKeyPair=function(e){e||(e={});for(var t=new Yn({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||ii(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new w(2));;){var i=new w(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},si.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},si.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new w(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),s=e.toArray("be",i),a=new Yn({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),l=this.n.sub(new w(1)),c=0;;c++){var u=n.k?n.k(c):new w(a.generate(this.n.byteLength()));if(!((u=this._truncateToN(u,!0)).cmpn(1)<=0||u.cmp(l)>=0)){var d=this.g.mul(u);if(!d.isInfinity()){var h=d.getX(),f=h.umod(this.n);if(0!==f.cmpn(0)){var p=u.invm(this.n).mul(f.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==h.cmp(f)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new Zn({r:f,s:p,recoveryParam:m})}}}}}},si.prototype.verify=function(e,t,r,n){e=this._truncateToN(new w(e,16)),r=this.keyFromPublic(r,n);var i=(t=new Zn(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),l=a.mul(e).umod(this.n),c=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(l,r.getPublic(),c)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(l,r.getPublic(),c)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},si.prototype.recoverPubKey=function(e,t,r,n){oi((3&r)===r,"The recovery param is more than two bits"),t=new Zn(t,n);var i=this.n,o=new w(e),s=t.r,a=t.s,l=1&r,c=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");s=c?this.curve.pointFromX(s.add(this.curve.n),l):this.curve.pointFromX(s,l);var u=t.r.invm(i),d=i.sub(o).mul(u).umod(i),h=a.mul(u).umod(i);return this.g.mulAdd(d,s,h)},si.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new Zn(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var li=Pn((function(e,t){var r=t;r.version="6.5.4",r.utils=Cn,r.rand=function(){throw new Error("unsupported")},r.curve=Hn,r.curves=Qn,r.ec=ai,r.eddsa=null})).ec;const ci=new $("signing-key/5.7.0");let ui=null;function di(){return ui||(ui=new li("secp256k1")),ui}class hi{constructor(e){_e(this,"curve","secp256k1"),_e(this,"privateKey",ae(e)),32!==le(this.privateKey)&&ci.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=di().keyFromPrivate(re(this.privateKey));_e(this,"publicKey","0x"+t.getPublic(!1,"hex")),_e(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),_e(this,"_isSigningKey",!0)}_addPoint(e){const t=di().keyFromPublic(re(this.publicKey)),r=di().keyFromPublic(re(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=di().keyFromPrivate(re(this.privateKey)),r=re(e);32!==r.length&&ci.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return fe({recoveryParam:n.recoveryParam,r:he("0x"+n.r.toString(16),32),s:he("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=di().keyFromPrivate(re(this.privateKey)),r=di().keyFromPublic(re(fi(e)));return he("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function fi(e,t){const r=re(e);if(32===r.length){return new hi(r).publicKey}return 33===r.length?"0x"+di().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?ae(r):ci.throwArgumentError("invalid public or private key","key","[REDACTED]")}const pi=new $("transactions/5.7.0");var mi;function gi(e){return"0x"===e?null:gr(e)}function Ei(e){return"0x"===e?Ke:Ae.from(e)}function yi(e,t){return function(e){return gr(ce($e(ce(fi(e),1)),12))}(function(e,t){const r=fe(t),n={r:re(r.r),s:re(r.s)};return"0x"+di().recoverPubKey(re(e),n,r.recoveryParam).encode("hex",!1)}(re(e),t))}function Ai(e,t){const r=ie(Ae.from(e).toHexString());return r.length>32&&pi.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function bi(e,t){return{address:gr(e),storageKeys:(t||[]).map(((t,r)=>(32!==le(t)&&pi.throwArgumentError("invalid access list storageKey",`accessList[${e}:${r}]`,t),t.toLowerCase())))}}function vi(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&pi.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),bi(e[0],e[1])):bi(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const r=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return bi(t,Object.keys(r).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function wi(e){return vi(e).map((e=>[e.address,e.storageKeys]))}function Oi(e,t){if(null!=e.gasPrice){const t=Ae.from(e.gasPrice),r=Ae.from(e.maxFeePerGas||0);t.eq(r)||pi.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:r})}const r=[Ai(e.chainId||0,"chainId"),Ai(e.nonce||0,"nonce"),Ai(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ai(e.maxFeePerGas||0,"maxFeePerGas"),Ai(e.gasLimit||0,"gasLimit"),null!=e.to?gr(e.to):"0x",Ai(e.value||0,"value"),e.data||"0x",wi(e.accessList||[])];if(t){const e=fe(t);r.push(Ai(e.recoveryParam,"recoveryParam")),r.push(ie(e.r)),r.push(ie(e.s))}return ue(["0x02",On(r)])}function Ni(e,t){const r=[Ai(e.chainId||0,"chainId"),Ai(e.nonce||0,"nonce"),Ai(e.gasPrice||0,"gasPrice"),Ai(e.gasLimit||0,"gasLimit"),null!=e.to?gr(e.to):"0x",Ai(e.value||0,"value"),e.data||"0x",wi(e.accessList||[])];if(t){const e=fe(t);r.push(Ai(e.recoveryParam,"recoveryParam")),r.push(ie(e.r)),r.push(ie(e.s))}return ue(["0x01",On(r)])}function Ti(e,t,r){try{const r=Ei(t[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");e.v=r}catch(e){pi.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=he(t[1],32),e.s=he(t[2],32);try{const t=$e(r(e));e.from=yi(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function _i(e){const t=re(e);if(t[0]>127)return function(e){const t=_n(e);9!==t.length&&6!==t.length&&pi.throwArgumentError("invalid raw transaction","rawTransaction",e);const r={nonce:Ei(t[0]).toNumber(),gasPrice:Ei(t[1]),gasLimit:Ei(t[2]),to:gi(t[3]),value:Ei(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=Ae.from(t[6]).toNumber()}catch(e){return r}if(r.r=he(t[7],32),r.s=he(t[8],32),Ae.from(r.r).isZero()&&Ae.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=t.slice(0,6);0!==r.chainId&&(i.push(ae(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const o=$e(On(i));try{r.from=yi(o,{r:ae(r.r),s:ae(r.s),recoveryParam:n})}catch(e){}r.hash=$e(e)}return r.type=null,r}(t);switch(t[0]){case 1:return function(e){const t=_n(e.slice(1));8!==t.length&&11!==t.length&&pi.throwArgumentError("invalid component count for transaction type: 1","payload",ae(e));const r={type:1,chainId:Ei(t[0]).toNumber(),nonce:Ei(t[1]).toNumber(),gasPrice:Ei(t[2]),gasLimit:Ei(t[3]),to:gi(t[4]),value:Ei(t[5]),data:t[6],accessList:vi(t[7])};return 8===t.length||(r.hash=$e(e),Ti(r,t.slice(8),Ni)),r}(t);case 2:return function(e){const t=_n(e.slice(1));9!==t.length&&12!==t.length&&pi.throwArgumentError("invalid component count for transaction type: 2","payload",ae(e));const r=Ei(t[2]),n=Ei(t[3]),i={type:2,chainId:Ei(t[0]).toNumber(),nonce:Ei(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Ei(t[4]),to:gi(t[5]),value:Ei(t[6]),data:t[7],accessList:vi(t[8])};return 9===t.length||(i.hash=$e(e),Ti(i,t.slice(9),Oi)),i}(t)}return pi.throwError(`unsupported transaction type: ${t[0]}`,$.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(mi||(mi={}));const Pi=new $(yn);class Ri{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this),l=this.type.bind(this);return e.transaction={hash:o,type:l,accessList:Ri.allowNull(this.accessList.bind(this),null),blockHash:Ri.allowNull(o,null),blockNumber:Ri.allowNull(a,null),transactionIndex:Ri.allowNull(a,null),confirmations:Ri.allowNull(a,null),from:t,gasPrice:Ri.allowNull(r),maxPriorityFeePerGas:Ri.allowNull(r),maxFeePerGas:Ri.allowNull(r),gasLimit:r,to:Ri.allowNull(t,null),value:r,nonce:a,data:i,r:Ri.allowNull(this.uint256),s:Ri.allowNull(this.uint256),v:Ri.allowNull(a),creates:Ri.allowNull(t,null),raw:Ri.allowNull(i)},e.transactionRequest={from:Ri.allowNull(t),nonce:Ri.allowNull(a),gasLimit:Ri.allowNull(r),gasPrice:Ri.allowNull(r),maxPriorityFeePerGas:Ri.allowNull(r),maxFeePerGas:Ri.allowNull(r),to:Ri.allowNull(t),value:Ri.allowNull(r),data:Ri.allowNull((e=>this.data(e,!0))),type:Ri.allowNull(a),accessList:Ri.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:t,topics:Ri.arrayOf(o),data:i,logIndex:a,blockHash:o},e.receipt={to:Ri.allowNull(this.address,null),from:Ri.allowNull(this.address,null),contractAddress:Ri.allowNull(t,null),transactionIndex:a,root:Ri.allowNull(s),gasUsed:r,logsBloom:Ri.allowNull(i),blockHash:o,transactionHash:o,logs:Ri.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Ri.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:Ri.allowNull(r),status:Ri.allowNull(a),type:l},e.block={hash:Ri.allowNull(o),parentHash:o,number:a,timestamp:a,nonce:Ri.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:Ri.allowNull(t),extraData:i,transactions:Ri.allowNull(Ri.arrayOf(o)),baseFeePerGas:Ri.allowNull(r)},e.blockWithTransactions=De(e.block),e.blockWithTransactions.transactions=Ri.allowNull(Ri.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Ri.allowNull(n,void 0),toBlock:Ri.allowNull(n,void 0),blockHash:Ri.allowNull(o,void 0),address:Ri.allowNull(t,void 0),topics:Ri.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Ri.allowNull(a),blockHash:Ri.allowNull(o),transactionIndex:a,removed:Ri.allowNull(this.boolean.bind(this)),address:t,data:Ri.allowFalsish(i,"0x"),topics:Ri.arrayOf(o),transactionHash:o,logIndex:a},e}accessList(e){return vi(e||[])}number(e){return"0x"===e?0:Ae.from(e).toNumber()}type(e){return"0x"===e||null==e?0:Ae.from(e).toNumber()}bigNumber(e){return Ae.from(e)}boolean(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),oe(e))?e.toLowerCase():Pi.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return gr(e)}callAddress(e){if(!oe(e,32))return null;const t=gr(ce(e,12));return"0x0000000000000000000000000000000000000000"===t?null:t}contractAddress(e){return Er(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"==typeof e||oe(e))return de(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return 32!==le(r)?Pi.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(null==e)return null;const t=Ae.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!oe(e))throw new Error("invalid uint256");return he(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const r=null!=e._difficulty?e._difficulty:e.difficulty,n=Ri.check(t,e);return n._difficulty=null==r?null:Ae.from(r),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Ri.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&Ae.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=Ri.check(this.formats.transaction,e);if(null!=e.chainId){let r=e.chainId;oe(r)&&(r=Ae.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;null==r&&null==t.v&&(r=e.chainId),oe(r)&&(r=Ae.from(r).toNumber()),"number"!=typeof r&&null!=t.v&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),t.chainId=r}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return _i(e)}receiptLog(e){return Ri.check(this.formats.receiptLog,e)}receipt(e){const t=Ri.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=Ae.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&Pi.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):Pi.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&Pi.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map((e=>this.topics(e))):null!=e?this.hash(e,!0):null}filter(e){return Ri.check(this.formats.filter,e)}filterLog(e){return Ri.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const n in e)try{const i=e[n](t[n]);void 0!==i&&(r[n]=i)}catch(e){throw e.checkKey=n,e.checkValue=t[n],e}return r}static allowNull(e,t){return function(r){return null==r?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach((function(t){r.push(e(t))})),r}}}var Di=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const Ii=new $(yn);function Ci(e){return null==e?"null":(32!==le(e)&&Ii.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function Si(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((e=>{if(Array.isArray(e)){const t={};e.forEach((e=>{t[Ci(e)]=!0}));const r=Object.keys(t);return r.sort(),r.join("|")}return Ci(e)})).join("&")}function ki(e){if("string"==typeof e){if(32===le(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+Si(e);if(Fe.isForkEvent(e))throw Ii.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+Si(e.topics||[])}throw new Error("invalid event - "+e)}function Bi(){return(new Date).getTime()}function xi(e){return new Promise((t=>{setTimeout(t,e)}))}const Li=["block","network","pending","poll"];class Fi{constructor(e,t,r){_e(this,"tag",e),_e(this,"listener",t),_e(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],r=""===(n=e[2])?[]:n.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}));var n;const i={};return r.length>0&&(i.topics=r),t&&"*"!==t&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||Li.indexOf(this.tag)>=0}}const Ui={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Mi(e){return he(Ae.from(e).toHexString(),32)}function qi(e){return Ye.encode(ne([e,ce(Br(Br(e)),0,4)]))}const Vi=new RegExp("^(ipfs)://(.*)$","i"),Gi=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Vi,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function ji(e,t){try{return nt(Hi(e,t))}catch(e){}return null}function Hi(e,t){if("0x"===e)return null;const r=Ae.from(ce(e,t,t+32)).toNumber(),n=Ae.from(ce(e,r,r+32)).toNumber();return ce(e,r+32,r+32+n)}function Qi(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):Ii.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function Xi(e){const t=re(e);if(t.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(t,32-t.length),r}function Yi(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function Ki(e){const t=[];let r=0;for(let n=0;n<e.length;n++)t.push(null),r+=32;for(let n=0;n<e.length;n++){const i=re(e[n]);t[n]=Xi(r),t.push(Xi(i.length)),t.push(Yi(i)),r+=32+32*Math.ceil(i.length/32)}return ue(t)}class $i{constructor(e,t,r,n){_e(this,"provider",e),_e(this,"name",r),_e(this,"address",e.formatter.address(t)),_e(this,"_resolvedAddress",n)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then((e=>Ae.from(e).eq(1))).catch((e=>{if(e.code===$.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return Di(this,void 0,void 0,(function*(){const r={to:this.address,ccipReadEnabled:!0,data:ue([e,Ct(this.name),t||"0x"])};let n=!1;var i;(yield this.supportsWildcard())&&(n=!0,r.data=ue(["0x9061b923",Ki([(i=this.name,ae(ne(It(i).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"),r.data])]));try{let e=yield this.provider.call(r);return re(e).length%32==4&&Ii.throwError("resolver threw error",$.errors.CALL_EXCEPTION,{transaction:r,data:e}),n&&(e=Hi(e,0)),e}catch(e){if(e.code===$.errors.CALL_EXCEPTION)return null;throw e}}))}_fetchBytes(e,t){return Di(this,void 0,void 0,(function*(){const r=yield this._fetch(e,t);return null!=r?Hi(r,0):null}))}_getAddress(e,t){const r=Ui[String(e)];if(null==r&&Ii.throwError(`unsupported coin type: ${e}`,$.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===r.ilk)return this.provider.formatter.address(t);const n=re(t);if(null!=r.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return qi(ne([[r.p2pkh],"0x"+e[2]]))}}if(null!=r.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return qi(ne([[r.p2sh],"0x"+e[2]]))}}if(null!=r.prefix){const e=n[1];let t=n[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&n.length===2+e&&e>=1&&e<=75){const e=N.toWords(n.slice(2));return e.unshift(t),N.encode(r.prefix,e)}}return null}getAddress(e){return Di(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===$.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",Mi(e));if(null==t||"0x"===t)return null;const r=this._getAddress(e,t);return null==r&&Ii.throwError("invalid or unsupported coin data",$.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r}))}getAvatar(){return Di(this,void 0,void 0,(function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let r=0;r<Gi.length;r++){const n=t.match(Gi[r]);if(null==n)continue;const i=n[1].toLowerCase();switch(i){case"https":return e.push({type:"url",content:t}),{linkage:e,url:t};case"data":return e.push({type:"data",content:t}),{linkage:e,url:t};case"ipfs":return e.push({type:"ipfs",content:t}),{linkage:e,url:Qi(t)};case"erc721":case"erc1155":{const r="erc721"===i?"0xc87b56dd":"0x0e89341c";e.push({type:i,content:t});const o=this._resolvedAddress||(yield this.getAddress()),s=(n[2]||"").split("/");if(2!==s.length)return null;const a=yield this.provider.formatter.address(s[0]),l=he(Ae.from(s[1]).toHexString(),32);if("erc721"===i){const t=this.provider.formatter.callAddress(yield this.provider.call({to:a,data:ue(["0x6352211e",l])}));if(o!==t)return null;e.push({type:"owner",content:t})}else if("erc1155"===i){const t=Ae.from(yield this.provider.call({to:a,data:ue(["0x00fdd58e",he(o,32),l])}));if(t.isZero())return null;e.push({type:"balance",content:t.toString()})}const c={to:this.provider.formatter.address(s[0]),data:ue([r,l])};let u=ji(yield this.provider.call(c),0);if(null==u)return null;e.push({type:"metadata-url-base",content:u}),"erc1155"===i&&(u=u.replace("{id}",l.substring(2)),e.push({type:"metadata-url-expanded",content:u})),u.match(/^ipfs:/i)&&(u=Qi(u)),e.push({type:"metadata-url",content:u});const d=yield gn(u);if(!d)return null;e.push({type:"metadata",content:JSON.stringify(d)});let h=d.image;if("string"!=typeof h)return null;if(h.match(/^(https:\/\/|data:)/i));else{if(null==h.match(Vi))return null;e.push({type:"url-ipfs",content:h}),h=Qi(h)}return e.push({type:"url",content:h}),{linkage:e,url:h}}}}}catch(e){}return null}))}getContentHash(){return Di(this,void 0,void 0,(function*(){const e=yield this._fetchBytes("0xbc1c58d1");if(null==e||"0x"===e)return null;const t=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const e=parseInt(t[3],16);if(t[4].length===2*e)return"ipfs://"+Ye.encode("0x"+t[1])}const r=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const e=parseInt(r[3],16);if(r[4].length===2*e)return"ipns://"+Ye.encode("0x"+r[1])}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&64===n[1].length)return"bzz://"+n[1];const i=e.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const e={"=":"","+":"-","/":"_"};return"sia://"+function(e){e=re(e);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}("0x"+i[1]).replace(/[=+\/]/g,(t=>e[t]))}return Ii.throwError("invalid or unsupported content hash data",$.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return Di(this,void 0,void 0,(function*(){let t=rt(e);t=ne([Mi(64),Mi(t.length),t]),t.length%32!=0&&(t=ne([t,he("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",ae(t));return null==r||"0x"===r?null:nt(r)}))}}let zi=null,Wi=1;class Ji extends Ue{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),_e(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch((e=>{})),this._ready().catch((e=>{}));else{const t=Pe(new.target,"getNetwork")(e);t?(_e(this,"_network",t),this.emit("network",t,null)):Ii.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Di(this,void 0,void 0,(function*(){if(null==this._network){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch(e){}null==e&&(e=yield this.detectNetwork()),e||Ii.throwError("no network detected",$.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:_e(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return En((()=>this._ready().then((e=>e),(e=>{if(e.code!==$.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==zi&&(zi=new Ri),zi}static getNetwork(e){return function(e){if(null==e)return null;if("number"==typeof e){for(const t in Qe){const r=Qe[t];if(r.chainId===e)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=Qe[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=Qe[e.name];if(!t)return"number"!=typeof e.chainId&&Me.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&Me.throwArgumentError("network chainId mismatch","network",e);let r=e._defaultProvider||null;var n;return null==r&&t._defaultProvider&&(r=(n=t._defaultProvider)&&"function"==typeof n.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:r}}(null==e?"homestead":e)}ccipReadFetch(e,t,r){return Di(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===r.length)return null;const n=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let e=0;e<r.length;e++){const t=r[e],s=t.replace("{sender}",n).replace("{data}",i),a=t.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:n}),l=yield gn({url:s,errorPassThrough:!0},a,((e,t)=>(e.status=t.statusCode,e)));if(l.data)return l.data;const c=l.message||"unknown error";if(l.status>=400&&l.status<500)return Ii.throwError(`response not found during CCIP fetch: ${c}`,$.errors.SERVER_ERROR,{url:t,errorMessage:c});o.push(c)}return Ii.throwError(`error encountered during CCIP fetch: ${o.map((e=>JSON.stringify(e))).join(", ")}`,$.errors.SERVER_ERROR,{urls:r,errorMessages:o})}))}_getInternalBlockNumber(e){return Di(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const r=yield t;if(Bi()-r.respTime<=e)return r.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=Bi(),r=Re({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const i=Bi();return(e=Ae.from(e).toNumber())<this._maxInternalBlockNumber&&(e=this._maxInternalBlockNumber),this._maxInternalBlockNumber=e,this._setFastBlockNumber(e),{blockNumber:e,reqTime:t,respTime:i}}));return this._internalBlockNumber=r,r.catch((e=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return Di(this,void 0,void 0,(function*(){const e=Wi++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Ii.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Ii.makeError("network block skew detected",$.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let e=this._emitted.block+1;e<=r;e++)this.emit("block",e);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&r-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((e=>{switch(e.type){case"tx":{const r=e.hash;let n=this.getTransactionReceipt(r).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+r]=e.blockNumber,this.emit(r,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(n);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=r-1);const n=e.filter;n.fromBlock=e._lastBlockNumber+1,n.toBlock=r;const i=n.toBlock-this._maxFilterBlockRange;i>n.fromBlock&&(n.fromBlock=i),n.fromBlock<0&&(n.fromBlock=0);const o=this.getLogs(n).then((t=>{e._inflight=!1,0!==t.length&&t.forEach((t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(n,t)}))})).catch((t=>{this.emit("error",t),e._inflight=!1}));t.push(o)}}})),this._lastBlockNumber=r,Promise.all(t).then((()=>{this.emit("didPoll",e)})).catch((e=>{this.emit("error",e)}))}else this.emit("didPoll",e)}))}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return Di(this,void 0,void 0,(function*(){return Ii.throwError("provider does not support network detection",$.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return Di(this,void 0,void 0,(function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield xi(0),this._network;const r=Ii.makeError("underlying network changed",$.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((e=>{this._setFastBlockNumber(e)}),(e=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const e=Bi();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=Bi(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return Di(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,r||0,null)}))}_waitForTransaction(e,t,r,n){return Di(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,o)=>{const s=[];let a=!1;const l=function(){return!!a||(a=!0,s.forEach((e=>{e()})),!1)},c=e=>{e.confirmations<t||l()||i(e)};if(this.on(e,c),s.push((()=>{this.removeListener(e,c)})),n){let r=n.startBlock,i=null;const c=s=>Di(this,void 0,void 0,(function*(){a||(yield xi(1e3),this.getTransactionCount(n.from).then((u=>Di(this,void 0,void 0,(function*(){if(!a){if(u<=n.nonce)r=s;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=r-3,i<n.startBlock&&(i=n.startBlock));i<=s;){if(a)return;const r=yield this.getBlockWithTransactions(i);for(let i=0;i<r.transactions.length;i++){const s=r.transactions[i];if(s.hash===e)return;if(s.from===n.from&&s.nonce===n.nonce){if(a)return;const r=yield this.waitForTransaction(s.hash,t);if(l())return;let i="replaced";return s.data===n.data&&s.to===n.to&&s.value.eq(n.value)?i="repriced":"0x"===s.data&&s.from===s.to&&s.value.isZero()&&(i="cancelled"),void o(Ii.makeError("transaction was replaced",$.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(s),hash:e,receipt:r}))}}i++}}a||this.once("block",c)}}))),(e=>{a||this.once("block",c)})))}));if(a)return;this.once("block",c),s.push((()=>{this.removeListener("block",c)}))}if("number"==typeof r&&r>0){const e=setTimeout((()=>{l()||o(Ii.makeError("timeout exceeded",$.errors.TIMEOUT,{timeout:r}))}),r);e.unref&&e.unref(),s.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return Di(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return Di(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ae.from(e)}catch(t){return Ii.throwError("bad result from backend",$.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return Di(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Re({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getBalance",r);try{return Ae.from(n)}catch(e){return Ii.throwError("bad result from backend",$.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:e})}}))}getTransactionCount(e,t){return Di(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Re({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getTransactionCount",r);try{return Ae.from(n).toNumber()}catch(e){return Ii.throwError("bad result from backend",$.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:e})}}))}getCode(e,t){return Di(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Re({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getCode",r);try{return ae(n)}catch(e){return Ii.throwError("bad result from backend",$.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:e})}}))}getStorageAt(e,t,r){return Di(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Re({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((e=>de(e)))}),i=yield this.perform("getStorageAt",n);try{return ae(i)}catch(e){return Ii.throwError("bad result from backend",$.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:e})}}))}_wrapTransaction(e,t,r){if(null!=t&&32!==le(t))throw new Error("invalid response - sendTransaction");const n=e;return null!=t&&e.hash!==t&&Ii.throwError("Transaction hash mismatch from Provider.sendTransaction.",$.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),n.wait=(t,n)=>Di(this,void 0,void 0,(function*(){let i;null==t&&(t=1),null==n&&(n=0),0!==t&&null!=r&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const o=yield this._waitForTransaction(e.hash,t,n,i);return null==o&&0===t?null:(this._emitted["t:"+e.hash]=o.blockNumber,0===o.status&&Ii.throwError("transaction failed",$.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:o}),o)})),n}sendTransaction(e){return Di(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>ae(e))),r=this.formatter.transaction(e);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,e,n)}catch(e){throw e.transaction=r,e.transactionHash=r.hash,e}}))}_getTransactionRequest(e){return Di(this,void 0,void 0,(function*(){const t=yield e,r={};return["from","to"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?Ae.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?ae(e):null)))})),this.formatter.transactionRequest(yield Re(r))}))}_getFilter(e){return Di(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((r=>{null!=e[r]&&(t[r]=e[r])})),["fromBlock","toBlock"].forEach((r=>{null!=e[r]&&(t[r]=this._getBlockTag(e[r]))})),this.formatter.filter(yield Re(t))}))}_call(e,t,r){return Di(this,void 0,void 0,(function*(){r>=10&&Ii.throwError("CCIP read exceeded maximum redirections",$.errors.SERVER_ERROR,{redirects:r,transaction:e});const n=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&"latest"===t&&null!=n&&"0x556f1830"===i.substring(0,10)&&le(i)%32==4)try{const o=ce(i,4),s=ce(o,0,32);Ae.from(s).eq(n)||Ii.throwError("CCIP Read sender did not match",$.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const a=[],l=Ae.from(ce(o,32,64)).toNumber(),c=Ae.from(ce(o,l,l+32)).toNumber(),u=ce(o,l+32);for(let t=0;t<c;t++){const r=ji(u,32*t);null==r&&Ii.throwError("CCIP Read contained corrupt URL string",$.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i}),a.push(r)}const d=Hi(o,64);Ae.from(ce(o,100,128)).isZero()||Ii.throwError("CCIP Read callback selector included junk",$.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const h=ce(o,96,100),f=Hi(o,128),p=yield this.ccipReadFetch(e,d,a);null==p&&Ii.throwError("CCIP Read disabled or provided no URLs",$.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const m={to:n,data:ue([h,Ki([p,f])])};return this._call(m,t,r+1)}catch(e){if(e.code===$.errors.SERVER_ERROR)throw e}try{return ae(i)}catch(r){return Ii.throwError("bad result from backend",$.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:t},result:i,error:r})}}))}call(e,t){return Di(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Re({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(t),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(r.transaction,r.blockTag,r.ccipReadEnabled?0:-1)}))}estimateGas(e){return Di(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Re({transaction:this._getTransactionRequest(e)}),r=yield this.perform("estimateGas",t);try{return Ae.from(r)}catch(e){return Ii.throwError("bad result from backend",$.errors.SERVER_ERROR,{method:"estimateGas",params:t,result:r,error:e})}}))}_getAddress(e){return Di(this,void 0,void 0,(function*(){"string"!=typeof(e=yield e)&&Ii.throwArgumentError("invalid address or ENS name","name",e);const t=yield this.resolveName(e);return null==t&&Ii.throwError("ENS name not configured",$.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),t}))}_getBlock(e,t){return Di(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;let r=-128;const n={includeTransactions:!!t};if(oe(e,32))n.blockHash=e;else try{n.blockTag=yield this._getBlockTag(e),oe(n.blockTag)&&(r=parseInt(n.blockTag.substring(2),16))}catch(t){Ii.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return En((()=>Di(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",n);if(null==e)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(t){let t=null;for(let r=0;r<e.transactions.length;r++){const n=e.transactions[r];if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){null==t&&(t=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let e=t-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}}const r=this.formatter.blockWithTransactions(e);return r.transactions=r.transactions.map((e=>this._wrapTransaction(e))),r}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return Di(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return En((()=>Di(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return this._wrapTransaction(n)}))),{oncePoll:this})}))}getTransactionReceipt(e){return Di(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return En((()=>Di(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return n}))),{oncePoll:this})}))}getLogs(e){return Di(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Re({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach((e=>{null==e.removed&&(e.removed=!1)})),Ri.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return Di(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return Di(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&Ii.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)}))}getResolver(e){return Di(this,void 0,void 0,(function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const r=yield this._getResolver(t,"getResolver");if(null!=r){const n=new $i(this,r,e);return t===e||(yield n.supportsWildcard())?n:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return Di(this,void 0,void 0,(function*(){null==t&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Ii.throwError("network does not support ENS",$.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const t=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Ct(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null}))}resolveName(e){return Di(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(oe(e))throw t}"string"!=typeof e&&Ii.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return Di(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(null==r)return null;const n=ji(yield this.call({to:r,data:"0x691f3431"+Ct(t).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n}))}getAvatar(e){return Di(this,void 0,void 0,(function*(){let t=null;if(oe(e)){const r=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;t=new $i(this,n,r);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==$.errors.CALL_EXCEPTION)throw e}try{const e=ji(yield this.call({to:n,data:"0x691f3431"+Ct(r).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==$.errors.CALL_EXCEPTION)throw e;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return null==r?null:r.url}))}perform(e,t){return Ii.throwError(e+" not implemented",$.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_stopEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_addEventListener(e,t,r){const n=new Fi(ki(e),t,r);return this._events.push(n),this._startEvent(n),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,n=[],i=ki(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),r=!0,!e.once||(n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),r}listenerCount(e){if(!e)return this._events.length;let t=ki(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=ki(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const r=[];let n=!1,i=ki(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!n||(n=!0,r.push(e),!1)))),r.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const r=ki(e);this._events=this._events.filter((e=>e.tag!==r||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var Zi=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const eo=new $("abstract-signer/5.7.0"),to=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],ro=[$.errors.INSUFFICIENT_FUNDS,$.errors.NONCE_EXPIRED,$.errors.REPLACEMENT_UNDERPRICED];let no=class e{constructor(){eo.checkAbstract(new.target,e),_e(this,"_isSigner",!0)}getBalance(e){return Zi(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return Zi(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return Zi(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield Re(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return Zi(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield Re(this.checkTransaction(e));return yield this.provider.call(r,t)}))}sendTransaction(e){return Zi(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)}))}getChainId(){return Zi(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Zi(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Zi(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return Zi(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===to.indexOf(t)&&eo.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=De(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&eo.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return Zi(this,void 0,void 0,(function*(){const t=yield Re(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>Zi(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&eo.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const r=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!r?0!==t.type&&1!==t.type||!r||eo.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):eo.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.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?(r&&eo.throwError("network does not support EIP-1559",$.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):eo.throwError("failed to get consistent fee data",$.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(ro.indexOf(e.code)>=0)throw e;return eo.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",$.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&eo.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield Re(t)}))}_checkProvider(e){this.provider||eo.throwError("missing provider",$.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}};var io=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const oo=new $(yn),so=["call","estimateGas"];function ao(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const r=oe(e.data)?e.data:null;if(!t||r)return{message:e.message,data:r}}if("object"==typeof e){for(const r in e){const n=ao(e[r],t);if(n)return n}return null}if("string"==typeof e)try{return ao(JSON.parse(e),t)}catch(e){}return null}function lo(e,t,r){const n=r.transaction||r.signedTransaction;if("call"===e){const e=ao(t,!0);if(e)return e.data;oo.throwError("missing revert data in call exception; Transaction reverted without a reason string",$.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:t})}if("estimateGas"===e){let r=ao(t.body,!1);null==r&&(r=ao(t,!1)),r&&oo.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",$.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:e,transaction:n,error:t})}let i=t.message;throw t.code===$.errors.SERVER_ERROR&&t.error&&"string"==typeof t.error.message?i=t.error.message:"string"==typeof t.body?i=t.body:"string"==typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&oo.throwError("insufficient funds for intrinsic transaction cost",$.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:n}),i.match(/nonce (is )?too low/i)&&oo.throwError("nonce has already been used",$.errors.NONCE_EXPIRED,{error:t,method:e,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&oo.throwError("replacement fee too low",$.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:n}),i.match(/only replay-protected/i)&&oo.throwError("legacy pre-eip-155 transactions not supported",$.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:n}),so.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&oo.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",$.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function co(e){return new Promise((function(t){setTimeout(t,e)}))}function uo(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function ho(e){return e?e.toLowerCase():e}const fo={};class po extends no{constructor(e,t,r){if(super(),e!==fo)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");_e(this,"provider",t),null==r&&(r=0),"string"==typeof r?(_e(this,"_address",this.provider.formatter.address(r)),_e(this,"_index",null)):"number"==typeof r?(_e(this,"_index",r),_e(this,"_address",null)):oo.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return oo.throwError("cannot alter JSON-RPC Signer connection",$.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new mo(fo,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((e=>(e.length<=this._index&&oo.throwError("unknown account #"+this._index,$.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=De(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const r=De(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>io(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&oo.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),Re({tx:Re(e),sender:t}).then((({tx:t,sender:r})=>{null!=t.from?t.from.toLowerCase()!==r&&oo.throwArgumentError("from address mismatch","transaction",e):t.from=r;const n=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then((e=>e),(e=>("string"==typeof e.message&&e.message.match(/user denied/i)&&oo.throwError("user rejected transaction",$.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),lo("sendTransaction",e,n))))}))}signTransaction(e){return oo.throwError("signing transactions is unsupported",$.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return io(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield En((()=>io(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(r);if(null!==e)return this.provider._wrapTransaction(e,r,t)}))),{oncePoll:this.provider})}catch(e){throw e.transactionHash=r,e}}))}signMessage(e){return io(this,void 0,void 0,(function*(){const t="string"==typeof e?rt(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[ae(t),r.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&oo.throwError("user rejected signing",$.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),t}}))}_legacySignMessage(e){return io(this,void 0,void 0,(function*(){const t="string"==typeof e?rt(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),ae(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&oo.throwError("user rejected signing",$.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),t}}))}_signTypedData(e,t,r){return io(this,void 0,void 0,(function*(){const n=yield kr.resolveNames(e,t,r,(e=>this.provider.resolveName(e))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(kr.getPayload(n.domain,t,n.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&oo.throwError("user rejected signing",$.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:n.domain,types:t,value:n.value}}),e}}))}unlock(e){return io(this,void 0,void 0,(function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])}))}}class mo extends po{sendTransaction(e){return this.sendUncheckedTransaction(e).then((e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)})))}}const go={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Eo extends Ji{constructor(e,t){let r=t;null==r&&(r=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(r),e||(e=Pe(this.constructor,"defaultUrl")()),_e(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(De(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return io(this,void 0,void 0,(function*(){yield co(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(e){}}if(null!=e){const t=Pe(this.constructor,"getNetwork");try{return t(Ae.from(e).toNumber())}catch(t){return oo.throwError("could not detect network",$.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return oo.throwError("could not detect network",$.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new po(fo,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((e=>e.map((e=>this.formatter.address(e)))))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:ke(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const i=gn(this.connection,JSON.stringify(r),uo).then((e=>(this.emit("debug",{action:"response",request:r,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:r,provider:this}),e}));return n&&(this._cache[e]=i,setTimeout((()=>{this._cache[e]=null}),0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[ho(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[ho(t.address),t.blockTag]];case"getCode":return["eth_getCode",[ho(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[ho(t.address),he(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[Pe(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[Pe(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=ho(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return io(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&Ae.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((t=De(t)).transaction=De(e),delete t.transaction.type)}}const r=this.prepareRequest(e,t);null==r&&oo.throwError(e+" not implemented",$.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(r){return lo(e,r,t)}}))}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(r){return function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;let n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return co(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){n()}),0),null;e.send("eth_uninstallFilter",[r])})).catch((e=>{}))}(),r})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=De(go);if(t)for(const e in t)t[e]&&(r[e]=!0);var n,i;i=r,(n=e)&&"object"==typeof n||Te.throwArgumentError("invalid object","object",n),Object.keys(n).forEach((e=>{i[e]||Te.throwArgumentError("invalid object key - "+e,"transaction:"+e,n)}));const o={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const r=de(Ae.from(e[t]));"gasLimit"===t&&(t="gas"),o[t]=r})),["from","to","data"].forEach((function(t){null!=e[t]&&(o[t]=ae(e[t]))})),e.accessList&&(o.accessList=vi(e.accessList)),o}}var yo=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const Ao=new $(yn);class bo extends Eo{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return yo(this,void 0,void 0,(function*(){let t=this.network;return null==t&&(t=yield e.detectNetwork.call(this),t||Ao.throwError("no network detected",$.errors.UNKNOWN_ERROR,{}),null==this._network&&(_e(this,"_network",t),this.emit("network",t,null))),t}))}}let vo=!1,wo=!1;const Oo={debug:1,default:2,info:2,warning:3,error:4,off:5};let No=Oo.default,To=null;const _o=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),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 Po,Ro;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(Po||(Po={})),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"}(Ro||(Ro={}));const Do="0123456789abcdef";let Io=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==Oo[r]&&this.throwArgumentError("invalid log level name","logLevel",e),No>Oo[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(wo)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=Do[t[e]>>4],r+=Do[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=t;let s="";switch(r){case Ro.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case Ro.CALL_EXCEPTION:case Ro.INSUFFICIENT_FUNDS:case Ro.MISSING_NEW:case Ro.NONCE_EXPIRED:case Ro.REPLACEMENT_UNDERPRICED:case Ro.TRANSACTION_REPLACED:case Ro.UNPREDICTABLE_GAS_LIMIT:s=r}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const a=new Error(t);return a.reason=o,a.code=r,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){_o&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_o})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return To||(To=new e("logger/5.7.0")),To}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),vo){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}wo=!!t,vo=!!r}static setLogLevel(t){const r=Oo[t.toLowerCase()];null!=r?No=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};Io.errors=Ro,Io.levels=Po;const Co=new Io("bytes/5.7.0");function So(e){return!!e.toHexString}function ko(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return ko(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Bo(e){return"number"==typeof e&&e==e&&e%1==0}function xo(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Bo(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Bo(r)||r<0||r>=256)return!1}return!0}function Lo(e,t){if(t||(t={}),"number"==typeof e){Co.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),ko(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),So(e)&&(e=e.toHexString()),Uo(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Co.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return ko(new Uint8Array(n))}return xo(e)?ko(new Uint8Array(e)):Co.throwArgumentError("invalid arrayify value","value",e)}function Fo(e){const t=e.map((e=>Lo(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),ko(n)}function Uo(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Mo="0123456789abcdef";function qo(e,t){if(t||(t={}),"number"==typeof e){Co.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Mo[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),So(e))return e.toHexString();if(Uo(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Co.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(xo(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Mo[(240&n)>>4]+Mo[15&n]}return t}return Co.throwArgumentError("invalid hexlify value","value",e)}function Vo(e,t){for("string"!=typeof e?e=qo(e):Uo(e)||Co.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Co.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}var Go=w.BN;const jo=new Io("bignumber/5.7.0"),Ho={},Qo=9007199254740991;let Xo=!1,Yo=class e{constructor(e,t){e!==Ho&&jo.throwError("cannot call constructor directly; use BigNumber.from",Io.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return $o(zo(this).fromTwos(e))}toTwos(e){return $o(zo(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return $o(zo(this).add(zo(e)))}sub(e){return $o(zo(this).sub(zo(e)))}div(t){return e.from(t).isZero()&&Wo("division-by-zero","div"),$o(zo(this).div(zo(t)))}mul(e){return $o(zo(this).mul(zo(e)))}mod(e){const t=zo(e);return t.isNeg()&&Wo("division-by-zero","mod"),$o(zo(this).umod(t))}pow(e){const t=zo(e);return t.isNeg()&&Wo("negative-power","pow"),$o(zo(this).pow(t))}and(e){const t=zo(e);return(this.isNegative()||t.isNeg())&&Wo("unbound-bitwise-result","and"),$o(zo(this).and(t))}or(e){const t=zo(e);return(this.isNegative()||t.isNeg())&&Wo("unbound-bitwise-result","or"),$o(zo(this).or(t))}xor(e){const t=zo(e);return(this.isNegative()||t.isNeg())&&Wo("unbound-bitwise-result","xor"),$o(zo(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Wo("negative-width","mask"),$o(zo(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Wo("negative-width","shl"),$o(zo(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Wo("negative-width","shr"),$o(zo(this).shrn(e))}eq(e){return zo(this).eq(zo(e))}lt(e){return zo(this).lt(zo(e))}lte(e){return zo(this).lte(zo(e))}gt(e){return zo(this).gt(zo(e))}gte(e){return zo(this).gte(zo(e))}isNegative(){return"-"===this._hex[0]}isZero(){return zo(this).isZero()}toNumber(){try{return zo(this).toNumber()}catch(e){Wo("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return jo.throwError("this platform does not support BigInt",Io.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Xo||(Xo=!0,jo.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?jo.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Io.errors.UNEXPECTED_ARGUMENT,{}):jo.throwError("BigNumber.toString does not accept parameters",Io.errors.UNEXPECTED_ARGUMENT,{})),zo(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(Ho,Ko(t)):t.match(/^-?[0-9]+$/)?new e(Ho,Ko(new Go(t))):jo.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Wo("underflow","BigNumber.from",t),(t>=Qo||t<=-Qo)&&Wo("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(xo(r))return e.from(qo(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Uo(t)||"-"===t[0]&&Uo(t.substring(1))))return e.from(t)}return jo.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Ko(e){if("string"!=typeof e)return Ko(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&jo.throwArgumentError("invalid hex","value",e),"0x00"===(e=Ko(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function $o(e){return Yo.from(Ko(e))}function zo(e){const t=Yo.from(e).toHexString();return"-"===t[0]?new Go("-"+t.substring(3),16):new Go(t.substring(2),16)}function Wo(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),jo.throwError(e,Io.errors.NUMERIC_FAULT,n)}const Jo=new Io("properties/5.7.0");function Zo(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function es(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}const ts={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function rs(e){if(null==e||ts[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!rs(n))return!1}return!0}return Jo.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function ns(e){if(rs(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>is(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&Zo(t,r,is(n))}return t}return Jo.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function is(e){return ns(e)}class os{constructor(e){for(const t in e)this[t]=is(e[t])}}const ss="abi/5.7.0",as=new Io(ss),ls={};let cs={calldata:!0,memory:!0,storage:!0},us={calldata:!0,memory:!0};function ds(e,t){if("bytes"===e||"string"===e){if(cs[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&us[t])return!0;return(cs[t]||"payable"===t)&&as.throwArgumentError("invalid modifier","name",t),!1}function hs(e,t){for(let r in t)Zo(e,r,t[r])}const fs=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),ps=new RegExp(/^(.*)\[([0-9]*)\]$/);class ms{constructor(e,t){e!==ls&&as.throwError("use fromString",Io.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),hs(this,t);let r=this.type.match(ps);hs(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:ms.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=fs.sighash),fs[e]||as.throwArgumentError("invalid format type","format",e),e===fs.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==fs.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===fs.full?", ":",")+")"):t+=this.type,e!==fs.sighash&&(!0===this.indexed&&(t+=" indexed"),e===fs.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?ms.fromString(e,t):ms.fromObject(e)}static fromObject(e){return ms.isParamType(e)?e:new ms(ls,{name:e.name||null,type:_s(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(ms.fromObject):null})}static fromString(e,t){return r=function(e,t){let r=e;function n(t){as.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},s=o;for(let r=0;r<e.length;r++){let o=e[r];switch(o){case"(":s.state.allowType&&""===s.type?s.type="tuple":s.state.allowParams||n(r),s.state.allowType=!1,s.type=_s(s.type),s.components=[i(s)],s=s.components[0];break;case")":delete s.state,"indexed"===s.name&&(t||n(r),s.indexed=!0,s.name=""),ds(s.type,s.name)&&(s.name=""),s.type=_s(s.type);let e=s;s=s.parent,s||n(r),delete e.parent,s.state.allowParams=!1,s.state.allowName=!0,s.state.allowArray=!0;break;case",":delete s.state,"indexed"===s.name&&(t||n(r),s.indexed=!0,s.name=""),ds(s.type,s.name)&&(s.name=""),s.type=_s(s.type);let a=i(s.parent);s.parent.components.push(a),delete s.parent,s=a;break;case" ":s.state.allowType&&""!==s.type&&(s.type=_s(s.type),delete s.state.allowType,s.state.allowName=!0,s.state.allowParams=!0),s.state.allowName&&""!==s.name&&("indexed"===s.name?(t||n(r),s.indexed&&n(r),s.indexed=!0,s.name=""):ds(s.type,s.name)?s.name="":s.state.allowName=!1);break;case"[":s.state.allowArray||n(r),s.type+=o,s.state.allowArray=!1,s.state.allowName=!1,s.state.readArray=!0;break;case"]":s.state.readArray||n(r),s.type+=o,s.state.readArray=!1,s.state.allowArray=!0,s.state.allowName=!0;break;default:s.state.allowType?(s.type+=o,s.state.allowParams=!0,s.state.allowArray=!0):s.state.allowName?(s.name+=o,delete s.state.allowArray):s.state.readArray?s.type+=o:n(r)}}return s.parent&&as.throwArgumentError("unexpected eof","param",e),delete o.state,"indexed"===s.name?(t||n(r.length-7),s.indexed&&n(r.length-7),s.indexed=!0,s.name=""):ds(s.type,s.name)&&(s.name=""),o.type=_s(o.type),o}(e,!!t),ms.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(e){return!(null==e||!e._isParamType)}}function gs(e,t){return function(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];","===o&&0===n?(t.push(r),r=""):(r+=o,"("===o?n++:")"===o&&(n--,-1===n&&as.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>ms.fromString(e,t)))}class Es{constructor(e,t){e!==ls&&as.throwError("use a static from method",Io.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),hs(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Es.isFragment(e)?e:"string"==typeof e?Es.fromString(e):Es.fromObject(e)}static fromObject(e){if(Es.isFragment(e))return e;switch(e.type){case"function":return Os.fromObject(e);case"event":return ys.fromObject(e);case"constructor":return ws.fromObject(e);case"error":return Ts.fromObject(e);case"fallback":case"receive":return null}return as.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?ys.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Os.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?ws.fromString(e.trim()):"error"===e.split(" ")[0]?Ts.fromString(e.substring(5).trim()):as.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class ys extends Es{format(e){if(e||(e=fs.sighash),fs[e]||as.throwArgumentError("invalid format type","format",e),e===fs.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==fs.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===fs.full?", ":",")+") ",e!==fs.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?ys.fromString(e):ys.fromObject(e)}static fromObject(e){if(ys.isEventFragment(e))return e;"event"!==e.type&&as.throwArgumentError("invalid event object","value",e);const t={name:Rs(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(ms.fromObject):[],type:"event"};return new ys(ls,t)}static fromString(e){let t=e.match(Ds);t||as.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":r=!0;break;case"":break;default:as.warn("unknown modifier: "+e)}})),ys.fromObject({name:t[1].trim(),anonymous:r,inputs:gs(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function As(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&as.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||as.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Yo.from(r[1]),r[0]):e}function bs(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function vs(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&as.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&as.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||as.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&as.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&as.throwArgumentError("unable to determine stateMutability","value",e),t}class ws extends Es{format(e){if(e||(e=fs.sighash),fs[e]||as.throwArgumentError("invalid format type","format",e),e===fs.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===fs.sighash&&as.throwError("cannot format a constructor for sighash",Io.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===fs.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?ws.fromString(e):ws.fromObject(e)}static fromObject(e){if(ws.isConstructorFragment(e))return e;"constructor"!==e.type&&as.throwArgumentError("invalid constructor object","value",e);let t=vs(e);t.constant&&as.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(ms.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Yo.from(e.gas):null};return new ws(ls,r)}static fromString(e){let t={type:"constructor"},r=(e=As(e,t)).match(Ds);return r&&"constructor"===r[1].trim()||as.throwArgumentError("invalid constructor string","value",e),t.inputs=gs(r[2].trim(),!1),bs(r[3].trim(),t),ws.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class Os extends ws{format(e){if(e||(e=fs.sighash),fs[e]||as.throwArgumentError("invalid format type","format",e),e===fs.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==fs.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===fs.full?", ":",")+") ",e!==fs.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"==typeof e?Os.fromString(e):Os.fromObject(e)}static fromObject(e){if(Os.isFunctionFragment(e))return e;"function"!==e.type&&as.throwArgumentError("invalid function object","value",e);let t=vs(e);const r={type:e.type,name:Rs(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(ms.fromObject):[],outputs:e.outputs?e.outputs.map(ms.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Yo.from(e.gas):null};return new Os(ls,r)}static fromString(e){let t={type:"function"},r=(e=As(e,t)).split(" returns ");r.length>2&&as.throwArgumentError("invalid function string","value",e);let n=r[0].match(Ds);if(n||as.throwArgumentError("invalid function signature","value",e),t.name=n[1].trim(),t.name&&Rs(t.name),t.inputs=gs(n[2],!1),bs(n[3].trim(),t),r.length>1){let n=r[1].match(Ds);""==n[1].trim()&&""==n[3].trim()||as.throwArgumentError("unexpected tokens","value",e),t.outputs=gs(n[2],!1)}else t.outputs=[];return Os.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function Ns(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||as.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class Ts extends Es{format(e){if(e||(e=fs.sighash),fs[e]||as.throwArgumentError("invalid format type","format",e),e===fs.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==fs.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===fs.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?Ts.fromString(e):Ts.fromObject(e)}static fromObject(e){if(Ts.isErrorFragment(e))return e;"error"!==e.type&&as.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:Rs(e.name),inputs:e.inputs?e.inputs.map(ms.fromObject):[]};return Ns(new Ts(ls,t))}static fromString(e){let t={type:"error"},r=e.match(Ds);return r||as.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&Rs(t.name),t.inputs=gs(r[2],!1),Ns(Ts.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function _s(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Ps=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Rs(e){return e&&e.match(Ps)||as.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Ds=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Is=new Io(ss);class Cs{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Is.throwArgumentError(e,this.localName,t)}}class Ss{constructor(e){Zo(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return function(e){let t="0x";return e.forEach((e=>{t+=qo(e).substring(2)})),t}(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(Fo(e._data))}writeBytes(e){let t=Lo(e);const r=t.length%this.wordSize;return r&&(t=Fo([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=Lo(Yo.from(e));return t.length>this.wordSize&&Is.throwError("value out-of-bounds",Io.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Fo([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class ks{constructor(e,t,r,n){Zo(this,"_data",Lo(e)),Zo(this,"wordSize",t||32),Zo(this,"_coerceFunc",r),Zo(this,"allowLoose",n),this._offset=0}get data(){return qo(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):ks.coerce(e,t)}_peekBytes(e,t,r){let n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:Is.throwError("data out-of-bounds",Io.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new ks(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return Yo.from(this.readBytes(this.wordSize))}}class Bs extends Cs{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=gr(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return gr(Vo(e.readValue().toHexString(),20))}}class xs extends Cs{constructor(e){super(e.name,e.type,void 0,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)}}const Ls=new Io(ss);function Fs(e,t,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let e={};n=t.map((t=>{const n=t.localName;return n||Ls.throwError("cannot encode object for signature with missing names",Io.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]&&Ls.throwError("cannot encode object for signature with duplicate names",Io.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]=!0,r[n]}))}else Ls.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&Ls.throwArgumentError("types/value length mismatch","tuple",r);let i=new Ss(e.wordSize),o=new Ss(e.wordSize),s=[];t.forEach(((e,t)=>{let r=n[t];if(e.dynamic){let t=o.length;e.encode(o,r);let n=i.writeUpdatableValue();s.push((e=>{n(e+t)}))}else e.encode(i,r)})),s.forEach((e=>{e(i.length)}));let a=e.appendWriter(i);return a+=e.appendWriter(o),a}function Us(e,t){let r=[],n=e.subReader(0);t.forEach((t=>{let i=null;if(t.dynamic){let r=e.readValue(),o=n.subReader(r.toNumber());try{i=t.decode(o)}catch(e){if(e.code===Io.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(e){if(e.code===Io.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}null!=i&&r.push(i)}));const i=t.reduce(((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});t.forEach(((e,t)=>{let n=e.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[t];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let e=0;e<r.length;e++){const t=r[e];t instanceof Error&&Object.defineProperty(r,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(r)}class Ms extends Cs{constructor(e,t,r){super("array",e.type+"["+(t>=0?t:"")+"]",r,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;r<this.length;r++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let r=this.length;-1===r&&(r=t.length,e.writeValue(t.length)),Ls.checkArgumentCount(t.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let e=0;e<t.length;e++)n.push(this.coder);return Fs(e,n,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&Ls.throwError("insufficient data length",Io.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let e=0;e<t;e++)r.push(new xs(this.coder));return e.coerce(this.name,Us(e,r))}}class qs extends Cs{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class Vs extends Cs{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=Lo(t);let r=e.writeValue(t.length);return r+=e.writeBytes(t),r}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class Gs extends Vs{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,qo(super.decode(e)))}}class js extends Cs{constructor(e,t){let r="bytes"+String(e);super(r,r,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let r=Lo(t);return r.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(r)}decode(e){return e.coerce(this.name,qo(e.readBytes(this.size)))}}class Hs extends Cs{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}const Qs=Yo.from(-1),Xs=Yo.from(0),Ys=Yo.from(1),Ks=Yo.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class $s extends Cs{constructor(e,t,r){const n=(t?"int":"uint")+8*e;super(n,n,r,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let r=Yo.from(t),n=Ks.mask(8*e.wordSize);if(this.signed){let e=n.mask(8*this.size-1);(r.gt(e)||r.lt(e.add(Ys).mul(Qs)))&&this._throwError("value out-of-bounds",t)}else(r.lt(Xs)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(r)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}const zs=new Io("strings/5.7.0");var Ws,Js;function Zs(e,t,r,n,i){if(e===Js.BAD_PREFIX||e===Js.UNEXPECTED_CONTINUE){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return e===Js.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(Ws||(Ws={})),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"}(Js||(Js={}));const ea=Object.freeze({error:function(e,t,r,n,i){return zs.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:Zs,replace:function(e,t,r,n,i){return e===Js.OVERLONG?(n.push(i),0):(n.push(65533),Zs(e,t,r))}});function ta(e,t=Ws.current){t!=Ws.current&&(zs.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Lo(r)}function ra(e,t){return r=function(e,t){null==t&&(t=ea.error),e=Lo(e);const r=[];let n=0;for(;n<e.length;){const i=e[n++];if(!(i>>7)){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=t(128==(192&i)?Js.UNEXPECTED_CONTINUE:Js.BAD_PREFIX,n-1,e,r);continue}o=3,s=65535}if(n-1+o>=e.length){n+=t(Js.OVERRUN,n-1,e,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=e[n];if(128!=(192&i)){n+=t(Js.MISSING_CONTINUE,n,e,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=t(Js.OUT_OF_RANGE,n-1-o,e,r,a):a>=55296&&a<=57343?n+=t(Js.UTF16_SURROGATE,n-1-o,e,r,a):a<=s?n+=t(Js.OVERLONG,n-1-o,e,r,a):r.push(a))}return r}(e,t),r.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("");var r}class na extends Vs{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,ta(t))}decode(e){return ra(super.decode(e))}}class ia extends Cs{constructor(e,t){let r=!1;const n=[];e.forEach((e=>{e.dynamic&&(r=!0),n.push(e.type)}));super("tuple","tuple("+n.join(",")+")",t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach((t=>{e.push(t.defaultValue())}));const t=this.coders.reduce(((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[n]))})),Object.freeze(e)}encode(e,t){return Fs(e,this.coders,t)}decode(e){return e.coerce(this.name,Us(e,this.coders))}}const oa=new Io(ss),sa=new RegExp(/^bytes([0-9]*)$/),aa=new RegExp(/^(u?int)([0-9]*)$/);const la=new class{constructor(e){Zo(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new Bs(e.name);case"bool":return new qs(e.name);case"string":return new na(e.name);case"bytes":return new Gs(e.name);case"array":return new Ms(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new ia((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new Hs(e.name)}let t=e.type.match(aa);if(t){let r=parseInt(t[2]||"256");return(0===r||r>256||r%8!=0)&&oa.throwArgumentError("invalid "+t[1]+" bit length","param",e),new $s(r/8,"int"===t[1],e.name)}if(t=e.type.match(sa),t){let r=parseInt(t[1]);return(0===r||r>32)&&oa.throwArgumentError("invalid bytes length","param",e),new js(r,e.name)}return oa.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new ks(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new Ss(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(ms.from(e))));return new ia(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&oa.throwError("types/values length mismatch",Io.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map((e=>this._getCoder(ms.from(e)))),n=new ia(r,"_"),i=this._getWriter();return n.encode(i,t),i.data}decode(e,t,r){const n=e.map((e=>this._getCoder(ms.from(e))));return new ia(n,"_").decode(this._getReader(Lo(t),r))}};function ca(e){return"0x"+v.keccak_256(Lo(e))}function ua(e){return ca(ta(e))}const da=new Io(ss);class ha extends os{}class fa extends os{}class pa extends os{}class ma extends os{static isIndexed(e){return!(!e||!e._isIndexed)}}const ga={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Ea(e,t){const r=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return r.error=t,r}class ya{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,Zo(this,"fragments",t.map((e=>Es.from(e))).filter((e=>null!=e))),Zo(this,"_abiCoder",es(new.target,"getAbiCoder")()),Zo(this,"functions",{}),Zo(this,"errors",{}),Zo(this,"events",{}),Zo(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void da.warn("duplicate definition - constructor"):void Zo(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let r=e.format();t[r]?da.warn("duplicate definition - "+r):t[r]=e})),this.deploy||Zo(this,"deploy",ws.from({payable:!1,type:"constructor"})),Zo(this,"_isInterface",!0)}format(e){e||(e=fs.full),e===fs.sighash&&da.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===fs.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return la}static getAddress(e){return gr(e)}static getSighash(e){return t=ua(e.format()),r=0,n=4,"string"!=typeof t?t=qo(t):(!Uo(t)||t.length%2)&&Co.throwArgumentError("invalid hexData","value",t),r=2+2*r,"0x"+t.substring(r,2+2*n);var t,r,n}static getEventTopic(e){return ua(e.format())}getFunction(e){if(Uo(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];da.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.functions).filter((e=>e.split("(")[0]===t));return 0===r.length?da.throwArgumentError("no matching function","name",t):r.length>1&&da.throwArgumentError("multiple matching functions","name",t),this.functions[r[0]]}const t=this.functions[Os.fromString(e).format()];return t||da.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Uo(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];da.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.events).filter((e=>e.split("(")[0]===t));return 0===r.length?da.throwArgumentError("no matching event","name",t):r.length>1&&da.throwArgumentError("multiple matching events","name",t),this.events[r[0]]}const t=this.events[ys.fromString(e).format()];return t||da.throwArgumentError("no matching event","signature",e),t}getError(e){if(Uo(e)){const t=es(this.constructor,"getSighash");for(const r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}da.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.errors).filter((e=>e.split("(")[0]===t));return 0===r.length?da.throwArgumentError("no matching error","name",t):r.length>1&&da.throwArgumentError("multiple matching errors","name",t),this.errors[r[0]]}const t=this.errors[Os.fromString(e).format()];return t||da.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return es(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),es(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"==typeof e&&(e=this.getError(e));const r=Lo(t);return qo(r.slice(0,4))!==this.getSighash(e)&&da.throwArgumentError(`data signature does not match error ${e.name}.`,"data",qo(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),qo(Fo([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const r=Lo(t);return qo(r.slice(0,4))!==this.getSighash(e)&&da.throwArgumentError(`data signature does not match function ${e.name}.`,"data",qo(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),qo(Fo([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let r=Lo(t),n=null,i="",o=null,s=null,a=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(e){}break;case 4:{const e=qo(r.slice(0,4)),t=ga[e];if(t)o=this._abiCoder.decode(t.inputs,r.slice(4)),s=t.name,a=t.signature,t.reason&&(n=o[0]),"Error"===s?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===s&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const t=this.getError(e);o=this._abiCoder.decode(t.inputs,r.slice(4)),s=t.name,a=t.format()}catch(e){}break}}return da.throwError("call revert exception"+i,Io.errors.CALL_EXCEPTION,{method:e.format(),data:qo(t),errorArgs:o,errorName:s,errorSignature:a,reason:n})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),qo(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&da.throwError("too many arguments for "+e.format(),Io.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const n=(e,t)=>"string"===e.type?ua(t):"bytes"===e.type?ca(qo(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=Yo.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),Vo(qo(t),32));for(t.forEach(((t,i)=>{let o=e.inputs[i];o.indexed?null==t?r.push(null):"array"===o.baseType||"tuple"===o.baseType?da.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,t):Array.isArray(t)?r.push(t.map((e=>n(o,e)))):r.push(n(o,t)):null!=t&&da.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,t)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));const r=[],n=[],i=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&da.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,o)=>{const s=t[o];if(e.indexed)if("string"===e.type)r.push(ua(s));else if("bytes"===e.type)r.push(ca(s));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([e.type],[s]))}else n.push(e),i.push(s)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){let t=this.getEventTopic(e);Uo(r[0],32)&&r[0].toLowerCase()===t||da.throwError("fragment/topic mismatch",Io.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:r[0]}),r=r.slice(1)}let n=[],i=[],o=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(n.push(ms.fromObject({type:"bytes32",name:e.name})),o.push(!0)):(n.push(e),o.push(!1)):(i.push(e),o.push(!1))}));let s=null!=r?this._abiCoder.decode(n,Fo(r)):null,a=this._abiCoder.decode(i,t,!0),l=[],c=0,u=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==s)l[t]=new ma({_isIndexed:!0,hash:null});else if(o[t])l[t]=new ma({_isIndexed:!0,hash:s[u++]});else try{l[t]=s[u++]}catch(e){l[t]=e}else try{l[t]=a[c++]}catch(e){l[t]=e}if(e.name&&null==l[e.name]){const r=l[t];r instanceof Error?Object.defineProperty(l,e.name,{enumerable:!0,get:()=>{throw Ea(`property ${JSON.stringify(e.name)}`,r)}}):l[e.name]=r}}));for(let e=0;e<l.length;e++){const t=l[e];t instanceof Error&&Object.defineProperty(l,e,{enumerable:!0,get:()=>{throw Ea(`index ${e}`,t)}})}return Object.freeze(l)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new fa({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Yo.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new ha({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=qo(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new pa({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!(!e||!e._isInterface)}}let Aa=!1,ba=!1;const va={debug:1,default:2,info:2,warning:3,error:4,off:5};let wa=va.default,Oa=null;const Na=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),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 Ta,_a;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(Ta||(Ta={})),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"}(_a||(_a={}));const Pa="0123456789abcdef";let Ra=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==va[r]&&this.throwArgumentError("invalid log level name","logLevel",e),wa>va[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(ba)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=Pa[t[e]>>4],r+=Pa[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=t;let s="";switch(r){case _a.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case _a.CALL_EXCEPTION:case _a.INSUFFICIENT_FUNDS:case _a.MISSING_NEW:case _a.NONCE_EXPIRED:case _a.REPLACEMENT_UNDERPRICED:case _a.TRANSACTION_REPLACED:case _a.UNPREDICTABLE_GAS_LIMIT:s=r}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const a=new Error(t);return a.reason=o,a.code=r,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){Na&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Na})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Oa||(Oa=new e("logger/5.7.0")),Oa}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Aa){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ba=!!t,Aa=!!r}static setLogLevel(t){const r=va[t.toLowerCase()];null!=r?wa=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};Ra.errors=_a,Ra.levels=Ta;const Da=new Ra("bytes/5.7.0");function Ia(e){return!!e.toHexString}function Ca(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return Ca(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Sa(e){return"number"==typeof e&&e==e&&e%1==0}function ka(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Sa(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Sa(r)||r<0||r>=256)return!1}return!0}function Ba(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const xa="0123456789abcdef";function La(e,t){if(t||(t={}),"number"==typeof e){Da.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=xa[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Ia(e))return e.toHexString();if(Ba(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Da.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(ka(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=xa[(240&n)>>4]+xa[15&n]}return t}return Da.throwArgumentError("invalid hexlify value","value",e)}var Fa=w.BN;const Ua=new Ra("bignumber/5.7.0"),Ma={},qa=9007199254740991;let Va=!1,Ga=class e{constructor(e,t){e!==Ma&&Ua.throwError("cannot call constructor directly; use BigNumber.from",Ra.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Ha(Qa(this).fromTwos(e))}toTwos(e){return Ha(Qa(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Ha(Qa(this).add(Qa(e)))}sub(e){return Ha(Qa(this).sub(Qa(e)))}div(t){return e.from(t).isZero()&&Xa("division-by-zero","div"),Ha(Qa(this).div(Qa(t)))}mul(e){return Ha(Qa(this).mul(Qa(e)))}mod(e){const t=Qa(e);return t.isNeg()&&Xa("division-by-zero","mod"),Ha(Qa(this).umod(t))}pow(e){const t=Qa(e);return t.isNeg()&&Xa("negative-power","pow"),Ha(Qa(this).pow(t))}and(e){const t=Qa(e);return(this.isNegative()||t.isNeg())&&Xa("unbound-bitwise-result","and"),Ha(Qa(this).and(t))}or(e){const t=Qa(e);return(this.isNegative()||t.isNeg())&&Xa("unbound-bitwise-result","or"),Ha(Qa(this).or(t))}xor(e){const t=Qa(e);return(this.isNegative()||t.isNeg())&&Xa("unbound-bitwise-result","xor"),Ha(Qa(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Xa("negative-width","mask"),Ha(Qa(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Xa("negative-width","shl"),Ha(Qa(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Xa("negative-width","shr"),Ha(Qa(this).shrn(e))}eq(e){return Qa(this).eq(Qa(e))}lt(e){return Qa(this).lt(Qa(e))}lte(e){return Qa(this).lte(Qa(e))}gt(e){return Qa(this).gt(Qa(e))}gte(e){return Qa(this).gte(Qa(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Qa(this).isZero()}toNumber(){try{return Qa(this).toNumber()}catch(e){Xa("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ua.throwError("this platform does not support BigInt",Ra.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Va||(Va=!0,Ua.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ua.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ra.errors.UNEXPECTED_ARGUMENT,{}):Ua.throwError("BigNumber.toString does not accept parameters",Ra.errors.UNEXPECTED_ARGUMENT,{})),Qa(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(Ma,ja(t)):t.match(/^-?[0-9]+$/)?new e(Ma,ja(new Fa(t))):Ua.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Xa("underflow","BigNumber.from",t),(t>=qa||t<=-qa)&&Xa("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(ka(r))return e.from(La(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Ba(t)||"-"===t[0]&&Ba(t.substring(1))))return e.from(t)}return Ua.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function ja(e){if("string"!=typeof e)return ja(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Ua.throwArgumentError("invalid hex","value",e),"0x00"===(e=ja(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function Ha(e){return Ga.from(ja(e))}function Qa(e){const t=Ga.from(e).toHexString();return"-"===t[0]?new Fa("-"+t.substring(3),16):new Fa(t.substring(2),16)}function Xa(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Ua.throwError(e,Ra.errors.NUMERIC_FAULT,n)}var Ya=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const Ka=new Ra("properties/5.7.0");function $a(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function za(e){return Ya(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function Wa(e){const t={};for(const r in e)t[r]=e[r];return t}const Ja={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Za(e){if(null==e||Ja[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!Za(n))return!1}return!0}return Ka.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function el(e){if(Za(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>tl(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&$a(t,r,tl(n))}return t}return Ka.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function tl(e){return el(e)}var rl=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const nl=new Ra("abstract-provider/5.7.0");class il{constructor(){nl.checkAbstract(new.target,il),$a(this,"_isProvider",!0)}getFeeData(){return rl(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield za({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let r=null,n=null,i=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,i=Ga.from("1500000000"),n=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:r,maxFeePerGas:n,maxPriorityFeePerGas:i,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}var ol=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const sl=new Ra("abstract-signer/5.7.0"),al=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],ll=[Ra.errors.INSUFFICIENT_FUNDS,Ra.errors.NONCE_EXPIRED,Ra.errors.REPLACEMENT_UNDERPRICED];class cl{constructor(){sl.checkAbstract(new.target,cl),$a(this,"_isSigner",!0)}getBalance(e){return ol(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return ol(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return ol(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield za(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return ol(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield za(this.checkTransaction(e));return yield this.provider.call(r,t)}))}sendTransaction(e){return ol(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)}))}getChainId(){return ol(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return ol(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return ol(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return ol(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===al.indexOf(t)&&sl.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=Wa(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&sl.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return ol(this,void 0,void 0,(function*(){const t=yield za(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>ol(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&sl.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const r=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!r?0!==t.type&&1!==t.type||!r||sl.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):sl.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.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?(r&&sl.throwError("network does not support EIP-1559",Ra.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):sl.throwError("failed to get consistent fee data",Ra.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(ll.indexOf(e.code)>=0)throw e;return sl.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Ra.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&sl.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield za(t)}))}_checkProvider(e){this.provider||sl.throwError("missing provider",Ra.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class ul extends cl{constructor(e,t){super(),$a(this,"address",e),$a(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{sl.throwError(e,Ra.errors.UNSUPPORTED_OPERATION,{operation:t})}))}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new ul(this.address,e)}}const dl=new Ra("transactions/5.7.0");var hl;function fl(e,t){return{address:gr(e),storageKeys:(t||[]).map(((t,r)=>(32!==function(e){if("string"!=typeof e)e=La(e);else if(!Ba(e)||e.length%2)return null;return(e.length-2)/2}(t)&&dl.throwArgumentError("invalid access list storageKey",`accessList[${e}:${r}]`,t),t.toLowerCase())))}}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(hl||(hl={}));var pl=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const ml=new Ra("contracts/5.7.0");function gl(e,t){return pl(this,void 0,void 0,(function*(){const r=yield t;"string"!=typeof r&&ml.throwArgumentError("invalid address or ENS name","name",r);try{return gr(r)}catch(e){}e||ml.throwError("a provider or signer is needed to resolve ENS names",Ra.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield e.resolveName(r);return null==n&&ml.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function El(e,t,r){return pl(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>El(e,Array.isArray(t)?t[n]:t[r.name],r)))):"address"===r.type?yield gl(e,t):"tuple"===r.type?yield El(e,t,r.components):"array"===r.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>El(e,t,r.arrayChildren)))):Promise.reject(ml.makeError("invalid value for array",Ra.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function yl(e,t,r){return pl(this,void 0,void 0,(function*(){let n={};r.length===t.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=Wa(r.pop())),ml.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?n.from?n.from=za({override:gl(e.signer,n.from),signer:e.signer.getAddress()}).then((e=>pl(this,void 0,void 0,(function*(){return gr(e.signer)!==e.override&&ml.throwError("Contract with a Signer cannot override from",Ra.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):n.from=e.signer.getAddress():n.from&&(n.from=gl(e.provider,n.from));const i=yield za({args:El(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:za(n)||{}}),o=e.interface.encodeFunctionData(t,i.args),s={data:o,to:i.address},a=i.overrides;if(null!=a.nonce&&(s.nonce=Ga.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=Ga.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=Ga.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=Ga.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=Ga.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=function(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&dl.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),fl(e[0],e[1])):fl(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const r=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return fl(t,Object.keys(r).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}(a.accessList)),null==s.gasLimit&&null!=t.gas){let e=21e3;const r=function(e,t){if(t||(t={}),"number"==typeof e){Da.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),Ca(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Ia(e)&&(e=e.toHexString()),Ba(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Da.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return Ca(new Uint8Array(n))}return ka(e)?Ca(new Uint8Array(e)):Da.throwArgumentError("invalid arrayify value","value",e)}(o);for(let t=0;t<r.length;t++)e+=4,r[t]&&(e+=64);s.gasLimit=Ga.from(t.gas).add(e)}if(a.value){const e=Ga.from(a.value);e.isZero()||t.payable||ml.throwError("non-payable method cannot override value",Ra.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:n.value}),s.value=e}a.customData&&(s.customData=Wa(a.customData)),a.ccipReadEnabled&&(s.ccipReadEnabled=!!a.ccipReadEnabled),delete n.nonce,delete n.gasLimit,delete n.gasPrice,delete n.from,delete n.value,delete n.type,delete n.accessList,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.customData,delete n.ccipReadEnabled;const l=Object.keys(n).filter((e=>null!=n[e]));return l.length&&ml.throwError(`cannot override ${l.map((e=>JSON.stringify(e))).join(",")}`,Ra.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),s}))}function Al(e,t,r){const n=e.signer||e.provider;return function(...i){return pl(this,void 0,void 0,(function*(){let o;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=Wa(i.pop());null!=e.blockTag&&(o=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(o));const s=yield yl(e,t,i),a=yield n.call(s,o);try{let n=e.interface.decodeFunctionResult(t,a);return r&&1===t.outputs.length&&(n=n[0]),n}catch(t){throw t.code===Ra.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=s),t}}))}}function bl(e,t){return function(...r){return pl(this,void 0,void 0,(function*(){e.signer||ml.throwError("sending a transaction requires a signer",Ra.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const n=yield yl(e,t,r),i=yield e.signer.sendTransaction(n);return function(e,t){const r=t.wait.bind(t);t.wait=t=>r(t).then((t=>(t.events=t.logs.map((r=>{let n=tl(r),i=null;try{i=e.interface.parseLog(r)}catch(e){}return i&&(n.args=i.args,n.decode=(t,r)=>e.interface.decodeEventLog(i.eventFragment,t,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>e.provider,n.getBlock=()=>e.provider.getBlock(t.blockHash),n.getTransaction=()=>e.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(t),n})),t)))}(e,i),i}))}}function vl(e,t,r){return t.constant?Al(e,t,r):bl(e,t)}function wl(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.map((e=>Array.isArray(e)?e.join("|"):e)).join(":"):""):"*"}class Ol{constructor(e,t){$a(this,"tag",e),$a(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter((r=>!(!t&&r.listener===e)||(t=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((e=>e.listener))}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter((t=>{const r=e.slice();return setTimeout((()=>{t.listener.apply(this,r)}),0),!t.once})),t}prepareEvent(e){}getEmit(e){return[e]}}class Nl extends Ol{constructor(){super("error",null)}}class Tl extends Ol{constructor(e,t,r,n){const i={address:e};let o=t.getEventTopic(r);n?(o!==n[0]&&ml.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(wl(i),i),$a(this,"address",e),$a(this,"interface",t),$a(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=function(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){const o=e.slice();o.push(i);try{r(o,n[i])}catch(e){t.push({path:o,error:e})}}};return r([],e),t}(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class _l extends Ol{constructor(e,t){super("*",{address:e}),$a(this,"address",e),$a(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,r)=>this.interface.decodeEventLog(t.eventFragment,e,r),e.args=t.args}catch(e){}}}class Pl{constructor(e,t,r){$a(this,"interface",function(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}(new.target,"getInterface")(t)),null==r?($a(this,"provider",null),$a(this,"signer",null)):cl.isSigner(r)?($a(this,"provider",r.provider||null),$a(this,"signer",r)):il.isProvider(r)?($a(this,"provider",r),$a(this,"signer",null)):ml.throwArgumentError("invalid signer or provider","signerOrProvider",r),$a(this,"callStatic",{}),$a(this,"estimateGas",{}),$a(this,"functions",{}),$a(this,"populateTransaction",{}),$a(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const r=this.interface.events[t];$a(this.filters,t,((...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,e)}))),e[r.name]||(e[r.name]=[]),e[r.name].push(t)})),Object.keys(e).forEach((t=>{const r=e[t];1===r.length?$a(this.filters,t,this.filters[r[0]]):ml.warn(`Duplicate definition of ${t} (${r.join(", ")})`)}))}if($a(this,"_runningEvents",{}),$a(this,"_wrappedEmits",{}),null==e&&ml.throwArgumentError("invalid contract address or ENS name","addressOrName",e),$a(this,"address",e),this.provider)$a(this,"resolvedAddress",gl(this.provider,e));else try{$a(this,"resolvedAddress",Promise.resolve(gr(e)))}catch(e){ml.throwError("provider is required to use ENS name as contract address",Ra.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((e=>{}));const n={},i={};Object.keys(this.interface.functions).forEach((e=>{const t=this.interface.functions[e];if(i[e])ml.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{i[e]=!0;{const r=t.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(e)}null==this[e]&&$a(this,e,vl(this,t,!0)),null==this.functions[e]&&$a(this.functions,e,vl(this,t,!1)),null==this.callStatic[e]&&$a(this.callStatic,e,Al(this,t,!0)),null==this.populateTransaction[e]&&$a(this.populateTransaction,e,function(e,t){return function(...r){return yl(e,t,r)}}(this,t)),null==this.estimateGas[e]&&$a(this.estimateGas,e,function(e,t){const r=e.signer||e.provider;return function(...n){return pl(this,void 0,void 0,(function*(){r||ml.throwError("estimate require a provider or signer",Ra.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield yl(e,t,n);return yield r.estimateGas(i)}))}}(this,t))}})),Object.keys(n).forEach((e=>{const t=n[e];if(t.length>1)return;e=e.substring(1);const r=t[0];try{null==this[e]&&$a(this,e,this[r])}catch(e){}null==this.functions[e]&&$a(this.functions,e,this.functions[r]),null==this.callStatic[e]&&$a(this.callStatic,e,this.callStatic[r]),null==this.populateTransaction[e]&&$a(this.populateTransaction,e,this.populateTransaction[r]),null==this.estimateGas[e]&&$a(this.estimateGas,e,this.estimateGas[r])}))}static getContractAddress(e){return Er(e)}static getInterface(e){return ya.isInterface(e)?e:new ya(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,e).then((e=>("0x"===e&&ml.throwError("contract not deployed",Ra.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||ml.throwError("sending a transactions require a signer",Ra.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=Wa(e||{});return["from","to"].forEach((function(e){null!=t[e]&&ml.throwError("cannot override "+e,Ra.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new ul(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&$a(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return ma.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new Nl);if("event"===e)return this._normalizeRunningEvent(new Ol("event",null));if("*"===e)return this._normalizeRunningEvent(new _l(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new Tl(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const t=e.topics[0];if("string"!=typeof t)throw new Error("invalid topic");const r=this.interface.getEvent(t);return this._normalizeRunningEvent(new Tl(this.address,this.interface,r,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Ol(wl(t),t))}return this._normalizeRunningEvent(new _l(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const n=tl(t);return n.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},n.getBlock=()=>this.provider.getBlock(t.blockHash),n.getTransaction=()=>this.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(n),n}_addEventListener(e,t,r){if(this.provider||ml.throwError("events require a provider or a signer with a provider",Ra.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const r=r=>{let n=this._wrapEvent(e,r,t);if(null==n.decodeError)try{const t=e.getEmit(n);this.emit(e.filter,...t)}catch(e){n.decodeError=e.error}null!=e.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[e.tag]=r,null!=e.filter&&this.provider.on(e.filter,r)}}queryFilter(e,t,r){const n=this._getRunningEvent(e),i=Wa(n.filter);return"string"==typeof t&&Ba(t,32)?(null!=r&&ml.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((e=>e.map((e=>this._wrapEvent(n,e,null)))))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),n=r.run(t)>0;return this._checkRunningEvents(r),n}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce(((e,t)=>e+this._runningEvents[t].listenerCount()),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){const e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach((t=>{e.push(t)}));return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(const e in this._runningEvents){const t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class Rl extends Pl{}function Dl(e,t,...r){return M(this,void 0,void 0,(function*(){const n=[];for(const e of r)for(const t of e)t.callData&&n.push(t.callData);const i=yield function(e,t,r){return M(this,void 0,void 0,(function*(){const n=yield Il(e,t,r),i=new Map;for(const{req:e,resp:t}of n)i.set(e,t);return e.map((e=>({req:e,resp:i.get(e)})))}))}(n,e,t),o=new Map;for(const{req:e,resp:t}of i)o.set(e,null==t?void 0:t.result);return r.map((e=>e.filter((e=>!e.callData||o.get(e.callData))).map(((e,t)=>e.processor(e.callData?o.get(e.callData):null,t)))))}))}function Il(e,t,r){return M(this,void 0,void 0,(function*(){let n=[e];e.length>800&&(n=T(e,800));let i=[];const o=n.map((e=>M(this,void 0,void 0,(function*(){const n=e.map((e=>[e.to,e.data])),o={data:t.interface.encodeFunctionData("aggregate",[n]),to:r};let s;try{s=yield t.provider.call(o)}catch(n){const o=e.length;if(o>20){const n=Math.floor(o/2),[s,a]=yield Promise.all([Il(e.slice(0,n),t,r),Il(e.slice(n,o),t,r)]);i=[...i,...s,...a]}else{const e="[sendCallReqs] error";console.error(e,n)}}if(void 0===s)throw new Error("Unexpected batch result");const[a,l]=la.decode(["uint256","bytes[]"],s);if(e.length!==l.length)throw new Error("Unexpected length mismatch");return l.map(((t,r)=>({resp:{result:t},req:e[r]})))}))));return(yield Promise.allSettled(o)).filter((e=>"fulfilled"===e.status)).forEach((({value:e})=>{i=[...i,...e]})),i}))}var Cl;function Sl(e){return M(this,void 0,void 0,(function*(){switch(e){case Cl.customERC20IsMintable:return[{inputs:[],name:"isMintable",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];case Cl.customMultiCallAggregate:return[{constant:!1,inputs:[{components:[{name:"target",type:"address"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate",outputs:[{name:"blockNumber",type:"uint256"},{name:"returnData",type:"bytes[]"}],payable:!1,stateMutability:"nonpayable",type:"function"}];default:return(yield function(e){switch(e){case"./ABIs/AaveLendingPoolABI.ts":return import("./AaveLendingPoolABI-CdLq16uB.js");case"./ABIs/AaveLendingPoolAddressesProvider.ts":return import("./AaveLendingPoolAddressesProvider-EOSAznLK.js");case"./ABIs/AavePriceOracleABI.ts":return import("./AavePriceOracleABI-C2UEpXR4.js");case"./ABIs/AaveProtocolDataProviderABI.ts":return import("./AaveProtocolDataProviderABI-0JclmmLX.js");case"./ABIs/BaseDrops.ts":return import("./BaseDrops-BrQZPqKk.js");case"./ABIs/baseFilterV1.ts":return import("./baseFilterV1-BPjWXMKw.js");case"./ABIs/classicalPoolABI.ts":return import("./classicalPoolABI-D5LxySAJ.js");case"./ABIs/D3MM_READ_ABI.ts":return import("./D3MM_READ_ABI-B5536S-z.js");case"./ABIs/D3Proxy.ts":return import("./D3Proxy-CKIzLOhI.js");case"./ABIs/DODO1155.ts":return import("./DODO1155-DDY5Jxhf.js");case"./ABIs/DODO721.ts":return import("./DODO721-Kl5REiwU.js");case"./ABIs/dodoABI.ts":return import("./dodoABI-CLkEBJ8P.js");case"./ABIs/dodoBuyoutModel.ts":return import("./dodoBuyoutModel-BtQv3C3q.js");case"./ABIs/DODOCirculationHelperABI.ts":return import("./DODOCirculationHelperABI-gu1sCqZ2.js");case"./ABIs/dodoCP.ts":return import("./dodoCP-N8KA8JwJ.js");case"./ABIs/dodoCPABI.ts":return import("./dodoCPABI-CdAN0KhU.js");case"./ABIs/dodoCPABIV2.ts":return import("./dodoCPABIV2-yzF6FlEg.js");case"./ABIs/dodoCPFactory.ts":return import("./dodoCPFactory-CD0SxXT6.js");case"./ABIs/dodoCpProxy.ts":return import("./dodoCpProxy-D2AI9-4r.js");case"./ABIs/dodoCpProxyV2.ts":return import("./dodoCpProxyV2-CGZRqk2H.js");case"./ABIs/dodoCpProxyV202.ts":return import("./dodoCpProxyV202-CoZaEf_6.js");case"./ABIs/dodoCustomMintableERC20.ts":return import("./dodoCustomMintableERC20-CPpNoX1v.js");case"./ABIs/dodoDPPAdmin.ts":return import("./dodoDPPAdmin-B-fmpTbV.js");case"./ABIs/dodoDPPFactory.ts":return import("./dodoDPPFactory-DwAkVskt.js");case"./ABIs/dodoDppProxy.ts":return import("./dodoDppProxy-A7PPYsqp.js");case"./ABIs/dodoDropsProxy.ts":return import("./dodoDropsProxy-vHUWsRNO.js");case"./ABIs/dodoDSP.ts":return import("./dodoDSP-B6KYm-Cn.js");case"./ABIs/dodoDSPFactory.ts":return import("./dodoDSPFactory-j1eg7Ez-.js");case"./ABIs/dodoDspProxy.ts":return import("./dodoDspProxy-CU7OAvJG.js");case"./ABIs/dodoDVM.ts":return import("./dodoDVM-DDYx1JAy.js");case"./ABIs/dodoDVMFactory.ts":return import("./dodoDVMFactory-FpnJdZb2.js");case"./ABIs/dodoERC20V3Factory.ts":return import("./dodoERC20V3Factory-Cz4XKDrU.js");case"./ABIs/dodoEthProxyABI.ts":return import("./dodoEthProxyABI-CoX95QJI.js");case"./ABIs/dodoFeeImpl.ts":return import("./dodoFeeImpl-zR9Qv4Tq.js");case"./ABIs/dodoFragment.ts":return import("./dodoFragment-4lxmE2XJ.js");case"./ABIs/dodoMineV3Proxy.ts":return import("./dodoMineV3Proxy-xOGM7Jnv.js");case"./ABIs/dodoMineV3ProxyOld.ts":return import("./dodoMineV3ProxyOld-BqsZxJRU.js");case"./ABIs/dodoMiningABI.ts":return import("./dodoMiningABI-9J5C_6kN.js");case"./ABIs/dodoMiningReaderABI.ts":return import("./dodoMiningReaderABI-DmUXA9Gv.js");case"./ABIs/dodoNftERC1155.ts":return import("./dodoNftERC1155-Bw6ID2NE.js");case"./ABIs/dodoNftERC721.ts":return import("./dodoNftERC721-CI1l0ip9.js");case"./ABIs/dodoNftPoolProxy.ts":return import("./dodoNftPoolProxy-DQkcZHUV.js");case"./ABIs/dodoNftProxy.ts":return import("./dodoNftProxy-Di-aoLYM.js");case"./ABIs/dodoNftVault.ts":return import("./dodoNftVault-B4NZaXcd.js");case"./ABIs/dodoOracleABI.ts":return import("./dodoOracleABI-BxwZofBV.js");case"./ABIs/dodoPair.ts":return import("./dodoPair-VN1aEVFz.js");case"./ABIs/dodoPreminingABI.ts":return import("./dodoPreminingABI-DU7ocR7L.js");case"./ABIs/dodoProxyV2.ts":return import("./dodoProxyV2-9ED9HqK5.js");case"./ABIs/DODORouteProxy.ts":return import("./DODORouteProxy-51kl6QgI.js");case"./ABIs/dodoStarterProxy.ts":return import("./dodoStarterProxy-B1TdMOvw.js");case"./ABIs/dodoTokenABI.ts":return import("./dodoTokenABI-Dd2DVUbK.js");case"./ABIs/dodoUpCpFactory.ts":return import("./dodoUpCpFactory-D8ifQyp-.js");case"./ABIs/dodoUpCPFactoryABI.ts":return import("./dodoUpCPFactoryABI-C1W0Q4Ft.js");case"./ABIs/dodoV1PairProxy.ts":return import("./dodoV1PairProxy-DyRTqyPe.js");case"./ABIs/DODOV1PmmHelperABI.ts":return import("./DODOV1PmmHelperABI-DQqthyaE.js");case"./ABIs/dodoZooABI.ts":return import("./dodoZooABI-D9Uc4iLK.js");case"./ABIs/dppPoolABI.ts":return import("./dppPoolABI-BvoeLJgK.js");case"./ABIs/DropsERC721.ts":return import("./DropsERC721-7Bckjcar.js");case"./ABIs/DVM.ts":return import("./DVM-DjtWbqiJ.js");case"./ABIs/erc20ABI.ts":return import("./erc20ABI-v08X4jmE.js");case"./ABIs/erc20Helper.ts":return import("./erc20Helper-CG659oLz.js");case"./ABIs/feeABI.ts":return import("./feeABI-DnQdJUpQ.js");case"./ABIs/FilterAdmin.ts":return import("./FilterAdmin-jm_-DS1l.js");case"./ABIs/FilterERC1155V1.ts":return import("./FilterERC1155V1-VIUlIHdF.js");case"./ABIs/FilterERC721V1.ts":return import("./FilterERC721V1-CWDEPGmH.js");case"./ABIs/Fragment.ts":return import("./Fragment-Bd_AXeVx.js");case"./ABIs/FundingABI.ts":return import("./FundingABI-WqQDGVVa.js");case"./ABIs/IdodoV2.ts":return import("./IdodoV2-DlW8pwaE.js");case"./ABIs/LockedTokenVaultABI.ts":return import("./LockedTokenVaultABI-CfBj0wEX.js");case"./ABIs/MarginTrading.ts":return import("./MarginTrading-CQ5odvHB.js");case"./ABIs/MarginTradingFactory.ts":return import("./MarginTradingFactory-2RKqvCSO.js");case"./ABIs/MerkleDistributorABI.ts":return import("./MerkleDistributorABI-Ctn26fnA.js");case"./ABIs/multicallABI.ts":return import("./multicallABI-D9E1EeQD.js");case"./ABIs/nftContract.ts":return import("./nftContract-d4b6ObxG.js");case"./ABIs/nftFilterAdmin.ts":return import("./nftFilterAdmin-DMr_jrK_.js");case"./ABIs/NonfungiblePositionManager.ts":return import("./NonfungiblePositionManager-c8Yw_9-Q.js");case"./ABIs/oneBitSettlement.ts":return import("./oneBitSettlement-DMzQ-0t_.js");case"./ABIs/PancakePairABI.ts":return import("./PancakePairABI-Cc9LuXnX.js");case"./ABIs/setApprovalForAll.ts":return import("./setApprovalForAll-BvnCORJI.js");case"./ABIs/spaceIdABI.ts":return import("./spaceIdABI-BS4XGAT1.js");case"./ABIs/spaceIdResolverABI.ts":return import("./spaceIdResolverABI-sYDT8GfP.js");case"./ABIs/UniswapV3Pool.ts":return import("./UniswapV3Pool-Da11VKXE.js");case"./ABIs/v3MiningABI.ts":return import("./v3MiningABI-ZjGBkolS.js");case"./ABIs/vdodo.ts":return import("./vdodo-ttc2RVOs.js");case"./ABIs/vdodoTokenABI.ts":return import("./vdodoTokenABI-PldrbOSo.js");case"./ABIs/weth.ts":return import("./weth-Dz5DGEIF.js");default:return Promise.reject(new Error("Unknown variable dynamic import: "+e))}}(`./ABIs/${e}.ts`)).default}}))}!function(e){e.customERC20IsMintable="customERC20IsMintable",e.customMultiCallAggregate="customMultiCallAggregate",e.erc20Helper="erc20Helper",e.erc20ABI="erc20ABI",e.erc20Mock="erc20Mock",e.dodoERC20V3Factory="dodoERC20V3Factory",e.dodoCustomMintableERC20="dodoCustomMintableERC20",e.multicallABI="multicallABI",e.dppPoolABI="dppPoolABI",e.dvmPoolABI="DVM",e.classicalPoolABI="classicalPoolABI",e.v3MiningABI="v3MiningABI",e.dodoMiningABI="dodoMiningABI",e.dodoCP="dodoCP",e.dodoCPABI="dodoCPABI",e.dodoCPABIV2="dodoCPABIV2",e.dodoCpProxyV2="dodoCpProxyV2",e.dodoCpProxyV202="dodoCpProxyV202",e.dodoFeeImpl="dodoFeeImpl",e.feeABI="feeABI",e.vdodo="vdodo",e.vdodoTokenABI="vdodoTokenABI",e.dodoPreminingABI="dodoPreminingABI",e.MerkleDistributorABI="MerkleDistributorABI",e.DODOCirculationHelperABI="DODOCirculationHelperABI",e.FundingABI="FundingABI",e.dodoStarterProxy="dodoStarterProxy",e.MarginTrading="MarginTrading",e.MarginTradingFactory="MarginTradingFactory",e.DODORouteProxy="DODORouteProxy",e.dodoProxyV2="dodoProxyV2",e.AaveLendingPoolABI="AaveLendingPoolABI",e.AaveProtocolDataProviderABI="AaveProtocolDataProviderABI",e.AaveLendingPoolAddressesProvider="AaveLendingPoolAddressesProvider",e.AavePriceOracleABI="AavePriceOracleABI",e.spaceIdABI="spaceIdABI",e.spaceIdResolverABI="spaceIdResolverABI",e.dodoABI="dodoABI",e.PancakePairABI="PancakePairABI",e.NonfungiblePositionManager="NonfungiblePositionManager",e.UniswapV3Pool="UniswapV3Pool",e.dodoDspProxy="dodoDspProxy",e.dodoDppProxy="dodoDppProxy",e.IdodoV2="IdodoV2",e.dodoDPPAdmin="dodoDPPAdmin",e.dodoDSP="dodoDSP",e.dodoDVM="dodoDVM",e.dodoDSPFactory="dodoDSPFactory",e.dodoDVMFactory="dodoDVMFactory",e.D3Proxy="D3Proxy",e.dodoNftERC721="dodoNftERC721",e.dodoNftERC1155="dodoNftERC1155",e.dodoDropsProxy="dodoDropsProxy",e.dodoNftVault="dodoNftVault",e.dodoNftProxy="dodoNftProxy",e.dodoFragment="dodoFragment",e.dodoBuyoutModel="dodoBuyoutModel",e.dodoNftPoolProxy="dodoNftPoolProxy",e.nftFilterAdmin="nftFilterAdmin",e.baseFilterV1="baseFilterV1",e.FilterERC721V1="FilterERC721V1",e.FilterERC1155V1="FilterERC1155V1",e.dodoV1PairProxy="dodoV1PairProxy",e.dodoPair="dodoPair",e.dodoMineV3Proxy="dodoMineV3Proxy",e.dodoMineV3ProxyOld="dodoMineV3ProxyOld",e.LockedTokenVaultABI="LockedTokenVaultABI",e.DODOV1PmmHelperABI="DODOV1PmmHelperABI",e.D3MM_READ_ABI="D3MM_READ_ABI"}(Cl||(Cl={}));let kl=!1,Bl=!1;const xl={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ll=xl.default,Fl=null;const Ul=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),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 Ml,ql;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(Ml||(Ml={})),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"}(ql||(ql={}));const Vl="0123456789abcdef";let Gl=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==xl[r]&&this.throwArgumentError("invalid log level name","logLevel",e),Ll>xl[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(Bl)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=Vl[t[e]>>4],r+=Vl[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=t;let s="";switch(r){case ql.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case ql.CALL_EXCEPTION:case ql.INSUFFICIENT_FUNDS:case ql.MISSING_NEW:case ql.NONCE_EXPIRED:case ql.REPLACEMENT_UNDERPRICED:case ql.TRANSACTION_REPLACED:case ql.UNPREDICTABLE_GAS_LIMIT:s=r}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const a=new Error(t);return a.reason=o,a.code=r,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){Ul&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Ul})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Fl||(Fl=new e("logger/5.7.0")),Fl}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),kl){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Bl=!!t,kl=!!r}static setLogLevel(t){const r=xl[t.toLowerCase()];null!=r?Ll=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};Gl.errors=ql,Gl.levels=Ml;const jl=new Gl("properties/5.7.0");function Hl(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}const Ql={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Xl(e){if(null==e||Ql[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!Xl(n))return!1}return!0}return jl.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Yl(e){if(Xl(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>Kl(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&Hl(t,r,Kl(n))}return t}return jl.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Kl(e){return Yl(e)}const $l=(e,t,r)=>M(void 0,void 0,void 0,(function*(){const n=yield Sl(e);return new ya(n).encodeFunctionData(t,r)})),zl=(e,t,r)=>new ya(e).encodeFunctionData(t,r);class Wl extends bo{constructor(){super(...arguments),this._pendingBatchAggregator=null,this._pendingBatch=null,this._provider=null}setProvider(e){this._provider=e}send(e,t){const r=Object.create(null,{send:{get:()=>super.send}});return M(this,void 0,void 0,(function*(){if("eth_call"!==e||2!==t.length||"object"!=typeof t[0]||!t[0].to||!t[0].data||"string"!=typeof t[1])return this._provider?this._provider.send(e,t):r.send.call(this,e,t);const n={request:{method:e,params:t},resolve:null,reject:null},i=new Promise(((e,t)=>{n.resolve=e,n.reject=t}));this._pendingBatch||(this._pendingBatch=[]),this._pendingBatch.push(n);const o=()=>M(this,void 0,void 0,(function*(){const t=this._pendingBatch||[];let r;this._pendingBatch=null,this._pendingBatchAggregator=null;const i=yield this.detectNetwork();r="object"!=typeof i?parseInt(i,i.startsWith("0x")?16:10):i.chainId;const o=yield function(e,t){return M(this,void 0,void 0,(function*(){let r="";const n=t.map((e=>{const[t]=e;return r=e[1],[t.to,t.data]})),i=yield $l(Cl.customMultiCallAggregate,"aggregate",[n]);return[{to:F[e].MULTI_CALL,data:i},r]}))}(r,t.map((e=>e.request.params))),s={method:e,params:o,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"requestBatch",request:Kl(t.map((e=>e.request))),provider:this,id:s.id});const a=e=>{if(e.error||!e.result)t.forEach((t=>{try{const r=new Error(e.error.message);r.code=e.error.code,r.data=e.error.data,t.reject(r)}catch(r){t.reject(e.error)}})),this.emit("debug",{action:"responseBatch.error",request:s,response:e,provider:this,id:s.id});else{const[r,i]=la.decode(["uint256","bytes[]"],e.result),o=r.toNumber();if(this._setFastBlockNumber(o),this.emit("blockNumberChanged",o),t.length!==i.length)return void n.reject("Unexpected length mismatch");t.forEach(((e,t)=>{const r=i[t];e.resolve(r)})),this.emit("debug",{action:"responseBatch",request:s,response:e,provider:this,decodeList:i,id:s.id})}},l=e=>{this.emit("debug",{action:"responseBatch.error",error:e,request:s,provider:this,id:s.id}),t.forEach((t=>{t.reject(e)}))};if(!this._provider)return gn(this.connection,JSON.stringify(s)).then(a,l);try{const e=yield this._provider.send(s.method,s.params);a({id:s.id,jsonrpc:s.jsonrpc,result:e})}catch(e){l(e)}}));return this._pendingBatchAggregator?this._pendingBatch.length>800&&(clearTimeout(this._pendingBatchAggregator),o()):this._pendingBatchAggregator=setTimeout(o,10),i}))}}const Jl="contract-query";class Zl{constructor(e){this.subContractRequestsList=[],this.debugQuery=null==e?void 0:e.debugQuery,this.debugProvider=null==e?void 0:e.debugProvider,this.rpc=null==e?void 0:e.rpc,this.getConfigProvider=null==e?void 0:e.getProvider,this.staticJsonRpcProviderMap=new Map,this.batchStaticJsonRpcProviderMap=new Map,this.batchContractMap=new Map}setRpc(e){this.rpc=e,this.subContractRequestsList.forEach((t=>{t.setRpc(e)}))}setGetConfigProvider(e){this.getConfigProvider=e,this.subContractRequestsList.forEach((t=>{t.setGetConfigProvider(e)})),this.batchContractMap=new Map,this.staticJsonRpcProviderMap=new Map,this.batchStaticJsonRpcProviderMap=new Map}getProvider(e){var t,r;const n=null===(t=this.getConfigProvider)||void 0===t?void 0:t.call(this,e);if(n)return n;const i=null===(r=this.rpc)||void 0===r?void 0:r[e];if(!i)throw new Error(`ChainId ${e} not found`);if(this.staticJsonRpcProviderMap.has(e))return this.staticJsonRpcProviderMap.get(e);const o=new bo(i,e);return this.debugProvider&&o.on("debug",console.log),this.staticJsonRpcProviderMap.set(e,o),o}getBatchProvider(e){var t,r;const n=null===(t=this.getConfigProvider)||void 0===t?void 0:t.call(this,e),i=null===(r=this.rpc)||void 0===r?void 0:r[e];if(!i&&!n)throw new Error(`ChainId ${e} not found`);if(this.batchStaticJsonRpcProviderMap.has(e))return this.batchStaticJsonRpcProviderMap.get(e);const o=new Wl(i,e);return o.setProvider(n||null),this.debugProvider&&o.on("debug",console.log),this.batchStaticJsonRpcProviderMap.set(e,o),o}createContractRequests(){const e=new Zl({rpc:this.rpc,getProvider:this.getConfigProvider,debugQuery:this.debugQuery,debugProvider:this.debugProvider});return this.subContractRequestsList.push(e),e}getContract(e,t,r){const n=this.getProvider(e);return new Rl(t,r,n)}getBatchContract(e,t,r){var n;const i=this.batchContractMap.get(e);if(i){if(i.has(t))return i.get(t)}else this.batchContractMap.set(e,new Map);const o=this.getBatchProvider(e),s=new Rl(t,r,o);return null===(n=this.batchContractMap.get(e))||void 0===n||n.set(t,s),s}getBatchContractByAbiName(e,t,r){return M(this,void 0,void 0,(function*(){const n=yield this.getContractInterface(r);return this.getBatchContract(e,t,n)}))}getContractInterface(e){return Sl(e)}callMultiQuery(e,t){return M(this,void 0,void 0,(function*(){const r=F[e],{MULTI_CALL:n}=r,i=yield this.getContractInterface(Cl.customMultiCallAggregate),o=this.getContract(e,n,i),s=[],a=new Map,l=new Map,c={};for(let r=0;r<t.length;r++){const{contractAddress:n,method:i,params:o,abiName:u,callback:d}=t[r];let h=l.get(u);if(!h){const t=yield this.getContractInterface(u);a.set(u,t),h=this.getContract(e,n,t),l.set(u,h)}const f={to:n,data:h.interface.encodeFunctionData(i,o)};s.push({callData:f,processor:e=>{const t=new ya(a.get(u)).decodeFunctionResult(i,e);d&&d(t);const n=d?d(t):void 0;return c[r]=n||t,c[r]}})}const[u]=yield Dl(o,n,s);return u}))}callQuery(e,t){return M(this,void 0,void 0,(function*(){const r=yield this.getContractInterface(t.abiName),n=this.getContract(e,t.contractAddress,r),i=yield n.callStatic[t.method](...t.params),o=t.callback?t.callback(i):void 0;return o||i}))}batchCallQuery(e,t){return M(this,void 0,void 0,(function*(){this.debugQuery&&console.log({action:"batchCallQuery.request",chainId:e,query:t});const r=yield this.getBatchProvider(e),n=yield $l(t.abiName,t.method,t.params),i=yield r.call({to:t.contractAddress,data:n}),o=yield((e,t,r)=>M(void 0,void 0,void 0,(function*(){const n=yield Sl(e);return new ya(n).decodeFunctionResult(t,r)})))(t.abiName,t.method,i),s=t.callback?t.callback(o):void 0;return this.debugQuery&&console.log({action:"batchCallQuery.response",chainId:e,query:t,response:o}),s||o}))}getBlockNumber(e){return M(this,void 0,void 0,(function*(){const t=this.getBatchProvider(e),r=yield t.getBlockNumber();return t.emit("blockNumberChanged",r),r}))}getETHBalance(e,t){return M(this,void 0,void 0,(function*(){const r=this.getProvider(e),n=yield r.getBalance(t);return new P(n.toString()).div(1e18)}))}}const ec=JSON;function tc(e,t){if(!Boolean(e))throw new Error(t)}function rc(e,t){if(!Boolean(e))throw new Error("Unexpected invariant triggered.")}const nc=/\r\n|[\n\r]/g;function ic(e,t){let r=0,n=1;for(const i of e.body.matchAll(nc)){if("number"==typeof i.index||rc(!1),i.index>=t)break;r=i.index+i[0].length,n+=1}return{line:n,column:t+1-r}}function oc(e,t){const r=e.locationOffset.column-1,n="".padStart(r)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=1===t.line?r:0,l=t.column+a,c=`${e.name}:${s}:${l}\n`,u=n.split(/\r\n|[\n\r]/g),d=u[i];if(d.length>120){const e=Math.floor(l/80),t=l%80,r=[];for(let e=0;e<d.length;e+=80)r.push(d.slice(e,e+80));return c+sc([[`${s} |`,r[0]],...r.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",r[e+1]]])}return c+sc([[s-1+" |",u[i-1]],[`${s} |`,d],["|","^".padStart(l)],[`${s+1} |`,u[i+1]]])}function sc(e){const t=e.filter((([e,t])=>void 0!==t)),r=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(r)+(t?" "+t:""))).join("\n")}class ac extends Error{constructor(e,...t){var r,n,i;const{nodes:o,source:s,positions:a,path:l,originalError:c,extensions:u}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=l?l:void 0,this.originalError=null!=c?c:void 0,this.nodes=lc(Array.isArray(o)?o:o?[o]:void 0);const d=lc(null===(r=this.nodes)||void 0===r?void 0:r.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=s?s:null==d||null===(n=d[0])||void 0===n?void 0:n.source,this.positions=null!=a?a:null==d?void 0:d.map((e=>e.start)),this.locations=a&&s?a.map((e=>ic(s,e))):null==d?void 0:d.map((e=>ic(e.source,e.start)));const h="object"==typeof(f=null==c?void 0:c.extensions)&&null!==f?null==c?void 0:c.extensions:void 0;var f;this.extensions=null!==(i=null!=u?u:h)&&void 0!==i?i:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=c&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,ac):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const r of this.nodes)r.loc&&(e+="\n\n"+oc((t=r.loc).source,ic(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+oc(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function lc(e){return void 0===e||0===e.length?void 0:e}function cc(e,t,r){return new ac(`Syntax Error: ${r}`,{source:e,positions:[t]})}class uc{constructor(e,t,r){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class dc{constructor(e,t,r,n,i,o){this.kind=e,this.start=t,this.end=r,this.line=n,this.column=i,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const hc={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},fc=new Set(Object.keys(hc));function pc(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&fc.has(t)}var mc,gc,Ec,yc;function Ac(e){return 9===e||32===e}function bc(e){return e>=48&&e<=57}function vc(e){return e>=97&&e<=122||e>=65&&e<=90}function wc(e){return vc(e)||95===e}function Oc(e){return vc(e)||bc(e)||95===e}function Nc(e){var t;let r=Number.MAX_SAFE_INTEGER,n=null,i=-1;for(let t=0;t<e.length;++t){var o;const s=e[t],a=Tc(s);a!==s.length&&(n=null!==(o=n)&&void 0!==o?o:t,i=t,0!==t&&a<r&&(r=a))}return e.map(((e,t)=>0===t?e:e.slice(r))).slice(null!==(t=n)&&void 0!==t?t:0,i+1)}function Tc(e){let t=0;for(;t<e.length&&Ac(e.charCodeAt(t));)++t;return t}!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(mc||(mc={})),function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(gc||(gc={})),function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(Ec||(Ec={})),function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(yc||(yc={}));class _c{constructor(e){const t=new dc(yc.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==yc.EOF)do{if(e.next)e=e.next;else{const t=kc(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===yc.COMMENT);return e}}function Pc(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Rc(e,t){return Dc(e.charCodeAt(t))&&Ic(e.charCodeAt(t+1))}function Dc(e){return e>=55296&&e<=56319}function Ic(e){return e>=56320&&e<=57343}function Cc(e,t){const r=e.source.body.codePointAt(t);if(void 0===r)return yc.EOF;if(r>=32&&r<=126){const e=String.fromCodePoint(r);return'"'===e?"'\"'":`"${e}"`}return"U+"+r.toString(16).toUpperCase().padStart(4,"0")}function Sc(e,t,r,n,i){const o=e.line,s=1+r-e.lineStart;return new dc(t,r,n,o,s,i)}function kc(e,t){const r=e.source.body,n=r.length;let i=t;for(;i<n;){const t=r.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===r.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return Bc(e,i);case 33:return Sc(e,yc.BANG,i,i+1);case 36:return Sc(e,yc.DOLLAR,i,i+1);case 38:return Sc(e,yc.AMP,i,i+1);case 40:return Sc(e,yc.PAREN_L,i,i+1);case 41:return Sc(e,yc.PAREN_R,i,i+1);case 46:if(46===r.charCodeAt(i+1)&&46===r.charCodeAt(i+2))return Sc(e,yc.SPREAD,i,i+3);break;case 58:return Sc(e,yc.COLON,i,i+1);case 61:return Sc(e,yc.EQUALS,i,i+1);case 64:return Sc(e,yc.AT,i,i+1);case 91:return Sc(e,yc.BRACKET_L,i,i+1);case 93:return Sc(e,yc.BRACKET_R,i,i+1);case 123:return Sc(e,yc.BRACE_L,i,i+1);case 124:return Sc(e,yc.PIPE,i,i+1);case 125:return Sc(e,yc.BRACE_R,i,i+1);case 34:return 34===r.charCodeAt(i+1)&&34===r.charCodeAt(i+2)?jc(e,i):Fc(e,i)}if(bc(t)||45===t)return xc(e,i,t);if(wc(t))return Hc(e,i);throw cc(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":Pc(t)||Rc(r,i)?`Unexpected character: ${Cc(e,i)}.`:`Invalid character: ${Cc(e,i)}.`)}return Sc(e,yc.EOF,n,n)}function Bc(e,t){const r=e.source.body,n=r.length;let i=t+1;for(;i<n;){const e=r.charCodeAt(i);if(10===e||13===e)break;if(Pc(e))++i;else{if(!Rc(r,i))break;i+=2}}return Sc(e,yc.COMMENT,t,i,r.slice(t+1,i))}function xc(e,t,r){const n=e.source.body;let i=t,o=r,s=!1;if(45===o&&(o=n.charCodeAt(++i)),48===o){if(o=n.charCodeAt(++i),bc(o))throw cc(e.source,i,`Invalid number, unexpected digit after 0: ${Cc(e,i)}.`)}else i=Lc(e,i,o),o=n.charCodeAt(i);if(46===o&&(s=!0,o=n.charCodeAt(++i),i=Lc(e,i,o),o=n.charCodeAt(i)),69!==o&&101!==o||(s=!0,o=n.charCodeAt(++i),43!==o&&45!==o||(o=n.charCodeAt(++i)),i=Lc(e,i,o),o=n.charCodeAt(i)),46===o||wc(o))throw cc(e.source,i,`Invalid number, expected digit but got: ${Cc(e,i)}.`);return Sc(e,s?yc.FLOAT:yc.INT,t,i,n.slice(t,i))}function Lc(e,t,r){if(!bc(r))throw cc(e.source,t,`Invalid number, expected digit but got: ${Cc(e,t)}.`);const n=e.source.body;let i=t+1;for(;bc(n.charCodeAt(i));)++i;return i}function Fc(e,t){const r=e.source.body,n=r.length;let i=t+1,o=i,s="";for(;i<n;){const n=r.charCodeAt(i);if(34===n)return s+=r.slice(o,i),Sc(e,yc.STRING,t,i+1,s);if(92!==n){if(10===n||13===n)break;if(Pc(n))++i;else{if(!Rc(r,i))throw cc(e.source,i,`Invalid character within String: ${Cc(e,i)}.`);i+=2}}else{s+=r.slice(o,i);const t=117===r.charCodeAt(i+1)?123===r.charCodeAt(i+2)?Uc(e,i):Mc(e,i):Gc(e,i);s+=t.value,i+=t.size,o=i}}throw cc(e.source,i,"Unterminated string.")}function Uc(e,t){const r=e.source.body;let n=0,i=3;for(;i<12;){const e=r.charCodeAt(t+i++);if(125===e){if(i<5||!Pc(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|Vc(e),n<0)break}throw cc(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+i)}".`)}function Mc(e,t){const r=e.source.body,n=qc(r,t+2);if(Pc(n))return{value:String.fromCodePoint(n),size:6};if(Dc(n)&&92===r.charCodeAt(t+6)&&117===r.charCodeAt(t+7)){const e=qc(r,t+8);if(Ic(e))return{value:String.fromCodePoint(n,e),size:12}}throw cc(e.source,t,`Invalid Unicode escape sequence: "${r.slice(t,t+6)}".`)}function qc(e,t){return Vc(e.charCodeAt(t))<<12|Vc(e.charCodeAt(t+1))<<8|Vc(e.charCodeAt(t+2))<<4|Vc(e.charCodeAt(t+3))}function Vc(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Gc(e,t){const r=e.source.body;switch(r.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw cc(e.source,t,`Invalid character escape sequence: "${r.slice(t,t+2)}".`)}function jc(e,t){const r=e.source.body,n=r.length;let i=e.lineStart,o=t+3,s=o,a="";const l=[];for(;o<n;){const n=r.charCodeAt(o);if(34===n&&34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)){a+=r.slice(s,o),l.push(a);const n=Sc(e,yc.BLOCK_STRING,t,o+3,Nc(l).join("\n"));return e.line+=l.length-1,e.lineStart=i,n}if(92!==n||34!==r.charCodeAt(o+1)||34!==r.charCodeAt(o+2)||34!==r.charCodeAt(o+3))if(10!==n&&13!==n)if(Pc(n))++o;else{if(!Rc(r,o))throw cc(e.source,o,`Invalid character within String: ${Cc(e,o)}.`);o+=2}else a+=r.slice(s,o),l.push(a),13===n&&10===r.charCodeAt(o+1)?o+=2:++o,a="",s=o,i=o;else a+=r.slice(s,o),s=o+1,o+=4}throw cc(e.source,o,"Unterminated string.")}function Hc(e,t){const r=e.source.body,n=r.length;let i=t+1;for(;i<n;){if(!Oc(r.charCodeAt(i)))break;++i}return Sc(e,yc.NAME,t,i,r.slice(t,i))}const Qc=10,Xc=2;function Yc(e){return Kc(e,[])}function Kc(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const r=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:Kc(t,r)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Xc)return"[Array]";const r=Math.min(Qc,e.length),n=e.length-r,i=[];for(let n=0;n<r;++n)i.push(Kc(e[n],t));1===n?i.push("... 1 more item"):n>1&&i.push(`... ${n} more items`);return"["+i.join(", ")+"]"}(e,r);return function(e,t){const r=Object.entries(e);if(0===r.length)return"{}";if(t.length>Xc)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const n=r.map((([e,r])=>e+": "+Kc(r,t)));return"{ "+n.join(", ")+" }"}(e,r)}(e,t);default:return String(e)}}const $c=globalThis.process&&"production"===globalThis.process.env.NODE_ENV?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if("object"==typeof e&&null!==e){var r;const n=t.prototype[Symbol.toStringTag];if(n===(Symbol.toStringTag in e?e[Symbol.toStringTag]:null===(r=e.constructor)||void 0===r?void 0:r.name)){const t=Yc(e);throw new Error(`Cannot use ${n} "${t}" from another module or realm.\n\nEnsure that there is only one instance of "graphql" in the node_modules\ndirectory. If different versions of "graphql" are the dependencies of other\nrelied on modules, use "resolutions" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate "graphql" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`)}}return!1};class zc{constructor(e,t="GraphQL request",r={line:1,column:1}){"string"==typeof e||tc(!1,`Body must be a string. Received: ${Yc(e)}.`),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||tc(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||tc(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class Wc{constructor(e,t={}){const r=function(e){return $c(e,zc)}(e)?e:new zc(e);this._lexer=new _c(r),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(yc.NAME);return this.node(e,{kind:Ec.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:Ec.DOCUMENT,definitions:this.many(yc.SOF,this.parseDefinition,yc.EOF)})}parseDefinition(){if(this.peek(yc.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===yc.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw cc(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(yc.BRACE_L))return this.node(e,{kind:Ec.OPERATION_DEFINITION,operation:mc.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let r;return this.peek(yc.NAME)&&(r=this.parseName()),this.node(e,{kind:Ec.OPERATION_DEFINITION,operation:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(yc.NAME);switch(e.value){case"query":return mc.QUERY;case"mutation":return mc.MUTATION;case"subscription":return mc.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(yc.PAREN_L,this.parseVariableDefinition,yc.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:Ec.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(yc.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(yc.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(yc.DOLLAR),this.node(e,{kind:Ec.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:Ec.SELECTION_SET,selections:this.many(yc.BRACE_L,this.parseSelection,yc.BRACE_R)})}parseSelection(){return this.peek(yc.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let r,n;return this.expectOptionalToken(yc.COLON)?(r=t,n=this.parseName()):n=t,this.node(e,{kind:Ec.FIELD,alias:r,name:n,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(yc.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(yc.PAREN_L,t,yc.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,r=this.parseName();return this.expectToken(yc.COLON),this.node(t,{kind:Ec.ARGUMENT,name:r,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(yc.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(yc.NAME)?this.node(e,{kind:Ec.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:Ec.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:Ec.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:Ec.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case yc.BRACKET_L:return this.parseList(e);case yc.BRACE_L:return this.parseObject(e);case yc.INT:return this.advanceLexer(),this.node(t,{kind:Ec.INT,value:t.value});case yc.FLOAT:return this.advanceLexer(),this.node(t,{kind:Ec.FLOAT,value:t.value});case yc.STRING:case yc.BLOCK_STRING:return this.parseStringLiteral();case yc.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:Ec.BOOLEAN,value:!0});case"false":return this.node(t,{kind:Ec.BOOLEAN,value:!1});case"null":return this.node(t,{kind:Ec.NULL});default:return this.node(t,{kind:Ec.ENUM,value:t.value})}case yc.DOLLAR:if(e){if(this.expectToken(yc.DOLLAR),this._lexer.token.kind===yc.NAME){const e=this._lexer.token.value;throw cc(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:Ec.STRING,value:e.value,block:e.kind===yc.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:Ec.LIST,values:this.any(yc.BRACKET_L,(()=>this.parseValueLiteral(e)),yc.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:Ec.OBJECT,fields:this.any(yc.BRACE_L,(()=>this.parseObjectField(e)),yc.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,r=this.parseName();return this.expectToken(yc.COLON),this.node(t,{kind:Ec.OBJECT_FIELD,name:r,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(yc.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(yc.AT),this.node(t,{kind:Ec.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(yc.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(yc.BRACKET_R),t=this.node(e,{kind:Ec.LIST_TYPE,type:r})}else t=this.parseNamedType();return this.expectOptionalToken(yc.BANG)?this.node(e,{kind:Ec.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:Ec.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(yc.STRING)||this.peek(yc.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),n=this.many(yc.BRACE_L,this.parseOperationTypeDefinition,yc.BRACE_R);return this.node(e,{kind:Ec.SCHEMA_DEFINITION,description:t,directives:r,operationTypes:n})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(yc.COLON);const r=this.parseNamedType();return this.node(e,{kind:Ec.OPERATION_TYPE_DEFINITION,operation:t,type:r})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),n=this.parseConstDirectives();return this.node(e,{kind:Ec.SCALAR_TYPE_DEFINITION,description:t,name:r,directives:n})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:Ec.OBJECT_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:i,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(yc.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(yc.BRACE_L,this.parseFieldDefinition,yc.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName(),n=this.parseArgumentDefs();this.expectToken(yc.COLON);const i=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:Ec.FIELD_DEFINITION,description:t,name:r,arguments:n,type:i,directives:o})}parseArgumentDefs(){return this.optionalMany(yc.PAREN_L,this.parseInputValueDef,yc.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseName();this.expectToken(yc.COLON);const n=this.parseTypeReference();let i;this.expectOptionalToken(yc.EQUALS)&&(i=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:Ec.INPUT_VALUE_DEFINITION,description:t,name:r,type:n,defaultValue:i,directives:o})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:Ec.INTERFACE_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:i,fields:o})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:Ec.UNION_TYPE_DEFINITION,description:t,name:r,directives:n,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(yc.EQUALS)?this.delimitedMany(yc.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:Ec.ENUM_TYPE_DEFINITION,description:t,name:r,directives:n,values:i})}parseEnumValuesDefinition(){return this.optionalMany(yc.BRACE_L,this.parseEnumValueDefinition,yc.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),r=this.parseEnumValueName(),n=this.parseConstDirectives();return this.node(e,{kind:Ec.ENUM_VALUE_DEFINITION,description:t,name:r,directives:n})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw cc(this._lexer.source,this._lexer.token.start,`${Jc(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:Ec.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:r,directives:n,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(yc.BRACE_L,this.parseInputValueDef,yc.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===yc.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),r=this.optionalMany(yc.BRACE_L,this.parseOperationTypeDefinition,yc.BRACE_R);if(0===t.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:Ec.SCHEMA_EXTENSION,directives:t,operationTypes:r})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),r=this.parseConstDirectives();if(0===r.length)throw this.unexpected();return this.node(e,{kind:Ec.SCALAR_TYPE_EXTENSION,name:t,directives:r})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),r=this.parseImplementsInterfaces(),n=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===r.length&&0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:Ec.OBJECT_TYPE_EXTENSION,name:t,interfaces:r,directives:n,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),r=this.parseImplementsInterfaces(),n=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===r.length&&0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:Ec.INTERFACE_TYPE_EXTENSION,name:t,interfaces:r,directives:n,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),r=this.parseConstDirectives(),n=this.parseUnionMemberTypes();if(0===r.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:Ec.UNION_TYPE_EXTENSION,name:t,directives:r,types:n})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),r=this.parseConstDirectives(),n=this.parseEnumValuesDefinition();if(0===r.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:Ec.ENUM_TYPE_EXTENSION,name:t,directives:r,values:n})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),r=this.parseConstDirectives(),n=this.parseInputFieldsDefinition();if(0===r.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:Ec.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:r,fields:n})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(yc.AT);const r=this.parseName(),n=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:Ec.DIRECTIVE_DEFINITION,description:t,name:r,arguments:n,repeatable:i,locations:o})}parseDirectiveLocations(){return this.delimitedMany(yc.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(gc,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new uc(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw cc(this._lexer.source,t.start,`Expected ${Zc(e)}, found ${Jc(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==yc.NAME||t.value!==e)throw cc(this._lexer.source,t.start,`Expected "${e}", found ${Jc(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===yc.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return cc(this._lexer.source,t.start,`Unexpected ${Jc(t)}.`)}any(e,t,r){this.expectToken(e);const n=[];for(;!this.expectOptionalToken(r);)n.push(t.call(this));return n}optionalMany(e,t,r){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(r));return e}return[]}many(e,t,r){this.expectToken(e);const n=[];do{n.push(t.call(this))}while(!this.expectOptionalToken(r));return n}delimitedMany(e,t){this.expectOptionalToken(e);const r=[];do{r.push(t.call(this))}while(this.expectOptionalToken(e));return r}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(void 0!==e&&t.kind!==yc.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw cc(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function Jc(e){const t=e.value;return Zc(e.kind)+(null!=t?` "${t}"`:"")}function Zc(e){return function(e){return e===yc.BANG||e===yc.DOLLAR||e===yc.AMP||e===yc.PAREN_L||e===yc.PAREN_R||e===yc.SPREAD||e===yc.COLON||e===yc.EQUALS||e===yc.AT||e===yc.BRACKET_L||e===yc.BRACKET_R||e===yc.BRACE_L||e===yc.PIPE||e===yc.BRACE_R}(e)?`"${e}"`:e}const eu=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function tu(e){return ru[e.charCodeAt(0)]}const ru=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],nu=Object.freeze({});function iu(e,t){const r=e[t];return"object"==typeof r?r:"function"==typeof r?{enter:r,leave:void 0}:{enter:e.enter,leave:e.leave}}function ou(e){return function(e,t,r=hc){const n=new Map;for(const e of Object.values(Ec))n.set(e,iu(t,e));let i,o,s,a=Array.isArray(e),l=[e],c=-1,u=[],d=e;const h=[],f=[];do{c++;const e=c===l.length,E=e&&0!==u.length;if(e){if(o=0===f.length?void 0:h[h.length-1],d=s,s=f.pop(),E)if(a){d=d.slice();let e=0;for(const[t,r]of u){const n=t-e;null===r?(d.splice(n,1),e++):d[n]=r}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[e,t]of u)d[e]=t}c=i.index,l=i.keys,u=i.edits,a=i.inArray,i=i.prev}else if(s){if(o=a?c:l[c],d=s[o],null==d)continue;h.push(o)}let y;if(!Array.isArray(d)){var p,m;pc(d)||tc(!1,`Invalid AST Node: ${Yc(d)}.`);const r=e?null===(p=n.get(d.kind))||void 0===p?void 0:p.leave:null===(m=n.get(d.kind))||void 0===m?void 0:m.enter;if(y=null==r?void 0:r.call(t,d,o,s,h,f),y===nu)break;if(!1===y){if(!e){h.pop();continue}}else if(void 0!==y&&(u.push([o,y]),!e)){if(!pc(y)){h.pop();continue}d=y}}var g;void 0===y&&E&&u.push([o,d]),e?h.pop():(i={inArray:a,index:c,keys:l,edits:u,prev:i},a=Array.isArray(d),l=a?d:null!==(g=r[d.kind])&&void 0!==g?g:[],c=-1,u=[],s&&f.push(s),s=d)}while(void 0!==i);return 0!==u.length?u[u.length-1][1]:e}(e,su)}const su={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>au(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=cu("(",au(e.variableDefinitions,", "),")"),r=au([e.operation,au([e.name,t]),au(e.directives," ")]," ");return("query"===r?"":r+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:r,directives:n})=>e+": "+t+cu(" = ",r)+cu(" ",au(n," "))},SelectionSet:{leave:({selections:e})=>lu(e)},Field:{leave({alias:e,name:t,arguments:r,directives:n,selectionSet:i}){const o=cu("",e,": ")+t;let s=o+cu("(",au(r,", "),")");return s.length>80&&(s=o+cu("(\n",uu(au(r,"\n")),"\n)")),au([s,au(n," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+cu(" ",au(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:r})=>au(["...",cu("on ",e),au(t," "),r]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:r,directives:n,selectionSet:i})=>`fragment ${e}${cu("(",au(r,", "),")")} on ${t} ${cu("",au(n," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const r=e.replace(/"""/g,'\\"""'),n=r.split(/\r\n|[\n\r]/g),i=1===n.length,o=n.length>1&&n.slice(1).every((e=>0===e.length||Ac(e.charCodeAt(0)))),s=r.endsWith('\\"""'),a=e.endsWith('"')&&!s,l=e.endsWith("\\"),c=a||l,u=!i||e.length>70||c||o||s;let d="";const h=i&&Ac(e.charCodeAt(0));return(u&&!h||o)&&(d+="\n"),d+=r,(u||c)&&(d+="\n"),'"""'+d+'"""'}(e):`"${e.replace(eu,tu)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+au(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+au(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+cu("(",au(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:r})=>cu("",e,"\n")+au(["schema",au(t," "),lu(r)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:r})=>cu("",e,"\n")+au(["scalar",t,au(r," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>cu("",e,"\n")+au(["type",t,cu("implements ",au(r," & ")),au(n," "),lu(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:r,type:n,directives:i})=>cu("",e,"\n")+t+(du(r)?cu("(\n",uu(au(r,"\n")),"\n)"):cu("(",au(r,", "),")"))+": "+n+cu(" ",au(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:r,defaultValue:n,directives:i})=>cu("",e,"\n")+au([t+": "+r,cu("= ",n),au(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:n,fields:i})=>cu("",e,"\n")+au(["interface",t,cu("implements ",au(r," & ")),au(n," "),lu(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:r,types:n})=>cu("",e,"\n")+au(["union",t,au(r," "),cu("= ",au(n," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:r,values:n})=>cu("",e,"\n")+au(["enum",t,au(r," "),lu(n)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:r})=>cu("",e,"\n")+au([t,au(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:r,fields:n})=>cu("",e,"\n")+au(["input",t,au(r," "),lu(n)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:r,repeatable:n,locations:i})=>cu("",e,"\n")+"directive @"+t+(du(r)?cu("(\n",uu(au(r,"\n")),"\n)"):cu("(",au(r,", "),")"))+(n?" repeatable":"")+" on "+au(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>au(["extend schema",au(e," "),lu(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>au(["extend scalar",e,au(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>au(["extend type",e,cu("implements ",au(t," & ")),au(r," "),lu(n)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:n})=>au(["extend interface",e,cu("implements ",au(t," & ")),au(r," "),lu(n)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:r})=>au(["extend union",e,au(t," "),cu("= ",au(r," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:r})=>au(["extend enum",e,au(t," "),lu(r)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:r})=>au(["extend input",e,au(t," "),lu(r)]," ")}};function au(e,t=""){var r;return null!==(r=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==r?r:""}function lu(e){return cu("{\n",uu(au(e,"\n")),"\n}")}function cu(e,t,r=""){return null!=t&&""!==t?e+t+r:""}function uu(e){return cu(" ",e.replace(/\n/g,"\n "))}function du(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}const hu=e=>{let t;const r=e.definitions.filter((e=>"OperationDefinition"===e.kind));return 1===r.length&&(t=r[0]?.name?.value),t},fu=e=>{if("string"==typeof e){let r;try{const n=new Wc(e,t).parseDocument();r=hu(n)}catch(e){}return{query:e,operationName:r}}var t;const r=hu(e);return{query:ou(e),operationName:r}};class pu extends Error{constructor(e,t){super(`${pu.extractMessage(e)}: ${JSON.stringify({response:e,request:t})}`),Object.setPrototypeOf(this,pu.prototype),this.response=e,this.request=t,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,pu)}static extractMessage(e){return e.errors?.[0]?.message??`GraphQL Error (Code: ${e.status})`}}const mu=e=>{let t={};return e&&("undefined"!=typeof Headers&&e instanceof Headers||D&&D.Headers&&e instanceof D.Headers?t=(e=>{const t={};return e.forEach(((e,r)=>{t[r]=e})),t})(e):Array.isArray(e)?e.forEach((([e,r])=>{e&&void 0!==r&&(t[e]=r)})):t=e),t},gu=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Eu=e=>async t=>{const{url:r,query:n,variables:i,operationName:o,fetch:s,fetchOptions:a,middleware:l}=t,c={...t.headers};let u,d="";"POST"===e?(u=bu(n,i,o,a.jsonSerializer),"string"==typeof u&&(c["Content-Type"]="application/json")):d=(e=>{if(!Array.isArray(e.query)){const t=e,r=[`query=${encodeURIComponent(gu(t.query))}`];return e.variables&&r.push(`variables=${encodeURIComponent(t.jsonSerializer.stringify(t.variables))}`),t.operationName&&r.push(`operationName=${encodeURIComponent(t.operationName)}`),r.join("&")}if(void 0!==e.variables&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,r=e.query.reduce(((e,r,n)=>(e.push({query:gu(r),variables:t.variables?t.jsonSerializer.stringify(t.variables[n]):void 0}),e)),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(r))}`})({query:n,variables:i,operationName:o,jsonSerializer:a.jsonSerializer??ec});const h={method:e,headers:c,body:u,...a};let f=r,p=h;if(l){const e=await Promise.resolve(l({...h,url:r,operationName:o,variables:i})),{url:t,...n}=e;f=t,p=n}return d&&(f=`${f}?${d}`),await s(f,p)};class yu{constructor(e,t={}){this.url=e,this.requestConfig=t,this.rawRequest=async(...e)=>{const[t,r,n]=e,i=((e,t,r)=>e.query?e:{query:e,variables:t,requestHeaders:r,signal:void 0})(t,r,n),{headers:o,fetch:s=I,method:a="POST",requestMiddleware:l,responseMiddleware:c,...u}=this.requestConfig,{url:d}=this;void 0!==i.signal&&(u.signal=i.signal);const{operationName:h}=fu(i.query);return Au({url:d,query:i.query,variables:i.variables,headers:{...mu(wu(o)),...mu(i.requestHeaders)},operationName:h,fetch:s,method:a,fetchOptions:u,middleware:l}).then((e=>(c&&c(e),e))).catch((e=>{throw c&&c(e),e}))}}async request(e,...t){const[r,n]=t,i=((e,t,r)=>e.document?e:{document:e,variables:t,requestHeaders:r,signal:void 0})(e,r,n),{headers:o,fetch:s=I,method:a="POST",requestMiddleware:l,responseMiddleware:c,...u}=this.requestConfig,{url:d}=this;void 0!==i.signal&&(u.signal=i.signal);const{query:h,operationName:f}=fu(i.document);return Au({url:d,query:h,variables:i.variables,headers:{...mu(wu(o)),...mu(i.requestHeaders)},operationName:f,fetch:s,method:a,fetchOptions:u,middleware:l}).then((e=>(c&&c(e),e.data))).catch((e=>{throw c&&c(e),e}))}batchRequests(e,t){const r=((e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0})(e,t),{headers:n,...i}=this.requestConfig;void 0!==r.signal&&(i.signal=r.signal);const o=r.documents.map((({document:e})=>fu(e).query)),s=r.documents.map((({variables:e})=>e));return Au({url:this.url,query:o,variables:s,headers:{...mu(wu(n)),...mu(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??I,method:this.requestConfig.method||"POST",fetchOptions:i,middleware:this.requestConfig.requestMiddleware}).then((e=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(e),e.data))).catch((e=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(e),e}))}setHeaders(e){return this.requestConfig.headers=e,this}setHeader(e,t){const{headers:r}=this.requestConfig;return r?r[e]=t:this.requestConfig.headers={[e]:t},this}setEndpoint(e){return this.url=e,this}}const Au=async e=>{const{query:t,variables:r,fetchOptions:n}=e,i=Eu((e.method??"post").toUpperCase());const o=Array.isArray(e.query),s=await i(e),a=await vu(s,n.jsonSerializer??ec),l=Array.isArray(a)?!a.some((({data:e})=>!e)):Boolean(a.data),c=Array.isArray(a)||!a.errors||Array.isArray(a.errors)&&!a.errors.length||"all"===n.errorPolicy||"ignore"===n.errorPolicy;if(s.ok&&c&&l){const{errors:e,...t}=(Array.isArray(a),a),r="ignore"===n.errorPolicy?t:a;return{...o?{data:r}:r,headers:s.headers,status:s.status}}throw new pu({..."string"==typeof a?{error:a}:a,status:s.status,headers:s.headers},{query:t,variables:r})},bu=(e,t,r,n)=>{const i=n??ec;if(!Array.isArray(e))return i.stringify({query:e,variables:t,operationName:r});if(void 0!==t&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const o=e.reduce(((e,r,n)=>(e.push({query:r,variables:t?t[n]:void 0}),e)),[]);return i.stringify(o)},vu=async(e,t)=>{let r;return e.headers.forEach(((e,t)=>{"content-type"===t.toLowerCase()&&(r=e)})),r&&(r.toLowerCase().startsWith("application/json")||r.toLowerCase().startsWith("application/graphql+json")||r.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},wu=e=>"function"==typeof e?e():e,Ou={url:"https://api.dodoex.io/frontend-graphql"};class Nu{constructor(e){const t=Object.assign(Object.assign({},Ou),e);this.url=t.url,this.getHeaders=t.getHeaders;const r=new yu(this.url,{fetch:t.fetch,requestMiddleware:e=>{const t=new URL(e.url);return e.operationName&&t.searchParams.append("opname",e.operationName),Object.assign(Object.assign({},e),{url:t.toString()})}});this.client=r,this.setHeaders()}setHeaders(){return M(this,void 0,void 0,(function*(){var e;const t=yield null===(e=this.getHeaders)||void 0===e?void 0:e.call(this);t&&this.client.setHeaders(t)}))}getData(e,t){return M(this,void 0,void 0,(function*(){yield this.setHeaders();return this.client.request(e,t)}))}getQuery(e,...[t]){return{queryKey:["graphql","getQuery",e,t],queryFn:()=>M(this,void 0,void 0,(function*(){return yield this.getData(e.toString(),t)}))}}getInfiniteQuery(e,t,...[r]){return{queryKey:["graphql","getInfiniteQuery",t,e,r],queryFn:n=>M(this,[n],void 0,(function*({pageParam:n}){return yield this.getData(e.toString(),Object.assign(Object.assign({},r),{where:Object.assign(Object.assign({},null==r?void 0:r.where),{[t]:n})}))}))}}}const Tu={host:"https://api.dodoex.io",fetch:I};class _u{constructor(e){const t=Object.assign(Object.assign({},Tu),e);this.host=t.host,this._getFetch=()=>t.fetch}getUrl(e,t){let r=`${this.host}/${e}`;return t&&(r=`${r}?${C.stringify(t)}`),r}responseProcessor(e){return M(this,void 0,void 0,(function*(){if(e.ok){const t=yield e.json();return{response:e,result:t}}throw new Error(`Response ${JSON.stringify(e)} failed`)}))}getJson(e,t,r){return M(this,void 0,void 0,(function*(){const n=this.getUrl(e,t),i=this._getFetch(),o=yield i(n,_({method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}},r));return this.responseProcessor(o)}))}postJson(e,t,r,n){return M(this,void 0,void 0,(function*(){const i=this.getUrl(e,r),o=this._getFetch(),s=yield o(i,_({method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:t?JSON.stringify(t):void 0},n));return this.responseProcessor(s)}))}}let Pu=!1,Ru=!1;const Du={debug:1,default:2,info:2,warning:3,error:4,off:5};let Iu=Du.default,Cu=null;const Su=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),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 ku,Bu;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(ku||(ku={})),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"}(Bu||(Bu={}));const xu="0123456789abcdef";class Lu{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==Du[r]&&this.throwArgumentError("invalid log level name","logLevel",e),Iu>Du[r]||console.log.apply(console,t)}debug(...e){this._log(Lu.levels.DEBUG,e)}info(...e){this._log(Lu.levels.INFO,e)}warn(...e){this._log(Lu.levels.WARNING,e)}makeError(e,t,r){if(Ru)return this.makeError("censored error",t,{});t||(t=Lu.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=xu[t[e]>>4],r+=xu[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(t){n.push(e+"="+JSON.stringify(r[e].toString()))}})),n.push(`code=${t}`),n.push(`version=${this.version}`);const i=e;let o="";switch(t){case Bu.NUMERIC_FAULT:{o="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":o+="-"+t;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Bu.CALL_EXCEPTION:case Bu.INSUFFICIENT_FUNDS:case Bu.MISSING_NEW:case Bu.NONCE_EXPIRED:case Bu.REPLACEMENT_UNDERPRICED:case Bu.TRANSACTION_REPLACED:case Bu.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const s=new Error(e);return s.reason=i,s.code=t,Object.keys(r).forEach((function(e){s[e]=r[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Lu.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){Su&&this.throwError("platform missing String.prototype.normalize",Lu.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Su})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Lu.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Lu.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,Lu.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,Lu.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",Lu.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Lu.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",Lu.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Cu||(Cu=new Lu("logger/5.8.0")),Cu}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Lu.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Pu){if(!e)return;this.globalLogger().throwError("error censorship permanent",Lu.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ru=!!e,Pu=!!t}static setLogLevel(e){const t=Du[e.toLowerCase()];null!=t?Iu=t:Lu.globalLogger().warn("invalid log level - "+e)}static from(e){return new Lu(e)}}Lu.errors=Bu,Lu.levels=ku;const Fu=new Lu("bytes/5.8.0");function Uu(e){return!!e.toHexString}function Mu(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return Mu(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function qu(e){return"number"==typeof e&&e==e&&e%1==0}function Vu(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!qu(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!qu(r)||r<0||r>=256)return!1}return!0}function Gu(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))}const ju="0123456789abcdef";function Hu(e,t){if(t||(t={}),"number"==typeof e){Fu.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=ju[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Uu(e))return e.toHexString();if(Gu(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Fu.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Vu(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=ju[(240&n)>>4]+ju[15&n]}return t}return Fu.throwArgumentError("invalid hexlify value","value",e)}function Qu(e,t){for("string"!=typeof e?e=Hu(e):Gu(e)||Fu.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Fu.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}const Xu="bignumber/5.8.0";var Yu=w.BN;const Ku=new Lu(Xu),$u={},zu=9007199254740991;let Wu=!1;class Ju{constructor(e,t){e!==$u&&Ku.throwError("cannot call constructor directly; use BigNumber.from",Lu.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return ed(td(this).fromTwos(e))}toTwos(e){return ed(td(this).toTwos(e))}abs(){return"-"===this._hex[0]?Ju.from(this._hex.substring(1)):this}add(e){return ed(td(this).add(td(e)))}sub(e){return ed(td(this).sub(td(e)))}div(e){return Ju.from(e).isZero()&&rd("division-by-zero","div"),ed(td(this).div(td(e)))}mul(e){return ed(td(this).mul(td(e)))}mod(e){const t=td(e);return t.isNeg()&&rd("division-by-zero","mod"),ed(td(this).umod(t))}pow(e){const t=td(e);return t.isNeg()&&rd("negative-power","pow"),ed(td(this).pow(t))}and(e){const t=td(e);return(this.isNegative()||t.isNeg())&&rd("unbound-bitwise-result","and"),ed(td(this).and(t))}or(e){const t=td(e);return(this.isNegative()||t.isNeg())&&rd("unbound-bitwise-result","or"),ed(td(this).or(t))}xor(e){const t=td(e);return(this.isNegative()||t.isNeg())&&rd("unbound-bitwise-result","xor"),ed(td(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&rd("negative-width","mask"),ed(td(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&rd("negative-width","shl"),ed(td(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&rd("negative-width","shr"),ed(td(this).shrn(e))}eq(e){return td(this).eq(td(e))}lt(e){return td(this).lt(td(e))}lte(e){return td(this).lte(td(e))}gt(e){return td(this).gt(td(e))}gte(e){return td(this).gte(td(e))}isNegative(){return"-"===this._hex[0]}isZero(){return td(this).isZero()}toNumber(){try{return td(this).toNumber()}catch(e){rd("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ku.throwError("this platform does not support BigInt",Lu.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Wu||(Wu=!0,Ku.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ku.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Lu.errors.UNEXPECTED_ARGUMENT,{}):Ku.throwError("BigNumber.toString does not accept parameters",Lu.errors.UNEXPECTED_ARGUMENT,{})),td(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Ju)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new Ju($u,Zu(e)):e.match(/^-?[0-9]+$/)?new Ju($u,Zu(new Yu(e))):Ku.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&rd("underflow","BigNumber.from",e),(e>=zu||e<=-zu)&&rd("overflow","BigNumber.from",e),Ju.from(String(e));const t=e;if("bigint"==typeof t)return Ju.from(t.toString());if(Vu(t))return Ju.from(Hu(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return Ju.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(Gu(e)||"-"===e[0]&&Gu(e.substring(1))))return Ju.from(e)}return Ku.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function Zu(e){if("string"!=typeof e)return Zu(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Ku.throwArgumentError("invalid hex","value",e),"0x00"===(e=Zu(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function ed(e){return Ju.from(Zu(e))}function td(e){const t=Ju.from(e).toHexString();return"-"===t[0]?new Yu("-"+t.substring(3),16):new Yu(t.substring(2),16)}function rd(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Ku.throwError(e,Lu.errors.NUMERIC_FAULT,n)}const nd=new Lu(Xu),id={},od=Ju.from(0),sd=Ju.from(-1);function ad(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),nd.throwError(e,Lu.errors.NUMERIC_FAULT,i)}let ld="0";for(;ld.length<256;)ld+=ld;function cd(e){if("number"!=typeof e)try{e=Ju.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+ld.substring(0,e):nd.throwArgumentError("invalid decimal size","decimals",e)}function ud(e,t){null==t&&(t=0);const r=cd(t),n=(e=Ju.from(e)).lt(od);n&&(e=e.mul(sd));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=e.div(r).toString();return e=1===r.length?o:o+"."+i,n&&(e="-"+e),e}function dd(e,t){null==t&&(t=0);const r=cd(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||nd.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&nd.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&nd.throwArgumentError("too many decimal points","value",e);let o=i[0],s=i[1];for(o||(o="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&ad("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=Ju.from(o),l=Ju.from(s);let c=a.mul(r).add(l);return n&&(c=c.mul(sd)),c}class hd{constructor(e,t,r,n){e!==id&&nd.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Lu.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=cd(n),Object.freeze(this)}static from(e){if(e instanceof hd)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||nd.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&nd.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&nd.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&nd.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new hd(id,t,r,n)}}class fd{constructor(e,t,r,n){e!==id&&nd.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Lu.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&nd.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=dd(this._value,this.format.decimals),r=dd(e._value,e.format.decimals);return fd.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=dd(this._value,this.format.decimals),r=dd(e._value,e.format.decimals);return fd.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=dd(this._value,this.format.decimals),r=dd(e._value,e.format.decimals);return fd.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=dd(this._value,this.format.decimals),r=dd(e._value,e.format.decimals);return fd.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=fd.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(pd.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=fd.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(pd.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&nd.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=fd.from("1"+ld.substring(0,e),this.format),n=md.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&nd.throwArgumentError("invalid byte width","width",e);return Qu(Ju.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return fd.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Ju.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Gu(e)||"bigint"==typeof e||Vu(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),fd.fromString(ud(e,t),hd.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=hd.from(t),n=dd(e,r.decimals);!r.signed&&n.lt(od)&&ad("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Qu(i,r.width/8));const o=ud(n,r.decimals);return new fd(id,i,o,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=hd.from(t);if(function(e,t){if(t||(t={}),"number"==typeof e){Fu.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),Mu(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Uu(e)&&(e=e.toHexString()),Gu(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Fu.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return Mu(new Uint8Array(n))}return Vu(e)?Mu(new Uint8Array(e)):Fu.throwArgumentError("invalid arrayify value","value",e)}(e).length>r.width/8)throw new Error("overflow");let n=Ju.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=ud(n,r.decimals);return new fd(id,i,o,r)}static from(e,t){if("string"==typeof e)return fd.fromString(e,t);if(Vu(e))return fd.fromBytes(e,t);try{return fd.fromValue(e,0,t)}catch(e){if(e.code!==Lu.errors.INVALID_ARGUMENT)throw e}return nd.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const pd=fd.from(1),md=fd.from("0.5"),gd={getIsV3Mining:e=>["DSP","GSP","LPTOKEN","V3CLASSICAL"].includes(e),singleSideLp:e=>["CLASSICAL","V3CLASSICAL","DPP"].includes(e),canOperateLiquidity(e,t,r,n){const i=null!=t?t:r;return!!(e&&i&&n)&&("DPP"!==e||i.toLocaleLowerCase()===n.toLocaleLowerCase())}};class Ed extends String{constructor(e,t){super(e),this.value=e,this.__meta__=t}toString(){return this.value}}const yd={"\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n }\n ":new Ed("\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n}\n "),"\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n }\n ":new Ed("\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n}\n "),"\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n }\n":new Ed("\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n}\n "),"\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new Ed("\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new Ed("\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new Ed("\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query FetchPoolList(\n $first: Int\n $where: Pair_filter\n $orderBy: Pair_orderBy\n ) {\n pairs(\n first: $first\n where: $where\n orderBy: $orderBy\n orderDirection: desc\n ) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n }\n ":new Ed("\n query FetchPoolList($first: Int, $where: Pair_filter, $orderBy: Pair_orderBy) {\n pairs(first: $first, where: $where, orderBy: $orderBy, orderDirection: desc) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n}\n "),"\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n ":new Ed("\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n}\n "),"\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n ":new Ed("\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n}\n "),"\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n }\n ":new Ed("\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n}\n "),"\n query FetchPool(\n $id: ID!\n $where: Pair_filter\n $liquidityWhere: Liquiditylist_filter\n ) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n }\n ":new Ed("\n query FetchPool($id: ID!, $where: Pair_filter, $liquidityWhere: Liquiditylist_filter) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n}\n "),"\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n }\n ":new Ed("\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n}\n "),"\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n }\n ":new Ed("\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n}\n "),"\n query FetchPoolSwapList(\n $first: Int\n $skip: Int\n $where: Swap_filter\n $orderBy: Swap_orderBy\n $orderDirection: OrderDirection\n ) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n }\n ":new Ed("\n query FetchPoolSwapList($first: Int, $skip: Int, $where: Swap_filter, $orderBy: Swap_orderBy, $orderDirection: OrderDirection) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n}\n "),"\n query FetchLiquidityPositions(\n $id: ID!\n $first: Int\n $skip: Int\n $where: LiquidityPosition_filter\n $miningWhere: LiquidityPosition_filter\n $orderBy: LiquidityPosition_orderBy\n $orderDirection: OrderDirection\n ) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n }\n ":new Ed("\n query FetchLiquidityPositions($id: ID!, $first: Int, $skip: Int, $where: LiquidityPosition_filter, $miningWhere: LiquidityPosition_filter, $orderBy: LiquidityPosition_orderBy, $orderDirection: OrderDirection) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n}\n "),"\n query FetchPoolPairList(\n $first: Int\n $baseWhere: Pair_filter\n $quoteWhere: Pair_filter\n $orderBy: Pair_orderBy\n $orderDirection: OrderDirection\n ) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n }\n ":new Ed("\n query FetchPoolPairList($first: Int, $baseWhere: Pair_filter, $quoteWhere: Pair_filter, $orderBy: Pair_orderBy, $orderDirection: OrderDirection) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n}\n "),"\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n }\n ":new Ed("\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n}\n "),"\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n }\n ":new Ed("\n query FetchNoticeCenterTransactionList($where: Notice_centertransactionListFilter) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n}\n "),"\n query FetchLiquidityLpPartnerRewards(\n $where: LiquidityLpPartnerRewardsInput\n ) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n }\n ":new Ed("\n query FetchLiquidityLpPartnerRewards($where: LiquidityLpPartnerRewardsInput) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n}\n "),"\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n }\n ":new Ed("\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n}\n ")};function Ad(e){var t;return null!==(t=yd[e])&&void 0!==t?t:{}}const bd=Ad("\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n }\n");class vd{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("AMMV3Api does not initialize the contractRequests");this.contractRequests=new Zl(e.contractRequestsConfig)}}getPositions(e,t,r){return{queryKey:[Jl,"ammv3","getPositions",...arguments],enabled:!!e&&!!t,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.callMultiQuery(e,r.map((e=>({abiName:Cl.NonfungiblePositionManager,contractAddress:t,method:"positions",params:e}))))}))}}getOwner(e,t,r){return{queryKey:[Jl,"ammv3","getOwner",...arguments],enabled:!!e&&!!t,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Cl.NonfungiblePositionManager,contractAddress:t,method:"ownerOf",params:[r]})}))}}getBalanceOf(e,t,r){return{queryKey:[Jl,"ammv3","getBalanceOf",...arguments],enabled:!!e&&!!t&&!!r,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t||!r)return null;const n=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.NonfungiblePositionManager,contractAddress:t,method:"balanceOf",params:[r]});return new P(n.toString())}))}}getTokenOfOwnerByIndex(e,t,r){return{queryKey:[Jl,"ammv3","getTokenOfOwnerByIndex",...arguments],enabled:!!e&&!!t,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.callMultiQuery(e,r.map((e=>({abiName:Cl.NonfungiblePositionManager,contractAddress:t,method:"tokenOfOwnerByIndex",params:e.map((e=>e.toString()))}))))}))}}getV3PoolSlot0(e,t){return{queryKey:[Jl,"ammv3","getSlot0",...arguments],enabled:!!e||!!t,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Cl.UniswapV3Pool,contractAddress:t,method:"slot0",params:[]})}))}}getV3PoolLiquidity(e,t){return{queryKey:[Jl,"ammv3","getV3PoolLiquidity",...arguments],enabled:!!e||!!t,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Cl.UniswapV3Pool,contractAddress:t,method:"liquidity",params:[]})}))}}getCollect(e,t,r,n){return{queryKey:[Jl,"ammv3","getCollect",...arguments],enabled:!!e||!!t,queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&t&&r&&n))return null;const i=Ju.from(2).pow(128).sub(1);return yield this.contractRequests.callQuery(e,{abiName:Cl.NonfungiblePositionManager,contractAddress:t,method:"collect",params:[{tokenId:r,recipient:n,amount0Max:i,amount1Max:i},{from:n}]})}))}}}vd.graphql={AllV3TicksDocument:bd},vd.utils=gd,vd.encode={};const wd=(e,t)=>new R(Ju.isBigNumber(e)?e.toString():e).div(10**t),Od={fetchPoolList:Ad("\n query FetchPoolList(\n $first: Int\n $where: Pair_filter\n $orderBy: Pair_orderBy\n ) {\n pairs(\n first: $first\n where: $where\n orderBy: $orderBy\n orderDirection: desc\n ) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n }\n "),fetchLiquidityList:Ad("\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n "),fetchMyLiquidityList:Ad("\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n "),fetchDashboardPairList:Ad("\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n }\n "),fetchPool:Ad("\n query FetchPool(\n $id: ID!\n $where: Pair_filter\n $liquidityWhere: Liquiditylist_filter\n ) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n }\n "),fetchPoolDayData:Ad("\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n }\n "),fetchPoolDashboard:Ad("\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n }\n "),fetchPoolSwapList:Ad("\n query FetchPoolSwapList(\n $first: Int\n $skip: Int\n $where: Swap_filter\n $orderBy: Swap_orderBy\n $orderDirection: OrderDirection\n ) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n }\n "),fetchLiquidityPositions:Ad("\n query FetchLiquidityPositions(\n $id: ID!\n $first: Int\n $skip: Int\n $where: LiquidityPosition_filter\n $miningWhere: LiquidityPosition_filter\n $orderBy: LiquidityPosition_orderBy\n $orderDirection: OrderDirection\n ) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n }\n "),fetchPoolPairList:Ad("\n query FetchPoolPairList(\n $first: Int\n $baseWhere: Pair_filter\n $quoteWhere: Pair_filter\n $orderBy: Pair_orderBy\n $orderDirection: OrderDirection\n ) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n }\n ")};class Nd{QuerySellBase(e,t){try{let r;if(0===t.RStatus)r=this.ROneSellBase(e,t);else if(1===t.RStatus){const n=t.B0.minus(t.B),i=t.Q.minus(t.Q0);e.lt(n)?(r=this.RAboveSellBase(e,t),r.gt(i)&&(r=i)):r=e.eq(n)?i:i.plus(this.ROneSellBase(e.minus(n),t))}else r=this.RBelowSellBase(e,t);const n=r.multipliedBy(t.mtFeeRate),i=r.multipliedBy(t.lpFeeRate);return r.minus(n).minus(i)}catch(e){return new P(0)}}QuerySellQuote(e,t){try{let r;if(0===t.RStatus)r=this.ROneSellQuote(e,t);else if(1===t.RStatus)r=this.RAboveSellQuote(e,t);else{const n=t.B.minus(t.B0),i=t.Q0.minus(t.Q);e.lt(i)?(r=this.RBelowSellQuote(e,t),r.gt(n)&&(r=n)):r=e.eq(i)?n:n.plus(this.ROneSellQuote(e.minus(i),t))}const n=r.multipliedBy(t.mtFeeRate),i=r.multipliedBy(t.lpFeeRate);return r.minus(n).minus(i)}catch(e){return new P(0)}}GetMidPrice(e){if(2==e.RStatus){let t=e.Q0.multipliedBy(e.Q0).div(e.Q).div(e.Q);return t=new P(1).minus(e.k).plus(e.k.multipliedBy(t)),e.OraclePrice.div(t)}if(1==e.RStatus){let t=e.B0.multipliedBy(e.B0).div(e.B).div(e.B);return t=new P(1).minus(e.k).plus(e.k.multipliedBy(t)),e.OraclePrice.multipliedBy(t)}return e.OraclePrice}ROneSellBase(e,t){return _d(t.Q0,t.Q0,e,t.OraclePrice,t.k)}ROneSellQuote(e,t){return _d(t.B0,t.B0,e,new P(1).div(t.OraclePrice),t.k)}RAboveSellBase(e,t){return Td(t.B0,t.B.plus(e),t.B,t.OraclePrice,t.k)}RAboveSellQuote(e,t){return _d(t.B0,t.B,e,new P(1).div(t.OraclePrice),t.k)}RBelowSellQuote(e,t){return Td(t.Q0,t.Q.plus(e),t.Q,new P(1).div(t.OraclePrice),t.k)}RBelowSellBase(e,t){return _d(t.Q0,t.Q,e,t.OraclePrice,t.k)}}const Td=(e,t,r,n,i)=>{if(e.lte(0))throw new Error("TARGET_IS_ZERO");const o=n.multipliedBy(t.minus(r));if(i.eq(0))return o;const s=e.multipliedBy(e).div(t).div(r).multipliedBy(i);return o.multipliedBy(new P(1).minus(i).plus(s))},_d=(e,t,r,n,i)=>{if(e.lte(0))throw new Error("TARGET_IS_ZERO");if(r.eq(0))return r;if(i.eq(0))return r.multipliedBy(n).gt(t)?t:r.multipliedBy(n);if(i.eq(1)){const i=n.multipliedBy(r).multipliedBy(t).div(e.multipliedBy(e));return t.multipliedBy(i).div(i.plus(1))}const o=i.multipliedBy(e).div(t).multipliedBy(e).plus(n.multipliedBy(r));let s,a=new P(1).minus(i).multipliedBy(t);a.gte(o)?(a=a.minus(o),s=!1):(a=o.minus(a),s=!0);let l=new P(4).multipliedBy(new P(1).minus(i)).multipliedBy(i).multipliedBy(e).multipliedBy(e);l=a.multipliedBy(a).plus(l).sqrt();const c=new P(2).multipliedBy(new P(1).minus(i));let u;return u=s?l.minus(a):a.plus(l),t.minus(u.div(c))},Pd=(e,t,r,n)=>{if(e.eq(0))return new P(0);if(n.eq(0))return e.plus(r.multipliedBy(t));const i=n.multipliedBy(4).multipliedBy(r).multipliedBy(t).div(e).plus(1).sqrt().minus(1).div(n.multipliedBy(2)).plus(1);return e.multipliedBy(i)};class Rd{constructor(e){this.B=e.B,this.Q=e.Q,this.B0=e.B0,this.Q0=e.Q0,this.RStatus=e.R,this.OraclePrice=e.i,this.k=e.K,this.mtFeeRate=e.mtFeeRate,this.lpFeeRate=e.lpFeeRate}}function Dd(e,t){let r=new P(e.toString());return t&&(r=r.div(new P(10**t))),r.dp(t)}const Id={DVM:Cl.dvmPoolABI,DSP:Cl.dvmPoolABI,GSP:Cl.dvmPoolABI,LPTOKEN:Cl.dvmPoolABI,CLASSICAL:Cl.classicalPoolABI,V3CLASSICAL:Cl.classicalPoolABI,DPP:Cl.dppPoolABI};function Cd({poolAddress:e,type:t,typeMethodObject:r,params:n=[]}){const i=r[t];if(!i)return null;const o=Id[t];return o?{abiName:o,contractAddress:e,method:i,params:n}:null}class Sd{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequestsConfig)throw new Error("PoolApi does not initialize the contractRequests");this.contractRequests=new Zl(e.contractRequestsConfig)}}getTotalBaseLpQuery(e,t,r,n){return{queryKey:[Jl,"pool","getTotalBaseLpQuery",...arguments],enabled:!!e&&!!t&&!!r&&void 0!==n,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t||!r||void 0===n)return null;if("AMMV2"===r){const r=yield m(e,t);return new P(S(r,n))}const i=Cd({poolAddress:t,type:r,typeMethodObject:{DVM:"totalSupply",DSP:"totalSupply",GSP:"totalSupply",LPTOKEN:"totalSupply",CLASSICAL:"getTotalBaseCapital",V3CLASSICAL:"getTotalBaseCapital",DPP:null}});if(!i)return null;const o=yield this.contractRequests.batchCallQuery(e,i);return wd(o,n)}))}}getTotalQuoteLpQuery(e,t,r,n){return{queryKey:[Jl,"pool","getTotalQuoteLp",...arguments],enabled:!!e&&!!t&&!!r&&void 0!==n,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t||!r||void 0===n)return null;const i=Cd({poolAddress:t,type:r,typeMethodObject:{DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getTotalQuoteCapital",V3CLASSICAL:"getTotalQuoteCapital",DPP:null}});if(!i)return null;const o=yield this.contractRequests.batchCallQuery(e,i);return wd(o,n)}))}}getUserBaseLpQuery(e,t,r,n,i){return{queryKey:[Jl,"pool","getUserBaseLp",...arguments],enabled:!!(e&&t&&r&&void 0!==n&&i),queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&t&&r&&void 0!==n&&i))return null;if("AMMV2"===r){const r=yield g(e,t,i);return new P(S(r,n))}const o=Cd({poolAddress:t,type:r,typeMethodObject:{DVM:"balanceOf",DSP:"balanceOf",GSP:"balanceOf",LPTOKEN:"balanceOf",CLASSICAL:"getBaseCapitalBalanceOf",V3CLASSICAL:"getBaseCapitalBalanceOf",DPP:null},params:[i]});if(!o)return null;const s=yield this.contractRequests.batchCallQuery(e,o);return wd(s,n)}))}}getUserQuoteLpQuery(e,t,r,n,i){return{queryKey:[Jl,"pool","getUserQuoteLp",...arguments],enabled:!!(e&&t&&r&&void 0!==n&&i),queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&t&&r&&void 0!==n&&i))return null;const o=Cd({poolAddress:t,type:r,typeMethodObject:{DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getQuoteCapitalBalanceOf",V3CLASSICAL:"getQuoteCapitalBalanceOf",DPP:null},params:[i]});if(!o)return null;const s=yield this.contractRequests.batchCallQuery(e,o);return wd(s,n)}))}}getReserveLpQuery(e,t,r,n,i){return"CLASSICAL"===r?this.getPMMStateQuery(e,t,r,n,i):{queryKey:[Jl,"pool","getReserveLp",...arguments],enabled:!!e&&!!t&&!!r&&void 0!==n&&void 0!==i,queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&t&&r&&void 0!==n&&void 0!==i))return null;if("AMMV2"===r){const r=yield E(e,t);return{baseReserve:wd(r._reserve0.toString(),n),quoteReserve:wd(r._reserve1.toString(),i)}}const o=Cd({poolAddress:t,type:r,typeMethodObject:{DVM:"getVaultReserve",DSP:"getVaultReserve",GSP:"getVaultReserve",LPTOKEN:"getVaultReserve",CLASSICAL:null,V3CLASSICAL:null,DPP:"getVaultReserve"},params:[]});if(!o)return null;const s=yield this.contractRequests.batchCallQuery(e,o);return{baseReserve:wd(s.baseReserve,n),quoteReserve:wd(s.quoteReserve,i)}}))}}getClassicalTargetQuery(e,t,r,n,i){return{queryKey:[Jl,"pool","getClassicalTargetQuery",...arguments],enabled:!!e&&!!t&&!!r&&void 0!==n&&void 0!==i,queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&t&&r&&void 0!==n&&void 0!==i&&["CLASSICAL","V3CLASSICAL"].includes(r)))return null;const o=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.classicalPoolABI,contractAddress:t,method:"getExpectedTarget",params:[]});return{baseTarget:wd(o.baseTarget,n),quoteTarget:wd(o.quoteTarget,i)}}))}}getTotalBaseMiningLpQuery(e,t,r,n,i){const o=!!r&&Sd.utils.getIsV3Mining(r);return{queryKey:[Jl,"pool","getTotalBaseMiningLp",...arguments],enabled:!!e&&!!t&&!!r&&void 0!==i&&(o||!!n),queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&t&&r&&void 0!==i&&(o||n)))return null;let s;const a={DVM:"balanceOf",DSP:"totalSupply",GSP:"totalSupply",LPTOKEN:"totalSupply",CLASSICAL:"balanceOf",V3CLASSICAL:"totalSupply",DPP:null}[r];if(!a)return null;if(o)s={abiName:Cl.v3MiningABI,contractAddress:t,method:a,params:[]};else{if(!n)return null;s={abiName:Cl.dodoMiningABI,contractAddress:n,method:a,params:[t]}}if(!s)return null;const l=yield this.contractRequests.batchCallQuery(e,s);return wd(l,i)}))}}getTotalQuoteMiningLpQuery(e,t,r,n,i){const o=!!r&&Sd.utils.getIsV3Mining(r);return{queryKey:[Jl,"pool","getTotalQuoteMiningLp",...arguments],enabled:!!e&&!!t&&!!r&&void 0!==i&&(o||!!n),queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t||!r||void 0===i)return null;let s;const a={DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"balanceOf",V3CLASSICAL:"totalSupply",DPP:null}[r];if(!a)return null;if(o)s={abiName:Cl.v3MiningABI,contractAddress:t,method:a,params:[]};else{if(!n)return null;s={abiName:Cl.dodoMiningABI,contractAddress:n,method:a,params:[t]}}if(!s)return null;const l=yield this.contractRequests.batchCallQuery(e,s);return wd(l,i)}))}}getUserBaseMiningLpQuery(e,t,r,n,i,o){const s=!!r&&Sd.utils.getIsV3Mining(r);return{queryKey:[Jl,"pool","getUserBaseMiningLp",...arguments],enabled:!!e&&!!o&&!!t&&!!r&&void 0!==i&&(s||!!n),queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&o&&t&&r&&void 0!==i))return null;let s;const a={DVM:"getUserLpBalance",DSP:"balanceOf",GSP:"balanceOf",LPTOKEN:"balanceOf",CLASSICAL:"getUserLpBalance",V3CLASSICAL:"balanceOf",DPP:null}[r];if(!a)return null;if(Sd.utils.getIsV3Mining(r))s={abiName:Cl.v3MiningABI,contractAddress:t,method:a,params:[o]};else{if(!n)return null;s={abiName:Cl.dodoMiningABI,contractAddress:t,method:a,params:[n,o]}}if(!s)return null;const l=yield this.contractRequests.batchCallQuery(e,s);return wd(l,i)}))}}getUserQuoteMiningLpQuery(e,t,r,n,i,o){const s=!!r&&Sd.utils.getIsV3Mining(r);return{queryKey:[Jl,"pool","getUserQuoteMiningLp",...arguments],enabled:!!e&&!!o&&!!t&&!!r&&void 0!==i&&(s||!!n),queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&o&&t&&r&&void 0!==i))return null;let s;const a={DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getUserLpBalance",V3CLASSICAL:"balanceOf",DPP:null}[r];if(!a)return null;if(Sd.utils.getIsV3Mining(r))s={abiName:Cl.v3MiningABI,contractAddress:t,method:a,params:[o]};else{if(!n)return null;s={abiName:Cl.dodoMiningABI,contractAddress:t,method:a,params:[n,o]}}if(!s)return null;const l=yield this.contractRequests.batchCallQuery(e,s);return wd(l,i)}))}}getLPFeeRateQuery(e,t,r){return{queryKey:[Jl,"pool","getLpFeeRateQuery",...arguments],enabled:!!e&&!!t&&!!r,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t||!r)return null;const n=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.dvmPoolABI,contractAddress:t,method:"_LP_FEE_RATE_",params:[]});return new P(n.toString()).div(10**18)}))}}getFeeRateQuery(e,t,r,n){return{queryKey:[Jl,"pool","getFeeRateQuery",...arguments],enabled:!!e&&!!t&&!!r,queryFn:()=>M(this,void 0,void 0,(function*(){var i;if(!e||!t||!r)return null;let o=new P(0),s=new P(0);if("CLASSICAL"===r){const{ROUTE_V1_DATA_FETCH:r}=F[e],n=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.DODOV1PmmHelperABI,contractAddress:r,method:"getPairDetail",params:[t]}),a=null===(i=null==n?void 0:n.res)||void 0===i?void 0:i[0];o=new P(a.lpFeeRate.toString()).div(10**18),s=new P(a.mtFeeRate.toString()).div(10**18)}else if("AMMV2"===r)if(y(e)&&A(e)){const r=yield b(e,t),n=wd(r.toString(),4);o=n.times(.8),s=n.times(.2)}else o=new P(.003),s=new P(0);else{const r=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.dvmPoolABI,contractAddress:t,method:"getUserFeeRate",params:[null!=n?n:t]});o=new P(r.lpFeeRate.toString()).div(10**18),s=new P(r.mtFeeRate.toString()).div(10**18)}return{lpFeeRate:o,mtFeeRate:s}}))}}getPMMStateQuery(e,t,r,n,i){return{queryKey:[Jl,"pool","getPMMStateQuery",...arguments],enabled:!!e&&!!t&&!!r&&void 0!==n&&void 0!==i,queryFn:()=>M(this,void 0,void 0,(function*(){var o;if(!e||!t||!r||void 0===n||void 0===i)return null;if("AMMV2"===r||"AMMV3"===r)return null;let s=null;if("CLASSICAL"===r){const{ROUTE_V1_DATA_FETCH:r}=F[e],n=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.DODOV1PmmHelperABI,contractAddress:r,method:"getPairDetail",params:[t]});s=null===(o=null==n?void 0:n.res)||void 0===o?void 0:o[0]}else{if(!["DVM","DPP","LPTOKEN","DSP","GSP"].includes(r))throw new Error(`type: ${r} not supported`);s=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.dvmPoolABI,contractAddress:t,method:"getPMMStateForCall",params:[]})}if(!Array.isArray(s)||!s.length)throw new Error("queryResult is not valid.");const a=function(e,t,r){const n=Dd(e.i,18-t+r),i=Dd(e.K,18),o=Dd(e.B,t),s=Dd(e.Q,r),a=Dd(e.B0,t),l=Dd(e.Q0,r),c=parseInt(e.R.toString());let u,d;return e.lpFeeRate&&(u=Dd(e.lpFeeRate,18)),e.mtFeeRate&&(d=Dd(e.mtFeeRate,18)),{q:s,b:o,k:i,i:n,b0:a,q0:l,R:c,lpFeeRate:u,mtFeeRate:d}}(s,n,i);let l;if(a.q.isEqualTo(0)&&2===a.R||a.b.isEqualTo(0)&&(1===a.R||0===a.R));else{const e=new Nd,t=new Rd({Q:a.q,B:a.b,K:a.k,i:a.i,B0:a.b0,Q0:a.q0,R:a.R,mtFeeRate:new P(0),lpFeeRate:new P(0)});l=e.GetMidPrice(t),l.isNaN()&&(l=void 0)}return{midPrice:l,pmmParamsBG:a,baseReserve:a.b,quoteReserve:a.q}}))}}getDPPOwnerProxyAddressQuery(e,t){return{queryKey:[...arguments],enabled:!!e&&!!t,queryFn:()=>e&&t?this.contractRequests.batchCallQuery(e,{abiName:Cl.IdodoV2,contractAddress:t,method:"_OWNER_",params:[]}):null}}getWithdrawBasePenaltyQuery(e,t,r,n){return{queryKey:[...arguments],enabled:!!(e&&t&&r&&n),queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&t&&r&&n))return null;const i=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.dodoPair,contractAddress:t,method:"getWithdrawBasePenalty",params:[r]});return wd(i,n)}))}}}Sd.graphql=Od,Sd.utils=gd,Sd.encode={createDSPPoolABI(e,t,r,n,i,o,s,a,l){return M(this,arguments,void 0,(function*(e,t,r,n,i,o,s,a,l,c=!1){const{DODO_DSP_PROXY:u}=F[e];return{to:u,data:yield $l(Cl.dodoDspProxy,"createDODOStablePair",[t.address,r.address,n,i,new P(o).div(1e4).multipliedBy(10**18).toString(),dd(new P(s).toString(),18-t.decimals+r.decimals).toString(),dd(new P(a).toString(),18).toString(),c,l])}}))},createGSPPoolABI(e,t,r,n,i,o,s,a,l,c){return M(this,void 0,void 0,(function*(){const{DODO_DSP_PROXY:u}=F[e];return{to:u,data:yield $l(Cl.dodoDspProxy,"createDODOGasSavingPair",[t,r.address,n.address,i,o,new P(s).div(1e4).multipliedBy(10**18).toString(),"0",dd(new P(a).toString(),18-r.decimals+n.decimals).toString(),dd(new P(l).toString(),18).toString(),"1000",c])}}))},createDVMPoolABI(e,t,r,n,i,o,s,a,l){return M(this,arguments,void 0,(function*(e,t,r,n,i,o,s,a,l,c=!1){const{DODO_PROXY:u}=F[e];return{to:u,data:yield $l(Cl.dodoProxyV2,"createDODOVendingMachine",[t.address,r.address,n,i,new P(o).div(1e4).multipliedBy(10**18).toString(),dd(new P(s).toString(),18-t.decimals+r.decimals).toString(),dd(new P(a).toString(),18).toString(),c,l])}}))},createDPPPoolABI(e,t,r,n,i,o,s,a,l){return M(this,arguments,void 0,(function*(e,t,r,n,i,o,s,a,l,c=!1){const{DODO_DPP_PROXY:u}=F[e];return{to:u,data:yield $l(Cl.dodoDppProxy,"createDODOPrivatePool",[t.address,r.address,n,i,new P(o).div(1e4).multipliedBy(10**18).toString(),dd(new P(s).toString(),18-t.decimals+r.decimals).toString(),dd(new P(a).toString(),18).toString(),c,l])}}))},removeDPPPoolABI(e,t,r,n,i,o,s,a,l,c){return M(this,void 0,void 0,(function*(){const u=new P(t).div(1e4).multipliedBy(10**18).toString(),d=dd(new P(r).toString(),18-l+c).toString(),h=dd(new P(n).toString(),18).toString(),f=yield $l(Cl.dodoDPPAdmin,"reset",["0x0000000000000000000000000000000000000000",u,d,h,i,o,s,a]);return{to:e,data:f}}))},resetDPPPoolABI(e,t,r,n,i,o,s,a,l,c,u,d,h,f,p){return M(this,void 0,void 0,(function*(){const{DODO_DPP_PROXY:m}=F[e],g=new P(r).div(1e4).multipliedBy(10**18).toString(),E=dd(new P(n).toString(),18-h+f).toString(),y=dd(new P(i).toString(),18).toString();return{to:m,data:yield $l(Cl.dodoDppProxy,"resetDODOPrivatePool",[t,[g,E,y],[o,s,a,l],d,c,u,p])}}))},addDSPLiquidityABI(e,t,r,n,i,o,s,a){return M(this,void 0,void 0,(function*(){if(!i||"0"===i)throw new Error("Invalid baseMinAmount");const{DODO_DSP_PROXY:l}=F[e];return{to:l,data:yield $l(Cl.dodoDspProxy,"addDSPLiquidity",[t,r,n,i,o,s,a])}}))},addDVMLiquidityABI(e,t,r,n,i,o,s,a){return M(this,void 0,void 0,(function*(){if(!i||"0"===i)throw new Error("Invalid baseMinAmount");const{DODO_PROXY:l}=F[e];return{to:l,data:yield $l(Cl.dodoProxyV2,"addDVMLiquidity",[t,r,n,i,o,s,a])}}))},removeDSPLiquidityABI(e,t,r,n,i,o,s,a){return M(this,void 0,void 0,(function*(){if(28!=e&&69!=e){const{CALLEE_HELPER:t}=F[e];s&&(r=t)}const l=yield $l(Cl.dodoDSP,"sellShares",[n,r,i,o,s?"0x00":"0x",a]);return{to:t,data:l}}))},removeDVMLiquidityABI(e,t,r,n,i,o,s,a){return M(this,void 0,void 0,(function*(){if(28!=e&&69!=e){const{CALLEE_HELPER:t}=F[e];s&&(r=t)}const l=yield $l(Cl.dodoDVM,"sellShares",[n,r,i,o,s?"0x00":"0x",a]);return{to:t,data:l}}))},addClassicalLiquidityABI(e,t,r,n,i,o,s,a){return M(this,void 0,void 0,(function*(){const{DODO_PROXY:l}=F[e];return{to:l,data:yield $l(Cl.dodoProxyV2,"addLiquidityToV1",[t,r,n,i,o,s,a])}}))},removeClassicalBaseABI(e,t,r,n){return M(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:i}=F[e];let o="",s="";return i?(s=i,o=yield $l(Cl.dodoV1PairProxy,"withdrawBase",[t,r,n])):(s=t,o=yield $l(Cl.dodoPair,"withdrawBase",[r])),{to:s,data:o}}))},removeMaxClassicalBaseABI(e,t,r){return M(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:n}=F[e];let i="",o="";return n?(o=n,i=yield $l(Cl.dodoV1PairProxy,"withdrawAllBase",[t,r])):(o=t,i=yield $l(Cl.dodoPair,"withdrawAllBase",[])),{to:o,data:i}}))},removeClassicalQuoteABI(e,t,r,n){return M(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:i}=F[e];let o="",s="";return i?(s=i,o=yield $l(Cl.dodoV1PairProxy,"withdrawQuote",[t,r,n])):(s=t,o=yield $l(Cl.dodoPair,"withdrawQuote",[r])),{to:s,data:o}}))},removeMaxClassicalQuoteABI(e,t,r){return M(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:n}=F[e];let i="",o="";return n?(o=n,i=yield $l(Cl.dodoV1PairProxy,"withdrawAllQuote",[t,r])):(o=t,i=yield $l(Cl.dodoPair,"withdrawAllQuote",[])),{to:o,data:i}}))}};const kd=(e,t,r,n,i)=>{const o=n.multipliedBy(t.minus(r)),s=e.multipliedBy(e).div(t).div(r).multipliedBy(i);return o.multipliedBy(new R(1).minus(i).plus(s))},Bd=(e,t,r,n,i)=>{let o=new R(1).minus(i).multipliedBy(t);o=o.minus(i.multipliedBy(e).multipliedBy(e).div(t)),o=o.plus(r.multipliedBy(n));let s=new R(4).multipliedBy(new R(1).minus(i)).multipliedBy(i).multipliedBy(e).multipliedBy(e);s=o.multipliedBy(o).plus(s).sqrt();const a=new R(2).multipliedBy(new R(1).minus(i));return o.plus(s).div(a)},xd=(e,t,r)=>{let n=new R(4).multipliedBy(t).multipliedBy(r).div(e);n=new R(1).plus(n).sqrt();const i=n.minus(new R(1)).div(t.multipliedBy(new R(2)));return e.multipliedBy(new R(1).plus(i))};R.config({EXPONENTIAL_AT:1e3,DECIMAL_PLACES:80});class Ld{getMidPrice(){if(0===this.RStatus)return this.i;const e=this.getExpectedTarget();if(1===this.RStatus){let t=e.base.div(this.B);return t=t.multipliedBy(t).multipliedBy(this.k).minus(this.k).plus(new R(1)),this.i.multipliedBy(t)}if(2===this.RStatus){let t=e.quote.div(this.Q);return t=t.multipliedBy(t).multipliedBy(this.k).minus(this.k).plus(new R(1)),this.i.div(t)}return this.i}getQuoteByMidPrice(e){if(1!==this.RStatus)throw new Error("No support is needed at the moment");const t=e.div(this.k.times(this.i)).plus(1).minus(new R(1).div(this.k)).times(this.B).times(this.B).sqrt();return this.i.times(this.k.div(this.B).times(t).times(t).plus(new R(1).minus(this.k.times(2)).times(t)).minus(new R(1).minus(this.k).times(this.B)))}getExpectedTarget(){let e,t;return e=this.B0,t=this.Q0,0===this.RStatus&&(e=this.B0,t=this.Q0),1===this.RStatus&&(t=this.Q0,e=xd(this.B,this.k,this.Q.minus(this.Q0).div(this.i))),2===this.RStatus&&(e=this.B0,t=xd(this.Q,this.k,this.B.minus(this.B0).multipliedBy(this.i))),{base:e,quote:t}}queryBuyBase(e){const t=e.multipliedBy(this.mtFeeRate),r=e.multipliedBy(this.lpFeeRate);e=e.plus(t).plus(r);const n=this.getExpectedTarget();let i=new R(0);if(0===this.RStatus)i=this.ROneBuyBase(e,n.base);else if(1===this.RStatus)i=this.RAboveBuyBase(e,n.base);else{const t=this.B.minus(n.base),r=n.quote.minus(this.Q);i=e.isLessThanOrEqualTo(t)?this.RBelowBuyBase(e,n.quote):r.plus(this.ROneBuyBase(e.minus(t),n.base))}return i}querySellBase(e){let t;const r=this.getExpectedTarget();if(0===this.RStatus)t=this.ROneSellBase(e,r.quote);else if(2===this.RStatus)t=this.RBelowSellBase(e,r.quote);else{const n=r.base.minus(this.B),i=this.Q.minus(r.quote);t=e.isLessThanOrEqualTo(n)?this.RAboveSellBase(e,r.base):i.plus(this.ROneSellBase(e.minus(n),r.quote))}const n=t.multipliedBy(this.mtFeeRate),i=t.multipliedBy(this.lpFeeRate);return t.minus(n).minus(i)}queryBuyQuote(e){const t=e.multipliedBy(this.mtFeeRate),r=e.multipliedBy(this.lpFeeRate);e=e.plus(t).plus(r);const n=this.getExpectedTarget();if(0===this.RStatus)return this.ROneBuyQuote(e,n.quote);if(2===this.RStatus)return this.RBelowBuyQuote(e,n.quote);const i=n.base.minus(this.B),o=this.Q.minus(n.quote);return e.isLessThanOrEqualTo(o)?this.RAboveBuyQuote(e,n.base):i.plus(this.ROneBuyQuote(e.minus(o),n.quote))}querySellQuote(e){let t;const r=this.getExpectedTarget();if(0===this.RStatus)t=this.ROneSellQuote(e,r.base);else if(1===this.RStatus)t=this.RAboveSellQuote(e,r.base);else{const n=this.B.minus(r.base),i=r.quote.minus(this.Q);t=e.isLessThanOrEqualTo(i)?this.RBelowSellQuote(e,r.quote):n.plus(this.ROneSellQuote(e.minus(i),r.base))}const n=t.multipliedBy(this.mtFeeRate),i=t.multipliedBy(this.lpFeeRate);return t.minus(n).minus(i)}getPriceDepth(e){const t=this.getExpectedTarget();let r,n;if(e.gt(this.i)){const i=e.div(this.i);r=t.base.div(i.minus(1).plus(this.k).div(this.k).sqrt()),n=this.ROneBuyBase(t.base.minus(r),t.base).plus(t.quote)}else{const i=this.i.div(e);n=t.quote.div(i.minus(1).plus(this.k).div(this.k).sqrt()),r=this.ROneBuyQuote(t.quote.minus(n),t.quote).plus(t.base)}return{baseAmount:this.B.minus(r).abs(),quoteAmount:this.Q.minus(n).abs(),isBuy:this.B.gt(r)}}getWithdrawBasePenalty(e){if(1===this.RStatus){const t=xd(this.B,this.k,this.Q.minus(this.Q0).div(this.i)),r=xd(this.B.minus(e),this.k,this.Q.minus(this.Q0).div(this.i));return t.minus(r).minus(e)}return new R(0)}getWithdrawQuotePenalty(e){if(2===this.RStatus){const t=xd(this.Q,this.k,this.B.minus(this.B0).multipliedBy(this.i)),r=xd(this.Q.minus(e),this.k,this.B.minus(this.B0).multipliedBy(this.i));return t.minus(r).minus(e)}return new R(0)}ROneBuyBase(e,t){return e.isGreaterThanOrEqualTo(t),kd(t,t,t.minus(e),this.i,this.k)}ROneBuyQuote(e,t){return e.isGreaterThanOrEqualTo(t),kd(t,t,t.minus(e),new R(1).div(this.i),this.k)}ROneSellBase(e,t){const r=Bd(t,t,this.i,e.negated(),this.k);return t.minus(r)}ROneSellQuote(e,t){const r=Bd(t,t,new R(1).div(this.i),e.negated(),this.k);return t.minus(r)}RAboveBuyBase(e,t){if(e.isGreaterThanOrEqualTo(this.B))throw new Error("RAbove Buy Base Amount Exceed Limitation");return kd(t,this.B,this.B.minus(e),this.i,this.k)}RAboveSellBase(e,t){if(e.plus(this.B).isGreaterThan(t))throw new Error("RAbove Sell Base Amount Exceed Limitation");return kd(t,this.B.plus(e),this.B,this.i,this.k)}RAboveBuyQuote(e,t){return Bd(t,this.B,new R(1).div(this.i),e,this.k).minus(this.B)}RAboveSellQuote(e,t){const r=Bd(t,this.B,new R(1).div(this.i),e.negated(),this.k);return this.B.minus(r)}RBelowBuyQuote(e,t){if(e.isGreaterThanOrEqualTo(this.Q))throw new Error("RBelow Buy Quote Amount Exceed Limitation");return kd(t,this.Q,this.Q.minus(e),new R(1).div(this.i),this.k)}RBelowSellQuote(e,t){if(e.plus(this.Q).isGreaterThan(t))throw new Error("RBelow Sell Quote Amount Exceed Limitation");return kd(t,this.Q.plus(e),this.Q,new R(1).div(this.i),this.k)}RBelowBuyBase(e,t){return Bd(t,this.Q,this.i,e,this.k).minus(this.Q)}RBelowSellBase(e,t){const r=Bd(t,this.Q,this.i,e.negated(),this.k);return this.Q.minus(r)}}function Fd({q:e,b:t,k:r,i:n,q0:i,b0:o,R:s}){const a=new Ld;return a.B0=new P(o),a.Q0=new P(i),a.B=new P(t),a.Q=new P(e),a.i=new P(n),a.k=new P(r),a.RStatus=s,a.mtFeeRate=new P(0),a.lpFeeRate=new P(0),a}function Ud(e){return e&&/^#[a-f\d]{3,6}\s*[0-9]{1,3}%/i.test(e)?(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})\s*([0-9]{1,3})*%?$/i.exec(e),(t=r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16),a:r[4]?Number(r[4])/100:1}:void 0)?`rgba(${t.r}, ${t.g}, ${t.b}, ${t.a})`:t):e;var t,r}var Md;!function(e){e.All="all"}(Md||(Md={}));class qd{constructor(e){this.restApiRequest=(null==e?void 0:e.restApiRequest)||new _u}getWidgetTokenListConfig(e,t){return this.restApiRequest.getJson("/config-center/user/tokenlist/v2",{project:e,apikey:t})}convertConfigToSwapWidgetProps(e){var t,r,n,i,o,s,a,l;const c=[];let u,d=!0,h=!0;if(e.chains.forEach((e=>{e.fromTokens&&(d=!1),e.toTokens&&(h=!1)})),e.chains.forEach((({chainId:e,fromTokens:t,toTokens:r,tokens:n})=>{if(null==n?void 0:n.length){const i=Number(e);[{isAllChain:d,selectTokens:t,side:"from"},{isAllChain:h,selectTokens:r,side:"to"}].forEach((({isAllChain:e,selectTokens:t,side:r})=>{(e||t)&&((null==t?void 0:t.length)?n.forEach((e=>{var n;t.some((t=>t.toLocaleLowerCase()===e.address.toLocaleLowerCase()))&&c.push(Object.assign(Object.assign({logoURI:e.logoImg},e),{chainId:null!==(n=e.chainId)&&void 0!==n?n:i,side:r}))})):n.forEach((e=>{var t;c.push(Object.assign(Object.assign({logoURI:e.logoImg},e),{chainId:null!==(t=e.chainId)&&void 0!==t?t:i,side:r}))})))}))}})),(null==e?void 0:e.style)&&Object.keys(e.style).length){const r=null===(t=null==e?void 0:e.basis)||void 0===t?void 0:t.fontSizeModify;u={palette:{mode:"light",primary:{main:Ud(e.style.primary)},secondary:{main:Ud(e.style.secondary),contrastText:Ud(e.style.secondaryContrast)},error:{main:Ud(e.style.error),contrastText:Ud(e.style.errorContrast)},warning:{main:Ud(e.style.warning)},success:{main:Ud(e.style.success)},background:{paper:Ud(e.style.background1),paperContrast:Ud(e.style.background2),backdrop:Ud(e.style.mask),input:Ud(e.style.input),tag:Ud(e.style.card)},text:{primary:Ud(e.style.text1),secondary:Ud(e.style.text2),disabled:Ud(e.style.textDisable),placeholder:Ud(e.style.textPlaceholder)},border:{main:Ud(e.style.borderSolid),light:Ud(e.style.borderDash),disabled:Ud(e.style.borderSolid)}},typography:r?{fontSize:16+r,ht:{fontSize:36+r},h2:{fontSize:32+r},h3:{fontSize:28+r},caption:{fontSize:20+r},h5:{fontSize:18+r},body1:{fontSize:16+r},body2:{fontSize:14+r},h6:{fontSize:12+r},button:{fontSize:16+r}}:void 0}}const f=e.rebateAddress,p=e.rebateRatio,m=e.swapSlippage,g=e.crossChainSlippage,E=null===(r=e.basis)||void 0===r?void 0:r.width,y=null===(n=e.basis)||void 0===n?void 0:n.height,A=null===(i=e.basis)||void 0===i?void 0:i.locale,b=null===(s=null===(o=e.basis)||void 0===o?void 0:o.crossChainSupport)||void 0===s||s,v=null===(a=e.basis)||void 0===a?void 0:a.rpcMap,w=null===(l=e.basis)||void 0===l?void 0:l.noPowerBy;return{tokenList:c,theme:u,rebateAddress:f,rebateRatio:p,swapSlippage:m,bridgeSlippage:g,width:E,height:y,locale:A,crossChain:b,jsonRpcUrlMap:v,noPowerBy:w}}getConfigSwapWidgetProps(e,t){return M(this,void 0,void 0,(function*(){var r;const{result:n}=yield this.getWidgetTokenListConfig(e,t),i=n.data;if(!i)throw new Error(null!==(r=n.msg)&&void 0!==r?r:"Error");return{swapWidgetProps:this.convertConfigToSwapWidgetProps(i),configTokenList:i}}))}}const Vd={fetchMiningList:Ad("\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n "),fetchMiningListV1:Ad("\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n "),fetchMyCreatedMiningList:Ad("\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ")};var Gd;!function(e){e[e.upcoming=0]="upcoming",e[e.active=1]="active",e[e.ended=2]="ended"}(Gd||(Gd={}));const jd={getMiningStatusByTimestamp:({startTime:e,endTime:t,rewardTokenInfoList:r})=>{let n,i;for(const o of r){const r=o.startTime||e,s=o.endTime||t;r&&(n=n?P.min(r,n):P.isBigNumber(r)?r:new P(r)),s&&(i=i?P.max(s,i):P.isBigNumber(s)?s:new P(s))}const o=new P(Math.floor(Date.now()/1e3));let s=Gd.ended;return n&&o.lt(n)&&(s=Gd.upcoming),n&&i&&o.gte(n)&&o.lte(i)&&(s=Gd.active),{status:s,firstStartTime:n,lastEndTime:i,currentTime:o}}},Hd=[{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimAllRewards",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"stakeToken",type:"address"},{internalType:"bool",name:"isLpToken",type:"bool"},{internalType:"uint256",name:"platform",type:"uint256"},{internalType:"address[]",name:"rewardTokens",type:"address[]"},{internalType:"uint256[]",name:"rewardPerBlock",type:"uint256[]"},{internalType:"uint256[]",name:"startBlock",type:"uint256[]"},{internalType:"uint256[]",name:"endBlock",type:"uint256[]"}],name:"createDODOMineV3",outputs:[{internalType:"address",name:"newMineV3",type:"address"}],stateMutability:"nonpayable",type:"function"}],Qd=[{inputs:[{internalType:"address",name:"stakeToken",type:"address"},{internalType:"bool",name:"isLpToken",type:"bool"},{internalType:"address[]",name:"rewardTokens",type:"address[]"},{internalType:"uint256[]",name:"rewardPerBlock",type:"uint256[]"},{internalType:"uint256[]",name:"startBlock",type:"uint256[]"},{internalType:"uint256[]",name:"endBlock",type:"uint256[]"}],name:"createDODOMineV3",outputs:[{internalType:"address",name:"newMineV3",type:"address"}],stateMutability:"nonpayable",type:"function"}];class Xd{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("MiningApi does not initialize the contractRequests");this.contractRequests=new Zl(e.contractRequestsConfig)}}getPendingRewardQuery(e,t,r,n,i,o){return{queryKey:[Jl,"mining","getPendingRewardQuery",...arguments],enabled:!!(e&&t&&r&&n&&void 0!==i),queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&t&&r&&n&&void 0!==i))return null;let s;if("3"===o)s=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.v3MiningABI,contractAddress:t,method:"getPendingRewardByToken",params:[r,n]});else s=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.dodoMiningABI,contractAddress:t,method:"getPendingReward",params:[n,r]});return wd(s,i)}))}}getLpStakedBalance(e,t,r,n,i,o){return{queryKey:[Jl,"mining","getLpStakedBalance",...arguments],enabled:!(!e||!t||!r||void 0===i||"3"!==o&&!n),queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&t&&r&&void 0!==i)||"3"!==o&&!n)return null;let s;if("3"===o)s=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.v3MiningABI,contractAddress:t,method:"balanceOf",params:[r]});else s=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.dodoMiningABI,contractAddress:t,method:"getUserLpBalance",params:[r,n]});return wd(s,i)}))}}getRewardTokenInfos(e,t,r,n){return{queryKey:[Jl,"mining","getRewardTokenInfos",...arguments],enabled:null!=e&&null!=t&&null!=r&&!n,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t)return null;const n=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.v3MiningABI,contractAddress:t,method:"rewardTokenInfos",params:[r]});if(!n)return null;const{rewardVault:i,rewardPerBlock:o,workThroughReward:s,lastFlagBlock:a,startBlock:l,endBlock:c}=n;return{rewardVault:i,rewardPerBlock:wd(o,0),workThroughReward:s?wd(s,0):void 0,lastFlagBlock:a?wd(a,0):void 0,startBlock:wd(l,0),endBlock:wd(c,0)}}))}}}Xd.utils=jd,Xd.graphql=Vd,Xd.encode={depositMining(e,t,r){return M(this,void 0,void 0,(function*(){const n=zl(Hd,"deposit",[dd(t.dp(r,P.ROUND_FLOOR).toString(),r).toString()]);return{to:e,data:n}}))},withdrawMining(e,t,r){return M(this,void 0,void 0,(function*(){const n=zl(Hd,"withdraw",[dd(t.dp(r,P.ROUND_FLOOR).toString(),r).toString()]);return{to:e,data:n}}))},claimAllMining(e){return M(this,void 0,void 0,(function*(){const t=zl(Hd,"claimAllRewards",[]);return{to:e,data:t}}))},createDODOMineV3(e,t,r,n,i,o,s,a){return M(this,void 0,void 0,(function*(){const{DODO_MINEV3_PROXY:l}=F[e];if(!l)return null;let c;return c=[1,10,288,66,128,137,1285,42161,1313161554,43114].includes(e)?zl(Qd,"createDODOMineV3",[t,r,i,o,s,a]):zl(Hd,"createDODOMineV3",[t,r,n,i,o,s,a]),{to:l,data:c}}))}};const Yd={fetchErc20SwapCrossList:Ad("\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n }\n "),fetchErc20ForecastSlippage:Ad("\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n }\n ")},Kd=new P(2).pow(256).minus(1);function $d(e){return e?e.replaceAll("\0",""):e}class zd{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("TokenApi does not initialize the contractRequests");this.contractRequests=new Zl(e.contractRequestsConfig)}this.restApiRequest=(null==e?void 0:e.restApiRequest)||new _u}getTokenDecimals(e,t){return{queryKey:["token","getTokenDecimals",null!=e?e:"",null==t?void 0:t.toLocaleLowerCase()],enabled:!!e&&!!t,queryFn:()=>M(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Cl.erc20ABI,contractAddress:t,method:"decimals",params:[]})}))}}getFiatPriceBatch(e,t){return this.restApiRequest.postJson("/frontend-v2-price-api/current/batch",{networks:e.map((e=>U[e.chainId])),addresses:e.map((e=>e.address)),symbols:e.map((e=>e.symbol)),isCache:!0},void 0,{headers:{"pass-key":t}})}getFetchTokenQuery(e,t,r,n){let i=n,o="";if(void 0!==e){const t=F[e];i||(i=null==t?void 0:t.DODO_APPROVE),o=null==t?void 0:t.ERC20_HELPER}return{queryKey:[Jl,"token","getFetchTokenQuery",null!=e?e:"",null==r?void 0:r.toLocaleLowerCase(),null==i?void 0:i.toLocaleLowerCase(),null==t?void 0:t.toLocaleLowerCase()],enabled:!!e&&!!t&&!!r,queryFn:()=>M(this,void 0,void 0,(function*(){if(!(e&&t&&r&&i))return null;const s=yield(e=>M(void 0,void 0,void 0,(function*(){let t=[];if(!t.length)switch(e){case k.MAINNET:t=(yield import("./eth-B9cviUl5.js")).default;break;case k.BSC:t=(yield import("./bsc-3D5wcqPq.js")).default}return t})))(e);if(s.includes(t))return null;const a=L[e];if(zd.utils.isSameAddress(t,a.address)){const t=yield this.contractRequests.getETHBalance(e,r);return{symbol:a.symbol,address:a.address,name:a.name,decimals:a.decimals,balance:t,allowance:Kd,account:r,spender:n,chainId:e}}const l=yield this.contractRequests.batchCallQuery(e,{abiName:Cl.erc20Helper,contractAddress:o,method:"isERC20",params:[t,r,i]}),{name:c,isOk:u}=l;if(u&&c){const r=parseInt(l.decimals,10),i=new P(10).pow(r),o=new P(l.allownance.toString()).div(i),s=new P(l.balance.toString()).div(i);return{address:t,decimals:r,symbol:$d(l.symbol),name:$d(c),balance:s,spender:n,allowance:o,chainId:e}}return null}))}}}zd.graphql=Yd,zd.utils={isSameAddress:(e,t)=>{const r=e.length,n=t.length;if(0===r||0===n)return!1;if(r===n)return e.toLowerCase()===t.toLowerCase();const i=e.substring(2,r).toLowerCase(),o=t.substring(2,r).toLowerCase();return i.length>o.length?i.endsWith(o):o.endsWith(i)}},zd.encode={approveABI:(e,t)=>$l(Cl.erc20ABI,"approve",[e,t.toFixed()]),transferEncodeABI(e,t){return M(this,void 0,void 0,(function*(){return yield $l(Cl.erc20ABI,"transfer",[e,t])}))}};const Wd={fetchUserSwapOrderHistories:Ad("\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n }\n ")};class Jd{constructor(){}}Jd.graphql=Wd;const Zd={fetchNoticeCenterTransactionList:Ad("\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n }\n "),fetchLiquidityLpPartnerRewards:Ad("\n query FetchLiquidityLpPartnerRewards(\n $where: LiquidityLpPartnerRewardsInput\n ) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n }\n "),fetchUserprofileReward:Ad("\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n }\n ")};class eh{constructor(){}}eh.graphql=Zd;export{Cl as ABIName,vd as AMMV3Api,Jl as CONTRACT_QUERY_KEY,k as ChainId,Zl as ContractRequests,Nu as GraphQLRequests,Xd as MiningApi,Gd as MiningStatusE,Nd as PMMHelper,Ld as PMMModel,Rd as PMMState,Sd as PoolApi,_u as RestApiRequests,Jd as SwapApi,qd as SwapWidgetApi,eh as SystemApi,zd as TokenApi,L as basicTokenMap,F as contractConfig,B as etherTokenAddress,Fd as getPmmModel,U as platformIdMap,Pd as solveQuadraticFunctionForTarget};
|
|
1
|
+
import{arbsepolia as e,plume as t,plumeTestnet as n,neox as r,morph as i,riseTestnet as s,nero as o,bitlayer as a,zircuitMainnet as l,xLayer as c,zeroMainnet as u,hashkey as d,hemi as h,pharosTestnet as f,monadTestnet as p,monad as m,fetchUniswapV2PairTotalSupply as g,fetchUniswapV2PairBalanceOf as y,fetchUniswapV2PairGetReserves as A,getUniswapV2Router02ContractAddressByChainId as E,getUniswapV2FactoryContractAddressByChainId as b,fetchUniswapV2PairFeeRate as v}from"@dodoex/dodo-contract-request";export{setContractRequests}from"@dodoex/dodo-contract-request";import w from"js-sha3";import O from"bn.js";import D from"hash.js";import P from"bech32";import{chunk as _,merge as T}from"lodash";import I,{BigNumber as R}from"bignumber.js";import*as C from"cross-fetch";import B from"cross-fetch";import k from"qs";import{formatUnits as N}from"@dodoex/contract-request";var x;!function(e){e[e.MAINNET=1]="MAINNET",e[e.GOERLI=5]="GOERLI",e[e.SEPOLIA=11155111]="SEPOLIA",e[e.BSC=56]="BSC",e[e.POLYGON=137]="POLYGON",e[e.ARBITRUM_ONE=42161]="ARBITRUM_ONE",e[e.ARBITRUM_SEPOLIA=421614]="ARBITRUM_SEPOLIA",e[e.AURORA=1313161554]="AURORA",e[e.OKCHAIN=66]="OKCHAIN",e[e.OPTIMISM=10]="OPTIMISM",e[e.AVALANCHE=43114]="AVALANCHE",e[e.CONFLUX=1030]="CONFLUX",e[e.BASE=8453]="BASE",e[e.LINEA=59144]="LINEA",e[e.SCROLL=534352]="SCROLL",e[e.MANTA=169]="MANTA",e[e.MANTLE=5e3]="MANTLE",e[e.DODO_CHAIN_TESTNET=53457]="DODO_CHAIN_TESTNET",e[e.TAIKO=167e3]="TAIKO",e[e.PLUME=98866]="PLUME",e[e.PLUME_TESTNET=98864]="PLUME_TESTNET",e[e.NEOX=47763]="NEOX",e[e.MORPH=2818]="MORPH",e[e.RISE_TESTNET=11155931]="RISE_TESTNET",e[e.NEROCHAIN=1689]="NEROCHAIN",e[e.BITLAYER=200901]="BITLAYER",e[e.ZIRCUIT=48900]="ZIRCUIT",e[e.X_LAYER=196]="X_LAYER",e[e.ZERO=543210]="ZERO",e[e.HASHKEY=177]="HASHKEY",e[e.HEMI=43111]="HEMI",e[e.PHAROS_TESTNET=688688]="PHAROS_TESTNET",e[e.MONAD_TESTNET=10143]="MONAD_TESTNET",e[e.MONAD=143]="MONAD"}(x||(x={}));const S="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",L={symbol:"ETH",address:S,name:"Ether",decimals:18,showDecimals:4,wrappedTokenSymbol:"WETH"},F={[x.MAINNET]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}),[x.GOERLI]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6"}),[x.SEPOLIA]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0x7B07164ecFaF0F0D85DFC062Bc205a4674c75Aa0"}),[x.OPTIMISM]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[x.CONFLUX]:Object.assign(Object.assign({},L),{symbol:"CFX",name:"CFX",wrappedTokenSymbol:"WCFX",wrappedTokenAddress:"0x14b2d3bc65e74dae1030eafd8ac30c533c976a9b"}),[x.BSC]:Object.assign(Object.assign({},L),{symbol:"BNB",name:"BNB",wrappedTokenSymbol:"WBNB",wrappedTokenAddress:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}),[x.OKCHAIN]:Object.assign(Object.assign({},L),{symbol:"OKT",name:"OKT",wrappedTokenSymbol:"WOKT",wrappedTokenAddress:"0x8F8526dbfd6E38E3D8307702cA8469Bae6C56C15"}),[x.POLYGON]:Object.assign(Object.assign({},L),{symbol:"MATIC",name:"MATIC",showDecimals:6,wrappedTokenSymbol:"WMATIC",wrappedTokenAddress:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"}),[x.ARBITRUM_ONE]:Object.assign(Object.assign({},L),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"}),[x.ARBITRUM_SEPOLIA]:Object.assign(Object.assign({},L),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0xfd6fFee92D25158b29315C71b0Bb4dE727530FaF"}),[x.AURORA]:Object.assign(Object.assign({},L),{name:"Ethereum",showDecimals:6,wrappedTokenAddress:"0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB"}),[x.AVALANCHE]:Object.assign(Object.assign({},L),{symbol:"AVAX",name:"Avalanche",showDecimals:6,wrappedTokenSymbol:"WAVAX",wrappedTokenAddress:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"}),[x.BASE]:Object.assign(Object.assign({},L),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[x.LINEA]:Object.assign(Object.assign({},L),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f"}),[x.SCROLL]:Object.assign(Object.assign({},L),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x5300000000000000000000000000000000000004"}),[x.MANTA]:Object.assign(Object.assign({},L),{wrappedTokenSymbol:"WETH",wrappedTokenAddress:"0x0Dc808adcE2099A9F62AA87D9670745AbA741746"}),[x.MANTLE]:Object.assign(Object.assign({},L),{wrappedTokenSymbol:"WMNT",wrappedTokenAddress:"0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8"}),[x.DODO_CHAIN_TESTNET]:Object.assign(Object.assign({},L),{symbol:"dodo",name:"Wrapped Berd",wrappedTokenSymbol:"WBERD",wrappedTokenAddress:"0x3a64Ec3606FF7310E8fAd6FcC008e39705fB496d"}),[x.TAIKO]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0xA51894664A773981C6C112C43ce576f315d5b1B6"}),[x.PLUME]:Object.assign(Object.assign({},L),{symbol:"PLUME",name:"PLUME",wrappedTokenSymbol:"WPLUME",wrappedTokenAddress:"0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1"}),[x.PLUME_TESTNET]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0xaA6210015fbf0855F0D9fDA3C415c1B12776Ae74"}),[x.NEOX]:Object.assign(Object.assign({},L),{symbol:"GAS",name:"GAS",showDecimals:6,wrappedTokenSymbol:"WGAS10",wrappedTokenAddress:"0xdE41591ED1f8ED1484aC2CD8ca0876428de60EfF"}),[x.MORPH]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0x5300000000000000000000000000000000000011"}),[x.RISE_TESTNET]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[x.NEROCHAIN]:Object.assign(Object.assign({},L),{symbol:"NERO",name:"NERO",wrappedTokenSymbol:"WNERO",wrappedTokenAddress:"0x252ba4a6efb0d91bd7108d91a067c14592a56f17"}),[x.BITLAYER]:Object.assign(Object.assign({},L),{symbol:"BTC",name:"BTC",wrappedTokenSymbol:"WBTC",wrappedTokenAddress:"0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f"}),[x.ZIRCUIT]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[x.X_LAYER]:Object.assign(Object.assign({},L),{symbol:"OKB",name:"OKB",wrappedTokenSymbol:"WOKB",wrappedTokenAddress:"0xe538905cf8410324e03a5a23c1c177a474d59b2b"}),[x.ZERO]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0xAc98B49576B1C892ba6BFae08fE1BB0d80Cf599c"}),[x.HASHKEY]:Object.assign(Object.assign({},L),{symbol:"HSK",name:"HSK",wrappedTokenSymbol:"WHSK",wrappedTokenAddress:"0xB210D2120d57b758EE163cFfb43e73728c471Cf1"}),[x.HEMI]:Object.assign(Object.assign({},L),{wrappedTokenAddress:"0x4200000000000000000000000000000000000006"}),[x.PHAROS_TESTNET]:Object.assign(Object.assign({},L),{symbol:"PHRS",name:"PHRS",wrappedTokenSymbol:"WPHRS",wrappedTokenAddress:"0x3019b247381c850ab53dc0ee53bce7a07ea9155f"}),[x.MONAD_TESTNET]:Object.assign(Object.assign({},L),{symbol:"MON",name:"MON",wrappedTokenSymbol:"WMON",wrappedTokenAddress:"0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701"}),[x.MONAD]:Object.assign(Object.assign({},L),{symbol:"MON",name:"MON",wrappedTokenSymbol:"WMON",wrappedTokenAddress:"0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A"})},M={[x.MAINNET]:{MULTI_CALL:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",DODO_APPROVE:"0xCB859eA579b28e02B87A1FDE08d087ab9dbE5149",ERC20_HELPER:"0x4F99cba8aAEad26fc970dc6CC4ea435779Fa9016",ROUTE_V2_DATA_FETCH:"0x9337cA090c390667984869193e10c3D4f9a17da8",ROUTE_V1_DATA_FETCH:"0x6373ceB657C83C91088d328622573FB766064Ac4",CALLEE_HELPER:"0x45a7E2E9D780613E047f7e78a9d3902ff854B522",DODO_PROXY:"0xa356867fDCEa8e71AEaF87805808803806231FdC",DODO_DSP_PROXY:"0x4599ed18F34cFE06820E3684bF0aACB8D75c644d",DODO_DPP_PROXY:"0xfF7C8F518e6f1435957ed3d3E0692C94676dAE7a",DODO_V1_PAIR_PROXY:"0x8dD0Fea5FA2f7df535F87f312641Cc15d8B151BA",DODO_MINEV3_PROXY:"0x0d9685D4037580F68D9F77B08971f17E1000bBdc"},[x.GOERLI]:{MULTI_CALL:"0x696E25A5e2AEd1C55E6d6Cfa0532Bbda9020165d",DODO_APPROVE:"0xC9143e54021f4a6d33b9b89DBB9F458AaEdd56FB",ERC20_HELPER:"0x24549FC74B3076A962624A26370ed556c467F74C",ROUTE_V2_DATA_FETCH:"0x7E9c460d0A10bd0605B15F0d0388e307d34a62E6",ROUTE_V1_DATA_FETCH:"0xAC716E87b0853C0712674e8E3a8435a489F276b4",CALLEE_HELPER:"0x5B2fd46E6E3Ff1E479d651ec0b210882Aa9871dF",DODO_PROXY:"0xbce44767af0a53A108b3B7ba4F740E03D228Ec0A",DODO_DSP_PROXY:"0x8d9ccc26CbF3D49bbA76E9920C3E6ed29e06b5cc",DODO_DPP_PROXY:"0xc4A1a152812dE96b2B1861E433f42290CDD7f113",DODO_MINEV3_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b"},[x.SEPOLIA]:{MULTI_CALL:"0x0fcB5237A1997C4700Ffa2BB4522EA38d4F851Fc",DODO_APPROVE:"0x66c45FF040e86DC613F239123A5E21FFdC3A3fEC",ERC20_HELPER:"0x297da061D1dE0132D241Fafed224288B34d81005",ROUTE_V2_DATA_FETCH:"0x03e89fC55A5ad0531576E5a502c4CA52c8bf391B",ROUTE_V1_DATA_FETCH:"0x3dD629473A2eD7f3C6299FFD9F3e0C283d073f11",CALLEE_HELPER:"0xCD536b4DECFD2fa0443666B6becD145F8aDe2E48",DODO_PROXY:"0x6292e8f7647b3b9dDf5795b1Fb77D0187e30E0F9",DODO_DSP_PROXY:"0x987bFBE33c9cF18cAA665B792Db66339a9c16D32",DODO_DPP_PROXY:"0x5e1251f4873248a030e1c92FFEB133AF1513277f",DODO_MINEV3_PROXY:"0xBbD59b9316eE65526DbBdEc2A748Cc05A285d54C"},[x.BSC]:{MULTI_CALL:"0x1Ee38d535d541c55C9dae27B12edf090C608E6Fb",DODO_APPROVE:"0xa128Ba44B2738A558A1fdC06d6303d52D3Cef8c1",ERC20_HELPER:"0x5B9E4c3056227C316a3da3296031DdC7a8d6a867",ROUTE_V2_DATA_FETCH:"0x35b8F92AcFE368afb90d37555f6d075Fc569a6BA",ROUTE_V1_DATA_FETCH:"0x2BBD66fC4898242BDBD2583BBe1d76E8b8f71445",CALLEE_HELPER:"0x2673E5333620bb22BD1bFB3af9Fc7012008E3b4B",DODO_PROXY:"0x8F8Dd7DB1bDA5eD3da8C9daf3bfa471c12d58486",DODO_DSP_PROXY:"0x2442A8B5cdf1E659F3F949A7E454Caa554D4E65a",DODO_DPP_PROXY:"0x624FC8368fE11BE00D8B2F3fE0B9D0053BEc21b9",DODO_V1_PAIR_PROXY:"0x4Fc222194862081866FC636893DDeCB3E4341A10",DODO_MINEV3_PROXY:"0x8f3fB1f9148dC473453163bF31de1d830Eb5c590"},[x.POLYGON]:{MULTI_CALL:"0xc9eD9B18e447e600238fe50e944B9062B664DEa4",DODO_APPROVE:"0x6D310348d5c12009854DFCf72e0DF9027e8cb4f4",ERC20_HELPER:"0xfd24312Ec7871A6D1a31e454D5AbB16c6c25a9b3",ROUTE_V2_DATA_FETCH:"0x1870854754d1E76C58B0a56a153E12Ff868eE3C6",ROUTE_V1_DATA_FETCH:"0x18DFdE99F578A0735410797e949E8D3e2AFCB9D2",CALLEE_HELPER:"0x261F6cF4dF0e5c1432739cDAFD9299150FEd3dFc",DODO_PROXY:"0xa222e6a71D1A1Dd5F279805fbe38d5329C1d0e70",DODO_DSP_PROXY:"0xA3dfF6ae0F73f0970E31Da63B3736F7D3CEF683e",DODO_DPP_PROXY:"0xF6f1A1Ef2f5b56bb289993F75C12Eb41e4abC2f7",DODO_V1_PAIR_PROXY:"0x58E27C46c162F2a781d750BbE1119E1b2DfE82e0",DODO_MINEV3_PROXY:"0x47a65e74dd6b6B5E3243dBb01EDEd9D55ba234Ad"},[x.ARBITRUM_ONE]:{MULTI_CALL:"0xF718F2bd590E5621e53f7b89398e52f7Acced8ca",DODO_APPROVE:"0xA867241cDC8d3b0C07C85cC06F25a0cD3b5474d8",ERC20_HELPER:"0x7C062B9C584fA6eC2504270790D38240A2c5fE72",ROUTE_V2_DATA_FETCH:"0x0C420970b2e5efcBB6e833601772D6E707155eA6",ROUTE_V1_DATA_FETCH:"0x4EE6398898F7FC3e648b3f6bA458310ac29cD352",CALLEE_HELPER:"0xe3B40F8D8346d428EAB28d9Fd672b784d921cfBD",DODO_PROXY:"0x88CBf433471A0CD8240D2a12354362988b4593E5",DODO_DSP_PROXY:"0x36E5238B4479d1ba0bFE47550B0B8e4f4f500EAA",DODO_DPP_PROXY:"0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25",DODO_V1_PAIR_PROXY:"0x49186E32fEd50fd6B5604A2618c7B0b03Cd41414",DODO_MINEV3_PROXY:"0x7E820457780Ac99B9A042Cd5f875b274855A1eE9"},[x.ARBITRUM_SEPOLIA]:{MULTI_CALL:e.MulticallWithValid,DODO_APPROVE:e.DODOApprove,ERC20_HELPER:e.ERC20Helper,ROUTE_V2_DATA_FETCH:e.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:e.DODOV1PmmHelper,CALLEE_HELPER:e.DODOCalleeHelper,DODO_PROXY:e.DODOV2Proxy02,DODO_DSP_PROXY:e.DODODspProxy,DODO_DPP_PROXY:e.DODODppProxy,DODO_MINEV3_PROXY:e.DODOMineV3ProxyWithoutPlatform},[x.AURORA]:{MULTI_CALL:"0x989DcAA95801C527C5B73AA65d3962dF9aCe1b0C",DODO_APPROVE:"0x335aC99bb3E51BDbF22025f092Ebc1Cf2c5cC619",ERC20_HELPER:"0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25",ROUTE_V2_DATA_FETCH:"0x49eAB58AAE044F31d3b136212058a00b282b2845",ROUTE_V1_DATA_FETCH:"0xbAb9F4ff4A19a0e8EEBC56b06750253228ffAc6E",CALLEE_HELPER:"0x738Ebf387A0CE0eb46b0eF8Fa5DEa2EaE6B1Df51",DODO_PROXY:"0xd9deC7c3C06e62a4c1BeEB07CadF568f496b14c2",DODO_DSP_PROXY:"0x53233ABD9108761258a4B6B7822abFD6716B129B",DODO_DPP_PROXY:"0x357c5E9cfA8B834EDcef7C7aAbD8F9Db09119d11",DODO_MINEV3_PROXY:"0x4775b1858f1e417C9609D455C3Ad8751ec01daC4"},[x.OKCHAIN]:{MULTI_CALL:"0x5e84190a270333aCe5B9202a3F4ceBf11b81bB01",DODO_APPROVE:"0x7737fd30535c69545deeEa54AB8Dd590ccaEBD3c",ERC20_HELPER:"0x4775b1858f1e417C9609D455C3Ad8751ec01daC4",ROUTE_V2_DATA_FETCH:"0x10Dd6d8A29D489BEDE472CC1b22dc695c144c5c7",ROUTE_V1_DATA_FETCH:"0xDfaf9584F5d229A9DBE5978523317820A8897C5A",CALLEE_HELPER:"0x3CD6D7F5fF977bf8069548eA1F9441b061162b42",DODO_PROXY:"0x6B4Fa0bc61Eddc928e0Df9c7f01e407BfcD3e5EF",DODO_DSP_PROXY:"0x5515363c0412AdD5c72d3E302fE1bD7dCBCF93Fe",DODO_DPP_PROXY:"0xa222e6a71D1A1Dd5F279805fbe38d5329C1d0e70",DODO_MINEV3_PROXY:"0x958f79e2998DFe417208b9A07D799265B0298e58"},[x.OPTIMISM]:{MULTI_CALL:"0xb98Ac2fEFc8b73aeAE33D02BB00c26E12afCa9Df",DODO_APPROVE:"0xa492d6eABcdc3E204676f15B950bBdD448080364",ERC20_HELPER:"0x42E456ea0dd7538ea103fBb1d0388D14C97bB5b2",ROUTE_V2_DATA_FETCH:"0xC48A8e689a644de96F80786ACb69E6F76D057F25",ROUTE_V1_DATA_FETCH:"0x6281E0628eb2B37fE9943279EA39725D5f0E0dBe",CALLEE_HELPER:"0x0BD7426f008737FeeD575ED8e2aA1bd4Fc49112D",DODO_PROXY:"0xfD9D2827AD469B72B69329dAA325ba7AfbDb3C98",DODO_DSP_PROXY:"0x61721e89a498dADa7aD579482BDC2aE60a9C5D54",DODO_DPP_PROXY:"0x51A70a33655FE1c5fae3286890DcE3bE332E85dD",DODO_MINEV3_PROXY:"0xaEdbD08D92ECccaA9A93b1A8D66D1d356e470c78"},[x.AVALANCHE]:{MULTI_CALL:"0x97f0153E7F5749640aDF3Ff9CFC518b79D6Fe53b",DODO_APPROVE:"0xCFea63e3DE31De53D68780Dd65675F169439e470",ERC20_HELPER:"0xC3528D128CC227fd60793007b5e3FdF7c2945282",ROUTE_V2_DATA_FETCH:"0x686984f0aa37585504f51DEbA0Eb45B0f0CB7e4a",ROUTE_V1_DATA_FETCH:"0x790B4A80Fb1094589A3c0eFC8740aA9b0C1733fB",CALLEE_HELPER:"0x4EfF1D851366b8cc51d553a87e2d12dA8Da46F2a",DODO_PROXY:"0x2cD18557E14aF72DAA8090BcAA95b231ffC9ea26",DODO_DSP_PROXY:"0xeCEaDe494FD5F913Fd937C5CAc4577236395Dc32",DODO_DPP_PROXY:"0xe44F14BFDe673B7339734a28152cCd6b821753C9",DODO_MINEV3_PROXY:"0x5D6e6A0BFB2176AFCc4FB809822D8e009216b245"},[x.CONFLUX]:{MULTI_CALL:"0x696e25a5e2aed1c55e6d6cfa0532bbda9020165d",DODO_APPROVE:"0x5BaF16d57620Cb361F622232F3cb4090e35F3da2",ERC20_HELPER:"0x24549FC74B3076A962624A26370ed556c467F74C",ROUTE_V2_DATA_FETCH:"0x7E9c460d0A10bd0605B15F0d0388e307d34a62E6",ROUTE_V1_DATA_FETCH:"0xAC716E87b0853C0712674e8E3a8435a489F276b4",CALLEE_HELPER:"0x5B2fd46E6E3Ff1E479d651ec0b210882Aa9871dF",DODO_PROXY:"0xbce44767af0a53A108b3B7ba4F740E03D228Ec0A",DODO_DSP_PROXY:"0x8d9ccc26cbf3d49bba76e9920c3e6ed29e06b5cc",DODO_DPP_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b",DODO_MINEV3_PROXY:"0x14F7B8Fb0c1447DdE7bcf92a8d9BB058c8A5FE64"},[x.BASE]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x89872650fA1A391f58B4E144222bB02e44db7e3B",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",DODO_DSP_PROXY:"0x49186E32fEd50fd6B5604A2618c7B0b03Cd41414",DODO_DPP_PROXY:"0x0B1467f71c082D8d410aF4376C685D9A6893cF36",DODO_MINEV3_PROXY:"0x2F66C5aAF006Bd9c51615D617589C16c0ed35fD3"},[x.LINEA]:{MULTI_CALL:"0xa7b9C3a116b20bEDDdBE4d90ff97157f67F0bD97",DODO_APPROVE:"0x6de4d882a84A98f4CCD5D33ea6b3C99A07BAbeB1",ERC20_HELPER:"0xbcd2FDC3B884Cf0dfD932f55Ec2Fe1fB7e8c62Da",ROUTE_V2_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",ROUTE_V1_DATA_FETCH:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",CALLEE_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",DODO_PROXY:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",DODO_DSP_PROXY:"0x6D3bd005A8a75d6522C9cFE7d309BB1Cf9650e03",DODO_DPP_PROXY:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",DODO_MINEV3_PROXY:"0xA6d0066328Edbcf3220cf8F61e8527e589DD9719"},[x.SCROLL]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x20E77aD760eC9E922Fd2dA8847ABFbB2471B92CD",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xf5048d8F9163AF17Db522Abe9FaF37735C911320",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0xe49781e6186214d88aACFd9eBc8cE40E3CDc066D",DODO_DSP_PROXY:"0x7Dd8c909E1F48a68FfEF03492761AF17B1496EDc",DODO_DPP_PROXY:"0x99d69565EdA438E3ebAA0627A407968ABD0f755b",DODO_MINEV3_PROXY:"0x14F7B8Fb0c1447DdE7bcf92a8d9BB058c8A5FE64"},[x.MANTA]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0x0226fCE8c969604C3A0AD19c37d1FAFac73e13c2",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0x4CAD0052524648A7Fa2cfE279997b00239295F33",ROUTE_V1_DATA_FETCH:"0x17644d3B366273faC75A07996E2F90A99A2946a7",CALLEE_HELPER:"0x44023441f2Bad375b6b5C6354B03c3E9AD01E269",DODO_PROXY:"0x2F86652dAEF5f1728c54191C955F065Ec3C188c7",DODO_DSP_PROXY:"0x0B1467f71c082D8d410aF4376C685D9A6893cF36",DODO_DPP_PROXY:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",DODO_MINEV3_PROXY:"0xA6d0066328Edbcf3220cf8F61e8527e589DD9719"},[x.MANTLE]:{MULTI_CALL:"0xf5Ec1a19e1570bDf0A3AaA6585274f27027270b1",DODO_APPROVE:"0xa71415675F68f29259ddD63215E5518d2735bf0a",ERC20_HELPER:"0xB5c7BA1EAde74800cD6cf5F56b1c4562De373780",ROUTE_V2_DATA_FETCH:"0xCDA4a6cc5997002B87f28D46852F9F0aA0f3c897",ROUTE_V1_DATA_FETCH:"0xa1609A1fa7DC16c025feA194c02b2822441b8c10",CALLEE_HELPER:"0x4aAe1d041C01078725dB016BA4D4F72455CaF931",DODO_PROXY:"0xe7979E2F3e77196Bb2AB206eaa67Ea278A3E33A2",DODO_DSP_PROXY:"0x2933c0374089D7D98BA0C71c5E02E1A0e09deBEE",DODO_DPP_PROXY:"0xa5fc92Ca57a21C87AA0477b1c8fE8B9Bbf69d6C2",DODO_MINEV3_PROXY:"0x6D3bd005A8a75d6522C9cFE7d309BB1Cf9650e03"},[x.DODO_CHAIN_TESTNET]:{MULTI_CALL:"0xD0CF7dfbF09CAfaB8AEf00e0Ce19a4638004a364",DODO_APPROVE:"0x82B26eb18382f7532015248078AB1f6030413396",ERC20_HELPER:"0xE6cecb7460c9E52aA483cb1f0E87d78D7085686F",ROUTE_V2_DATA_FETCH:"0xA3148a1765897EC0A9bCA57f855C0B4718060b78",ROUTE_V1_DATA_FETCH:"0x2e50e3e18c19C7d80B81888a961A13aEE49b962E",CALLEE_HELPER:"0x2Ba2696c63fA8b67b395de6D12F849b17C3515F9",DODO_PROXY:"0x464518e33F7Bd5E61a92b98b4332782915442580",DODO_DSP_PROXY:"0x886F677605512351e554AA53BA77eA493058b460",DODO_DPP_PROXY:"0xB4f2E70DE64F94116A6e93ff4dF2D020E91e7a63",DODO_MINEV3_PROXY:"0x391f8D754E4BaC453d059BA7D2137C4905bF48d4"},[x.TAIKO]:{MULTI_CALL:"0x388371233439cF57bB8C9f2e4835954841cfCb15",DODO_APPROVE:"0x2629E610dB4AC081c108cCDf8b19ED39D702df43",ERC20_HELPER:"0x0c76F95a2952DC171B26b152f2b30cA8968e79D5",ROUTE_V2_DATA_FETCH:"0xC7EaBEc77Be175432DC20c0056Cce4c2C78B84F3",ROUTE_V1_DATA_FETCH:"0x187210CE04F5B3179F0e483FCf292c34BA7568Dd",CALLEE_HELPER:"0x94B66F3156353a12A6004d098A16F2fCfF9E8348",DODO_PROXY:"0xfcd8EF54A4dA96dE6B2DDF67C6265C7405a3A9c6",DODO_DSP_PROXY:"0x928e9762B5223d5A2ac1F5b13E8A61907aCaa9Bd",DODO_DPP_PROXY:"0x38886EDE1Fc92886F9a11C37a1f5e75474858eaa",DODO_MINEV3_PROXY:"0x1dFd36964e21a2eb633991f0B95b4241c20e1db3"},[x.PLUME]:{MULTI_CALL:t.MulticallWithValid,DODO_APPROVE:t.DODOApprove,ERC20_HELPER:t.ERC20Helper,ROUTE_V2_DATA_FETCH:t.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:t.DODOV1PmmHelper,CALLEE_HELPER:t.DODOCalleeHelper,DODO_PROXY:t.DODOV2Proxy02,DODO_DSP_PROXY:t.DODODspProxy,DODO_DPP_PROXY:t.DODODppProxy,DODO_MINEV3_PROXY:t.DODOMineV3Proxy},[x.PLUME_TESTNET]:{MULTI_CALL:n.MulticallWithValid,DODO_APPROVE:n.DODOApprove,ERC20_HELPER:n.ERC20Helper,ROUTE_V2_DATA_FETCH:n.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:n.DODOV1PmmHelper,CALLEE_HELPER:n.DODOCalleeHelper,DODO_PROXY:n.DODOV2Proxy02,DODO_DSP_PROXY:n.DODODspProxy,DODO_DPP_PROXY:n.DODODppProxy,DODO_MINEV3_PROXY:n.DODOMineV3Proxy},[x.NEOX]:{MULTI_CALL:r.MulticallWithValid,DODO_APPROVE:r.DODOApprove,ERC20_HELPER:r.ERC20Helper,ROUTE_V2_DATA_FETCH:r.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:r.DODOV1PmmHelper,CALLEE_HELPER:r.DODOCalleeHelper,DODO_PROXY:r.DODOV2Proxy02,DODO_DSP_PROXY:r.DODODspProxy,DODO_DPP_PROXY:r.DODODppProxy,DODO_MINEV3_PROXY:r.DODOMineV3Proxy},[x.MORPH]:{MULTI_CALL:i.MulticallWithValid,DODO_APPROVE:i.DODOApprove,ERC20_HELPER:i.ERC20Helper,ROUTE_V2_DATA_FETCH:i.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:i.DODOV1PmmHelper,CALLEE_HELPER:i.DODOCalleeHelper,DODO_PROXY:i.DODOV2Proxy02,DODO_DSP_PROXY:i.DODODspProxy,DODO_DPP_PROXY:i.DODODppProxy,DODO_MINEV3_PROXY:i.DODOMineV3Proxy},[x.RISE_TESTNET]:{MULTI_CALL:s.MulticallWithValid,DODO_APPROVE:s.DODOApprove,ERC20_HELPER:s.ERC20Helper,ROUTE_V2_DATA_FETCH:s.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:s.DODOV1PmmHelper,CALLEE_HELPER:s.DODOCalleeHelper,DODO_PROXY:s.DODOV2Proxy02,DODO_DSP_PROXY:s.DODODspProxy,DODO_DPP_PROXY:s.DODODppProxy,DODO_MINEV3_PROXY:s.DODOMineV3Proxy},[x.NEROCHAIN]:{MULTI_CALL:o.MulticallWithValid,DODO_APPROVE:o.DODOApprove,ERC20_HELPER:o.ERC20Helper,ROUTE_V2_DATA_FETCH:o.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:o.DODOV1PmmHelper,CALLEE_HELPER:o.DODOCalleeHelper,DODO_PROXY:o.DODOV2Proxy02,DODO_DSP_PROXY:o.DODODspProxy,DODO_DPP_PROXY:o.DODODppProxy,DODO_MINEV3_PROXY:o.DODOMineV3Proxy},[x.BITLAYER]:{MULTI_CALL:a.MulticallWithValid,DODO_APPROVE:a.DODOApprove,ERC20_HELPER:a.ERC20Helper,ROUTE_V2_DATA_FETCH:a.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:a.DODOV1PmmHelper,CALLEE_HELPER:a.DODOCalleeHelper,DODO_PROXY:a.DODOV2Proxy02,DODO_DSP_PROXY:a.DODODspProxyWithoutGSP,DODO_DPP_PROXY:a.DODODppProxy,DODO_MINEV3_PROXY:a.DODOMineV3Proxy},[x.ZIRCUIT]:{MULTI_CALL:l.MulticallWithValid,DODO_APPROVE:l.DODOApprove,ERC20_HELPER:l.ERC20Helper,ROUTE_V2_DATA_FETCH:l.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:l.DODOV1PmmHelper,CALLEE_HELPER:l.DODOCalleeHelper,DODO_PROXY:l.DODOV2Proxy02,DODO_DSP_PROXY:l.DODODspProxyWithoutGSP,DODO_DPP_PROXY:l.DODODppProxy,DODO_MINEV3_PROXY:l.DODOMineV3Proxy},[x.X_LAYER]:{MULTI_CALL:c.MulticallWithValid,DODO_APPROVE:c.DODOApprove,ERC20_HELPER:c.ERC20Helper,ROUTE_V2_DATA_FETCH:c.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:c.DODOV1PmmHelper,CALLEE_HELPER:c.DODOCalleeHelper,DODO_PROXY:c.DODOV2Proxy02,DODO_DSP_PROXY:c.DODODspProxy,DODO_DPP_PROXY:c.DODODppProxy,DODO_MINEV3_PROXY:c.DODOMineV3Proxy},[x.ZERO]:{MULTI_CALL:u.MulticallWithValid,DODO_APPROVE:u.DODOApprove,ERC20_HELPER:u.ERC20Helper,ROUTE_V2_DATA_FETCH:u.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:u.DODOV1PmmHelper,CALLEE_HELPER:u.DODOCalleeHelper,DODO_PROXY:u.DODOV2Proxy02,DODO_DSP_PROXY:u.DODODspProxy,DODO_DPP_PROXY:u.DODODppProxy,DODO_MINEV3_PROXY:u.DODOMineV3Proxy},[x.HASHKEY]:{MULTI_CALL:d.MulticallWithValid,DODO_APPROVE:d.DODOApprove,ERC20_HELPER:d.ERC20Helper,ROUTE_V2_DATA_FETCH:d.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:d.DODOV1PmmHelper,CALLEE_HELPER:d.DODOCalleeHelper,DODO_PROXY:d.DODOV2Proxy02,DODO_DSP_PROXY:d.DODODspProxyWithoutGSP,DODO_DPP_PROXY:d.DODODppProxy,DODO_MINEV3_PROXY:d.DODOMineV3Proxy},[x.HEMI]:{MULTI_CALL:h.MulticallWithValid,DODO_APPROVE:h.DODOApprove,ERC20_HELPER:h.ERC20Helper,ROUTE_V2_DATA_FETCH:h.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:h.DODOV1PmmHelper,CALLEE_HELPER:h.DODOCalleeHelper,DODO_PROXY:h.DODOV2Proxy02,DODO_DSP_PROXY:h.DODODspProxyWithoutGSP,DODO_DPP_PROXY:h.DODODppProxy,DODO_MINEV3_PROXY:h.DODOMineV3Proxy},[x.PHAROS_TESTNET]:{MULTI_CALL:f.MulticallWithValid,DODO_APPROVE:f.DODOApprove,ERC20_HELPER:f.ERC20Helper,ROUTE_V2_DATA_FETCH:f.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:f.DODOV1PmmHelper,CALLEE_HELPER:f.DODOCalleeHelper,DODO_PROXY:f.DODOV2Proxy02,DODO_DSP_PROXY:f.DODODspProxy,DODO_DPP_PROXY:f.DODODppProxy,DODO_MINEV3_PROXY:f.DODOMineV3Proxy},[x.MONAD_TESTNET]:{MULTI_CALL:p.MulticallWithValid,DODO_APPROVE:p.DODOApprove,ERC20_HELPER:p.ERC20Helper,ROUTE_V2_DATA_FETCH:p.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:p.DODOV1PmmHelper,CALLEE_HELPER:p.DODOCalleeHelper,DODO_PROXY:p.DODOV2Proxy02,DODO_DSP_PROXY:p.DODODspProxy,DODO_DPP_PROXY:p.DODODppProxy,DODO_MINEV3_PROXY:p.DODOMineV3Proxy},[x.MONAD]:{MULTI_CALL:m.MulticallWithValid,DODO_APPROVE:m.DODOApprove,ERC20_HELPER:m.ERC20Helper,ROUTE_V2_DATA_FETCH:m.DODOV2RouteHelper,ROUTE_V1_DATA_FETCH:m.DODOV1PmmHelper,CALLEE_HELPER:m.DODOCalleeHelper,DODO_PROXY:m.DODOV2Proxy02,DODO_DSP_PROXY:m.DODODspProxy,DODO_DPP_PROXY:m.DODODppProxy,DODO_MINEV3_PROXY:m.DODOMineV3Proxy}},q={[x.MAINNET]:"ethereum",[x.GOERLI]:"goerli",[x.OPTIMISM]:"optimism",[x.CONFLUX]:"cfx",[x.BSC]:"bsc",[x.OKCHAIN]:"okex-chain",[x.POLYGON]:"polygon",[x.ARBITRUM_ONE]:"arbitrum",[x.ARBITRUM_SEPOLIA]:"arb-sep",[x.AURORA]:"aurora",[x.AVALANCHE]:"avalanche",[x.BASE]:"base",[x.LINEA]:"linea",[x.SCROLL]:"scr",[x.MANTA]:"manta",[x.MANTLE]:"mantle",[x.SEPOLIA]:"sepolia",[x.DODO_CHAIN_TESTNET]:"dodochain-testnet",[x.TAIKO]:"taiko",[x.PLUME]:"plume",[x.PLUME_TESTNET]:"plume-testnet",[x.NEOX]:"neox",[x.MORPH]:"morph",[x.RISE_TESTNET]:"rise-testnet",[x.NEROCHAIN]:"nero",[x.BITLAYER]:"btr",[x.ZIRCUIT]:"zircuit-mainnet",[x.X_LAYER]:"okb",[x.ZERO]:"zero-mainnet",[x.HASHKEY]:"hashkey",[x.HEMI]:"hemi",[x.PHAROS_TESTNET]:"pharos-testnet",[x.MONAD_TESTNET]:"monad-testnet",[x.MONAD]:"monad"};function U(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}let V=!1,H=!1;const j={debug:1,default:2,info:2,warning:3,error:4,off:5};let Q=j.default,Y=null;const G=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}})),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 X,$;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(X||(X={})),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"}($||($={}));const K="0123456789abcdef";class z{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==j[n]&&this.throwArgumentError("invalid log level name","logLevel",e),Q>j[n]||console.log.apply(console,t)}debug(...e){this._log(z.levels.DEBUG,e)}info(...e){this._log(z.levels.INFO,e)}warn(...e){this._log(z.levels.WARNING,e)}makeError(e,t,n){if(H)return this.makeError("censored error",t,{});t||(t=z.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e<t.length;e++)n+=K[t[e]>>4],n+=K[15&t[e]];r.push(e+"=Uint8Array(0x"+n+")")}else r.push(e+"="+JSON.stringify(t))}catch(t){r.push(e+"="+JSON.stringify(n[e].toString()))}})),r.push(`code=${t}`),r.push(`version=${this.version}`);const i=e;let s="";switch(t){case $.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case $.CALL_EXCEPTION:case $.INSUFFICIENT_FUNDS:case $.MISSING_NEW:case $.NONCE_EXPIRED:case $.REPLACEMENT_UNDERPRICED:case $.TRANSACTION_REPLACED:case $.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),r.length&&(e+=" ("+r.join(", ")+")");const o=new Error(e);return o.reason=i,o.code=t,Object.keys(n).forEach((function(e){o[e]=n[e]})),o}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,z.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(e){G&&this.throwError("platform missing String.prototype.normalize",z.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:G})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,z.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,z.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n=n?": "+n:"",e<t&&this.throwError("missing argument"+n,z.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+n,z.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",z.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",z.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",z.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Y||(Y=new z("logger/5.7.0")),Y}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",z.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),V){if(!e)return;this.globalLogger().throwError("error censorship permanent",z.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}H=!!e,V=!!t}static setLogLevel(e){const t=j[e.toLowerCase()];null!=t?Q=t:z.globalLogger().warn("invalid log level - "+e)}static from(e){return new z(e)}}z.errors=$,z.levels=X;const J=new z("bytes/5.7.0");function W(e){return!!e.toHexString}function Z(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return Z(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function ee(e){return oe(e)&&!(e.length%2)||ne(e)}function te(e){return"number"==typeof e&&e==e&&e%1==0}function ne(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!te(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const n=e[t];if(!te(n)||n<0||n>=256)return!1}return!0}function re(e,t){if(t||(t={}),"number"==typeof e){J.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),Z(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),W(e)&&(e=e.toHexString()),oe(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":J.throwArgumentError("hex data is odd-length","value",e));const r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return Z(new Uint8Array(r))}return ne(e)?Z(new Uint8Array(e)):J.throwArgumentError("invalid arrayify value","value",e)}function ie(e){const t=e.map((e=>re(e))),n=t.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(n);return t.reduce(((e,t)=>(r.set(t,e),e+t.length)),0),Z(r)}function se(e){let t=re(e);if(0===t.length)return t;let n=0;for(;n<t.length&&0===t[n];)n++;return n&&(t=t.slice(n)),t}function oe(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const ae="0123456789abcdef";function le(e,t){if(t||(t={}),"number"==typeof e){J.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=ae[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),W(e))return e.toHexString();if(oe(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":J.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(ne(e)){let t="0x";for(let n=0;n<e.length;n++){let r=e[n];t+=ae[(240&r)>>4]+ae[15&r]}return t}return J.throwArgumentError("invalid hexlify value","value",e)}function ce(e){if("string"!=typeof e)e=le(e);else if(!oe(e)||e.length%2)return null;return(e.length-2)/2}function ue(e,t,n){return"string"!=typeof e?e=le(e):(!oe(e)||e.length%2)&&J.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function de(e){let t="0x";return e.forEach((e=>{t+=le(e).substring(2)})),t}function he(e){const t=function(e){"string"!=typeof e&&(e=le(e));oe(e)||J.throwArgumentError("invalid hex string","value",e);e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}(le(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function fe(e,t){for("string"!=typeof e?e=le(e):oe(e)||J.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&J.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function pe(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(ee(e)){let n=re(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=le(n.slice(0,32)),t.s=le(n.slice(32,64))):65===n.length?(t.r=le(n.slice(0,32)),t.s=le(n.slice(32,64)),t.v=n[64]):J.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:J.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=le(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const n=function(e,t){(e=re(e)).length>t&&J.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(e,t-e.length),Z(n)}(re(t._vs),32);t._vs=le(n);const r=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=r:t.recoveryParam!==r&&J.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;const i=le(n);null==t.s?t.s=i:t.s!==i&&J.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?J.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const n=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==n&&J.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&oe(t.r)?t.r=fe(t.r,32):J.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&oe(t.s)?t.s=fe(t.s,32):J.throwArgumentError("signature missing or invalid s","signature",e);const n=re(t.s);n[0]>=128&&J.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(n[0]|=128);const r=le(n);t._vs&&(oe(t._vs)||J.throwArgumentError("signature invalid _vs","signature",e),t._vs=fe(t._vs,32)),null==t._vs?t._vs=r:t._vs!==r&&J.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}const me="bignumber/5.7.0";var ge=O.BN;const ye=new z(me),Ae={},Ee=9007199254740991;let be=!1;class ve{constructor(e,t){e!==Ae&&ye.throwError("cannot call constructor directly; use BigNumber.from",z.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Oe(De(this).fromTwos(e))}toTwos(e){return Oe(De(this).toTwos(e))}abs(){return"-"===this._hex[0]?ve.from(this._hex.substring(1)):this}add(e){return Oe(De(this).add(De(e)))}sub(e){return Oe(De(this).sub(De(e)))}div(e){return ve.from(e).isZero()&&Pe("division-by-zero","div"),Oe(De(this).div(De(e)))}mul(e){return Oe(De(this).mul(De(e)))}mod(e){const t=De(e);return t.isNeg()&&Pe("division-by-zero","mod"),Oe(De(this).umod(t))}pow(e){const t=De(e);return t.isNeg()&&Pe("negative-power","pow"),Oe(De(this).pow(t))}and(e){const t=De(e);return(this.isNegative()||t.isNeg())&&Pe("unbound-bitwise-result","and"),Oe(De(this).and(t))}or(e){const t=De(e);return(this.isNegative()||t.isNeg())&&Pe("unbound-bitwise-result","or"),Oe(De(this).or(t))}xor(e){const t=De(e);return(this.isNegative()||t.isNeg())&&Pe("unbound-bitwise-result","xor"),Oe(De(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Pe("negative-width","mask"),Oe(De(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Pe("negative-width","shl"),Oe(De(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Pe("negative-width","shr"),Oe(De(this).shrn(e))}eq(e){return De(this).eq(De(e))}lt(e){return De(this).lt(De(e))}lte(e){return De(this).lte(De(e))}gt(e){return De(this).gt(De(e))}gte(e){return De(this).gte(De(e))}isNegative(){return"-"===this._hex[0]}isZero(){return De(this).isZero()}toNumber(){try{return De(this).toNumber()}catch(e){Pe("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return ye.throwError("this platform does not support BigInt",z.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?be||(be=!0,ye.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?ye.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",z.errors.UNEXPECTED_ARGUMENT,{}):ye.throwError("BigNumber.toString does not accept parameters",z.errors.UNEXPECTED_ARGUMENT,{})),De(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof ve)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new ve(Ae,we(e)):e.match(/^-?[0-9]+$/)?new ve(Ae,we(new ge(e))):ye.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Pe("underflow","BigNumber.from",e),(e>=Ee||e<=-Ee)&&Pe("overflow","BigNumber.from",e),ve.from(String(e));const t=e;if("bigint"==typeof t)return ve.from(t.toString());if(ne(t))return ve.from(le(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return ve.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(oe(e)||"-"===e[0]&&oe(e.substring(1))))return ve.from(e)}return ye.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function we(e){if("string"!=typeof e)return we(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&ye.throwArgumentError("invalid hex","value",e),"0x00"===(e=we(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function Oe(e){return ve.from(we(e))}function De(e){const t=ve.from(e).toHexString();return"-"===t[0]?new ge("-"+t.substring(3),16):new ge(t.substring(2),16)}function Pe(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),ye.throwError(e,z.errors.NUMERIC_FAULT,r)}const _e=new z(me),Te={},Ie=ve.from(0),Re=ve.from(-1);function Ce(e,t,n,r){const i={fault:t,operation:n};return void 0!==r&&(i.value=r),_e.throwError(e,z.errors.NUMERIC_FAULT,i)}let Be="0";for(;Be.length<256;)Be+=Be;function ke(e){if("number"!=typeof e)try{e=ve.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Be.substring(0,e):_e.throwArgumentError("invalid decimal size","decimals",e)}function Ne(e,t){null==t&&(t=0);const n=ke(t),r=(e=ve.from(e)).lt(Ie);r&&(e=e.mul(Re));let i=e.mod(n).toString();for(;i.length<n.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(n).toString();return e=1===n.length?s:s+"."+i,r&&(e="-"+e),e}function xe(e,t){null==t&&(t=0);const n=ke(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||_e.throwArgumentError("invalid decimal value","value",e);const r="-"===e.substring(0,1);r&&(e=e.substring(1)),"."===e&&_e.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&_e.throwArgumentError("too many decimal points","value",e);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>n.length-1&&Ce("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<n.length-1;)o+="0";const a=ve.from(s),l=ve.from(o);let c=a.mul(n).add(l);return r&&(c=c.mul(Re)),c}class Se{constructor(e,t,n,r){e!==Te&&_e.throwError("cannot use FixedFormat constructor; use FixedFormat.from",z.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=n,this.decimals=r,this.name=(t?"":"u")+"fixed"+String(n)+"x"+String(r),this._multiplier=ke(r),Object.freeze(this)}static from(e){if(e instanceof Se)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,n=128,r=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||_e.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],n=parseInt(i[2]),r=parseInt(i[3])}else if(e){const i=(t,n,r)=>null==e[t]?r:(typeof e[t]!==n&&_e.throwArgumentError("invalid fixed format ("+t+" not "+n+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&_e.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&_e.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new Se(Te,t,n,r)}}class Le{constructor(e,t,n,r){e!==Te&&_e.throwError("cannot use FixedNumber constructor; use FixedNumber.from",z.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=t,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&_e.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=xe(this._value,this.format.decimals),n=xe(e._value,e.format.decimals);return Le.fromValue(t.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=xe(this._value,this.format.decimals),n=xe(e._value,e.format.decimals);return Le.fromValue(t.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=xe(this._value,this.format.decimals),n=xe(e._value,e.format.decimals);return Le.fromValue(t.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=xe(this._value,this.format.decimals),n=xe(e._value,e.format.decimals);return Le.fromValue(t.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Le.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(t=t.subUnsafe(Fe.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=Le.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(t=t.addUnsafe(Fe.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&_e.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const n=Le.from("1"+Be.substring(0,e),this.format),r=Me.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&_e.throwArgumentError("invalid byte width","width",e);return fe(ve.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Le.fromString(this._value,e)}static fromValue(e,t,n){return null!=n||null==t||function(e){return null!=e&&(ve.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||oe(e)||"bigint"==typeof e||ne(e))}(t)||(n=t,t=null),null==t&&(t=0),null==n&&(n="fixed"),Le.fromString(Ne(e,t),Se.from(n))}static fromString(e,t){null==t&&(t="fixed");const n=Se.from(t),r=xe(e,n.decimals);!n.signed&&r.lt(Ie)&&Ce("unsigned value cannot be negative","overflow","value",e);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=fe(i,n.width/8));const s=Ne(r,n.decimals);return new Le(Te,i,s,n)}static fromBytes(e,t){null==t&&(t="fixed");const n=Se.from(t);if(re(e).length>n.width/8)throw new Error("overflow");let r=ve.from(e);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),s=Ne(r,n.decimals);return new Le(Te,i,s,n)}static from(e,t){if("string"==typeof e)return Le.fromString(e,t);if(ne(e))return Le.fromBytes(e,t);try{return Le.fromValue(e,0,t)}catch(e){if(e.code!==z.errors.INVALID_ARGUMENT)throw e}return _e.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const Fe=Le.from(1),Me=Le.from("0.5");var qe=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Ue=new z("properties/5.7.0");function Ve(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function He(e,t){for(let n=0;n<32;n++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function je(e){return qe(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const n=e[t];return Promise.resolve(n).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function Qe(e){const t={};for(const n in e)t[n]=e[n];return t}const Ye={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Ge(e){if(null==e||Ye[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let n=0;n<t.length;n++){let r=null;try{r=e[t[n]]}catch(e){continue}if(!Ge(r))return!1}return!0}return Ue.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Xe(e){if(Ge(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>$e(e))));if("object"==typeof e){const t={};for(const n in e){const r=e[n];void 0!==r&&Ve(t,n,$e(r))}return t}return Ue.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function $e(e){return Xe(e)}class Ke{constructor(e){for(const t in e)this[t]=$e(e[t])}}var ze=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Je=new z("abstract-provider/5.7.0");class We extends Ke{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class Ze{constructor(){Je.checkAbstract(new.target,Ze),Ve(this,"_isProvider",!0)}getFeeData(){return ze(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield je({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let n=null,r=null,i=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,i=ve.from("1500000000"),r=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}const et=new z("networks/5.7.1");function tt(e){const t=function(t,n){null==n&&(n={});const r=[];if(t.InfuraProvider&&"-"!==n.infura)try{r.push(new t.InfuraProvider(e,n.infura))}catch(e){}if(t.EtherscanProvider&&"-"!==n.etherscan)try{r.push(new t.EtherscanProvider(e,n.etherscan))}catch(e){}if(t.AlchemyProvider&&"-"!==n.alchemy)try{r.push(new t.AlchemyProvider(e,n.alchemy))}catch(e){}if(t.PocketProvider&&"-"!==n.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const s=new t.PocketProvider(e,n.pocket);s.network&&-1===i.indexOf(s.network.name)&&r.push(s)}catch(e){}}if(t.CloudflareProvider&&"-"!==n.cloudflare)try{r.push(new t.CloudflareProvider(e))}catch(e){}if(t.AnkrProvider&&"-"!==n.ankr)try{const i=["ropsten"],s=new t.AnkrProvider(e,n.ankr);s.network&&-1===i.indexOf(s.network.name)&&r.push(s)}catch(e){}if(0===r.length)return null;if(t.FallbackProvider){let i=1;return null!=n.quorum?i=n.quorum:"homestead"===e&&(i=2),new t.FallbackProvider(r,i)}return r[0]};return t.renetwork=function(e){return tt(e)},t}function nt(e,t){const n=function(n,r){return n.JsonRpcProvider?new n.JsonRpcProvider(e,t):null};return n.renetwork=function(t){return nt(e,t)},n}const rt={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:tt("homestead")},it={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:tt("ropsten")},st={chainId:63,name:"classicMordor",_defaultProvider:nt("https://www.ethercluster.com/mordor","classicMordor")},ot={unspecified:{chainId:0,name:"unspecified"},homestead:rt,mainnet:rt,morden:{chainId:2,name:"morden"},ropsten:it,testnet:it,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:tt("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:tt("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:tt("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:tt("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:nt("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:st,classicTestnet:st,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:nt("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:tt("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:tt("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function at(e){e=atob(e);const t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return re(t)}function lt(e){e=re(e);let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}class ct{constructor(e){Ve(this,"alphabet",e),Ve(this,"base",e.length),Ve(this,"_alphabetMap",{}),Ve(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=re(e);if(0===t.length)return"";let n=[0];for(let e=0;e<t.length;++e){let r=t[e];for(let e=0;e<n.length;++e)r+=n[e]<<8,n[e]=r%this.base,r=r/this.base|0;for(;r>0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let e=0;0===t[e]&&e<t.length-1;++e)r+=this._leader;for(let e=n.length-1;e>=0;--e)r+=this.alphabet[n[e]];return r}decode(e){if("string"!=typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let n=0;n<e.length;n++){let r=this._alphabetMap[e[n]];if(void 0===r)throw new Error("Non-base"+this.base+" character");let i=r;for(let e=0;e<t.length;++e)i+=t[e]*this.base,t[e]=255&i,i>>=8;for(;i>0;)t.push(255&i),i>>=8}for(let n=0;e[n]===this._leader&&n<e.length-1;++n)t.push(0);return re(new Uint8Array(t.reverse()))}}new ct("abcdefghijklmnopqrstuvwxyz234567");const ut=new ct("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),dt=ve.from(-1),ht=ve.from(0),ft=ve.from(1),pt=ve.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function mt(e){return"0x"+w.keccak_256(re(e))}const gt=new z("strings/5.7.0");var yt,At;function Et(e,t,n,r,i){if(e===At.BAD_PREFIX||e===At.UNEXPECTED_CONTINUE){let e=0;for(let r=t+1;r<n.length&&n[r]>>6==2;r++)e++;return e}return e===At.OVERRUN?n.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(yt||(yt={})),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"}(At||(At={}));const bt=Object.freeze({error:function(e,t,n,r,i){return gt.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",n)},ignore:Et,replace:function(e,t,n,r,i){return e===At.OVERLONG?(r.push(i),0):(r.push(65533),Et(e,t,n))}});function vt(e,t){null==t&&(t=bt.error),e=re(e);const n=[];let r=0;for(;r<e.length;){const i=e[r++];if(!(i>>7)){n.push(i);continue}let s=null,o=null;if(192==(224&i))s=1,o=127;else if(224==(240&i))s=2,o=2047;else{if(240!=(248&i)){r+=t(128==(192&i)?At.UNEXPECTED_CONTINUE:At.BAD_PREFIX,r-1,e,n);continue}s=3,o=65535}if(r-1+s>=e.length){r+=t(At.OVERRUN,r-1,e,n);continue}let a=i&(1<<8-s-1)-1;for(let i=0;i<s;i++){let i=e[r];if(128!=(192&i)){r+=t(At.MISSING_CONTINUE,r,e,n),a=null;break}a=a<<6|63&i,r++}null!==a&&(a>1114111?r+=t(At.OUT_OF_RANGE,r-1-s,e,n,a):a>=55296&&a<=57343?r+=t(At.UTF16_SURROGATE,r-1-s,e,n,a):a<=o?r+=t(At.OVERLONG,r-1-s,e,n,a):n.push(a))}return n}function wt(e,t=yt.current){t!=yt.current&&(gt.checkNormalize(),e=e.normalize(t));let n=[];for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const s=65536+((1023&r)<<10)+(1023&i);n.push(s>>18|240),n.push(s>>12&63|128),n.push(s>>6&63|128),n.push(63&s|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return re(n)}function Ot(e,t){return vt(e,t).map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function Dt(e){return mt(wt(e))}const Pt="hash/5.7.0";function _t(e,t){null==t&&(t=1);const n=[],r=n.forEach,i=function(e,t){r.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):n.push(e)}))};return i(e,t),n}function Tt(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function n(){return e[t++]<<8|e[t++]}let r=n(),i=1,s=[0,1];for(let e=1;e<r;e++)s.push(i+=n());let o=n(),a=t;t+=o;let l=0,c=0;function u(){return 0==l&&(c=c<<8|e[t++],l=8),c>>--l&1}const d=Math.pow(2,31),h=d>>>1,f=h>>1,p=d-1;let m=0;for(let e=0;e<31;e++)m=m<<1|u();let g=[],y=0,A=d;for(;;){let e=Math.floor(((m-y+1)*i-1)/A),t=0,n=r;for(;n-t>1;){let r=t+n>>>1;e<s[r]?n=r:t=r}if(0==t)break;g.push(t);let o=y+Math.floor(A*s[t]/i),a=y+Math.floor(A*s[t+1]/i)-1;for(;!((o^a)&h);)m=m<<1&p|u(),o=o<<1&p,a=a<<1&p|1;for(;o&~a&f;)m=m&h|m<<1&p>>>1|u(),o=o<<1^h,a=(a^h)<<1|h|1;y=o,A=1+a-o}let E=r-4;return g.map((t=>{switch(t-E){case 3:return E+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return E+256+(e[a++]<<8|e[a++]);case 1:return E+e[a++];default:return t-1}}))}(e))}function It(e){return 1&e?~e>>1:e>>1}function Rt(e,t){let n=Array(e);for(let r=0,i=-1;r<e;r++)n[r]=i+=1+t();return n}function Ct(e,t){let n=Array(e);for(let r=0,i=0;r<e;r++)n[r]=i+=It(t());return n}function Bt(e,t){let n=Rt(e(),e),r=e(),i=Rt(r,e),s=function(e,t){let n=Array(e);for(let r=0;r<e;r++)n[r]=1+t();return n}(r,e);for(let e=0;e<r;e++)for(let t=0;t<s[e];t++)n.push(i[e]+t);return t?n.map((e=>t[e])):n}function kt(e,t,n){let r=Array(e).fill(void 0).map((()=>[]));for(let i=0;i<t;i++)Ct(e,n).forEach(((e,t)=>r[t].push(e)));return r}function Nt(e,t){let n=1+t(),r=t(),i=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(n)}return t}(t);return _t(kt(i.length,1+e,t).map(((e,t)=>{const s=e[0],o=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*r;return[s+t*n,o.map((e=>e+i))]}))})))}function xt(e,t){return kt(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const St=Tt(at("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),Lt=new Set(Bt(St)),Ft=new Set(Bt(St)),Mt=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(Nt(n,e))}for(;;){let n=e()-1;if(n<0)break;t.push(xt(n,e))}return function(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[r[0]]=r[1]}return t}(_t(t))}(St),qt=function(e){let t=Bt(e).sort(((e,t)=>e-t));return function n(){let r=[];for(;;){let i=Bt(e,t);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((e,t)=>t.set.size-e.set.size));let i=e(),s=i%3;i=i/3|0;let o=!!(1&i);return i>>=1,{branches:r,valid:s,fe0f:o,save:1==i,check:2==i}}()}(St),Ut=45,Vt=95;function Ht(e){return function(e,t=yt.current){return vt(wt(e,t))}(e)}function jt(e){return e.filter((e=>65039!=e))}function Qt(e){for(let t of e.split(".")){let e=Ht(t);try{for(let t=e.lastIndexOf(Vt)-1;t>=0;t--)if(e[t]!==Vt)throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&e[2]===Ut&&e[3]===Ut)throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function Yt(e){return Qt(function(e,t){let n=Ht(e).reverse(),r=[];for(;n.length;){let e=Gt(n);if(e){r.push(...t(e));continue}let i=n.pop();if(Lt.has(i)){r.push(i);continue}if(Ft.has(i))continue;let s=Mt[i];if(!s)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...s)}return Qt((i=String.fromCodePoint(...r),i.normalize("NFC")));var i}(e,jt))}function Gt(e,t){var n;let r,i,s=qt,o=[],a=e.length;for(;a;){let t=e[--a];if(s=null===(n=s.branches.find((e=>e.set.has(t))))||void 0===n?void 0:n.node,!s)break;if(s.save)i=t;else if(s.check&&t===i)break;o.push(t),s.fe0f&&(o.push(65039),a>0&&65039==e[a-1]&&a--),s.valid&&(r=o.slice(),2==s.valid&&r.splice(1,1),e.length=a)}return r}const Xt=new z(Pt),$t=new Uint8Array(32);function Kt(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function zt(e){const t=wt(Yt(e)),n=[];if(0===e.length)return n;let r=0;for(let e=0;e<t.length;e++){46===t[e]&&(n.push(Kt(t.slice(r,e))),r=e+1)}if(r>=t.length)throw new Error("invalid ENS name; empty component");return n.push(Kt(t.slice(r))),n}function Jt(e){"string"!=typeof e&&Xt.throwArgumentError("invalid ENS name; not a string","name",e);let t=$t;const n=zt(e);for(;n.length;)t=mt(ie([t,mt(n.pop())]));return le(t)}$t.fill(0);const Wt=new z("rlp/5.7.0");function Zt(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function en(e,t,n){let r=0;for(let i=0;i<n;i++)r=256*r+e[t+i];return r}function tn(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(tn(e))})),t.length<=55)return t.unshift(192+t.length),t;const n=Zt(t.length);return n.unshift(247+n.length),n.concat(t)}ee(e)||Wt.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(re(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const n=Zt(t.length);return n.unshift(183+n.length),n.concat(t)}function nn(e){return le(tn(e))}function rn(e,t,n,r){const i=[];for(;n<t+1+r;){const s=sn(e,n);i.push(s.result),(n+=s.consumed)>t+1+r&&Wt.throwError("child data too short",z.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function sn(e,t){if(0===e.length&&Wt.throwError("data too short",z.errors.BUFFER_OVERRUN,{}),e[t]>=248){const n=e[t]-247;t+1+n>e.length&&Wt.throwError("data short segment too short",z.errors.BUFFER_OVERRUN,{});const r=en(e,t+1,n);return t+1+n+r>e.length&&Wt.throwError("data long segment too short",z.errors.BUFFER_OVERRUN,{}),rn(e,t,t+1+n,n+r)}if(e[t]>=192){const n=e[t]-192;return t+1+n>e.length&&Wt.throwError("data array too short",z.errors.BUFFER_OVERRUN,{}),rn(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;t+1+n>e.length&&Wt.throwError("data array too short",z.errors.BUFFER_OVERRUN,{});const r=en(e,t+1,n);t+1+n+r>e.length&&Wt.throwError("data array too short",z.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:le(e.slice(t+1+n,t+1+n+r))}}if(e[t]>=128){const n=e[t]-128;t+1+n>e.length&&Wt.throwError("data too short",z.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:le(e.slice(t+1,t+1+n))}}return{consumed:1,result:le(e[t])}}function on(e){const t=re(e),n=sn(t,0);return n.consumed!==t.length&&Wt.throwArgumentError("invalid rlp data","data",e),n.result}const an=new z("address/5.7.0");function ln(e){oe(e,20)||an.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let e=0;e<40;e++)n[e]=t[e].charCodeAt(0);const r=re(mt(n));for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&r[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const cn={};for(let e=0;e<10;e++)cn[String(e)]=String(e);for(let e=0;e<26;e++)cn[String.fromCharCode(65+e)]=String(10+e);const un=Math.floor((dn=9007199254740991,Math.log10?Math.log10(dn):Math.log(dn)/Math.LN10));var dn;function hn(e){let t=null;if("string"!=typeof e&&an.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=ln(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&an.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==function(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>cn[e])).join("");for(;t.length>=un;){let e=t.substring(0,un);t=parseInt(e,10)%97+t.substring(e.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n="0"+n;return n}(e)&&an.throwArgumentError("bad icap checksum","address",e),n=e.substring(4),t=new ge(n,36).toString(16);t.length<40;)t="0"+t;t=ln("0x"+t)}else an.throwArgumentError("invalid address","address",e);var n;return t}function fn(e){let t=null;try{t=hn(e.from)}catch(t){an.throwArgumentError("missing from address","transaction",e)}return hn(ue(mt(nn([t,se(re(ve.from(e.nonce).toHexString()))])),12))}var pn=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const mn=new z(Pt),gn=new Uint8Array(32);gn.fill(0);const yn=ve.from(-1),An=ve.from(0),En=ve.from(1),bn=ve.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const vn=fe(En.toHexString(),32),wn=fe(An.toHexString(),32),On={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Dn=["name","version","chainId","verifyingContract","salt"];function Pn(e){return function(t){return"string"!=typeof t&&mn.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const _n={name:Pn("name"),version:Pn("version"),chainId:function(e){try{return ve.from(e).toString()}catch(e){}return mn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return hn(e).toLowerCase()}catch(e){}return mn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=re(e);if(32!==t.length)throw new Error("bad length");return le(t)}catch(e){}return mn.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function Tn(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],r=parseInt(t[2]||"256");(r%8!=0||r>256||t[2]&&t[2]!==String(r))&&mn.throwArgumentError("invalid numeric width","type",e);const i=bn.mask(n?r-1:r),s=n?i.add(En).mul(yn):An;return function(t){const n=ve.from(t);return(n.lt(s)||n.gt(i))&&mn.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),fe(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const n=parseInt(t[1]);return(0===n||n>32||t[1]!==String(n))&&mn.throwArgumentError("invalid bytes width","type",e),function(t){return re(t).length!==n&&mn.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=re(e),n=t.length%32;return n?de([t,gn.slice(n)]):le(t)}(t)}}}switch(e){case"address":return function(e){return fe(hn(e),32)};case"bool":return function(e){return e?vn:wn};case"bytes":return function(e){return mt(e)};case"string":return function(e){return Dt(e)}}return null}function In(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class Rn{constructor(e){Ve(this,"types",Object.freeze($e(e))),Ve(this,"_encoderCache",{}),Ve(this,"_types",{});const t={},n={},r={};Object.keys(e).forEach((e=>{t[e]={},n[e]=[],r[e]={}}));for(const r in e){const i={};e[r].forEach((s=>{i[s.name]&&mn.throwArgumentError(`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(r)}`,"types",e),i[s.name]=!0;const o=s.type.match(/^([^\x5b]*)(\x5b|$)/)[1];o===r&&mn.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e);Tn(o)||(n[o]||mn.throwArgumentError(`unknown type ${JSON.stringify(o)}`,"types",e),n[o].push(r),t[r][o]=!0)}))}const i=Object.keys(n).filter((e=>0===n[e].length));0===i.length?mn.throwArgumentError("missing primary type","types",e):i.length>1&&mn.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),Ve(this,"primaryType",i[0]),function i(s,o){o[s]&&mn.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e),o[s]=!0,Object.keys(t[s]).forEach((e=>{n[e]&&(i(e,o),Object.keys(o).forEach((t=>{r[t][e]=!0})))})),delete o[s]}(this.primaryType,{});for(const t in r){const n=Object.keys(r[t]);n.sort(),this._types[t]=In(t,e[t])+n.map((t=>In(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=Tn(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],n=this.getEncoder(e),r=parseInt(t[3]);return t=>{r>=0&&t.length!==r&&mn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(n);return this._types[e]&&(i=i.map(mt)),mt(de(i))}}const n=this.types[e];if(n){const t=Dt(this._types[e]);return e=>{const r=n.map((({name:t,type:n})=>{const r=this.getEncoder(n)(e[t]);return this._types[n]?mt(r):r}));return r.unshift(t),de(r)}}return mn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||mn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return mt(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,n){if(Tn(e))return n(e,t);const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const e=r[1],i=parseInt(r[3]);return i>=0&&t.length!==i&&mn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,n)))}const i=this.types[e];return i?i.reduce(((e,{name:r,type:i})=>(e[r]=this._visit(i,t[r],n),e)),{}):mn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Rn(e)}static getPrimaryType(e){return Rn.from(e).primaryType}static hashStruct(e,t,n){return Rn.from(t).hashStruct(e,n)}static hashDomain(e){const t=[];for(const n in e){const r=On[n];r||mn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:r})}return t.sort(((e,t)=>Dn.indexOf(e.name)-Dn.indexOf(t.name))),Rn.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return de(["0x1901",Rn.hashDomain(e),Rn.from(t).hash(n)])}static hash(e,t,n){return mt(Rn.encode(e,t,n))}static resolveNames(e,t,n,r){return pn(this,void 0,void 0,(function*(){e=Qe(e);const i={};e.verifyingContract&&!oe(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const s=Rn.from(t);s.visit(n,((e,t)=>("address"!==e||oe(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield r(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),n=s.visit(n,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:n}}))}static getPayload(e,t,n){Rn.hashDomain(e);const r={},i=[];Dn.forEach((t=>{const n=e[t];null!=n&&(r[t]=_n[t](n),i.push({name:t,type:On[t]}))}));const s=Rn.from(t),o=Qe(t);return o.EIP712Domain?mn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):o.EIP712Domain=i,s.encode(n),{types:o,domain:r,primaryType:s.primaryType,message:s.visit(n,((e,t)=>{if(e.match(/^bytes(\d*)/))return le(re(t));if(e.match(/^u?int/))return ve.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&mn.throwArgumentError("invalid string","value",t),t}return mn.throwArgumentError("unsupported type","type",e)}))}}}function Cn(e){return"0x"+D.sha256().update(re(e)).digest("hex")}var Bn=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};function kn(e,t){return Bn(this,void 0,void 0,(function*(){null==t&&(t={});const n={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(n.mode=e.mode),e.cache&&(n.cache=e.cache),e.credentials&&(n.credentials=e.credentials),e.redirect&&(n.redirect=e.redirect),e.referrer&&(n.referrer=e.referrer)}const r=yield fetch(e,n),i=yield r.arrayBuffer(),s={};return r.headers.forEach?r.headers.forEach(((e,t)=>{s[t.toLowerCase()]=e})):r.headers.keys().forEach((e=>{s[e.toLowerCase()]=r.headers.get(e)})),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:re(new Uint8Array(i))}}))}var Nn=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const xn=new z("web/5.7.1");function Sn(e){return new Promise((t=>{setTimeout(t,e)}))}function Ln(e,t){if(null==e)return null;if("string"==typeof e)return e;if(ee(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return Ot(e)}catch(e){}return le(e)}return e}function Fn(e,t,n){let r=null;if(null!=t){r=wt(t);const n="string"==typeof e?{url:e}:Qe(e);if(n.headers){0!==Object.keys(n.headers).filter((e=>"content-type"===e.toLowerCase())).length||(n.headers=Qe(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};e=n}return function(e,t,n){const r="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;xn.assertArgument(r>0&&r%1==0,"invalid connection throttle limit","connection.throttleLimit",r);const i="object"==typeof e?e.throttleCallback:null,s="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;xn.assertArgument(s>0&&s%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o="object"==typeof e&&!!e.errorPassThrough,a={};let l=null;const c={method:"GET"};let u=!1,d=12e4;if("string"==typeof e)l=e;else if("object"==typeof e){if(null!=e&&null!=e.url||xn.throwArgumentError("missing URL","connection.url",e),l=e.url,"number"==typeof e.timeout&&e.timeout>0&&(d=e.timeout),e.headers)for(const t in e.headers)a[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(u=!0);if(c.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==l.substring(0,6)&&!0!==e.allowInsecureAuthentication&&xn.throwError("basic authentication requires a secure https url",z.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;a.authorization={key:"Authorization",value:"Basic "+lt(wt(t))}}null!=e.skipFetchSetup&&(c.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(c.fetchOptions=Qe(e.fetchOptions))}const h=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=l?l.match(h):null;if(f)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?at(f[3]):(p=f[3],wt(p.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return n&&(t=n(e.body,e)),Promise.resolve(t)}catch(e){xn.throwError("processing response error",z.errors.SERVER_ERROR,{body:Ln(f[1],f[2]),error:e,requestBody:null,requestMethod:"GET",url:l})}var p;t&&(c.method="POST",c.body=t,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(t.length)}));const m={};Object.keys(a).forEach((e=>{const t=a[e];m[t.key]=t.value})),c.headers=m;const g=function(){let e=null;return{promise:new Promise((function(t,n){d&&(e=setTimeout((()=>{null!=e&&(e=null,n(xn.makeError("timeout",z.errors.TIMEOUT,{requestBody:Ln(c.body,m["content-type"]),requestMethod:c.method,timeout:d,url:l})))}),d))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),y=function(){return Nn(this,void 0,void 0,(function*(){for(let e=0;e<r;e++){let t=null;try{if(t=yield kn(l,c),e<r)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===c.method&&e.match(/^https:/)){l=t.headers.location;continue}}else if(429===t.statusCode){let n=!0;if(i&&(n=yield i(e,l)),n){let n=0;const r=t.headers["retry-after"];n="string"==typeof r&&r.match(/^[1-9][0-9]*$/)?1e3*parseInt(r):s*parseInt(String(Math.random()*Math.pow(2,e))),yield Sn(n);continue}}}catch(e){t=e.response,null==t&&(g.cancel(),xn.throwError("missing response",z.errors.SERVER_ERROR,{requestBody:Ln(c.body,m["content-type"]),requestMethod:c.method,serverError:e,url:l}))}let a=t.body;if(u&&304===t.statusCode?a=null:!o&&(t.statusCode<200||t.statusCode>=300)&&(g.cancel(),xn.throwError("bad response",z.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:Ln(a,t.headers?t.headers["content-type"]:null),requestBody:Ln(c.body,m["content-type"]),requestMethod:c.method,url:l})),n)try{const e=yield n(a,t);return g.cancel(),e}catch(n){if(n.throttleRetry&&e<r){let t=!0;if(i&&(t=yield i(e,l)),t){const t=s*parseInt(String(Math.random()*Math.pow(2,e)));yield Sn(t);continue}}g.cancel(),xn.throwError("processing response error",z.errors.SERVER_ERROR,{body:Ln(a,t.headers?t.headers["content-type"]:null),error:n,requestBody:Ln(c.body,m["content-type"]),requestMethod:c.method,url:l})}return g.cancel(),a}return xn.throwError("failed response",z.errors.SERVER_ERROR,{requestBody:Ln(c.body,m["content-type"]),requestMethod:c.method,url:l})}))}();return Promise.race([g.promise,y])}(e,r,((e,t)=>{let r=null;if(null!=e)try{r=JSON.parse(Ot(e))}catch(t){xn.throwError("invalid JSON",z.errors.SERVER_ERROR,{body:e,error:t})}return n&&(r=n(r,t)),r}))}function Mn(e,t){return t||(t={}),null==(t=Qe(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(n,r){let i=null,s=!1;const o=()=>!s&&(s=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{o()&&r(new Error("timeout"))}),t.timeout));const a=t.retryLimit;let l=0;!function i(){return e().then((function(e){if(void 0!==e)o()&&n(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!s){if(l++,l>a)return void(o()&&r(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,l)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){o()&&r(e)}))}()}))}const qn="providers/5.7.2";function Un(e,t,n){return n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},e(n,n.exports),n.exports}var Vn=Hn;function Hn(e,t){if(!e)throw new Error(t||"Assertion failed")}Hn.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var jn=Un((function(e,t){var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),s=i>>8,o=255&i;s?n.push(s,o):n.push(o)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}})),Qn=Un((function(e,t){var n=t;n.assert=Vn,n.toArray=jn.toArray,n.zero2=jn.zero2,n.toHex=jn.toHex,n.encode=jn.encode,n.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<<t+1,s=e.clone(),o=0;o<r.length;o++){var a,l=s.andln(i-1);s.isOdd()?(a=l>(i>>1)-1?(i>>1)-l:l,s.isubn(a)):a=0,r[o]=a,s.iushrn(1)}return r},n.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,s=0;e.cmpn(-i)>0||t.cmpn(-s)>0;){var o,a,l=e.andln(3)+i&3,c=t.andln(3)+s&3;3===l&&(l=-1),3===c&&(c=-1),o=1&l?3!==(r=e.andln(7)+i&7)&&5!==r||2!==c?l:-l:0,n[0].push(o),a=1&c?3!==(r=t.andln(7)+s&7)&&5!==r||2!==l?c:-c:0,n[1].push(a),2*i===o+1&&(i=1-i),2*s===a+1&&(s=1-s),e.iushrn(1),t.iushrn(1)}return n},n.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new O(e,"hex","le")}})),Yn=Qn.getNAF,Gn=Qn.getJSF,Xn=Qn.assert;function $n(e,t){this.type=e,this.p=new O(t.p,16),this.red=t.prime?O.red(t.prime):O.mont(this.p),this.zero=new O(0).toRed(this.red),this.one=new O(1).toRed(this.red),this.two=new O(2).toRed(this.red),this.n=t.n&&new O(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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 n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Kn=$n;function zn(e,t){this.curve=e,this.type=t,this.precomputed=null}$n.prototype.point=function(){throw new Error("Not implemented")},$n.prototype.validate=function(){throw new Error("Not implemented")},$n.prototype._fixedNafMul=function(e,t){Xn(e.precomputed);var n=e._getDoubles(),r=Yn(t,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var s,o,a=[];for(s=0;s<r.length;s+=n.step){o=0;for(var l=s+n.step-1;l>=s;l--)o=(o<<1)+r[l];a.push(o)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s<a.length;s++)(o=a[s])===d?u=u.mixedAdd(n.points[s]):o===-d&&(u=u.mixedAdd(n.points[s].neg()));c=c.add(u)}return c.toP()},$n.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,s=Yn(t,n,this._bitLength),o=this.jpoint(null,null,null),a=s.length-1;a>=0;a--){for(var l=0;a>=0&&0===s[a];a--)l++;if(a>=0&&l++,o=o.dblp(l),a<0)break;var c=s[a];Xn(0!==c),o="affine"===e.type?c>0?o.mixedAdd(i[c-1>>1]):o.mixedAdd(i[-c-1>>1].neg()):c>0?o.add(i[c-1>>1]):o.add(i[-c-1>>1].neg())}return"affine"===e.type?o.toP():o},$n.prototype._wnafMulAdd=function(e,t,n,r,i){var s,o,a,l=this._wnafT1,c=this._wnafT2,u=this._wnafT3,d=0;for(s=0;s<r;s++){var h=(a=t[s])._getNAFPoints(e);l[s]=h.wnd,c[s]=h.points}for(s=r-1;s>=1;s-=2){var f=s-1,p=s;if(1===l[f]&&1===l[p]){var m=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(m[1]=t[f].add(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].add(t[p].neg())):(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=Gn(n[f],n[p]);for(d=Math.max(y[0].length,d),u[f]=new Array(d),u[p]=new Array(d),o=0;o<d;o++){var A=0|y[0][o],E=0|y[1][o];u[f][o]=g[3*(A+1)+(E+1)],u[p][o]=0,c[f]=m}}else u[f]=Yn(n[f],l[f],this._bitLength),u[p]=Yn(n[p],l[p],this._bitLength),d=Math.max(u[f].length,d),d=Math.max(u[p].length,d)}var b=this.jpoint(null,null,null),v=this._wnafT4;for(s=d;s>=0;s--){for(var w=0;s>=0;){var O=!0;for(o=0;o<r;o++)v[o]=0|u[o][s],0!==v[o]&&(O=!1);if(!O)break;w++,s--}if(s>=0&&w++,b=b.dblp(w),s<0)break;for(o=0;o<r;o++){var D=v[o];0!==D&&(D>0?a=c[o][D-1>>1]:D<0&&(a=c[o][-D-1>>1].neg()),b="affine"===a.type?b.mixedAdd(a):b.add(a))}}for(s=0;s<r;s++)c[s]=null;return i?b:b.toP()},$n.BasePoint=zn,zn.prototype.eq=function(){throw new Error("Not implemented")},zn.prototype.validate=function(){return this.curve.validate(this)},$n.prototype.decodePoint=function(e,t){e=Qn.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?Xn(e[e.length-1]%2==0):7===e[0]&&Xn(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},zn.prototype.encodeCompressed=function(e){return this.encode(e,!0)},zn.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},zn.prototype.encode=function(e,t){return Qn.encode(this._encode(t),e)},zn.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},zn.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},zn.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var s=0;s<e;s++)r=r.dbl();n.push(r)}return{step:e,points:n}},zn.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},zn.prototype._getBeta=function(){return null},zn.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t};var Jn=Un((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),Wn=Qn.assert;function Zn(e){Kn.call(this,"short",e),this.a=new O(e.a,16).toRed(this.red),this.b=new O(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)}Jn(Zn,Kn);var er=Zn;function tr(e,t,n,r){Kn.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new O(t,16),this.y=new O(n,16),r&&(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 nr(e,t,n,r){Kn.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new O(0)):(this.x=new O(t,16),this.y=new O(n,16),this.z=new O(r,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}Zn.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new O(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new O(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],Wn(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new O(e.a,16),b:new O(e.b,16)}})):this._getEndoBasis(n)}}},Zn.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:O.mont(e),n=new O(2).toRed(t).redInvm(),r=n.redNeg(),i=new O(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},Zn.prototype._getEndoBasis=function(e){for(var t,n,r,i,s,o,a,l,c,u=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),f=new O(1),p=new O(0),m=new O(0),g=new O(1),y=0;0!==d.cmpn(0);){var A=h.div(d);l=h.sub(A.mul(d)),c=m.sub(A.mul(f));var E=g.sub(A.mul(p));if(!r&&l.cmp(u)<0)t=a.neg(),n=f,r=l.neg(),i=c;else if(r&&2==++y)break;a=l,h=d,d=l,m=f,f=c,g=p,p=E}s=l.neg(),o=c;var b=r.sqr().add(i.sqr());return s.sqr().add(o.sqr()).cmp(b)>=0&&(s=t,o=n),r.negative&&(r=r.neg(),i=i.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:r,b:i},{a:s,b:o}]},Zn.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),o=i.mul(n.a),a=s.mul(r.a),l=i.mul(n.b),c=s.mul(r.b);return{k1:e.sub(o).sub(a),k2:l.add(c).neg()}},Zn.prototype.pointFromX=function(e,t){(e=new O(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},Zn.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Zn.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],l=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),l=l.neg(!0)),r[2*s]=a,r[2*s+1]=l,i[2*s]=o.k1,i[2*s+1]=o.k2}for(var c=this._wnafMulAdd(1,r,i,2*s,n),u=0;u<2*s;u++)r[u]=null,i[u]=null;return c},Jn(tr,Kn.BasePoint),Zn.prototype.point=function(e,t,n){return new tr(this,e,t,n)},Zn.prototype.pointFromJSON=function(e,t){return tr.fromJSON(this,e,t)},tr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},tr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},tr.fromJSON=function(e,t,n){"string"==typeof t&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var s=t[2];return r.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[r].concat(s.doubles.points.map(i))},naf:s.naf&&{wnd:s.naf.wnd,points:[r].concat(s.naf.points.map(i))}},r},tr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},tr.prototype.isInfinity=function(){return this.inf},tr.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 t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},tr.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 t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},tr.prototype.getX=function(){return this.x.fromRed()},tr.prototype.getY=function(){return this.y.fromRed()},tr.prototype.mul=function(e){return e=new O(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)},tr.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},tr.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},tr.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))},tr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},tr.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Jn(nr,Kn.BasePoint),Zn.prototype.jpoint=function(e,t,n){return new nr(this,e,t,n)},nr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},nr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},nr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(n.redMul(this.z)),a=r.redSub(i),l=s.redSub(o);if(0===a.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),d=r.redMul(c),h=l.redSqr().redIAdd(u).redISub(d).redISub(d),f=l.redMul(d.redISub(h)).redISub(s.redMul(u)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,f,p)},nr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,s=e.y.redMul(t).redMul(this.z),o=n.redSub(r),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=o.redSqr(),c=l.redMul(o),u=n.redMul(l),d=a.redSqr().redIAdd(c).redISub(u).redISub(u),h=a.redMul(u.redISub(d)).redISub(i.redMul(c)),f=this.z.redMul(o);return this.curve.jpoint(d,h,f)},nr.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,s=this.x,o=this.y,a=this.z,l=a.redSqr().redSqr(),c=o.redAdd(o);for(t=0;t<e;t++){var u=s.redSqr(),d=c.redSqr(),h=d.redSqr(),f=u.redAdd(u).redIAdd(u).redIAdd(r.redMul(l)),p=s.redMul(d),m=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=f.redMul(g);y=y.redIAdd(y).redISub(h);var A=c.redMul(a);t+1<e&&(l=l.redMul(h)),s=m,a=A,c=y}return this.curve.jpoint(s,c.redMul(i),a)},nr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},nr.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(s);o=o.redIAdd(o);var a=r.redAdd(r).redIAdd(r),l=a.redSqr().redISub(o).redISub(o),c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),e=l,t=a.redMul(o.redISub(l)).redISub(c),n=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),f=this.x.redAdd(d).redSqr().redISub(u).redISub(h);f=f.redIAdd(f);var p=u.redAdd(u).redIAdd(u),m=p.redSqr(),g=h.redIAdd(h);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},nr.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(s);o=o.redIAdd(o);var a=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),l=a.redSqr().redISub(o).redISub(o);e=l;var c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(o.redISub(l)).redISub(c),n=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),f=this.x.redSub(u).redMul(this.x.redAdd(u));f=f.redAdd(f).redIAdd(f);var p=h.redIAdd(h),m=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(u);var g=d.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=f.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},nr.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),s=t.redSqr(),o=n.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(i)),l=t.redAdd(t),c=(l=l.redIAdd(l)).redMul(o),u=a.redSqr().redISub(c.redAdd(c)),d=c.redISub(u),h=o.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=a.redMul(d).redISub(h),p=n.redAdd(n).redMul(r);return this.curve.jpoint(u,f,p)},nr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),s=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(r),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),l=r.redIAdd(r);l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var c=i.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(l),u=t.redMul(c);u=(u=u.redIAdd(u)).redIAdd(u);var d=this.x.redMul(a).redISub(u);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(c.redMul(l.redISub(c)).redISub(o.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=this.z.redAdd(o).redSqr().redISub(n).redISub(a);return this.curve.jpoint(d,h,f)},nr.prototype.mul=function(e,t){return e=new O(e,t),this.curve._wnafMul(this,e)},nr.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},nr.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},nr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},nr.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var rr=Un((function(e,t){var n=t;n.base=Kn,n.short=er,n.mont=null,n.edwards=null})),ir=Un((function(e,t){var n,r=t,i=Qn.assert;function s(e){"short"===e.type?this.curve=new rr.short(e):"edwards"===e.type?this.curve=new rr.edwards(e):this.curve=new rr.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 o(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new s(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=s,o("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"]}),o("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"]}),o("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"]}),o("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"]}),o("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"]}),o("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"]}),o("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{n=null.crash()}catch(e){n=void 0}o("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",n]})}));function sr(e){if(!(this instanceof sr))return new sr(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 t=jn.toArray(e.entropy,e.entropyEnc||"hex"),n=jn.toArray(e.nonce,e.nonceEnc||"hex"),r=jn.toArray(e.pers,e.persEnc||"hex");Vn(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var or=sr;sr.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},sr.prototype._hmac=function(){return new D.hmac(this.hash,this.K)},sr.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},sr.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=jn.toArray(e,t),n=jn.toArray(n,r),Vn(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},sr.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=jn.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,e);return this._update(n),this._reseed++,jn.encode(s,t)};var ar=Qn.assert;function lr(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var cr=lr;lr.fromPublic=function(e,t,n){return t instanceof lr?t:new lr(e,{pub:t,pubEnc:n})},lr.fromPrivate=function(e,t,n){return t instanceof lr?t:new lr(e,{priv:t,privEnc:n})},lr.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"}},lr.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},lr.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},lr.prototype._importPrivate=function(e,t){this.priv=new O(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},lr.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?ar(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||ar(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,t)},lr.prototype.derive=function(e){return e.validate()||ar(e.validate(),"public point not validated"),e.mul(this.priv).getX()},lr.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},lr.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},lr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var ur=Qn.assert;function dr(e,t){if(e instanceof dr)return e;this._importDER(e,t)||(ur(e.r&&e.s,"Signature without r or s"),this.r=new O(e.r,16),this.s=new O(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var hr=dr;function fr(){this.place=0}function pr(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,s=0,o=t.place;s<r;s++,o++)i<<=8,i|=e[o],i>>>=0;return!(i<=127)&&(t.place=o,i)}function mr(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function gr(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}dr.prototype._importDER=function(e,t){e=Qn.toArray(e,t);var n=new fr;if(48!==e[n.place++])return!1;var r=pr(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=pr(e,n);if(!1===i)return!1;var s=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var o=pr(e,n);if(!1===o)return!1;if(e.length!==o+n.place)return!1;var a=e.slice(n.place,o+n.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new O(s),this.s=new O(a),this.recoveryParam=null,!0},dr.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=mr(t),n=mr(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];gr(r,t.length),(r=r.concat(t)).push(2),gr(r,n.length);var i=r.concat(n),s=[48];return gr(s,i.length),s=s.concat(i),Qn.encode(s,e)};var yr=function(){throw new Error("unsupported")},Ar=Qn.assert;function Er(e){if(!(this instanceof Er))return new Er(e);"string"==typeof e&&(Ar(Object.prototype.hasOwnProperty.call(ir,e),"Unknown curve "+e),e=ir[e]),e instanceof ir.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}var br=Er;Er.prototype.keyPair=function(e){return new cr(this,e)},Er.prototype.keyFromPrivate=function(e,t){return cr.fromPrivate(this,e,t)},Er.prototype.keyFromPublic=function(e,t){return cr.fromPublic(this,e,t)},Er.prototype.genKeyPair=function(e){e||(e={});for(var t=new or({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||yr(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new O(2));;){var i=new O(t.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Er.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Er.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new O(e,16));for(var i=this.n.byteLength(),s=t.getPrivate().toArray("be",i),o=e.toArray("be",i),a=new or({hash:this.hash,entropy:s,nonce:o,pers:r.pers,persEnc:r.persEnc||"utf8"}),l=this.n.sub(new O(1)),c=0;;c++){var u=r.k?r.k(c):new O(a.generate(this.n.byteLength()));if(!((u=this._truncateToN(u,!0)).cmpn(1)<=0||u.cmp(l)>=0)){var d=this.g.mul(u);if(!d.isInfinity()){var h=d.getX(),f=h.umod(this.n);if(0!==f.cmpn(0)){var p=u.invm(this.n).mul(f.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==h.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new hr({r:f,s:p,recoveryParam:m})}}}}}},Er.prototype.verify=function(e,t,n,r){e=this._truncateToN(new O(e,16)),n=this.keyFromPublic(n,r);var i=(t=new hr(t,"hex")).r,s=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o,a=s.invm(this.n),l=a.mul(e).umod(this.n),c=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(o=this.g.jmulAdd(l,n.getPublic(),c)).isInfinity()&&o.eqXToP(i):!(o=this.g.mulAdd(l,n.getPublic(),c)).isInfinity()&&0===o.getX().umod(this.n).cmp(i)},Er.prototype.recoverPubKey=function(e,t,n,r){Ar((3&n)===n,"The recovery param is more than two bits"),t=new hr(t,r);var i=this.n,s=new O(e),o=t.r,a=t.s,l=1&n,c=n>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");o=c?this.curve.pointFromX(o.add(this.curve.n),l):this.curve.pointFromX(o,l);var u=t.r.invm(i),d=i.sub(s).mul(u).umod(i),h=a.mul(u).umod(i);return this.g.mulAdd(d,o,h)},Er.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new hr(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,t,i)}catch(e){continue}if(s.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var vr=Un((function(e,t){var n=t;n.version="6.5.4",n.utils=Qn,n.rand=function(){throw new Error("unsupported")},n.curve=rr,n.curves=ir,n.ec=br,n.eddsa=null})).ec;const wr=new z("signing-key/5.7.0");let Or=null;function Dr(){return Or||(Or=new vr("secp256k1")),Or}class Pr{constructor(e){Ve(this,"curve","secp256k1"),Ve(this,"privateKey",le(e)),32!==ce(this.privateKey)&&wr.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Dr().keyFromPrivate(re(this.privateKey));Ve(this,"publicKey","0x"+t.getPublic(!1,"hex")),Ve(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Ve(this,"_isSigningKey",!0)}_addPoint(e){const t=Dr().keyFromPublic(re(this.publicKey)),n=Dr().keyFromPublic(re(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const t=Dr().keyFromPrivate(re(this.privateKey)),n=re(e);32!==n.length&&wr.throwArgumentError("bad digest length","digest",e);const r=t.sign(n,{canonical:!0});return pe({recoveryParam:r.recoveryParam,r:fe("0x"+r.r.toString(16),32),s:fe("0x"+r.s.toString(16),32)})}computeSharedSecret(e){const t=Dr().keyFromPrivate(re(this.privateKey)),n=Dr().keyFromPublic(re(_r(e)));return fe("0x"+t.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function _r(e,t){const n=re(e);if(32===n.length){return new Pr(n).publicKey}return 33===n.length?"0x"+Dr().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?le(n):wr.throwArgumentError("invalid public or private key","key","[REDACTED]")}const Tr=new z("transactions/5.7.0");var Ir;function Rr(e){return"0x"===e?null:hn(e)}function Cr(e){return"0x"===e?ht:ve.from(e)}function Br(e,t){return function(e){return hn(ue(mt(ue(_r(e),1)),12))}(function(e,t){const n=pe(t),r={r:re(n.r),s:re(n.s)};return"0x"+Dr().recoverPubKey(re(e),r,n.recoveryParam).encode("hex",!1)}(re(e),t))}function kr(e,t){const n=se(ve.from(e).toHexString());return n.length>32&&Tr.throwArgumentError("invalid length for "+t,"transaction:"+t,e),n}function Nr(e,t){return{address:hn(e),storageKeys:(t||[]).map(((t,n)=>(32!==ce(t)&&Tr.throwArgumentError("invalid access list storageKey",`accessList[${e}:${n}]`,t),t.toLowerCase())))}}function xr(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&Tr.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),Nr(e[0],e[1])):Nr(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const n=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return Nr(t,Object.keys(n).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function Sr(e){return xr(e).map((e=>[e.address,e.storageKeys]))}function Lr(e,t){if(null!=e.gasPrice){const t=ve.from(e.gasPrice),n=ve.from(e.maxFeePerGas||0);t.eq(n)||Tr.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:n})}const n=[kr(e.chainId||0,"chainId"),kr(e.nonce||0,"nonce"),kr(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),kr(e.maxFeePerGas||0,"maxFeePerGas"),kr(e.gasLimit||0,"gasLimit"),null!=e.to?hn(e.to):"0x",kr(e.value||0,"value"),e.data||"0x",Sr(e.accessList||[])];if(t){const e=pe(t);n.push(kr(e.recoveryParam,"recoveryParam")),n.push(se(e.r)),n.push(se(e.s))}return de(["0x02",nn(n)])}function Fr(e,t){const n=[kr(e.chainId||0,"chainId"),kr(e.nonce||0,"nonce"),kr(e.gasPrice||0,"gasPrice"),kr(e.gasLimit||0,"gasLimit"),null!=e.to?hn(e.to):"0x",kr(e.value||0,"value"),e.data||"0x",Sr(e.accessList||[])];if(t){const e=pe(t);n.push(kr(e.recoveryParam,"recoveryParam")),n.push(se(e.r)),n.push(se(e.s))}return de(["0x01",nn(n)])}function Mr(e,t,n){try{const n=Cr(t[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");e.v=n}catch(e){Tr.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=fe(t[1],32),e.s=fe(t[2],32);try{const t=mt(n(e));e.from=Br(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function qr(e){const t=re(e);if(t[0]>127)return function(e){const t=on(e);9!==t.length&&6!==t.length&&Tr.throwArgumentError("invalid raw transaction","rawTransaction",e);const n={nonce:Cr(t[0]).toNumber(),gasPrice:Cr(t[1]),gasLimit:Cr(t[2]),to:Rr(t[3]),value:Cr(t[4]),data:t[5],chainId:0};if(6===t.length)return n;try{n.v=ve.from(t[6]).toNumber()}catch(e){return n}if(n.r=fe(t[7],32),n.s=fe(t[8],32),ve.from(n.r).isZero()&&ve.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let r=n.v-27;const i=t.slice(0,6);0!==n.chainId&&(i.push(le(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);const s=mt(nn(i));try{n.from=Br(s,{r:le(n.r),s:le(n.s),recoveryParam:r})}catch(e){}n.hash=mt(e)}return n.type=null,n}(t);switch(t[0]){case 1:return function(e){const t=on(e.slice(1));8!==t.length&&11!==t.length&&Tr.throwArgumentError("invalid component count for transaction type: 1","payload",le(e));const n={type:1,chainId:Cr(t[0]).toNumber(),nonce:Cr(t[1]).toNumber(),gasPrice:Cr(t[2]),gasLimit:Cr(t[3]),to:Rr(t[4]),value:Cr(t[5]),data:t[6],accessList:xr(t[7])};return 8===t.length||(n.hash=mt(e),Mr(n,t.slice(8),Fr)),n}(t);case 2:return function(e){const t=on(e.slice(1));9!==t.length&&12!==t.length&&Tr.throwArgumentError("invalid component count for transaction type: 2","payload",le(e));const n=Cr(t[2]),r=Cr(t[3]),i={type:2,chainId:Cr(t[0]).toNumber(),nonce:Cr(t[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:Cr(t[4]),to:Rr(t[5]),value:Cr(t[6]),data:t[7],accessList:xr(t[8])};return 9===t.length||(i.hash=mt(e),Mr(i,t.slice(9),Lr)),i}(t)}return Tr.throwError(`unsupported transaction type: ${t[0]}`,z.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(Ir||(Ir={}));const Ur=new z(qn);class Vr{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),n=this.bigNumber.bind(this),r=this.blockTag.bind(this),i=this.data.bind(this),s=this.hash.bind(this),o=this.hex.bind(this),a=this.number.bind(this),l=this.type.bind(this);return e.transaction={hash:s,type:l,accessList:Vr.allowNull(this.accessList.bind(this),null),blockHash:Vr.allowNull(s,null),blockNumber:Vr.allowNull(a,null),transactionIndex:Vr.allowNull(a,null),confirmations:Vr.allowNull(a,null),from:t,gasPrice:Vr.allowNull(n),maxPriorityFeePerGas:Vr.allowNull(n),maxFeePerGas:Vr.allowNull(n),gasLimit:n,to:Vr.allowNull(t,null),value:n,nonce:a,data:i,r:Vr.allowNull(this.uint256),s:Vr.allowNull(this.uint256),v:Vr.allowNull(a),creates:Vr.allowNull(t,null),raw:Vr.allowNull(i)},e.transactionRequest={from:Vr.allowNull(t),nonce:Vr.allowNull(a),gasLimit:Vr.allowNull(n),gasPrice:Vr.allowNull(n),maxPriorityFeePerGas:Vr.allowNull(n),maxFeePerGas:Vr.allowNull(n),to:Vr.allowNull(t),value:Vr.allowNull(n),data:Vr.allowNull((e=>this.data(e,!0))),type:Vr.allowNull(a),accessList:Vr.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:t,topics:Vr.arrayOf(s),data:i,logIndex:a,blockHash:s},e.receipt={to:Vr.allowNull(this.address,null),from:Vr.allowNull(this.address,null),contractAddress:Vr.allowNull(t,null),transactionIndex:a,root:Vr.allowNull(o),gasUsed:n,logsBloom:Vr.allowNull(i),blockHash:s,transactionHash:s,logs:Vr.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Vr.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:Vr.allowNull(n),status:Vr.allowNull(a),type:l},e.block={hash:Vr.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:Vr.allowNull(o),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:Vr.allowNull(t),extraData:i,transactions:Vr.allowNull(Vr.arrayOf(s)),baseFeePerGas:Vr.allowNull(n)},e.blockWithTransactions=Qe(e.block),e.blockWithTransactions.transactions=Vr.allowNull(Vr.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Vr.allowNull(r,void 0),toBlock:Vr.allowNull(r,void 0),blockHash:Vr.allowNull(s,void 0),address:Vr.allowNull(t,void 0),topics:Vr.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Vr.allowNull(a),blockHash:Vr.allowNull(s),transactionIndex:a,removed:Vr.allowNull(this.boolean.bind(this)),address:t,data:Vr.allowFalsish(i,"0x"),topics:Vr.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return xr(e||[])}number(e){return"0x"===e?0:ve.from(e).toNumber()}type(e){return"0x"===e||null==e?0:ve.from(e).toNumber()}bigNumber(e){return ve.from(e)}boolean(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),oe(e))?e.toLowerCase():Ur.throwArgumentError("invalid hash","value",e)}data(e,t){const n=this.hex(e,t);if(n.length%2!=0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return hn(e)}callAddress(e){if(!oe(e,32))return null;const t=hn(ue(e,12));return"0x0000000000000000000000000000000000000000"===t?null:t}contractAddress(e){return fn(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"==typeof e||oe(e))return he(e);throw new Error("invalid blockTag")}hash(e,t){const n=this.hex(e,t);return 32!==ce(n)?Ur.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(null==e)return null;const t=ve.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!oe(e))throw new Error("invalid uint256");return fe(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const n=null!=e._difficulty?e._difficulty:e.difficulty,r=Vr.check(t,e);return r._difficulty=null==n?null:ve.from(n),r}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Vr.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&ve.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=Vr.check(this.formats.transaction,e);if(null!=e.chainId){let n=e.chainId;oe(n)&&(n=ve.from(n).toNumber()),t.chainId=n}else{let n=e.networkId;null==n&&null==t.v&&(n=e.chainId),oe(n)&&(n=ve.from(n).toNumber()),"number"!=typeof n&&null!=t.v&&(n=(t.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!=typeof n&&(n=0),t.chainId=n}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return qr(e)}receiptLog(e){return Vr.check(this.formats.receiptLog,e)}receipt(e){const t=Vr.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=ve.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&Ur.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):Ur.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&Ur.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map((e=>this.topics(e))):null!=e?this.hash(e,!0):null}filter(e){return Vr.check(this.formats.filter,e)}filterLog(e){return Vr.check(this.formats.filterLog,e)}static check(e,t){const n={};for(const r in e)try{const i=e[r](t[r]);void 0!==i&&(n[r]=i)}catch(e){throw e.checkKey=r,e.checkValue=t[r],e}return n}static allowNull(e,t){return function(n){return null==n?t:e(n)}}static allowFalsish(e,t){return function(n){return n?e(n):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const n=[];return t.forEach((function(t){n.push(e(t))})),n}}}var Hr=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const jr=new z(qn);function Qr(e){return null==e?"null":(32!==ce(e)&&jr.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function Yr(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((e=>{if(Array.isArray(e)){const t={};e.forEach((e=>{t[Qr(e)]=!0}));const n=Object.keys(t);return n.sort(),n.join("|")}return Qr(e)})).join("&")}function Gr(e){if("string"==typeof e){if(32===ce(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+Yr(e);if(We.isForkEvent(e))throw jr.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+Yr(e.topics||[])}throw new Error("invalid event - "+e)}function Xr(){return(new Date).getTime()}function $r(e){return new Promise((t=>{setTimeout(t,e)}))}const Kr=["block","network","pending","poll"];class zr{constructor(e,t,n){Ve(this,"tag",e),Ve(this,"listener",t),Ve(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],n=""===(r=e[2])?[]:r.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}));var r;const i={};return n.length>0&&(i.topics=n),t&&"*"!==t&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||Kr.indexOf(this.tag)>=0}}const Jr={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Wr(e){return fe(ve.from(e).toHexString(),32)}function Zr(e){return ut.encode(ie([e,ue(Cn(Cn(e)),0,4)]))}const ei=new RegExp("^(ipfs)://(.*)$","i"),ti=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),ei,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function ni(e,t){try{return Ot(ri(e,t))}catch(e){}return null}function ri(e,t){if("0x"===e)return null;const n=ve.from(ue(e,t,t+32)).toNumber(),r=ve.from(ue(e,n,n+32)).toNumber();return ue(e,n+32,n+32+r)}function ii(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):jr.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function si(e){const t=re(e);if(t.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(t,32-t.length),n}function oi(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function ai(e){const t=[];let n=0;for(let r=0;r<e.length;r++)t.push(null),n+=32;for(let r=0;r<e.length;r++){const i=re(e[r]);t[r]=si(n),t.push(si(i.length)),t.push(oi(i)),n+=32+32*Math.ceil(i.length/32)}return de(t)}class li{constructor(e,t,n,r){Ve(this,"provider",e),Ve(this,"name",n),Ve(this,"address",e.formatter.address(t)),Ve(this,"_resolvedAddress",r)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then((e=>ve.from(e).eq(1))).catch((e=>{if(e.code===z.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return Hr(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:de([e,Jt(this.name),t||"0x"])};let r=!1;var i;(yield this.supportsWildcard())&&(r=!0,n.data=de(["0x9061b923",ai([(i=this.name,le(ie(zt(i).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"),n.data])]));try{let e=yield this.provider.call(n);return re(e).length%32==4&&jr.throwError("resolver threw error",z.errors.CALL_EXCEPTION,{transaction:n,data:e}),r&&(e=ri(e,0)),e}catch(e){if(e.code===z.errors.CALL_EXCEPTION)return null;throw e}}))}_fetchBytes(e,t){return Hr(this,void 0,void 0,(function*(){const n=yield this._fetch(e,t);return null!=n?ri(n,0):null}))}_getAddress(e,t){const n=Jr[String(e)];if(null==n&&jr.throwError(`unsupported coin type: ${e}`,z.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===n.ilk)return this.provider.formatter.address(t);const r=re(t);if(null!=n.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return Zr(ie([[n.p2pkh],"0x"+e[2]]))}}if(null!=n.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return Zr(ie([[n.p2sh],"0x"+e[2]]))}}if(null!=n.prefix){const e=r[1];let t=r[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&r.length===2+e&&e>=1&&e<=75){const e=P.toWords(r.slice(2));return e.unshift(t),P.encode(n.prefix,e)}}return null}getAddress(e){return Hr(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===z.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",Wr(e));if(null==t||"0x"===t)return null;const n=this._getAddress(e,t);return null==n&&jr.throwError("invalid or unsupported coin data",z.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),n}))}getAvatar(){return Hr(this,void 0,void 0,(function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let n=0;n<ti.length;n++){const r=t.match(ti[n]);if(null==r)continue;const i=r[1].toLowerCase();switch(i){case"https":return e.push({type:"url",content:t}),{linkage:e,url:t};case"data":return e.push({type:"data",content:t}),{linkage:e,url:t};case"ipfs":return e.push({type:"ipfs",content:t}),{linkage:e,url:ii(t)};case"erc721":case"erc1155":{const n="erc721"===i?"0xc87b56dd":"0x0e89341c";e.push({type:i,content:t});const s=this._resolvedAddress||(yield this.getAddress()),o=(r[2]||"").split("/");if(2!==o.length)return null;const a=yield this.provider.formatter.address(o[0]),l=fe(ve.from(o[1]).toHexString(),32);if("erc721"===i){const t=this.provider.formatter.callAddress(yield this.provider.call({to:a,data:de(["0x6352211e",l])}));if(s!==t)return null;e.push({type:"owner",content:t})}else if("erc1155"===i){const t=ve.from(yield this.provider.call({to:a,data:de(["0x00fdd58e",fe(s,32),l])}));if(t.isZero())return null;e.push({type:"balance",content:t.toString()})}const c={to:this.provider.formatter.address(o[0]),data:de([n,l])};let u=ni(yield this.provider.call(c),0);if(null==u)return null;e.push({type:"metadata-url-base",content:u}),"erc1155"===i&&(u=u.replace("{id}",l.substring(2)),e.push({type:"metadata-url-expanded",content:u})),u.match(/^ipfs:/i)&&(u=ii(u)),e.push({type:"metadata-url",content:u});const d=yield Fn(u);if(!d)return null;e.push({type:"metadata",content:JSON.stringify(d)});let h=d.image;if("string"!=typeof h)return null;if(h.match(/^(https:\/\/|data:)/i));else{if(null==h.match(ei))return null;e.push({type:"url-ipfs",content:h}),h=ii(h)}return e.push({type:"url",content:h}),{linkage:e,url:h}}}}}catch(e){}return null}))}getContentHash(){return Hr(this,void 0,void 0,(function*(){const e=yield this._fetchBytes("0xbc1c58d1");if(null==e||"0x"===e)return null;const t=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const e=parseInt(t[3],16);if(t[4].length===2*e)return"ipfs://"+ut.encode("0x"+t[1])}const n=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const e=parseInt(n[3],16);if(n[4].length===2*e)return"ipns://"+ut.encode("0x"+n[1])}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&64===r[1].length)return"bzz://"+r[1];const i=e.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const e={"=":"","+":"-","/":"_"};return"sia://"+lt("0x"+i[1]).replace(/[=+\/]/g,(t=>e[t]))}return jr.throwError("invalid or unsupported content hash data",z.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return Hr(this,void 0,void 0,(function*(){let t=wt(e);t=ie([Wr(64),Wr(t.length),t]),t.length%32!=0&&(t=ie([t,fe("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",le(t));return null==n||"0x"===n?null:Ot(n)}))}}let ci=null,ui=1;class di extends Ze{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Ve(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch((e=>{})),this._ready().catch((e=>{}));else{const t=He(new.target,"getNetwork")(e);t?(Ve(this,"_network",t),this.emit("network",t,null)):jr.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Hr(this,void 0,void 0,(function*(){if(null==this._network){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch(e){}null==e&&(e=yield this.detectNetwork()),e||jr.throwError("no network detected",z.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:Ve(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return Mn((()=>this._ready().then((e=>e),(e=>{if(e.code!==z.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==ci&&(ci=new Vr),ci}static getNetwork(e){return function(e){if(null==e)return null;if("number"==typeof e){for(const t in ot){const n=ot[t];if(n.chainId===e)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=ot[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=ot[e.name];if(!t)return"number"!=typeof e.chainId&&et.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&et.throwArgumentError("network chainId mismatch","network",e);let n=e._defaultProvider||null;var r;return null==n&&t._defaultProvider&&(n=(r=t._defaultProvider)&&"function"==typeof r.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:n}}(null==e?"homestead":e)}ccipReadFetch(e,t,n){return Hr(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=e.to.toLowerCase(),i=t.toLowerCase(),s=[];for(let e=0;e<n.length;e++){const t=n[e],o=t.replace("{sender}",r).replace("{data}",i),a=t.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:r}),l=yield Fn({url:o,errorPassThrough:!0},a,((e,t)=>(e.status=t.statusCode,e)));if(l.data)return l.data;const c=l.message||"unknown error";if(l.status>=400&&l.status<500)return jr.throwError(`response not found during CCIP fetch: ${c}`,z.errors.SERVER_ERROR,{url:t,errorMessage:c});s.push(c)}return jr.throwError(`error encountered during CCIP fetch: ${s.map((e=>JSON.stringify(e))).join(", ")}`,z.errors.SERVER_ERROR,{urls:n,errorMessages:s})}))}_getInternalBlockNumber(e){return Hr(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const n=yield t;if(Xr()-n.respTime<=e)return n.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=Xr(),n=je({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=Xr();return(e=ve.from(e).toNumber())<this._maxInternalBlockNumber&&(e=this._maxInternalBlockNumber),this._maxInternalBlockNumber=e,this._setFastBlockNumber(e),{blockNumber:e,reqTime:t,respTime:i}}));return this._internalBlockNumber=n,n.catch((e=>{this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return Hr(this,void 0,void 0,(function*(){const e=ui++,t=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)jr.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",jr.makeError("network block skew detected",z.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let e=this._emitted.block+1;e<=n;e++)this.emit("block",e);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&n-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((e=>{switch(e.type){case"tx":{const n=e.hash;let r=this.getTransactionReceipt(n).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+n]=e.blockNumber,this.emit(n,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(r);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=n-1);const r=e.filter;r.fromBlock=e._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const s=this.getLogs(r).then((t=>{e._inflight=!1,0!==t.length&&t.forEach((t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(r,t)}))})).catch((t=>{this.emit("error",t),e._inflight=!1}));t.push(s)}}})),this._lastBlockNumber=n,Promise.all(t).then((()=>{this.emit("didPoll",e)})).catch((e=>{this.emit("error",e)}))}else this.emit("didPoll",e)}))}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return Hr(this,void 0,void 0,(function*(){return jr.throwError("provider does not support network detection",z.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return Hr(this,void 0,void 0,(function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield $r(0),this._network;const n=jr.makeError("underlying network changed",z.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",n),n}return e}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((e=>{this._setFastBlockNumber(e)}),(e=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const e=Xr();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=Xr(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,n){return Hr(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,n||0,null)}))}_waitForTransaction(e,t,n,r){return Hr(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,s)=>{const o=[];let a=!1;const l=function(){return!!a||(a=!0,o.forEach((e=>{e()})),!1)},c=e=>{e.confirmations<t||l()||i(e)};if(this.on(e,c),o.push((()=>{this.removeListener(e,c)})),r){let n=r.startBlock,i=null;const c=o=>Hr(this,void 0,void 0,(function*(){a||(yield $r(1e3),this.getTransactionCount(r.from).then((u=>Hr(this,void 0,void 0,(function*(){if(!a){if(u<=r.nonce)n=o;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=n-3,i<r.startBlock&&(i=r.startBlock));i<=o;){if(a)return;const n=yield this.getBlockWithTransactions(i);for(let i=0;i<n.transactions.length;i++){const o=n.transactions[i];if(o.hash===e)return;if(o.from===r.from&&o.nonce===r.nonce){if(a)return;const n=yield this.waitForTransaction(o.hash,t);if(l())return;let i="replaced";return o.data===r.data&&o.to===r.to&&o.value.eq(r.value)?i="repriced":"0x"===o.data&&o.from===o.to&&o.value.isZero()&&(i="cancelled"),void s(jr.makeError("transaction was replaced",z.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(o),hash:e,receipt:n}))}}i++}}a||this.once("block",c)}}))),(e=>{a||this.once("block",c)})))}));if(a)return;this.once("block",c),o.push((()=>{this.removeListener("block",c)}))}if("number"==typeof n&&n>0){const e=setTimeout((()=>{l()||s(jr.makeError("timeout exceeded",z.errors.TIMEOUT,{timeout:n}))}),n);e.unref&&e.unref(),o.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return Hr(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return ve.from(e)}catch(t){return jr.throwError("bad result from backend",z.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield je({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getBalance",n);try{return ve.from(r)}catch(e){return jr.throwError("bad result from backend",z.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:e})}}))}getTransactionCount(e,t){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield je({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getTransactionCount",n);try{return ve.from(r).toNumber()}catch(e){return jr.throwError("bad result from backend",z.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:e})}}))}getCode(e,t){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield je({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getCode",n);try{return le(r)}catch(e){return jr.throwError("bad result from backend",z.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:e})}}))}getStorageAt(e,t,n){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield je({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(t).then((e=>he(e)))}),i=yield this.perform("getStorageAt",r);try{return le(i)}catch(e){return jr.throwError("bad result from backend",z.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:e})}}))}_wrapTransaction(e,t,n){if(null!=t&&32!==ce(t))throw new Error("invalid response - sendTransaction");const r=e;return null!=t&&e.hash!==t&&jr.throwError("Transaction hash mismatch from Provider.sendTransaction.",z.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),r.wait=(t,r)=>Hr(this,void 0,void 0,(function*(){let i;null==t&&(t=1),null==r&&(r=0),0!==t&&null!=n&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const s=yield this._waitForTransaction(e.hash,t,r,i);return null==s&&0===t?null:(this._emitted["t:"+e.hash]=s.blockNumber,0===s.status&&jr.throwError("transaction failed",z.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:s}),s)})),r}sendTransaction(e){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>le(e))),n=this.formatter.transaction(e);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(n,e,r)}catch(e){throw e.transaction=n,e.transactionHash=n.hash,e}}))}_getTransactionRequest(e){return Hr(this,void 0,void 0,(function*(){const t=yield e,n={};return["from","to"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?ve.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(n.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?le(e):null)))})),this.formatter.transactionRequest(yield je(n))}))}_getFilter(e){return Hr(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((n=>{null!=e[n]&&(t[n]=e[n])})),["fromBlock","toBlock"].forEach((n=>{null!=e[n]&&(t[n]=this._getBlockTag(e[n]))})),this.formatter.filter(yield je(t))}))}_call(e,t,n){return Hr(this,void 0,void 0,(function*(){n>=10&&jr.throwError("CCIP read exceeded maximum redirections",z.errors.SERVER_ERROR,{redirects:n,transaction:e});const r=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(n>=0&&"latest"===t&&null!=r&&"0x556f1830"===i.substring(0,10)&&ce(i)%32==4)try{const s=ue(i,4),o=ue(s,0,32);ve.from(o).eq(r)||jr.throwError("CCIP Read sender did not match",z.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const a=[],l=ve.from(ue(s,32,64)).toNumber(),c=ve.from(ue(s,l,l+32)).toNumber(),u=ue(s,l+32);for(let t=0;t<c;t++){const n=ni(u,32*t);null==n&&jr.throwError("CCIP Read contained corrupt URL string",z.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i}),a.push(n)}const d=ri(s,64);ve.from(ue(s,100,128)).isZero()||jr.throwError("CCIP Read callback selector included junk",z.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const h=ue(s,96,100),f=ri(s,128),p=yield this.ccipReadFetch(e,d,a);null==p&&jr.throwError("CCIP Read disabled or provided no URLs",z.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const m={to:r,data:de([h,ai([p,f])])};return this._call(m,t,n+1)}catch(e){if(e.code===z.errors.SERVER_ERROR)throw e}try{return le(i)}catch(n){return jr.throwError("bad result from backend",z.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:t},result:i,error:n})}}))}call(e,t){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield je({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(t),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(n.transaction,n.blockTag,n.ccipReadEnabled?0:-1)}))}estimateGas(e){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield je({transaction:this._getTransactionRequest(e)}),n=yield this.perform("estimateGas",t);try{return ve.from(n)}catch(e){return jr.throwError("bad result from backend",z.errors.SERVER_ERROR,{method:"estimateGas",params:t,result:n,error:e})}}))}_getAddress(e){return Hr(this,void 0,void 0,(function*(){"string"!=typeof(e=yield e)&&jr.throwArgumentError("invalid address or ENS name","name",e);const t=yield this.resolveName(e);return null==t&&jr.throwError("ENS name not configured",z.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),t}))}_getBlock(e,t){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;let n=-128;const r={includeTransactions:!!t};if(oe(e,32))r.blockHash=e;else try{r.blockTag=yield this._getBlockTag(e),oe(r.blockTag)&&(n=parseInt(r.blockTag.substring(2),16))}catch(t){jr.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return Mn((()=>Hr(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",r);if(null==e)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(t){let t=null;for(let n=0;n<e.transactions.length;n++){const r=e.transactions[n];if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){null==t&&(t=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let e=t-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}}const n=this.formatter.blockWithTransactions(e);return n.transactions=n.transactions.map((e=>this._wrapTransaction(e))),n}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Mn((()=>Hr(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(e){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Mn((()=>Hr(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return r}))),{oncePoll:this})}))}getLogs(e){return Hr(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield je({filter:this._getFilter(e)}),n=yield this.perform("getLogs",t);return n.forEach((e=>{null==e.removed&&(e.removed=!1)})),Vr.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return Hr(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return Hr(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&jr.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)}))}getResolver(e){return Hr(this,void 0,void 0,(function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const n=yield this._getResolver(t,"getResolver");if(null!=n){const r=new li(this,n,e);return t===e||(yield r.supportsWildcard())?r:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return Hr(this,void 0,void 0,(function*(){null==t&&(t="ENS");const n=yield this.getNetwork();n.ensAddress||jr.throwError("network does not support ENS",z.errors.UNSUPPORTED_OPERATION,{operation:t,network:n.name});try{const t=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+Jt(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null}))}resolveName(e){return Hr(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(oe(e))throw t}"string"!=typeof e&&jr.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return Hr(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(t,"lookupAddress");if(null==n)return null;const r=ni(yield this.call({to:n,data:"0x691f3431"+Jt(t).substring(2)}),0);return(yield this.resolveName(r))!=e?null:r}))}getAvatar(e){return Hr(this,void 0,void 0,(function*(){let t=null;if(oe(e)){const n=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(n,"getAvatar");if(!r)return null;t=new li(this,r,n);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==z.errors.CALL_EXCEPTION)throw e}try{const e=ni(yield this.call({to:r,data:"0x691f3431"+Jt(n).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==z.errors.CALL_EXCEPTION)throw e;return null}}else if(t=yield this.getResolver(e),!t)return null;const n=yield t.getAvatar();return null==n?null:n.url}))}perform(e,t){return jr.throwError(e+" not implemented",z.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_stopEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_addEventListener(e,t,n){const r=new zr(Gr(e),t,n);return this._events.push(r),this._startEvent(r),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let n=!1,r=[],i=Gr(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),n=!0,!e.once||(r.push(e),!1)))),r.forEach((e=>{this._stopEvent(e)})),n}listenerCount(e){if(!e)return this._events.length;let t=Gr(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=Gr(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const n=[];let r=!1,i=Gr(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!r||(r=!0,n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const n=Gr(e);this._events=this._events.filter((e=>e.tag!==n||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var hi=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const fi=new z("abstract-signer/5.7.0"),pi=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],mi=[z.errors.INSUFFICIENT_FUNDS,z.errors.NONCE_EXPIRED,z.errors.REPLACEMENT_UNDERPRICED];class gi{constructor(){fi.checkAbstract(new.target,gi),Ve(this,"_isSigner",!0)}getBalance(e){return hi(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return hi(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return hi(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield je(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return hi(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield je(this.checkTransaction(e));return yield this.provider.call(n,t)}))}sendTransaction(e){return hi(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),n=yield this.signTransaction(t);return yield this.provider.sendTransaction(n)}))}getChainId(){return hi(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return hi(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return hi(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return hi(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===pi.indexOf(t)&&fi.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=Qe(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&fi.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return hi(this,void 0,void 0,(function*(){const t=yield je(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>hi(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&fi.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const n=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!n?0!==t.type&&1!==t.type||!n||fi.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):fi.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.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?(n&&fi.throwError("network does not support EIP-1559",z.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):fi.throwError("failed to get consistent fee data",z.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(mi.indexOf(e.code)>=0)throw e;return fi.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",z.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&fi.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield je(t)}))}_checkProvider(e){this.provider||fi.throwError("missing provider",z.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class yi extends gi{constructor(e,t){super(),Ve(this,"address",e),Ve(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{fi.throwError(e,z.errors.UNSUPPORTED_OPERATION,{operation:t})}))}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new yi(this.address,e)}}var Ai=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Ei=new z(qn),bi=["call","estimateGas"];function vi(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const n=oe(e.data)?e.data:null;if(!t||n)return{message:e.message,data:n}}if("object"==typeof e){for(const n in e){const r=vi(e[n],t);if(r)return r}return null}if("string"==typeof e)try{return vi(JSON.parse(e),t)}catch(e){}return null}function wi(e,t,n){const r=n.transaction||n.signedTransaction;if("call"===e){const e=vi(t,!0);if(e)return e.data;Ei.throwError("missing revert data in call exception; Transaction reverted without a reason string",z.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:t})}if("estimateGas"===e){let n=vi(t.body,!1);null==n&&(n=vi(t,!1)),n&&Ei.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",z.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:e,transaction:r,error:t})}let i=t.message;throw t.code===z.errors.SERVER_ERROR&&t.error&&"string"==typeof t.error.message?i=t.error.message:"string"==typeof t.body?i=t.body:"string"==typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Ei.throwError("insufficient funds for intrinsic transaction cost",z.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),i.match(/nonce (is )?too low/i)&&Ei.throwError("nonce has already been used",z.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Ei.throwError("replacement fee too low",z.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),i.match(/only replay-protected/i)&&Ei.throwError("legacy pre-eip-155 transactions not supported",z.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:r}),bi.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Ei.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",z.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}function Oi(e){return new Promise((function(t){setTimeout(t,e)}))}function Di(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function Pi(e){return e?e.toLowerCase():e}const _i={};class Ti extends gi{constructor(e,t,n){if(super(),e!==_i)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Ve(this,"provider",t),null==n&&(n=0),"string"==typeof n?(Ve(this,"_address",this.provider.formatter.address(n)),Ve(this,"_index",null)):"number"==typeof n?(Ve(this,"_index",n),Ve(this,"_address",null)):Ei.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return Ei.throwError("cannot alter JSON-RPC Signer connection",z.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Ii(_i,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((e=>(e.length<=this._index&&Ei.throwError("unknown account #"+this._index,z.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=Qe(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const n=Qe(e);n.from=t,e.gasLimit=this.provider.estimateGas(n)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>Ai(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&Ei.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),je({tx:je(e),sender:t}).then((({tx:t,sender:n})=>{null!=t.from?t.from.toLowerCase()!==n&&Ei.throwArgumentError("from address mismatch","transaction",e):t.from=n;const r=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((e=>e),(e=>("string"==typeof e.message&&e.message.match(/user denied/i)&&Ei.throwError("user rejected transaction",z.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),wi("sendTransaction",e,r))))}))}signTransaction(e){return Ei.throwError("signing transactions is unsupported",z.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Ai(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield Mn((()=>Ai(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(n);if(null!==e)return this.provider._wrapTransaction(e,n,t)}))),{oncePoll:this.provider})}catch(e){throw e.transactionHash=n,e}}))}signMessage(e){return Ai(this,void 0,void 0,(function*(){const t="string"==typeof e?wt(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[le(t),n.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&Ei.throwError("user rejected signing",z.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),t}}))}_legacySignMessage(e){return Ai(this,void 0,void 0,(function*(){const t="string"==typeof e?wt(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),le(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&Ei.throwError("user rejected signing",z.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),t}}))}_signTypedData(e,t,n){return Ai(this,void 0,void 0,(function*(){const r=yield Rn.resolveNames(e,t,n,(e=>this.provider.resolveName(e))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(Rn.getPayload(r.domain,t,r.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&Ei.throwError("user rejected signing",z.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:t,value:r.value}}),e}}))}unlock(e){return Ai(this,void 0,void 0,(function*(){const t=this.provider,n=yield this.getAddress();return t.send("personal_unlockAccount",[n.toLowerCase(),e,null])}))}}class Ii extends Ti{sendTransaction(e){return this.sendUncheckedTransaction(e).then((e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)})))}}const Ri={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Ci extends di{constructor(e,t){let n=t;null==n&&(n=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(n),e||(e=He(this.constructor,"defaultUrl")()),Ve(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(Qe(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Ai(this,void 0,void 0,(function*(){yield Oi(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(e){}}if(null!=e){const t=He(this.constructor,"getNetwork");try{return t(ve.from(e).toNumber())}catch(t){return Ei.throwError("could not detect network",z.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return Ei.throwError("could not detect network",z.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new Ti(_i,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((e=>e.map((e=>this.formatter.address(e)))))}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:$e(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(r&&this._cache[e])return this._cache[e];const i=Fn(this.connection,JSON.stringify(n),Di).then((e=>(this.emit("debug",{action:"response",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:n,provider:this}),e}));return r&&(this._cache[e]=i,setTimeout((()=>{this._cache[e]=null}),0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[Pi(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Pi(t.address),t.blockTag]];case"getCode":return["eth_getCode",[Pi(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Pi(t.address),fe(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[He(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[He(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=Pi(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Ai(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&ve.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((t=Qe(t)).transaction=Qe(e),delete t.transaction.type)}}const n=this.prepareRequest(e,t);null==n&&Ei.throwError(e+" not implemented",z.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(n){return wi(e,n,t)}}))}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(n){return function r(){e.send("eth_getFilterChanges",[n]).then((function(n){if(e._pendingFilter!=t)return null;let r=Promise.resolve();return n.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",r=r.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),r.then((function(){return Oi(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){r()}),0),null;e.send("eth_uninstallFilter",[n])})).catch((e=>{}))}(),n})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const n=Qe(Ri);if(t)for(const e in t)t[e]&&(n[e]=!0);var r,i;i=n,(r=e)&&"object"==typeof r||Ue.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((e=>{i[e]||Ue.throwArgumentError("invalid object key - "+e,"transaction:"+e,r)}));const s={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const n=he(ve.from(e[t]));"gasLimit"===t&&(t="gas"),s[t]=n})),["from","to","data"].forEach((function(t){null!=e[t]&&(s[t]=le(e[t]))})),e.accessList&&(s.accessList=xr(e.accessList)),s}}var Bi=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const ki=new z(qn);class Ni extends Ci{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return Bi(this,void 0,void 0,(function*(){let t=this.network;return null==t&&(t=yield e.detectNetwork.call(this),t||ki.throwError("no network detected",z.errors.UNKNOWN_ERROR,{}),null==this._network&&(Ve(this,"_network",t),this.emit("network",t,null))),t}))}}const xi="abi/5.7.0",Si=new z(xi),Li={};let Fi={calldata:!0,memory:!0,storage:!0},Mi={calldata:!0,memory:!0};function qi(e,t){if("bytes"===e||"string"===e){if(Fi[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Mi[t])return!0;return(Fi[t]||"payable"===t)&&Si.throwArgumentError("invalid modifier","name",t),!1}function Ui(e,t){for(let n in t)Ve(e,n,t[n])}const Vi=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Hi=new RegExp(/^(.*)\[([0-9]*)\]$/);class ji{constructor(e,t){e!==Li&&Si.throwError("use fromString",z.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Ui(this,t);let n=this.type.match(Hi);Ui(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:ji.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=Vi.sighash),Vi[e]||Si.throwArgumentError("invalid format type","format",e),e===Vi.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==Vi.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Vi.full?", ":",")+")"):t+=this.type,e!==Vi.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Vi.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?ji.fromString(e,t):ji.fromObject(e)}static fromObject(e){return ji.isParamType(e)?e:new ji(Li,{name:e.name||null,type:es(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(ji.fromObject):null})}static fromString(e,t){return n=function(e,t){let n=e;function r(t){Si.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let n={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(n.indexed=!1),n}e=e.replace(/\s/g," ");let s={type:"",name:"",state:{allowType:!0}},o=s;for(let n=0;n<e.length;n++){let s=e[n];switch(s){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||r(n),o.state.allowType=!1,o.type=es(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||r(n),o.indexed=!0,o.name=""),qi(o.type,o.name)&&(o.name=""),o.type=es(o.type);let e=o;o=o.parent,o||r(n),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||r(n),o.indexed=!0,o.name=""),qi(o.type,o.name)&&(o.name=""),o.type=es(o.type);let a=i(o.parent);o.parent.components.push(a),delete o.parent,o=a;break;case" ":o.state.allowType&&""!==o.type&&(o.type=es(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||r(n),o.indexed&&r(n),o.indexed=!0,o.name=""):qi(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||r(n),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||r(n),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:r(n)}}return o.parent&&Si.throwArgumentError("unexpected eof","param",e),delete s.state,"indexed"===o.name?(t||r(n.length-7),o.indexed&&r(n.length-7),o.indexed=!0,o.name=""):qi(o.type,o.name)&&(o.name=""),s.type=es(s.type),s}(e,!!t),ji.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}}function Qi(e,t){return function(e){e=e.trim();let t=[],n="",r=0;for(let i=0;i<e.length;i++){let s=e[i];","===s&&0===r?(t.push(n),n=""):(n+=s,"("===s?r++:")"===s&&(r--,-1===r&&Si.throwArgumentError("unbalanced parenthesis","value",e)))}n&&t.push(n);return t}(e).map((e=>ji.fromString(e,t)))}class Yi{constructor(e,t){e!==Li&&Si.throwError("use a static from method",z.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Ui(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Yi.isFragment(e)?e:"string"==typeof e?Yi.fromString(e):Yi.fromObject(e)}static fromObject(e){if(Yi.isFragment(e))return e;switch(e.type){case"function":return Ji.fromObject(e);case"event":return Gi.fromObject(e);case"constructor":return zi.fromObject(e);case"error":return Zi.fromObject(e);case"fallback":case"receive":return null}return Si.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Gi.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Ji.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?zi.fromString(e.trim()):"error"===e.split(" ")[0]?Zi.fromString(e.substring(5).trim()):Si.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class Gi extends Yi{format(e){if(e||(e=Vi.sighash),Vi[e]||Si.throwArgumentError("invalid format type","format",e),e===Vi.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Vi.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Vi.full?", ":",")+") ",e!==Vi.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?Gi.fromString(e):Gi.fromObject(e)}static fromObject(e){if(Gi.isEventFragment(e))return e;"event"!==e.type&&Si.throwArgumentError("invalid event object","value",e);const t={name:ns(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(ji.fromObject):[],type:"event"};return new Gi(Li,t)}static fromString(e){let t=e.match(rs);t||Si.throwArgumentError("invalid event string","value",e);let n=!1;return t[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:Si.warn("unknown modifier: "+e)}})),Gi.fromObject({name:t[1].trim(),anonymous:n,inputs:Qi(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function Xi(e,t){t.gas=null;let n=e.split("@");return 1!==n.length?(n.length>2&&Si.throwArgumentError("invalid human-readable ABI signature","value",e),n[1].match(/^[0-9]+$/)||Si.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=ve.from(n[1]),n[0]):e}function $i(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function Ki(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&Si.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&Si.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||Si.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&Si.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&Si.throwArgumentError("unable to determine stateMutability","value",e),t}class zi extends Yi{format(e){if(e||(e=Vi.sighash),Vi[e]||Si.throwArgumentError("invalid format type","format",e),e===Vi.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===Vi.sighash&&Si.throwError("cannot format a constructor for sighash",z.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Vi.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?zi.fromString(e):zi.fromObject(e)}static fromObject(e){if(zi.isConstructorFragment(e))return e;"constructor"!==e.type&&Si.throwArgumentError("invalid constructor object","value",e);let t=Ki(e);t.constant&&Si.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(ji.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?ve.from(e.gas):null};return new zi(Li,n)}static fromString(e){let t={type:"constructor"},n=(e=Xi(e,t)).match(rs);return n&&"constructor"===n[1].trim()||Si.throwArgumentError("invalid constructor string","value",e),t.inputs=Qi(n[2].trim(),!1),$i(n[3].trim(),t),zi.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class Ji extends zi{format(e){if(e||(e=Vi.sighash),Vi[e]||Si.throwArgumentError("invalid format type","format",e),e===Vi.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Vi.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Vi.full?", ":",")+") ",e!==Vi.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"==typeof e?Ji.fromString(e):Ji.fromObject(e)}static fromObject(e){if(Ji.isFunctionFragment(e))return e;"function"!==e.type&&Si.throwArgumentError("invalid function object","value",e);let t=Ki(e);const n={type:e.type,name:ns(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(ji.fromObject):[],outputs:e.outputs?e.outputs.map(ji.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?ve.from(e.gas):null};return new Ji(Li,n)}static fromString(e){let t={type:"function"},n=(e=Xi(e,t)).split(" returns ");n.length>2&&Si.throwArgumentError("invalid function string","value",e);let r=n[0].match(rs);if(r||Si.throwArgumentError("invalid function signature","value",e),t.name=r[1].trim(),t.name&&ns(t.name),t.inputs=Qi(r[2],!1),$i(r[3].trim(),t),n.length>1){let r=n[1].match(rs);""==r[1].trim()&&""==r[3].trim()||Si.throwArgumentError("unexpected tokens","value",e),t.outputs=Qi(r[2],!1)}else t.outputs=[];return Ji.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function Wi(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||Si.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class Zi extends Yi{format(e){if(e||(e=Vi.sighash),Vi[e]||Si.throwArgumentError("invalid format type","format",e),e===Vi.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Vi.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Vi.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?Zi.fromString(e):Zi.fromObject(e)}static fromObject(e){if(Zi.isErrorFragment(e))return e;"error"!==e.type&&Si.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:ns(e.name),inputs:e.inputs?e.inputs.map(ji.fromObject):[]};return Wi(new Zi(Li,t))}static fromString(e){let t={type:"error"},n=e.match(rs);return n||Si.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&ns(t.name),t.inputs=Qi(n[2],!1),Wi(Zi.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function es(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const ts=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function ns(e){return e&&e.match(ts)||Si.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const rs=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const is=new z(xi);class ss{constructor(e,t,n,r){this.name=e,this.type=t,this.localName=n,this.dynamic=r}_throwError(e,t){is.throwArgumentError(e,this.localName,t)}}class os{constructor(e){Ve(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return de(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(ie(e._data))}writeBytes(e){let t=re(e);const n=t.length%this.wordSize;return n&&(t=ie([t,this._padding.slice(n)])),this._writeData(t)}_getValue(e){let t=re(ve.from(e));return t.length>this.wordSize&&is.throwError("value out-of-bounds",z.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=ie([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class as{constructor(e,t,n,r){Ve(this,"_data",re(e)),Ve(this,"wordSize",t||32),Ve(this,"_coerceFunc",n),Ve(this,"allowLoose",r),this._offset=0}get data(){return le(this._data)}get consumed(){return this._offset}static coerce(e,t){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):as.coerce(e,t)}_peekBytes(e,t,n){let r=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+t<=this._data.length?r=t:is.throwError("data out-of-bounds",z.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(e){return new as(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let n=this._peekBytes(0,e,!!t);return this._offset+=n.length,n.slice(0,e)}readValue(){return ve.from(this.readBytes(this.wordSize))}}class ls extends ss{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=hn(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return hn(fe(e.readValue().toHexString(),20))}}class cs extends ss{constructor(e){super(e.name,e.type,void 0,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)}}const us=new z(xi);function ds(e,t,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let e={};r=t.map((t=>{const r=t.localName;return r||us.throwError("cannot encode object for signature with missing names",z.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]&&us.throwError("cannot encode object for signature with duplicate names",z.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]=!0,n[r]}))}else us.throwArgumentError("invalid tuple value","tuple",n);t.length!==r.length&&us.throwArgumentError("types/value length mismatch","tuple",n);let i=new os(e.wordSize),s=new os(e.wordSize),o=[];t.forEach(((e,t)=>{let n=r[t];if(e.dynamic){let t=s.length;e.encode(s,n);let r=i.writeUpdatableValue();o.push((e=>{r(e+t)}))}else e.encode(i,n)})),o.forEach((e=>{e(i.length)}));let a=e.appendWriter(i);return a+=e.appendWriter(s),a}function hs(e,t){let n=[],r=e.subReader(0);t.forEach((t=>{let i=null;if(t.dynamic){let n=e.readValue(),s=r.subReader(n.toNumber());try{i=t.decode(s)}catch(e){if(e.code===z.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(e){if(e.code===z.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}null!=i&&n.push(i)}));const i=t.reduce(((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e}),{});t.forEach(((e,t)=>{let r=e.localName;if(!r||1!==i[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const s=n[t];s instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw s}}):n[r]=s}));for(let e=0;e<n.length;e++){const t=n[e];t instanceof Error&&Object.defineProperty(n,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(n)}class fs extends ss{constructor(e,t,n){super("array",e.type+"["+(t>=0?t:"")+"]",n,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let n=this.length;-1===n&&(n=t.length,e.writeValue(t.length)),us.checkArgumentCount(t.length,n,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let e=0;e<t.length;e++)r.push(this.coder);return ds(e,r,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&us.throwError("insufficient data length",z.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let n=[];for(let e=0;e<t;e++)n.push(new cs(this.coder));return e.coerce(this.name,hs(e,n))}}class ps extends ss{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class ms extends ss{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=re(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class gs extends ms{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,le(super.decode(e)))}}class ys extends ss{constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let n=re(t);return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return e.coerce(this.name,le(e.readBytes(this.size)))}}class As extends ss{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}class Es extends ss{constructor(e,t,n){const r=(t?"int":"uint")+8*e;super(r,r,n,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let n=ve.from(t),r=pt.mask(8*e.wordSize);if(this.signed){let e=r.mask(8*this.size-1);(n.gt(e)||n.lt(e.add(ft).mul(dt)))&&this._throwError("value out-of-bounds",t)}else(n.lt(ht)||n.gt(r.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return n=n.toTwos(8*this.size).mask(8*this.size),this.signed&&(n=n.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(n)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}class bs extends ms{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,wt(t))}decode(e){return Ot(super.decode(e))}}class vs extends ss{constructor(e,t){let n=!1;const r=[];e.forEach((e=>{e.dynamic&&(n=!0),r.push(e.type)}));super("tuple","tuple("+r.join(",")+")",t,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach((t=>{e.push(t.defaultValue())}));const t=this.coders.reduce(((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[r]))})),Object.freeze(e)}encode(e,t){return ds(e,this.coders,t)}decode(e){return e.coerce(this.name,hs(e,this.coders))}}const ws=new z(xi),Os=new RegExp(/^bytes([0-9]*)$/),Ds=new RegExp(/^(u?int)([0-9]*)$/);const Ps=new class{constructor(e){Ve(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new ls(e.name);case"bool":return new ps(e.name);case"string":return new bs(e.name);case"bytes":return new gs(e.name);case"array":return new fs(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new vs((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new As(e.name)}let t=e.type.match(Ds);if(t){let n=parseInt(t[2]||"256");return(0===n||n>256||n%8!=0)&&ws.throwArgumentError("invalid "+t[1]+" bit length","param",e),new Es(n/8,"int"===t[1],e.name)}if(t=e.type.match(Os),t){let n=parseInt(t[1]);return(0===n||n>32)&&ws.throwArgumentError("invalid bytes length","param",e),new ys(n,e.name)}return ws.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new as(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new os(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(ji.from(e))));return new vs(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&ws.throwError("types/values length mismatch",z.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const n=e.map((e=>this._getCoder(ji.from(e)))),r=new vs(n,"_"),i=this._getWriter();return r.encode(i,t),i.data}decode(e,t,n){const r=e.map((e=>this._getCoder(ji.from(e))));return new vs(r,"_").decode(this._getReader(re(t),n))}},_s=new z(xi);class Ts extends Ke{}class Is extends Ke{}class Rs extends Ke{}class Cs extends Ke{static isIndexed(e){return!(!e||!e._isIndexed)}}const Bs={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function ks(e,t){const n=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return n.error=t,n}class Ns{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,Ve(this,"fragments",t.map((e=>Yi.from(e))).filter((e=>null!=e))),Ve(this,"_abiCoder",He(new.target,"getAbiCoder")()),Ve(this,"functions",{}),Ve(this,"errors",{}),Ve(this,"events",{}),Ve(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void _s.warn("duplicate definition - constructor"):void Ve(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let n=e.format();t[n]?_s.warn("duplicate definition - "+n):t[n]=e})),this.deploy||Ve(this,"deploy",zi.from({payable:!1,type:"constructor"})),Ve(this,"_isInterface",!0)}format(e){e||(e=Vi.full),e===Vi.sighash&&_s.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===Vi.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return Ps}static getAddress(e){return hn(e)}static getSighash(e){return ue(Dt(e.format()),0,4)}static getEventTopic(e){return Dt(e.format())}getFunction(e){if(oe(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];_s.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.functions).filter((e=>e.split("(")[0]===t));return 0===n.length?_s.throwArgumentError("no matching function","name",t):n.length>1&&_s.throwArgumentError("multiple matching functions","name",t),this.functions[n[0]]}const t=this.functions[Ji.fromString(e).format()];return t||_s.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(oe(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];_s.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.events).filter((e=>e.split("(")[0]===t));return 0===n.length?_s.throwArgumentError("no matching event","name",t):n.length>1&&_s.throwArgumentError("multiple matching events","name",t),this.events[n[0]]}const t=this.events[Gi.fromString(e).format()];return t||_s.throwArgumentError("no matching event","signature",e),t}getError(e){if(oe(e)){const t=He(this.constructor,"getSighash");for(const n in this.errors){if(e===t(this.errors[n]))return this.errors[n]}_s.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.errors).filter((e=>e.split("(")[0]===t));return 0===n.length?_s.throwArgumentError("no matching error","name",t):n.length>1&&_s.throwArgumentError("multiple matching errors","name",t),this.errors[n[0]]}const t=this.errors[Ji.fromString(e).format()];return t||_s.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return He(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),He(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"==typeof e&&(e=this.getError(e));const n=re(t);return le(n.slice(0,4))!==this.getSighash(e)&&_s.throwArgumentError(`data signature does not match error ${e.name}.`,"data",le(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),le(ie([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const n=re(t);return le(n.slice(0,4))!==this.getSighash(e)&&_s.throwArgumentError(`data signature does not match function ${e.name}.`,"data",le(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),le(ie([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let n=re(t),r=null,i="",s=null,o=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch(e){}break;case 4:{const e=le(n.slice(0,4)),t=Bs[e];if(t)s=this._abiCoder.decode(t.inputs,n.slice(4)),o=t.name,a=t.signature,t.reason&&(r=s[0]),"Error"===o?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:"Panic"===o&&(i=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const t=this.getError(e);s=this._abiCoder.decode(t.inputs,n.slice(4)),o=t.name,a=t.format()}catch(e){}break}}return _s.throwError("call revert exception"+i,z.errors.CALL_EXCEPTION,{method:e.format(),data:le(t),errorArgs:s,errorName:o,errorSignature:a,reason:r})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),le(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&_s.throwError("too many arguments for "+e.format(),z.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let n=[];e.anonymous||n.push(this.getEventTopic(e));const r=(e,t)=>"string"===e.type?Dt(t):"bytes"===e.type?mt(le(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=ve.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),fe(le(t),32));for(t.forEach(((t,i)=>{let s=e.inputs[i];s.indexed?null==t?n.push(null):"array"===s.baseType||"tuple"===s.baseType?_s.throwArgumentError("filtering with tuples or arrays not supported","contract."+s.name,t):Array.isArray(t)?n.push(t.map((e=>r(s,e)))):n.push(r(s,t)):null!=t&&_s.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+s.name,t)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));const n=[],r=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&_s.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,s)=>{const o=t[s];if(e.indexed)if("string"===e.type)n.push(Dt(o));else if("bytes"===e.type)n.push(mt(o));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(this._abiCoder.encode([e.type],[o]))}else r.push(e),i.push(o)})),{data:this._abiCoder.encode(r,i),topics:n}}decodeEventLog(e,t,n){if("string"==typeof e&&(e=this.getEvent(e)),null!=n&&!e.anonymous){let t=this.getEventTopic(e);oe(n[0],32)&&n[0].toLowerCase()===t||_s.throwError("fragment/topic mismatch",z.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:n[0]}),n=n.slice(1)}let r=[],i=[],s=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(r.push(ji.fromObject({type:"bytes32",name:e.name})),s.push(!0)):(r.push(e),s.push(!1)):(i.push(e),s.push(!1))}));let o=null!=n?this._abiCoder.decode(r,ie(n)):null,a=this._abiCoder.decode(i,t,!0),l=[],c=0,u=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==o)l[t]=new Cs({_isIndexed:!0,hash:null});else if(s[t])l[t]=new Cs({_isIndexed:!0,hash:o[u++]});else try{l[t]=o[u++]}catch(e){l[t]=e}else try{l[t]=a[c++]}catch(e){l[t]=e}if(e.name&&null==l[e.name]){const n=l[t];n instanceof Error?Object.defineProperty(l,e.name,{enumerable:!0,get:()=>{throw ks(`property ${JSON.stringify(e.name)}`,n)}}):l[e.name]=n}}));for(let e=0;e<l.length;e++){const t=l[e];t instanceof Error&&Object.defineProperty(l,e,{enumerable:!0,get:()=>{throw ks(`index ${e}`,t)}})}return Object.freeze(l)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new Is({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:ve.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Ts({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=le(e);let n=this.getError(t.substring(0,10).toLowerCase());return n?new Rs({args:this._abiCoder.decode(n.inputs,"0x"+t.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!(!e||!e._isInterface)}}var xs=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))};const Ss=new z("contracts/5.7.0");function Ls(e,t){return xs(this,void 0,void 0,(function*(){const n=yield t;"string"!=typeof n&&Ss.throwArgumentError("invalid address or ENS name","name",n);try{return hn(n)}catch(e){}e||Ss.throwError("a provider or signer is needed to resolve ENS names",z.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield e.resolveName(n);return null==r&&Ss.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r}))}function Fs(e,t,n){return xs(this,void 0,void 0,(function*(){return Array.isArray(n)?yield Promise.all(n.map(((n,r)=>Fs(e,Array.isArray(t)?t[r]:t[n.name],n)))):"address"===n.type?yield Ls(e,t):"tuple"===n.type?yield Fs(e,t,n.components):"array"===n.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>Fs(e,t,n.arrayChildren)))):Promise.reject(Ss.makeError("invalid value for array",z.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function Ms(e,t,n){return xs(this,void 0,void 0,(function*(){let r={};n.length===t.inputs.length+1&&"object"==typeof n[n.length-1]&&(r=Qe(n.pop())),Ss.checkArgumentCount(n.length,t.inputs.length,"passed to contract"),e.signer?r.from?r.from=je({override:Ls(e.signer,r.from),signer:e.signer.getAddress()}).then((e=>xs(this,void 0,void 0,(function*(){return hn(e.signer)!==e.override&&Ss.throwError("Contract with a Signer cannot override from",z.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):r.from=e.signer.getAddress():r.from&&(r.from=Ls(e.provider,r.from));const i=yield je({args:Fs(e.signer||e.provider,n,t.inputs),address:e.resolvedAddress,overrides:je(r)||{}}),s=e.interface.encodeFunctionData(t,i.args),o={data:s,to:i.address},a=i.overrides;if(null!=a.nonce&&(o.nonce=ve.from(a.nonce).toNumber()),null!=a.gasLimit&&(o.gasLimit=ve.from(a.gasLimit)),null!=a.gasPrice&&(o.gasPrice=ve.from(a.gasPrice)),null!=a.maxFeePerGas&&(o.maxFeePerGas=ve.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(o.maxPriorityFeePerGas=ve.from(a.maxPriorityFeePerGas)),null!=a.from&&(o.from=a.from),null!=a.type&&(o.type=a.type),null!=a.accessList&&(o.accessList=xr(a.accessList)),null==o.gasLimit&&null!=t.gas){let e=21e3;const n=re(s);for(let t=0;t<n.length;t++)e+=4,n[t]&&(e+=64);o.gasLimit=ve.from(t.gas).add(e)}if(a.value){const e=ve.from(a.value);e.isZero()||t.payable||Ss.throwError("non-payable method cannot override value",z.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:r.value}),o.value=e}a.customData&&(o.customData=Qe(a.customData)),a.ccipReadEnabled&&(o.ccipReadEnabled=!!a.ccipReadEnabled),delete r.nonce,delete r.gasLimit,delete r.gasPrice,delete r.from,delete r.value,delete r.type,delete r.accessList,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.customData,delete r.ccipReadEnabled;const l=Object.keys(r).filter((e=>null!=r[e]));return l.length&&Ss.throwError(`cannot override ${l.map((e=>JSON.stringify(e))).join(",")}`,z.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o}))}function qs(e,t,n){const r=e.signer||e.provider;return function(...i){return xs(this,void 0,void 0,(function*(){let s;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=Qe(i.pop());null!=e.blockTag&&(s=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(s));const o=yield Ms(e,t,i),a=yield r.call(o,s);try{let r=e.interface.decodeFunctionResult(t,a);return n&&1===t.outputs.length&&(r=r[0]),r}catch(t){throw t.code===z.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=o),t}}))}}function Us(e,t){return function(...n){return xs(this,void 0,void 0,(function*(){e.signer||Ss.throwError("sending a transaction requires a signer",z.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const r=yield Ms(e,t,n),i=yield e.signer.sendTransaction(r);return function(e,t){const n=t.wait.bind(t);t.wait=t=>n(t).then((t=>(t.events=t.logs.map((n=>{let r=$e(n),i=null;try{i=e.interface.parseLog(n)}catch(e){}return i&&(r.args=i.args,r.decode=(t,n)=>e.interface.decodeEventLog(i.eventFragment,t,n),r.event=i.name,r.eventSignature=i.signature),r.removeListener=()=>e.provider,r.getBlock=()=>e.provider.getBlock(t.blockHash),r.getTransaction=()=>e.provider.getTransaction(t.transactionHash),r.getTransactionReceipt=()=>Promise.resolve(t),r})),t)))}(e,i),i}))}}function Vs(e,t,n){return t.constant?qs(e,t,n):Us(e,t)}function Hs(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.map((e=>Array.isArray(e)?e.join("|"):e)).join(":"):""):"*"}class js{constructor(e,t){Ve(this,"tag",e),Ve(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter((n=>!(!t&&n.listener===e)||(t=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((e=>e.listener))}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter((t=>{const n=e.slice();return setTimeout((()=>{t.listener.apply(this,n)}),0),!t.once})),t}prepareEvent(e){}getEmit(e){return[e]}}class Qs extends js{constructor(){super("error",null)}}class Ys extends js{constructor(e,t,n,r){const i={address:e};let s=t.getEventTopic(n);r?(s!==r[0]&&Ss.throwArgumentError("topic mismatch","topics",r),i.topics=r.slice()):i.topics=[s],super(Hs(i),i),Ve(this,"address",e),Ve(this,"interface",t),Ve(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=function(e){const t=[],n=function(e,r){if(Array.isArray(r))for(let i in r){const s=e.slice();s.push(i);try{n(s,r[i])}catch(e){t.push({path:s,error:e})}}};return n([],e),t}(e.args);if(t.length)throw t[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Gs extends js{constructor(e,t){super("*",{address:e}),Ve(this,"address",e),Ve(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,n)=>this.interface.decodeEventLog(t.eventFragment,e,n),e.args=t.args}catch(e){}}}class Xs{constructor(e,t,n){Ve(this,"interface",He(new.target,"getInterface")(t)),null==n?(Ve(this,"provider",null),Ve(this,"signer",null)):gi.isSigner(n)?(Ve(this,"provider",n.provider||null),Ve(this,"signer",n)):Ze.isProvider(n)?(Ve(this,"provider",n),Ve(this,"signer",null)):Ss.throwArgumentError("invalid signer or provider","signerOrProvider",n),Ve(this,"callStatic",{}),Ve(this,"estimateGas",{}),Ve(this,"functions",{}),Ve(this,"populateTransaction",{}),Ve(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const n=this.interface.events[t];Ve(this.filters,t,((...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(n,e)}))),e[n.name]||(e[n.name]=[]),e[n.name].push(t)})),Object.keys(e).forEach((t=>{const n=e[t];1===n.length?Ve(this.filters,t,this.filters[n[0]]):Ss.warn(`Duplicate definition of ${t} (${n.join(", ")})`)}))}if(Ve(this,"_runningEvents",{}),Ve(this,"_wrappedEmits",{}),null==e&&Ss.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Ve(this,"address",e),this.provider)Ve(this,"resolvedAddress",Ls(this.provider,e));else try{Ve(this,"resolvedAddress",Promise.resolve(hn(e)))}catch(e){Ss.throwError("provider is required to use ENS name as contract address",z.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((e=>{}));const r={},i={};Object.keys(this.interface.functions).forEach((e=>{const t=this.interface.functions[e];if(i[e])Ss.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{i[e]=!0;{const n=t.name;r[`%${n}`]||(r[`%${n}`]=[]),r[`%${n}`].push(e)}null==this[e]&&Ve(this,e,Vs(this,t,!0)),null==this.functions[e]&&Ve(this.functions,e,Vs(this,t,!1)),null==this.callStatic[e]&&Ve(this.callStatic,e,qs(this,t,!0)),null==this.populateTransaction[e]&&Ve(this.populateTransaction,e,function(e,t){return function(...n){return Ms(e,t,n)}}(this,t)),null==this.estimateGas[e]&&Ve(this.estimateGas,e,function(e,t){const n=e.signer||e.provider;return function(...r){return xs(this,void 0,void 0,(function*(){n||Ss.throwError("estimate require a provider or signer",z.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Ms(e,t,r);return yield n.estimateGas(i)}))}}(this,t))}})),Object.keys(r).forEach((e=>{const t=r[e];if(t.length>1)return;e=e.substring(1);const n=t[0];try{null==this[e]&&Ve(this,e,this[n])}catch(e){}null==this.functions[e]&&Ve(this.functions,e,this.functions[n]),null==this.callStatic[e]&&Ve(this.callStatic,e,this.callStatic[n]),null==this.populateTransaction[e]&&Ve(this.populateTransaction,e,this.populateTransaction[n]),null==this.estimateGas[e]&&Ve(this.estimateGas,e,this.estimateGas[n])}))}static getContractAddress(e){return fn(e)}static getInterface(e){return Ns.isInterface(e)?e:new Ns(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,e).then((e=>("0x"===e&&Ss.throwError("contract not deployed",z.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||Ss.throwError("sending a transactions require a signer",z.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=Qe(e||{});return["from","to"].forEach((function(e){null!=t[e]&&Ss.throwError("cannot override "+e,z.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new yi(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Ve(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Cs.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new Qs);if("event"===e)return this._normalizeRunningEvent(new js("event",null));if("*"===e)return this._normalizeRunningEvent(new Gs(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new Ys(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const t=e.topics[0];if("string"!=typeof t)throw new Error("invalid topic");const n=this.interface.getEvent(t);return this._normalizeRunningEvent(new Ys(this.address,this.interface,n,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new js(Hs(t),t))}return this._normalizeRunningEvent(new Gs(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,n){const r=$e(t);return r.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},r.getBlock=()=>this.provider.getBlock(t.blockHash),r.getTransaction=()=>this.provider.getTransaction(t.transactionHash),r.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(r),r}_addEventListener(e,t,n){if(this.provider||Ss.throwError("events require a provider or a signer with a provider",z.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const n=n=>{let r=this._wrapEvent(e,n,t);if(null==r.decodeError)try{const t=e.getEmit(r);this.emit(e.filter,...t)}catch(e){r.decodeError=e.error}null!=e.filter&&this.emit("event",r),null!=r.decodeError&&this.emit("error",r.decodeError,r)};this._wrappedEmits[e.tag]=n,null!=e.filter&&this.provider.on(e.filter,n)}}queryFilter(e,t,n){const r=this._getRunningEvent(e),i=Qe(r.filter);return"string"==typeof t&&oe(t,32)?(null!=n&&Ss.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=n?n:"latest"),this.provider.getLogs(i).then((e=>e.map((e=>this._wrapEvent(r,e,null)))))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const n=this._getRunningEvent(e),r=n.run(t)>0;return this._checkRunningEvents(n),r}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce(((e,t)=>e+this._runningEvents[t].listenerCount()),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){const e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach((t=>{e.push(t)}));return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(const e in this._runningEvents){const t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(t),this._checkRunningEvents(n),this}removeListener(e,t){return this.off(e,t)}}class $s extends Xs{}function Ks(e,t,...n){return U(this,void 0,void 0,(function*(){const r=[];for(const e of n)for(const t of e)t.callData&&r.push(t.callData);const i=yield function(e,t,n){return U(this,void 0,void 0,(function*(){const r=yield zs(e,t,n),i=new Map;for(const{req:e,resp:t}of r)i.set(e,t);return e.map((e=>({req:e,resp:i.get(e)})))}))}(r,e,t),s=new Map;for(const{req:e,resp:t}of i)s.set(e,null==t?void 0:t.result);return n.map((e=>e.filter((e=>!e.callData||s.get(e.callData))).map(((e,t)=>e.processor(e.callData?s.get(e.callData):null,t)))))}))}function zs(e,t,n){return U(this,void 0,void 0,(function*(){let r=[e];e.length>800&&(r=_(e,800));let i=[];const s=r.map((e=>U(this,void 0,void 0,(function*(){const r=e.map((e=>[e.to,e.data])),s={data:t.interface.encodeFunctionData("aggregate",[r]),to:n};let o;try{o=yield t.provider.call(s)}catch(r){const s=e.length;if(s>20){const r=Math.floor(s/2),[o,a]=yield Promise.all([zs(e.slice(0,r),t,n),zs(e.slice(r,s),t,n)]);i=[...i,...o,...a]}else{const e="[sendCallReqs] error";console.error(e,r)}}if(void 0===o)throw new Error("Unexpected batch result");const[a,l]=Ps.decode(["uint256","bytes[]"],o);if(e.length!==l.length)throw new Error("Unexpected length mismatch");return l.map(((t,n)=>({resp:{result:t},req:e[n]})))}))));return(yield Promise.allSettled(s)).filter((e=>"fulfilled"===e.status)).forEach((({value:e})=>{i=[...i,...e]})),i}))}var Js;function Ws(e){return U(this,void 0,void 0,(function*(){switch(e){case Js.customERC20IsMintable:return[{inputs:[],name:"isMintable",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];case Js.customMultiCallAggregate:return[{constant:!1,inputs:[{components:[{name:"target",type:"address"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate",outputs:[{name:"blockNumber",type:"uint256"},{name:"returnData",type:"bytes[]"}],payable:!1,stateMutability:"nonpayable",type:"function"}];default:return(yield function(e){switch(e){case"./ABIs/AaveLendingPoolABI.ts":return import("./AaveLendingPoolABI-CdLq16uB.js");case"./ABIs/AaveLendingPoolAddressesProvider.ts":return import("./AaveLendingPoolAddressesProvider-EOSAznLK.js");case"./ABIs/AavePriceOracleABI.ts":return import("./AavePriceOracleABI-C2UEpXR4.js");case"./ABIs/AaveProtocolDataProviderABI.ts":return import("./AaveProtocolDataProviderABI-0JclmmLX.js");case"./ABIs/BaseDrops.ts":return import("./BaseDrops-BrQZPqKk.js");case"./ABIs/baseFilterV1.ts":return import("./baseFilterV1-BPjWXMKw.js");case"./ABIs/classicalPoolABI.ts":return import("./classicalPoolABI-D5LxySAJ.js");case"./ABIs/D3MM_READ_ABI.ts":return import("./D3MM_READ_ABI-B5536S-z.js");case"./ABIs/D3Proxy.ts":return import("./D3Proxy-CKIzLOhI.js");case"./ABIs/DODO1155.ts":return import("./DODO1155-DDY5Jxhf.js");case"./ABIs/DODO721.ts":return import("./DODO721-Kl5REiwU.js");case"./ABIs/dodoABI.ts":return import("./dodoABI-CLkEBJ8P.js");case"./ABIs/dodoBuyoutModel.ts":return import("./dodoBuyoutModel-BtQv3C3q.js");case"./ABIs/DODOCirculationHelperABI.ts":return import("./DODOCirculationHelperABI-gu1sCqZ2.js");case"./ABIs/dodoCP.ts":return import("./dodoCP-N8KA8JwJ.js");case"./ABIs/dodoCPABI.ts":return import("./dodoCPABI-CdAN0KhU.js");case"./ABIs/dodoCPABIV2.ts":return import("./dodoCPABIV2-yzF6FlEg.js");case"./ABIs/dodoCPFactory.ts":return import("./dodoCPFactory-CD0SxXT6.js");case"./ABIs/dodoCpProxy.ts":return import("./dodoCpProxy-D2AI9-4r.js");case"./ABIs/dodoCpProxyV2.ts":return import("./dodoCpProxyV2-CGZRqk2H.js");case"./ABIs/dodoCpProxyV202.ts":return import("./dodoCpProxyV202-CoZaEf_6.js");case"./ABIs/dodoCustomMintableERC20.ts":return import("./dodoCustomMintableERC20-CPpNoX1v.js");case"./ABIs/dodoDPPAdmin.ts":return import("./dodoDPPAdmin-B-fmpTbV.js");case"./ABIs/dodoDPPFactory.ts":return import("./dodoDPPFactory-DwAkVskt.js");case"./ABIs/dodoDppProxy.ts":return import("./dodoDppProxy-A7PPYsqp.js");case"./ABIs/dodoDropsProxy.ts":return import("./dodoDropsProxy-vHUWsRNO.js");case"./ABIs/dodoDSP.ts":return import("./dodoDSP-B6KYm-Cn.js");case"./ABIs/dodoDSPFactory.ts":return import("./dodoDSPFactory-j1eg7Ez-.js");case"./ABIs/dodoDspProxy.ts":return import("./dodoDspProxy-CU7OAvJG.js");case"./ABIs/dodoDVM.ts":return import("./dodoDVM-DDYx1JAy.js");case"./ABIs/dodoDVMFactory.ts":return import("./dodoDVMFactory-FpnJdZb2.js");case"./ABIs/dodoERC20V3Factory.ts":return import("./dodoERC20V3Factory-Cz4XKDrU.js");case"./ABIs/dodoEthProxyABI.ts":return import("./dodoEthProxyABI-CoX95QJI.js");case"./ABIs/dodoFeeImpl.ts":return import("./dodoFeeImpl-zR9Qv4Tq.js");case"./ABIs/dodoFragment.ts":return import("./dodoFragment-4lxmE2XJ.js");case"./ABIs/dodoMineV3Proxy.ts":return import("./dodoMineV3Proxy-xOGM7Jnv.js");case"./ABIs/dodoMineV3ProxyOld.ts":return import("./dodoMineV3ProxyOld-BqsZxJRU.js");case"./ABIs/dodoMiningABI.ts":return import("./dodoMiningABI-9J5C_6kN.js");case"./ABIs/dodoMiningReaderABI.ts":return import("./dodoMiningReaderABI-DmUXA9Gv.js");case"./ABIs/dodoNftERC1155.ts":return import("./dodoNftERC1155-Bw6ID2NE.js");case"./ABIs/dodoNftERC721.ts":return import("./dodoNftERC721-CI1l0ip9.js");case"./ABIs/dodoNftPoolProxy.ts":return import("./dodoNftPoolProxy-DQkcZHUV.js");case"./ABIs/dodoNftProxy.ts":return import("./dodoNftProxy-Di-aoLYM.js");case"./ABIs/dodoNftVault.ts":return import("./dodoNftVault-B4NZaXcd.js");case"./ABIs/dodoOracleABI.ts":return import("./dodoOracleABI-BxwZofBV.js");case"./ABIs/dodoPair.ts":return import("./dodoPair-VN1aEVFz.js");case"./ABIs/dodoPreminingABI.ts":return import("./dodoPreminingABI-DU7ocR7L.js");case"./ABIs/dodoProxyV2.ts":return import("./dodoProxyV2-9ED9HqK5.js");case"./ABIs/DODORouteProxy.ts":return import("./DODORouteProxy-51kl6QgI.js");case"./ABIs/dodoStarterProxy.ts":return import("./dodoStarterProxy-B1TdMOvw.js");case"./ABIs/dodoTokenABI.ts":return import("./dodoTokenABI-Dd2DVUbK.js");case"./ABIs/dodoUpCpFactory.ts":return import("./dodoUpCpFactory-D8ifQyp-.js");case"./ABIs/dodoUpCPFactoryABI.ts":return import("./dodoUpCPFactoryABI-C1W0Q4Ft.js");case"./ABIs/dodoV1PairProxy.ts":return import("./dodoV1PairProxy-DyRTqyPe.js");case"./ABIs/DODOV1PmmHelperABI.ts":return import("./DODOV1PmmHelperABI-DQqthyaE.js");case"./ABIs/dodoZooABI.ts":return import("./dodoZooABI-D9Uc4iLK.js");case"./ABIs/dppPoolABI.ts":return import("./dppPoolABI-BvoeLJgK.js");case"./ABIs/DropsERC721.ts":return import("./DropsERC721-7Bckjcar.js");case"./ABIs/DVM.ts":return import("./DVM-DjtWbqiJ.js");case"./ABIs/erc20ABI.ts":return import("./erc20ABI-v08X4jmE.js");case"./ABIs/erc20Helper.ts":return import("./erc20Helper-CG659oLz.js");case"./ABIs/feeABI.ts":return import("./feeABI-DnQdJUpQ.js");case"./ABIs/FilterAdmin.ts":return import("./FilterAdmin-jm_-DS1l.js");case"./ABIs/FilterERC1155V1.ts":return import("./FilterERC1155V1-VIUlIHdF.js");case"./ABIs/FilterERC721V1.ts":return import("./FilterERC721V1-CWDEPGmH.js");case"./ABIs/Fragment.ts":return import("./Fragment-Bd_AXeVx.js");case"./ABIs/FundingABI.ts":return import("./FundingABI-WqQDGVVa.js");case"./ABIs/IdodoV2.ts":return import("./IdodoV2-DlW8pwaE.js");case"./ABIs/LockedTokenVaultABI.ts":return import("./LockedTokenVaultABI-CfBj0wEX.js");case"./ABIs/MarginTrading.ts":return import("./MarginTrading-CQ5odvHB.js");case"./ABIs/MarginTradingFactory.ts":return import("./MarginTradingFactory-2RKqvCSO.js");case"./ABIs/MerkleDistributorABI.ts":return import("./MerkleDistributorABI-Ctn26fnA.js");case"./ABIs/multicallABI.ts":return import("./multicallABI-D9E1EeQD.js");case"./ABIs/nftContract.ts":return import("./nftContract-d4b6ObxG.js");case"./ABIs/nftFilterAdmin.ts":return import("./nftFilterAdmin-DMr_jrK_.js");case"./ABIs/NonfungiblePositionManager.ts":return import("./NonfungiblePositionManager-c8Yw_9-Q.js");case"./ABIs/oneBitSettlement.ts":return import("./oneBitSettlement-DMzQ-0t_.js");case"./ABIs/PancakePairABI.ts":return import("./PancakePairABI-Cc9LuXnX.js");case"./ABIs/setApprovalForAll.ts":return import("./setApprovalForAll-BvnCORJI.js");case"./ABIs/spaceIdABI.ts":return import("./spaceIdABI-BS4XGAT1.js");case"./ABIs/spaceIdResolverABI.ts":return import("./spaceIdResolverABI-sYDT8GfP.js");case"./ABIs/UniswapV3Pool.ts":return import("./UniswapV3Pool-Da11VKXE.js");case"./ABIs/v3MiningABI.ts":return import("./v3MiningABI-ZjGBkolS.js");case"./ABIs/vdodo.ts":return import("./vdodo-ttc2RVOs.js");case"./ABIs/vdodoTokenABI.ts":return import("./vdodoTokenABI-PldrbOSo.js");case"./ABIs/weth.ts":return import("./weth-Dz5DGEIF.js");default:return Promise.reject(new Error("Unknown variable dynamic import: "+e))}}(`./ABIs/${e}.ts`)).default}}))}!function(e){e.customERC20IsMintable="customERC20IsMintable",e.customMultiCallAggregate="customMultiCallAggregate",e.erc20Helper="erc20Helper",e.erc20ABI="erc20ABI",e.erc20Mock="erc20Mock",e.dodoERC20V3Factory="dodoERC20V3Factory",e.dodoCustomMintableERC20="dodoCustomMintableERC20",e.multicallABI="multicallABI",e.dppPoolABI="dppPoolABI",e.dvmPoolABI="DVM",e.classicalPoolABI="classicalPoolABI",e.v3MiningABI="v3MiningABI",e.dodoMiningABI="dodoMiningABI",e.dodoCP="dodoCP",e.dodoCPABI="dodoCPABI",e.dodoCPABIV2="dodoCPABIV2",e.dodoCpProxyV2="dodoCpProxyV2",e.dodoCpProxyV202="dodoCpProxyV202",e.dodoFeeImpl="dodoFeeImpl",e.feeABI="feeABI",e.vdodo="vdodo",e.vdodoTokenABI="vdodoTokenABI",e.dodoPreminingABI="dodoPreminingABI",e.MerkleDistributorABI="MerkleDistributorABI",e.DODOCirculationHelperABI="DODOCirculationHelperABI",e.FundingABI="FundingABI",e.dodoStarterProxy="dodoStarterProxy",e.MarginTrading="MarginTrading",e.MarginTradingFactory="MarginTradingFactory",e.DODORouteProxy="DODORouteProxy",e.dodoProxyV2="dodoProxyV2",e.AaveLendingPoolABI="AaveLendingPoolABI",e.AaveProtocolDataProviderABI="AaveProtocolDataProviderABI",e.AaveLendingPoolAddressesProvider="AaveLendingPoolAddressesProvider",e.AavePriceOracleABI="AavePriceOracleABI",e.spaceIdABI="spaceIdABI",e.spaceIdResolverABI="spaceIdResolverABI",e.dodoABI="dodoABI",e.PancakePairABI="PancakePairABI",e.NonfungiblePositionManager="NonfungiblePositionManager",e.UniswapV3Pool="UniswapV3Pool",e.dodoDspProxy="dodoDspProxy",e.dodoDppProxy="dodoDppProxy",e.IdodoV2="IdodoV2",e.dodoDPPAdmin="dodoDPPAdmin",e.dodoDSP="dodoDSP",e.dodoDVM="dodoDVM",e.dodoDSPFactory="dodoDSPFactory",e.dodoDVMFactory="dodoDVMFactory",e.D3Proxy="D3Proxy",e.dodoNftERC721="dodoNftERC721",e.dodoNftERC1155="dodoNftERC1155",e.dodoDropsProxy="dodoDropsProxy",e.dodoNftVault="dodoNftVault",e.dodoNftProxy="dodoNftProxy",e.dodoFragment="dodoFragment",e.dodoBuyoutModel="dodoBuyoutModel",e.dodoNftPoolProxy="dodoNftPoolProxy",e.nftFilterAdmin="nftFilterAdmin",e.baseFilterV1="baseFilterV1",e.FilterERC721V1="FilterERC721V1",e.FilterERC1155V1="FilterERC1155V1",e.dodoV1PairProxy="dodoV1PairProxy",e.dodoPair="dodoPair",e.dodoMineV3Proxy="dodoMineV3Proxy",e.dodoMineV3ProxyOld="dodoMineV3ProxyOld",e.LockedTokenVaultABI="LockedTokenVaultABI",e.DODOV1PmmHelperABI="DODOV1PmmHelperABI",e.D3MM_READ_ABI="D3MM_READ_ABI"}(Js||(Js={}));const Zs=(e,t,n)=>U(void 0,void 0,void 0,(function*(){const r=yield Ws(e);return new Ns(r).encodeFunctionData(t,n)})),eo=(e,t,n)=>new Ns(e).encodeFunctionData(t,n);class to extends Ni{constructor(){super(...arguments),this._pendingBatchAggregator=null,this._pendingBatch=null,this._provider=null}setProvider(e){this._provider=e}send(e,t){const n=Object.create(null,{send:{get:()=>super.send}});return U(this,void 0,void 0,(function*(){if("eth_call"!==e||2!==t.length||"object"!=typeof t[0]||!t[0].to||!t[0].data||"string"!=typeof t[1])return this._provider?this._provider.send(e,t):n.send.call(this,e,t);const r={request:{method:e,params:t},resolve:null,reject:null},i=new Promise(((e,t)=>{r.resolve=e,r.reject=t}));this._pendingBatch||(this._pendingBatch=[]),this._pendingBatch.push(r);const s=()=>U(this,void 0,void 0,(function*(){const t=this._pendingBatch||[];let n;this._pendingBatch=null,this._pendingBatchAggregator=null;const i=yield this.detectNetwork();n="object"!=typeof i?parseInt(i,i.startsWith("0x")?16:10):i.chainId;const s=yield function(e,t){return U(this,void 0,void 0,(function*(){let n="";const r=t.map((e=>{const[t]=e;return n=e[1],[t.to,t.data]})),i=yield Zs(Js.customMultiCallAggregate,"aggregate",[r]);return[{to:M[e].MULTI_CALL,data:i},n]}))}(n,t.map((e=>e.request.params))),o={method:e,params:s,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"requestBatch",request:$e(t.map((e=>e.request))),provider:this,id:o.id});const a=e=>{if(e.error||!e.result)t.forEach((t=>{try{const n=new Error(e.error.message);n.code=e.error.code,n.data=e.error.data,t.reject(n)}catch(n){t.reject(e.error)}})),this.emit("debug",{action:"responseBatch.error",request:o,response:e,provider:this,id:o.id});else{const[n,i]=Ps.decode(["uint256","bytes[]"],e.result),s=n.toNumber();if(this._setFastBlockNumber(s),this.emit("blockNumberChanged",s),t.length!==i.length)return void r.reject("Unexpected length mismatch");t.forEach(((e,t)=>{const n=i[t];e.resolve(n)})),this.emit("debug",{action:"responseBatch",request:o,response:e,provider:this,decodeList:i,id:o.id})}},l=e=>{this.emit("debug",{action:"responseBatch.error",error:e,request:o,provider:this,id:o.id}),t.forEach((t=>{t.reject(e)}))};if(!this._provider)return Fn(this.connection,JSON.stringify(o)).then(a,l);try{const e=yield this._provider.send(o.method,o.params);a({id:o.id,jsonrpc:o.jsonrpc,result:e})}catch(e){l(e)}}));return this._pendingBatchAggregator?this._pendingBatch.length>800&&(clearTimeout(this._pendingBatchAggregator),s()):this._pendingBatchAggregator=setTimeout(s,10),i}))}}const no="contract-query";class ro{constructor(e){this.subContractRequestsList=[],this.debugQuery=null==e?void 0:e.debugQuery,this.debugProvider=null==e?void 0:e.debugProvider,this.rpc=null==e?void 0:e.rpc,this.getConfigProvider=null==e?void 0:e.getProvider,this.staticJsonRpcProviderMap=new Map,this.batchStaticJsonRpcProviderMap=new Map,this.batchContractMap=new Map}setRpc(e){this.rpc=e,this.subContractRequestsList.forEach((t=>{t.setRpc(e)}))}setGetConfigProvider(e){this.getConfigProvider=e,this.subContractRequestsList.forEach((t=>{t.setGetConfigProvider(e)})),this.batchContractMap=new Map,this.staticJsonRpcProviderMap=new Map,this.batchStaticJsonRpcProviderMap=new Map}getProvider(e){var t,n;const r=null===(t=this.getConfigProvider)||void 0===t?void 0:t.call(this,e);if(r)return r;const i=null===(n=this.rpc)||void 0===n?void 0:n[e];if(!i)throw new Error(`ChainId ${e} not found`);if(this.staticJsonRpcProviderMap.has(e))return this.staticJsonRpcProviderMap.get(e);const s=new Ni(i,e);return this.debugProvider&&s.on("debug",console.log),this.staticJsonRpcProviderMap.set(e,s),s}getBatchProvider(e){var t,n;const r=null===(t=this.getConfigProvider)||void 0===t?void 0:t.call(this,e),i=null===(n=this.rpc)||void 0===n?void 0:n[e];if(!i&&!r)throw new Error(`ChainId ${e} not found`);if(this.batchStaticJsonRpcProviderMap.has(e))return this.batchStaticJsonRpcProviderMap.get(e);const s=new to(i,e);return s.setProvider(r||null),this.debugProvider&&s.on("debug",console.log),this.batchStaticJsonRpcProviderMap.set(e,s),s}createContractRequests(){const e=new ro({rpc:this.rpc,getProvider:this.getConfigProvider,debugQuery:this.debugQuery,debugProvider:this.debugProvider});return this.subContractRequestsList.push(e),e}getContract(e,t,n){const r=this.getProvider(e);return new $s(t,n,r)}getBatchContract(e,t,n){var r;const i=this.batchContractMap.get(e);if(i){if(i.has(t))return i.get(t)}else this.batchContractMap.set(e,new Map);const s=this.getBatchProvider(e),o=new $s(t,n,s);return null===(r=this.batchContractMap.get(e))||void 0===r||r.set(t,o),o}getBatchContractByAbiName(e,t,n){return U(this,void 0,void 0,(function*(){const r=yield this.getContractInterface(n);return this.getBatchContract(e,t,r)}))}getContractInterface(e){return Ws(e)}callMultiQuery(e,t){return U(this,void 0,void 0,(function*(){const n=M[e],{MULTI_CALL:r}=n,i=yield this.getContractInterface(Js.customMultiCallAggregate),s=this.getContract(e,r,i),o=[],a=new Map,l=new Map,c={};for(let n=0;n<t.length;n++){const{contractAddress:r,method:i,params:s,abiName:u,callback:d}=t[n];let h=l.get(u);if(!h){const t=yield this.getContractInterface(u);a.set(u,t),h=this.getContract(e,r,t),l.set(u,h)}const f={to:r,data:h.interface.encodeFunctionData(i,s)};o.push({callData:f,processor:e=>{const t=new Ns(a.get(u)).decodeFunctionResult(i,e);d&&d(t);const r=d?d(t):void 0;return c[n]=r||t,c[n]}})}const[u]=yield Ks(s,r,o);return u}))}callQuery(e,t){return U(this,void 0,void 0,(function*(){const n=yield this.getContractInterface(t.abiName),r=this.getContract(e,t.contractAddress,n),i=yield r.callStatic[t.method](...t.params),s=t.callback?t.callback(i):void 0;return s||i}))}batchCallQuery(e,t){return U(this,void 0,void 0,(function*(){this.debugQuery&&console.log({action:"batchCallQuery.request",chainId:e,query:t});const n=yield this.getBatchProvider(e),r=yield Zs(t.abiName,t.method,t.params),i=yield n.call({to:t.contractAddress,data:r}),s=yield((e,t,n)=>U(void 0,void 0,void 0,(function*(){const r=yield Ws(e);return new Ns(r).decodeFunctionResult(t,n)})))(t.abiName,t.method,i),o=t.callback?t.callback(s):void 0;return this.debugQuery&&console.log({action:"batchCallQuery.response",chainId:e,query:t,response:s}),o||s}))}getBlockNumber(e){return U(this,void 0,void 0,(function*(){const t=this.getBatchProvider(e),n=yield t.getBlockNumber();return t.emit("blockNumberChanged",n),n}))}getETHBalance(e,t){return U(this,void 0,void 0,(function*(){const n=this.getProvider(e),r=yield n.getBalance(t);return new I(r.toString()).div(1e18)}))}}const io=JSON;function so(e,t){if(!Boolean(e))throw new Error(t)}function oo(e,t){if(!Boolean(e))throw new Error("Unexpected invariant triggered.")}const ao=/\r\n|[\n\r]/g;function lo(e,t){let n=0,r=1;for(const i of e.body.matchAll(ao)){if("number"==typeof i.index||oo(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function co(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,o=t.line+s,a=1===t.line?n:0,l=t.column+a,c=`${e.name}:${o}:${l}\n`,u=r.split(/\r\n|[\n\r]/g),d=u[i];if(d.length>120){const e=Math.floor(l/80),t=l%80,n=[];for(let e=0;e<d.length;e+=80)n.push(d.slice(e,e+80));return c+uo([[`${o} |`,n[0]],...n.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return c+uo([[o-1+" |",u[i-1]],[`${o} |`,d],["|","^".padStart(l)],[`${o+1} |`,u[i+1]]])}function uo(e){const t=e.filter((([e,t])=>void 0!==t)),n=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(n)+(t?" "+t:""))).join("\n")}class ho extends Error{constructor(e,...t){var n,r,i;const{nodes:s,source:o,positions:a,path:l,originalError:c,extensions:u}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=l?l:void 0,this.originalError=null!=c?c:void 0,this.nodes=fo(Array.isArray(s)?s:s?[s]:void 0);const d=fo(null===(n=this.nodes)||void 0===n?void 0:n.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=o?o:null==d||null===(r=d[0])||void 0===r?void 0:r.source,this.positions=null!=a?a:null==d?void 0:d.map((e=>e.start)),this.locations=a&&o?a.map((e=>lo(o,e))):null==d?void 0:d.map((e=>lo(e.source,e.start)));const h="object"==typeof(f=null==c?void 0:c.extensions)&&null!==f?null==c?void 0:c.extensions:void 0;var f;this.extensions=null!==(i=null!=u?u:h)&&void 0!==i?i:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=c&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,ho):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(e+="\n\n"+co((t=n.loc).source,lo(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+co(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function fo(e){return void 0===e||0===e.length?void 0:e}function po(e,t,n){return new ho(`Syntax Error: ${n}`,{source:e,positions:[t]})}class mo{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class go{constructor(e,t,n,r,i,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const yo={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Ao=new Set(Object.keys(yo));function Eo(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&Ao.has(t)}var bo,vo,wo,Oo;function Do(e){return 9===e||32===e}function Po(e){return e>=48&&e<=57}function _o(e){return e>=97&&e<=122||e>=65&&e<=90}function To(e){return _o(e)||95===e}function Io(e){return _o(e)||Po(e)||95===e}function Ro(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let t=0;t<e.length;++t){var s;const o=e[t],a=Co(o);a!==o.length&&(r=null!==(s=r)&&void 0!==s?s:t,i=t,0!==t&&a<n&&(n=a))}return e.map(((e,t)=>0===t?e:e.slice(n))).slice(null!==(t=r)&&void 0!==t?t:0,i+1)}function Co(e){let t=0;for(;t<e.length&&Do(e.charCodeAt(t));)++t;return t}!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(bo||(bo={})),function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(vo||(vo={})),function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(wo||(wo={})),function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(Oo||(Oo={}));class Bo{constructor(e){const t=new go(Oo.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==Oo.EOF)do{if(e.next)e=e.next;else{const t=Mo(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===Oo.COMMENT);return e}}function ko(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function No(e,t){return xo(e.charCodeAt(t))&&So(e.charCodeAt(t+1))}function xo(e){return e>=55296&&e<=56319}function So(e){return e>=56320&&e<=57343}function Lo(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return Oo.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function Fo(e,t,n,r,i){const s=e.line,o=1+n-e.lineStart;return new go(t,n,r,s,o,i)}function Mo(e,t){const n=e.source.body,r=n.length;let i=t;for(;i<r;){const t=n.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===n.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return qo(e,i);case 33:return Fo(e,Oo.BANG,i,i+1);case 36:return Fo(e,Oo.DOLLAR,i,i+1);case 38:return Fo(e,Oo.AMP,i,i+1);case 40:return Fo(e,Oo.PAREN_L,i,i+1);case 41:return Fo(e,Oo.PAREN_R,i,i+1);case 46:if(46===n.charCodeAt(i+1)&&46===n.charCodeAt(i+2))return Fo(e,Oo.SPREAD,i,i+3);break;case 58:return Fo(e,Oo.COLON,i,i+1);case 61:return Fo(e,Oo.EQUALS,i,i+1);case 64:return Fo(e,Oo.AT,i,i+1);case 91:return Fo(e,Oo.BRACKET_L,i,i+1);case 93:return Fo(e,Oo.BRACKET_R,i,i+1);case 123:return Fo(e,Oo.BRACE_L,i,i+1);case 124:return Fo(e,Oo.PIPE,i,i+1);case 125:return Fo(e,Oo.BRACE_R,i,i+1);case 34:return 34===n.charCodeAt(i+1)&&34===n.charCodeAt(i+2)?$o(e,i):Ho(e,i)}if(Po(t)||45===t)return Uo(e,i,t);if(To(t))return Ko(e,i);throw po(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":ko(t)||No(n,i)?`Unexpected character: ${Lo(e,i)}.`:`Invalid character: ${Lo(e,i)}.`)}return Fo(e,Oo.EOF,r,r)}function qo(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const e=n.charCodeAt(i);if(10===e||13===e)break;if(ko(e))++i;else{if(!No(n,i))break;i+=2}}return Fo(e,Oo.COMMENT,t,i,n.slice(t+1,i))}function Uo(e,t,n){const r=e.source.body;let i=t,s=n,o=!1;if(45===s&&(s=r.charCodeAt(++i)),48===s){if(s=r.charCodeAt(++i),Po(s))throw po(e.source,i,`Invalid number, unexpected digit after 0: ${Lo(e,i)}.`)}else i=Vo(e,i,s),s=r.charCodeAt(i);if(46===s&&(o=!0,s=r.charCodeAt(++i),i=Vo(e,i,s),s=r.charCodeAt(i)),69!==s&&101!==s||(o=!0,s=r.charCodeAt(++i),43!==s&&45!==s||(s=r.charCodeAt(++i)),i=Vo(e,i,s),s=r.charCodeAt(i)),46===s||To(s))throw po(e.source,i,`Invalid number, expected digit but got: ${Lo(e,i)}.`);return Fo(e,o?Oo.FLOAT:Oo.INT,t,i,r.slice(t,i))}function Vo(e,t,n){if(!Po(n))throw po(e.source,t,`Invalid number, expected digit but got: ${Lo(e,t)}.`);const r=e.source.body;let i=t+1;for(;Po(r.charCodeAt(i));)++i;return i}function Ho(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,o="";for(;i<r;){const r=n.charCodeAt(i);if(34===r)return o+=n.slice(s,i),Fo(e,Oo.STRING,t,i+1,o);if(92!==r){if(10===r||13===r)break;if(ko(r))++i;else{if(!No(n,i))throw po(e.source,i,`Invalid character within String: ${Lo(e,i)}.`);i+=2}}else{o+=n.slice(s,i);const t=117===n.charCodeAt(i+1)?123===n.charCodeAt(i+2)?jo(e,i):Qo(e,i):Xo(e,i);o+=t.value,i+=t.size,s=i}}throw po(e.source,i,"Unterminated string.")}function jo(e,t){const n=e.source.body;let r=0,i=3;for(;i<12;){const e=n.charCodeAt(t+i++);if(125===e){if(i<5||!ko(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Go(e),r<0)break}throw po(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Qo(e,t){const n=e.source.body,r=Yo(n,t+2);if(ko(r))return{value:String.fromCodePoint(r),size:6};if(xo(r)&&92===n.charCodeAt(t+6)&&117===n.charCodeAt(t+7)){const e=Yo(n,t+8);if(So(e))return{value:String.fromCodePoint(r,e),size:12}}throw po(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function Yo(e,t){return Go(e.charCodeAt(t))<<12|Go(e.charCodeAt(t+1))<<8|Go(e.charCodeAt(t+2))<<4|Go(e.charCodeAt(t+3))}function Go(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Xo(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw po(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function $o(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,o=s,a="";const l=[];for(;s<r;){const r=n.charCodeAt(s);if(34===r&&34===n.charCodeAt(s+1)&&34===n.charCodeAt(s+2)){a+=n.slice(o,s),l.push(a);const r=Fo(e,Oo.BLOCK_STRING,t,s+3,Ro(l).join("\n"));return e.line+=l.length-1,e.lineStart=i,r}if(92!==r||34!==n.charCodeAt(s+1)||34!==n.charCodeAt(s+2)||34!==n.charCodeAt(s+3))if(10!==r&&13!==r)if(ko(r))++s;else{if(!No(n,s))throw po(e.source,s,`Invalid character within String: ${Lo(e,s)}.`);s+=2}else a+=n.slice(o,s),l.push(a),13===r&&10===n.charCodeAt(s+1)?s+=2:++s,a="",o=s,i=s;else a+=n.slice(o,s),o=s+1,s+=4}throw po(e.source,s,"Unterminated string.")}function Ko(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){if(!Io(n.charCodeAt(i)))break;++i}return Fo(e,Oo.NAME,t,i,n.slice(t,i))}const zo=10,Jo=2;function Wo(e){return Zo(e,[])}function Zo(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:Zo(t,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Jo)return"[Array]";const n=Math.min(zo,e.length),r=e.length-n,i=[];for(let r=0;r<n;++r)i.push(Zo(e[r],t));1===r?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`);return"["+i.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);if(0===n.length)return"{}";if(t.length>Jo)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const r=n.map((([e,n])=>e+": "+Zo(n,t)));return"{ "+r.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const ea=globalThis.process&&"production"===globalThis.process.env.NODE_ENV?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if("object"==typeof e&&null!==e){var n;const r=t.prototype[Symbol.toStringTag];if(r===(Symbol.toStringTag in e?e[Symbol.toStringTag]:null===(n=e.constructor)||void 0===n?void 0:n.name)){const t=Wo(e);throw new Error(`Cannot use ${r} "${t}" from another module or realm.\n\nEnsure that there is only one instance of "graphql" in the node_modules\ndirectory. If different versions of "graphql" are the dependencies of other\nrelied on modules, use "resolutions" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate "graphql" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`)}}return!1};class ta{constructor(e,t="GraphQL request",n={line:1,column:1}){"string"==typeof e||so(!1,`Body must be a string. Received: ${Wo(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||so(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||so(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class na{constructor(e,t={}){const n=function(e){return ea(e,ta)}(e)?e:new ta(e);this._lexer=new Bo(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(Oo.NAME);return this.node(e,{kind:wo.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:wo.DOCUMENT,definitions:this.many(Oo.SOF,this.parseDefinition,Oo.EOF)})}parseDefinition(){if(this.peek(Oo.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===Oo.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw po(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(Oo.BRACE_L))return this.node(e,{kind:wo.OPERATION_DEFINITION,operation:bo.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(Oo.NAME)&&(n=this.parseName()),this.node(e,{kind:wo.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Oo.NAME);switch(e.value){case"query":return bo.QUERY;case"mutation":return bo.MUTATION;case"subscription":return bo.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Oo.PAREN_L,this.parseVariableDefinition,Oo.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:wo.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Oo.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Oo.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Oo.DOLLAR),this.node(e,{kind:wo.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:wo.SELECTION_SET,selections:this.many(Oo.BRACE_L,this.parseSelection,Oo.BRACE_R)})}parseSelection(){return this.peek(Oo.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,r;return this.expectOptionalToken(Oo.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:wo.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Oo.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Oo.PAREN_L,t,Oo.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(Oo.COLON),this.node(t,{kind:wo.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Oo.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(Oo.NAME)?this.node(e,{kind:wo.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:wo.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:wo.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:wo.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case Oo.BRACKET_L:return this.parseList(e);case Oo.BRACE_L:return this.parseObject(e);case Oo.INT:return this.advanceLexer(),this.node(t,{kind:wo.INT,value:t.value});case Oo.FLOAT:return this.advanceLexer(),this.node(t,{kind:wo.FLOAT,value:t.value});case Oo.STRING:case Oo.BLOCK_STRING:return this.parseStringLiteral();case Oo.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:wo.BOOLEAN,value:!0});case"false":return this.node(t,{kind:wo.BOOLEAN,value:!1});case"null":return this.node(t,{kind:wo.NULL});default:return this.node(t,{kind:wo.ENUM,value:t.value})}case Oo.DOLLAR:if(e){if(this.expectToken(Oo.DOLLAR),this._lexer.token.kind===Oo.NAME){const e=this._lexer.token.value;throw po(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:wo.STRING,value:e.value,block:e.kind===Oo.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:wo.LIST,values:this.any(Oo.BRACKET_L,(()=>this.parseValueLiteral(e)),Oo.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:wo.OBJECT,fields:this.any(Oo.BRACE_L,(()=>this.parseObjectField(e)),Oo.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(Oo.COLON),this.node(t,{kind:wo.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(Oo.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(Oo.AT),this.node(t,{kind:wo.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(Oo.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(Oo.BRACKET_R),t=this.node(e,{kind:wo.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(Oo.BANG)?this.node(e,{kind:wo.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:wo.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Oo.STRING)||this.peek(Oo.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.many(Oo.BRACE_L,this.parseOperationTypeDefinition,Oo.BRACE_R);return this.node(e,{kind:wo.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(Oo.COLON);const n=this.parseNamedType();return this.node(e,{kind:wo.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:wo.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:wo.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Oo.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Oo.BRACE_L,this.parseFieldDefinition,Oo.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(Oo.COLON);const i=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:wo.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:s})}parseArgumentDefs(){return this.optionalMany(Oo.PAREN_L,this.parseInputValueDef,Oo.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(Oo.COLON);const r=this.parseTypeReference();let i;this.expectOptionalToken(Oo.EQUALS)&&(i=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(e,{kind:wo.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:i,directives:s})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:wo.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:wo.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(Oo.EQUALS)?this.delimitedMany(Oo.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:wo.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i})}parseEnumValuesDefinition(){return this.optionalMany(Oo.BRACE_L,this.parseEnumValueDefinition,Oo.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:wo.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw po(this._lexer.source,this._lexer.token.start,`${ra(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:wo.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(Oo.BRACE_L,this.parseInputValueDef,Oo.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Oo.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(Oo.BRACE_L,this.parseOperationTypeDefinition,Oo.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:wo.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(e,{kind:wo.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:wo.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:wo.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:wo.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:wo.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:wo.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Oo.AT);const n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(e,{kind:wo.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:s})}parseDirectiveLocations(){return this.delimitedMany(Oo.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(vo,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new mo(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this.advanceLexer(),t;throw po(this._lexer.source,t.start,`Expected ${ia(e)}, found ${ra(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==Oo.NAME||t.value!==e)throw po(this._lexer.source,t.start,`Expected "${e}", found ${ra(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===Oo.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return po(this._lexer.source,t.start,`Unexpected ${ra(t)}.`)}any(e,t,n){this.expectToken(e);const r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);const r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(void 0!==e&&t.kind!==Oo.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw po(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function ra(e){const t=e.value;return ia(e.kind)+(null!=t?` "${t}"`:"")}function ia(e){return function(e){return e===Oo.BANG||e===Oo.DOLLAR||e===Oo.AMP||e===Oo.PAREN_L||e===Oo.PAREN_R||e===Oo.SPREAD||e===Oo.COLON||e===Oo.EQUALS||e===Oo.AT||e===Oo.BRACKET_L||e===Oo.BRACKET_R||e===Oo.BRACE_L||e===Oo.PIPE||e===Oo.BRACE_R}(e)?`"${e}"`:e}const sa=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function oa(e){return aa[e.charCodeAt(0)]}const aa=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],la=Object.freeze({});function ca(e,t){const n=e[t];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function ua(e){return function(e,t,n=yo){const r=new Map;for(const e of Object.values(wo))r.set(e,ca(t,e));let i,s,o,a=Array.isArray(e),l=[e],c=-1,u=[],d=e;const h=[],f=[];do{c++;const e=c===l.length,y=e&&0!==u.length;if(e){if(s=0===f.length?void 0:h[h.length-1],d=o,o=f.pop(),y)if(a){d=d.slice();let e=0;for(const[t,n]of u){const r=t-e;null===n?(d.splice(r,1),e++):d[r]=n}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[e,t]of u)d[e]=t}c=i.index,l=i.keys,u=i.edits,a=i.inArray,i=i.prev}else if(o){if(s=a?c:l[c],d=o[s],null==d)continue;h.push(s)}let A;if(!Array.isArray(d)){var p,m;Eo(d)||so(!1,`Invalid AST Node: ${Wo(d)}.`);const n=e?null===(p=r.get(d.kind))||void 0===p?void 0:p.leave:null===(m=r.get(d.kind))||void 0===m?void 0:m.enter;if(A=null==n?void 0:n.call(t,d,s,o,h,f),A===la)break;if(!1===A){if(!e){h.pop();continue}}else if(void 0!==A&&(u.push([s,A]),!e)){if(!Eo(A)){h.pop();continue}d=A}}var g;void 0===A&&y&&u.push([s,d]),e?h.pop():(i={inArray:a,index:c,keys:l,edits:u,prev:i},a=Array.isArray(d),l=a?d:null!==(g=n[d.kind])&&void 0!==g?g:[],c=-1,u=[],o&&f.push(o),o=d)}while(void 0!==i);return 0!==u.length?u[u.length-1][1]:e}(e,da)}const da={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>ha(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=pa("(",ha(e.variableDefinitions,", "),")"),n=ha([e.operation,ha([e.name,t]),ha(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+pa(" = ",n)+pa(" ",ha(r," "))},SelectionSet:{leave:({selections:e})=>fa(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=pa("",e,": ")+t;let o=s+pa("(",ha(n,", "),")");return o.length>80&&(o=s+pa("(\n",ma(ha(n,"\n")),"\n)")),ha([o,ha(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+pa(" ",ha(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>ha(["...",pa("on ",e),ha(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${pa("(",ha(n,", "),")")} on ${t} ${pa("",ha(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=1===r.length,s=r.length>1&&r.slice(1).every((e=>0===e.length||Do(e.charCodeAt(0)))),o=n.endsWith('\\"""'),a=e.endsWith('"')&&!o,l=e.endsWith("\\"),c=a||l,u=!i||e.length>70||c||s||o;let d="";const h=i&&Do(e.charCodeAt(0));return(u&&!h||s)&&(d+="\n"),d+=n,(u||c)&&(d+="\n"),'"""'+d+'"""'}(e):`"${e.replace(sa,oa)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+ha(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+ha(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+pa("(",ha(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>pa("",e,"\n")+ha(["schema",ha(t," "),fa(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>pa("",e,"\n")+ha(["scalar",t,ha(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>pa("",e,"\n")+ha(["type",t,pa("implements ",ha(n," & ")),ha(r," "),fa(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>pa("",e,"\n")+t+(ga(n)?pa("(\n",ma(ha(n,"\n")),"\n)"):pa("(",ha(n,", "),")"))+": "+r+pa(" ",ha(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>pa("",e,"\n")+ha([t+": "+n,pa("= ",r),ha(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>pa("",e,"\n")+ha(["interface",t,pa("implements ",ha(n," & ")),ha(r," "),fa(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>pa("",e,"\n")+ha(["union",t,ha(n," "),pa("= ",ha(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>pa("",e,"\n")+ha(["enum",t,ha(n," "),fa(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>pa("",e,"\n")+ha([t,ha(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>pa("",e,"\n")+ha(["input",t,ha(n," "),fa(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>pa("",e,"\n")+"directive @"+t+(ga(n)?pa("(\n",ma(ha(n,"\n")),"\n)"):pa("(",ha(n,", "),")"))+(r?" repeatable":"")+" on "+ha(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>ha(["extend schema",ha(e," "),fa(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>ha(["extend scalar",e,ha(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>ha(["extend type",e,pa("implements ",ha(t," & ")),ha(n," "),fa(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>ha(["extend interface",e,pa("implements ",ha(t," & ")),ha(n," "),fa(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>ha(["extend union",e,ha(t," "),pa("= ",ha(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>ha(["extend enum",e,ha(t," "),fa(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>ha(["extend input",e,ha(t," "),fa(n)]," ")}};function ha(e,t=""){var n;return null!==(n=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==n?n:""}function fa(e){return pa("{\n",ma(ha(e,"\n")),"\n}")}function pa(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function ma(e){return pa(" ",e.replace(/\n/g,"\n "))}function ga(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}const ya=e=>{let t;const n=e.definitions.filter((e=>"OperationDefinition"===e.kind));return 1===n.length&&(t=n[0]?.name?.value),t},Aa=e=>{if("string"==typeof e){let n;try{const r=new na(e,t).parseDocument();n=ya(r)}catch(e){}return{query:e,operationName:n}}var t;const n=ya(e);return{query:ua(e),operationName:n}};class Ea extends Error{constructor(e,t){super(`${Ea.extractMessage(e)}: ${JSON.stringify({response:e,request:t})}`),Object.setPrototypeOf(this,Ea.prototype),this.response=e,this.request=t,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,Ea)}static extractMessage(e){return e.errors?.[0]?.message??`GraphQL Error (Code: ${e.status})`}}const ba=e=>{let t={};return e&&("undefined"!=typeof Headers&&e instanceof Headers||C&&C.Headers&&e instanceof C.Headers?t=(e=>{const t={};return e.forEach(((e,n)=>{t[n]=e})),t})(e):Array.isArray(e)?e.forEach((([e,n])=>{e&&void 0!==n&&(t[e]=n)})):t=e),t},va=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),wa=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:o,fetchOptions:a,middleware:l}=t,c={...t.headers};let u,d="";"POST"===e?(u=Pa(r,i,s,a.jsonSerializer),"string"==typeof u&&(c["Content-Type"]="application/json")):d=(e=>{if(!Array.isArray(e.query)){const t=e,n=[`query=${encodeURIComponent(va(t.query))}`];return e.variables&&n.push(`variables=${encodeURIComponent(t.jsonSerializer.stringify(t.variables))}`),t.operationName&&n.push(`operationName=${encodeURIComponent(t.operationName)}`),n.join("&")}if(void 0!==e.variables&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce(((e,n,r)=>(e.push({query:va(n),variables:t.variables?t.jsonSerializer.stringify(t.variables[r]):void 0}),e)),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`})({query:r,variables:i,operationName:s,jsonSerializer:a.jsonSerializer??io});const h={method:e,headers:c,body:u,...a};let f=n,p=h;if(l){const e=await Promise.resolve(l({...h,url:n,operationName:s,variables:i})),{url:t,...r}=e;f=t,p=r}return d&&(f=`${f}?${d}`),await o(f,p)};class Oa{constructor(e,t={}){this.url=e,this.requestConfig=t,this.rawRequest=async(...e)=>{const[t,n,r]=e,i=((e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0})(t,n,r),{headers:s,fetch:o=B,method:a="POST",requestMiddleware:l,responseMiddleware:c,...u}=this.requestConfig,{url:d}=this;void 0!==i.signal&&(u.signal=i.signal);const{operationName:h}=Aa(i.query);return Da({url:d,query:i.query,variables:i.variables,headers:{...ba(Ta(s)),...ba(i.requestHeaders)},operationName:h,fetch:o,method:a,fetchOptions:u,middleware:l}).then((e=>(c&&c(e),e))).catch((e=>{throw c&&c(e),e}))}}async request(e,...t){const[n,r]=t,i=((e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0})(e,n,r),{headers:s,fetch:o=B,method:a="POST",requestMiddleware:l,responseMiddleware:c,...u}=this.requestConfig,{url:d}=this;void 0!==i.signal&&(u.signal=i.signal);const{query:h,operationName:f}=Aa(i.document);return Da({url:d,query:h,variables:i.variables,headers:{...ba(Ta(s)),...ba(i.requestHeaders)},operationName:f,fetch:o,method:a,fetchOptions:u,middleware:l}).then((e=>(c&&c(e),e.data))).catch((e=>{throw c&&c(e),e}))}batchRequests(e,t){const n=((e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0})(e,t),{headers:r,...i}=this.requestConfig;void 0!==n.signal&&(i.signal=n.signal);const s=n.documents.map((({document:e})=>Aa(e).query)),o=n.documents.map((({variables:e})=>e));return Da({url:this.url,query:s,variables:o,headers:{...ba(Ta(r)),...ba(n.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??B,method:this.requestConfig.method||"POST",fetchOptions:i,middleware:this.requestConfig.requestMiddleware}).then((e=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(e),e.data))).catch((e=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(e),e}))}setHeaders(e){return this.requestConfig.headers=e,this}setHeader(e,t){const{headers:n}=this.requestConfig;return n?n[e]=t:this.requestConfig.headers={[e]:t},this}setEndpoint(e){return this.url=e,this}}const Da=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=wa((e.method??"post").toUpperCase());const s=Array.isArray(e.query),o=await i(e),a=await _a(o,r.jsonSerializer??io),l=Array.isArray(a)?!a.some((({data:e})=>!e)):Boolean(a.data),c=Array.isArray(a)||!a.errors||Array.isArray(a.errors)&&!a.errors.length||"all"===r.errorPolicy||"ignore"===r.errorPolicy;if(o.ok&&c&&l){const{errors:e,...t}=(Array.isArray(a),a),n="ignore"===r.errorPolicy?t:a;return{...s?{data:n}:n,headers:o.headers,status:o.status}}throw new Ea({..."string"==typeof a?{error:a}:a,status:o.status,headers:o.headers},{query:t,variables:n})},Pa=(e,t,n,r)=>{const i=r??io;if(!Array.isArray(e))return i.stringify({query:e,variables:t,operationName:n});if(void 0!==t&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const s=e.reduce(((e,n,r)=>(e.push({query:n,variables:t?t[r]:void 0}),e)),[]);return i.stringify(s)},_a=async(e,t)=>{let n;return e.headers.forEach(((e,t)=>{"content-type"===t.toLowerCase()&&(n=e)})),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},Ta=e=>"function"==typeof e?e():e,Ia={url:"https://api.dodoex.io/frontend-graphql"};class Ra{constructor(e){const t=Object.assign(Object.assign({},Ia),e);this.url=t.url,this.getHeaders=t.getHeaders;const n=new Oa(this.url,{fetch:t.fetch,requestMiddleware:e=>{const t=new URL(e.url);return e.operationName&&t.searchParams.append("opname",e.operationName),Object.assign(Object.assign({},e),{url:t.toString()})}});this.client=n,this.setHeaders()}setHeaders(){return U(this,void 0,void 0,(function*(){var e;const t=yield null===(e=this.getHeaders)||void 0===e?void 0:e.call(this);t&&this.client.setHeaders(t)}))}getData(e,t){return U(this,void 0,void 0,(function*(){yield this.setHeaders();return this.client.request(e,t)}))}getQuery(e,...[t]){return{queryKey:["graphql","getQuery",e,t],queryFn:()=>U(this,void 0,void 0,(function*(){return yield this.getData(e.toString(),t)}))}}getInfiniteQuery(e,t,...[n]){return{queryKey:["graphql","getInfiniteQuery",t,e,n],queryFn:r=>U(this,[r],void 0,(function*({pageParam:r}){return yield this.getData(e.toString(),Object.assign(Object.assign({},n),{where:Object.assign(Object.assign({},null==n?void 0:n.where),{[t]:r})}))}))}}}const Ca={host:"https://api.dodoex.io",fetch:B};class Ba{constructor(e){const t=Object.assign(Object.assign({},Ca),e);this.host=t.host,this._getFetch=()=>t.fetch}getUrl(e,t){let n=`${this.host}/${e}`;return t&&(n=`${n}?${k.stringify(t)}`),n}responseProcessor(e){return U(this,void 0,void 0,(function*(){if(e.ok){const t=yield e.json();return{response:e,result:t}}throw new Error(`Response ${JSON.stringify(e)} failed`)}))}getJson(e,t,n){return U(this,void 0,void 0,(function*(){const r=this.getUrl(e,t),i=this._getFetch(),s=yield i(r,T({method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}},n));return this.responseProcessor(s)}))}postJson(e,t,n,r){return U(this,void 0,void 0,(function*(){const i=this.getUrl(e,n),s=this._getFetch(),o=yield s(i,T({method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:t?JSON.stringify(t):void 0},r));return this.responseProcessor(o)}))}}const ka={getIsV3Mining:e=>["DSP","GSP","LPTOKEN","V3CLASSICAL"].includes(e),singleSideLp:e=>["CLASSICAL","V3CLASSICAL","DPP"].includes(e),canOperateLiquidity(e,t,n,r){const i=null!=t?t:n;return!!(e&&i&&r)&&("DPP"!==e||i.toLocaleLowerCase()===r.toLocaleLowerCase())}};class Na extends String{constructor(e,t){super(e),this.value=e,this.__meta__=t}toString(){return this.value}}const xa={"\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n }\n ":new Na("\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n}\n "),"\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n }\n ":new Na("\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n}\n "),"\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n }\n":new Na("\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n}\n "),"\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new Na("\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new Na("\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ":new Na("\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n}\n "),"\n query FetchPoolList(\n $first: Int\n $where: Pair_filter\n $orderBy: Pair_orderBy\n ) {\n pairs(\n first: $first\n where: $where\n orderBy: $orderBy\n orderDirection: desc\n ) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n }\n ":new Na("\n query FetchPoolList($first: Int, $where: Pair_filter, $orderBy: Pair_orderBy) {\n pairs(first: $first, where: $where, orderBy: $orderBy, orderDirection: desc) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n}\n "),"\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n ":new Na("\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n}\n "),"\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n ":new Na("\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n}\n "),"\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n }\n ":new Na("\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n}\n "),"\n query FetchPool(\n $id: ID!\n $where: Pair_filter\n $liquidityWhere: Liquiditylist_filter\n ) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n }\n ":new Na("\n query FetchPool($id: ID!, $where: Pair_filter, $liquidityWhere: Liquiditylist_filter) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n}\n "),"\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n }\n ":new Na("\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n}\n "),"\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n }\n ":new Na("\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n}\n "),"\n query FetchPoolSwapList(\n $first: Int\n $skip: Int\n $where: Swap_filter\n $orderBy: Swap_orderBy\n $orderDirection: OrderDirection\n ) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n }\n ":new Na("\n query FetchPoolSwapList($first: Int, $skip: Int, $where: Swap_filter, $orderBy: Swap_orderBy, $orderDirection: OrderDirection) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n}\n "),"\n query FetchLiquidityPositions(\n $id: ID!\n $first: Int\n $skip: Int\n $where: LiquidityPosition_filter\n $miningWhere: LiquidityPosition_filter\n $orderBy: LiquidityPosition_orderBy\n $orderDirection: OrderDirection\n ) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n }\n ":new Na("\n query FetchLiquidityPositions($id: ID!, $first: Int, $skip: Int, $where: LiquidityPosition_filter, $miningWhere: LiquidityPosition_filter, $orderBy: LiquidityPosition_orderBy, $orderDirection: OrderDirection) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n}\n "),"\n query FetchPoolPairList(\n $first: Int\n $baseWhere: Pair_filter\n $quoteWhere: Pair_filter\n $orderBy: Pair_orderBy\n $orderDirection: OrderDirection\n ) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n }\n ":new Na("\n query FetchPoolPairList($first: Int, $baseWhere: Pair_filter, $quoteWhere: Pair_filter, $orderBy: Pair_orderBy, $orderDirection: OrderDirection) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n}\n "),"\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n }\n ":new Na("\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n}\n "),"\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n }\n ":new Na("\n query FetchNoticeCenterTransactionList($where: Notice_centertransactionListFilter) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n}\n "),"\n query FetchLiquidityLpPartnerRewards(\n $where: LiquidityLpPartnerRewardsInput\n ) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n }\n ":new Na("\n query FetchLiquidityLpPartnerRewards($where: LiquidityLpPartnerRewardsInput) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n}\n "),"\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n }\n ":new Na("\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n}\n ")};function Sa(e){var t;return null!==(t=xa[e])&&void 0!==t?t:{}}const La=Sa("\n query Ticks($where: Tick_filter, $skip: Int, $first: Int) {\n ticks(where: $where, skip: $skip, first: $first) {\n id\n poolAddress\n tickIdx\n liquidityNet\n price0\n price1\n }\n }\n");class Fa{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("AMMV3Api does not initialize the contractRequests");this.contractRequests=new ro(e.contractRequestsConfig)}}getPositions(e,t,n){return{queryKey:[no,"ammv3","getPositions",...arguments],enabled:!!e&&!!t,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.callMultiQuery(e,n.map((e=>({abiName:Js.NonfungiblePositionManager,contractAddress:t,method:"positions",params:e}))))}))}}getOwner(e,t,n){return{queryKey:[no,"ammv3","getOwner",...arguments],enabled:!!e&&!!t,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Js.NonfungiblePositionManager,contractAddress:t,method:"ownerOf",params:[n]})}))}}getBalanceOf(e,t,n){return{queryKey:[no,"ammv3","getBalanceOf",...arguments],enabled:!!e&&!!t&&!!n,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t||!n)return null;const r=yield this.contractRequests.batchCallQuery(e,{abiName:Js.NonfungiblePositionManager,contractAddress:t,method:"balanceOf",params:[n]});return new I(r.toString())}))}}getTokenOfOwnerByIndex(e,t,n){return{queryKey:[no,"ammv3","getTokenOfOwnerByIndex",...arguments],enabled:!!e&&!!t,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.callMultiQuery(e,n.map((e=>({abiName:Js.NonfungiblePositionManager,contractAddress:t,method:"tokenOfOwnerByIndex",params:e.map((e=>e.toString()))}))))}))}}getV3PoolSlot0(e,t){return{queryKey:[no,"ammv3","getSlot0",...arguments],enabled:!!e||!!t,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Js.UniswapV3Pool,contractAddress:t,method:"slot0",params:[]})}))}}getV3PoolLiquidity(e,t){return{queryKey:[no,"ammv3","getV3PoolLiquidity",...arguments],enabled:!!e||!!t,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Js.UniswapV3Pool,contractAddress:t,method:"liquidity",params:[]})}))}}getCollect(e,t,n,r){return{queryKey:[no,"ammv3","getCollect",...arguments],enabled:!!e||!!t,queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&t&&n&&r))return null;const i=ve.from(2).pow(128).sub(1);return yield this.contractRequests.callQuery(e,{abiName:Js.NonfungiblePositionManager,contractAddress:t,method:"collect",params:[{tokenId:n,recipient:r,amount0Max:i,amount1Max:i},{from:r}]})}))}}}Fa.graphql={AllV3TicksDocument:La},Fa.utils=ka,Fa.encode={};const Ma=(e,t)=>new R(ve.isBigNumber(e)?e.toString():e).div(10**t),qa={fetchPoolList:Sa("\n query FetchPoolList(\n $first: Int\n $where: Pair_filter\n $orderBy: Pair_orderBy\n ) {\n pairs(\n first: $first\n where: $where\n orderBy: $orderBy\n orderDirection: desc\n ) {\n id\n type\n creator\n owner\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n lastTradePrice\n feeBase\n feeQuote\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n }\n }\n "),fetchLiquidityList:Sa("\n query FetchLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n currentPage\n pageSize\n totalCount\n lqList {\n id\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n "),fetchMyLiquidityList:Sa("\n query FetchMyLiquidityList($where: Liquiditylist_filter) {\n liquidity_list(where: $where) {\n lqList {\n id\n liquidityPositions {\n id\n liquidityTokenBalance\n liquidityTokenInMining\n poolShare\n liquidityUSD\n tokenId\n outOfRange\n priceRange {\n token0LowerPrice\n token0UpperPrice\n token1LowerPrice\n token1UpperPrice\n }\n tickLower {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n tickUpper {\n id\n tickIdx\n liquidityGross\n liquidityNet\n price0\n price1\n }\n }\n pair {\n id\n chainId\n type\n lpFeeRate\n mtFeeRate\n creator\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n quoteToken {\n id\n symbol\n name\n decimals\n logoImg\n }\n tvl\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n volume24H\n }\n }\n }\n }\n "),fetchDashboardPairList:Sa("\n query FetchDashboardPairList($where: Dashboardtype_list_filter) {\n dashboard_pairs_list(where: $where) {\n list {\n chainId\n pairAddress\n poolType\n baseReserve\n quoteReserve\n totalFee\n baseAddress\n quoteAddress\n baseSymbol\n quoteSymbol\n tvl\n baseTvl\n quoteTvl\n baseTvlRate\n quoteTvlRate\n }\n }\n }\n "),fetchPool:Sa("\n query FetchPool(\n $id: ID!\n $where: Pair_filter\n $liquidityWhere: Liquiditylist_filter\n ) {\n pair(id: $id, where: $where) {\n id\n type\n creator\n owner\n traderCount\n volumeBaseToken\n volumeQuoteToken\n volumeUSD\n feeBase\n feeQuote\n mtFeeRate\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n baseLpToken {\n id\n symbol\n name\n decimals\n }\n quoteLpToken {\n id\n symbol\n name\n decimals\n }\n }\n liquidity_list(where: $liquidityWhere) {\n lqList {\n pair {\n apy {\n miningBaseApy\n miningQuoteApy\n transactionBaseApy\n transactionQuoteApy\n metromMiningApy\n }\n miningAddress\n }\n }\n }\n }\n "),fetchPoolDayData:Sa("\n query FetchPoolDayData($where: Dashboardday_filter) {\n dashboard_pairs_day_data(where: $where) {\n timestamp\n date\n volumeUsd\n feeUsd\n mtFeeUsd\n tvlUsd\n addresses\n }\n }\n "),fetchPoolDashboard:Sa("\n query FetchPoolDashboard($where: Dashboardpair_detail_filter) {\n dashboard_pairs_detail(where: $where) {\n fee\n volume\n totalFee\n totalMtFee\n totalVolume\n tvl\n turnover\n liquidity\n baseReserve\n quoteReserve\n baseVolume\n quoteVolume\n basePrice\n quotePrice\n price\n baseFee\n quoteFee\n baseMtFee\n quoteMtFee\n pair\n poolType\n baseVolumeCumulative\n quoteVolumeCumulative\n baseAddress\n baseSymbol\n quoteAddress\n quoteSymbol\n network\n pairAddress\n txes\n txesNear24h\n txUsers\n txUserNear24h\n mtFeeNear24h\n feeNear24h\n }\n }\n "),fetchPoolSwapList:Sa("\n query FetchPoolSwapList(\n $first: Int\n $skip: Int\n $where: Swap_filter\n $orderBy: Swap_orderBy\n $orderDirection: OrderDirection\n ) {\n swaps(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n timestamp\n from\n baseVolume\n quoteVolume\n feeBase\n feeQuote\n fromToken {\n id\n symbol\n name\n decimals\n }\n toToken {\n id\n symbol\n name\n decimals\n }\n amountIn\n amountOut\n }\n }\n "),fetchLiquidityPositions:Sa("\n query FetchLiquidityPositions(\n $id: ID!\n $first: Int\n $skip: Int\n $where: LiquidityPosition_filter\n $miningWhere: LiquidityPosition_filter\n $orderBy: LiquidityPosition_orderBy\n $orderDirection: OrderDirection\n ) {\n balance: liquidityPositions(\n first: $first\n skip: $skip\n where: $where\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenBalance\n }\n mining: liquidityPositions(\n first: $first\n skip: $skip\n where: $miningWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n liquidityTokenInMining\n }\n pair(id: $id) {\n lastTradePrice\n baseLpToken {\n id\n decimals\n }\n quoteLpToken {\n id\n decimals\n }\n baseToken {\n id\n symbol\n name\n decimals\n }\n quoteToken {\n id\n symbol\n name\n decimals\n }\n }\n }\n "),fetchPoolPairList:Sa("\n query FetchPoolPairList(\n $first: Int\n $baseWhere: Pair_filter\n $quoteWhere: Pair_filter\n $orderBy: Pair_orderBy\n $orderDirection: OrderDirection\n ) {\n basePairs: pairs(\n first: $first\n where: $baseWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n quotePairs: pairs(\n first: $first\n where: $quoteWhere\n orderBy: $orderBy\n orderDirection: $orderDirection\n ) {\n id\n type\n creator\n lpFeeRate\n i\n k\n baseReserve\n quoteReserve\n createdAtTimestamp\n lastTradePrice\n volumeUSD\n baseToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n quoteToken {\n id\n symbol\n name\n decimals\n usdPrice\n }\n }\n }\n ")};class Ua{QuerySellBase(e,t){try{let n;if(0===t.RStatus)n=this.ROneSellBase(e,t);else if(1===t.RStatus){const r=t.B0.minus(t.B),i=t.Q.minus(t.Q0);e.lt(r)?(n=this.RAboveSellBase(e,t),n.gt(i)&&(n=i)):n=e.eq(r)?i:i.plus(this.ROneSellBase(e.minus(r),t))}else n=this.RBelowSellBase(e,t);const r=n.multipliedBy(t.mtFeeRate),i=n.multipliedBy(t.lpFeeRate);return n.minus(r).minus(i)}catch(e){return new I(0)}}QuerySellQuote(e,t){try{let n;if(0===t.RStatus)n=this.ROneSellQuote(e,t);else if(1===t.RStatus)n=this.RAboveSellQuote(e,t);else{const r=t.B.minus(t.B0),i=t.Q0.minus(t.Q);e.lt(i)?(n=this.RBelowSellQuote(e,t),n.gt(r)&&(n=r)):n=e.eq(i)?r:r.plus(this.ROneSellQuote(e.minus(i),t))}const r=n.multipliedBy(t.mtFeeRate),i=n.multipliedBy(t.lpFeeRate);return n.minus(r).minus(i)}catch(e){return new I(0)}}GetMidPrice(e){if(2==e.RStatus){let t=e.Q0.multipliedBy(e.Q0).div(e.Q).div(e.Q);return t=new I(1).minus(e.k).plus(e.k.multipliedBy(t)),e.OraclePrice.div(t)}if(1==e.RStatus){let t=e.B0.multipliedBy(e.B0).div(e.B).div(e.B);return t=new I(1).minus(e.k).plus(e.k.multipliedBy(t)),e.OraclePrice.multipliedBy(t)}return e.OraclePrice}ROneSellBase(e,t){return Ha(t.Q0,t.Q0,e,t.OraclePrice,t.k)}ROneSellQuote(e,t){return Ha(t.B0,t.B0,e,new I(1).div(t.OraclePrice),t.k)}RAboveSellBase(e,t){return Va(t.B0,t.B.plus(e),t.B,t.OraclePrice,t.k)}RAboveSellQuote(e,t){return Ha(t.B0,t.B,e,new I(1).div(t.OraclePrice),t.k)}RBelowSellQuote(e,t){return Va(t.Q0,t.Q.plus(e),t.Q,new I(1).div(t.OraclePrice),t.k)}RBelowSellBase(e,t){return Ha(t.Q0,t.Q,e,t.OraclePrice,t.k)}}const Va=(e,t,n,r,i)=>{if(e.lte(0))throw new Error("TARGET_IS_ZERO");const s=r.multipliedBy(t.minus(n));if(i.eq(0))return s;const o=e.multipliedBy(e).div(t).div(n).multipliedBy(i);return s.multipliedBy(new I(1).minus(i).plus(o))},Ha=(e,t,n,r,i)=>{if(e.lte(0))throw new Error("TARGET_IS_ZERO");if(n.eq(0))return n;if(i.eq(0))return n.multipliedBy(r).gt(t)?t:n.multipliedBy(r);if(i.eq(1)){const i=r.multipliedBy(n).multipliedBy(t).div(e.multipliedBy(e));return t.multipliedBy(i).div(i.plus(1))}const s=i.multipliedBy(e).div(t).multipliedBy(e).plus(r.multipliedBy(n));let o,a=new I(1).minus(i).multipliedBy(t);a.gte(s)?(a=a.minus(s),o=!1):(a=s.minus(a),o=!0);let l=new I(4).multipliedBy(new I(1).minus(i)).multipliedBy(i).multipliedBy(e).multipliedBy(e);l=a.multipliedBy(a).plus(l).sqrt();const c=new I(2).multipliedBy(new I(1).minus(i));let u;return u=o?l.minus(a):a.plus(l),t.minus(u.div(c))},ja=(e,t,n,r)=>{if(e.eq(0))return new I(0);if(r.eq(0))return e.plus(n.multipliedBy(t));const i=r.multipliedBy(4).multipliedBy(n).multipliedBy(t).div(e).plus(1).sqrt().minus(1).div(r.multipliedBy(2)).plus(1);return e.multipliedBy(i)};class Qa{constructor(e){this.B=e.B,this.Q=e.Q,this.B0=e.B0,this.Q0=e.Q0,this.RStatus=e.R,this.OraclePrice=e.i,this.k=e.K,this.mtFeeRate=e.mtFeeRate,this.lpFeeRate=e.lpFeeRate}}function Ya(e,t){let n=new I(e.toString());return t&&(n=n.div(new I(10**t))),n.dp(t)}const Ga={DVM:Js.dvmPoolABI,DSP:Js.dvmPoolABI,GSP:Js.dvmPoolABI,LPTOKEN:Js.dvmPoolABI,CLASSICAL:Js.classicalPoolABI,V3CLASSICAL:Js.classicalPoolABI,DPP:Js.dppPoolABI};function Xa({poolAddress:e,type:t,typeMethodObject:n,params:r=[]}){const i=n[t];if(!i)return null;const s=Ga[t];return s?{abiName:s,contractAddress:e,method:i,params:r}:null}class $a{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequestsConfig)throw new Error("PoolApi does not initialize the contractRequests");this.contractRequests=new ro(e.contractRequestsConfig)}}getTotalBaseLpQuery(e,t,n,r){return{queryKey:[no,"pool","getTotalBaseLpQuery",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t||!n||void 0===r)return null;if("AMMV2"===n){const n=yield g(e,t);return new I(N(n,r))}const i=Xa({poolAddress:t,type:n,typeMethodObject:{DVM:"totalSupply",DSP:"totalSupply",GSP:"totalSupply",LPTOKEN:"totalSupply",CLASSICAL:"getTotalBaseCapital",V3CLASSICAL:"getTotalBaseCapital",DPP:null}});if(!i)return null;const s=yield this.contractRequests.batchCallQuery(e,i);return Ma(s,r)}))}}getTotalQuoteLpQuery(e,t,n,r){return{queryKey:[no,"pool","getTotalQuoteLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t||!n||void 0===r)return null;const i=Xa({poolAddress:t,type:n,typeMethodObject:{DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getTotalQuoteCapital",V3CLASSICAL:"getTotalQuoteCapital",DPP:null}});if(!i)return null;const s=yield this.contractRequests.batchCallQuery(e,i);return Ma(s,r)}))}}getUserBaseLpQuery(e,t,n,r,i){return{queryKey:[no,"pool","getUserBaseLp",...arguments],enabled:!!(e&&t&&n&&void 0!==r&&i),queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==r&&i))return null;if("AMMV2"===n){const n=yield y(e,t,i);return new I(N(n,r))}const s=Xa({poolAddress:t,type:n,typeMethodObject:{DVM:"balanceOf",DSP:"balanceOf",GSP:"balanceOf",LPTOKEN:"balanceOf",CLASSICAL:"getBaseCapitalBalanceOf",V3CLASSICAL:"getBaseCapitalBalanceOf",DPP:null},params:[i]});if(!s)return null;const o=yield this.contractRequests.batchCallQuery(e,s);return Ma(o,r)}))}}getUserQuoteLpQuery(e,t,n,r,i){return{queryKey:[no,"pool","getUserQuoteLp",...arguments],enabled:!!(e&&t&&n&&void 0!==r&&i),queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==r&&i))return null;const s=Xa({poolAddress:t,type:n,typeMethodObject:{DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getQuoteCapitalBalanceOf",V3CLASSICAL:"getQuoteCapitalBalanceOf",DPP:null},params:[i]});if(!s)return null;const o=yield this.contractRequests.batchCallQuery(e,s);return Ma(o,r)}))}}getReserveLpQuery(e,t,n,r,i){return"CLASSICAL"===n?this.getPMMStateQuery(e,t,n,r,i):{queryKey:[no,"pool","getReserveLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r&&void 0!==i,queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==r&&void 0!==i))return null;if("AMMV2"===n){const n=yield A(e,t);return{baseReserve:Ma(n._reserve0.toString(),r),quoteReserve:Ma(n._reserve1.toString(),i)}}const s=Xa({poolAddress:t,type:n,typeMethodObject:{DVM:"getVaultReserve",DSP:"getVaultReserve",GSP:"getVaultReserve",LPTOKEN:"getVaultReserve",CLASSICAL:null,V3CLASSICAL:null,DPP:"getVaultReserve"},params:[]});if(!s)return null;const o=yield this.contractRequests.batchCallQuery(e,s);return{baseReserve:Ma(o.baseReserve,r),quoteReserve:Ma(o.quoteReserve,i)}}))}}getClassicalTargetQuery(e,t,n,r,i){return{queryKey:[no,"pool","getClassicalTargetQuery",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r&&void 0!==i,queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==r&&void 0!==i&&["CLASSICAL","V3CLASSICAL"].includes(n)))return null;const s=yield this.contractRequests.batchCallQuery(e,{abiName:Js.classicalPoolABI,contractAddress:t,method:"getExpectedTarget",params:[]});return{baseTarget:Ma(s.baseTarget,r),quoteTarget:Ma(s.quoteTarget,i)}}))}}getTotalBaseMiningLpQuery(e,t,n,r,i){const s=!!n&&$a.utils.getIsV3Mining(n);return{queryKey:[no,"pool","getTotalBaseMiningLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==i&&(s||!!r),queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==i&&(s||r)))return null;let o;const a={DVM:"balanceOf",DSP:"totalSupply",GSP:"totalSupply",LPTOKEN:"totalSupply",CLASSICAL:"balanceOf",V3CLASSICAL:"totalSupply",DPP:null}[n];if(!a)return null;if(s)o={abiName:Js.v3MiningABI,contractAddress:t,method:a,params:[]};else{if(!r)return null;o={abiName:Js.dodoMiningABI,contractAddress:r,method:a,params:[t]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return Ma(l,i)}))}}getTotalQuoteMiningLpQuery(e,t,n,r,i){const s=!!n&&$a.utils.getIsV3Mining(n);return{queryKey:[no,"pool","getTotalQuoteMiningLp",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==i&&(s||!!r),queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t||!n||void 0===i)return null;let o;const a={DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"balanceOf",V3CLASSICAL:"totalSupply",DPP:null}[n];if(!a)return null;if(s)o={abiName:Js.v3MiningABI,contractAddress:t,method:a,params:[]};else{if(!r)return null;o={abiName:Js.dodoMiningABI,contractAddress:r,method:a,params:[t]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return Ma(l,i)}))}}getUserBaseMiningLpQuery(e,t,n,r,i,s){const o=!!n&&$a.utils.getIsV3Mining(n);return{queryKey:[no,"pool","getUserBaseMiningLp",...arguments],enabled:!!e&&!!s&&!!t&&!!n&&void 0!==i&&(o||!!r),queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&s&&t&&n&&void 0!==i))return null;let o;const a={DVM:"getUserLpBalance",DSP:"balanceOf",GSP:"balanceOf",LPTOKEN:"balanceOf",CLASSICAL:"getUserLpBalance",V3CLASSICAL:"balanceOf",DPP:null}[n];if(!a)return null;if($a.utils.getIsV3Mining(n))o={abiName:Js.v3MiningABI,contractAddress:t,method:a,params:[s]};else{if(!r)return null;o={abiName:Js.dodoMiningABI,contractAddress:t,method:a,params:[r,s]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return Ma(l,i)}))}}getUserQuoteMiningLpQuery(e,t,n,r,i,s){const o=!!n&&$a.utils.getIsV3Mining(n);return{queryKey:[no,"pool","getUserQuoteMiningLp",...arguments],enabled:!!e&&!!s&&!!t&&!!n&&void 0!==i&&(o||!!r),queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&s&&t&&n&&void 0!==i))return null;let o;const a={DVM:null,DSP:null,GSP:null,LPTOKEN:null,CLASSICAL:"getUserLpBalance",V3CLASSICAL:"balanceOf",DPP:null}[n];if(!a)return null;if($a.utils.getIsV3Mining(n))o={abiName:Js.v3MiningABI,contractAddress:t,method:a,params:[s]};else{if(!r)return null;o={abiName:Js.dodoMiningABI,contractAddress:t,method:a,params:[r,s]}}if(!o)return null;const l=yield this.contractRequests.batchCallQuery(e,o);return Ma(l,i)}))}}getLPFeeRateQuery(e,t,n){return{queryKey:[no,"pool","getLpFeeRateQuery",...arguments],enabled:!!e&&!!t&&!!n,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t||!n)return null;const r=yield this.contractRequests.batchCallQuery(e,{abiName:Js.dvmPoolABI,contractAddress:t,method:"_LP_FEE_RATE_",params:[]});return new I(r.toString()).div(10**18)}))}}getFeeRateQuery(e,t,n,r){return{queryKey:[no,"pool","getFeeRateQuery",...arguments],enabled:!!e&&!!t&&!!n,queryFn:()=>U(this,void 0,void 0,(function*(){var i;if(!e||!t||!n)return null;let s=new I(0),o=new I(0);if("CLASSICAL"===n){const{ROUTE_V1_DATA_FETCH:n}=M[e],r=yield this.contractRequests.batchCallQuery(e,{abiName:Js.DODOV1PmmHelperABI,contractAddress:n,method:"getPairDetail",params:[t]}),a=null===(i=null==r?void 0:r.res)||void 0===i?void 0:i[0];s=new I(a.lpFeeRate.toString()).div(10**18),o=new I(a.mtFeeRate.toString()).div(10**18)}else if("AMMV2"===n)if(E(e)&&b(e)){const n=yield v(e,t),r=Ma(n.toString(),4);s=r.times(.8),o=r.times(.2)}else s=new I(.003),o=new I(0);else{const n=yield this.contractRequests.batchCallQuery(e,{abiName:Js.dvmPoolABI,contractAddress:t,method:"getUserFeeRate",params:[null!=r?r:t]});s=new I(n.lpFeeRate.toString()).div(10**18),o=new I(n.mtFeeRate.toString()).div(10**18)}return{lpFeeRate:s,mtFeeRate:o}}))}}getPMMStateQuery(e,t,n,r,i){return{queryKey:[no,"pool","getPMMStateQuery",...arguments],enabled:!!e&&!!t&&!!n&&void 0!==r&&void 0!==i,queryFn:()=>U(this,void 0,void 0,(function*(){var s;if(!e||!t||!n||void 0===r||void 0===i)return null;if("AMMV2"===n||"AMMV3"===n)return null;let o=null;if("CLASSICAL"===n){const{ROUTE_V1_DATA_FETCH:n}=M[e],r=yield this.contractRequests.batchCallQuery(e,{abiName:Js.DODOV1PmmHelperABI,contractAddress:n,method:"getPairDetail",params:[t]});o=null===(s=null==r?void 0:r.res)||void 0===s?void 0:s[0]}else{if(!["DVM","DPP","LPTOKEN","DSP","GSP"].includes(n))throw new Error(`type: ${n} not supported`);o=yield this.contractRequests.batchCallQuery(e,{abiName:Js.dvmPoolABI,contractAddress:t,method:"getPMMStateForCall",params:[]})}if(!Array.isArray(o)||!o.length)throw new Error("queryResult is not valid.");const a=function(e,t,n){const r=Ya(e.i,18-t+n),i=Ya(e.K,18),s=Ya(e.B,t),o=Ya(e.Q,n),a=Ya(e.B0,t),l=Ya(e.Q0,n),c=parseInt(e.R.toString());let u,d;return e.lpFeeRate&&(u=Ya(e.lpFeeRate,18)),e.mtFeeRate&&(d=Ya(e.mtFeeRate,18)),{q:o,b:s,k:i,i:r,b0:a,q0:l,R:c,lpFeeRate:u,mtFeeRate:d}}(o,r,i);let l;if(a.q.isEqualTo(0)&&2===a.R||a.b.isEqualTo(0)&&(1===a.R||0===a.R));else{const e=new Ua,t=new Qa({Q:a.q,B:a.b,K:a.k,i:a.i,B0:a.b0,Q0:a.q0,R:a.R,mtFeeRate:new I(0),lpFeeRate:new I(0)});l=e.GetMidPrice(t),l.isNaN()&&(l=void 0)}return{midPrice:l,pmmParamsBG:a,baseReserve:a.b,quoteReserve:a.q}}))}}getDPPOwnerProxyAddressQuery(e,t){return{queryKey:[...arguments],enabled:!!e&&!!t,queryFn:()=>e&&t?this.contractRequests.batchCallQuery(e,{abiName:Js.IdodoV2,contractAddress:t,method:"_OWNER_",params:[]}):null}}getWithdrawBasePenaltyQuery(e,t,n,r){return{queryKey:[...arguments],enabled:!!(e&&t&&n&&r),queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&t&&n&&r))return null;const i=yield this.contractRequests.batchCallQuery(e,{abiName:Js.dodoPair,contractAddress:t,method:"getWithdrawBasePenalty",params:[n]});return Ma(i,r)}))}}}$a.graphql=qa,$a.utils=ka,$a.encode={createDSPPoolABI(e,t,n,r,i,s,o,a,l){return U(this,arguments,void 0,(function*(e,t,n,r,i,s,o,a,l,c=!1){const{DODO_DSP_PROXY:u}=M[e];return{to:u,data:yield Zs(Js.dodoDspProxy,"createDODOStablePair",[t.address,n.address,r,i,new I(s).div(1e4).multipliedBy(10**18).toString(),xe(new I(o).toString(),18-t.decimals+n.decimals).toString(),xe(new I(a).toString(),18).toString(),c,l])}}))},createGSPPoolABI(e,t,n,r,i,s,o,a,l,c){return U(this,void 0,void 0,(function*(){const{DODO_DSP_PROXY:u}=M[e];return{to:u,data:yield Zs(Js.dodoDspProxy,"createDODOGasSavingPair",[t,n.address,r.address,i,s,new I(o).div(1e4).multipliedBy(10**18).toString(),"0",xe(new I(a).toString(),18-n.decimals+r.decimals).toString(),xe(new I(l).toString(),18).toString(),"1000",c])}}))},createDVMPoolABI(e,t,n,r,i,s,o,a,l){return U(this,arguments,void 0,(function*(e,t,n,r,i,s,o,a,l,c=!1){const{DODO_PROXY:u}=M[e];return{to:u,data:yield Zs(Js.dodoProxyV2,"createDODOVendingMachine",[t.address,n.address,r,i,new I(s).div(1e4).multipliedBy(10**18).toString(),xe(new I(o).toString(),18-t.decimals+n.decimals).toString(),xe(new I(a).toString(),18).toString(),c,l])}}))},createDPPPoolABI(e,t,n,r,i,s,o,a,l){return U(this,arguments,void 0,(function*(e,t,n,r,i,s,o,a,l,c=!1){const{DODO_DPP_PROXY:u}=M[e];return{to:u,data:yield Zs(Js.dodoDppProxy,"createDODOPrivatePool",[t.address,n.address,r,i,new I(s).div(1e4).multipliedBy(10**18).toString(),xe(new I(o).toString(),18-t.decimals+n.decimals).toString(),xe(new I(a).toString(),18).toString(),c,l])}}))},removeDPPPoolABI(e,t,n,r,i,s,o,a,l,c){return U(this,void 0,void 0,(function*(){const u=new I(t).div(1e4).multipliedBy(10**18).toString(),d=xe(new I(n).toString(),18-l+c).toString(),h=xe(new I(r).toString(),18).toString(),f=yield Zs(Js.dodoDPPAdmin,"reset",["0x0000000000000000000000000000000000000000",u,d,h,i,s,o,a]);return{to:e,data:f}}))},resetDPPPoolABI(e,t,n,r,i,s,o,a,l,c,u,d,h,f,p){return U(this,void 0,void 0,(function*(){const{DODO_DPP_PROXY:m}=M[e],g=new I(n).div(1e4).multipliedBy(10**18).toString(),y=xe(new I(r).toString(),18-h+f).toString(),A=xe(new I(i).toString(),18).toString();return{to:m,data:yield Zs(Js.dodoDppProxy,"resetDODOPrivatePool",[t,[g,y,A],[s,o,a,l],d,c,u,p])}}))},addDSPLiquidityABI(e,t,n,r,i,s,o,a){return U(this,void 0,void 0,(function*(){if(!i||"0"===i)throw new Error("Invalid baseMinAmount");const{DODO_DSP_PROXY:l}=M[e];return{to:l,data:yield Zs(Js.dodoDspProxy,"addDSPLiquidity",[t,n,r,i,s,o,a])}}))},addDVMLiquidityABI(e,t,n,r,i,s,o,a){return U(this,void 0,void 0,(function*(){if(!i||"0"===i)throw new Error("Invalid baseMinAmount");const{DODO_PROXY:l}=M[e];return{to:l,data:yield Zs(Js.dodoProxyV2,"addDVMLiquidity",[t,n,r,i,s,o,a])}}))},removeDSPLiquidityABI(e,t,n,r,i,s,o,a){return U(this,void 0,void 0,(function*(){if(28!=e&&69!=e){const{CALLEE_HELPER:t}=M[e];o&&(n=t)}const l=yield Zs(Js.dodoDSP,"sellShares",[r,n,i,s,o?"0x00":"0x",a]);return{to:t,data:l}}))},removeDVMLiquidityABI(e,t,n,r,i,s,o,a){return U(this,void 0,void 0,(function*(){if(28!=e&&69!=e){const{CALLEE_HELPER:t}=M[e];o&&(n=t)}const l=yield Zs(Js.dodoDVM,"sellShares",[r,n,i,s,o?"0x00":"0x",a]);return{to:t,data:l}}))},addClassicalLiquidityABI(e,t,n,r,i,s,o,a){return U(this,void 0,void 0,(function*(){const{DODO_PROXY:l}=M[e];return{to:l,data:yield Zs(Js.dodoProxyV2,"addLiquidityToV1",[t,n,r,i,s,o,a])}}))},removeClassicalBaseABI(e,t,n,r){return U(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:i}=M[e];let s="",o="";return i?(o=i,s=yield Zs(Js.dodoV1PairProxy,"withdrawBase",[t,n,r])):(o=t,s=yield Zs(Js.dodoPair,"withdrawBase",[n])),{to:o,data:s}}))},removeMaxClassicalBaseABI(e,t,n){return U(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:r}=M[e];let i="",s="";return r?(s=r,i=yield Zs(Js.dodoV1PairProxy,"withdrawAllBase",[t,n])):(s=t,i=yield Zs(Js.dodoPair,"withdrawAllBase",[])),{to:s,data:i}}))},removeClassicalQuoteABI(e,t,n,r){return U(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:i}=M[e];let s="",o="";return i?(o=i,s=yield Zs(Js.dodoV1PairProxy,"withdrawQuote",[t,n,r])):(o=t,s=yield Zs(Js.dodoPair,"withdrawQuote",[n])),{to:o,data:s}}))},removeMaxClassicalQuoteABI(e,t,n){return U(this,void 0,void 0,(function*(){const{DODO_V1_PAIR_PROXY:r}=M[e];let i="",s="";return r?(s=r,i=yield Zs(Js.dodoV1PairProxy,"withdrawAllQuote",[t,n])):(s=t,i=yield Zs(Js.dodoPair,"withdrawAllQuote",[])),{to:s,data:i}}))}};const Ka=(e,t,n,r,i)=>{const s=r.multipliedBy(t.minus(n)),o=e.multipliedBy(e).div(t).div(n).multipliedBy(i);return s.multipliedBy(new R(1).minus(i).plus(o))},za=(e,t,n,r,i)=>{let s=new R(1).minus(i).multipliedBy(t);s=s.minus(i.multipliedBy(e).multipliedBy(e).div(t)),s=s.plus(n.multipliedBy(r));let o=new R(4).multipliedBy(new R(1).minus(i)).multipliedBy(i).multipliedBy(e).multipliedBy(e);o=s.multipliedBy(s).plus(o).sqrt();const a=new R(2).multipliedBy(new R(1).minus(i));return s.plus(o).div(a)},Ja=(e,t,n)=>{let r=new R(4).multipliedBy(t).multipliedBy(n).div(e);r=new R(1).plus(r).sqrt();const i=r.minus(new R(1)).div(t.multipliedBy(new R(2)));return e.multipliedBy(new R(1).plus(i))};R.config({EXPONENTIAL_AT:1e3,DECIMAL_PLACES:80});class Wa{getMidPrice(){if(0===this.RStatus)return this.i;const e=this.getExpectedTarget();if(1===this.RStatus){let t=e.base.div(this.B);return t=t.multipliedBy(t).multipliedBy(this.k).minus(this.k).plus(new R(1)),this.i.multipliedBy(t)}if(2===this.RStatus){let t=e.quote.div(this.Q);return t=t.multipliedBy(t).multipliedBy(this.k).minus(this.k).plus(new R(1)),this.i.div(t)}return this.i}getQuoteByMidPrice(e){if(1!==this.RStatus)throw new Error("No support is needed at the moment");const t=e.div(this.k.times(this.i)).plus(1).minus(new R(1).div(this.k)).times(this.B).times(this.B).sqrt();return this.i.times(this.k.div(this.B).times(t).times(t).plus(new R(1).minus(this.k.times(2)).times(t)).minus(new R(1).minus(this.k).times(this.B)))}getExpectedTarget(){let e,t;return e=this.B0,t=this.Q0,0===this.RStatus&&(e=this.B0,t=this.Q0),1===this.RStatus&&(t=this.Q0,e=Ja(this.B,this.k,this.Q.minus(this.Q0).div(this.i))),2===this.RStatus&&(e=this.B0,t=Ja(this.Q,this.k,this.B.minus(this.B0).multipliedBy(this.i))),{base:e,quote:t}}queryBuyBase(e){const t=e.multipliedBy(this.mtFeeRate),n=e.multipliedBy(this.lpFeeRate);e=e.plus(t).plus(n);const r=this.getExpectedTarget();let i=new R(0);if(0===this.RStatus)i=this.ROneBuyBase(e,r.base);else if(1===this.RStatus)i=this.RAboveBuyBase(e,r.base);else{const t=this.B.minus(r.base),n=r.quote.minus(this.Q);i=e.isLessThanOrEqualTo(t)?this.RBelowBuyBase(e,r.quote):n.plus(this.ROneBuyBase(e.minus(t),r.base))}return i}querySellBase(e){let t;const n=this.getExpectedTarget();if(0===this.RStatus)t=this.ROneSellBase(e,n.quote);else if(2===this.RStatus)t=this.RBelowSellBase(e,n.quote);else{const r=n.base.minus(this.B),i=this.Q.minus(n.quote);t=e.isLessThanOrEqualTo(r)?this.RAboveSellBase(e,n.base):i.plus(this.ROneSellBase(e.minus(r),n.quote))}const r=t.multipliedBy(this.mtFeeRate),i=t.multipliedBy(this.lpFeeRate);return t.minus(r).minus(i)}queryBuyQuote(e){const t=e.multipliedBy(this.mtFeeRate),n=e.multipliedBy(this.lpFeeRate);e=e.plus(t).plus(n);const r=this.getExpectedTarget();if(0===this.RStatus)return this.ROneBuyQuote(e,r.quote);if(2===this.RStatus)return this.RBelowBuyQuote(e,r.quote);const i=r.base.minus(this.B),s=this.Q.minus(r.quote);return e.isLessThanOrEqualTo(s)?this.RAboveBuyQuote(e,r.base):i.plus(this.ROneBuyQuote(e.minus(s),r.quote))}querySellQuote(e){let t;const n=this.getExpectedTarget();if(0===this.RStatus)t=this.ROneSellQuote(e,n.base);else if(1===this.RStatus)t=this.RAboveSellQuote(e,n.base);else{const r=this.B.minus(n.base),i=n.quote.minus(this.Q);t=e.isLessThanOrEqualTo(i)?this.RBelowSellQuote(e,n.quote):r.plus(this.ROneSellQuote(e.minus(i),n.base))}const r=t.multipliedBy(this.mtFeeRate),i=t.multipliedBy(this.lpFeeRate);return t.minus(r).minus(i)}getPriceDepth(e){const t=this.getExpectedTarget();let n,r;if(e.gt(this.i)){const i=e.div(this.i);n=t.base.div(i.minus(1).plus(this.k).div(this.k).sqrt()),r=this.ROneBuyBase(t.base.minus(n),t.base).plus(t.quote)}else{const i=this.i.div(e);r=t.quote.div(i.minus(1).plus(this.k).div(this.k).sqrt()),n=this.ROneBuyQuote(t.quote.minus(r),t.quote).plus(t.base)}return{baseAmount:this.B.minus(n).abs(),quoteAmount:this.Q.minus(r).abs(),isBuy:this.B.gt(n)}}getWithdrawBasePenalty(e){if(1===this.RStatus){const t=Ja(this.B,this.k,this.Q.minus(this.Q0).div(this.i)),n=Ja(this.B.minus(e),this.k,this.Q.minus(this.Q0).div(this.i));return t.minus(n).minus(e)}return new R(0)}getWithdrawQuotePenalty(e){if(2===this.RStatus){const t=Ja(this.Q,this.k,this.B.minus(this.B0).multipliedBy(this.i)),n=Ja(this.Q.minus(e),this.k,this.B.minus(this.B0).multipliedBy(this.i));return t.minus(n).minus(e)}return new R(0)}ROneBuyBase(e,t){return e.isGreaterThanOrEqualTo(t),Ka(t,t,t.minus(e),this.i,this.k)}ROneBuyQuote(e,t){return e.isGreaterThanOrEqualTo(t),Ka(t,t,t.minus(e),new R(1).div(this.i),this.k)}ROneSellBase(e,t){const n=za(t,t,this.i,e.negated(),this.k);return t.minus(n)}ROneSellQuote(e,t){const n=za(t,t,new R(1).div(this.i),e.negated(),this.k);return t.minus(n)}RAboveBuyBase(e,t){if(e.isGreaterThanOrEqualTo(this.B))throw new Error("RAbove Buy Base Amount Exceed Limitation");return Ka(t,this.B,this.B.minus(e),this.i,this.k)}RAboveSellBase(e,t){if(e.plus(this.B).isGreaterThan(t))throw new Error("RAbove Sell Base Amount Exceed Limitation");return Ka(t,this.B.plus(e),this.B,this.i,this.k)}RAboveBuyQuote(e,t){return za(t,this.B,new R(1).div(this.i),e,this.k).minus(this.B)}RAboveSellQuote(e,t){const n=za(t,this.B,new R(1).div(this.i),e.negated(),this.k);return this.B.minus(n)}RBelowBuyQuote(e,t){if(e.isGreaterThanOrEqualTo(this.Q))throw new Error("RBelow Buy Quote Amount Exceed Limitation");return Ka(t,this.Q,this.Q.minus(e),new R(1).div(this.i),this.k)}RBelowSellQuote(e,t){if(e.plus(this.Q).isGreaterThan(t))throw new Error("RBelow Sell Quote Amount Exceed Limitation");return Ka(t,this.Q.plus(e),this.Q,new R(1).div(this.i),this.k)}RBelowBuyBase(e,t){return za(t,this.Q,this.i,e,this.k).minus(this.Q)}RBelowSellBase(e,t){const n=za(t,this.Q,this.i,e.negated(),this.k);return this.Q.minus(n)}}function Za({q:e,b:t,k:n,i:r,q0:i,b0:s,R:o}){const a=new Wa;return a.B0=new I(s),a.Q0=new I(i),a.B=new I(t),a.Q=new I(e),a.i=new I(r),a.k=new I(n),a.RStatus=o,a.mtFeeRate=new I(0),a.lpFeeRate=new I(0),a}function el(e){return e&&/^#[a-f\d]{3,6}\s*[0-9]{1,3}%/i.test(e)?(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})\s*([0-9]{1,3})*%?$/i.exec(e),(t=n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:n[4]?Number(n[4])/100:1}:void 0)?`rgba(${t.r}, ${t.g}, ${t.b}, ${t.a})`:t):e;var t,n}var tl;!function(e){e.All="all"}(tl||(tl={}));class nl{constructor(e){this.restApiRequest=(null==e?void 0:e.restApiRequest)||new Ba}getWidgetTokenListConfig(e,t){return this.restApiRequest.getJson("/config-center/user/tokenlist/v2",{project:e,apikey:t})}convertConfigToSwapWidgetProps(e){var t,n,r,i,s,o,a,l;const c=[];let u,d=!0,h=!0;if(e.chains.forEach((e=>{e.fromTokens&&(d=!1),e.toTokens&&(h=!1)})),e.chains.forEach((({chainId:e,fromTokens:t,toTokens:n,tokens:r})=>{if(null==r?void 0:r.length){const i=Number(e);[{isAllChain:d,selectTokens:t,side:"from"},{isAllChain:h,selectTokens:n,side:"to"}].forEach((({isAllChain:e,selectTokens:t,side:n})=>{(e||t)&&((null==t?void 0:t.length)?r.forEach((e=>{var r;t.some((t=>t.toLocaleLowerCase()===e.address.toLocaleLowerCase()))&&c.push(Object.assign(Object.assign({logoURI:e.logoImg},e),{chainId:null!==(r=e.chainId)&&void 0!==r?r:i,side:n}))})):r.forEach((e=>{var t;c.push(Object.assign(Object.assign({logoURI:e.logoImg},e),{chainId:null!==(t=e.chainId)&&void 0!==t?t:i,side:n}))})))}))}})),(null==e?void 0:e.style)&&Object.keys(e.style).length){const n=null===(t=null==e?void 0:e.basis)||void 0===t?void 0:t.fontSizeModify;u={palette:{mode:"light",primary:{main:el(e.style.primary)},secondary:{main:el(e.style.secondary),contrastText:el(e.style.secondaryContrast)},error:{main:el(e.style.error),contrastText:el(e.style.errorContrast)},warning:{main:el(e.style.warning)},success:{main:el(e.style.success)},background:{paper:el(e.style.background1),paperContrast:el(e.style.background2),backdrop:el(e.style.mask),input:el(e.style.input),tag:el(e.style.card)},text:{primary:el(e.style.text1),secondary:el(e.style.text2),disabled:el(e.style.textDisable),placeholder:el(e.style.textPlaceholder)},border:{main:el(e.style.borderSolid),light:el(e.style.borderDash),disabled:el(e.style.borderSolid)}},typography:n?{fontSize:16+n,ht:{fontSize:36+n},h2:{fontSize:32+n},h3:{fontSize:28+n},caption:{fontSize:20+n},h5:{fontSize:18+n},body1:{fontSize:16+n},body2:{fontSize:14+n},h6:{fontSize:12+n},button:{fontSize:16+n}}:void 0}}const f=e.rebateAddress,p=e.rebateRatio,m=e.swapSlippage,g=e.crossChainSlippage,y=null===(n=e.basis)||void 0===n?void 0:n.width,A=null===(r=e.basis)||void 0===r?void 0:r.height,E=null===(i=e.basis)||void 0===i?void 0:i.locale,b=null===(o=null===(s=e.basis)||void 0===s?void 0:s.crossChainSupport)||void 0===o||o,v=null===(a=e.basis)||void 0===a?void 0:a.rpcMap,w=null===(l=e.basis)||void 0===l?void 0:l.noPowerBy;return{tokenList:c,theme:u,rebateAddress:f,rebateRatio:p,swapSlippage:m,bridgeSlippage:g,width:y,height:A,locale:E,crossChain:b,jsonRpcUrlMap:v,noPowerBy:w}}getConfigSwapWidgetProps(e,t){return U(this,void 0,void 0,(function*(){var n;const{result:r}=yield this.getWidgetTokenListConfig(e,t),i=r.data;if(!i)throw new Error(null!==(n=r.msg)&&void 0!==n?n:"Error");return{swapWidgetProps:this.convertConfigToSwapWidgetProps(i),configTokenList:i}}))}}const rl={fetchMiningList:Sa("\n query FetchMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n baseApy\n baseLpToken {\n decimals\n address: id\n symbol\n }\n baseToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n address: id\n symbol\n }\n quoteToken {\n decimals\n address: id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n address: id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n "),fetchMiningListV1:Sa("\n query MiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n miningTotalDollar\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n "),fetchMyCreatedMiningList:Sa("\n query MyCreatedMiningList($where: Miningmining_list_filter) {\n mining_list(where: $where) {\n list {\n chainId\n type\n version\n address\n isGSP\n isNewERCMineV3\n baseApy\n baseLpToken {\n decimals\n id\n symbol\n }\n baseToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n endBlock\n miningContractAddress\n baseLpTokenMining\n quoteLpTokenMining\n quoteApy\n quoteLpToken {\n decimals\n id\n symbol\n }\n quoteToken {\n decimals\n id\n price\n symbol\n logoImg\n }\n rewardTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n rewardQuoteTokenInfos {\n apy\n decimals\n id\n price\n logoImg\n rewardNumIndex\n rewardPerBlock\n startBlock\n endBlock\n startTime\n endTime\n symbol\n }\n startBlock\n title\n platform\n blockNumber\n participantsNum\n startTime\n endTime\n }\n totalCount\n chains\n }\n }\n ")};var il;!function(e){e[e.upcoming=0]="upcoming",e[e.active=1]="active",e[e.ended=2]="ended"}(il||(il={}));const sl={getMiningStatusByTimestamp:({startTime:e,endTime:t,rewardTokenInfoList:n})=>{let r,i;for(const s of n){const n=s.startTime||e,o=s.endTime||t;n&&(r=r?I.min(n,r):I.isBigNumber(n)?n:new I(n)),o&&(i=i?I.max(o,i):I.isBigNumber(o)?o:new I(o))}const s=new I(Math.floor(Date.now()/1e3));let o=il.ended;return r&&s.lt(r)&&(o=il.upcoming),r&&i&&s.gte(r)&&s.lte(i)&&(o=il.active),{status:o,firstStartTime:r,lastEndTime:i,currentTime:s}}},ol=[{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"claimAllRewards",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"stakeToken",type:"address"},{internalType:"bool",name:"isLpToken",type:"bool"},{internalType:"uint256",name:"platform",type:"uint256"},{internalType:"address[]",name:"rewardTokens",type:"address[]"},{internalType:"uint256[]",name:"rewardPerBlock",type:"uint256[]"},{internalType:"uint256[]",name:"startBlock",type:"uint256[]"},{internalType:"uint256[]",name:"endBlock",type:"uint256[]"}],name:"createDODOMineV3",outputs:[{internalType:"address",name:"newMineV3",type:"address"}],stateMutability:"nonpayable",type:"function"}],al=[{inputs:[{internalType:"address",name:"stakeToken",type:"address"},{internalType:"bool",name:"isLpToken",type:"bool"},{internalType:"address[]",name:"rewardTokens",type:"address[]"},{internalType:"uint256[]",name:"rewardPerBlock",type:"uint256[]"},{internalType:"uint256[]",name:"startBlock",type:"uint256[]"},{internalType:"uint256[]",name:"endBlock",type:"uint256[]"}],name:"createDODOMineV3",outputs:[{internalType:"address",name:"newMineV3",type:"address"}],stateMutability:"nonpayable",type:"function"}];class ll{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("MiningApi does not initialize the contractRequests");this.contractRequests=new ro(e.contractRequestsConfig)}}getPendingRewardQuery(e,t,n,r,i,s){return{queryKey:[no,"mining","getPendingRewardQuery",...arguments],enabled:!!(e&&t&&n&&r&&void 0!==i),queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&t&&n&&r&&void 0!==i))return null;let o;if("3"===s)o=yield this.contractRequests.batchCallQuery(e,{abiName:Js.v3MiningABI,contractAddress:t,method:"getPendingRewardByToken",params:[n,r]});else o=yield this.contractRequests.batchCallQuery(e,{abiName:Js.dodoMiningABI,contractAddress:t,method:"getPendingReward",params:[r,n]});return Ma(o,i)}))}}getLpStakedBalance(e,t,n,r,i,s){return{queryKey:[no,"mining","getLpStakedBalance",...arguments],enabled:!(!e||!t||!n||void 0===i||"3"!==s&&!r),queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&t&&n&&void 0!==i)||"3"!==s&&!r)return null;let o;if("3"===s)o=yield this.contractRequests.batchCallQuery(e,{abiName:Js.v3MiningABI,contractAddress:t,method:"balanceOf",params:[n]});else o=yield this.contractRequests.batchCallQuery(e,{abiName:Js.dodoMiningABI,contractAddress:t,method:"getUserLpBalance",params:[n,r]});return Ma(o,i)}))}}getRewardTokenInfos(e,t,n,r){return{queryKey:[no,"mining","getRewardTokenInfos",...arguments],enabled:null!=e&&null!=t&&null!=n&&!r,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t)return null;const r=yield this.contractRequests.batchCallQuery(e,{abiName:Js.v3MiningABI,contractAddress:t,method:"rewardTokenInfos",params:[n]});if(!r)return null;const{rewardVault:i,rewardPerBlock:s,workThroughReward:o,lastFlagBlock:a,startBlock:l,endBlock:c}=r;return{rewardVault:i,rewardPerBlock:Ma(s,0),workThroughReward:o?Ma(o,0):void 0,lastFlagBlock:a?Ma(a,0):void 0,startBlock:Ma(l,0),endBlock:Ma(c,0)}}))}}}ll.utils=sl,ll.graphql=rl,ll.encode={depositMining(e,t,n){return U(this,void 0,void 0,(function*(){const r=eo(ol,"deposit",[xe(t.dp(n,I.ROUND_FLOOR).toString(),n).toString()]);return{to:e,data:r}}))},withdrawMining(e,t,n){return U(this,void 0,void 0,(function*(){const r=eo(ol,"withdraw",[xe(t.dp(n,I.ROUND_FLOOR).toString(),n).toString()]);return{to:e,data:r}}))},claimAllMining(e){return U(this,void 0,void 0,(function*(){const t=eo(ol,"claimAllRewards",[]);return{to:e,data:t}}))},createDODOMineV3(e,t,n,r,i,s,o,a){return U(this,void 0,void 0,(function*(){const{DODO_MINEV3_PROXY:l}=M[e];if(!l)return null;let c;return c=[1,10,288,66,128,137,1285,42161,1313161554,43114].includes(e)?eo(al,"createDODOMineV3",[t,n,i,s,o,a]):eo(ol,"createDODOMineV3",[t,n,r,i,s,o,a]),{to:l,data:c}}))}};const cl={fetchErc20SwapCrossList:Sa("\n query FetchErc20SwapCrossChainList($where: Erc20listV2Filter) {\n erc20_swapCrossChainList(where: $where) {\n name\n address\n symbol\n decimals\n slippage\n chainId\n logoImg\n tokenlists {\n name\n status\n }\n domains {\n name\n }\n funcLabels {\n key\n }\n attributeLabels {\n key\n }\n }\n }\n "),fetchErc20ForecastSlippage:Sa("\n query FetchErc20ForecastSlippage($where: Erc20_extenderc20ExtendV2Filter) {\n erc20_extend_erc20ExtendV2(where: $where) {\n forecastSlippageList {\n forecastSlippage\n forecastValue\n confidenceRatio\n confidenceIntervalUpper\n confidenceIntervalLower\n }\n }\n }\n ")},ul=new I(2).pow(256).minus(1);function dl(e){return e?e.replaceAll("\0",""):e}class hl{constructor(e){if(e.contractRequests)this.contractRequests=e.contractRequests;else{if(!e.contractRequests)throw new Error("TokenApi does not initialize the contractRequests");this.contractRequests=new ro(e.contractRequestsConfig)}this.restApiRequest=(null==e?void 0:e.restApiRequest)||new Ba}getTokenDecimals(e,t){return{queryKey:["token","getTokenDecimals",null!=e?e:"",null==t?void 0:t.toLocaleLowerCase()],enabled:!!e&&!!t,queryFn:()=>U(this,void 0,void 0,(function*(){if(!e||!t)return null;return yield this.contractRequests.batchCallQuery(e,{abiName:Js.erc20ABI,contractAddress:t,method:"decimals",params:[]})}))}}getFiatPriceBatch(e,t){return this.restApiRequest.postJson("/frontend-v2-price-api/current/batch",{networks:e.map((e=>q[e.chainId])),addresses:e.map((e=>e.address)),symbols:e.map((e=>e.symbol)),isCache:!0},void 0,{headers:{"pass-key":t}})}getFetchTokenQuery(e,t,n,r){let i=r,s="";if(void 0!==e){const t=M[e];i||(i=null==t?void 0:t.DODO_APPROVE),s=null==t?void 0:t.ERC20_HELPER}return{queryKey:[no,"token","getFetchTokenQuery",null!=e?e:"",null==n?void 0:n.toLocaleLowerCase(),null==i?void 0:i.toLocaleLowerCase(),null==t?void 0:t.toLocaleLowerCase()],enabled:!!e&&!!t&&!!n,queryFn:()=>U(this,void 0,void 0,(function*(){if(!(e&&t&&n&&i))return null;const o=yield(e=>U(void 0,void 0,void 0,(function*(){let t=[];if(!t.length)switch(e){case x.MAINNET:t=(yield import("./eth-B9cviUl5.js")).default;break;case x.BSC:t=(yield import("./bsc-3D5wcqPq.js")).default}return t})))(e);if(o.includes(t))return null;const a=F[e];if(hl.utils.isSameAddress(t,a.address)){const t=yield this.contractRequests.getETHBalance(e,n);return{symbol:a.symbol,address:a.address,name:a.name,decimals:a.decimals,balance:t,allowance:ul,account:n,spender:r,chainId:e}}const l=yield this.contractRequests.batchCallQuery(e,{abiName:Js.erc20Helper,contractAddress:s,method:"isERC20",params:[t,n,i]}),{name:c,isOk:u}=l;if(u&&c){const n=parseInt(l.decimals,10),i=new I(10).pow(n),s=new I(l.allownance.toString()).div(i),o=new I(l.balance.toString()).div(i);return{address:t,decimals:n,symbol:dl(l.symbol),name:dl(c),balance:o,spender:r,allowance:s,chainId:e}}return null}))}}}hl.graphql=cl,hl.utils={isSameAddress:(e,t)=>{const n=e.length,r=t.length;if(0===n||0===r)return!1;if(n===r)return e.toLowerCase()===t.toLowerCase();const i=e.substring(2,n).toLowerCase(),s=t.substring(2,n).toLowerCase();return i.length>s.length?i.endsWith(s):s.endsWith(i)}},hl.encode={approveABI:(e,t)=>Zs(Js.erc20ABI,"approve",[e,t.toFixed()]),transferEncodeABI(e,t){return U(this,void 0,void 0,(function*(){return yield Zs(Js.erc20ABI,"transfer",[e,t])}))}};const fl={fetchUserSwapOrderHistories:Sa("\n query FetchUserSwapOrderHistories($where: User_swapswapFilter) {\n user_swap_orderHistories(where: $where) {\n count\n page\n list {\n chainId\n createdAt\n fromAmount\n fromTokenDecimals\n fromTokenPrice\n fromTokenSymbol\n fromTokenAddress\n fromTokenLogoImg\n hash\n status\n toAmount\n toTokenDecimals\n toTokenPrice\n toTokenSymbol\n toTokenAddress\n toTokenLogoImg\n minAmount\n nonce\n extra\n user\n }\n }\n }\n ")};class pl{constructor(){}}pl.graphql=fl;const ml={fetchNoticeCenterTransactionList:Sa("\n query FetchNoticeCenterTransactionList(\n $where: Notice_centertransactionListFilter\n ) {\n notice_center_transactionList(where: $where) {\n list {\n chainId\n createTime\n extend\n from\n id\n key\n type\n }\n count\n limit\n page\n }\n }\n "),fetchLiquidityLpPartnerRewards:Sa("\n query FetchLiquidityLpPartnerRewards(\n $where: LiquidityLpPartnerRewardsInput\n ) {\n liquidity_getLpPartnerRewards(where: $where) {\n partnerInfos {\n partner\n logo\n introduction\n link\n theme\n sort\n platform\n extra\n }\n partnerRewards {\n chainId\n pool\n partner\n reward\n type\n }\n }\n }\n "),fetchUserprofileReward:Sa("\n query FetchUserprofileReward($where: UserprofileReward_filter) {\n userprofile_reward(where: $where) {\n name_key\n token_address\n contract_address\n token_symbol\n locking\n version\n merkle {\n index\n amout\n proof\n }\n }\n }\n ")};class gl{constructor(){}}gl.graphql=ml;export{Js as ABIName,Fa as AMMV3Api,no as CONTRACT_QUERY_KEY,x as ChainId,ro as ContractRequests,Ra as GraphQLRequests,ll as MiningApi,il as MiningStatusE,Ua as PMMHelper,Wa as PMMModel,Qa as PMMState,$a as PoolApi,Ba as RestApiRequests,pl as SwapApi,nl as SwapWidgetApi,gl as SystemApi,hl as TokenApi,F as basicTokenMap,M as contractConfig,S as etherTokenAddress,Za as getPmmModel,q as platformIdMap,ja as solveQuadraticFunctionForTarget};
|