@snapshot-labs/snapshot.js 0.2.2 → 0.2.6
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/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/plugins/charts/index.d.ts +5 -0
- package/dist/plugins/commentBox/index.d.ts +5 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/rollup.cjs.config.dev.js +43 -0
- package/dist/rollup.config.dev.js +75 -0
- package/dist/sign/eip1271.d.ts +1 -1
- package/dist/sign/index.d.ts +2 -2
- package/dist/snapshot.cjs.js +73 -34
- package/dist/snapshot.esm.js +73 -34
- package/dist/snapshot.min.js +1 -1
- package/dist/strategies/aave-governance-power/index.d.ts +3 -0
- package/dist/strategies/aavegotchi/index.d.ts +6 -0
- package/dist/strategies/aavegotchi-agip/index.d.ts +3 -0
- package/dist/strategies/apescape/index.d.ts +6 -0
- package/dist/strategies/api/index.d.ts +6 -0
- package/dist/strategies/avn-balance-of-staked/index.d.ts +3 -0
- package/dist/strategies/badgeth/index.d.ts +3 -0
- package/dist/strategies/balance-of-with-min/index.d.ts +3 -0
- package/dist/strategies/balance-of-with-thresholds/index.d.ts +25 -0
- package/dist/strategies/balancer/index.d.ts +3 -0
- package/dist/strategies/balancer-delegation/index.d.ts +6 -0
- package/dist/strategies/balancer-smart-pool/index.d.ts +6 -0
- package/dist/strategies/balancer-unipool/index.d.ts +6 -0
- package/dist/strategies/brightid/index.d.ts +6 -0
- package/dist/strategies/cake/index.d.ts +3 -0
- package/dist/strategies/celer-sgn-delegation/index.d.ts +3 -0
- package/dist/strategies/comp-like-votes/index.d.ts +6 -0
- package/dist/strategies/contract-call/index.d.ts +6 -0
- package/dist/strategies/cream/index.d.ts +3 -0
- package/dist/strategies/ctoken/index.d.ts +3 -0
- package/dist/strategies/curio-cards-erc20-weighted/index.d.ts +3 -0
- package/dist/strategies/decentraland-estate-size/index.d.ts +3 -0
- package/dist/strategies/defidollar/index.d.ts +3 -0
- package/dist/strategies/delegation/index.d.ts +6 -0
- package/dist/strategies/dittomoney/index.d.ts +3 -0
- package/dist/strategies/ens-domains-owned/index.d.ts +3 -0
- package/dist/strategies/ens-reverse-record/index.d.ts +6 -0
- package/dist/strategies/erc1155-all-balances-of/index.d.ts +6 -0
- package/dist/strategies/erc1155-balance-of/index.d.ts +6 -0
- package/dist/strategies/erc1155-balance-of-cv/index.d.ts +6 -0
- package/dist/strategies/erc20-balance-of/index.d.ts +3 -0
- package/dist/strategies/erc20-balance-of-coeff/index.d.ts +3 -0
- package/dist/strategies/erc20-balance-of-cv/index.d.ts +6 -0
- package/dist/strategies/erc20-balance-of-delegation/index.d.ts +6 -0
- package/dist/strategies/erc20-balance-of-fixed-total/index.d.ts +6 -0
- package/dist/strategies/erc20-balance-of-quadratic-delegation/index.d.ts +6 -0
- package/dist/strategies/erc20-price/index.d.ts +3 -0
- package/dist/strategies/erc20-received/index.d.ts +10 -0
- package/dist/strategies/erc20-with-balance/index.d.ts +3 -0
- package/dist/strategies/erc721/index.d.ts +6 -0
- package/dist/strategies/erc721-enumerable/index.d.ts +3 -0
- package/dist/strategies/erc721-with-multiplier/index.d.ts +6 -0
- package/dist/strategies/erc721-with-tokenid/index.d.ts +21 -0
- package/dist/strategies/esd/index.d.ts +3 -0
- package/dist/strategies/esd-delegation/index.d.ts +6 -0
- package/dist/strategies/eth-balance/index.d.ts +6 -0
- package/dist/strategies/eth-philanthropy/index.d.ts +6 -0
- package/dist/strategies/eth-received/ElasticSearchTxResult.d.ts +71 -0
- package/dist/strategies/eth-received/index.d.ts +7 -0
- package/dist/strategies/eth-wallet-age/index.d.ts +3 -0
- package/dist/strategies/eth-with-balance/index.d.ts +3 -0
- package/dist/strategies/flashstake/index.d.ts +3 -0
- package/dist/strategies/frax-finance/index.d.ts +3 -0
- package/dist/strategies/governor-alpha/index.d.ts +6 -0
- package/dist/strategies/hopr-uni-lp-farm/index.d.ts +3 -0
- package/dist/strategies/ilv/index.d.ts +6 -0
- package/dist/strategies/impossible-finance/index.d.ts +6 -0
- package/dist/strategies/index.d.ts +243 -0
- package/dist/strategies/infinityprotocol-liquidity-pools/index.d.ts +3 -0
- package/dist/strategies/inverse-xinv/index.d.ts +6 -0
- package/dist/strategies/iotex-balance/index.d.ts +3 -0
- package/dist/strategies/iotex-staked-balance/index.d.ts +3 -0
- package/dist/strategies/liftkitchen/index.d.ts +3 -0
- package/dist/strategies/maker-ds-chief/index.d.ts +6 -0
- package/dist/strategies/masterchef/index.d.ts +3 -0
- package/dist/strategies/masterchef-pool-balance/index.d.ts +3 -0
- package/dist/strategies/masterchef-pool-balance-price/index.d.ts +6 -0
- package/dist/strategies/mithcash/index.d.ts +3 -0
- package/dist/strategies/modefi/index.d.ts +6 -0
- package/dist/strategies/modefi-staking/index.d.ts +6 -0
- package/dist/strategies/moloch/index.d.ts +6 -0
- package/dist/strategies/moloch-all/index.d.ts +6 -0
- package/dist/strategies/moloch-loot/index.d.ts +6 -0
- package/dist/strategies/multichain/index.d.ts +3 -0
- package/dist/strategies/multisig-owners/index.d.ts +6 -0
- package/dist/strategies/mushrooms/index.d.ts +6 -0
- package/dist/strategies/niu-staked/index.d.ts +6 -0
- package/dist/strategies/ocean-marketplace/index.d.ts +8 -0
- package/dist/strategies/ocean-marketplace/oceanUtils.d.ts +2 -0
- package/dist/strategies/ogn/index.d.ts +3 -0
- package/dist/strategies/opium/index.d.ts +3 -0
- package/dist/strategies/pagination/index.d.ts +3 -0
- package/dist/strategies/pancake/index.d.ts +6 -0
- package/dist/strategies/pepemon/index.d.ts +6 -0
- package/dist/strategies/piedao/index.d.ts +3 -0
- package/dist/strategies/planet-finance/index.d.ts +4 -0
- package/dist/strategies/pob-hash/index.d.ts +9 -0
- package/dist/strategies/rebased/index.d.ts +3 -0
- package/dist/strategies/ren-nodes/index.d.ts +3 -0
- package/dist/strategies/rnbw-balance/index.d.ts +3 -0
- package/dist/strategies/ruler-staked-lp/index.d.ts +6 -0
- package/dist/strategies/ruler-staked-token/index.d.ts +6 -0
- package/dist/strategies/saffron-finance/index.d.ts +6 -0
- package/dist/strategies/spookyswap/index.d.ts +6 -0
- package/dist/strategies/stablexswap/index.d.ts +6 -0
- package/dist/strategies/staked-keep/index.d.ts +3 -0
- package/dist/strategies/staked-uniswap/index.d.ts +6 -0
- package/dist/strategies/strategiesFull.d.ts +245 -0
- package/dist/strategies/sushiswap/index.d.ts +3 -0
- package/dist/strategies/synthetix/index.d.ts +3 -0
- package/dist/strategies/the-graph/baseStrategy.d.ts +4 -0
- package/dist/strategies/the-graph/graphUtils.d.ts +12 -0
- package/dist/strategies/the-graph/tokenLockWallets.d.ts +9 -0
- package/dist/strategies/the-graph-balance/balances.d.ts +2 -0
- package/dist/strategies/the-graph-balance/index.d.ts +6 -0
- package/dist/strategies/the-graph-delegation/delegators.d.ts +2 -0
- package/dist/strategies/the-graph-delegation/index.d.ts +6 -0
- package/dist/strategies/the-graph-indexing/index.d.ts +6 -0
- package/dist/strategies/the-graph-indexing/indexers.d.ts +2 -0
- package/dist/strategies/ticket/index.d.ts +6 -0
- package/dist/strategies/ticket-validity/index.d.ts +3 -0
- package/dist/strategies/tokenlon/index.d.ts +3 -0
- package/dist/strategies/tomb-finance/index.d.ts +6 -0
- package/dist/strategies/total-axion-shares/index.d.ts +3 -0
- package/dist/strategies/tranche-staking/index.d.ts +6 -0
- package/dist/strategies/tranche-staking-lp/index.d.ts +6 -0
- package/dist/strategies/tranche-staking-slice/index.d.ts +3 -0
- package/dist/strategies/typhoon/index.d.ts +3 -0
- package/dist/strategies/uni/index.d.ts +6 -0
- package/dist/strategies/unipool-same-token/index.d.ts +6 -0
- package/dist/strategies/unipool-univ2-lp/index.d.ts +6 -0
- package/dist/strategies/uniswap/index.d.ts +3 -0
- package/dist/strategies/whitelist/index.d.ts +6 -0
- package/dist/strategies/work/index.d.ts +6 -0
- package/dist/strategies/xcover/index.d.ts +6 -0
- package/dist/strategies/xdai-easy-staking/index.d.ts +3 -0
- package/dist/strategies/xdai-easy-staking/utils.d.ts +3 -0
- package/dist/strategies/xdai-posdao-staking/index.d.ts +3 -0
- package/dist/strategies/xdai-stake-delegation/index.d.ts +6 -0
- package/dist/strategies/xdai-stake-holders/index.d.ts +3 -0
- package/dist/strategies/xdai-stakers-and-holders/index.d.ts +3 -0
- package/dist/strategies/xrc20-balance-of/index.d.ts +3 -0
- package/dist/strategies/xseen/index.d.ts +6 -0
- package/dist/strategies/yearn-vault/index.d.ts +3 -0
- package/dist/strategies/zrx-voting-power/index.d.ts +3 -0
- package/dist/utils/contentHash.d.ts +28 -0
- package/package.json +2 -2
- package/src/client.ts +0 -0
- package/src/dist/index.js +14 -0
- package/src/dist/utils.js +291 -0
- package/src/networks/{fuse.png → 122.png} +0 -0
- package/src/networks/43114.png +0 -0
- package/src/networks.json +2 -2
- package/src/plugins/charts/index.ts +5 -0
- package/src/plugins/charts/logo.png +0 -0
- package/src/plugins/commentBox/index.ts +5 -0
- package/src/plugins/commentBox/logo.png +0 -0
- package/src/plugins/index.ts +5 -1
- package/src/plugins/safeSnap/dist/index.js +585 -0
- package/src/plugins/safeSnap/index.ts +22 -7
- package/src/sign/eip1271.ts +2 -2
- package/src/sign/index.ts +9 -5
- package/src/strategies/aave-governance-power/dist/index.js +110 -0
- package/src/strategies/aavegotchi/dist/index.js +156 -0
- package/src/strategies/aavegotchi-agip/dist/index.js +168 -0
- package/src/strategies/apescape/dist/index.js +164 -0
- package/src/strategies/api/dist/index.js +76 -0
- package/src/strategies/avn-balance-of-staked/dist/index.js +173 -0
- package/src/strategies/badgeth/dist/index.js +86 -0
- package/src/strategies/balance-of-with-min/dist/index.js +64 -0
- package/src/strategies/balance-of-with-thresholds/dist/index.js +73 -0
- package/src/strategies/balancer/dist/index.js +121 -0
- package/src/strategies/balancer-delegation/dist/index.js +62 -0
- package/src/strategies/balancer-smart-pool/dist/index.js +85 -0
- package/src/strategies/balancer-unipool/dist/index.js +141 -0
- package/src/strategies/brightid/dist/index.js +69 -0
- package/src/strategies/cake/dist/index.js +146 -0
- package/src/strategies/celer-sgn-delegation/dist/index.js +199 -0
- package/src/strategies/comp-like-votes/dist/index.js +91 -0
- package/src/strategies/contract-call/dist/index.js +76 -0
- package/src/strategies/cream/dist/index.js +310 -0
- package/src/strategies/ctoken/dist/index.js +145 -0
- package/src/strategies/curio-cards-erc20-weighted/dist/index.js +188 -0
- package/src/strategies/decentraland-estate-size/dist/index.js +101 -0
- package/src/strategies/defidollar/dist/index.js +106 -0
- package/src/strategies/delegation/dist/index.js +71 -0
- package/src/strategies/dist/index.js +248 -0
- package/src/strategies/dist/strategiesFull.js +246 -0
- package/src/strategies/dittomoney/dist/index.js +167 -0
- package/src/strategies/ens-domains-owned/dist/index.js +105 -0
- package/src/strategies/ens-reverse-record/dist/index.js +98 -0
- package/src/strategies/erc1155-all-balances-of/dist/index.js +99 -0
- package/src/strategies/erc1155-balance-of/dist/index.js +94 -0
- package/src/strategies/erc1155-balance-of-cv/dist/index.js +58 -0
- package/src/strategies/erc20-balance-of/dist/index.js +76 -0
- package/src/strategies/erc20-balance-of-delegation/dist/index.js +73 -0
- package/src/strategies/erc20-balance-of-quadratic-delegation/dist/index.js +75 -0
- package/src/strategies/erc20-price/dist/index.js +107 -0
- package/src/strategies/erc20-received/dist/index.js +166 -0
- package/src/strategies/erc20-with-balance/dist/index.js +61 -0
- package/src/strategies/erc721/dist/index.js +69 -0
- package/src/strategies/erc721-enumerable/dist/index.js +57 -0
- package/src/strategies/erc721-with-multiplier/dist/index.js +70 -0
- package/src/strategies/erc721-with-tokenid/dist/index.js +68 -0
- package/src/strategies/esd/dist/index.js +125 -0
- package/src/strategies/esd-delegation/dist/index.js +73 -0
- package/src/strategies/eth-balance/dist/index.js +72 -0
- package/src/strategies/eth-philanthropy/dist/index.js +81 -0
- package/src/strategies/eth-received/dist/index.js +127 -0
- package/src/strategies/eth-wallet-age/dist/index.js +126 -0
- package/src/strategies/eth-with-balance/dist/index.js +63 -0
- package/src/strategies/flashstake/dist/index.js +138 -0
- package/src/strategies/frax-finance/dist/index.js +236 -0
- package/src/strategies/governor-alpha/dist/index.js +71 -0
- package/src/strategies/hopr-uni-lp-farm/dist/index.js +232 -0
- package/src/strategies/ilv/dist/index.js +58 -0
- package/src/strategies/impossible-finance/dist/index.js +126 -0
- package/src/strategies/infinityprotocol-liquidity-pools/dist/index.js +120 -0
- package/src/strategies/inverse-xinv/dist/index.js +76 -0
- package/src/strategies/iotex-balance/dist/index.js +82 -0
- package/src/strategies/iotex-staked-balance/dist/index.js +79 -0
- package/src/strategies/liftkitchen/dist/index.js +167 -0
- package/src/strategies/masterchef/dist/index.js +183 -0
- package/src/strategies/masterchef-pool-balance/dist/index.js +190 -0
- package/src/strategies/masterchef-pool-balance-price/dist/index.js +442 -0
- package/src/strategies/mithcash/dist/index.js +133 -0
- package/src/strategies/modefi/dist/index.js +120 -0
- package/src/strategies/modefi-staking/dist/index.js +115 -0
- package/src/strategies/moloch-all/dist/index.js +154 -0
- package/src/strategies/moloch-loot/dist/index.js +153 -0
- package/src/strategies/multichain/dist/index.js +149 -0
- package/src/strategies/multisig-owners/dist/index.js +85 -0
- package/src/strategies/mushrooms/dist/index.js +202 -0
- package/src/strategies/niu-staked/dist/index.js +83 -0
- package/src/strategies/ocean-marketplace/dist/index.js +155 -0
- package/src/strategies/ogn/dist/index.js +105 -0
- package/src/strategies/opium/dist/index.js +153 -0
- package/src/strategies/pagination/dist/index.js +78 -0
- package/src/strategies/pancake/dist/index.js +140 -0
- package/src/strategies/pepemon/dist/index.js +177 -0
- package/src/strategies/piedao/dist/index.js +156 -0
- package/src/strategies/planet-finance/dist/index.js +190 -0
- package/src/strategies/pob-hash/dist/index.js +95 -0
- package/src/strategies/rebased/dist/index.js +134 -0
- package/src/strategies/ren-nodes/dist/index.js +148 -0
- package/src/strategies/rnbw-balance/dist/index.js +107 -0
- package/src/strategies/ruler-staked-lp/dist/index.js +156 -0
- package/src/strategies/ruler-staked-token/dist/index.js +100 -0
- package/src/strategies/saffron-finance/dist/index.js +293 -0
- package/src/strategies/spookyswap/dist/index.js +161 -0
- package/src/strategies/stablexswap/dist/index.js +153 -0
- package/src/strategies/staked-keep/dist/index.js +90 -0
- package/src/strategies/staked-uniswap/dist/index.js +112 -0
- package/src/strategies/sushiswap/dist/index.js +120 -0
- package/src/strategies/synthetix/dist/index.js +233 -0
- package/src/strategies/the-graph-balance/dist/index.js +55 -0
- package/src/strategies/the-graph-delegation/dist/index.js +55 -0
- package/src/strategies/the-graph-indexing/dist/index.js +55 -0
- package/src/strategies/ticket/dist/index.js +51 -0
- package/src/strategies/ticket-validity/dist/index.js +63 -0
- package/src/strategies/tokenlon/dist/index.js +211 -0
- package/src/strategies/tomb-finance/dist/index.js +130 -0
- package/src/strategies/total-axion-shares/dist/index.js +93 -0
- package/src/strategies/tranche-staking/dist/index.js +96 -0
- package/src/strategies/tranche-staking-lp/dist/index.js +133 -0
- package/src/strategies/tranche-staking-slice/dist/index.js +164 -0
- package/src/strategies/typhoon/dist/index.js +124 -0
- package/src/strategies/uni/dist/index.js +93 -0
- package/src/strategies/unipool-same-token/dist/index.js +98 -0
- package/src/strategies/unipool-univ2-lp/dist/index.js +105 -0
- package/src/strategies/uniswap/dist/index.js +120 -0
- package/src/strategies/whitelist/dist/index.js +56 -0
- package/src/strategies/work/dist/index.js +90 -0
- package/src/strategies/xcover/dist/index.js +95 -0
- package/src/strategies/xdai-easy-staking/dist/index.js +193 -0
- package/src/strategies/xdai-posdao-staking/dist/index.js +63 -0
- package/src/strategies/xdai-stake-delegation/dist/index.js +93 -0
- package/src/strategies/xdai-stake-holders/dist/index.js +63 -0
- package/src/strategies/xdai-stakers-and-holders/dist/index.js +137 -0
- package/src/strategies/xrc20-balance-of/dist/index.js +83 -0
- package/src/strategies/xseen/dist/index.js +121 -0
- package/src/strategies/zrx-voting-power/dist/index.js +104 -0
- package/src/utils/dist/provider.js +12 -0
- package/src/utils/dist/web3.js +73 -0
package/dist/snapshot.min.js
CHANGED
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
|| ${u} === "boolean" || ${o} === null`).assign(l,fu._`[${o}]`)}}i.else(),h(t),i.endIf(),i.if(fu._`${l} !== undefined`,()=>{i.assign(o,l),function({gen:t,parentData:e,parentDataProperty:r},i){t.if(fu._`${e} !== undefined`,()=>t.assign(fu._`${e}[${r}]`,i))}(t,l)})}(t,e,u):h(t)})}return l};const n=new Set(["string","number","integer","boolean","null"]);function o(t,e,i,n=r.Correct){const o=n===r.Correct?fu.operators.EQ:fu.operators.NEQ;let s;switch(t){case"null":return fu._`${e} ${o} null`;case"array":s=fu._`Array.isArray(${e})`;break;case"object":s=fu._`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=a(fu._`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=a();break;default:return fu._`typeof ${e} ${o} ${t}`}return n===r.Correct?s:fu.not(s);function a(t=fu.nil){return fu.and(fu._`typeof ${e} == "number"`,t,i?fu._`isFinite(${e})`:fu.nil)}}function s(t,e,r,i){if(1===t.length)return o(t[0],e,r,i);let n;const s=cu.toHash(t);if(s.array&&s.object){const t=fu._`typeof ${e} != "object"`;n=s.null?t:fu._`!${e} || ${t}`,delete s.null,delete s.array,delete s.object}else n=fu.nil;s.number&&delete s.integer;for(const t in s)n=fu.and(n,o(t,e,r,i));return n}e.checkDataType=o,e.checkDataTypes=s;const a={message:({schema:t})=>"must be "+t,params:({schema:t,schemaValue:e})=>"string"==typeof t?fu._`{type: ${t}}`:fu._`{type: ${e}}`};function h(t){const e=function(t){const{gen:e,data:r,schema:i}=t,n=cu.schemaRefOrVal(t,i,"type");return{gen:e,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:t}}(t);pu.reportError(e,a)}e.reportTypeError=h})),Mu=a((function(t,e){function r(t,e,r){const{gen:i,compositeRule:n,data:o,opts:s}=t;if(void 0===r)return;const a=fu._`${o}${fu.getProperty(e)}`;if(n)return void cu.checkStrictMode(t,"default is ignored for: "+a);let h=fu._`${a} === undefined`;"empty"===s.useDefaults&&(h=fu._`${h} || ${a} === null || ${a} === ""`),i.if(h,fu._`${a} = ${fu.stringify(r)}`)}Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0,e.assignDefaults=function(t,e){const{properties:i,items:n}=t.schema;if("object"===e&&i)for(const e in i)r(t,e,i[e].default);else"array"===e&&Array.isArray(n)&&n.forEach((e,i)=>r(t,i,e.default))}})),bu=a((function(t,e){function r(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:fu._`Object.prototype.hasOwnProperty`})}function i(t,e,i){return fu._`${r(t)}.call(${e}, ${i})`}function n(t,e,r,n){const o=fu._`${e}${fu.getProperty(r)} === undefined`;return n?fu.or(o,fu.not(i(t,e,r))):o}function o(t){return t?Object.keys(t).filter(t=>"__proto__"!==t):[]}Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0,e.checkReportMissingProp=function(t,e){const{gen:r,data:i,it:o}=t;r.if(n(r,i,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:fu._`${e}`},!0),t.error()})},e.checkMissingProp=function({gen:t,data:e,it:{opts:r}},i,o){return fu.or(...i.map(i=>fu.and(n(t,e,i,r.ownProperties),fu._`${o} = ${i}`)))},e.reportMissingProp=function(t,e){t.setParams({missingProperty:e},!0),t.error()},e.hasPropFunc=r,e.isOwnProperty=i,e.propertyInData=function(t,e,r,n){const o=fu._`${e}${fu.getProperty(r)} !== undefined`;return n?fu._`${o} && ${i(t,e,r)}`:o},e.noPropertyInData=n,e.allSchemaProperties=o,e.schemaProperties=function(t,e){return o(e).filter(r=>!cu.alwaysValidSchema(t,e[r]))},e.callValidateCode=function({schemaCode:t,data:e,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},a,h,u){const l=u?fu._`${t}, ${e}, ${i}${n}`:e,f=[[mu.default.instancePath,fu.strConcat(mu.default.instancePath,o)],[mu.default.parentData,s.parentData],[mu.default.parentDataProperty,s.parentDataProperty],[mu.default.rootData,mu.default.rootData]];s.opts.dynamicRef&&f.push([mu.default.dynamicAnchors,mu.default.dynamicAnchors]);const c=fu._`${l}, ${r.object(...f)}`;return h!==fu.nil?fu._`${a}.call(${h}, ${c})`:fu._`${a}(${c})`},e.usePattern=function({gen:t,it:{opts:e}},r){const i=e.unicodeRegExp?"u":"";return t.scopeValue("pattern",{key:r,ref:new RegExp(r,i),code:fu._`new RegExp(${r}, ${i})`})},e.validateArray=function(t){const{gen:e,data:r,keyword:i,it:n}=t,o=e.name("valid");if(n.allErrors){const t=e.let("valid",!0);return s(()=>e.assign(t,!1)),t}return e.var(o,!0),s(()=>e.break()),o;function s(n){const s=e.const("len",fu._`${r}.length`);e.forRange("i",0,s,r=>{t.subschema({keyword:i,dataProp:r,dataPropType:cu.Type.Num},o),e.if(fu.not(o),n)})}},e.validateUnion=function(t){const{gen:e,schema:r,keyword:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(t=>cu.alwaysValidSchema(n,t))&&!n.opts.unevaluated)return;const o=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((r,n)=>{const a=t.subschema({keyword:i,schemaProp:n,compositeRule:!0},s);e.assign(o,fu._`${o} || ${s}`);t.mergeValidEvaluated(a,s)||e.if(fu.not(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}})),Eu=a((function(t,e){function r(t){const{gen:e,data:r,it:i}=t;e.if(i.parentData,()=>e.assign(r,fu._`${i.parentData}[${i.parentDataProperty}]`))}function i(t,e,r){if(void 0===r)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:fu.stringify(r)})}Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0,e.macroKeywordCode=function(t,e){const{gen:r,keyword:n,schema:o,parentSchema:s,it:a}=t,h=e.macro.call(a.self,o,s,a),u=i(r,n,h);!1!==a.opts.validateSchema&&a.self.validateSchema(h,!0);const l=r.name("valid");t.subschema({schema:h,schemaPath:fu.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},l),t.pass(l,()=>t.error(!0))},e.funcKeywordCode=function(t,e){var n;const{gen:o,keyword:s,schema:a,parentSchema:h,$data:u,it:l}=t;!function({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}(l,e);const f=!u&&e.compile?e.compile.call(l.self,a,h,l):e.validate,c=i(o,s,f),d=o.let("valid");function m(r=(e.async?fu._`await `:fu.nil)){const i=l.opts.passContext?mu.default.this:mu.default.self,n=!("compile"in e&&!u||!1===e.schema);o.assign(d,fu._`${r}${bu.callValidateCode(t,c,i,n)}`,e.modifying)}function p(t){var r;o.if(fu.not(null!==(r=e.valid)&&void 0!==r?r:d),t)}t.block$data(d,(function(){if(!1===e.errors)m(),e.modifying&&r(t),p(()=>t.error());else{const i=e.async?function(){const t=o.let("ruleErrs",null);return o.try(()=>m(fu._`await `),e=>o.assign(d,!1).if(fu._`${e} instanceof ${l.ValidationError}`,()=>o.assign(t,fu._`${e}.errors`),()=>o.throw(e))),t}():function(){const t=fu._`${c}.errors`;return o.assign(t,null),m(fu.nil),t}();e.modifying&&r(t),p(()=>function(t,e){const{gen:r}=t;r.if(fu._`Array.isArray(${e})`,()=>{r.assign(mu.default.vErrors,fu._`${mu.default.vErrors} === null ? ${e} : ${mu.default.vErrors}.concat(${e})`).assign(mu.default.errors,fu._`${mu.default.vErrors}.length`),pu.extendErrors(t)},()=>t.error())}(t,i))}})),t.ok(null!==(n=e.valid)&&void 0!==n?n:d)},e.validSchemaType=function(t,e,r=!1){return!e.length||e.some(e=>"array"===e?Array.isArray(t):"object"===e?t&&"object"==typeof t&&!Array.isArray(t):typeof t==e||r&&void 0===t)},e.validateKeywordUsage=function({schema:t,opts:e,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");const s=n.dependencies;if(null==s?void 0:s.some(e=>!Object.prototype.hasOwnProperty.call(t,e)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(t[o])){const t=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if("log"!==e.validateSchema)throw new Error(t);r.logger.error(t)}}}})),_u=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0,e.getSubschema=function(t,{keyword:e,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(void 0!==e&&void 0!==i)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==e){const i=t.schema[e];return void 0===r?{schema:i,schemaPath:fu._`${t.schemaPath}${fu.getProperty(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:i[r],schemaPath:fu._`${t.schemaPath}${fu.getProperty(e)}${fu.getProperty(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${cu.escapeFragment(r)}`}}if(void 0!==i){if(void 0===n||void 0===o||void 0===s)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(t,e,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(void 0!==n&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:a}=e;if(void 0!==r){const{errorPath:n,dataPathArr:o,opts:s}=e;h(a.let("data",fu._`${e.data}${fu.getProperty(r)}`,!0)),t.errorPath=fu.str`${n}${cu.getErrorPath(r,i,s.jsPropertySyntax)}`,t.parentDataProperty=fu._`${r}`,t.dataPathArr=[...o,t.parentDataProperty]}if(void 0!==n){h(n instanceof fu.Name?n:a.let("data",n,!0)),void 0!==s&&(t.propertyName=s)}function h(r){t.data=r,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,r]}o&&(t.dataTypes=o)},e.extendSubschemaMode=function(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){void 0!==i&&(t.compositeRule=i),void 0!==n&&(t.createErrors=n),void 0!==o&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}})),Nu=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(e)){if((i=e.length)!=r.length)return!1;for(n=i;0!=n--;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((i=(o=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;0!=n--;){var s=o[n];if(!t(e[s],r[s]))return!1}return!0}return e!=e&&r!=r},Au=a((function(t){var e=t.exports=function(t,i,n){"function"==typeof i&&(n=i,i={}),function t(i,n,o,s,a,h,u,l,f,c){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var d in n(s,a,h,u,l,f,c),s){var m=s[d];if(Array.isArray(m)){if(d in e.arrayKeywords)for(var p=0;p<m.length;p++)t(i,n,o,m[p],a+"/"+d+"/"+p,h,a,d,s,p)}else if(d in e.propsKeywords){if(m&&"object"==typeof m)for(var g in m)t(i,n,o,m[g],a+"/"+d+"/"+r(g),h,a,d,s,g)}else(d in e.keywords||i.allKeys&&!(d in e.skipKeywords))&&t(i,n,o,m,a+"/"+d,h,a,d,s)}o(s,a,h,u,l,f,c)}}(i,"function"==typeof(n=i.cb||n)?n:n.pre||function(){},n.post||function(){},t,"",t)};function r(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}})),Su=a((function(t,e){!function(t){function e(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(e.length>1){e[0]=e[0].slice(0,-1);for(var i=e.length-1,n=1;n<i;++n)e[n]=e[n].slice(1,-1);return e[i]=e[i].slice(1),e.join("")}return e[0]}function r(t){return"(?:"+t+")"}function i(t){return void 0===t?"undefined":null===t?"null":Object.prototype.toString.call(t).split(" ").pop().split("]").shift().toLowerCase()}function n(t){return t.toUpperCase()}function o(t){return null!=t?t instanceof Array?t:"number"!=typeof t.length||t.split||t.setInterval||t.call?[t]:Array.prototype.slice.call(t):[]}function s(t,e){var r=t;if(e)for(var i in e)r[i]=e[i];return r}function a(t){var i="[A-Za-z]",n="[0-9]",o=e(n,"[A-Fa-f]"),s=r(r("%[EFef]"+o+"%"+o+o+"%"+o+o)+"|"+r("%[89A-Fa-f]"+o+"%"+o+o)+"|"+r("%"+o+o)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",h=e("[\\:\\/\\?\\#\\[\\]\\@]",a),u=t?"[\\uE000-\\uF8FF]":"[]",l=e(i,n,"[\\-\\.\\_\\~]",t?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),f=(r(i+e(i,n,"[\\+\\-\\.]")+"*"),r(r(s+"|"+e(l,a,"[\\:]"))+"*"),r(r("25[0-5]")+"|"+r("2[0-4]"+n)+"|"+r("1"+n+n)+"|"+r("0?[1-9]"+n)+"|0?0?"+n)),c=r(f+"\\."+f+"\\."+f+"\\."+f),d=r(o+"{1,4}"),m=r(r(d+"\\:"+d)+"|"+c),p=r(r(d+"\\:")+"{6}"+m),g=r("\\:\\:"+r(d+"\\:")+"{5}"+m),v=r(r(d)+"?\\:\\:"+r(d+"\\:")+"{4}"+m),y=r(r(r(d+"\\:")+"{0,1}"+d)+"?\\:\\:"+r(d+"\\:")+"{3}"+m),w=r(r(r(d+"\\:")+"{0,2}"+d)+"?\\:\\:"+r(d+"\\:")+"{2}"+m),M=r(r(r(d+"\\:")+"{0,3}"+d)+"?\\:\\:"+d+"\\:"+m),b=r(r(r(d+"\\:")+"{0,4}"+d)+"?\\:\\:"+m),E=r(r(r(d+"\\:")+"{0,5}"+d)+"?\\:\\:"+d),_=r(r(r(d+"\\:")+"{0,6}"+d)+"?\\:\\:"),N=r([p,g,v,y,w,M,b,E,_].join("|")),A=r(r(l+"|"+s)+"+"),S=(r("[vV]"+o+"+\\."+e(l,a,"[\\:]")+"+"),r(r(s+"|"+e(l,a))+"*"),r(s+"|"+e(l,a,"[\\:\\@]")));return r(r(s+"|"+e(l,a,"[\\@]"))+"+"),r(r(S+"|"+e("[\\/\\?]",u))+"*"),{NOT_SCHEME:new RegExp(e("[^]",i,n,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",l,a),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",l,a),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",l,a),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",l,a),"g"),NOT_QUERY:new RegExp(e("[^\\%]",l,a,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",l,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",l,a),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",l,h),"g"),PCT_ENCODED:new RegExp(s,"g"),IPV4ADDRESS:new RegExp("^("+c+")$"),IPV6ADDRESS:new RegExp("^\\[?("+N+")"+r(r("\\%25|\\%(?!"+o+"{2})")+"("+A+")")+"?\\]?$")}}var h=a(!1),u=a(!0),l=function(){function t(t,e){var r=[],i=!0,n=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);i=!0);}catch(t){n=!0,o=t}finally{try{!i&&a.return&&a.return()}finally{if(n)throw o}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)},c=2147483647,d=36,m=1,p=26,g=38,v=700,y=72,w=128,M="-",b=/^xn--/,E=/[^\0-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,N={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=d-m,S=Math.floor,R=String.fromCharCode;function x(t){throw new RangeError(N[t])}function I(t,e){for(var r=[],i=t.length;i--;)r[i]=e(t[i]);return r}function k(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+I((t=t.replace(_,".")).split("."),e).join(".")}function T(t){for(var e=[],r=0,i=t.length;r<i;){var n=t.charCodeAt(r++);if(n>=55296&&n<=56319&&r<i){var o=t.charCodeAt(r++);56320==(64512&o)?e.push(((1023&n)<<10)+(1023&o)+65536):(e.push(n),r--)}else e.push(n)}return e}var O=function(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:d},P=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},C=function(t,e,r){var i=0;for(t=r?S(t/v):t>>1,t+=S(t/e);t>A*p>>1;i+=d)t=S(t/A);return S(i+(A+1)*t/(t+g))},U=function(t){var e=[],r=t.length,i=0,n=w,o=y,s=t.lastIndexOf(M);s<0&&(s=0);for(var a=0;a<s;++a)t.charCodeAt(a)>=128&&x("not-basic"),e.push(t.charCodeAt(a));for(var h=s>0?s+1:0;h<r;){for(var u=i,l=1,f=d;;f+=d){h>=r&&x("invalid-input");var g=O(t.charCodeAt(h++));(g>=d||g>S((c-i)/l))&&x("overflow"),i+=g*l;var v=f<=o?m:f>=o+p?p:f-o;if(g<v)break;var b=d-v;l>S(c/b)&&x("overflow"),l*=b}var E=e.length+1;o=C(i-u,E,0==u),S(i/E)>c-n&&x("overflow"),n+=S(i/E),i%=E,e.splice(i++,0,n)}return String.fromCodePoint.apply(String,e)},F=function(t){var e=[],r=(t=T(t)).length,i=w,n=0,o=y,s=!0,a=!1,h=void 0;try{for(var u,l=t[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){var f=u.value;f<128&&e.push(R(f))}}catch(t){a=!0,h=t}finally{try{!s&&l.return&&l.return()}finally{if(a)throw h}}var g=e.length,v=g;for(g&&e.push(M);v<r;){var b=c,E=!0,_=!1,N=void 0;try{for(var A,I=t[Symbol.iterator]();!(E=(A=I.next()).done);E=!0){var k=A.value;k>=i&&k<b&&(b=k)}}catch(t){_=!0,N=t}finally{try{!E&&I.return&&I.return()}finally{if(_)throw N}}var O=v+1;b-i>S((c-n)/O)&&x("overflow"),n+=(b-i)*O,i=b;var U=!0,F=!1,B=void 0;try{for(var D,L=t[Symbol.iterator]();!(U=(D=L.next()).done);U=!0){var $=D.value;if($<i&&++n>c&&x("overflow"),$==i){for(var j=n,z=d;;z+=d){var q=z<=o?m:z>=o+p?p:z-o;if(j<q)break;var G=j-q,V=d-q;e.push(R(P(q+G%V,0))),j=S(G/V)}e.push(R(P(j,0))),o=C(n,O,v==g),n=0,++v}}}catch(t){F=!0,B=t}finally{try{!U&&L.return&&L.return()}finally{if(F)throw B}}++n,++i}return e.join("")},B=function(t){return k(t,(function(t){return b.test(t)?U(t.slice(4).toLowerCase()):t}))},D=function(t){return k(t,(function(t){return E.test(t)?"xn--"+F(t):t}))},L={version:"2.1.0",ucs2:{decode:T,encode:function(t){return String.fromCodePoint.apply(String,f(t))}},decode:U,encode:F,toASCII:D,toUnicode:B},$={};function j(t){var e=t.charCodeAt(0);return e<16?"%0"+e.toString(16).toUpperCase():e<128?"%"+e.toString(16).toUpperCase():e<2048?"%"+(e>>6|192).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase():"%"+(e>>12|224).toString(16).toUpperCase()+"%"+(e>>6&63|128).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase()}function z(t){for(var e="",r=0,i=t.length;r<i;){var n=parseInt(t.substr(r+1,2),16);if(n<128)e+=String.fromCharCode(n),r+=3;else if(n>=194&&n<224){if(i-r>=6){var o=parseInt(t.substr(r+4,2),16);e+=String.fromCharCode((31&n)<<6|63&o)}else e+=t.substr(r,6);r+=6}else if(n>=224){if(i-r>=9){var s=parseInt(t.substr(r+4,2),16),a=parseInt(t.substr(r+7,2),16);e+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&a)}else e+=t.substr(r,9);r+=9}else e+=t.substr(r,3),r+=3}return e}function q(t,e){function r(t){var r=z(t);return r.match(e.UNRESERVED)?r:t}return t.scheme&&(t.scheme=String(t.scheme).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_SCHEME,"")),void 0!==t.userinfo&&(t.userinfo=String(t.userinfo).replace(e.PCT_ENCODED,r).replace(e.NOT_USERINFO,j).replace(e.PCT_ENCODED,n)),void 0!==t.host&&(t.host=String(t.host).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_HOST,j).replace(e.PCT_ENCODED,n)),void 0!==t.path&&(t.path=String(t.path).replace(e.PCT_ENCODED,r).replace(t.scheme?e.NOT_PATH:e.NOT_PATH_NOSCHEME,j).replace(e.PCT_ENCODED,n)),void 0!==t.query&&(t.query=String(t.query).replace(e.PCT_ENCODED,r).replace(e.NOT_QUERY,j).replace(e.PCT_ENCODED,n)),void 0!==t.fragment&&(t.fragment=String(t.fragment).replace(e.PCT_ENCODED,r).replace(e.NOT_FRAGMENT,j).replace(e.PCT_ENCODED,n)),t}function G(t){return t.replace(/^0*(.*)/,"$1")||"0"}function V(t,e){var r=t.match(e.IPV4ADDRESS)||[],i=l(r,2)[1];return i?i.split(".").map(G).join("."):t}function Z(t,e){var r=t.match(e.IPV6ADDRESS)||[],i=l(r,3),n=i[1],o=i[2];if(n){for(var s=n.toLowerCase().split("::").reverse(),a=l(s,2),h=a[0],u=a[1],f=u?u.split(":").map(G):[],c=h.split(":").map(G),d=e.IPV4ADDRESS.test(c[c.length-1]),m=d?7:8,p=c.length-m,g=Array(m),v=0;v<m;++v)g[v]=f[v]||c[p+v]||"";d&&(g[m-1]=V(g[m-1],e));var y=g.reduce((function(t,e,r){if(!e||"0"===e){var i=t[t.length-1];i&&i.index+i.length===r?i.length++:t.push({index:r,length:1})}return t}),[]).sort((function(t,e){return e.length-t.length}))[0],w=void 0;if(y&&y.length>1){var M=g.slice(0,y.index),b=g.slice(y.index+y.length);w=M.join(":")+"::"+b.join(":")}else w=g.join(":");return o&&(w+="%"+o),w}return t}var K=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,H=void 0==="".match(/(){0}/)[1];function W(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i=!1!==e.iri?u:h;"suffix"===e.reference&&(t=(e.scheme?e.scheme+":":"")+"//"+t);var n=t.match(K);if(n){H?(r.scheme=n[1],r.userinfo=n[3],r.host=n[4],r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=n[7],r.fragment=n[8],isNaN(r.port)&&(r.port=n[5])):(r.scheme=n[1]||void 0,r.userinfo=-1!==t.indexOf("@")?n[3]:void 0,r.host=-1!==t.indexOf("//")?n[4]:void 0,r.port=parseInt(n[5],10),r.path=n[6]||"",r.query=-1!==t.indexOf("?")?n[7]:void 0,r.fragment=-1!==t.indexOf("#")?n[8]:void 0,isNaN(r.port)&&(r.port=t.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?n[4]:void 0)),r.host&&(r.host=Z(V(r.host,i),i)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",e.reference&&"suffix"!==e.reference&&e.reference!==r.reference&&(r.error=r.error||"URI is not a "+e.reference+" reference.");var o=$[(e.scheme||r.scheme||"").toLowerCase()];if(e.unicodeSupport||o&&o.unicodeSupport)q(r,i);else{if(r.host&&(e.domainHost||o&&o.domainHost))try{r.host=L.toASCII(r.host.replace(i.PCT_ENCODED,z).toLowerCase())}catch(t){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+t}q(r,h)}o&&o.parse&&o.parse(r,e)}else r.error=r.error||"URI can not be parsed.";return r}function J(t,e){var r=!1!==e.iri?u:h,i=[];return void 0!==t.userinfo&&(i.push(t.userinfo),i.push("@")),void 0!==t.host&&i.push(Z(V(String(t.host),r),r).replace(r.IPV6ADDRESS,(function(t,e,r){return"["+e+(r?"%25"+r:"")+"]"}))),"number"!=typeof t.port&&"string"!=typeof t.port||(i.push(":"),i.push(String(t.port))),i.length?i.join(""):void 0}var X=/^\.\.?\//,Y=/^\/\.(\/|$)/,Q=/^\/\.\.(\/|$)/,tt=/^\/?(?:.|\n)*?(?=\/|$)/;function et(t){for(var e=[];t.length;)if(t.match(X))t=t.replace(X,"");else if(t.match(Y))t=t.replace(Y,"/");else if(t.match(Q))t=t.replace(Q,"/"),e.pop();else if("."===t||".."===t)t="";else{var r=t.match(tt);if(!r)throw new Error("Unexpected dot segment condition");var i=r[0];t=t.slice(i.length),e.push(i)}return e.join("")}function rt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.iri?u:h,i=[],n=$[(e.scheme||t.scheme||"").toLowerCase()];if(n&&n.serialize&&n.serialize(t,e),t.host)if(r.IPV6ADDRESS.test(t.host));else if(e.domainHost||n&&n.domainHost)try{t.host=e.iri?L.toUnicode(t.host):L.toASCII(t.host.replace(r.PCT_ENCODED,z).toLowerCase())}catch(r){t.error=t.error||"Host's domain name can not be converted to "+(e.iri?"Unicode":"ASCII")+" via punycode: "+r}q(t,r),"suffix"!==e.reference&&t.scheme&&(i.push(t.scheme),i.push(":"));var o=J(t,e);if(void 0!==o&&("suffix"!==e.reference&&i.push("//"),i.push(o),t.path&&"/"!==t.path.charAt(0)&&i.push("/")),void 0!==t.path){var s=t.path;e.absolutePath||n&&n.absolutePath||(s=et(s)),void 0===o&&(s=s.replace(/^\/\//,"/%2F")),i.push(s)}return void 0!==t.query&&(i.push("?"),i.push(t.query)),void 0!==t.fragment&&(i.push("#"),i.push(t.fragment)),i.join("")}function it(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={};return arguments[3]||(t=W(rt(t,r),r),e=W(rt(e,r),r)),!(r=r||{}).tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=et(e.path||""),i.query=e.query):(void 0!==e.userinfo||void 0!==e.host||void 0!==e.port?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=et(e.path||""),i.query=e.query):(e.path?("/"===e.path.charAt(0)?i.path=et(e.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path:i.path="/"+e.path,i.path=et(i.path)),i.query=e.query):(i.path=t.path,void 0!==e.query?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function nt(t,e,r){var i=s({scheme:"null"},r);return rt(it(W(t,i),W(e,i),i,!0),i)}function ot(t,e){return"string"==typeof t?t=rt(W(t,e),e):"object"===i(t)&&(t=W(rt(t,e),e)),t}function st(t,e,r){return"string"==typeof t?t=rt(W(t,r),r):"object"===i(t)&&(t=rt(t,r)),"string"==typeof e?e=rt(W(e,r),r):"object"===i(e)&&(e=rt(e,r)),t===e}function at(t,e){return t&&t.toString().replace(e&&e.iri?u.ESCAPE:h.ESCAPE,j)}function ht(t,e){return t&&t.toString().replace(e&&e.iri?u.PCT_ENCODED:h.PCT_ENCODED,z)}var ut={scheme:"http",domainHost:!0,parse:function(t,e){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t},serialize:function(t,e){var r="https"===String(t.scheme).toLowerCase();return t.port!==(r?443:80)&&""!==t.port||(t.port=void 0),t.path||(t.path="/"),t}},lt={scheme:"https",domainHost:ut.domainHost,parse:ut.parse,serialize:ut.serialize};function ft(t){return"boolean"==typeof t.secure?t.secure:"wss"===String(t.scheme).toLowerCase()}var ct={scheme:"ws",domainHost:!0,parse:function(t,e){var r=t;return r.secure=ft(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(t,e){if(t.port!==(ft(t)?443:80)&&""!==t.port||(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){var r=t.resourceName.split("?"),i=l(r,2),n=i[0],o=i[1];t.path=n&&"/"!==n?n:void 0,t.query=o,t.resourceName=void 0}return t.fragment=void 0,t}},dt={scheme:"wss",domainHost:ct.domainHost,parse:ct.parse,serialize:ct.serialize},mt={},pt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",gt="[0-9A-Fa-f]",vt=r(r("%[EFef]"+gt+"%"+gt+gt+"%"+gt+gt)+"|"+r("%[89A-Fa-f]"+gt+"%"+gt+gt)+"|"+r("%"+gt+gt)),yt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",wt=e("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),Mt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",bt=new RegExp(pt,"g"),Et=new RegExp(vt,"g"),_t=new RegExp(e("[^]",yt,"[\\.]",'[\\"]',wt),"g"),Nt=new RegExp(e("[^]",pt,Mt),"g"),At=Nt;function St(t){var e=z(t);return e.match(bt)?e:t}var Rt={scheme:"mailto",parse:function(t,e){var r=t,i=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var n=!1,o={},s=r.query.split("&"),a=0,h=s.length;a<h;++a){var u=s[a].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),f=0,c=l.length;f<c;++f)i.push(l[f]);break;case"subject":r.subject=ht(u[1],e);break;case"body":r.body=ht(u[1],e);break;default:n=!0,o[ht(u[0],e)]=ht(u[1],e)}}n&&(r.headers=o)}r.query=void 0;for(var d=0,m=i.length;d<m;++d){var p=i[d].split("@");if(p[0]=ht(p[0]),e.unicodeSupport)p[1]=ht(p[1],e).toLowerCase();else try{p[1]=L.toASCII(ht(p[1],e).toLowerCase())}catch(t){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+t}i[d]=p.join("@")}return r},serialize:function(t,e){var r=t,i=o(t.to);if(i){for(var s=0,a=i.length;s<a;++s){var h=String(i[s]),u=h.lastIndexOf("@"),l=h.slice(0,u).replace(Et,St).replace(Et,n).replace(_t,j),f=h.slice(u+1);try{f=e.iri?L.toUnicode(f):L.toASCII(ht(f,e).toLowerCase())}catch(t){r.error=r.error||"Email address's domain name can not be converted to "+(e.iri?"Unicode":"ASCII")+" via punycode: "+t}i[s]=l+"@"+f}r.path=i.join(",")}var c=t.headers=t.headers||{};t.subject&&(c.subject=t.subject),t.body&&(c.body=t.body);var d=[];for(var m in c)c[m]!==mt[m]&&d.push(m.replace(Et,St).replace(Et,n).replace(Nt,j)+"="+c[m].replace(Et,St).replace(Et,n).replace(At,j));return d.length&&(r.query=d.join("&")),r}},xt=/^([^\:]+)\:(.*)/,It={scheme:"urn",parse:function(t,e){var r=t.path&&t.path.match(xt),i=t;if(r){var n=e.scheme||i.scheme||"urn",o=r[1].toLowerCase(),s=r[2],a=n+":"+(e.nid||o),h=$[a];i.nid=o,i.nss=s,i.path=void 0,h&&(i=h.parse(i,e))}else i.error=i.error||"URN can not be parsed.";return i},serialize:function(t,e){var r=e.scheme||t.scheme||"urn",i=t.nid,n=r+":"+(e.nid||i),o=$[n];o&&(t=o.serialize(t,e));var s=t,a=t.nss;return s.path=(i||e.nid)+":"+a,s}},kt=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Tt={scheme:"urn:uuid",parse:function(t,e){var r=t;return r.uuid=r.nss,r.nss=void 0,e.tolerant||r.uuid&&r.uuid.match(kt)||(r.error=r.error||"UUID is not valid."),r},serialize:function(t,e){var r=t;return r.nss=(t.uuid||"").toLowerCase(),r}};$[ut.scheme]=ut,$[lt.scheme]=lt,$[ct.scheme]=ct,$[dt.scheme]=dt,$[Rt.scheme]=Rt,$[It.scheme]=It,$[Tt.scheme]=Tt,t.SCHEMES=$,t.pctEncChar=j,t.pctDecChars=z,t.parse=W,t.removeDotSegments=et,t.serialize=rt,t.resolveComponents=it,t.resolve=nt,t.normalize=ot,t.equal=st,t.escapeComponent=at,t.unescapeComponent=ht,Object.defineProperty(t,"__esModule",{value:!0})}(e)})),Ru=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;const r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);e.inlineRef=function(t,e=!0){return"boolean"==typeof t||(!0===e?!n(t):!!e&&function t(e){let i=0;for(const n in e){if("$ref"===n)return 1/0;if(i++,!r.has(n)&&("object"==typeof e[n]&&cu.eachItem(e[n],e=>i+=t(e)),i===1/0))return 1/0}return i}(t)<=e)};const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function n(t){for(const e in t){if(i.has(e))return!0;const r=t[e];if(Array.isArray(r)&&r.some(n))return!0;if("object"==typeof r&&n(r))return!0}return!1}function o(t="",e){!1!==e&&(t=h(t));return s(Su.parse(t))}function s(t){return Su.serialize(t).split("#")[0]+"#"}e.getFullPath=o,e._getFullPath=s;const a=/#\/?$/;function h(t){return t?t.replace(a,""):""}e.normalizeId=h,e.resolveUrl=function(t,e){return e=h(e),Su.resolve(t,e)};const u=/^[a-z_][-a-z0-9._]*$/i;e.getSchemaRefs=function(t){if("boolean"==typeof t)return{};const{schemaId:e}=this.opts,r=h(t[e]),i={"":r},n=o(r,!1),s={},a=new Set;return Au(t,{allKeys:!0},(t,r,o,c)=>{if(void 0===c)return;const d=n+r;let m=i[c];function p(e){if(e=h(m?Su.resolve(m,e):e),a.has(e))throw f(e);a.add(e);let r=this.refs[e];return"string"==typeof r&&(r=this.refs[r]),"object"==typeof r?l(t,r.schema,e):e!==h(d)&&("#"===e[0]?(l(t,s[e],e),s[e]=t):this.refs[e]=d),e}function g(t){if("string"==typeof t){if(!u.test(t))throw new Error(`invalid anchor "${t}"`);p.call(this,"#"+t)}}"string"==typeof t[e]&&(m=p.call(this,t[e])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),i[r]=m}),s;function l(t,e,r){if(void 0!==e&&!Nu(t,e))throw f(r)}function f(t){return new Error(`reference "${t}" resolves to more than one schema`)}}})),xu=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;const r=wu;function i({gen:t,validateName:e,schema:r,schemaEnv:i,opts:o},s){o.code.es5?t.func(e,fu._`${mu.default.data}, ${mu.default.valCxt}`,i.$async,()=>{t.code(fu._`"use strict"; ${n(r,o)}`),function(t,e){t.if(mu.default.valCxt,()=>{t.var(mu.default.instancePath,fu._`${mu.default.valCxt}.${mu.default.instancePath}`),t.var(mu.default.parentData,fu._`${mu.default.valCxt}.${mu.default.parentData}`),t.var(mu.default.parentDataProperty,fu._`${mu.default.valCxt}.${mu.default.parentDataProperty}`),t.var(mu.default.rootData,fu._`${mu.default.valCxt}.${mu.default.rootData}`),e.dynamicRef&&t.var(mu.default.dynamicAnchors,fu._`${mu.default.valCxt}.${mu.default.dynamicAnchors}`)},()=>{t.var(mu.default.instancePath,fu._`""`),t.var(mu.default.parentData,fu._`undefined`),t.var(mu.default.parentDataProperty,fu._`undefined`),t.var(mu.default.rootData,mu.default.data),e.dynamicRef&&t.var(mu.default.dynamicAnchors,fu._`{}`)})}(t,o),t.code(s)}):t.func(e,fu._`${mu.default.data}, ${function(t){return fu._`{${mu.default.instancePath}="", ${mu.default.parentData}, ${mu.default.parentDataProperty}, ${mu.default.rootData}=${mu.default.data}${t.dynamicRef?fu._`, ${mu.default.dynamicAnchors}={}`:fu.nil}}={}`}(o)}`,i.$async,()=>t.code(n(r,o)).code(s))}function n(t,e){const r="object"==typeof t&&t[e.schemaId];return r&&(e.code.source||e.code.process)?fu._`/*# sourceURL=${r} */`:fu.nil}function o(t,e){a(t)&&(h(t),s(t))?function(t,e){const{schema:r,gen:i,opts:n}=t;n.$comment&&r.$comment&&l(t);(function(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=Ru.resolveUrl(t.baseId,e))})(t),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}(t);const o=i.const("_errs",mu.default.errors);u(t,o),i.var(e,fu._`${o} === ${mu.default.errors}`)}(t,e):gu.boolOrEmptySchema(t,e)}function s({schema:t,self:e}){if("boolean"==typeof t)return!t;for(const r in t)if(e.RULES.all[r])return!0;return!1}function a(t){return"boolean"!=typeof t.schema}function h(t){cu.checkUnknownRules(t),function(t){const{schema:e,errSchemaPath:r,opts:i,self:n}=t;e.$ref&&i.ignoreKeywordsWithRef&&cu.schemaHasRulesButRef(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(t)}function u(t,e){if(t.opts.jtd)return f(t,[],!1,e);const r=wu.getSchemaTypes(t.schema);f(t,r,!wu.coerceAndCheckDataType(t,r),e)}function l({gen:t,schemaEnv:e,schema:r,errSchemaPath:i,opts:n}){const o=r.$comment;if(!0===n.$comment)t.code(fu._`${mu.default.self}.logger.log(${o})`);else if("function"==typeof n.$comment){const r=fu.str`${i}/$comment`,n=t.scopeValue("root",{ref:e.root});t.code(fu._`${mu.default.self}.opts.$comment(${o}, ${r}, ${n}.schema)`)}}function f(t,e,i,n){const{gen:o,schema:s,data:a,allErrors:h,opts:u,self:l}=t,{RULES:f}=l;function g(l){yu.shouldUseGroup(s,l)&&(l.type?(o.if(r.checkDataType(l.type,a,u.strictNumbers)),c(t,l),1===e.length&&e[0]===l.type&&i&&(o.else(),r.reportTypeError(t)),o.endIf()):c(t,l),h||o.if(fu._`${mu.default.errors} === ${n||0}`))}!s.$ref||!u.ignoreKeywordsWithRef&&cu.schemaHasRulesButRef(s,f)?(u.jtd||function(t,e){if(t.schemaEnv.meta||!t.opts.strictTypes)return;(function(t,e){if(!e.length)return;if(!t.dataTypes.length)return void(t.dataTypes=e);e.forEach(e=>{m(t.dataTypes,e)||p(t,`type "${e}" not allowed by context "${t.dataTypes.join(",")}"`)}),t.dataTypes=t.dataTypes.filter(t=>m(e,t))})(t,e),t.opts.allowUnionTypes||function(t,e){e.length>1&&(2!==e.length||!e.includes("null"))&&p(t,"use allowUnionTypes to allow union type keyword")}(t,e);!function(t,e){const r=t.self.RULES.all;for(const i in r){const n=r[i];if("object"==typeof n&&yu.shouldUseRule(t.schema,n)){const{type:r}=n.definition;r.length&&!r.some(t=>d(e,t))&&p(t,`missing type "${r.join(",")}" for keyword "${i}"`)}}}(t,t.dataTypes)}(t,e),o.block(()=>{for(const t of f.rules)g(t);g(f.post)})):o.block(()=>v(t,"$ref",f.all.$ref.definition))}function c(t,e){const{gen:r,schema:i,opts:{useDefaults:n}}=t;n&&Mu.assignDefaults(t,e.type),r.block(()=>{for(const r of e.rules)yu.shouldUseRule(i,r)&&v(t,r.keyword,r.definition,e.type)})}function d(t,e){return t.includes(e)||"number"===e&&t.includes("integer")}function m(t,e){return t.includes(e)||"integer"===e&&t.includes("number")}function p(t,e){e+=` at "${t.schemaEnv.baseId+t.errSchemaPath}" (strictTypes)`,cu.checkStrictMode(t,e,t.opts.strictTypes)}e.validateFunctionCode=function(t){a(t)&&(h(t),s(t))?function(t){const{schema:e,opts:r,gen:n}=t;i(t,()=>{r.$comment&&e.$comment&&l(t),function(t){const{schema:e,opts:r}=t;void 0!==e.default&&r.useDefaults&&r.strictSchema&&cu.checkStrictMode(t,"default is ignored in the schema root")}(t),n.let(mu.default.vErrors,null),n.let(mu.default.errors,0),r.unevaluated&&function(t){const{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",fu._`${r}.evaluated`),e.if(fu._`${t.evaluated}.dynamicProps`,()=>e.assign(fu._`${t.evaluated}.props`,fu._`undefined`)),e.if(fu._`${t.evaluated}.dynamicItems`,()=>e.assign(fu._`${t.evaluated}.items`,fu._`undefined`))}(t),u(t),function(t){const{gen:e,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=t;r.$async?e.if(fu._`${mu.default.errors} === 0`,()=>e.return(mu.default.data),()=>e.throw(fu._`new ${n}(${mu.default.vErrors})`)):(e.assign(fu._`${i}.errors`,mu.default.vErrors),o.unevaluated&&function({gen:t,evaluated:e,props:r,items:i}){r instanceof fu.Name&&t.assign(fu._`${e}.props`,r);i instanceof fu.Name&&t.assign(fu._`${e}.items`,i)}(t),e.return(fu._`${mu.default.errors} === 0`))}(t)})}(t):i(t,()=>gu.topBoolOrEmptySchema(t))};class g{constructor(t,e,r){if(Eu.validateKeywordUsage(t,e,r),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=r,this.data=t.data,this.schema=t.schema[r],this.$data=e.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=cu.schemaRefOrVal(t,this.schema,r,this.$data),this.schemaType=e.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=e,this.$data)this.schemaCode=t.gen.const("vSchema",M(this.$data,t));else if(this.schemaCode=this.schemaValue,!Eu.validSchemaType(this.schema,e.schemaType,e.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(e.schemaType)}`);("code"in e?e.trackErrors:!1!==e.errors)&&(this.errsCount=t.gen.const("_errs",mu.default.errors))}result(t,e,r){this.gen.if(fu.not(t)),r?r():this.error(),e?(this.gen.else(),e(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,e){this.result(t,void 0,e)}fail(t){if(void 0===t)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:e}=this;this.fail(fu._`${e} !== undefined && (${fu.or(this.invalid$data(),t)})`)}error(t,e,r){if(e)return this.setParams(e),this._error(t,r),void this.setParams({});this._error(t,r)}_error(t,e){(t?pu.reportExtraError:pu.reportError)(this,this.def.error,e)}$dataError(){pu.reportError(this,this.def.$dataError||pu.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');pu.resetErrorsCount(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,e){e?Object.assign(this.params,t):this.params=t}block$data(t,e,r=fu.nil){this.gen.block(()=>{this.check$data(t,r),e()})}check$data(t=fu.nil,e=fu.nil){if(!this.$data)return;const{gen:r,schemaCode:i,schemaType:n,def:o}=this;r.if(fu.or(fu._`${i} === undefined`,e)),t!==fu.nil&&r.assign(t,!0),(n.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),t!==fu.nil&&r.assign(t,!1)),r.else()}invalid$data(){const{gen:t,schemaCode:e,schemaType:i,def:n,it:o}=this;return fu.or(function(){if(i.length){if(!(e instanceof fu.Name))throw new Error("ajv implementation error");const t=Array.isArray(i)?i:[i];return fu._`${r.checkDataTypes(t,e,o.opts.strictNumbers,r.DataType.Wrong)}`}return fu.nil}(),function(){if(n.validateSchema){const r=t.scopeValue("validate$data",{ref:n.validateSchema});return fu._`!${r}(${e})`}return fu.nil}())}subschema(t,e){const r=_u.getSubschema(this.it,t);_u.extendSubschemaData(r,this.it,t),_u.extendSubschemaMode(r,t);const i={...this.it,...r,items:void 0,props:void 0};return o(i,e),i}mergeEvaluated(t,e){const{it:r,gen:i}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==t.props&&(r.props=cu.mergeEvaluated.props(i,t.props,r.props,e)),!0!==r.items&&void 0!==t.items&&(r.items=cu.mergeEvaluated.items(i,t.items,r.items,e)))}mergeValidEvaluated(t,e){const{it:r,gen:i}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return i.if(e,()=>this.mergeEvaluated(t,fu.Name)),!0}}function v(t,e,r,i){const n=new g(t,r,e);"code"in r?r.code(n,i):n.$data&&r.validate?Eu.funcKeywordCode(n,r):"macro"in r?Eu.macroKeywordCode(n,r):(r.compile||r.validate)&&Eu.funcKeywordCode(n,r)}e.KeywordCxt=g;const y=/^\/(?:[^~]|~0|~1)*$/,w=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function M(t,{dataLevel:e,dataNames:r,dataPathArr:i}){let n,o;if(""===t)return mu.default.rootData;if("/"===t[0]){if(!y.test(t))throw new Error("Invalid JSON-pointer: "+t);n=t,o=mu.default.rootData}else{const s=w.exec(t);if(!s)throw new Error("Invalid JSON-pointer: "+t);const a=+s[1];if(n=s[2],"#"===n){if(a>=e)throw new Error(h("property/index",a));return i[e-a]}if(a>e)throw new Error(h("data",a));if(o=r[e-a],!n)return o}let s=o;const a=n.split("/");for(const t of a)t&&(o=fu._`${o}${fu.getProperty(cu.unescapeJsonPointer(t))}`,s=fu._`${s} && ${o}`);return s;function h(t,r){return`Cannot access ${t} ${r} levels up, current level is ${e}`}}e.getData=M}));class Iu extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}var ku=Iu,Tu=Object.defineProperty({default:ku},"__esModule",{value:!0});class Ou extends Error{constructor(t,e,r){super(r||`can't resolve reference ${e} from id ${t}`),this.missingRef=Ru.resolveUrl(t,e),this.missingSchema=Ru.normalizeId(Ru.getFullPath(this.missingRef))}}var Pu=Ou,Cu=Object.defineProperty({default:Pu},"__esModule",{value:!0}),Uu=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;class r{constructor(t){var e;let r;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(r=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!==(e=t.baseId)&&void 0!==e?e:Ru.normalizeId(null==r?void 0:r[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function i(t){const e=o.call(this,t);if(e)return e;const r=Ru.getFullPath(t.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:s}=this.opts,a=new fu.CodeGen(this.scope,{es5:i,lines:n,ownProperties:s});let h;t.$async&&(h=a.scopeValue("Error",{ref:Tu.default,code:fu._`require("ajv/dist/runtime/validation_error").default`}));const u=a.scopeName("validate");t.validateName=u;const l={gen:a,allErrors:this.opts.allErrors,data:mu.default.data,parentData:mu.default.parentData,parentDataProperty:mu.default.parentDataProperty,dataNames:[mu.default.data],dataPathArr:[fu.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:fu.stringify(t.schema)}:{ref:t.schema}),validateName:u,ValidationError:h,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:fu.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:fu._`""`,opts:this.opts,self:this};let f;try{this._compilations.add(t),xu.validateFunctionCode(l),a.optimize(this.opts.code.optimize);const e=a.toString();f=`${a.scopeRefs(mu.default.scope)}return ${e}`,this.opts.code.process&&(f=this.opts.code.process(f,t));const r=new Function(""+mu.default.self,""+mu.default.scope,f)(this,this.scope.get());if(this.scope.value(u,{ref:r}),r.errors=null,r.schema=t.schema,r.schemaEnv=t,t.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:u,validateCode:e,scopeValues:a._values}),this.opts.unevaluated){const{props:t,items:e}=l;r.evaluated={props:t instanceof fu.Name?void 0:t,items:e instanceof fu.Name?void 0:e,dynamicProps:t instanceof fu.Name,dynamicItems:e instanceof fu.Name},r.source&&(r.source.evaluated=fu.stringify(r.evaluated))}return t.validate=r,t}catch(e){throw delete t.validate,delete t.validateName,f&&this.logger.error("Error compiling schema, function code:",f),e}finally{this._compilations.delete(t)}}function n(t){return Ru.inlineRef(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:i.call(this,t)}function o(t){for(const i of this._compilations)if(r=t,(e=i).schema===r.schema&&e.root===r.root&&e.baseId===r.baseId)return i;var e,r}function s(t,e){let r;for(;"string"==typeof(r=this.refs[e]);)e=r;return r||this.schemas[e]||a.call(this,t,e)}function a(t,e){const n=Su.parse(e),o=Ru._getFullPath(n);let s=Ru.getFullPath(t.baseId);if(Object.keys(t.schema).length>0&&o===s)return u.call(this,n,t);const h=Ru.normalizeId(o),l=this.refs[h]||this.schemas[h];if("string"==typeof l){const e=a.call(this,t,l);if("object"!=typeof(null==e?void 0:e.schema))return;return u.call(this,n,e)}if("object"==typeof(null==l?void 0:l.schema)){if(l.validate||i.call(this,l),h===Ru.normalizeId(e)){const{schema:e}=l,{schemaId:i}=this.opts,n=e[i];return n&&(s=Ru.resolveUrl(s,n)),new r({schema:e,schemaId:i,root:t,baseId:s})}return u.call(this,n,l)}}e.SchemaEnv=r,e.compileSchema=i,e.resolveRef=function(t,e,i){var o;i=Ru.resolveUrl(e,i);const a=t.refs[i];if(a)return a;let h=s.call(this,t,i);if(void 0===h){const n=null===(o=t.localRefs)||void 0===o?void 0:o[i],{schemaId:s}=this.opts;n&&(h=new r({schema:n,schemaId:s,root:t,baseId:e}))}return void 0!==h?t.refs[i]=n.call(this,h):void 0},e.getCompilingSchema=o,e.resolveSchema=a;const h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function u(t,{baseId:e,schema:i,root:n}){var o;if("/"!==(null===(o=t.fragment)||void 0===o?void 0:o[0]))return;for(const r of t.fragment.slice(1).split("/")){if("boolean"==typeof i)return;if(void 0===(i=i[cu.unescapeFragment(r)]))return;const t="object"==typeof i&&i[this.opts.schemaId];!h.has(r)&&t&&(e=Ru.resolveUrl(e,t))}let s;if("boolean"!=typeof i&&i.$ref&&!cu.schemaHasRulesButRef(i,this.RULES)){const t=Ru.resolveUrl(e,i.$ref);s=a.call(this,n,t)}const{schemaId:u}=this.opts;return s=s||new r({schema:i,schemaId:u,root:n,baseId:e}),s.schema!==s.root.schema?s:void 0}})),Fu={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},Bu=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0,Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return xu.KeywordCxt}}),Object.defineProperty(e,"_",{enumerable:!0,get:function(){return fu._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return fu.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return fu.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return fu.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return fu.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return fu.CodeGen}});const r=fu,i=["removeAdditional","useDefaults","coerceTypes"],n=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),o={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},s={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function a(t){var e,r,i,n,o,s,a,h,u,l,f,c,d,m,p,g,v,y,w,M,b,E;const _=t.strict,N=null===(e=t.code)||void 0===e?void 0:e.optimize,A=!0===N||void 0===N?1:N||0;return{strictSchema:null===(i=null!==(r=t.strictSchema)&&void 0!==r?r:_)||void 0===i||i,strictNumbers:null===(o=null!==(n=t.strictNumbers)&&void 0!==n?n:_)||void 0===o||o,strictTypes:null!==(a=null!==(s=t.strictTypes)&&void 0!==s?s:_)&&void 0!==a?a:"log",strictTuples:null!==(u=null!==(h=t.strictTuples)&&void 0!==h?h:_)&&void 0!==u?u:"log",strictRequired:null!==(f=null!==(l=t.strictRequired)&&void 0!==l?l:_)&&void 0!==f&&f,code:t.code?{...t.code,optimize:A}:{optimize:A},loopRequired:null!==(c=t.loopRequired)&&void 0!==c?c:200,loopEnum:null!==(d=t.loopEnum)&&void 0!==d?d:200,meta:null===(m=t.meta)||void 0===m||m,messages:null===(p=t.messages)||void 0===p||p,inlineRefs:null===(g=t.inlineRefs)||void 0===g||g,schemaId:null!==(v=t.schemaId)&&void 0!==v?v:"$id",addUsedSchema:null===(y=t.addUsedSchema)||void 0===y||y,validateSchema:null===(w=t.validateSchema)||void 0===w||w,validateFormats:null===(M=t.validateFormats)||void 0===M||M,unicodeRegExp:null===(b=t.unicodeRegExp)||void 0===b||b,int32range:null===(E=t.int32range)||void 0===E||E}}class h{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...a(t)};const{es5:e,lines:i}=this.opts.code;this.scope=new r.ValueScope({scope:{},prefixes:n,es5:e,lines:i}),this.logger=function(t){if(!1===t)return p;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}(t.logger);const h=t.validateFormats;t.validateFormats=!1,this.RULES=vu.getRules(),u.call(this,o,t,"NOT SUPPORTED"),u.call(this,s,t,"DEPRECATED","warn"),this._metaOpts=m.call(this),t.formats&&c.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&d.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),f.call(this),t.validateFormats=h}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:t,meta:e,schemaId:r}=this.opts;let i=Fu;"id"===r&&(i={...Fu},i.id=i.$id,delete i.$id),e&&t&&this.addMetaSchema(i,i[r],!1)}defaultMeta(){const{meta:t,schemaId:e}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[e]||t:void 0}validate(t,e){let r;if("string"==typeof t){if(r=this.getSchema(t),!r)throw new Error(`no schema with key or ref "${t}"`)}else r=this.compile(t);const i=r(e);return"$async"in r||(this.errors=r.errors),i}compile(t,e){const r=this._addSchema(t,e);return r.validate||this._compileSchemaEnv(r)}compileAsync(t,e){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return i.call(this,t,e);async function i(t,e){await n.call(this,t.$schema);const r=this._addSchema(t,e);return r.validate||o.call(this,r)}async function n(t){t&&!this.getSchema(t)&&await i.call(this,{$ref:t},!0)}async function o(t){try{return this._compileSchemaEnv(t)}catch(e){if(!(e instanceof Cu.default))throw e;return s.call(this,e),await a.call(this,e.missingSchema),o.call(this,t)}}function s({missingSchema:t,missingRef:e}){if(this.refs[t])throw new Error(`AnySchema ${t} is loaded but ${e} cannot be resolved`)}async function a(t){const r=await h.call(this,t);this.refs[t]||await n.call(this,r.$schema),this.refs[t]||this.addSchema(r,t,e)}async function h(t){const e=this._loading[t];if(e)return e;try{return await(this._loading[t]=r(t))}finally{delete this._loading[t]}}}addSchema(t,e,r,i=this.opts.validateSchema){if(Array.isArray(t)){for(const e of t)this.addSchema(e,void 0,r,i);return this}let n;if("object"==typeof t){const{schemaId:e}=this.opts;if(n=t[e],void 0!==n&&"string"!=typeof n)throw new Error(`schema ${e} must be string`)}return e=Ru.normalizeId(e||n),this._checkUnique(e),this.schemas[e]=this._addSchema(t,r,e,i,!0),this}addMetaSchema(t,e,r=this.opts.validateSchema){return this.addSchema(t,e,!0,r),this}validateSchema(t,e){if("boolean"==typeof t)return!0;let r;if(r=t.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const i=this.validate(r,t);if(!i&&e){const t="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(t);this.logger.error(t)}return i}getSchema(t){let e;for(;"string"==typeof(e=l.call(this,t));)t=e;if(void 0===e){const{schemaId:r}=this.opts,i=new Uu.SchemaEnv({schema:{},schemaId:r});if(e=Uu.resolveSchema.call(this,i,t),!e)return;this.refs[t]=e}return e.validate||this._compileSchemaEnv(e)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const e=l.call(this,t);return"object"==typeof e&&this._cache.delete(e.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{const e=t;this._cache.delete(e);let r=t[this.opts.schemaId];return r&&(r=Ru.normalizeId(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(const e of t)this.addKeyword(e);return this}addKeyword(t,e){let r;if("string"==typeof t)r=t,"object"==typeof e&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),e.keyword=r);else{if("object"!=typeof t||void 0!==e)throw new Error("invalid addKeywords parameters");if(r=(e=t).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(v.call(this,r,e),!e)return cu.eachItem(r,t=>y.call(this,t)),this;M.call(this,e);const i={...e,type:wu.getJSONTypes(e.type),schemaType:wu.getJSONTypes(e.schemaType)};return cu.eachItem(r,0===i.type.length?t=>y.call(this,t,i):t=>i.type.forEach(e=>y.call(this,t,i,e))),this}getKeyword(t){const e=this.RULES.all[t];return"object"==typeof e?e.definition:!!e}removeKeyword(t){const{RULES:e}=this;delete e.keywords[t],delete e.all[t];for(const r of e.rules){const e=r.rules.findIndex(e=>e.keyword===t);e>=0&&r.rules.splice(e,1)}return this}addFormat(t,e){return"string"==typeof e&&(e=new RegExp(e)),this.formats[t]=e,this}errorsText(t=this.errors,{separator:e=", ",dataVar:r="data"}={}){return t&&0!==t.length?t.map(t=>`${r}${t.instancePath} ${t.message}`).reduce((t,r)=>t+e+r):"No errors"}$dataMetaSchema(t,e){const r=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(const i of e){const e=i.split("/").slice(1);let n=t;for(const t of e)n=n[t];for(const t in r){const e=r[t];if("object"!=typeof e)continue;const{$data:i}=e.definition,o=n[t];i&&o&&(n[t]=E(o))}}return t}_removeAllSchemas(t,e){for(const r in t){const i=t[r];e&&!e.test(r)||("string"==typeof i?delete t[r]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[r]))}}_addSchema(t,e,r,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o;const{schemaId:s}=this.opts;if("object"==typeof t)o=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof t)throw new Error("schema must be object or boolean")}let a=this._cache.get(t);if(void 0!==a)return a;const h=Ru.getSchemaRefs.call(this,t);return r=Ru.normalizeId(o||r),a=new Uu.SchemaEnv({schema:t,schemaId:s,meta:e,baseId:r,localRefs:h}),this._cache.set(a.schema,a),n&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=a),i&&this.validateSchema(t,!0),a}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Uu.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){const e=this.opts;this.opts=this._metaOpts;try{Uu.compileSchema.call(this,t)}finally{this.opts=e}}}function u(t,e,r,i="error"){for(const n in t){const o=n;o in e&&this.logger[i](`${r}: option ${n}. ${t[o]}`)}}function l(t){return t=Ru.normalizeId(t),this.schemas[t]||this.refs[t]}function f(){const t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(const e in t)this.addSchema(t[e],e)}function c(){for(const t in this.opts.formats){const e=this.opts.formats[t];e&&this.addFormat(t,e)}}function d(t){if(Array.isArray(t))this.addVocabulary(t);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const e in t){const r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}}function m(){const t={...this.opts};for(const e of i)delete t[e];return t}e.default=h,h.ValidationError=Tu.default,h.MissingRefError=Cu.default;const p={log(){},warn(){},error(){}};const g=/^[a-z_$][a-z0-9_$:-]*$/i;function v(t,e){const{RULES:r}=this;if(cu.eachItem(t,t=>{if(r.keywords[t])throw new Error(`Keyword ${t} is already defined`);if(!g.test(t))throw new Error(`Keyword ${t} has invalid name`)}),e&&e.$data&&!("code"in e)&&!("validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function y(t,e,r){var i;const n=null==e?void 0:e.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let s=n?o.post:o.rules.find(({type:t})=>t===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;const a={keyword:t,definition:{...e,type:wu.getJSONTypes(e.type),schemaType:wu.getJSONTypes(e.schemaType)}};e.before?w.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,null===(i=e.implements)||void 0===i||i.forEach(t=>this.addKeyword(t))}function w(t,e,r){const i=t.rules.findIndex(t=>t.keyword===r);i>=0?t.rules.splice(i,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function M(t){let{metaSchema:e}=t;void 0!==e&&(t.$data&&this.opts.$data&&(e=E(e)),t.validateSchema=this.compile(e,!0))}const b={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function E(t){return{anyOf:[t,b]}}}));var Du={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}},Lu=Object.defineProperty({default:Du},"__esModule",{value:!0}),$u=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;const r={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:r,it:o}=t,{baseId:s,schemaEnv:a,validateName:h,opts:u,self:l}=o,{root:f}=a;if(("#"===r||"#/"===r)&&s===f.baseId)return function(){if(a===f)return n(t,h,a,a.$async);const r=e.scopeValue("root",{ref:f});return n(t,fu._`${r}.validate`,f,f.$async)}();const c=Uu.resolveRef.call(l,f,s,r);if(void 0===c)throw new Cu.default(s,r);return c instanceof Uu.SchemaEnv?function(e){const r=i(t,e);n(t,r,e,e.$async)}(c):function(i){const n=e.scopeValue("schema",!0===u.code.source?{ref:i,code:fu.stringify(i)}:{ref:i}),o=e.name("valid"),s=t.subschema({schema:i,dataTypes:[],schemaPath:fu.nil,topSchemaRef:n,errSchemaPath:r},o);t.mergeEvaluated(s),t.ok(o)}(c)}};function i(t,e){const{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):fu._`${r.scopeValue("wrapper",{ref:e})}.validate`}function n(t,e,r,i){const{gen:n,it:o}=t,{allErrors:s,schemaEnv:a,opts:h}=o,u=h.passContext?mu.default.this:fu.nil;function l(t){const e=fu._`${t}.errors`;n.assign(mu.default.vErrors,fu._`${mu.default.vErrors} === null ? ${e} : ${mu.default.vErrors}.concat(${e})`),n.assign(mu.default.errors,fu._`${mu.default.vErrors}.length`)}function f(t){var e;if(!o.opts.unevaluated)return;const i=null===(e=null==r?void 0:r.validate)||void 0===e?void 0:e.evaluated;if(!0!==o.props)if(i&&!i.dynamicProps)void 0!==i.props&&(o.props=cu.mergeEvaluated.props(n,i.props,o.props));else{const e=n.var("props",fu._`${t}.evaluated.props`);o.props=cu.mergeEvaluated.props(n,e,o.props,fu.Name)}if(!0!==o.items)if(i&&!i.dynamicItems)void 0!==i.items&&(o.items=cu.mergeEvaluated.items(n,i.items,o.items));else{const e=n.var("items",fu._`${t}.evaluated.items`);o.items=cu.mergeEvaluated.items(n,e,o.items,fu.Name)}}i?function(){if(!a.$async)throw new Error("async schema referenced by sync schema");const r=n.let("valid");n.try(()=>{n.code(fu._`await ${bu.callValidateCode(t,e,u)}`),f(e),s||n.assign(r,!0)},t=>{n.if(fu._`!(${t} instanceof ${o.ValidationError})`,()=>n.throw(t)),l(t),s||n.assign(r,!1)}),t.ok(r)}():t.result(bu.callValidateCode(t,e,u),()=>f(e),()=>l(e))}e.getValidate=i,e.callRef=n,e.default=r}));var ju=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Lu.default,$u.default],zu=Object.defineProperty({default:ju},"__esModule",{value:!0});const qu=fu.operators,Gu={maximum:{okStr:"<=",ok:qu.LTE,fail:qu.GT},minimum:{okStr:">=",ok:qu.GTE,fail:qu.LT},exclusiveMaximum:{okStr:"<",ok:qu.LT,fail:qu.GTE},exclusiveMinimum:{okStr:">",ok:qu.GT,fail:qu.LTE}},Vu={message:({keyword:t,schemaCode:e})=>fu.str`must be ${Gu[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>fu._`{comparison: ${Gu[t].okStr}, limit: ${e}}`};var Zu={keyword:Object.keys(Gu),type:"number",schemaType:"number",$data:!0,error:Vu,code(t){const{keyword:e,data:r,schemaCode:i}=t;t.fail$data(fu._`${r} ${Gu[e].fail} ${i} || isNaN(${r})`)}},Ku=Object.defineProperty({default:Zu},"__esModule",{value:!0});var Hu={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>fu.str`must be multiple of ${t}`,params:({schemaCode:t})=>fu._`{multipleOf: ${t}}`},code(t){const{gen:e,data:r,schemaCode:i,it:n}=t,o=n.opts.multipleOfPrecision,s=e.let("res"),a=o?fu._`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:fu._`${s} !== parseInt(${s})`;t.fail$data(fu._`(${i} === 0 || (${s} = ${r}/${i}, ${a}))`)}},Wu=Object.defineProperty({default:Hu},"__esModule",{value:!0});function Ju(t){const e=t.length;let r,i=0,n=0;for(;n<e;)i++,r=t.charCodeAt(n++),r>=55296&&r<=56319&&n<e&&(r=t.charCodeAt(n),56320==(64512&r)&&n++);return i}var Xu=Ju;Ju.code='require("ajv/dist/runtime/ucs2length").default';var Yu=Object.defineProperty({default:Xu},"__esModule",{value:!0});var Qu={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r="maxLength"===t?"more":"fewer";return fu.str`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>fu._`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:i,it:n}=t,o="maxLength"===e?fu.operators.GT:fu.operators.LT,s=!1===n.opts.unicode?fu._`${r}.length`:fu._`${cu.useFunc(t.gen,Yu.default)}(${r})`;t.fail$data(fu._`${s} ${o} ${i}`)}},tl=Object.defineProperty({default:Qu},"__esModule",{value:!0});var el={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>fu.str`must match pattern "${t}"`,params:({schemaCode:t})=>fu._`{pattern: ${t}}`},code(t){const{data:e,$data:r,schema:i,schemaCode:n,it:o}=t,s=o.opts.unicodeRegExp?"u":"",a=r?fu._`(new RegExp(${n}, ${s}))`:bu.usePattern(t,i);t.fail$data(fu._`!${a}.test(${e})`)}},rl=Object.defineProperty({default:el},"__esModule",{value:!0});var il={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r="maxProperties"===t?"more":"fewer";return fu.str`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>fu._`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:i}=t,n="maxProperties"===e?fu.operators.GT:fu.operators.LT;t.fail$data(fu._`Object.keys(${r}).length ${n} ${i}`)}},nl=Object.defineProperty({default:il},"__esModule",{value:!0});var ol={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>fu.str`must have required property '${t}'`,params:({params:{missingProperty:t}})=>fu._`{missingProperty: ${t}}`},code(t){const{gen:e,schema:r,schemaCode:i,data:n,$data:o,it:s}=t,{opts:a}=s;if(!o&&0===r.length)return;const h=r.length>=a.loopRequired;if(s.allErrors?function(){if(h||o)t.block$data(fu.nil,u);else for(const e of r)bu.checkReportMissingProp(t,e)}():function(){const s=e.let("missing");if(h||o){const r=e.let("valid",!0);t.block$data(r,()=>function(r,o){t.setParams({missingProperty:r}),e.forOf(r,i,()=>{e.assign(o,bu.propertyInData(e,n,r,a.ownProperties)),e.if(fu.not(o),()=>{t.error(),e.break()})},fu.nil)}(s,r)),t.ok(r)}else e.if(bu.checkMissingProp(t,r,s)),bu.reportMissingProp(t,s),e.else()}(),a.strictRequired){const e=t.parentSchema.properties,{definedProperties:i}=t.it;for(const t of r)if(void 0===(null==e?void 0:e[t])&&!i.has(t)){const e=`required property "${t}" is not defined at "${s.schemaEnv.baseId+s.errSchemaPath}" (strictRequired)`;cu.checkStrictMode(s,e,s.opts.strictRequired)}}function u(){e.forOf("prop",i,r=>{t.setParams({missingProperty:r}),e.if(bu.noPropertyInData(e,n,r,a.ownProperties),()=>t.error())})}}},sl=Object.defineProperty({default:ol},"__esModule",{value:!0});var al={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:e}){const r="maxItems"===t?"more":"fewer";return fu.str`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>fu._`{limit: ${t}}`},code(t){const{keyword:e,data:r,schemaCode:i}=t,n="maxItems"===e?fu.operators.GT:fu.operators.LT;t.fail$data(fu._`${r}.length ${n} ${i}`)}},hl=Object.defineProperty({default:al},"__esModule",{value:!0});Nu.code='require("ajv/dist/runtime/equal").default';var ul=Nu,ll=Object.defineProperty({default:ul},"__esModule",{value:!0});var fl={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>fu.str`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>fu._`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:a}=t;if(!i&&!n)return;const h=e.let("valid"),u=o.items?wu.getSchemaTypes(o.items):[];function l(i,n){const o=e.name("item"),s=wu.checkDataTypes(u,o,a.opts.strictNumbers,wu.DataType.Wrong),l=e.const("indices",fu._`{}`);e.for(fu._`;${i}--;`,()=>{e.let(o,fu._`${r}[${i}]`),e.if(s,fu._`continue`),u.length>1&&e.if(fu._`typeof ${o} == "string"`,fu._`${o} += "_"`),e.if(fu._`typeof ${l}[${o}] == "number"`,()=>{e.assign(n,fu._`${l}[${o}]`),t.error(),e.assign(h,!1).break()}).code(fu._`${l}[${o}] = ${i}`)})}function f(i,n){const o=cu.useFunc(e,ll.default),s=e.name("outer");e.label(s).for(fu._`;${i}--;`,()=>e.for(fu._`${n} = ${i}; ${n}--;`,()=>e.if(fu._`${o}(${r}[${i}], ${r}[${n}])`,()=>{t.error(),e.assign(h,!1).break(s)})))}t.block$data(h,(function(){const i=e.let("i",fu._`${r}.length`),n=e.let("j");t.setParams({i:i,j:n}),e.assign(h,!0),e.if(fu._`${i} > 1`,()=>(u.length>0&&!u.some(t=>"object"===t||"array"===t)?l:f)(i,n))}),fu._`${s} === false`),t.ok(h)}},cl=Object.defineProperty({default:fl},"__esModule",{value:!0});var dl={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>fu._`{allowedValue: ${t}}`},code(t){const{gen:e,data:r,$data:i,schemaCode:n,schema:o}=t;i||o&&"object"==typeof o?t.fail$data(fu._`!${cu.useFunc(e,ll.default)}(${r}, ${n})`):t.fail(fu._`${o} !== ${r}`)}},ml=Object.defineProperty({default:dl},"__esModule",{value:!0});var pl={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>fu._`{allowedValues: ${t}}`},code(t){const{gen:e,data:r,$data:i,schema:n,schemaCode:o,it:s}=t;if(!i&&0===n.length)throw new Error("enum must have non-empty array");const a=n.length>=s.opts.loopEnum,h=cu.useFunc(e,ll.default);let u;if(a||i)u=e.let("valid"),t.block$data(u,(function(){e.assign(u,!1),e.forOf("v",o,t=>e.if(fu._`${h}(${r}, ${t})`,()=>e.assign(u,!0).break()))}));else{if(!Array.isArray(n))throw new Error("ajv implementation error");const t=e.const("vSchema",o);u=fu.or(...n.map((e,i)=>function(t,e){const i=n[e];return"object"==typeof i&&null!==i?fu._`${h}(${r}, ${t}[${e}])`:fu._`${r} === ${i}`}(t,i)))}t.pass(u)}},gl=Object.defineProperty({default:pl},"__esModule",{value:!0});var vl=[Ku.default,Wu.default,tl.default,rl.default,nl.default,sl.default,hl.default,cl.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},ml.default,gl.default],yl=Object.defineProperty({default:vl},"__esModule",{value:!0}),wl=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;const r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>fu.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>fu._`{limit: ${t}}`},code(t){const{parentSchema:e,it:r}=t,{items:n}=e;Array.isArray(n)?i(t,n):cu.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function i(t,e){const{gen:r,schema:i,data:n,keyword:o,it:s}=t;s.items=!0;const a=r.const("len",fu._`${n}.length`);if(!1===i)t.setParams({len:e.length}),t.pass(fu._`${a} <= ${e.length}`);else if("object"==typeof i&&!cu.alwaysValidSchema(s,i)){const i=r.var("valid",fu._`${a} <= ${e.length}`);r.if(fu.not(i),()=>function(i){r.forRange("i",e.length,a,e=>{t.subschema({keyword:o,dataProp:e,dataPropType:cu.Type.Num},i),s.allErrors||r.if(fu.not(i),()=>r.break())})}(i)),t.ok(i)}}e.validateAdditionalItems=i,e.default=r})),Ml=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;const r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:r}=t;if(Array.isArray(e))return i(t,"additionalItems",e);r.items=!0,cu.alwaysValidSchema(r,e)||t.ok(bu.validateArray(t))}};function i(t,e,r=t.schema){const{gen:i,parentSchema:n,data:o,keyword:s,it:a}=t;!function(t){const{opts:i,errSchemaPath:n}=a,o=r.length,h=o===t.minItems&&(o===t.maxItems||!1===t[e]);if(i.strictTuples&&!h){const t=`"${s}" is ${o}-tuple, but minItems or maxItems/${e} are not specified or different at path "${n}"`;cu.checkStrictMode(a,t,i.strictTuples)}}(n),a.opts.unevaluated&&r.length&&!0!==a.items&&(a.items=cu.mergeEvaluated.items(i,r.length,a.items));const h=i.name("valid"),u=i.const("len",fu._`${o}.length`);r.forEach((e,r)=>{cu.alwaysValidSchema(a,e)||(i.if(fu._`${u} > ${r}`,()=>t.subschema({keyword:s,schemaProp:r,dataProp:r},h)),t.ok(h))})}e.validateTuple=i,e.default=r}));var bl={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>Ml.validateTuple(t,"items")},El=Object.defineProperty({default:bl},"__esModule",{value:!0});var _l={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>fu.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>fu._`{limit: ${t}}`},code(t){const{schema:e,parentSchema:r,it:i}=t,{prefixItems:n}=r;i.items=!0,cu.alwaysValidSchema(i,e)||(n?wl.validateAdditionalItems(t,n):t.ok(bu.validateArray(t)))}},Nl=Object.defineProperty({default:_l},"__esModule",{value:!0});var Al={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>void 0===e?fu.str`must contain at least ${t} valid item(s)`:fu.str`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>void 0===e?fu._`{minContains: ${t}}`:fu._`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:r,parentSchema:i,data:n,it:o}=t;let s,a;const{minContains:h,maxContains:u}=i;o.opts.next?(s=void 0===h?1:h,a=u):s=1;const l=e.const("len",fu._`${n}.length`);if(t.setParams({min:s,max:a}),void 0===a&&0===s)return void cu.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&s>a)return cu.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),void t.fail();if(cu.alwaysValidSchema(o,r)){let e=fu._`${l} >= ${s}`;return void 0!==a&&(e=fu._`${e} && ${l} <= ${a}`),void t.pass(e)}o.items=!0;const f=e.name("valid");if(void 0===a&&1===s)c(f,()=>e.if(f,()=>e.break()));else{e.let(f,!1);const t=e.name("_valid"),r=e.let("count",0);c(t,()=>e.if(t,()=>function(t){e.code(fu._`${t}++`),void 0===a?e.if(fu._`${t} >= ${s}`,()=>e.assign(f,!0).break()):(e.if(fu._`${t} > ${a}`,()=>e.assign(f,!1).break()),1===s?e.assign(f,!0):e.if(fu._`${t} >= ${s}`,()=>e.assign(f,!0)))}(r)))}function c(r,i){e.forRange("i",0,l,e=>{t.subschema({keyword:"contains",dataProp:e,dataPropType:cu.Type.Num,compositeRule:!0},r),i()})}t.result(f,()=>t.reset())}},Sl=Object.defineProperty({default:Al},"__esModule",{value:!0}),Rl=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0,e.error={message:({params:{property:t,depsCount:e,deps:r}})=>{const i=1===e?"property":"properties";return fu.str`must have ${i} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:i}})=>fu._`{property: ${t},
|
|
19
19
|
missingProperty: ${i},
|
|
20
20
|
depsCount: ${e},
|
|
21
|
-
deps: ${r}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(t){const[e,r]=function({schema:t}){const e={},r={};for(const i in t){if("__proto__"===i)continue;(Array.isArray(t[i])?e:r)[i]=t[i]}return[e,r]}(t);i(t,e),n(t,r)}};function i(t,e=t.schema){const{gen:r,data:i,it:n}=t;if(0===Object.keys(e).length)return;const o=r.let("missing");for(const s in e){const a=e[s];if(0===a.length)continue;const h=bu.propertyInData(r,i,s,n.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(h,()=>{for(const e of a)bu.checkReportMissingProp(t,e)}):(r.if(fu._`${h} && (${bu.checkMissingProp(t,a,o)})`),bu.reportMissingProp(t,o),r.else())}}function n(t,e=t.schema){const{gen:r,data:i,keyword:n,it:o}=t,s=r.name("valid");for(const a in e)cu.alwaysValidSchema(o,e[a])||(r.if(bu.propertyInData(r,i,a,o.opts.ownProperties),()=>{const e=t.subschema({keyword:n,schemaProp:a},s);t.mergeValidEvaluated(e,s)},()=>r.var(s,!0)),t.ok(s))}e.validatePropertyDeps=i,e.validateSchemaDeps=n,e.default=r}));var xl={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>fu._`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:r,data:i,it:n}=t;if(cu.alwaysValidSchema(n,r))return;const o=e.name("valid");e.forIn("key",i,r=>{t.setParams({propertyName:r}),t.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),e.if(fu.not(o),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(o)}},Il=Object.defineProperty({default:xl},"__esModule",{value:!0});var kl={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>fu._`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:e,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");const{allErrors:a,opts:h}=s;if(s.props=!0,"all"!==h.removeAdditional&&cu.alwaysValidSchema(s,r))return;const u=bu.allSchemaProperties(i.properties),l=bu.allSchemaProperties(i.patternProperties);function f(t){e.code(fu._`delete ${n}[${t}]`)}function c(i){if("all"===h.removeAdditional||h.removeAdditional&&!1===r)f(i);else{if(!1===r)return t.setParams({additionalProperty:i}),t.error(),void(a||e.break());if("object"==typeof r&&!cu.alwaysValidSchema(s,r)){const r=e.name("valid");"failing"===h.removeAdditional?(d(i,r,!1),e.if(fu.not(r),()=>{t.reset(),f(i)})):(d(i,r),a||e.if(fu.not(r),()=>e.break()))}}}function d(e,r,i){const n={keyword:"additionalProperties",dataProp:e,dataPropType:cu.Type.Str};!1===i&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(n,r)}e.forIn("key",n,r=>{u.length||l.length?e.if(function(r){let n;if(u.length>8){const t=cu.schemaRefOrVal(s,i.properties,"properties");n=bu.isOwnProperty(e,t,r)}else n=u.length?fu.or(...u.map(t=>fu._`${r} === ${t}`)):fu.nil;return l.length&&(n=fu.or(n,...l.map(e=>fu._`${bu.usePattern(t,e)}.test(${r})`))),fu.not(n)}(r),()=>c(r)):c(r)}),t.ok(fu._`${o} === ${mu.default.errors}`)}},Tl=Object.defineProperty({default:kl},"__esModule",{value:!0});var Ol={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,parentSchema:i,data:n,it:o}=t;"all"===o.opts.removeAdditional&&void 0===i.additionalProperties&&Tl.default.code(new xu.KeywordCxt(o,Tl.default,"additionalProperties"));const s=bu.allSchemaProperties(r);for(const t of s)o.definedProperties.add(t);o.opts.unevaluated&&s.length&&!0!==o.props&&(o.props=cu.mergeEvaluated.props(e,cu.toHash(s),o.props));const a=s.filter(t=>!cu.alwaysValidSchema(o,r[t]));if(0===a.length)return;const h=e.name("valid");for(const r of a)u(r)?l(r):(e.if(bu.propertyInData(e,n,r,o.opts.ownProperties)),l(r),o.allErrors||e.else().var(h,!0),e.endIf()),t.it.definedProperties.add(r),t.ok(h);function u(t){return o.opts.useDefaults&&!o.compositeRule&&void 0!==r[t].default}function l(e){t.subschema({keyword:"properties",schemaProp:e,dataProp:e},h)}}},Pl=Object.defineProperty({default:Ol},"__esModule",{value:!0});const Cl=cu;var Ul={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,data:i,parentSchema:n,it:o}=t,{opts:s}=o,a=bu.allSchemaProperties(r),h=a.filter(t=>cu.alwaysValidSchema(o,r[t]));if(0===a.length||h.length===a.length&&(!o.opts.unevaluated||!0===o.props))return;const u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,l=e.name("valid");!0===o.props||o.props instanceof fu.Name||(o.props=Cl.evaluatedPropsToName(e,o.props));const{props:f}=o;function c(t){for(const e in u)new RegExp(t).test(e)&&cu.checkStrictMode(o,`property ${e} matches pattern ${t} (use allowMatchingProperties)`)}function d(r){e.forIn("key",i,i=>{e.if(fu._`${bu.usePattern(t,r)}.test(${i})`,()=>{const n=h.includes(r);n||t.subschema({keyword:"patternProperties",schemaProp:r,dataProp:i,dataPropType:Cl.Type.Str},l),o.opts.unevaluated&&!0!==f?e.assign(fu._`${f}[${i}]`,!0):n||o.allErrors||e.if(fu.not(l),()=>e.break())})})}!function(){for(const t of a)u&&c(t),o.allErrors?d(t):(e.var(l,!0),d(t),e.if(l))}()}},Fl=Object.defineProperty({default:Ul},"__esModule",{value:!0});var Bl={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:r,it:i}=t;if(cu.alwaysValidSchema(i,r))return void t.fail();const n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.result(n,()=>t.error(),()=>t.reset())},error:{message:"must NOT be valid"}},Dl=Object.defineProperty({default:Bl},"__esModule",{value:!0});var Ll={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:bu.validateUnion,error:{message:"must match a schema in anyOf"}},$l=Object.defineProperty({default:Ll},"__esModule",{value:!0});var jl={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>fu._`{passingSchemas: ${t.passing}}`},code(t){const{gen:e,schema:r,parentSchema:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;const o=r,s=e.let("valid",!1),a=e.let("passing",null),h=e.name("_valid");t.setParams({passing:a}),e.block((function(){o.forEach((r,i)=>{let o;cu.alwaysValidSchema(n,r)?e.var(h,!0):o=t.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},h),i>0&&e.if(fu._`${h} && ${s}`).assign(s,!1).assign(a,fu._`[${a}, ${i}]`).else(),e.if(h,()=>{e.assign(s,!0),e.assign(a,i),o&&t.mergeEvaluated(o,fu.Name)})})})),t.result(s,()=>t.reset(),()=>t.error(!0))}},zl=Object.defineProperty({default:jl},"__esModule",{value:!0});var ql={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:r,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");const n=e.name("valid");r.forEach((e,r)=>{if(cu.alwaysValidSchema(i,e))return;const o=t.subschema({keyword:"allOf",schemaProp:r},n);t.ok(n),t.mergeEvaluated(o)})}},Gl=Object.defineProperty({default:ql},"__esModule",{value:!0});function Vl(t,e){const r=t.schema[e];return void 0!==r&&!cu.alwaysValidSchema(t,r)}var Zl={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>fu.str`must match "${t.ifClause}" schema`,params:({params:t})=>fu._`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:r,it:i}=t;void 0===r.then&&void 0===r.else&&cu.checkStrictMode(i,'"if" without "then" and "else" is ignored');const n=Vl(i,"then"),o=Vl(i,"else");if(!n&&!o)return;const s=e.let("valid",!0),a=e.name("_valid");if(function(){const e=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(e)}(),t.reset(),n&&o){const r=e.let("ifClause");t.setParams({ifClause:r}),e.if(a,h("then",r),h("else",r))}else n?e.if(a,h("then")):e.if(fu.not(a),h("else"));function h(r,i){return()=>{const n=t.subschema({keyword:r},a);e.assign(s,a),t.mergeValidEvaluated(n,s),i?e.assign(i,fu._`${r}`):t.setParams({ifClause:r})}}t.pass(s,()=>t.error(!0))}},Kl=Object.defineProperty({default:Zl},"__esModule",{value:!0});var Hl={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){void 0===e.if&&cu.checkStrictMode(r,`"${t}" without "if" is ignored`)}},Wl=Object.defineProperty({default:Hl},"__esModule",{value:!0});var Jl=function(t=!1){const e=[Dl.default,$l.default,zl.default,Gl.default,Kl.default,Wl.default,Il.default,Tl.default,Rl.default,Pl.default,Fl.default];return t?e.push(El.default,Nl.default):e.push(wl.default,Ml.default),e.push(Sl.default),e},Xl=Object.defineProperty({default:Jl},"__esModule",{value:!0});var Yl={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>fu.str`must match format "${t}"`,params:({schemaCode:t})=>fu._`{format: ${t}}`},code(t,e){const{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=t,{opts:h,errSchemaPath:u,schemaEnv:l,self:f}=a;h.validateFormats&&(n?function(){const n=r.scopeValue("formats",{ref:f.formats,code:h.code.formats}),o=r.const("fDef",fu._`${n}[${s}]`),a=r.let("fType"),u=r.let("format");r.if(fu._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(a,fu._`${o}.type || "string"`).assign(u,fu._`${o}.validate`),()=>r.assign(a,fu._`"string"`).assign(u,o)),t.fail$data(fu.or(!1===h.strictSchema?fu.nil:fu._`${s} && !${u}`,function(){const t=l.$async?fu._`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:fu._`${u}(${i})`,r=fu._`(typeof ${u} == "function" ? ${t} : ${u}.test(${i}))`;return fu._`${u} && ${u} !== true && ${a} === ${e} && !${r}`}()))}():function(){const n=f.formats[o];if(!n)return void function(){if(!1===h.strictSchema)return void f.logger.warn(t());throw new Error(t());function t(){return`unknown format "${o}" ignored in schema at path "${u}"`}}();if(!0===n)return;const[s,a,c]=function(t){const e=t instanceof RegExp?fu.regexpCode(t):h.code.formats?fu._`${h.code.formats}${fu.getProperty(o)}`:void 0,i=r.scopeValue("formats",{key:o,ref:t,code:e});if("object"==typeof t&&!(t instanceof RegExp))return[t.type||"string",t.validate,fu._`${i}.validate`];return["string",t,i]}(n);s===e&&t.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.async){if(!l.$async)throw new Error("async format in sync schema");return fu._`await ${c}(${i})`}return"function"==typeof a?fu._`${c}(${i})`:fu._`${c}.test(${i})`}())}())}};var Ql=[Object.defineProperty({default:Yl},"__esModule",{value:!0}).default],tf=Object.defineProperty({default:Ql},"__esModule",{value:!0}),ef=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}));var rf=[zu.default,yl.default,Xl.default(),tf.default,ef.metadataVocabulary,ef.contentVocabulary],nf=Object.defineProperty({default:rf},"__esModule",{value:!0}),of=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))}));var sf={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===of.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>fu._`{error: ${t}, tag: ${r}, tagValue: ${e}}`},code(t){const{gen:e,data:r,schema:i,parentSchema:n,it:o}=t,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=i.propertyName;if("string"!=typeof a)throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");const h=e.let("valid",!1),u=e.const("tag",fu._`${r}${fu.getProperty(a)}`);function l(r){const i=e.name("valid"),n=t.subschema({keyword:"oneOf",schemaProp:r},i);return t.mergeEvaluated(n,fu.Name),i}e.if(fu._`typeof ${u} == "string"`,()=>function(){const r=function(){var t;const e={},r=o(n);let i=!0;for(let e=0;e<s.length;e++){const n=s[e],u=null===(t=n.properties)||void 0===t?void 0:t[a];if("object"!=typeof u)throw new Error(`discriminator: oneOf schemas must have "properties/${a}"`);i=i&&(r||o(n)),h(u,e)}if(!i)throw new Error(`discriminator: "${a}" must be required`);return e;function o({required:t}){return Array.isArray(t)&&t.includes(a)}function h(t,e){if(t.const)u(t.const,e);else{if(!t.enum)throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`);for(const r of t.enum)u(r,e)}}function u(t,r){if("string"!=typeof t||t in e)throw new Error(`discriminator: "${a}" values must be unique strings`);e[t]=r}}();e.if(!1);for(const t in r)e.elseIf(fu._`${u} === ${t}`),e.assign(h,l(r[t]));e.else(),t.error(!1,{discrError:of.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}(),()=>t.error(!1,{discrError:of.DiscrError.Tag,tag:u,tagName:a})),t.ok(h)}},af=Object.defineProperty({default:sf},"__esModule",{value:!0}),hf={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0},uf=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;const r=["/properties"],i="http://json-schema.org/draft-07/schema";class n extends Bu.default{_addVocabularies(){super._addVocabularies(),nf.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(af.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(hf,r):hf;this.addMetaSchema(t,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n,Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return xu.KeywordCxt}}),Object.defineProperty(e,"_",{enumerable:!0,get:function(){return fu._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return fu.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return fu.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return fu.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return fu.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return fu.CodeGen}})})),lf=o(uf),ff=a((function(t,e){function r(t,e){return{validate:t,compare:e}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:r(o,s),time:r(h,u),"date-time":r((function(t){const e=t.split(l);return 2===e.length&&o(e[0])&&h(e[1],!0)}),f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return c.test(t)&&d.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(t){if(p.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,int32:{type:"number",validate:function(t){return Number.isInteger(t)&&t<=2147483647&&t>=-2147483648}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:m},double:{type:"number",validate:m},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);const i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(t){const e=i.exec(t);if(!e)return!1;const r=+e[1],o=+e[2],s=+e[3];return o>=1&&o<=12&&s>=1&&s<=(2===o&&function(t){return t%4==0&&(t%100!=0||t%400==0)}(r)?29:n[o])}function s(t,e){if(t&&e)return t>e?1:t<e?-1:0}const a=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function h(t,e){const r=a.exec(t);if(!r)return!1;const i=+r[1],n=+r[2],o=+r[3],s=r[5];return(i<=23&&n<=59&&o<=59||23===i&&59===n&&60===o)&&(!e||""!==s)}function u(t,e){if(!t||!e)return;const r=a.exec(t),i=a.exec(e);return r&&i?(t=r[1]+r[2]+r[3]+(r[4]||""))>(e=i[1]+i[2]+i[3]+(i[4]||""))?1:t<e?-1:0:void 0}const l=/t|\s/i;function f(t,e){if(!t||!e)return;const[r,i]=t.split(l),[n,o]=e.split(l),a=s(r,n);return void 0!==a?a||u(i,o):void 0}const c=/\/|:/,d=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function m(){return!0}const p=/[^\\]\\Z/})),cf=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const r=fu.operators,i={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={message:({keyword:t,schemaCode:e})=>fu.str`should be ${i[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>fu._`{comparison: ${i[t].okStr}, limit: ${e}}`};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:n,code(t){const{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:a,self:h}=s;if(!a.validateFormats)return;const u=new uf.KeywordCxt(s,h.RULES.all.format.definition,"format");function l(t){return fu._`${t}.compare(${r}, ${n}) ${i[o].fail} 0`}u.$data?function(){const r=e.scopeValue("formats",{ref:h.formats,code:a.code.formats}),i=e.const("fmt",fu._`${r}[${u.schemaCode}]`);t.fail$data(fu.or(fu._`typeof ${i} != "object"`,fu._`${i} instanceof RegExp`,fu._`typeof ${i}.compare != "function"`,l(i)))}():function(){const r=u.schema,i=h.formats[r];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw new Error(`"${o}": format "${r}" does not define "compare" function`);const n=e.scopeValue("formats",{key:r,ref:i,code:a.code.formats?fu._`${a.code.formats}${fu.getProperty(r)}`:void 0});t.fail$data(l(n))}()},dependencies:["format"]};e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),df=o(a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=new fu.Name("fullFormats"),i=new fu.Name("fastFormats"),n=(t,e={keywords:!0})=>{if(Array.isArray(e))return o(t,e,ff.fullFormats,r),t;const[n,s]="fast"===e.mode?[ff.fastFormats,i]:[ff.fullFormats,r];return o(t,e.formats||ff.formatNames,n,s),e.keywords&&cf.default(t),t};function o(t,e,r,i){var n,o;null!==(n=(o=t.opts.code).formats)&&void 0!==n||(o.formats=fu._`require("ajv-formats/dist/formats").${i}`);for(const i of e)t.addFormat(i,r[i])}n.get=(t,e="full")=>{const r=("fast"===e?ff.fastFormats:ff.fullFormats)[t];if(!r)throw new Error(`Unknown format "${t}"`);return r},t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n}))),mf="[object GeneratorFunction]",pf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gf=/^\w*$/,vf=/^\./,yf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wf=/\\(\\)?/g,Mf=/^\[object .+?Constructor\]$/,bf=/^(?:0|[1-9]\d*)$/,Ef="object"==typeof n&&n&&n.Object===Object&&n,_f="object"==typeof self&&self&&self.Object===Object&&self,Nf=Ef||_f||Function("return this")();var Af,Sf=Array.prototype,Rf=Function.prototype,xf=Object.prototype,If=Nf["__core-js_shared__"],kf=(Af=/[^.]+$/.exec(If&&If.keys&&If.keys.IE_PROTO||""))?"Symbol(src)_1."+Af:"",Tf=Rf.toString,Of=xf.hasOwnProperty,Pf=xf.toString,Cf=RegExp("^"+Tf.call(Of).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Uf=Nf.Symbol,Ff=Sf.splice,Bf=Wf(Nf,"Map"),Df=Wf(Object,"create"),Lf=Uf?Uf.prototype:void 0,$f=Lf?Lf.toString:void 0;function jf(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function zf(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function qf(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function Gf(t,e,r){var i=t[e];Of.call(t,e)&&tc(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function Vf(t,e){for(var r=t.length;r--;)if(tc(t[r][0],e))return r;return-1}function Zf(t){return!(!rc(t)||(e=t,kf&&kf in e))&&(function(t){var e=rc(t)?Pf.call(t):"";return"[object Function]"==e||e==mf}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?Cf:Mf).test(function(t){if(null!=t){try{return Tf.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function Kf(t,e,r,i){if(!rc(t))return t;for(var n=-1,o=(e=function(t,e){if(ec(t))return!1;var r=typeof t;if("number"==r||"symbol"==r||"boolean"==r||null==t||ic(t))return!0;return gf.test(t)||!pf.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return ec(t)?t:Xf(t)}(e)).length,s=o-1,a=t;null!=a&&++n<o;){var h=Yf(e[n]),u=r;if(n!=s){var l=a[h];void 0===(u=i?i(l,h,a):void 0)&&(u=rc(l)?l:Jf(e[n+1])?[]:{})}Gf(a,h,u),a=a[h]}return t}function Hf(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function Wf(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Zf(r)?r:void 0}function Jf(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||bf.test(t))&&t>-1&&t%1==0&&t<e}jf.prototype.clear=function(){this.__data__=Df?Df(null):{}},jf.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},jf.prototype.get=function(t){var e=this.__data__;if(Df){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Of.call(e,t)?e[t]:void 0},jf.prototype.has=function(t){var e=this.__data__;return Df?void 0!==e[t]:Of.call(e,t)},jf.prototype.set=function(t,e){return this.__data__[t]=Df&&void 0===e?"__lodash_hash_undefined__":e,this},zf.prototype.clear=function(){this.__data__=[]},zf.prototype.delete=function(t){var e=this.__data__,r=Vf(e,t);return!(r<0)&&(r==e.length-1?e.pop():Ff.call(e,r,1),!0)},zf.prototype.get=function(t){var e=this.__data__,r=Vf(e,t);return r<0?void 0:e[r][1]},zf.prototype.has=function(t){return Vf(this.__data__,t)>-1},zf.prototype.set=function(t,e){var r=this.__data__,i=Vf(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},qf.prototype.clear=function(){this.__data__={hash:new jf,map:new(Bf||zf),string:new jf}},qf.prototype.delete=function(t){return Hf(this,t).delete(t)},qf.prototype.get=function(t){return Hf(this,t).get(t)},qf.prototype.has=function(t){return Hf(this,t).has(t)},qf.prototype.set=function(t,e){return Hf(this,t).set(t,e),this};var Xf=Qf((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(ic(t))return $f?$f.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var r=[];return vf.test(t)&&r.push(""),t.replace(yf,(function(t,e,i,n){r.push(i?n.replace(wf,"$1"):e||t)})),r}));function Yf(t){if("string"==typeof t||ic(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function Qf(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=t.apply(this,i);return r.cache=o.set(n,s),s};return r.cache=new(Qf.Cache||qf),r}function tc(t,e){return t===e||t!=t&&e!=e}Qf.Cache=qf;var ec=Array.isArray;function rc(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ic(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==Pf.call(t)}var nc=function(t,e,r){return null==t?t:Kf(t,e,r)},oc=function(){function t(t,e,r,i){this.options={},this.calls=[],this.paths=[],this.network=t,this.provider=e,this.abi=r,this.options=i||{}}return t.prototype.call=function(t,e,r,i){return this.calls.push([e,r,i]),this.paths.push(t),this},t.prototype.execute=function(t){return e(this,void 0,void 0,(function(){var e,i=this;return r(this,(function(r){switch(r.label){case 0:return e=t||{},[4,QM(this.network,this.provider,this.abi,this.calls,this.options)];case 1:return r.sent().forEach((function(t,r){return nc(e,i.paths[r],t.length>1?t:t[0])})),this.calls=[],this.paths=[],[2,e]}}))}))},t}();let sc=!1,ac=!1;const hc={debug:1,default:2,info:2,warning:3,error:4,off:5};let uc=hc.default,lc=null;const fc=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var cc,dc;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(cc||(cc={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(dc||(dc={}));class mc{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==hc[r]&&this.throwArgumentError("invalid log level name","logLevel",t),uc>hc[r]||console.log.apply(console,e)}debug(...t){this._log(mc.levels.DEBUG,t)}info(...t){this._log(mc.levels.INFO,t)}warn(...t){this._log(mc.levels.WARNING,t)}makeError(t,e,r){if(ac)return this.makeError("censored error",e,{});e||(e=mc.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,mc.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){fc&&this.throwError("platform missing String.prototype.normalize",mc.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:fc})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,mc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,mc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,mc.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,mc.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",mc.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",mc.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",mc.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return lc||(lc=new mc("logger/5.3.0")),lc}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",mc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),sc){if(!t)return;this.globalLogger().throwError("error censorship permanent",mc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ac=!!t,sc=!!e}static setLogLevel(t){const e=hc[t.toLowerCase()];null!=e?uc=e:mc.globalLogger().warn("invalid log level - "+t)}static from(t){return new mc(t)}}mc.errors=dc,mc.levels=cc;const pc=new mc("networks/5.3.1");function gc(t){const e=function(e,r){null==r&&(r={});const i=[];if(e.InfuraProvider)try{i.push(new e.InfuraProvider(t,r.infura))}catch(t){}if(e.EtherscanProvider)try{i.push(new e.EtherscanProvider(t,r.etherscan))}catch(t){}if(e.AlchemyProvider)try{i.push(new e.AlchemyProvider(t,r.alchemy))}catch(t){}if(e.CloudflareProvider)try{i.push(new e.CloudflareProvider(t))}catch(t){}if(0===i.length)return null;if(e.FallbackProvider){let n=1;return null!=r.quorum?n=r.quorum:"homestead"===t&&(n=2),new e.FallbackProvider(i,n)}return i[0]};return e.renetwork=function(t){return gc(t)},e}function vc(t,e){const r=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null};return r.renetwork=function(e){return vc(t,e)},r}const yc={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:gc("homestead")},wc={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:gc("ropsten")},Mc={chainId:63,name:"classicMordor",_defaultProvider:vc("https://www.ethercluster.com/mordor","classicMordor")},bc={unspecified:{chainId:0,name:"unspecified"},homestead:yc,mainnet:yc,morden:{chainId:2,name:"morden"},ropsten:wc,testnet:wc,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:gc("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:gc("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:gc("goerli")},classic:{chainId:61,name:"classic",_defaultProvider:vc("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Mc,classicTestnet:Mc,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:vc("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic"},maticmum:{chainId:80001,name:"maticmum"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};let Ec=!1,_c=!1;const Nc={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ac=Nc.default,Sc=null;const Rc=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var xc,Ic;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(xc||(xc={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(Ic||(Ic={}));class kc{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Nc[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Ac>Nc[r]||console.log.apply(console,e)}debug(...t){this._log(kc.levels.DEBUG,t)}info(...t){this._log(kc.levels.INFO,t)}warn(...t){this._log(kc.levels.WARNING,t)}makeError(t,e,r){if(_c)return this.makeError("censored error",e,{});e||(e=kc.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,kc.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){Rc&&this.throwError("platform missing String.prototype.normalize",kc.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Rc})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,kc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,kc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,kc.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,kc.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",kc.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",kc.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",kc.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Sc||(Sc=new kc("logger/5.3.0")),Sc}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",kc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ec){if(!t)return;this.globalLogger().throwError("error censorship permanent",kc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_c=!!t,Ec=!!e}static setLogLevel(t){const e=Nc[t.toLowerCase()];null!=e?Ac=e:kc.globalLogger().warn("invalid log level - "+t)}static from(t){return new kc(t)}}kc.errors=Ic,kc.levels=xc;const Tc=new kc("bytes/5.3.0");function Oc(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Oc(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Pc(t,e){if(e||(e={}),"number"==typeof t){Tc.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Oc(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){if("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))return!1;if(e&&t.length!==2+2*e)return!1;return!0}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":Tc.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return Oc(new Uint8Array(i))}return function(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}(t)?Oc(new Uint8Array(t)):Tc.throwArgumentError("invalid arrayify value","value",t)}window&&window.__awaiter;new kc("properties/5.3.0");function Cc(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}class Uc{constructor(t){Cc(this,"alphabet",t),Cc(this,"base",t.length),Cc(this,"_alphabetMap",{}),Cc(this,"_leader",t.charAt(0));for(let e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}encode(t){let e=Pc(t);if(0===e.length)return"";let r=[0];for(let t=0;t<e.length;++t){let i=e[t];for(let t=0;t<r.length;++t)i+=r[t]<<8,r[t]=i%this.base,i=i/this.base|0;for(;i>0;)r.push(i%this.base),i=i/this.base|0}let i="";for(let t=0;0===e[t]&&t<e.length-1;++t)i+=this._leader;for(let t=r.length-1;t>=0;--t)i+=this.alphabet[r[t]];return i}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r<t.length;r++){let i=this._alphabetMap[t[r]];if(void 0===i)throw new Error("Non-base"+this.base+" character");let n=i;for(let t=0;t<e.length;++t)n+=e[t]*this.base,e[t]=255&n,n>>=8;for(;n>0;)e.push(255&n),n>>=8}for(let r=0;t[r]===this._leader&&r<t.length-1;++r)e.push(0);return Pc(new Uint8Array(e.reverse()))}}new Uc("abcdefghijklmnopqrstuvwxyz234567");const Fc=new Uc("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Bc=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,f=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!==(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);i=(m=m.idivn(d)).isZero()?p+i:u[c-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),l=this.clone();if(h){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],M=8191&w,b=w>>>13,E=0|s[4],_=8191&E,N=E>>>13,A=0|s[5],S=8191&A,R=A>>>13,x=0|s[6],I=8191&x,k=x>>>13,T=0|s[7],O=8191&T,P=T>>>13,C=0|s[8],U=8191&C,F=C>>>13,B=0|s[9],D=8191&B,L=B>>>13,$=0|a[0],j=8191&$,z=$>>>13,q=0|a[1],G=8191&q,V=q>>>13,Z=0|a[2],K=8191&Z,H=Z>>>13,W=0|a[3],J=8191&W,X=W>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(c,j)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,j),n=(n=Math.imul(v,z))+Math.imul(y,j)|0,o=Math.imul(y,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,V)|0;var yt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,z))+Math.imul(b,j)|0,o=Math.imul(b,z),i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,X)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(_,j),n=(n=Math.imul(_,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,X)|0;var Mt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(k,j)|0,o=Math.imul(k,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Et=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(u+(i=i+Math.imul(f,ht)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,z))+Math.imul(F,j)|0,o=Math.imul(F,z),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Nt=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,V)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(M,ot)|0,n=(n=n+Math.imul(M,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ht)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var At=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;u=((o=o+Math.imul(c,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,V))+Math.imul(L,G)|0,o=Math.imul(L,V),i=i+Math.imul(U,K)|0,n=(n=n+Math.imul(U,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var St=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,H))+Math.imul(L,K)|0,o=Math.imul(L,H),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,X)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,X))+Math.imul(L,J)|0,o=Math.imul(L,X),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var xt=(u+(i=i+Math.imul(M,mt)|0)|0)+((8191&(n=(n=n+Math.imul(M,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var It=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(U,ot)|0,n=(n=n+Math.imul(U,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ft)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(S,mt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(U,ht)|0,n=(n=n+Math.imul(U,ut)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(U,ft)|0,n=(n=n+Math.imul(U,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Ot=(u+(i=i+Math.imul(O,mt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ft),n=(n=Math.imul(D,ct))+Math.imul(L,ft)|0,o=Math.imul(L,ct);var Pt=(u+(i=i+Math.imul(U,mt)|0)|0)+((8191&(n=(n=n+Math.imul(U,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ct=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=Et,h[7]=_t,h[8]=Nt,h[9]=At,h[10]=St,h[11]=Rt,h[12]=xt,h[13]=It,h[14]=kt,h[15]=Tt,h[16]=Ot,h[17]=Pt,h[18]=Ct,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),c=67108863&f;a=67108863&(c=c+a|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},p.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},p.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var f=h,c=u,d=0;d<s;d++){var m=r[l+d],p=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=m+g,i[l+d]=p+v,r[l+d+s]=m-g,i[l+d+s]=p-v,d!==a&&(y=h*f-u*c,c=h*c+u*f,f=y)}},p.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},p.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},p.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,l,f,i,n);for(var d=0;d<i;d++){var m=a[d]*l[d]-h[d]*f[d];h[d]=a[d]*f[d]+h[d]*l[d],a[d]=m}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var f=h-1;f>=0;f--){var c=67108864*(0|i.words[o.length+f])+(0|i.words[o.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(f)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(M,v),i(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var v=this.pow(f,new n(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new _(t)},i(_,E),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,n)}));const Dc=new mc("bytes/5.3.0");function Lc(t){return!!t.toHexString}function $c(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return $c(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function jc(t){return Zc(t)&&!(t.length%2)||zc(t)}function zc(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function qc(t,e){if(e||(e={}),"number"==typeof t){Dc.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),$c(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Lc(t)&&(t=t.toHexString()),Zc(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":Dc.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return $c(new Uint8Array(i))}return zc(t)?$c(new Uint8Array(t)):Dc.throwArgumentError("invalid arrayify value","value",t)}function Gc(t){const e=t.map(t=>qc(t)),r=e.reduce((t,e)=>t+e.length,0),i=new Uint8Array(r);return e.reduce((t,e)=>(i.set(e,t),t+e.length),0),$c(i)}function Vc(t){let e=qc(t);if(0===e.length)return e;let r=0;for(;r<e.length&&0===e[r];)r++;return r&&(e=e.slice(r)),e}function Zc(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function Kc(t,e){if(e||(e={}),"number"==typeof t){Dc.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Lc(t))return t.toHexString();if(Zc(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Dc.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(zc(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return Dc.throwArgumentError("invalid hexlify value","value",t)}function Hc(t){if("string"!=typeof t)t=Kc(t);else if(!Zc(t)||t.length%2)return null;return(t.length-2)/2}function Wc(t,e,r){return"string"!=typeof t?t=Kc(t):(!Zc(t)||t.length%2)&&Dc.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Jc(t){let e="0x";return t.forEach(t=>{e+=Kc(t).substring(2)}),e}function Xc(t){const e=function(t){"string"!=typeof t&&(t=Kc(t));Zc(t)||Dc.throwArgumentError("invalid hex string","value",t);t=t.substring(2);let e=0;for(;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}(Kc(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function Yc(t,e){for("string"!=typeof t?t=Kc(t):Zc(t)||Dc.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Dc.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Qc(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(jc(t)){const r=qc(t);65!==r.length&&Dc.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),e.r=Kc(r.slice(0,32)),e.s=Kc(r.slice(32,64)),e.v=r[64],e.v<27&&(0===e.v||1===e.v?e.v+=27:Dc.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Kc(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=qc(t)).length>e&&Dc.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),$c(r)}(qc(e._vs),32);e._vs=Kc(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&Dc.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const n=Kc(r);null==e.s?e.s=n:e.s!==n&&Dc.throwArgumentError("signature v mismatch _vs","signature",t)}null==e.recoveryParam?null==e.v?Dc.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2:null==e.v?e.v=27+e.recoveryParam:e.recoveryParam!==1-e.v%2&&Dc.throwArgumentError("signature recoveryParam mismatch v","signature",t),null!=e.r&&Zc(e.r)?e.r=Yc(e.r,32):Dc.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Zc(e.s)?e.s=Yc(e.s,32):Dc.throwArgumentError("signature missing or invalid s","signature",t);const r=qc(e.s);r[0]>=128&&Dc.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=Kc(r);e._vs&&(Zc(e._vs)||Dc.throwArgumentError("signature invalid _vs","signature",t),e._vs=Yc(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&Dc.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e}var td=Bc.BN;const ed=new mc("bignumber/5.3.0"),rd={};let id=!1;class nd{constructor(t,e){ed.checkNew(new.target,nd),t!==rd&&ed.throwError("cannot call constructor directly; use BigNumber.from",mc.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return sd(ad(this).fromTwos(t))}toTwos(t){return sd(ad(this).toTwos(t))}abs(){return"-"===this._hex[0]?nd.from(this._hex.substring(1)):this}add(t){return sd(ad(this).add(ad(t)))}sub(t){return sd(ad(this).sub(ad(t)))}div(t){return nd.from(t).isZero()&&hd("division by zero","div"),sd(ad(this).div(ad(t)))}mul(t){return sd(ad(this).mul(ad(t)))}mod(t){const e=ad(t);return e.isNeg()&&hd("cannot modulo negative values","mod"),sd(ad(this).umod(e))}pow(t){const e=ad(t);return e.isNeg()&&hd("cannot raise to negative values","pow"),sd(ad(this).pow(e))}and(t){const e=ad(t);return(this.isNegative()||e.isNeg())&&hd("cannot 'and' negative values","and"),sd(ad(this).and(e))}or(t){const e=ad(t);return(this.isNegative()||e.isNeg())&&hd("cannot 'or' negative values","or"),sd(ad(this).or(e))}xor(t){const e=ad(t);return(this.isNegative()||e.isNeg())&&hd("cannot 'xor' negative values","xor"),sd(ad(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&hd("cannot mask negative values","mask"),sd(ad(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&hd("cannot shift negative values","shl"),sd(ad(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&hd("cannot shift negative values","shr"),sd(ad(this).shrn(t))}eq(t){return ad(this).eq(ad(t))}lt(t){return ad(this).lt(ad(t))}lte(t){return ad(this).lte(ad(t))}gt(t){return ad(this).gt(ad(t))}gte(t){return ad(this).gte(ad(t))}isNegative(){return"-"===this._hex[0]}isZero(){return ad(this).isZero()}toNumber(){try{return ad(this).toNumber()}catch(t){hd("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return ed.throwError("this platform does not support BigInt",mc.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?id||(id=!0,ed.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?ed.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",mc.errors.UNEXPECTED_ARGUMENT,{}):ed.throwError("BigNumber.toString does not accept parameters",mc.errors.UNEXPECTED_ARGUMENT,{})),ad(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof nd)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new nd(rd,od(t)):t.match(/^-?[0-9]+$/)?new nd(rd,od(new td(t))):ed.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&hd("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&hd("overflow","BigNumber.from",t),nd.from(String(t));const e=t;if("bigint"==typeof e)return nd.from(e.toString());if(zc(e))return nd.from(Kc(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return nd.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Zc(t)||"-"===t[0]&&Zc(t.substring(1))))return nd.from(t)}return ed.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function od(t){if("string"!=typeof t)return od(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&ed.throwArgumentError("invalid hex","value",t),"0x00"===(t=od(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function sd(t){return nd.from(od(t))}function ad(t){const e=nd.from(t).toHexString();return"-"===e[0]?new td("-"+e.substring(3),16):new td(e.substring(2),16)}function hd(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),ed.throwError(t,mc.errors.NUMERIC_FAULT,i)}const ud=nd.from(0);function ld(t){return"0x"+si.keccak_256(qc(t))}const fd=new mc("strings/5.3.0");var cd,dd;function md(t,e,r,i,n){if(t===dd.BAD_PREFIX||t===dd.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===dd.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(cd||(cd={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(dd||(dd={}));const pd=Object.freeze({error:function(t,e,r,i,n){return fd.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:md,replace:function(t,e,r,i,n){return t===dd.OVERLONG?(i.push(n),0):(i.push(65533),md(t,e,r))}});function gd(t,e){null==e&&(e=pd.error),t=qc(t);const r=[];let i=0;for(;i<t.length;){const n=t[i++];if(n>>7==0){r.push(n);continue}let o=null,s=null;if(192==(224&n))o=1,s=127;else if(224==(240&n))o=2,s=2047;else{if(240!=(248&n)){i+=e(128==(192&n)?dd.UNEXPECTED_CONTINUE:dd.BAD_PREFIX,i-1,t,r);continue}o=3,s=65535}if(i-1+o>=t.length){i+=e(dd.OVERRUN,i-1,t,r);continue}let a=n&(1<<8-o-1)-1;for(let n=0;n<o;n++){let n=t[i];if(128!=(192&n)){i+=e(dd.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|63&n,i++}null!==a&&(a>1114111?i+=e(dd.OUT_OF_RANGE,i-1-o,t,r,a):a>=55296&&a<=57343?i+=e(dd.UTF16_SURROGATE,i-1-o,t,r,a):a<=s?i+=e(dd.OVERLONG,i-1-o,t,r,a):r.push(a))}return r}function vd(t,e=cd.current){e!=cd.current&&(fd.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&i)<<10)+(1023&n);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(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return qc(r)}function yd(t){return t.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t)))).join("")}function wd(t,e){return yd(gd(t,e))}function Md(t,e=cd.current){return gd(vd(t,e))}function bd(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,i={};return t.split(",").forEach(t=>{let n=t.split(":");r+=parseInt(n[0],16),i[r]=e(n[1])}),i}function Ed(t){let e=0;return t.split(",").map(t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let i=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:i,h:e}})}function _d(t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];if(r+=n.l,t>=r&&t<=r+n.h&&(t-r)%(n.d||1)==0){if(n.e&&-1!==n.e.indexOf(t-r))continue;return n}}return null}const Nd=Ed("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Ad="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),Sd=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Rd=bd("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),xd=bd("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Id=bd("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e})),kd=Ed("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function Td(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let e=Md(t);var r;r=e.map(t=>{if(Ad.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=_d(t,Sd);if(e)return[t+e.s];let r=Rd[t];if(r)return r;let i=xd[t];return i?[t+i[0]]:Id[t]||null}(t);return e||[t]}),e=r.reduce((t,e)=>(e.forEach(e=>{t.push(e)}),t),[]),e=Md(yd(e),cd.NFKC),e.forEach(t=>{if(_d(t,kd))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),e.forEach(t=>{if(_d(t,Nd))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let i=yd(e);if("-"===i.substring(0,1)||"--"===i.substring(2,4)||"-"===i.substring(i.length-1))throw new Error("invalid hyphen");if(i.length>63)throw new Error("too long");return i}function Od(t){return ld(vd(t))}const Pd=new mc("hash/5.3.0"),Cd=new Uint8Array(32);Cd.fill(0);const Ud=new RegExp("^((.*)\\.)?([^.]+)$");function Fd(t){"string"!=typeof t&&Pd.throwArgumentError("invalid ENS name; not a string","name",t);let e=t,r=Cd;for(;e.length;){const i=e.match(Ud);null!=i&&""!==i[2]||Pd.throwArgumentError("invalid ENS address; missing component","name",t);r=ld(Gc([r,ld(vd(Td(i[3])))])),e=i[2]||""}return Kc(r)}const Bd=new mc("rlp/5.3.0");function Dd(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function Ld(t,e,r){let i=0;for(let n=0;n<r;n++)i=256*i+t[e+n];return i}function $d(t){return Kc(function t(e){if(Array.isArray(e)){let r=[];if(e.forEach((function(e){r=r.concat(t(e))})),r.length<=55)return r.unshift(192+r.length),r;const i=Dd(r.length);return i.unshift(247+i.length),i.concat(r)}jc(e)||Bd.throwArgumentError("RLP object must be BytesLike","object",e);const r=Array.prototype.slice.call(qc(e));if(1===r.length&&r[0]<=127)return r;if(r.length<=55)return r.unshift(128+r.length),r;const i=Dd(r.length);return i.unshift(183+i.length),i.concat(r)}(t))}function jd(t,e,r,i){const n=[];for(;r<e+1+i;){const o=zd(t,r);n.push(o.result),(r+=o.consumed)>e+1+i&&Bd.throwError("child data too short",mc.errors.BUFFER_OVERRUN,{})}return{consumed:1+i,result:n}}function zd(t,e){if(0===t.length&&Bd.throwError("data too short",mc.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&Bd.throwError("data short segment too short",mc.errors.BUFFER_OVERRUN,{});const i=Ld(t,e+1,r);return e+1+r+i>t.length&&Bd.throwError("data long segment too short",mc.errors.BUFFER_OVERRUN,{}),jd(t,e,e+1+r,r+i)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&Bd.throwError("data array too short",mc.errors.BUFFER_OVERRUN,{}),jd(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&Bd.throwError("data array too short",mc.errors.BUFFER_OVERRUN,{});const i=Ld(t,e+1,r);e+1+r+i>t.length&&Bd.throwError("data array too short",mc.errors.BUFFER_OVERRUN,{});return{consumed:1+r+i,result:Kc(t.slice(e+1+r,e+1+r+i))}}if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&Bd.throwError("data too short",mc.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:Kc(t.slice(e+1,e+1+r))}}return{consumed:1,result:Kc(t[e])}}function qd(t){const e=qc(t),r=zd(e,0);return r.consumed!==e.length&&Bd.throwArgumentError("invalid rlp data","data",t),r.result}const Gd=new mc("address/5.3.0");function Vd(t){Zc(t,20)||Gd.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=qc(ld(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Zd={};for(let t=0;t<10;t++)Zd[String(t)]=String(t);for(let t=0;t<26;t++)Zd[String.fromCharCode(65+t)]=String(10+t);const Kd=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Hd(t){let e=null;if("string"!=typeof t&&Gd.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Vd(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Gd.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>Zd[t]).join("");for(;e.length>=Kd;){let t=e.substring(0,Kd);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&Gd.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new td(r,36).toString(16);e.length<40;)e="0"+e;e=Vd("0x"+e)}else Gd.throwArgumentError("invalid address","address",t);var r;return e}var Wd=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Jd=new mc("properties/5.3.0");function Xd(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Yd(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function Qd(t){return Wd(this,void 0,void 0,(function*(){const e=Object.keys(t).map(e=>{const r=t[e];return Promise.resolve(r).then(t=>({key:e,value:t}))});return(yield Promise.all(e)).reduce((t,e)=>(t[e.key]=e.value,t),{})}))}function tm(t){const e={};for(const r in t)e[r]=t[r];return e}const em={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function rm(t){if(function t(e){if(null==e||em[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const r=Object.keys(e);for(let i=0;i<r.length;i++)if(!t(e[r[i]]))return!1;return!0}return Jd.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}(t))return t;if(Array.isArray(t))return Object.freeze(t.map(t=>im(t)));if("object"==typeof t){const e={};for(const r in t){const i=t[r];void 0!==i&&Xd(e,r,im(i))}return e}return Jd.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function im(t){return rm(t)}var nm=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const om=new mc("hash/5.3.0"),sm=new Uint8Array(32);sm.fill(0);const am=nd.from(-1),hm=nd.from(0),um=nd.from(1),lm=nd.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const fm=Yc(um.toHexString(),32),cm=Yc(hm.toHexString(),32),dm={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},mm=["name","version","chainId","verifyingContract","salt"];function pm(t){return function(e){return"string"!=typeof e&&om.throwArgumentError("invalid domain value for "+JSON.stringify(t),"domain."+t,e),e}}const gm={name:pm("name"),version:pm("version"),chainId:function(t){try{return nd.from(t).toString()}catch(t){}return om.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Hd(t).toLowerCase()}catch(t){}return om.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=qc(t);if(32!==e.length)throw new Error("bad length");return Kc(e)}catch(t){}return om.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function vm(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&om.throwArgumentError("invalid numeric width","type",t);const n=lm.mask(r?i-1:i),o=r?n.add(um).mul(am):hm;return function(e){const r=nd.from(e);return(r.lt(o)||r.gt(n))&&om.throwArgumentError("value out-of-bounds for "+t,"value",e),Yc(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&om.throwArgumentError("invalid bytes width","type",t),function(e){return qc(e).length!==r&&om.throwArgumentError("invalid length for "+t,"value",e),function(t){const e=qc(t),r=e.length%32;return r?Jc([e,sm.slice(r)]):Kc(e)}(e)}}}switch(t){case"address":return function(t){return Yc(Hd(t),32)};case"bool":return function(t){return t?fm:cm};case"bytes":return function(t){return ld(t)};case"string":return function(t){return Od(t)}}return null}function ym(t,e){return`${t}(${e.map(({name:t,type:e})=>e+" "+t).join(",")})`}class wm{constructor(t){Xd(this,"types",Object.freeze(im(t))),Xd(this,"_encoderCache",{}),Xd(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach(t=>{e[t]={},r[t]=[],i[t]={}});for(const i in t){const n={};t[i].forEach(o=>{n[o.name]&&om.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===i&&om.throwArgumentError("circular type reference to "+JSON.stringify(s),"types",t);vm(s)||(r[s]||om.throwArgumentError("unknown type "+JSON.stringify(s),"types",t),r[s].push(i),e[i][s]=!0)})}const n=Object.keys(r).filter(t=>0===r[t].length);0===n.length?om.throwArgumentError("missing primary type","types",t):n.length>1&&om.throwArgumentError("ambiguous primary types or unused types: "+n.map(t=>JSON.stringify(t)).join(", "),"types",t),Xd(this,"primaryType",n[0]),function n(o,s){s[o]&&om.throwArgumentError("circular type reference to "+JSON.stringify(o),"types",t),s[o]=!0,Object.keys(e[o]).forEach(t=>{r[t]&&(n(t,s),Object.keys(s).forEach(e=>{i[e][t]=!0}))}),delete s[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=ym(e,t[e])+r.map(e=>ym(e,t[e])).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=vm(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&om.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(ld)),ld(Jc(n))}}const r=this.types[t];if(r){const e=Od(this._types[t]);return t=>{const i=r.map(({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?ld(i):i});return i.unshift(e),Jc(i)}}return om.throwArgumentError("unknown type: "+t,"type",t)}encodeType(t){const e=this._types[t];return e||om.throwArgumentError("unknown type: "+JSON.stringify(t),"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return ld(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(vm(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&om.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map(e=>this._visit(t,e,r))}const n=this.types[t];return n?n.reduce((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t),{}):om.throwArgumentError("unknown type: "+t,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new wm(t)}static getPrimaryType(t){return wm.from(t).primaryType}static hashStruct(t,e,r){return wm.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=dm[r];i||om.throwArgumentError("invalid typed-data domain key: "+JSON.stringify(r),"domain",t),e.push({name:r,type:i})}return e.sort((t,e)=>mm.indexOf(t.name)-mm.indexOf(e.name)),wm.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Jc(["0x1901",wm.hashDomain(t),wm.from(e).hash(r)])}static hash(t,e,r){return ld(wm.encode(t,e,r))}static resolveNames(t,e,r,i){return nm(this,void 0,void 0,(function*(){t=tm(t);const n={};t.verifyingContract&&!Zc(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=wm.from(e);o.visit(r,(t,e)=>("address"!==t||Zc(e,20)||(n[e]="0x"),e));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,(t,e)=>"address"===t&&n[e]?n[e]:e),{domain:t,value:r}}))}static getPayload(t,e,r){wm.hashDomain(t);const i={},n=[];mm.forEach(e=>{const r=t[e];null!=r&&(i[e]=gm[e](r),n.push({name:e,type:dm[e]}))});const o=wm.from(e),s=tm(e);return s.EIP712Domain?om.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=n,o.encode(r),{types:s,domain:i,primaryType:o.primaryType,message:o.visit(r,(t,e)=>{if(t.match(/^bytes(\d*)/))return Kc(qc(e));if(t.match(/^u?int/))return nd.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&om.throwArgumentError("invalid string","value",e),e}return om.throwArgumentError("unsupported type","type",t)})}}}var Mm=bm;function bm(t,e){if(!t)throw new Error(e||"Assertion failed")}function Em(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function _m(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function Nm(t){return 1===t.length?"0"+t:t}function Am(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}bm.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Sm={inherits:a((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),toArray:function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var o=t.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=63&o|128):Em(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n<t.length;n++)r[n]=0|t[n];return r},toHex:function(t){for(var e="",r=0;r<t.length;r++)e+=Nm(t[r].toString(16));return e},htonl:_m,toHex32:function(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];"little"===e&&(n=_m(n)),r+=Am(n.toString(16))}return r},zero2:Nm,zero8:Am,join32:function(t,e,r,i){var n=r-e;Mm(n%4==0);for(var o=new Array(n/4),s=0,a=e;s<o.length;s++,a+=4){var h;h="big"===i?t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],o[s]=h>>>0}return o},split32:function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i<t.length;i++,n+=4){var o=t[i];"big"===e?(r[n]=o>>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},rotr32:function(t,e){return t>>>e|t<<32-e},rotl32:function(t,e){return t<<e|t>>>32-e},sum32:function(t,e){return t+e>>>0},sum32_3:function(t,e,r){return t+e+r>>>0},sum32_4:function(t,e,r,i){return t+e+r+i>>>0},sum32_5:function(t,e,r,i,n){return t+e+r+i+n>>>0},sum64:function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,s=(o<i?1:0)+r+n;t[e]=s>>>0,t[e+1]=o},sum64_hi:function(t,e,r,i){return(e+i>>>0<e?1:0)+t+r>>>0},sum64_lo:function(t,e,r,i){return e+i>>>0},sum64_4_hi:function(t,e,r,i,n,o,s,a){var h=0,u=e;return h+=(u=u+i>>>0)<e?1:0,h+=(u=u+o>>>0)<o?1:0,t+r+n+s+(h+=(u=u+a>>>0)<a?1:0)>>>0},sum64_4_lo:function(t,e,r,i,n,o,s,a){return e+i+o+a>>>0},sum64_5_hi:function(t,e,r,i,n,o,s,a,h,u){var l=0,f=e;return l+=(f=f+i>>>0)<e?1:0,l+=(f=f+o>>>0)<o?1:0,l+=(f=f+a>>>0)<a?1:0,t+r+n+s+h+(l+=(f=f+u>>>0)<u?1:0)>>>0},sum64_5_lo:function(t,e,r,i,n,o,s,a,h,u){return e+i+o+a+u>>>0},rotr64_hi:function(t,e,r){return(e<<32-r|t>>>r)>>>0},rotr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0},shr64_hi:function(t,e,r){return t>>>r},shr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0}};function Rm(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var xm=Rm;Rm.prototype.update=function(t,e){if(t=Sm.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=Sm.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},Rm.prototype.digest=function(t){return this.update(this._pad()),Mm(null===this.pending),this._digest(t)},Rm.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=t>>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o<this.padLength;o++)i[n++]=0;return i};var Im={BlockHash:xm},km=Sm.rotr32;function Tm(t,e,r){return t&e^~t&r}function Om(t,e,r){return t&e^t&r^e&r}function Pm(t,e,r){return t^e^r}var Cm={ft_1:function(t,e,r,i){return 0===t?Tm(e,r,i):1===t||3===t?Pm(e,r,i):2===t?Om(e,r,i):void 0},ch32:Tm,maj32:Om,p32:Pm,s0_256:function(t){return km(t,2)^km(t,13)^km(t,22)},s1_256:function(t){return km(t,6)^km(t,11)^km(t,25)},g0_256:function(t){return km(t,7)^km(t,18)^t>>>3},g1_256:function(t){return km(t,17)^km(t,19)^t>>>10}},Um=Sm.rotl32,Fm=Sm.sum32,Bm=Sm.sum32_5,Dm=Cm.ft_1,Lm=Im.BlockHash,$m=[1518500249,1859775393,2400959708,3395469782];function jm(){if(!(this instanceof jm))return new jm;Lm.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Sm.inherits(jm,Lm);var zm=jm;jm.blockSize=512,jm.outSize=160,jm.hmacStrength=80,jm.padLength=64,jm.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=Um(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4];for(i=0;i<r.length;i++){var u=~~(i/20),l=Bm(Um(n,5),Dm(u,o,s,a),h,r[i],$m[u]);h=a,a=s,s=Um(o,30),o=n,n=l}this.h[0]=Fm(this.h[0],n),this.h[1]=Fm(this.h[1],o),this.h[2]=Fm(this.h[2],s),this.h[3]=Fm(this.h[3],a),this.h[4]=Fm(this.h[4],h)},jm.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h,"big"):Sm.split32(this.h,"big")};var qm=Sm.sum32,Gm=Sm.sum32_4,Vm=Sm.sum32_5,Zm=Cm.ch32,Km=Cm.maj32,Hm=Cm.s0_256,Wm=Cm.s1_256,Jm=Cm.g0_256,Xm=Cm.g1_256,Ym=Im.BlockHash,Qm=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function tp(){if(!(this instanceof tp))return new tp;Ym.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Qm,this.W=new Array(64)}Sm.inherits(tp,Ym);var ep=tp;function rp(){if(!(this instanceof rp))return new rp;ep.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}tp.blockSize=512,tp.outSize=256,tp.hmacStrength=192,tp.padLength=64,tp.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=Gm(Xm(r[i-2]),r[i-7],Jm(r[i-15]),r[i-16]);var n=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4],u=this.h[5],l=this.h[6],f=this.h[7];for(Mm(this.k.length===r.length),i=0;i<r.length;i++){var c=Vm(f,Wm(h),Zm(h,u,l),this.k[i],r[i]),d=qm(Hm(n),Km(n,o,s));f=l,l=u,u=h,h=qm(a,c),a=s,s=o,o=n,n=qm(c,d)}this.h[0]=qm(this.h[0],n),this.h[1]=qm(this.h[1],o),this.h[2]=qm(this.h[2],s),this.h[3]=qm(this.h[3],a),this.h[4]=qm(this.h[4],h),this.h[5]=qm(this.h[5],u),this.h[6]=qm(this.h[6],l),this.h[7]=qm(this.h[7],f)},tp.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h,"big"):Sm.split32(this.h,"big")},Sm.inherits(rp,ep);var ip=rp;rp.blockSize=512,rp.outSize=224,rp.hmacStrength=192,rp.padLength=64,rp.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h.slice(0,7),"big"):Sm.split32(this.h.slice(0,7),"big")};var np=Sm.rotr64_hi,op=Sm.rotr64_lo,sp=Sm.shr64_hi,ap=Sm.shr64_lo,hp=Sm.sum64,up=Sm.sum64_hi,lp=Sm.sum64_lo,fp=Sm.sum64_4_hi,cp=Sm.sum64_4_lo,dp=Sm.sum64_5_hi,mp=Sm.sum64_5_lo,pp=Im.BlockHash,gp=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function vp(){if(!(this instanceof vp))return new vp;pp.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=gp,this.W=new Array(160)}Sm.inherits(vp,pp);var yp=vp;function wp(t,e,r,i,n){var o=t&r^~t&n;return o<0&&(o+=4294967296),o}function Mp(t,e,r,i,n,o){var s=e&i^~e&o;return s<0&&(s+=4294967296),s}function bp(t,e,r,i,n){var o=t&r^t&n^r&n;return o<0&&(o+=4294967296),o}function Ep(t,e,r,i,n,o){var s=e&i^e&o^i&o;return s<0&&(s+=4294967296),s}function _p(t,e){var r=np(t,e,28)^np(e,t,2)^np(e,t,7);return r<0&&(r+=4294967296),r}function Np(t,e){var r=op(t,e,28)^op(e,t,2)^op(e,t,7);return r<0&&(r+=4294967296),r}function Ap(t,e){var r=np(t,e,14)^np(t,e,18)^np(e,t,9);return r<0&&(r+=4294967296),r}function Sp(t,e){var r=op(t,e,14)^op(t,e,18)^op(e,t,9);return r<0&&(r+=4294967296),r}function Rp(t,e){var r=np(t,e,1)^np(t,e,8)^sp(t,e,7);return r<0&&(r+=4294967296),r}function xp(t,e){var r=op(t,e,1)^op(t,e,8)^ap(t,e,7);return r<0&&(r+=4294967296),r}function Ip(t,e){var r=np(t,e,19)^np(e,t,29)^sp(t,e,6);return r<0&&(r+=4294967296),r}function kp(t,e){var r=op(t,e,19)^op(e,t,29)^ap(t,e,6);return r<0&&(r+=4294967296),r}function Tp(){if(!(this instanceof Tp))return new Tp;yp.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}vp.blockSize=1024,vp.outSize=512,vp.hmacStrength=192,vp.padLength=128,vp.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i<r.length;i+=2){var n=Ip(r[i-4],r[i-3]),o=kp(r[i-4],r[i-3]),s=r[i-14],a=r[i-13],h=Rp(r[i-30],r[i-29]),u=xp(r[i-30],r[i-29]),l=r[i-32],f=r[i-31];r[i]=fp(n,o,s,a,h,u,l,f),r[i+1]=cp(n,o,s,a,h,u,l,f)}},vp.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,i=this.h[0],n=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],h=this.h[5],u=this.h[6],l=this.h[7],f=this.h[8],c=this.h[9],d=this.h[10],m=this.h[11],p=this.h[12],g=this.h[13],v=this.h[14],y=this.h[15];Mm(this.k.length===r.length);for(var w=0;w<r.length;w+=2){var M=v,b=y,E=Ap(f,c),_=Sp(f,c),N=wp(f,c,d,m,p),A=Mp(f,c,d,m,p,g),S=this.k[w],R=this.k[w+1],x=r[w],I=r[w+1],k=dp(M,b,E,_,N,A,S,R,x,I),T=mp(M,b,E,_,N,A,S,R,x,I);M=_p(i,n),b=Np(i,n),E=bp(i,n,o,s,a),_=Ep(i,n,o,s,a,h);var O=up(M,b,E,_),P=lp(M,b,E,_);v=p,y=g,p=d,g=m,d=f,m=c,f=up(u,l,k,T),c=lp(l,l,k,T),u=a,l=h,a=o,h=s,o=i,s=n,i=up(k,T,O,P),n=lp(k,T,O,P)}hp(this.h,0,i,n),hp(this.h,2,o,s),hp(this.h,4,a,h),hp(this.h,6,u,l),hp(this.h,8,f,c),hp(this.h,10,d,m),hp(this.h,12,p,g),hp(this.h,14,v,y)},vp.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h,"big"):Sm.split32(this.h,"big")},Sm.inherits(Tp,yp);var Op=Tp;Tp.blockSize=1024,Tp.outSize=384,Tp.hmacStrength=192,Tp.padLength=128,Tp.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h.slice(0,12),"big"):Sm.split32(this.h.slice(0,12),"big")};var Pp={sha1:zm,sha224:ip,sha256:ep,sha384:Op,sha512:yp},Cp=Sm.rotl32,Up=Sm.sum32,Fp=Sm.sum32_3,Bp=Sm.sum32_4,Dp=Im.BlockHash;function Lp(){if(!(this instanceof Lp))return new Lp;Dp.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Sm.inherits(Lp,Dp);var $p=Lp;function jp(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function zp(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function qp(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}Lp.blockSize=512,Lp.outSize=160,Lp.hmacStrength=192,Lp.padLength=64,Lp.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],o=this.h[3],s=this.h[4],a=r,h=i,u=n,l=o,f=s,c=0;c<80;c++){var d=Up(Cp(Bp(r,jp(c,i,n,o),t[Gp[c]+e],zp(c)),Zp[c]),s);r=s,s=o,o=Cp(n,10),n=i,i=d,d=Up(Cp(Bp(a,jp(79-c,h,u,l),t[Vp[c]+e],qp(c)),Kp[c]),f),a=f,f=l,l=Cp(u,10),u=h,h=d}d=Fp(this.h[1],n,l),this.h[1]=Fp(this.h[2],o,f),this.h[2]=Fp(this.h[3],s,a),this.h[3]=Fp(this.h[4],r,h),this.h[4]=Fp(this.h[0],i,u),this.h[0]=d},Lp.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h,"little"):Sm.split32(this.h,"little")};var Gp=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Vp=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Zp=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Kp=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Hp={ripemd160:$p};function Wp(t,e,r){if(!(this instanceof Wp))return new Wp(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(Sm.toArray(e,r))}var Jp=Wp;Wp.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),Mm(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},Wp.prototype.update=function(t,e){return this.inner.update(t,e),this},Wp.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};var Xp=a((function(t,e){var r=e;r.utils=Sm,r.common=Im,r.sha=Pp,r.ripemd=Hp,r.hmac=Jp,r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160}));let Yp=!1,Qp=!1;const tg={debug:1,default:2,info:2,warning:3,error:4,off:5};let eg=tg.default,rg=null;const ig=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var ng,og;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ng||(ng={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(og||(og={}));class sg{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==tg[r]&&this.throwArgumentError("invalid log level name","logLevel",t),eg>tg[r]||console.log.apply(console,e)}debug(...t){this._log(sg.levels.DEBUG,t)}info(...t){this._log(sg.levels.INFO,t)}warn(...t){this._log(sg.levels.WARNING,t)}makeError(t,e,r){if(Qp)return this.makeError("censored error",e,{});e||(e=sg.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,sg.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){ig&&this.throwError("platform missing String.prototype.normalize",sg.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ig})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,sg.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,sg.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,sg.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,sg.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",sg.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",sg.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",sg.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return rg||(rg=new sg("logger/5.3.0")),rg}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",sg.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Yp){if(!t)return;this.globalLogger().throwError("error censorship permanent",sg.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Qp=!!t,Yp=!!e}static setLogLevel(t){const e=tg[t.toLowerCase()];null!=e?eg=e:sg.globalLogger().warn("invalid log level - "+t)}static from(t){return new sg(t)}}sg.errors=og,sg.levels=ng;const ag=new sg("bytes/5.3.0");function hg(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return hg(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function ug(t,e){if(e||(e={}),"number"==typeof t){ag.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),hg(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){if("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))return!1;if(e&&t.length!==2+2*e)return!1;return!0}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":ag.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return hg(new Uint8Array(i))}return function(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}(t)?hg(new Uint8Array(t)):ag.throwArgumentError("invalid arrayify value","value",t)}new sg("sha2/5.3.0");function lg(t){return"0x"+Xp.sha256().update(ug(t)).digest("hex")}function fg(t){t=qc(t);let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}var cg=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};function dg(t,e){return cg(this,void 0,void 0,(function*(){null==e&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0,mode:"cors",cache:"no-cache",credentials:"same-origin",redirect:"follow",referrer:"client"},i=yield fetch(t,r),n=yield i.arrayBuffer(),o={};return i.headers.forEach?i.headers.forEach((t,e)=>{o[e.toLowerCase()]=t}):i.headers.keys().forEach(t=>{o[t.toLowerCase()]=i.headers.get(t)}),{headers:o,statusCode:i.status,statusMessage:i.statusText,body:qc(new Uint8Array(n))}}))}var mg=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const pg=new mc("web/5.3.0");function gg(t){return new Promise(e=>{setTimeout(e,t)})}function vg(t,e){if(null==t)return null;if("string"==typeof t)return t;if(jc(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return wd(t)}catch(t){}return Kc(t)}return t}function yg(t,e,r){let i=null;if(null!=e){i=vd(e);const r="string"==typeof t?{url:t}:tm(t);if(r.headers){0!==Object.keys(r.headers).filter(t=>"content-type"===t.toLowerCase()).length||(r.headers=tm(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return function(t,e,r){const i="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;pg.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const n="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;pg.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s={};let a=null;const h={method:"GET"};let u=!1,l=12e4;if("string"==typeof t)a=t;else if("object"==typeof t){if(null!=t&&null!=t.url||pg.throwArgumentError("missing URL","connection.url",t),a=t.url,"number"==typeof t.timeout&&t.timeout>0&&(l=t.timeout),t.headers)for(const e in t.headers)s[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(u=!0);if(h.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==a.substring(0,6)&&!0!==t.allowInsecureAuthentication&&pg.throwError("basic authentication requires a secure https url",mc.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;s.authorization={key:"Authorization",value:"Basic "+fg(vd(e))}}}e&&(h.method="POST",h.body=e,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(e.length)}));const f={};Object.keys(s).forEach(t=>{const e=s[t];f[e.key]=e.value}),h.headers=f;const c=function(){let t=null;return{promise:new Promise((function(e,r){l&&(t=setTimeout(()=>{null!=t&&(t=null,r(pg.makeError("timeout",mc.errors.TIMEOUT,{requestBody:vg(h.body,f["content-type"]),requestMethod:h.method,timeout:l,url:a})))},l))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),d=function(){return mg(this,void 0,void 0,(function*(){for(let t=0;t<i;t++){let e=null;try{if(e=yield dg(a,h),429===e.statusCode&&t<i){let r=!0;if(n&&(r=yield n(t,a)),r){let r=0;const i=e.headers["retry-after"];r="string"==typeof i&&i.match(/^[1-9][0-9]*$/)?1e3*parseInt(i):o*parseInt(String(Math.random()*Math.pow(2,t))),yield gg(r);continue}}}catch(t){e=t.response,null==e&&(c.cancel(),pg.throwError("missing response",mc.errors.SERVER_ERROR,{requestBody:vg(h.body,f["content-type"]),requestMethod:h.method,serverError:t,url:a}))}let s=e.body;if(u&&304===e.statusCode?s=null:(e.statusCode<200||e.statusCode>=300)&&(c.cancel(),pg.throwError("bad response",mc.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:vg(s,e.headers?e.headers["content-type"]:null),requestBody:vg(h.body,f["content-type"]),requestMethod:h.method,url:a})),r)try{const t=yield r(s,e);return c.cancel(),t}catch(r){if(r.throttleRetry&&t<i){let e=!0;if(n&&(e=yield n(t,a)),e){const e=o*parseInt(String(Math.random()*Math.pow(2,t)));yield gg(e);continue}}c.cancel(),pg.throwError("processing response error",mc.errors.SERVER_ERROR,{body:vg(s,e.headers?e.headers["content-type"]:null),error:r,requestBody:vg(h.body,f["content-type"]),requestMethod:h.method,url:a})}return c.cancel(),s}return pg.throwError("failed response",mc.errors.SERVER_ERROR,{requestBody:vg(h.body,f["content-type"]),requestMethod:h.method,url:a})}))}();return Promise.race([c.promise,d])}(t,i,(t,e)=>{let i=null;if(null!=t)try{i=JSON.parse(wd(t))}catch(e){pg.throwError("invalid JSON",mc.errors.SERVER_ERROR,{body:t,error:e})}return r&&(i=r(i,e)),i})}function wg(t,e){return e||(e={}),null==(e=tm(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,i){let n=null,o=!1;const s=()=>!o&&(o=!0,n&&clearTimeout(n),!0);e.timeout&&(n=setTimeout(()=>{s()&&i(new Error("timeout"))},e.timeout));const a=e.retryLimit;let h=0;!function n(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",n);else if(e.onceBlock)e.onceBlock.once("block",n);else if(!o){if(h++,h>a)return void(s()&&i(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,h)));t<e.floor&&(t=e.floor),t>e.ceiling&&(t=e.ceiling),setTimeout(n,t)}return null}),(function(t){s()&&i(t)}))}()}))}for(var Mg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",bg={},Eg=0;Eg<Mg.length;Eg++){var _g=Mg.charAt(Eg);if(void 0!==bg[_g])throw new TypeError(_g+" is ambiguous");bg[_g]=Eg}function Ng(t){var e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function Ag(t){for(var e=1,r=0;r<t.length;++r){var i=t.charCodeAt(r);if(i<33||i>126)return"Invalid prefix ("+t+")";e=Ng(e)^i>>5}for(e=Ng(e),r=0;r<t.length;++r){var n=t.charCodeAt(r);e=Ng(e)^31&n}return e}function Sg(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),i=t.toUpperCase();if(t!==r&&t!==i)return"Mixed-case string "+t;var n=(t=r).lastIndexOf("1");if(-1===n)return"No separator character for "+t;if(0===n)return"Missing prefix for "+t;var o=t.slice(0,n),s=t.slice(n+1);if(s.length<6)return"Data too short";var a=Ag(o);if("string"==typeof a)return a;for(var h=[],u=0;u<s.length;++u){var l=s.charAt(u),f=bg[l];if(void 0===f)return"Unknown character "+l;a=Ng(a)^f,u+6>=s.length||h.push(f)}return 1!==a?"Invalid checksum for "+t:{prefix:o,words:h}}function Rg(t,e,r,i){for(var n=0,o=0,s=(1<<r)-1,a=[],h=0;h<t.length;++h)for(n=n<<e|t[h],o+=e;o>=r;)o-=r,a.push(n>>o&s);if(i)o>0&&a.push(n<<r-o&s);else{if(o>=e)return"Excess padding";if(n<<r-o&s)return"Non-zero padding"}return a}var xg={decodeUnsafe:function(){var t=Sg.apply(null,arguments);if("object"==typeof t)return t},decode:function(t){var e=Sg.apply(null,arguments);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,e,r){if(r=r||90,t.length+7+e.length>r)throw new TypeError("Exceeds length limit");var i=Ag(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var n=t+"1",o=0;o<e.length;++o){var s=e[o];if(s>>5!=0)throw new Error("Non 5-bit word");i=Ng(i)^s,n+=Mg.charAt(s)}for(o=0;o<6;++o)i=Ng(i);for(i^=1,o=0;o<6;++o){n+=Mg.charAt(i>>5*(5-o)&31)}return n},toWordsUnsafe:function(t){var e=Rg(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=Rg(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=Rg(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=Rg(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}};const Ig="providers/5.3.1";function kg(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var Tg=Og;function Og(t,e){if(!t)throw new Error(e||"Assertion failed")}Og.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Pg=kg((function(t,e){var r=e;function i(t){return 1===t.length?"0"+t:t}function n(t){for(var e="",r=0;r<t.length;r++)e+=i(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var i=0;i<t.length;i++)r[i]=0|t[i];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(i=0;i<t.length;i++){var n=t.charCodeAt(i),o=n>>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=i,r.toHex=n,r.encode=function(t,e){return"hex"===e?n(t):t}})),Cg=kg((function(t,e){var r=e;r.assert=Tg,r.toArray=Pg.toArray,r.zero2=Pg.zero2,r.toHex=Pg.toHex,r.encode=Pg.encode,r.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<<e+1,o=t.clone(),s=0;s<i.length;s++){var a,h=o.andln(n-1);o.isOdd()?(a=h>(n>>1)-1?(n>>1)-h:h,o.isubn(a)):a=0,i[s]=a,o.iushrn(1)}return i},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var s,a,h=t.andln(3)+n&3,u=e.andln(3)+o&3;3===h&&(h=-1),3===u&&(u=-1),s=0==(1&h)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==u?h:-h,r[0].push(s),a=0==(1&u)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==h?u:-u,r[1].push(a),2*n===s+1&&(n=1-n),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new Bc(t,"hex","le")}})),Ug=Cg.getNAF,Fg=Cg.getJSF,Bg=Cg.assert;function Dg(t,e){this.type=t,this.p=new Bc(e.p,16),this.red=e.prime?Bc.red(e.prime):Bc.mont(this.p),this.zero=new Bc(0).toRed(this.red),this.one=new Bc(1).toRed(this.red),this.two=new Bc(2).toRed(this.red),this.n=e.n&&new Bc(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.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 Lg=Dg;function $g(t,e){this.curve=t,this.type=e,this.precomputed=null}Dg.prototype.point=function(){throw new Error("Not implemented")},Dg.prototype.validate=function(){throw new Error("Not implemented")},Dg.prototype._fixedNafMul=function(t,e){Bg(t.precomputed);var r=t._getDoubles(),i=Ug(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,s,a=[];for(o=0;o<i.length;o+=r.step){s=0;for(var h=o+r.step-1;h>=o;h--)s=(s<<1)+i[h];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=n;f>0;f--){for(o=0;o<a.length;o++)(s=a[o])===f?l=l.mixedAdd(r.points[o]):s===-f&&(l=l.mixedAdd(r.points[o].neg()));u=u.add(l)}return u.toP()},Dg.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=Ug(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var h=0;a>=0&&0===o[a];a--)h++;if(a>=0&&h++,s=s.dblp(h),a<0)break;var u=o[a];Bg(0!==u),s="affine"===t.type?u>0?s.mixedAdd(n[u-1>>1]):s.mixedAdd(n[-u-1>>1].neg()):u>0?s.add(n[u-1>>1]):s.add(n[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},Dg.prototype._wnafMulAdd=function(t,e,r,i,n){var o,s,a,h=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o<i;o++){var c=(a=e[o])._getNAFPoints(t);h[o]=c.wnd,u[o]=c.points}for(o=i-1;o>=1;o-=2){var d=o-1,m=o;if(1===h[d]&&1===h[m]){var p=[e[d],null,null,e[m]];0===e[d].y.cmp(e[m].y)?(p[1]=e[d].add(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg())):0===e[d].y.cmp(e[m].y.redNeg())?(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].add(e[m].neg())):(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Fg(r[d],r[m]);for(f=Math.max(v[0].length,f),l[d]=new Array(f),l[m]=new Array(f),s=0;s<f;s++){var y=0|v[0][s],w=0|v[1][s];l[d][s]=g[3*(y+1)+(w+1)],l[m][s]=0,u[d]=p}}else l[d]=Ug(r[d],h[d],this._bitLength),l[m]=Ug(r[m],h[m],this._bitLength),f=Math.max(l[d].length,f),f=Math.max(l[m].length,f)}var M=this.jpoint(null,null,null),b=this._wnafT4;for(o=f;o>=0;o--){for(var E=0;o>=0;){var _=!0;for(s=0;s<i;s++)b[s]=0|l[s][o],0!==b[s]&&(_=!1);if(!_)break;E++,o--}if(o>=0&&E++,M=M.dblp(E),o<0)break;for(s=0;s<i;s++){var N=b[s];0!==N&&(N>0?a=u[s][N-1>>1]:N<0&&(a=u[s][-N-1>>1].neg()),M="affine"===a.type?M.mixedAdd(a):M.add(a))}}for(o=0;o<i;o++)u[o]=null;return n?M:M.toP()},Dg.BasePoint=$g,$g.prototype.eq=function(){throw new Error("Not implemented")},$g.prototype.validate=function(){return this.curve.validate(this)},Dg.prototype.decodePoint=function(t,e){t=Cg.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?Bg(t[t.length-1]%2==0):7===t[0]&&Bg(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},$g.prototype.encodeCompressed=function(t){return this.encode(t,!0)},$g.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},$g.prototype.encode=function(t,e){return Cg.encode(this._encode(e),t)},$g.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},$g.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},$g.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var o=0;o<t;o++)i=i.dbl();r.push(i)}return{step:t,points:r}},$g.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},$g.prototype._getBeta=function(){return null},$g.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var jg=kg((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),zg=Cg.assert;function qg(t){Lg.call(this,"short",t),this.a=new Bc(t.a,16).toRed(this.red),this.b=new Bc(t.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(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}jg(qg,Lg);var Gg=qg;function Vg(t,e,r,i){Lg.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new Bc(e,16),this.y=new Bc(r,16),i&&(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 Zg(t,e,r,i){Lg.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Bc(0)):(this.x=new Bc(e,16),this.y=new Bc(r,16),this.z=new Bc(i,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}qg.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new Bc(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new Bc(t.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(e))?r=n[0]:(r=n[1],zg(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new Bc(t.a,16),b:new Bc(t.b,16)}})):this._getEndoBasis(r)}}},qg.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:Bc.mont(t),r=new Bc(2).toRed(e).redInvm(),i=r.redNeg(),n=new Bc(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},qg.prototype._getEndoBasis=function(t){for(var e,r,i,n,o,s,a,h,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=t,c=this.n.clone(),d=new Bc(1),m=new Bc(0),p=new Bc(0),g=new Bc(1),v=0;0!==f.cmpn(0);){var y=c.div(f);h=c.sub(y.mul(f)),u=p.sub(y.mul(d));var w=g.sub(y.mul(m));if(!i&&h.cmp(l)<0)e=a.neg(),r=d,i=h.neg(),n=u;else if(i&&2==++v)break;a=h,c=f,f=h,p=d,d=u,g=m,m=w}o=h.neg(),s=u;var M=i.sqr().add(n.sqr());return o.sqr().add(s.sqr()).cmp(M)>=0&&(o=e,s=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:n},{a:o,b:s}]},qg.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=n.mul(r.a),a=o.mul(i.a),h=n.mul(r.b),u=o.mul(i.b);return{k1:t.sub(s).sub(a),k2:h.add(u).neg()}},qg.prototype.pointFromX=function(t,e){(t=new Bc(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},qg.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},qg.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],h=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),h=h.neg(!0)),i[2*o]=a,i[2*o+1]=h,n[2*o]=s.k1,n[2*o+1]=s.k2}for(var u=this._wnafMulAdd(1,i,n,2*o,r),l=0;l<2*o;l++)i[l]=null,n[l]=null;return u},jg(Vg,Lg.BasePoint),qg.prototype.point=function(t,e,r){return new Vg(this,t,e,r)},qg.prototype.pointFromJSON=function(t,e){return Vg.fromJSON(this,t,e)},Vg.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},Vg.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]},Vg.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(e){return t.point(e[0],e[1],r)}var o=e[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(n))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(n))}},i},Vg.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)+">"},Vg.prototype.isInfinity=function(){return this.inf},Vg.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Vg.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),s=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},Vg.prototype.getX=function(){return this.x.fromRed()},Vg.prototype.getY=function(){return this.y.fromRed()},Vg.prototype.mul=function(t){return t=new Bc(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Vg.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Vg.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Vg.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Vg.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},Vg.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},jg(Zg,Lg.BasePoint),qg.prototype.jpoint=function(t,e,r){return new Zg(this,t,e,r)},Zg.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},Zg.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Zg.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),h=o.redSub(s);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),f=i.redMul(u),c=h.redSqr().redIAdd(l).redISub(f).redISub(f),d=h.redMul(f.redISub(c)).redISub(o.redMul(l)),m=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(c,d,m)},Zg.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(i),a=n.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),u=h.redMul(s),l=r.redMul(h),f=a.redSqr().redIAdd(u).redISub(l).redISub(l),c=a.redMul(l.redISub(f)).redISub(n.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(f,c,d)},Zg.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,o=this.x,s=this.y,a=this.z,h=a.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var l=o.redSqr(),f=u.redSqr(),c=f.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(h)),m=o.redMul(f),p=d.redSqr().redISub(m.redAdd(m)),g=m.redISub(p),v=d.redMul(g);v=v.redIAdd(v).redISub(c);var y=u.redMul(a);e+1<t&&(h=h.redMul(c)),o=p,a=y,u=v}return this.curve.jpoint(o,u.redMul(n),a)},Zg.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Zg.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var a=i.redAdd(i).redIAdd(i),h=a.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=h,e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),f=this.y.redSqr(),c=f.redSqr(),d=this.x.redAdd(f).redSqr().redISub(l).redISub(c);d=d.redIAdd(d);var m=l.redAdd(l).redIAdd(l),p=m.redSqr(),g=c.redIAdd(c);g=(g=g.redIAdd(g)).redIAdd(g),t=p.redISub(d).redISub(d),e=m.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},Zg.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),h=a.redSqr().redISub(s).redISub(s);t=h;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),f=this.y.redSqr(),c=this.x.redMul(f),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var m=c.redIAdd(c),p=(m=m.redIAdd(m)).redAdd(m);t=d.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(l);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(m.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},Zg.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(n)),h=e.redAdd(e),u=(h=h.redIAdd(h)).redMul(s),l=a.redSqr().redISub(u.redAdd(u)),f=u.redISub(l),c=s.redSqr();c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=a.redMul(f).redISub(c),m=r.redAdd(r).redMul(i);return this.curve.jpoint(l,d,m)},Zg.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),o=n.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(i),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),h=i.redIAdd(i);h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var u=n.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(h),l=e.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.x.redMul(a).redISub(l);f=(f=f.redIAdd(f)).redIAdd(f);var c=this.y.redMul(u.redMul(h.redISub(u)).redISub(s.redMul(a)));c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(f,c,d)},Zg.prototype.mul=function(t,e){return t=new Bc(t,e),this.curve._wnafMul(this,t)},Zg.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return 0===this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)},Zg.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},Zg.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)+">"},Zg.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Kg=kg((function(t,e){var r=e;r.base=Lg,r.short=Gg,r.mont=null,r.edwards=null})),Hg=kg((function(t,e){var r,i=e,n=Cg.assert;function o(t){"short"===t.type?this.curve=new Kg.short(t):"edwards"===t.type?this.curve=new Kg.edwards(t):this.curve=new Kg.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){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:Xp.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function Wg(t){if(!(this instanceof Wg))return new Wg(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Pg.toArray(t.entropy,t.entropyEnc||"hex"),r=Pg.toArray(t.nonce,t.nonceEnc||"hex"),i=Pg.toArray(t.pers,t.persEnc||"hex");Tg(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var Jg=Wg;Wg.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},Wg.prototype._hmac=function(){return new Xp.hmac(this.hash,this.K)},Wg.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},Wg.prototype.reseed=function(t,e,r,i){"string"!=typeof e&&(i=r,r=e,e=null),t=Pg.toArray(t,e),r=Pg.toArray(r,i),Tg(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Wg.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=Pg.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<t;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var o=n.slice(0,t);return this._update(r),this._reseed++,Pg.encode(o,e)};var Xg=Cg.assert;function Yg(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Qg=Yg;Yg.fromPublic=function(t,e,r){return e instanceof Yg?e:new Yg(t,{pub:e,pubEnc:r})},Yg.fromPrivate=function(t,e,r){return e instanceof Yg?e:new Yg(t,{priv:e,privEnc:r})},Yg.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},Yg.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Yg.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},Yg.prototype._importPrivate=function(t,e){this.priv=new Bc(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Yg.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?Xg(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Xg(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},Yg.prototype.derive=function(t){return t.validate()||Xg(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Yg.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Yg.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Yg.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var tv=Cg.assert;function ev(t,e){if(t instanceof ev)return t;this._importDER(t,e)||(tv(t.r&&t.s,"Signature without r or s"),this.r=new Bc(t.r,16),this.s=new Bc(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var rv=ev;function iv(){this.place=0}function nv(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,s=e.place;o<i;o++,s++)n<<=8,n|=t[s],n>>>=0;return!(n<=127)&&(e.place=s,n)}function ov(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function sv(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}ev.prototype._importDER=function(t,e){t=Cg.toArray(t,e);var r=new iv;if(48!==t[r.place++])return!1;var i=nv(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=nv(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var s=nv(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.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 Bc(o),this.s=new Bc(a),this.recoveryParam=null,!0},ev.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=ov(e),r=ov(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];sv(i,e.length),(i=i.concat(e)).push(2),sv(i,r.length);var n=i.concat(r),o=[48];return sv(o,n.length),o=o.concat(n),Cg.encode(o,t)};var av=function(){throw new Error("unsupported")},hv=Cg.assert;function uv(t){if(!(this instanceof uv))return new uv(t);"string"==typeof t&&(hv(Object.prototype.hasOwnProperty.call(Hg,t),"Unknown curve "+t),t=Hg[t]),t instanceof Hg.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var lv=uv;uv.prototype.keyPair=function(t){return new Qg(this,t)},uv.prototype.keyFromPrivate=function(t,e){return Qg.fromPrivate(this,t,e)},uv.prototype.keyFromPublic=function(t,e){return Qg.fromPublic(this,t,e)},uv.prototype.genKeyPair=function(t){t||(t={});for(var e=new Jg({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||av(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new Bc(2));;){var n=new Bc(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},uv.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},uv.prototype.sign=function(t,e,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new Bc(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),s=t.toArray("be",n),a=new Jg({hash:this.hash,entropy:o,nonce:s,pers:i.pers,persEnc:i.persEnc||"utf8"}),h=this.n.sub(new Bc(1)),u=0;;u++){var l=i.k?i.k(u):new Bc(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var f=this.g.mul(l);if(!f.isInfinity()){var c=f.getX(),d=c.umod(this.n);if(0!==d.cmpn(0)){var m=l.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var p=(f.getY().isOdd()?1:0)|(0!==c.cmp(d)?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),p^=1),new rv({r:d,s:m,recoveryParam:p})}}}}}},uv.prototype.verify=function(t,e,r,i){t=this._truncateToN(new Bc(t,16)),r=this.keyFromPublic(r,i);var n=(e=new rv(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.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),h=a.mul(t).umod(this.n),u=a.mul(n).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(h,r.getPublic(),u)).isInfinity()&&s.eqXToP(n):!(s=this.g.mulAdd(h,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(n)},uv.prototype.recoverPubKey=function(t,e,r,i){hv((3&r)===r,"The recovery param is more than two bits"),e=new rv(e,i);var n=this.n,o=new Bc(t),s=e.r,a=e.s,h=1&r,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");s=u?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var l=e.r.invm(n),f=n.sub(o).mul(l).umod(n),c=a.mul(l).umod(n);return this.g.mulAdd(f,s,c)},uv.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new rv(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var fv=kg((function(t,e){var r=e;r.version="6.5.4",r.utils=Cg,r.rand=function(){throw new Error("unsupported")},r.curve=Kg,r.curves=Hg,r.ec=lv,r.eddsa=null})).ec;const cv=new mc("signing-key/5.3.0");let dv=null;function mv(){return dv||(dv=new fv("secp256k1")),dv}class pv{constructor(t){Xd(this,"curve","secp256k1"),Xd(this,"privateKey",Kc(t));const e=mv().keyFromPrivate(qc(this.privateKey));Xd(this,"publicKey","0x"+e.getPublic(!1,"hex")),Xd(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Xd(this,"_isSigningKey",!0)}_addPoint(t){const e=mv().keyFromPublic(qc(this.publicKey)),r=mv().keyFromPublic(qc(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=mv().keyFromPrivate(qc(this.privateKey)),r=qc(t);32!==r.length&&cv.throwArgumentError("bad digest length","digest",t);const i=e.sign(r,{canonical:!0});return Qc({recoveryParam:i.recoveryParam,r:Yc("0x"+i.r.toString(16),32),s:Yc("0x"+i.s.toString(16),32)})}computeSharedSecret(t){const e=mv().keyFromPrivate(qc(this.privateKey)),r=mv().keyFromPublic(qc(gv(t)));return Yc("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function gv(t,e){const r=qc(t);if(32===r.length){const t=new pv(r);return e?"0x"+mv().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?Kc(r):"0x"+mv().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+mv().keyFromPublic(r).getPublic(!0,"hex"):Kc(r):cv.throwArgumentError("invalid public or private key","key","[REDACTED]")}const vv=new mc("transactions/5.3.0");function yv(t){return"0x"===t?null:Hd(t)}function wv(t){return"0x"===t?ud:nd.from(t)}function Mv(t,e){return function(t){return Hd(Wc(ld(Wc(gv(t),1)),12))}(function(t,e){const r=Qc(e),i={r:qc(r.r),s:qc(r.s)};return"0x"+mv().recoverPubKey(qc(t),i,r.recoveryParam).encode("hex",!1)}(qc(t),e))}function bv(t,e){const r=Vc(nd.from(t).toHexString());return r.length>32&&vv.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Ev(t,e){return{address:Hd(t),storageKeys:(e||[]).map((e,r)=>(32!==Hc(e)&&vv.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase()))}}function _v(t){if(Array.isArray(t))return t.map((t,e)=>Array.isArray(t)?(t.length>2&&vv.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),Ev(t[0],t[1])):Ev(t.address,t.storageKeys));const e=Object.keys(t).map(e=>{const r=t[e].reduce((t,e)=>(t[e]=!0,t),{});return Ev(e,Object.keys(r).sort())});return e.sort((t,e)=>t.address.localeCompare(e.address)),e}function Nv(t){const e=qd(t.slice(1));8!==e.length&&11!==e.length&&vv.throwArgumentError("invalid component count for transaction type: 1","payload",Kc(t));const r={type:1,chainId:wv(e[0]).toNumber(),nonce:wv(e[1]).toNumber(),gasPrice:wv(e[2]),gasLimit:wv(e[3]),to:yv(e[4]),value:wv(e[5]),data:e[6],accessList:_v(e[7])};if(8===e.length)return r;try{const t=wv(e[8]).toNumber();if(0!==t&&1!==t)throw new Error("bad recid");r.v=t}catch(t){vv.throwArgumentError("invalid v for transaction type: 1","v",e[8])}r.r=Yc(e[9],32),r.s=Yc(e[10],32);try{const t=ld(function(t,e){const r=[bv(t.chainId||0,"chainId"),bv(t.nonce||0,"nonce"),bv(t.gasPrice||0,"gasPrice"),bv(t.gasLimit||0,"gasLimit"),null!=t.to?Hd(t.to):"0x",bv(t.value||0,"value"),t.data||"0x",(i=t.accessList||[],_v(i).map(t=>[t.address,t.storageKeys]))];var i;if(e){const t=Qc(e);r.push(bv(t.recoveryParam,"recoveryParam")),r.push(Vc(t.r)),r.push(Vc(t.s))}return Jc(["0x01",$d(r)])}(r));r.from=Mv(t,{r:r.r,s:r.s,recoveryParam:r.v})}catch(t){console.log(t)}return r.hash=ld(t),r}function Av(t){const e=qc(t);if(e[0]>127)return function(t){const e=qd(t);9!==e.length&&6!==e.length&&vv.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:wv(e[0]).toNumber(),gasPrice:wv(e[1]),gasLimit:wv(e[2]),to:yv(e[3]),value:wv(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=nd.from(e[6]).toNumber()}catch(t){return console.log(t),r}if(r.r=Yc(e[7],32),r.s=Yc(e[8],32),nd.from(r.r).isZero()&&nd.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 i=r.v-27;const n=e.slice(0,6);0!==r.chainId&&(n.push(Kc(r.chainId)),n.push("0x"),n.push("0x"),i-=2*r.chainId+8);const o=ld($d(n));try{r.from=Mv(o,{r:Kc(r.r),s:Kc(r.s),recoveryParam:i})}catch(t){console.log(t)}r.hash=ld(t)}return r.type=null,r}(e);switch(e[0]){case 1:return Nv(e)}return vv.throwError("unsupported transaction type: "+e[0],mc.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const Sv=new mc(Ig);class Rv{constructor(){Sv.checkNew(new.target,Rv),this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),n=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this);return t.transaction={hash:o,type:Rv.allowNull(a,null),accessList:Rv.allowNull(this.accessList.bind(this),null),blockHash:Rv.allowNull(o,null),blockNumber:Rv.allowNull(a,null),transactionIndex:Rv.allowNull(a,null),confirmations:Rv.allowNull(a,null),from:e,gasPrice:r,gasLimit:r,to:Rv.allowNull(e,null),value:r,nonce:a,data:n,r:Rv.allowNull(this.uint256),s:Rv.allowNull(this.uint256),v:Rv.allowNull(a),creates:Rv.allowNull(e,null),raw:Rv.allowNull(n)},t.transactionRequest={from:Rv.allowNull(e),nonce:Rv.allowNull(a),gasLimit:Rv.allowNull(r),gasPrice:Rv.allowNull(r),to:Rv.allowNull(e),value:Rv.allowNull(r),data:Rv.allowNull(t=>this.data(t,!0)),type:Rv.allowNull(a),accessList:Rv.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:e,topics:Rv.arrayOf(o),data:n,logIndex:a,blockHash:o},t.receipt={to:Rv.allowNull(this.address,null),from:Rv.allowNull(this.address,null),contractAddress:Rv.allowNull(e,null),transactionIndex:a,root:Rv.allowNull(s),gasUsed:r,logsBloom:Rv.allowNull(n),blockHash:o,transactionHash:o,logs:Rv.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Rv.allowNull(a,null),cumulativeGasUsed:r,status:Rv.allowNull(a)},t.block={hash:o,parentHash:o,number:a,timestamp:a,nonce:Rv.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:e,extraData:n,transactions:Rv.allowNull(Rv.arrayOf(o))},t.blockWithTransactions=tm(t.block),t.blockWithTransactions.transactions=Rv.allowNull(Rv.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Rv.allowNull(i,void 0),toBlock:Rv.allowNull(i,void 0),blockHash:Rv.allowNull(o,void 0),address:Rv.allowNull(e,void 0),topics:Rv.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Rv.allowNull(a),blockHash:Rv.allowNull(o),transactionIndex:a,removed:Rv.allowNull(this.boolean.bind(this)),address:e,data:Rv.allowFalsish(n,"0x"),topics:Rv.arrayOf(o),transactionHash:o,logIndex:a},t}accessList(t){return _v(t||[])}number(t){return"0x"===t?0:nd.from(t).toNumber()}bigNumber(t){return nd.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),Zc(t))?t.toLowerCase():Sv.throwArgumentError("invalid hash","value",t)}data(t,e){const r=this.hex(t,e);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+t);return r}address(t){return Hd(t)}callAddress(t){if(!Zc(t,32))return null;const e=Hd(Wc(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e}contractAddress(t){return function(t){let e=null;try{e=Hd(t.from)}catch(e){Gd.throwArgumentError("missing from address","transaction",t)}return Hd(Wc(ld($d([e,Vc(qc(nd.from(t.nonce).toHexString()))])),12))}(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"==typeof t||Zc(t))return Xc(t);throw new Error("invalid blockTag")}hash(t,e){const r=this.hex(t,e);return 32!==Hc(r)?Sv.throwArgumentError("invalid hash","value",t):r}difficulty(t){if(null==t)return null;const e=nd.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!Zc(t))throw new Error("invalid uint256");return Yc(t,32)}_block(t,e){return null!=t.author&&null==t.miner&&(t.miner=t.author),Rv.check(e,t)}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Rv.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&nd.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1===t.type&&null==t.accessList&&(t.accessList=[]);const e=Rv.check(this.formats.transaction,t);if(null!=t.chainId){let r=t.chainId;Zc(r)&&(r=nd.from(r).toNumber()),e.chainId=r}else{let r=t.networkId;null==r&&null==e.v&&(r=t.chainId),Zc(r)&&(r=nd.from(r).toNumber()),"number"!=typeof r&&null!=e.v&&(r=(e.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),e.chainId=r}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return Av(t)}receiptLog(t){return Rv.check(this.formats.receiptLog,t)}receipt(t){const e=Rv.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=nd.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&Sv.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):Sv.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&Sv.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map(t=>this.topics(t)):null!=t?this.hash(t,!0):null}filter(t){return Rv.check(this.formats.filter,t)}filterLog(t){return Rv.check(this.formats.filterLog,t)}static check(t,e){const r={};for(const i in t)try{const n=t[i](e[i]);void 0!==n&&(r[i]=n)}catch(t){throw t.checkKey=i,t.checkValue=e[i],t}return r}static allowNull(t,e){return function(r){return null==r?e:t(r)}}static allowFalsish(t,e){return function(r){return r?t(r):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const r=[];return e.forEach((function(e){r.push(t(e))})),r}}}var xv=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Iv=new mc(Ig);function kv(t){return null==t?"null":(32!==Hc(t)&&Iv.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Tv(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map(t=>{if(Array.isArray(t)){const e={};t.forEach(t=>{e[kv(t)]=!0});const r=Object.keys(e);return r.sort(),r.join("|")}return kv(t)}).join("&")}function Ov(t){if("string"==typeof t){if(32===Hc(t=t.toLowerCase()))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+Tv(t);if(class extends class{constructor(t){for(const e in t)this[e]=Da(t[e])}}{static isForkEvent(t){return!(!t||!t._isForkEvent)}}.isForkEvent(t))throw Iv.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+Tv(t.topics||[])}throw new Error("invalid event - "+t)}function Pv(){return(new Date).getTime()}function Cv(t){return new Promise(e=>{setTimeout(e,t)})}const Uv=["block","network","pending","poll"];class Fv{constructor(t,e,r){Xd(this,"tag",t),Xd(this,"listener",e),Xd(this,"once",r)}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 t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],r=""===(i=t[2])?[]:i.split(/&/g).map(t=>{if(""===t)return[];const e=t.split("|").map(t=>"null"===t?null:t);return 1===e.length?e[0]:e});var i;const n={};return r.length>0&&(n.topics=r),e&&"*"!==e&&(n.address=e),n}pollable(){return this.tag.indexOf(":")>=0||Uv.indexOf(this.tag)>=0}}const Bv={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 Dv(t){return Yc(nd.from(t).toHexString(),32)}function Lv(t){return Fc.encode(Gc([t,Wc(lg(lg(t)),0,4)]))}class $v{constructor(t,e,r){Xd(this,"provider",t),Xd(this,"name",r),Xd(this,"address",t.formatter.address(e))}_fetchBytes(t,e){return xv(this,void 0,void 0,(function*(){const r={to:this.address,data:Jc([t,Fd(this.name),e||"0x"])},i=yield this.provider.call(r);if("0x"===i)return null;const n=nd.from(Wc(i,0,32)).toNumber(),o=nd.from(Wc(i,n,n+32)).toNumber();return Wc(i,n+32,n+32+o)}))}_getAddress(t,e){const r=Bv[String(t)];if(null==r&&Iv.throwError("unsupported coin type: "+t,mc.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===r.ilk)return this.provider.formatter.address(e);const i=qc(e);if(null!=r.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return Lv(Gc([[r.p2pkh],"0x"+t[2]]))}}if(null!=r.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return Lv(Gc([[r.p2sh],"0x"+t[2]]))}}if(null!=r.prefix){const t=i[1];let e=i[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&i.length===2+t&&t>=1&&t<=75){const t=xg.toWords(i.slice(2));return t.unshift(e),xg.encode(r.prefix,t)}}return null}getAddress(t){return xv(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t){const t={to:this.address,data:"0x3b3b57de"+Fd(this.name).substring(2)},e=yield this.provider.call(t);return"0x"===e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e?null:this.provider.formatter.callAddress(e)}const e=yield this._fetchBytes("0xf1cb7e06",Dv(t));if(null==e||"0x"===e)return null;const r=this._getAddress(t,e);return null==r&&Iv.throwError("invalid or unsupported coin data",mc.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),r}))}getContentHash(){return xv(this,void 0,void 0,(function*(){const t=yield this._fetchBytes("0xbc1c58d1");if(null==t||"0x"===t)return null;const e=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(e){const t=parseInt(e[3],16);if(e[4].length===2*t)return"ipfs://"+Fc.encode("0x"+e[1])}const r=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);return r&&64===r[1].length?"bzz://"+r[1]:Iv.throwError("invalid or unsupported content hash data",mc.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return xv(this,void 0,void 0,(function*(){let e=vd(t);e=Gc([Dv(64),Dv(e.length),e]),e.length%32!=0&&(e=Gc([e,Yc("0x",32-t.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",Kc(e));return null==r||"0x"===r?null:wd(r)}))}}let jv=null,zv=1;class qv extends $a{constructor(t){if(Iv.checkNew(new.target,$a),super(),this._events=[],this._emitted={block:-2},this.formatter=new.target.getFormatter(),Xd(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch(t=>{}),this._ready().catch(t=>{});else{const e=Yd(new.target,"getNetwork")(t);e?(Xd(this,"_network",e),this.emit("network",e,null)):Iv.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return xv(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||Iv.throwError("no network detected",mc.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:Xd(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return wg(()=>this._ready().then(t=>t,t=>{if(t.code!==mc.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))}static getFormatter(){return null==jv&&(jv=new Rv),jv}static getNetwork(t){return function(t){if(null==t)return null;if("number"==typeof t){for(const e in bc){const r=bc[e];if(r.chainId===t)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=bc[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=bc[t.name];if(!e)return"number"!=typeof t.chainId&&pc.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&pc.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;var i;return null==r&&e._defaultProvider&&(r=(i=e._defaultProvider)&&"function"==typeof i.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}(null==t?"homestead":t)}_getInternalBlockNumber(t){return xv(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const r=yield e;if(Pv()-r.respTime<=t)return r.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=Pv(),r=Qd({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(t=>null,t=>t)}).then(({blockNumber:t,networkError:i})=>{if(i)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),i;const n=Pv();return(t=nd.from(t).toNumber())<this._maxInternalBlockNumber&&(t=this._maxInternalBlockNumber),this._maxInternalBlockNumber=t,this._setFastBlockNumber(t),{blockNumber:t,reqTime:e,respTime:n}});return this._internalBlockNumber=r,r.catch(t=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber}))}poll(){return xv(this,void 0,void 0,(function*(){const t=zv++,e=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(r),this.emit("poll",t,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Iv.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Iv.makeError("network block skew detected",mc.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let t=this._emitted.block+1;t<=r;t++)this.emit("block",t);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&r-e>12&&delete this._emitted[t]})),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach(t=>{switch(t.type){case"tx":{const r=t.hash;let i=this.getTransactionReceipt(r).then(t=>t&&null!=t.blockNumber?(this._emitted["t:"+r]=t.blockNumber,this.emit(r,t),null):null).catch(t=>{this.emit("error",t)});e.push(i);break}case"filter":{const i=t.filter;i.fromBlock=this._lastBlockNumber+1,i.toBlock=r;const n=this.getLogs(i).then(t=>{0!==t.length&&t.forEach(t=>{this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(i,t)})}).catch(t=>{this.emit("error",t)});e.push(n);break}}}),this._lastBlockNumber=r,Promise.all(e).then(()=>{this.emit("didPoll",t)}).catch(t=>{this.emit("error",t)})}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return xv(this,void 0,void 0,(function*(){return Iv.throwError("provider does not support network detection",mc.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return xv(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,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",e,t),yield Cv(0),this._network;const r=Iv.makeError("underlying network changed",mc.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",r),r}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(t=>{this._setFastBlockNumber(t)},t=>{}),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!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))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const t=Pv();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then(t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&t<this._fastBlockNumber||(this._fastQueryDate=Pv(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,r){return xv(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,r||0,null)}))}_waitForTransaction(t,e,r,i){return xv(this,void 0,void 0,(function*(){const n=yield this.getTransactionReceipt(t);return(n?n.confirmations:0)>=e?n:new Promise((n,o)=>{const s=[];let a=!1;const h=function(){return!!a||(a=!0,s.forEach(t=>{t()}),!1)},u=t=>{t.confirmations<e||h()||n(t)};if(this.on(t,u),s.push(()=>{this.removeListener(t,u)}),i){let r=i.startBlock,n=null;const u=s=>xv(this,void 0,void 0,(function*(){a||(yield Cv(1e3),this.getTransactionCount(i.from).then(l=>xv(this,void 0,void 0,(function*(){if(!a){if(l<=i.nonce)r=s;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==n&&(n=r-3,n<i.startBlock&&(n=i.startBlock));n<=s;){if(a)return;const r=yield this.getBlockWithTransactions(n);for(let n=0;n<r.transactions.length;n++){const s=r.transactions[n];if(s.hash===t)return;if(s.from===i.from&&s.nonce===i.nonce){if(a)return;const r=yield this.waitForTransaction(s.hash,e);if(h())return;let n="replaced";return s.data===i.data&&s.to===i.to&&s.value.eq(i.value)?n="repriced":"0x"===s.data&&s.from===s.to&&s.value.isZero()&&(n="cancelled"),void o(Iv.makeError("transaction was replaced",mc.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===n||"cancelled"===n,reason:n,replacement:this._wrapTransaction(s),hash:t,receipt:r}))}}n++}}a||this.once("block",u)}})),t=>{a||this.once("block",u)}))}));if(a)return;this.once("block",u),s.push(()=>{this.removeListener("block",u)})}if("number"==typeof r&&r>0){const t=setTimeout(()=>{h()||o(Iv.makeError("timeout exceeded",mc.errors.TIMEOUT,{timeout:r}))},r);t.unref&&t.unref(),s.push(()=>{clearTimeout(t)})}})}))}getBlockNumber(){return xv(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return nd.from(t)}catch(e){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Qd({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getBalance",r);try{return nd.from(i)}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:t})}}))}getTransactionCount(t,e){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Qd({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getTransactionCount",r);try{return nd.from(i).toNumber()}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:t})}}))}getCode(t,e){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Qd({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getCode",r);try{return Kc(i)}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:t})}}))}getStorageAt(t,e,r){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const i=yield Qd({address:this._getAddress(t),blockTag:this._getBlockTag(r),position:Promise.resolve(e).then(t=>Xc(t))}),n=yield this.perform("getStorageAt",i);try{return Kc(n)}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:n,error:t})}}))}_wrapTransaction(t,e,r){if(null!=e&&32!==Hc(e))throw new Error("invalid response - sendTransaction");const i=t;return null!=e&&t.hash!==e&&Iv.throwError("Transaction hash mismatch from Provider.sendTransaction.",mc.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),i.wait=(e,i)=>xv(this,void 0,void 0,(function*(){null==e&&(e=1),null==i&&(i=0);let n=void 0;0!==e&&null!=r&&(n={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:r});const o=yield this._waitForTransaction(t.hash,e,i,n);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&Iv.throwError("transaction failed",mc.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),i}sendTransaction(t){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then(t=>Kc(t)),r=this.formatter.transaction(t),i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(r,t,i)}catch(t){throw t.transaction=r,t.transactionHash=r.hash,t}}))}_getTransactionRequest(t){return xv(this,void 0,void 0,(function*(){const e=yield t,r={};return["from","to"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?this._getAddress(t):null))}),["gasLimit","gasPrice","value"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?nd.from(t):null))}),["type"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>null!=t?t:null))}),e.accessList&&(r.accessList=this.formatter.accessList(e.accessList)),["data"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?Kc(t):null))}),this.formatter.transactionRequest(yield Qd(r))}))}_getFilter(t){return xv(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach(r=>{null!=t[r]&&(e[r]=t[r])}),["fromBlock","toBlock"].forEach(r=>{null!=t[r]&&(e[r]=this._getBlockTag(t[r]))}),this.formatter.filter(yield Qd(e))}))}call(t,e){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Qd({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("call",r);try{return Kc(i)}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"call",params:r,result:i,error:t})}}))}estimateGas(t){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Qd({transaction:this._getTransactionRequest(t)}),r=yield this.perform("estimateGas",e);try{return nd.from(r)}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"estimateGas",params:e,result:r,error:t})}}))}_getAddress(t){return xv(this,void 0,void 0,(function*(){const e=yield this.resolveName(t);return null==e&&Iv.throwError("ENS name not configured",mc.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),e}))}_getBlock(t,e){return xv(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;let r=-128;const i={includeTransactions:!!e};if(Zc(t,32))i.blockHash=t;else try{i.blockTag=this.formatter.blockTag(yield this._getBlockTag(t)),Zc(i.blockTag)&&(r=parseInt(i.blockTag.substring(2),16))}catch(e){Iv.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return wg(()=>xv(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",i);if(null==t)return null!=i.blockHash&&null==this._emitted["b:"+i.blockHash]||null!=i.blockTag&&r>this._emitted.block?null:void 0;if(e){let e=null;for(let r=0;r<t.transactions.length;r++){const i=t.transactions[r];if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){null==e&&(e=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let t=e-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}}return this.formatter.blockWithTransactions(t)}return this.formatter.block(t)})),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return xv(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return wg(()=>xv(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;const i=this.formatter.transactionResponse(r);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}return this._wrapTransaction(i)})),{oncePoll:this})}))}getTransactionReceipt(t){return xv(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return wg(()=>xv(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;if(null==r.blockHash)return;const i=this.formatter.receipt(r);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}return i})),{oncePoll:this})}))}getLogs(t){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Qd({filter:this._getFilter(t)}),r=yield this.perform("getLogs",e);return r.forEach(t=>{null==t.removed&&(t.removed=!1)}),Rv.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return xv(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return xv(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&Iv.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return xv(this,void 0,void 0,(function*(){const e=yield this._getResolver(t);return null==e?null:new $v(this,e,t)}))}_getResolver(t){return xv(this,void 0,void 0,(function*(){const e=yield this.getNetwork();e.ensAddress||Iv.throwError("network does not support ENS",mc.errors.UNSUPPORTED_OPERATION,{operation:"ENS",network:e.name});const r={to:e.ensAddress,data:"0x0178b8bf"+Fd(t).substring(2)};return this.formatter.callAddress(yield this.call(r))}))}resolveName(t){return xv(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if(Zc(t))throw e}"string"!=typeof t&&Iv.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return xv(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(e);if(!r)return null;let i=qc(yield this.call({to:r,data:"0x691f3431"+Fd(e).substring(2)}));if(i.length<32||!nd.from(i.slice(0,32)).eq(32))return null;if(i=i.slice(32),i.length<32)return null;const n=nd.from(i.slice(0,32)).toNumber();if(i=i.slice(32),n>i.length)return null;const o=wd(i.slice(0,n));return(yield this.resolveName(o))!=t?null:o}))}perform(t,e){return Iv.throwError(t+" not implemented",mc.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter(t=>t.pollable()).length>0}_stopEvent(t){this.polling=this._events.filter(t=>t.pollable()).length>0}_addEventListener(t,e,r){const i=new Fv(Ov(t),e,r);return this._events.push(i),this._startEvent(i),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let r=!1,i=[],n=Ov(t);return this._events=this._events.filter(t=>t.tag!==n||(setTimeout(()=>{t.listener.apply(this,e)},0),r=!0,!t.once||(i.push(t),!1))),i.forEach(t=>{this._stopEvent(t)}),r}listenerCount(t){if(!t)return this._events.length;let e=Ov(t);return this._events.filter(t=>t.tag===e).length}listeners(t){if(null==t)return this._events.map(t=>t.listener);let e=Ov(t);return this._events.filter(t=>t.tag===e).map(t=>t.listener)}off(t,e){if(null==e)return this.removeAllListeners(t);const r=[];let i=!1,n=Ov(t);return this._events=this._events.filter(t=>t.tag!==n||t.listener!=e||(!!i||(i=!0,r.push(t),!1))),r.forEach(t=>{this._stopEvent(t)}),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const r=Ov(t);this._events=this._events.filter(t=>t.tag!==r||(e.push(t),!1))}return e.forEach(t=>{this._stopEvent(t)}),this}}var Gv=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Vv=new mc(Ig),Zv=["call","estimateGas"];function Kv(t,e,r){if("call"===t&&e.code===mc.errors.SERVER_ERROR){const t=e.error;if(t&&t.message.match("reverted")&&Zc(t.data))return t.data}let i=e.message;e.code===mc.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?i=e.error.message:"string"==typeof e.body?i=e.body:"string"==typeof e.responseText&&(i=e.responseText),i=(i||"").toLowerCase();const n=r.transaction||r.signedTransaction;throw i.match(/insufficient funds/)&&Vv.throwError("insufficient funds for intrinsic transaction cost",mc.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce too low/)&&Vv.throwError("nonce has already been used",mc.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced/)&&Vv.throwError("replacement fee too low",mc.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/)&&Vv.throwError("legacy pre-eip-155 transactions not supported",mc.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),Zv.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted/)&&Vv.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",mc.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Hv(t){return new Promise((function(e){setTimeout(e,t)}))}function Wv(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function Jv(t){return t?t.toLowerCase():t}const Xv={};class Yv extends ih{constructor(t,e,r){if(Vv.checkNew(new.target,Yv),super(),t!==Xv)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Xd(this,"provider",e),null==r&&(r=0),"string"==typeof r?(Xd(this,"_address",this.provider.formatter.address(r)),Xd(this,"_index",null)):"number"==typeof r?(Xd(this,"_index",r),Xd(this,"_address",null)):Vv.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(t){return Vv.throwError("cannot alter JSON-RPC Signer connection",mc.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Qv(Xv,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(t=>(t.length<=this._index&&Vv.throwError("unknown account #"+this._index,mc.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index])))}sendUncheckedTransaction(t){t=tm(t);const e=this.getAddress().then(t=>(t&&(t=t.toLowerCase()),t));if(null==t.gasLimit){const r=tm(t);r.from=e,t.gasLimit=this.provider.estimateGas(r)}return Qd({tx:Qd(t),sender:e}).then(({tx:e,sender:r})=>{null!=e.from?e.from.toLowerCase()!==r&&Vv.throwArgumentError("from address mismatch","transaction",t):e.from=r;const i=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[i]).then(t=>t,t=>Kv("sendTransaction",t,i))})}signTransaction(t){return Vv.throwError("signing transactions is unsupported",mc.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return Gv(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(t);try{return yield wg(()=>Gv(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(r);if(null!==t)return this.provider._wrapTransaction(t,r,e)})),{oncePoll:this.provider})}catch(t){throw t.transactionHash=r,t}}))}signMessage(t){return Gv(this,void 0,void 0,(function*(){const e="string"==typeof t?vd(t):t,r=yield this.getAddress();return yield this.provider.send("eth_sign",[r.toLowerCase(),Kc(e)])}))}_signTypedData(t,e,r){return Gv(this,void 0,void 0,(function*(){const i=yield wm.resolveNames(t,e,r,t=>this.provider.resolveName(t)),n=yield this.getAddress();return yield this.provider.send("eth_signTypedData_v4",[n.toLowerCase(),JSON.stringify(wm.getPayload(i.domain,e,i.value))])}))}unlock(t){return Gv(this,void 0,void 0,(function*(){const e=this.provider,r=yield this.getAddress();return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))}}class Qv extends Yv{sendTransaction(t){return this.sendUncheckedTransaction(t).then(t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)}))}}const ty={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0};class ey extends qv{constructor(t,e){Vv.checkNew(new.target,ey);let r=e;null==r&&(r=new Promise((t,e)=>{setTimeout(()=>{this.detectNetwork().then(e=>{t(e)},t=>{e(t)})},0)})),super(r),t||(t=Yd(this.constructor,"defaultUrl")()),Xd(this,"connection","string"==typeof t?Object.freeze({url:t}):Object.freeze(tm(t))),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 Gv(this,void 0,void 0,(function*(){yield Hv(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=Yd(this.constructor,"getNetwork");try{return e(nd.from(t).toNumber())}catch(e){return Vv.throwError("could not detect network",mc.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return Vv.throwError("could not detect network",mc.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new Yv(Xv,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(t=>t.map(t=>this.formatter.address(t)))}send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:im(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(i&&this._cache[t])return this._cache[t];const n=yg(this.connection,JSON.stringify(r),Wv).then(t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t),t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t});return i&&(this._cache[t]=n,setTimeout(()=>{this._cache[t]=null},0)),n}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[Jv(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Jv(e.address),e.blockTag]];case"getCode":return["eth_getCode",[Jv(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Jv(e.address),e.position,e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[Yd(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[Yd(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=Jv(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return Gv(this,void 0,void 0,(function*(){const r=this.prepareRequest(t,e);null==r&&Vv.throwError(t+" not implemented",mc.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(r[0],r[1])}catch(r){return Kv(t,r,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(r){return function i(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;let i=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",i=i.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),i.then((function(){return Hv(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){i()}),0),null;t.send("eth_uninstallFilter",[r])})).catch(t=>{})}(),r})).catch(t=>{})}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const r=tm(ty);if(e)for(const t in e)e[t]&&(r[t]=!0);!function(t,e){t&&"object"==typeof t||Jd.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Jd.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}(t,r);const i={};return["gasLimit","gasPrice","type","nonce","value"].forEach((function(e){if(null==t[e])return;const r=Xc(t[e]);"gasLimit"===e&&(e="gas"),i[e]=r})),["from","to","data"].forEach((function(e){null!=t[e]&&(i[e]=Kc(t[e]))})),t.accessList&&(i.accessList=_v(t.accessList)),i}}var ry=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const iy=new mc(Ig);class ny extends ey{detectNetwork(){const t=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return ry(this,void 0,void 0,(function*(){let e=this.network;return null==e&&(e=yield t.detectNetwork.call(this),e||iy.throwError("no network detected",mc.errors.UNKNOWN_ERROR,{}),null==this._network&&(Xd(this,"_network",e),this.emit("network",e,null))),e}))}}var oy={1:{key:"1",name:"Ethereum Mainnet",chainId:1,network:"homestead",multicall:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",rpc:[{url:"https://api-geth-archive.ankr.com",user:"balancer_user",password:"balancerAnkr20201015"},"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive","https://apis.ankr.com/e62bc219f9c9462b8749defe472d2dc5/6106d4a3ec1d1bcc87ec72158f8fd089/eth/archive/main","https://eth-archival.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://eth-mainnet.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv","https://cloudflare-eth.com"],ws:["wss://eth-mainnet.ws.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],explorer:"https://etherscan.io"},3:{key:"3",name:"Ethereum Testnet Ropsten",shortName:"Ropsten",chainId:3,network:"ropsten",multicall:"0x53c43764255c17bd724f74c4ef150724ac50a3ed",rpc:["https://eth-ropsten.alchemyapi.io/v2/QzGz6gdkpTyDzebi3PjxIaKO7bDTGnSy"],explorer:"https://ropsten.etherscan.io"},4:{key:"4",name:"Ethereum Testnet Rinkeby",shortName:"Rinkeby",chainId:4,network:"rinkeby",multicall:"0x42ad527de7d4e9d9d011ac45b31d8551f8fe9821",rpc:["https://eth-rinkeby.alchemyapi.io/v2/ugiPEBqMebLQbjro42kalZ1h4StpW_fR","https://eth-rinkeby.gateway.pokt.network/v1/5f76124fb90218002e9ce985"],ws:["wss://eth-rinkeby.ws.alchemyapi.io/v2/twReQE9Px03E-E_N_Fbb3OVF7YgHxoGq"],explorer:"https://rinkeby.etherscan.io"},5:{key:"5",name:"Ethereum Testnet Görli",shortName:"Görli",chainId:5,network:"goerli",multicall:"0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e",rpc:["https://eth-goerli.alchemyapi.io/v2/v4nqH_J-J3STit45Mm07TxuYexMHQsYZ"],explorer:"https://goerli.etherscan.io"},7:{key:"7",name:"ThaiChain",chainId:7,network:"mainnet",multicall:"0xB9cb900E526e7Ad32A2f26f1fF6Dee63350fcDc5",rpc:["https://rpc.dome.cloud"],ws:["wss://ws.dome.cloud"],explorer:"https://exp.tch.in.th"},30:{key:"30",name:"RSK Mainnet",chainId:30,network:"rsk mainnet",multicall:"0x4eeebb5580769ba6d26bfd07be636300076d1831",rpc:["https://public-node.rsk.co"],explorer:"https://explorer.rsk.co"},31:{key:"31",name:"RSK Testnet",chainId:31,network:"rsk testnet",multicall:"0x4eeebb5580769ba6d26bfd07be636300076d1831",rpc:["https://public-node.testnet.rsk.co"],explorer:"https://explorer.testnet.rsk.co"},42:{key:"42",name:"Ethereum Testnet Kovan",shortName:"Kovan",chainId:42,network:"kovan",multicall:"0x2cc8688c5f75e365aaeeb4ea8d6a480405a48d2a",rpc:["https://eth-kovan.alchemyapi.io/v2/s96TIUFYg0LuddgpmafA040ZyUaZbrpM","https://poa-kovan.gateway.pokt.network/v1/5f76124fb90218002e9ce985"],ws:["wss://eth-kovan.ws.alchemyapi.io/v2/QCsM2iU0bQ49eGDmZ7-Y--Wpu0lVWXSO"],explorer:"https://kovan.etherscan.io"},50:{key:"50",name:"XinFin MainNet",shortName:"XDC",chainId:50,network:"mainnet",multicall:"",rpc:["https://rpc.xinfin.network"],ws:["wss://ws.xinfin.network"],explorer:"http://explorer.xinfin.network/"},56:{key:"56",name:"Binance Smart Chain Mainnet",shortName:"BSC",chainId:56,network:"mainnet",multicall:"0x1ee38d535d541c55c9dae27b12edf090c608e6fb",rpc:["https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive","https://apis.ankr.com/c0d871dd3c6d4529b01c9362a9b79e89/6106d4a3ec1d1bcc87ec72158f8fd089/binance/archive/main","https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7","https://bsc-private-dataseed1.nariox.org","https://bsc-private-dataseed2.nariox.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed1.binance.org","https://bsc-dataseed2.binance.org","https://bsc-dataseed3.binance.org"],explorer:"https://bscscan.com"},61:{key:"61",name:"Ethereum Classic Mainnet",shortName:"Ethereum Classic",chainId:61,network:"mainnet",multicall:"",rpc:["https://ethereumclassic.network"],explorer:"https://blockscout.com/etc/mainnet"},65:{key:"65",name:"OKExChain Testnet",shortName:"OEC Testnet",chainId:65,network:"oec testnet",multicall:"0x04c68A7fB750ca0Ba232105B3b094926a0f77645",rpc:["https://exchaintestrpc.okex.org"],ws:["wss://exchaintestws.okex.org:8443"],explorer:"https://www.oklink.com/okexchain-test"},66:{key:"66",name:"OKExChain Mainnet",shortName:"OEC Mainnet",chainId:66,network:"oec mainnet",multicall:"0x6EB187d8197Ac265c945b69f3c3064A6f3831866",rpc:["https://exchainrpc.okex.org"],ws:["wss://exchainws.okex.org:8443"],explorer:"https://www.oklink.com/okexchain"},70:{key:"70",name:"Hoo Smart Chain Mainnet",shortName:"hsc",chainId:70,network:"Mainnet",multicall:"0xd4b794b89baccb70ef851830099bee4d69f19ebc",rpc:["https://http-mainnet2.hoosmartchain.com"],ws:["wss://ws-mainnet2.hoosmartchain.com"],explorer:"https://hscscan.com"},80:{key:"80",name:"GeneChain",chainId:80,network:"Mainnet",multicall:"0x9e6ed491171A0D9089892aA5F14800f9f32038eb",rpc:["https://rpc.genechain.io"],explorer:"https://scan.genechain.io"},82:{key:"82",name:"Meter Mainnet",shortName:"Meter",chainId:82,network:"mainnet",multicall:"0x579De77CAEd0614e3b158cb738fcD5131B9719Ae",rpc:["https://rpc.meter.io"],explorer:"https://scan.meter.io"},97:{key:"97",name:"Binance Smart Chain Testnet",shortName:"BSC Testnet",chainId:97,network:"testnet",multicall:"0x8b54247c6BAe96A6ccAFa468ebae96c4D7445e46",rpc:["https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/bsc/testnet/archive","https://data-seed-prebsc-1-s1.binance.org:8545"],explorer:"https://testnet.bscscan.com"},99:{key:"99",name:"POA Core",shortName:"POA",chainId:99,network:"mainnet",multicall:"",rpc:["https://core.poa.network"],explorer:"https://blockscout.com/poa/core/"},100:{key:"100",name:"xDAI Chain",shortName:"xDAI",chainId:100,network:"mainnet",multicall:"0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a",rpc:["https://xdai-archive.blockscout.com","https://poa-xdai.gateway.pokt.network/v1/5f76124fb90218002e9ce985"],ws:["wss://rpc.xdaichain.com/wss"],explorer:"https://blockscout.com/poa/xdai"},108:{key:"108",name:"Thundercore Mainnet",chainId:108,network:"mainnet",multicall:"",rpc:["https://mainnet-rpc.thundercore.com"],explorer:"https://scan.thundercore.com"},122:{key:"122",name:"Fuse Mainnet",shortName:"Fuse",chainId:122,network:"mainnet",multicall:"0x7a59441fb06666F6d2D766393d876945D06a169c",rpc:["https://oefusefull1.liquify.info/"],explorer:"https://explorer.fuse.io"},128:{key:"128",name:"Huobi Eco Chain Mainnet",shortName:"heco",chainId:128,network:"Mainnet",multicall:"0x37ab26db3df780e7026f3e767f65efb739f48d8e",rpc:["https://pub001.hg.network/rpc"],ws:["wss://pub001.hg.network/ws"],explorer:"https://hecoinfo.com"},137:{key:"137",name:"Polygon Mainnet",shortName:"Polygon",chainId:137,network:"mainnet",multicall:"0xCBca837161be50EfA5925bB9Cc77406468e76751",rpc:["https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mainnet/archive","https://rpc-mainnet.maticvigil.com/v1/1cfd7598e5ba6dcf0b4db58e8be484badc6ea08e","https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/polygon/mainnet/archive"],ws:["wss://ws-mainnet.matic.network"],explorer:"https://polygonscan.com"},246:{key:"246",name:"Energy Web Chain",shortName:"EWC",chainId:246,network:"mainnet",multicall:"0x0767F26d0D568aB61A98b279C0b28a4164A6f05e",rpc:["https://voting-rpc.carbonswap.exchange"],explorer:"https://explorer.energyweb.org"},250:{key:"250",name:"Fantom Opera",shortName:"fantom",chainId:250,network:"Mainnet",multicall:"0x7f6A10218264a22B4309F3896745687E712962a0",rpc:["https://rpc.ftm.tools","https://rpcapi.fantom.network"],explorer:"https://ftmscan.com"},256:{key:"256",name:"Huobi Eco Chain Testnet",shortName:"heco",chainId:256,network:"testnet",multicall:"0xC33994Eb943c61a8a59a918E2de65e03e4e385E0",rpc:["https://http-testnet.hecochain.com"],ws:["wss://ws-testnet.hecochain.com"],explorer:"https://testnet.hecoinfo.com"},321:{key:"321",name:"KCC Mainnet",shortName:"KCC",chainId:321,network:"mainnet",multicall:"0xa64D6AFb48225BDA3259246cfb418c0b91de6D7a",rpc:["https://rpc-mainnet.kcc.network"],ws:["wss://rpc-ws-mainnet.kcc.network"],explorer:"https://explorer.kcc.io"},499:{key:"499",name:"Rupaya",shortName:"RUPX",chainId:499,network:"mainnet",multicall:"0x7955FF653FfDBf13056FeAe227f655CfF5C194D5",rpc:["https://rpc.rupx.io"],ws:["wss://ws.rupx.io"],explorer:"http://scan.rupx.io"},1285:{key:"1285",name:"Moonriver (Kusama)",shortName:"Moonriver",chainId:1285,network:"mainnet",multicall:"0x537004440ffFE1D4AE9F009031Fc2b0385FCA9F1",rpc:["https://rpc.moonriver.moonbeam.network"],explorer:"https://blockscout.moonriver.moonbeam.network/"},1287:{key:"1287",name:"Moonbase Alpha TestNet",shortName:"Moonbase",chainId:1287,network:"testnet",multicall:"0xD7bA481DE7fB53A7a29641c43232B09e5D9CAe7b",rpc:["https://rpc.testnet.moonbeam.network"],explorer:"https://moonbase-blockscout.testnet.moonbeam.network/"},2109:{key:"2109",name:"Avalanche",chainId:43114,network:"mainnet",multicall:"0x7E9985aE4C8248fdB07607648406a48C76e9e7eD",rpc:["https://api.avax.network/ext/bc/C/rpc"],explorer:"https://cchain.explorer.avax.network"},4689:{key:"4689",name:"IoTeX Mainnet",shortName:"IoTeX",chainId:4689,network:"mainnet",multicall:"0x9c8B105c94282CDB0F3ecF27e3cfA96A35c07be6",rpc:["https://babel-api.mainnet.iotex.io"],explorer:"https://iotexscan.io"},4690:{key:"4690",name:"IoTeX Testnet",shortName:"IoTeX",chainId:4690,network:"testnet",multicall:"0x30aE8783d26aBE7Fbb9d83549CCb7430AE4A301F",rpc:["https://babel-api.testnet.iotex.io"],explorer:"https://testnet.iotexscan.io"},32659:{key:"32659",name:"Fusion Mainnet",chainId:32659,network:"mainnet",multicall:"",rpc:["https://vote.anyswap.exchange/mainnet"],ws:["wss://mainnetpublicgateway1.fusionnetwork.io:10001"],explorer:"https://fsnex.com"},42220:{key:"42220",name:"Celo Mainnet",shortName:"Celo",chainId:42220,network:"mainnet",multicall:"0xb8d0d2C1391eeB350d2Cd39EfABBaaEC297368D9",rpc:["https://celo-mainnet--rpc.datahub.figment.io/apikey/e892a66dc36e4d2d98a5d6406d609796/"],explorer:"https://explorer.celo.org"},80001:{key:"80001",name:"Matic Mumbai",chainId:80001,network:"testnet",multicall:"0x08411ADd0b5AA8ee47563b146743C13b3556c9Cc",rpc:["https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mumbai/archive","https://rpc-mumbai.matic.today"],ws:["wss://ws-mumbai.matic.today"],explorer:""},333888:{key:"333888",name:"Polis Sparta",shortName:"Sparta",chainId:333888,network:"testnet",multicall:"0xA4c03972023d5f684d35eF1C541752490975383e",rpc:["https://sparta-rpc.polis.tech"],explorer:"https://sparta-explorer.polis.tech"},333999:{key:"333999",name:"Polis Olympus",shortName:"Olympus",chainId:333999,network:"mainnet",multicall:"0x34b99C2a4a4620F10ac779c36b8c61F90FD61732",rpc:["https://rpc.polis.tech"],explorer:"https://explorer.polis.tech"},16666e5:{key:"1666600000",name:"Harmony Mainnet",shortName:"HarmonyMainnet",chainId:16666e5,network:"mainnet",multicall:"0x9c31392D2e0229dC4Aa250F043d46B9E82074BF8",rpc:["https://a.api.s0.t.hmny.io"],ws:["wss://ws.s0.t.hmny.io"],explorer:"https://explorer.harmony.one"},16667e5:{key:"1666700000",name:"Harmony Testnet",shortName:"HarmonyTestnet",chainId:16667e5,network:"testnet",multicall:"0x9923589503Fd205feE3d367DDFF2378f0F7dD2d4",rpc:["https://api.s0.b.hmny.io"],ws:["wss://ws.s0.b.hmny.io"],explorer:"https://explorer.pops.one"},wanchain:{key:"wanchain",name:"Wanchain",chainId:1,network:"mainnet",multicall:"0xba5934ab3056fca1fa458d30fbb3810c3eb5145f",rpc:["https://gwan-ssl.wandevs.org:56891"],ws:["wss://api.wanchain.org:8443/ws/v3/ddd16770c68f30350a21114802d5418eafe039b722de52b488e7eee1ee2cd73f"],explorer:"https://www.wanscan.org"},11297108109:{key:"11297108109",name:"Palm Mainnet",shortName:"Palm",chainId:11297108109,network:"mainnet",multicall:"0xfFE2FF36c5b8D948f788a34f867784828aa7415D",rpc:["https://palm-mainnet.infura.io/v3/3a961d6501e54add9a41aa53f15de99b"],explorer:"https://explorer.palm.io"}},sy={};function ay(t){var e=oy[t].rpc[0];return sy[t]||(sy[t]=new ny(e)),sy[t]}var hy={basic:function(t,i,n,o){var s,a;return e(this,void 0,void 0,(function(){var e,n,h,u;return r(this,(function(r){switch(r.label){case 0:return e=o.strategies||i.strategies,n=o.onlyMembers||(null===(s=i.filters)||void 0===s?void 0:s.onlyMembers),h=o.minScore||(null===(a=i.filters)||void 0===a?void 0:a.minScore),(i.members||[]).map((function(t){return t.toLowerCase()})).includes(t.toLowerCase())?[2,!0]:n?[2,!1]:h?[4,rb(i.id||i.key,e,i.network,"",[t])]:[3,2];case 1:if(u=r.sent(),u.map((function(t){return Object.values(t).reduce((function(t,e){return t+e}),0)})).reduce((function(t,e){return t+e}),0)<h)return[2,!1];r.label=2;case 2:return[2,!0]}}))}))},aave:function(t,n,o,s){var a,h;return e(this,void 0,void 0,(function(){var e,o,u,l,f,c;return r(this,(function(r){switch(r.label){case 0:return e=s.onlyMembers||(null===(a=n.filters)||void 0===a?void 0:a.onlyMembers),o=s.minScore||(null===(h=n.filters)||void 0===h?void 0:h.minScore),u=(n.members||[]).map((function(t){return t.toLowerCase()})),l=i(n.strategies),(f=l.findIndex((function(t){return"aave-governance-power"===t.name})))>=0&&(l[f].params.powerType="proposition"),u.includes(t.toLowerCase())?[2,!0]:e?[2,!1]:o?[4,rb(n.id||n.key,l,n.network,"",[t])]:[3,2];case 1:if(c=r.sent(),c.map((function(t){return Object.values(t).reduce((function(t,e){return t+e}),0)})).reduce((function(t,e){return t+e}),0)<o)return[2,!1];r.label=2;case 2:return[2,!0]}}))}))}};let uy=!1,ly=!1;const fy={debug:1,default:2,info:2,warning:3,error:4,off:5};let cy=fy.default,dy=null;const my=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var py,gy;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(py||(py={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(gy||(gy={}));class vy{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==fy[r]&&this.throwArgumentError("invalid log level name","logLevel",t),cy>fy[r]||console.log.apply(console,e)}debug(...t){this._log(vy.levels.DEBUG,t)}info(...t){this._log(vy.levels.INFO,t)}warn(...t){this._log(vy.levels.WARNING,t)}makeError(t,e,r){if(ly)return this.makeError("censored error",e,{});e||(e=vy.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,vy.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){my&&this.throwError("platform missing String.prototype.normalize",vy.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:my})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,vy.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,vy.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,vy.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,vy.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",vy.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",vy.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",vy.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return dy||(dy=new vy("logger/5.4.0")),dy}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",vy.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),uy){if(!t)return;this.globalLogger().throwError("error censorship permanent",vy.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ly=!!t,uy=!!e}static setLogLevel(t){const e=fy[t.toLowerCase()];null!=e?cy=e:vy.globalLogger().warn("invalid log level - "+t)}static from(t){return new vy(t)}}vy.errors=gy,vy.levels=py;const yy=new vy("bytes/5.4.0");function wy(t){return!!t.toHexString}function My(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return My(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function by(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function Ey(t,e){if(e||(e={}),"number"==typeof t){yy.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),My(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),wy(t)&&(t=t.toHexString()),_y(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":yy.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return My(new Uint8Array(i))}return by(t)?My(new Uint8Array(t)):yy.throwArgumentError("invalid arrayify value","value",t)}function _y(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function Ny(t,e){if(e||(e={}),"number"==typeof t){yy.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),wy(t))return t.toHexString();if(_y(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":yy.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(by(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return yy.throwArgumentError("invalid hexlify value","value",t)}function Ay(t){let e="0x";return t.forEach(t=>{e+=Ny(t).substring(2)}),e}function Sy(t,e){for("string"!=typeof t?t=Ny(t):_y(t)||yy.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&yy.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var Ry=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,f=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!==(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);i=(m=m.idivn(d)).isZero()?p+i:u[c-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),l=this.clone();if(h){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],M=8191&w,b=w>>>13,E=0|s[4],_=8191&E,N=E>>>13,A=0|s[5],S=8191&A,R=A>>>13,x=0|s[6],I=8191&x,k=x>>>13,T=0|s[7],O=8191&T,P=T>>>13,C=0|s[8],U=8191&C,F=C>>>13,B=0|s[9],D=8191&B,L=B>>>13,$=0|a[0],j=8191&$,z=$>>>13,q=0|a[1],G=8191&q,V=q>>>13,Z=0|a[2],K=8191&Z,H=Z>>>13,W=0|a[3],J=8191&W,X=W>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(c,j)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,j),n=(n=Math.imul(v,z))+Math.imul(y,j)|0,o=Math.imul(y,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,V)|0;var yt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,z))+Math.imul(b,j)|0,o=Math.imul(b,z),i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,X)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(_,j),n=(n=Math.imul(_,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,X)|0;var Mt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(k,j)|0,o=Math.imul(k,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Et=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(u+(i=i+Math.imul(f,ht)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,z))+Math.imul(F,j)|0,o=Math.imul(F,z),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Nt=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,V)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(M,ot)|0,n=(n=n+Math.imul(M,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ht)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var At=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;u=((o=o+Math.imul(c,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,V))+Math.imul(L,G)|0,o=Math.imul(L,V),i=i+Math.imul(U,K)|0,n=(n=n+Math.imul(U,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var St=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,H))+Math.imul(L,K)|0,o=Math.imul(L,H),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,X)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,X))+Math.imul(L,J)|0,o=Math.imul(L,X),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var xt=(u+(i=i+Math.imul(M,mt)|0)|0)+((8191&(n=(n=n+Math.imul(M,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var It=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(U,ot)|0,n=(n=n+Math.imul(U,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ft)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(S,mt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(U,ht)|0,n=(n=n+Math.imul(U,ut)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(U,ft)|0,n=(n=n+Math.imul(U,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Ot=(u+(i=i+Math.imul(O,mt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ft),n=(n=Math.imul(D,ct))+Math.imul(L,ft)|0,o=Math.imul(L,ct);var Pt=(u+(i=i+Math.imul(U,mt)|0)|0)+((8191&(n=(n=n+Math.imul(U,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ct=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=Et,h[7]=_t,h[8]=Nt,h[9]=At,h[10]=St,h[11]=Rt,h[12]=xt,h[13]=It,h[14]=kt,h[15]=Tt,h[16]=Ot,h[17]=Pt,h[18]=Ct,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),c=67108863&f;a=67108863&(c=c+a|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},p.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},p.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var f=h,c=u,d=0;d<s;d++){var m=r[l+d],p=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=m+g,i[l+d]=p+v,r[l+d+s]=m-g,i[l+d+s]=p-v,d!==a&&(y=h*f-u*c,c=h*c+u*f,f=y)}},p.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},p.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},p.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,l,f,i,n);for(var d=0;d<i;d++){var m=a[d]*l[d]-h[d]*f[d];h[d]=a[d]*f[d]+h[d]*l[d],a[d]=m}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var f=h-1;f>=0;f--){var c=67108864*(0|i.words[o.length+f])+(0|i.words[o.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(f)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(M,v),i(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var v=this.pow(f,new n(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new _(t)},i(_,E),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,n)})).BN;const xy=new vy("bignumber/5.4.0"),Iy={};let ky=!1;class Ty{constructor(t,e){xy.checkNew(new.target,Ty),t!==Iy&&xy.throwError("cannot call constructor directly; use BigNumber.from",vy.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Py(Cy(this).fromTwos(t))}toTwos(t){return Py(Cy(this).toTwos(t))}abs(){return"-"===this._hex[0]?Ty.from(this._hex.substring(1)):this}add(t){return Py(Cy(this).add(Cy(t)))}sub(t){return Py(Cy(this).sub(Cy(t)))}div(t){return Ty.from(t).isZero()&&Uy("division by zero","div"),Py(Cy(this).div(Cy(t)))}mul(t){return Py(Cy(this).mul(Cy(t)))}mod(t){const e=Cy(t);return e.isNeg()&&Uy("cannot modulo negative values","mod"),Py(Cy(this).umod(e))}pow(t){const e=Cy(t);return e.isNeg()&&Uy("cannot raise to negative values","pow"),Py(Cy(this).pow(e))}and(t){const e=Cy(t);return(this.isNegative()||e.isNeg())&&Uy("cannot 'and' negative values","and"),Py(Cy(this).and(e))}or(t){const e=Cy(t);return(this.isNegative()||e.isNeg())&&Uy("cannot 'or' negative values","or"),Py(Cy(this).or(e))}xor(t){const e=Cy(t);return(this.isNegative()||e.isNeg())&&Uy("cannot 'xor' negative values","xor"),Py(Cy(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Uy("cannot mask negative values","mask"),Py(Cy(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Uy("cannot shift negative values","shl"),Py(Cy(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Uy("cannot shift negative values","shr"),Py(Cy(this).shrn(t))}eq(t){return Cy(this).eq(Cy(t))}lt(t){return Cy(this).lt(Cy(t))}lte(t){return Cy(this).lte(Cy(t))}gt(t){return Cy(this).gt(Cy(t))}gte(t){return Cy(this).gte(Cy(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Cy(this).isZero()}toNumber(){try{return Cy(this).toNumber()}catch(t){Uy("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return xy.throwError("this platform does not support BigInt",vy.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ky||(ky=!0,xy.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?xy.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",vy.errors.UNEXPECTED_ARGUMENT,{}):xy.throwError("BigNumber.toString does not accept parameters",vy.errors.UNEXPECTED_ARGUMENT,{})),Cy(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ty)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Ty(Iy,Oy(t)):t.match(/^-?[0-9]+$/)?new Ty(Iy,Oy(new Ry(t))):xy.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Uy("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&Uy("overflow","BigNumber.from",t),Ty.from(String(t));const e=t;if("bigint"==typeof e)return Ty.from(e.toString());if(by(e))return Ty.from(Ny(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Ty.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(_y(t)||"-"===t[0]&&_y(t.substring(1))))return Ty.from(t)}return xy.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Oy(t){if("string"!=typeof t)return Oy(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&xy.throwArgumentError("invalid hex","value",t),"0x00"===(t=Oy(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Py(t){return Ty.from(Oy(t))}function Cy(t){const e=Ty.from(t).toHexString();return"-"===e[0]?new Ry("-"+e.substring(3),16):new Ry(e.substring(2),16)}function Uy(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),xy.throwError(t,vy.errors.NUMERIC_FAULT,i)}function Fy(t){return"0x"+si.keccak_256(Ey(t))}const By=new vy("address/5.4.0");function Dy(t){_y(t,20)||By.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=Ey(Fy(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Ly={};for(let t=0;t<10;t++)Ly[String(t)]=String(t);for(let t=0;t<26;t++)Ly[String.fromCharCode(65+t)]=String(10+t);const $y=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function jy(t){let e=null;if("string"!=typeof t&&By.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Dy(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&By.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>Ly[t]).join("");for(;e.length>=$y;){let t=e.substring(0,$y);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&By.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Ry(r,36).toString(16);e.length<40;)e="0"+e;e=Dy("0x"+e)}else By.throwArgumentError("invalid address","address",t);var r;return e}window&&window.__awaiter;const zy=new vy("properties/5.4.0");function qy(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Gy(t){const e={};for(const r in t)e[r]=t[r];return e}const Vy={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Zy(t){if(function t(e){if(null==e||Vy[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const r=Object.keys(e);for(let i=0;i<r.length;i++)if(!t(e[r[i]]))return!1;return!0}return zy.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}(t))return t;if(Array.isArray(t))return Object.freeze(t.map(t=>Ky(t)));if("object"==typeof t){const e={};for(const r in t){const i=t[r];void 0!==i&&qy(e,r,Ky(i))}return e}return zy.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Ky(t){return Zy(t)}const Hy=new vy("strings/5.4.0");var Wy,Jy;function Xy(t,e,r,i,n){if(t===Jy.BAD_PREFIX||t===Jy.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===Jy.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Wy||(Wy={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Jy||(Jy={}));Object.freeze({error:function(t,e,r,i,n){return Hy.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Xy,replace:function(t,e,r,i,n){return t===Jy.OVERLONG?(i.push(n),0):(i.push(65533),Xy(t,e,r))}});function Yy(t){return Fy(function(t,e=Wy.current){e!=Wy.current&&(Hy.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&i)<<10)+(1023&n);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(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return Ey(r)}(t))}var Qy=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const tw=new vy("hash/5.4.0"),ew=new Uint8Array(32);ew.fill(0);const rw=Ty.from(-1),iw=Ty.from(0),nw=Ty.from(1),ow=Ty.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const sw=Sy(nw.toHexString(),32),aw=Sy(iw.toHexString(),32),hw={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},uw=["name","version","chainId","verifyingContract","salt"];function lw(t){return function(e){return"string"!=typeof e&&tw.throwArgumentError("invalid domain value for "+JSON.stringify(t),"domain."+t,e),e}}const fw={name:lw("name"),version:lw("version"),chainId:function(t){try{return Ty.from(t).toString()}catch(t){}return tw.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return jy(t).toLowerCase()}catch(t){}return tw.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=Ey(t);if(32!==e.length)throw new Error("bad length");return Ny(e)}catch(t){}return tw.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function cw(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&tw.throwArgumentError("invalid numeric width","type",t);const n=ow.mask(r?i-1:i),o=r?n.add(nw).mul(rw):iw;return function(e){const r=Ty.from(e);return(r.lt(o)||r.gt(n))&&tw.throwArgumentError("value out-of-bounds for "+t,"value",e),Sy(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&tw.throwArgumentError("invalid bytes width","type",t),function(e){return Ey(e).length!==r&&tw.throwArgumentError("invalid length for "+t,"value",e),function(t){const e=Ey(t),r=e.length%32;return r?Ay([e,ew.slice(r)]):Ny(e)}(e)}}}switch(t){case"address":return function(t){return Sy(jy(t),32)};case"bool":return function(t){return t?sw:aw};case"bytes":return function(t){return Fy(t)};case"string":return function(t){return Yy(t)}}return null}function dw(t,e){return`${t}(${e.map(({name:t,type:e})=>e+" "+t).join(",")})`}class mw{constructor(t){qy(this,"types",Object.freeze(Ky(t))),qy(this,"_encoderCache",{}),qy(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach(t=>{e[t]={},r[t]=[],i[t]={}});for(const i in t){const n={};t[i].forEach(o=>{n[o.name]&&tw.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===i&&tw.throwArgumentError("circular type reference to "+JSON.stringify(s),"types",t);cw(s)||(r[s]||tw.throwArgumentError("unknown type "+JSON.stringify(s),"types",t),r[s].push(i),e[i][s]=!0)})}const n=Object.keys(r).filter(t=>0===r[t].length);0===n.length?tw.throwArgumentError("missing primary type","types",t):n.length>1&&tw.throwArgumentError("ambiguous primary types or unused types: "+n.map(t=>JSON.stringify(t)).join(", "),"types",t),qy(this,"primaryType",n[0]),function n(o,s){s[o]&&tw.throwArgumentError("circular type reference to "+JSON.stringify(o),"types",t),s[o]=!0,Object.keys(e[o]).forEach(t=>{r[t]&&(n(t,s),Object.keys(s).forEach(e=>{i[e][t]=!0}))}),delete s[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=dw(e,t[e])+r.map(e=>dw(e,t[e])).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=cw(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&tw.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(Fy)),Fy(Ay(n))}}const r=this.types[t];if(r){const e=Yy(this._types[t]);return t=>{const i=r.map(({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?Fy(i):i});return i.unshift(e),Ay(i)}}return tw.throwArgumentError("unknown type: "+t,"type",t)}encodeType(t){const e=this._types[t];return e||tw.throwArgumentError("unknown type: "+JSON.stringify(t),"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return Fy(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(cw(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&tw.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map(e=>this._visit(t,e,r))}const n=this.types[t];return n?n.reduce((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t),{}):tw.throwArgumentError("unknown type: "+t,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new mw(t)}static getPrimaryType(t){return mw.from(t).primaryType}static hashStruct(t,e,r){return mw.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=hw[r];i||tw.throwArgumentError("invalid typed-data domain key: "+JSON.stringify(r),"domain",t),e.push({name:r,type:i})}return e.sort((t,e)=>uw.indexOf(t.name)-uw.indexOf(e.name)),mw.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Ay(["0x1901",mw.hashDomain(t),mw.from(e).hash(r)])}static hash(t,e,r){return Fy(mw.encode(t,e,r))}static resolveNames(t,e,r,i){return Qy(this,void 0,void 0,(function*(){t=Gy(t);const n={};t.verifyingContract&&!_y(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=mw.from(e);o.visit(r,(t,e)=>("address"!==t||_y(e,20)||(n[e]="0x"),e));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,(t,e)=>"address"===t&&n[e]?n[e]:e),{domain:t,value:r}}))}static getPayload(t,e,r){mw.hashDomain(t);const i={},n=[];uw.forEach(e=>{const r=t[e];null!=r&&(i[e]=fw[e](r),n.push({name:e,type:hw[e]}))});const o=mw.from(e),s=Gy(e);return s.EIP712Domain?tw.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=n,o.encode(r),{types:s,domain:i,primaryType:o.primaryType,message:o.visit(r,(t,e)=>{if(t.match(/^bytes(\d*)/))return Ny(Ey(e));if(t.match(/^u?int/))return Ty.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&tw.throwArgumentError("invalid string","value",e),e}return tw.throwArgumentError("unsupported type","type",t)})}}}var pw=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,f=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!==(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);i=(m=m.idivn(d)).isZero()?p+i:u[c-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),l=this.clone();if(h){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],M=8191&w,b=w>>>13,E=0|s[4],_=8191&E,N=E>>>13,A=0|s[5],S=8191&A,R=A>>>13,x=0|s[6],I=8191&x,k=x>>>13,T=0|s[7],O=8191&T,P=T>>>13,C=0|s[8],U=8191&C,F=C>>>13,B=0|s[9],D=8191&B,L=B>>>13,$=0|a[0],j=8191&$,z=$>>>13,q=0|a[1],G=8191&q,V=q>>>13,Z=0|a[2],K=8191&Z,H=Z>>>13,W=0|a[3],J=8191&W,X=W>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(c,j)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,j),n=(n=Math.imul(v,z))+Math.imul(y,j)|0,o=Math.imul(y,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,V)|0;var yt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,z))+Math.imul(b,j)|0,o=Math.imul(b,z),i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,X)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(_,j),n=(n=Math.imul(_,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,X)|0;var Mt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(k,j)|0,o=Math.imul(k,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Et=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(u+(i=i+Math.imul(f,ht)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,z))+Math.imul(F,j)|0,o=Math.imul(F,z),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Nt=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,V)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(M,ot)|0,n=(n=n+Math.imul(M,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ht)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var At=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;u=((o=o+Math.imul(c,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,V))+Math.imul(L,G)|0,o=Math.imul(L,V),i=i+Math.imul(U,K)|0,n=(n=n+Math.imul(U,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var St=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,H))+Math.imul(L,K)|0,o=Math.imul(L,H),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,X)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,X))+Math.imul(L,J)|0,o=Math.imul(L,X),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var xt=(u+(i=i+Math.imul(M,mt)|0)|0)+((8191&(n=(n=n+Math.imul(M,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var It=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(U,ot)|0,n=(n=n+Math.imul(U,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ft)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(S,mt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(U,ht)|0,n=(n=n+Math.imul(U,ut)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(U,ft)|0,n=(n=n+Math.imul(U,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Ot=(u+(i=i+Math.imul(O,mt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ft),n=(n=Math.imul(D,ct))+Math.imul(L,ft)|0,o=Math.imul(L,ct);var Pt=(u+(i=i+Math.imul(U,mt)|0)|0)+((8191&(n=(n=n+Math.imul(U,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ct=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=Et,h[7]=_t,h[8]=Nt,h[9]=At,h[10]=St,h[11]=Rt,h[12]=xt,h[13]=It,h[14]=kt,h[15]=Tt,h[16]=Ot,h[17]=Pt,h[18]=Ct,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),c=67108863&f;a=67108863&(c=c+a|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},p.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},p.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var f=h,c=u,d=0;d<s;d++){var m=r[l+d],p=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=m+g,i[l+d]=p+v,r[l+d+s]=m-g,i[l+d+s]=p-v,d!==a&&(y=h*f-u*c,c=h*c+u*f,f=y)}},p.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},p.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},p.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,l,f,i,n);for(var d=0;d<i;d++){var m=a[d]*l[d]-h[d]*f[d];h[d]=a[d]*f[d]+h[d]*l[d],a[d]=m}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var f=h-1;f>=0;f--){var c=67108864*(0|i.words[o.length+f])+(0|i.words[o.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(f)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(M,v),i(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var v=this.pow(f,new n(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new _(t)},i(_,E),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,n)}));function gw(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var vw=yw;function yw(t,e){if(!t)throw new Error(e||"Assertion failed")}yw.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var ww=gw((function(t,e){var r=e;function i(t){return 1===t.length?"0"+t:t}function n(t){for(var e="",r=0;r<t.length;r++)e+=i(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var i=0;i<t.length;i++)r[i]=0|t[i];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(i=0;i<t.length;i++){var n=t.charCodeAt(i),o=n>>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=i,r.toHex=n,r.encode=function(t,e){return"hex"===e?n(t):t}})),Mw=gw((function(t,e){var r=e;r.assert=vw,r.toArray=ww.toArray,r.zero2=ww.zero2,r.toHex=ww.toHex,r.encode=ww.encode,r.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<<e+1,o=t.clone(),s=0;s<i.length;s++){var a,h=o.andln(n-1);o.isOdd()?(a=h>(n>>1)-1?(n>>1)-h:h,o.isubn(a)):a=0,i[s]=a,o.iushrn(1)}return i},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var s,a,h=t.andln(3)+n&3,u=e.andln(3)+o&3;3===h&&(h=-1),3===u&&(u=-1),s=0==(1&h)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==u?h:-h,r[0].push(s),a=0==(1&u)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==h?u:-u,r[1].push(a),2*n===s+1&&(n=1-n),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new pw(t,"hex","le")}})),bw=Mw.getNAF,Ew=Mw.getJSF,_w=Mw.assert;function Nw(t,e){this.type=t,this.p=new pw(e.p,16),this.red=e.prime?pw.red(e.prime):pw.mont(this.p),this.zero=new pw(0).toRed(this.red),this.one=new pw(1).toRed(this.red),this.two=new pw(2).toRed(this.red),this.n=e.n&&new pw(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.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 Aw=Nw;function Sw(t,e){this.curve=t,this.type=e,this.precomputed=null}Nw.prototype.point=function(){throw new Error("Not implemented")},Nw.prototype.validate=function(){throw new Error("Not implemented")},Nw.prototype._fixedNafMul=function(t,e){_w(t.precomputed);var r=t._getDoubles(),i=bw(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,s,a=[];for(o=0;o<i.length;o+=r.step){s=0;for(var h=o+r.step-1;h>=o;h--)s=(s<<1)+i[h];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=n;f>0;f--){for(o=0;o<a.length;o++)(s=a[o])===f?l=l.mixedAdd(r.points[o]):s===-f&&(l=l.mixedAdd(r.points[o].neg()));u=u.add(l)}return u.toP()},Nw.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=bw(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var h=0;a>=0&&0===o[a];a--)h++;if(a>=0&&h++,s=s.dblp(h),a<0)break;var u=o[a];_w(0!==u),s="affine"===t.type?u>0?s.mixedAdd(n[u-1>>1]):s.mixedAdd(n[-u-1>>1].neg()):u>0?s.add(n[u-1>>1]):s.add(n[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},Nw.prototype._wnafMulAdd=function(t,e,r,i,n){var o,s,a,h=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o<i;o++){var c=(a=e[o])._getNAFPoints(t);h[o]=c.wnd,u[o]=c.points}for(o=i-1;o>=1;o-=2){var d=o-1,m=o;if(1===h[d]&&1===h[m]){var p=[e[d],null,null,e[m]];0===e[d].y.cmp(e[m].y)?(p[1]=e[d].add(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg())):0===e[d].y.cmp(e[m].y.redNeg())?(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].add(e[m].neg())):(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Ew(r[d],r[m]);for(f=Math.max(v[0].length,f),l[d]=new Array(f),l[m]=new Array(f),s=0;s<f;s++){var y=0|v[0][s],w=0|v[1][s];l[d][s]=g[3*(y+1)+(w+1)],l[m][s]=0,u[d]=p}}else l[d]=bw(r[d],h[d],this._bitLength),l[m]=bw(r[m],h[m],this._bitLength),f=Math.max(l[d].length,f),f=Math.max(l[m].length,f)}var M=this.jpoint(null,null,null),b=this._wnafT4;for(o=f;o>=0;o--){for(var E=0;o>=0;){var _=!0;for(s=0;s<i;s++)b[s]=0|l[s][o],0!==b[s]&&(_=!1);if(!_)break;E++,o--}if(o>=0&&E++,M=M.dblp(E),o<0)break;for(s=0;s<i;s++){var N=b[s];0!==N&&(N>0?a=u[s][N-1>>1]:N<0&&(a=u[s][-N-1>>1].neg()),M="affine"===a.type?M.mixedAdd(a):M.add(a))}}for(o=0;o<i;o++)u[o]=null;return n?M:M.toP()},Nw.BasePoint=Sw,Sw.prototype.eq=function(){throw new Error("Not implemented")},Sw.prototype.validate=function(){return this.curve.validate(this)},Nw.prototype.decodePoint=function(t,e){t=Mw.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?_w(t[t.length-1]%2==0):7===t[0]&&_w(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},Sw.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Sw.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},Sw.prototype.encode=function(t,e){return Mw.encode(this._encode(e),t)},Sw.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},Sw.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},Sw.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var o=0;o<t;o++)i=i.dbl();r.push(i)}return{step:t,points:r}},Sw.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},Sw.prototype._getBeta=function(){return null},Sw.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var Rw=gw((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),xw=Mw.assert;function Iw(t){Aw.call(this,"short",t),this.a=new pw(t.a,16).toRed(this.red),this.b=new pw(t.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(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Rw(Iw,Aw);var kw=Iw;function Tw(t,e,r,i){Aw.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new pw(e,16),this.y=new pw(r,16),i&&(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 Ow(t,e,r,i){Aw.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new pw(0)):(this.x=new pw(e,16),this.y=new pw(r,16),this.z=new pw(i,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}Iw.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new pw(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new pw(t.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(e))?r=n[0]:(r=n[1],xw(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new pw(t.a,16),b:new pw(t.b,16)}})):this._getEndoBasis(r)}}},Iw.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:pw.mont(t),r=new pw(2).toRed(e).redInvm(),i=r.redNeg(),n=new pw(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},Iw.prototype._getEndoBasis=function(t){for(var e,r,i,n,o,s,a,h,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=t,c=this.n.clone(),d=new pw(1),m=new pw(0),p=new pw(0),g=new pw(1),v=0;0!==f.cmpn(0);){var y=c.div(f);h=c.sub(y.mul(f)),u=p.sub(y.mul(d));var w=g.sub(y.mul(m));if(!i&&h.cmp(l)<0)e=a.neg(),r=d,i=h.neg(),n=u;else if(i&&2==++v)break;a=h,c=f,f=h,p=d,d=u,g=m,m=w}o=h.neg(),s=u;var M=i.sqr().add(n.sqr());return o.sqr().add(s.sqr()).cmp(M)>=0&&(o=e,s=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:n},{a:o,b:s}]},Iw.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=n.mul(r.a),a=o.mul(i.a),h=n.mul(r.b),u=o.mul(i.b);return{k1:t.sub(s).sub(a),k2:h.add(u).neg()}},Iw.prototype.pointFromX=function(t,e){(t=new pw(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},Iw.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},Iw.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],h=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),h=h.neg(!0)),i[2*o]=a,i[2*o+1]=h,n[2*o]=s.k1,n[2*o+1]=s.k2}for(var u=this._wnafMulAdd(1,i,n,2*o,r),l=0;l<2*o;l++)i[l]=null,n[l]=null;return u},Rw(Tw,Aw.BasePoint),Iw.prototype.point=function(t,e,r){return new Tw(this,t,e,r)},Iw.prototype.pointFromJSON=function(t,e){return Tw.fromJSON(this,t,e)},Tw.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},Tw.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]},Tw.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(e){return t.point(e[0],e[1],r)}var o=e[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(n))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(n))}},i},Tw.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)+">"},Tw.prototype.isInfinity=function(){return this.inf},Tw.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Tw.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),s=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},Tw.prototype.getX=function(){return this.x.fromRed()},Tw.prototype.getY=function(){return this.y.fromRed()},Tw.prototype.mul=function(t){return t=new pw(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Tw.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Tw.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Tw.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Tw.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},Tw.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Rw(Ow,Aw.BasePoint),Iw.prototype.jpoint=function(t,e,r){return new Ow(this,t,e,r)},Ow.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},Ow.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Ow.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),h=o.redSub(s);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),f=i.redMul(u),c=h.redSqr().redIAdd(l).redISub(f).redISub(f),d=h.redMul(f.redISub(c)).redISub(o.redMul(l)),m=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(c,d,m)},Ow.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(i),a=n.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),u=h.redMul(s),l=r.redMul(h),f=a.redSqr().redIAdd(u).redISub(l).redISub(l),c=a.redMul(l.redISub(f)).redISub(n.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(f,c,d)},Ow.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,o=this.x,s=this.y,a=this.z,h=a.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var l=o.redSqr(),f=u.redSqr(),c=f.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(h)),m=o.redMul(f),p=d.redSqr().redISub(m.redAdd(m)),g=m.redISub(p),v=d.redMul(g);v=v.redIAdd(v).redISub(c);var y=u.redMul(a);e+1<t&&(h=h.redMul(c)),o=p,a=y,u=v}return this.curve.jpoint(o,u.redMul(n),a)},Ow.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Ow.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var a=i.redAdd(i).redIAdd(i),h=a.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=h,e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),f=this.y.redSqr(),c=f.redSqr(),d=this.x.redAdd(f).redSqr().redISub(l).redISub(c);d=d.redIAdd(d);var m=l.redAdd(l).redIAdd(l),p=m.redSqr(),g=c.redIAdd(c);g=(g=g.redIAdd(g)).redIAdd(g),t=p.redISub(d).redISub(d),e=m.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},Ow.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),h=a.redSqr().redISub(s).redISub(s);t=h;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),f=this.y.redSqr(),c=this.x.redMul(f),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var m=c.redIAdd(c),p=(m=m.redIAdd(m)).redAdd(m);t=d.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(l);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(m.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},Ow.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(n)),h=e.redAdd(e),u=(h=h.redIAdd(h)).redMul(s),l=a.redSqr().redISub(u.redAdd(u)),f=u.redISub(l),c=s.redSqr();c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=a.redMul(f).redISub(c),m=r.redAdd(r).redMul(i);return this.curve.jpoint(l,d,m)},Ow.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),o=n.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(i),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),h=i.redIAdd(i);h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var u=n.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(h),l=e.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.x.redMul(a).redISub(l);f=(f=f.redIAdd(f)).redIAdd(f);var c=this.y.redMul(u.redMul(h.redISub(u)).redISub(s.redMul(a)));c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(f,c,d)},Ow.prototype.mul=function(t,e){return t=new pw(t,e),this.curve._wnafMul(this,t)},Ow.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return 0===this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)},Ow.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},Ow.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)+">"},Ow.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Pw=gw((function(t,e){var r=e;r.base=Aw,r.short=kw,r.mont=null,r.edwards=null})),Cw=gw((function(t,e){var r,i=e,n=Mw.assert;function o(t){"short"===t.type?this.curve=new Pw.short(t):"edwards"===t.type?this.curve=new Pw.edwards(t):this.curve=new Pw.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){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:Xp.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function Uw(t){if(!(this instanceof Uw))return new Uw(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ww.toArray(t.entropy,t.entropyEnc||"hex"),r=ww.toArray(t.nonce,t.nonceEnc||"hex"),i=ww.toArray(t.pers,t.persEnc||"hex");vw(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var Fw=Uw;Uw.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},Uw.prototype._hmac=function(){return new Xp.hmac(this.hash,this.K)},Uw.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},Uw.prototype.reseed=function(t,e,r,i){"string"!=typeof e&&(i=r,r=e,e=null),t=ww.toArray(t,e),r=ww.toArray(r,i),vw(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Uw.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=ww.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<t;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var o=n.slice(0,t);return this._update(r),this._reseed++,ww.encode(o,e)};var Bw=Mw.assert;function Dw(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Lw=Dw;Dw.fromPublic=function(t,e,r){return e instanceof Dw?e:new Dw(t,{pub:e,pubEnc:r})},Dw.fromPrivate=function(t,e,r){return e instanceof Dw?e:new Dw(t,{priv:e,privEnc:r})},Dw.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},Dw.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Dw.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},Dw.prototype._importPrivate=function(t,e){this.priv=new pw(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Dw.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?Bw(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Bw(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},Dw.prototype.derive=function(t){return t.validate()||Bw(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Dw.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Dw.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Dw.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var $w=Mw.assert;function jw(t,e){if(t instanceof jw)return t;this._importDER(t,e)||($w(t.r&&t.s,"Signature without r or s"),this.r=new pw(t.r,16),this.s=new pw(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var zw=jw;function qw(){this.place=0}function Gw(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,s=e.place;o<i;o++,s++)n<<=8,n|=t[s],n>>>=0;return!(n<=127)&&(e.place=s,n)}function Vw(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function Zw(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}jw.prototype._importDER=function(t,e){t=Mw.toArray(t,e);var r=new qw;if(48!==t[r.place++])return!1;var i=Gw(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=Gw(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var s=Gw(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.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 pw(o),this.s=new pw(a),this.recoveryParam=null,!0},jw.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=Vw(e),r=Vw(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];Zw(i,e.length),(i=i.concat(e)).push(2),Zw(i,r.length);var n=i.concat(r),o=[48];return Zw(o,n.length),o=o.concat(n),Mw.encode(o,t)};var Kw=function(){throw new Error("unsupported")},Hw=Mw.assert;function Ww(t){if(!(this instanceof Ww))return new Ww(t);"string"==typeof t&&(Hw(Object.prototype.hasOwnProperty.call(Cw,t),"Unknown curve "+t),t=Cw[t]),t instanceof Cw.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Jw=Ww;Ww.prototype.keyPair=function(t){return new Lw(this,t)},Ww.prototype.keyFromPrivate=function(t,e){return Lw.fromPrivate(this,t,e)},Ww.prototype.keyFromPublic=function(t,e){return Lw.fromPublic(this,t,e)},Ww.prototype.genKeyPair=function(t){t||(t={});for(var e=new Fw({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Kw(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new pw(2));;){var n=new pw(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},Ww.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Ww.prototype.sign=function(t,e,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new pw(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),s=t.toArray("be",n),a=new Fw({hash:this.hash,entropy:o,nonce:s,pers:i.pers,persEnc:i.persEnc||"utf8"}),h=this.n.sub(new pw(1)),u=0;;u++){var l=i.k?i.k(u):new pw(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var f=this.g.mul(l);if(!f.isInfinity()){var c=f.getX(),d=c.umod(this.n);if(0!==d.cmpn(0)){var m=l.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var p=(f.getY().isOdd()?1:0)|(0!==c.cmp(d)?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),p^=1),new zw({r:d,s:m,recoveryParam:p})}}}}}},Ww.prototype.verify=function(t,e,r,i){t=this._truncateToN(new pw(t,16)),r=this.keyFromPublic(r,i);var n=(e=new zw(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.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),h=a.mul(t).umod(this.n),u=a.mul(n).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(h,r.getPublic(),u)).isInfinity()&&s.eqXToP(n):!(s=this.g.mulAdd(h,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(n)},Ww.prototype.recoverPubKey=function(t,e,r,i){Hw((3&r)===r,"The recovery param is more than two bits"),e=new zw(e,i);var n=this.n,o=new pw(t),s=e.r,a=e.s,h=1&r,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");s=u?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var l=e.r.invm(n),f=n.sub(o).mul(l).umod(n),c=a.mul(l).umod(n);return this.g.mulAdd(f,s,c)},Ww.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new zw(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var Xw=gw((function(t,e){var r=e;r.version="6.5.4",r.utils=Mw,r.rand=function(){throw new Error("unsupported")},r.curve=Pw,r.curves=Cw,r.ec=Jw,r.eddsa=null})).ec;let Yw=!1,Qw=!1;const tM={debug:1,default:2,info:2,warning:3,error:4,off:5};let eM=tM.default,rM=null;const iM=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var nM,oM;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(nM||(nM={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(oM||(oM={}));class sM{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==tM[r]&&this.throwArgumentError("invalid log level name","logLevel",t),eM>tM[r]||console.log.apply(console,e)}debug(...t){this._log(sM.levels.DEBUG,t)}info(...t){this._log(sM.levels.INFO,t)}warn(...t){this._log(sM.levels.WARNING,t)}makeError(t,e,r){if(Qw)return this.makeError("censored error",e,{});e||(e=sM.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,sM.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){iM&&this.throwError("platform missing String.prototype.normalize",sM.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:iM})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,sM.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,sM.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,sM.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,sM.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",sM.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",sM.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",sM.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return rM||(rM=new sM("logger/5.4.0")),rM}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",sM.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Yw){if(!t)return;this.globalLogger().throwError("error censorship permanent",sM.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Qw=!!t,Yw=!!e}static setLogLevel(t){const e=tM[t.toLowerCase()];null!=e?eM=e:sM.globalLogger().warn("invalid log level - "+t)}static from(t){return new sM(t)}}sM.errors=oM,sM.levels=nM;const aM=new sM("bytes/5.4.0");function hM(t){return!!t.toHexString}function uM(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return uM(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function lM(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function fM(t,e){if(e||(e={}),"number"==typeof t){aM.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),uM(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),hM(t)&&(t=t.toHexString()),cM(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":aM.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return uM(new Uint8Array(i))}return lM(t)?uM(new Uint8Array(t)):aM.throwArgumentError("invalid arrayify value","value",t)}function cM(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function dM(t,e){if(e||(e={}),"number"==typeof t){aM.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),hM(t))return t.toHexString();if(cM(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":aM.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(lM(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return aM.throwArgumentError("invalid hexlify value","value",t)}function mM(t,e){for("string"!=typeof t?t=dM(t):cM(t)||aM.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&aM.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function pM(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(cM(r=t)&&!(r.length%2)||lM(r)){const r=fM(t);65!==r.length&&aM.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),e.r=dM(r.slice(0,32)),e.s=dM(r.slice(32,64)),e.v=r[64],e.v<27&&(0===e.v||1===e.v?e.v+=27:aM.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=dM(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=fM(t)).length>e&&aM.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),uM(r)}(fM(e._vs),32);e._vs=dM(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&aM.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const n=dM(r);null==e.s?e.s=n:e.s!==n&&aM.throwArgumentError("signature v mismatch _vs","signature",t)}null==e.recoveryParam?null==e.v?aM.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2:null==e.v?e.v=27+e.recoveryParam:e.recoveryParam!==1-e.v%2&&aM.throwArgumentError("signature recoveryParam mismatch v","signature",t),null!=e.r&&cM(e.r)?e.r=mM(e.r,32):aM.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&cM(e.s)?e.s=mM(e.s,32):aM.throwArgumentError("signature missing or invalid s","signature",t);const r=fM(e.s);r[0]>=128&&aM.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=dM(r);e._vs&&(cM(e._vs)||aM.throwArgumentError("signature invalid _vs","signature",t),e._vs=mM(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&aM.throwArgumentError("signature _vs mismatch v and s","signature",t)}var r;return e}window&&window.__awaiter;new sM("properties/5.4.0");function gM(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}const vM=new sM("signing-key/5.4.0");let yM=null;function wM(){return yM||(yM=new Xw("secp256k1")),yM}class MM{constructor(t){gM(this,"curve","secp256k1"),gM(this,"privateKey",dM(t));const e=wM().keyFromPrivate(fM(this.privateKey));gM(this,"publicKey","0x"+e.getPublic(!1,"hex")),gM(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),gM(this,"_isSigningKey",!0)}_addPoint(t){const e=wM().keyFromPublic(fM(this.publicKey)),r=wM().keyFromPublic(fM(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=wM().keyFromPrivate(fM(this.privateKey)),r=fM(t);32!==r.length&&vM.throwArgumentError("bad digest length","digest",t);const i=e.sign(r,{canonical:!0});return pM({recoveryParam:i.recoveryParam,r:mM("0x"+i.r.toString(16),32),s:mM("0x"+i.s.toString(16),32)})}computeSharedSecret(t){const e=wM().keyFromPrivate(fM(this.privateKey)),r=wM().keyFromPublic(fM(bM(t)));return mM("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function bM(t,e){const r=fM(t);if(32===r.length){const t=new MM(r);return e?"0x"+wM().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?dM(r):"0x"+wM().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+wM().keyFromPublic(r).getPublic(!0,"hex"):dM(r):vM.throwArgumentError("invalid public or private key","key","[REDACTED]")}let EM=!1,_M=!1;const NM={debug:1,default:2,info:2,warning:3,error:4,off:5};let AM=NM.default,SM=null;const RM=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var xM,IM;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(xM||(xM={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(IM||(IM={}));class kM{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==NM[r]&&this.throwArgumentError("invalid log level name","logLevel",t),AM>NM[r]||console.log.apply(console,e)}debug(...t){this._log(kM.levels.DEBUG,t)}info(...t){this._log(kM.levels.INFO,t)}warn(...t){this._log(kM.levels.WARNING,t)}makeError(t,e,r){if(_M)return this.makeError("censored error",e,{});e||(e=kM.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,kM.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){RM&&this.throwError("platform missing String.prototype.normalize",kM.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:RM})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,kM.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,kM.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,kM.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,kM.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",kM.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",kM.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",kM.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return SM||(SM=new kM("logger/5.4.0")),SM}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",kM.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),EM){if(!t)return;this.globalLogger().throwError("error censorship permanent",kM.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_M=!!t,EM=!!e}static setLogLevel(t){const e=NM[t.toLowerCase()];null!=e?AM=e:kM.globalLogger().warn("invalid log level - "+t)}static from(t){return new kM(t)}}kM.errors=IM,kM.levels=xM;const TM=new kM("bytes/5.4.0");function OM(t){return!!t.toHexString}function PM(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return PM(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function CM(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function UM(t,e){if(e||(e={}),"number"==typeof t){TM.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),PM(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),OM(t)&&(t=t.toHexString()),FM(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":TM.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return PM(new Uint8Array(i))}return CM(t)?PM(new Uint8Array(t)):TM.throwArgumentError("invalid arrayify value","value",t)}function FM(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function BM(t,e,r){return"string"!=typeof t?t=function(t,e){if(e||(e={}),"number"==typeof t){TM.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),OM(t))return t.toHexString();if(FM(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":TM.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(CM(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return TM.throwArgumentError("invalid hexlify value","value",t)}(t):(!FM(t)||t.length%2)&&TM.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}var DM=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,f=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!==(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);i=(m=m.idivn(d)).isZero()?p+i:u[c-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),l=this.clone();if(h){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],M=8191&w,b=w>>>13,E=0|s[4],_=8191&E,N=E>>>13,A=0|s[5],S=8191&A,R=A>>>13,x=0|s[6],I=8191&x,k=x>>>13,T=0|s[7],O=8191&T,P=T>>>13,C=0|s[8],U=8191&C,F=C>>>13,B=0|s[9],D=8191&B,L=B>>>13,$=0|a[0],j=8191&$,z=$>>>13,q=0|a[1],G=8191&q,V=q>>>13,Z=0|a[2],K=8191&Z,H=Z>>>13,W=0|a[3],J=8191&W,X=W>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(c,j)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,j),n=(n=Math.imul(v,z))+Math.imul(y,j)|0,o=Math.imul(y,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,V)|0;var yt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,z))+Math.imul(b,j)|0,o=Math.imul(b,z),i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,X)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(_,j),n=(n=Math.imul(_,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,X)|0;var Mt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(k,j)|0,o=Math.imul(k,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Et=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(u+(i=i+Math.imul(f,ht)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,z))+Math.imul(F,j)|0,o=Math.imul(F,z),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Nt=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,V)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(M,ot)|0,n=(n=n+Math.imul(M,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ht)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var At=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;u=((o=o+Math.imul(c,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,V))+Math.imul(L,G)|0,o=Math.imul(L,V),i=i+Math.imul(U,K)|0,n=(n=n+Math.imul(U,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var St=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,H))+Math.imul(L,K)|0,o=Math.imul(L,H),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,X)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,X))+Math.imul(L,J)|0,o=Math.imul(L,X),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var xt=(u+(i=i+Math.imul(M,mt)|0)|0)+((8191&(n=(n=n+Math.imul(M,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var It=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(U,ot)|0,n=(n=n+Math.imul(U,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ft)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(S,mt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(U,ht)|0,n=(n=n+Math.imul(U,ut)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(U,ft)|0,n=(n=n+Math.imul(U,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Ot=(u+(i=i+Math.imul(O,mt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ft),n=(n=Math.imul(D,ct))+Math.imul(L,ft)|0,o=Math.imul(L,ct);var Pt=(u+(i=i+Math.imul(U,mt)|0)|0)+((8191&(n=(n=n+Math.imul(U,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ct=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=Et,h[7]=_t,h[8]=Nt,h[9]=At,h[10]=St,h[11]=Rt,h[12]=xt,h[13]=It,h[14]=kt,h[15]=Tt,h[16]=Ot,h[17]=Pt,h[18]=Ct,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),c=67108863&f;a=67108863&(c=c+a|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},p.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},p.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var f=h,c=u,d=0;d<s;d++){var m=r[l+d],p=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=m+g,i[l+d]=p+v,r[l+d+s]=m-g,i[l+d+s]=p-v,d!==a&&(y=h*f-u*c,c=h*c+u*f,f=y)}},p.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},p.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},p.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,l,f,i,n);for(var d=0;d<i;d++){var m=a[d]*l[d]-h[d]*f[d];h[d]=a[d]*f[d]+h[d]*l[d],a[d]=m}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var f=h-1;f>=0;f--){var c=67108864*(0|i.words[o.length+f])+(0|i.words[o.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(f)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(M,v),i(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var v=this.pow(f,new n(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new _(t)},i(_,E),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,n)})).BN;new kM("bignumber/5.4.0");function LM(t){return"0x"+si.keccak_256(UM(t))}const $M=new kM("address/5.4.0");function jM(t){FM(t,20)||$M.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=UM(LM(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const zM={};for(let t=0;t<10;t++)zM[String(t)]=String(t);for(let t=0;t<26;t++)zM[String.fromCharCode(65+t)]=String(10+t);const qM=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function GM(t){let e=null;if("string"!=typeof t&&$M.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=jM(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&$M.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>zM[t]).join("");for(;e.length>=qM;){let t=e.substring(0,qM);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&$M.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new DM(r,36).toString(16);e.length<40;)e="0"+e;e=jM("0x"+e)}else $M.throwArgumentError("invalid address","address",t);var r;return e}new kM("transactions/5.4.0");var VM;function ZM(t,e){return function(t){return GM(BM(LM(BM(bM(t),1)),12))}(function(t,e){const r=pM(e),i={r:fM(r.r),s:fM(r.s)};return"0x"+wM().recoverPubKey(fM(t),i,r.recoveryParam).encode("hex",!1)}(UM(t),e))}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(VM||(VM={}));window&&window.__awaiter;new vy("wallet/5.4.0");function KM(t,i,n,o){return e(this,void 0,void 0,(function(){var e,s,a,h;return r(this,(function(r){switch(r.label){case 0:s="0x1626ba7e",a="function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4 magicValue)",r.label=1;case 1:return r.trys.push([1,3,,4]),[4,YM(o,[a],[t,"isValidSignature",[_(n),i]])];case 2:return e=r.sent(),[3,4];case 3:return h=r.sent(),console.log(h),[2,!1];case 4:return[2,e.toLowerCase()===s.toLowerCase()]}}))}))}function HM(t,i,n,o){return e(this,void 0,void 0,(function(){var e,s,a,h;return r(this,(function(r){switch(r.label){case 0:s="0x20c13b0b",a="function isValidSignature(bytes _hash, bytes memory _signature) public view returns (bytes4 magicValue)",r.label=1;case 1:return r.trys.push([1,3,,4]),[4,YM(o,[a],[t,"isValidSignature",[_(n),i]])];case 2:return e=r.sent(),[3,4];case 3:return h=r.sent(),console.log(h),[2,!1];case 4:return[2,e.toLowerCase()===s.toLowerCase()]}}))}))}function WM(t,i,n){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return e=ay("1"),[4,KM(t,i,n,e)];case 1:return r.sent()?[2,!0]:[4,HM(t,i,n,e)];case 2:return[2,r.sent()]}}))}))}function JM(t){var e=t.domain,r=t.types,i=t.message;return Hn.hash(e,r,i)}var XM=["cloudflare-ipfs.com","cf-ipfs.com","ipfs.io","ipfs.fleek.co","gateway.pinata.cloud","dweb.link","ipfs.infura.io"];function YM(t,n,o,s){return e(this,void 0,void 0,(function(){var e,a,h;return r(this,(function(r){switch(r.label){case 0:e=new ru(o[0],n,t),r.label=1;case 1:return r.trys.push([1,3,,4]),a=o[2]||[],[4,e[o[1]].apply(e,i(a,[s||{}]))];case 2:return[2,r.sent()];case 3:return h=r.sent(),[2,Promise.reject(h)];case 4:return[2]}}))}))}function QM(t,i,n,o,s){return e(this,void 0,void 0,(function(){var e,a,h,u,l;return r(this,(function(r){switch(r.label){case 0:e=["function aggregate(tuple(address target, bytes callData)[] calls) view returns (uint256 blockNumber, bytes[] returnData)"],a=new ru(oy[t].multicall,e,i),h=new eo(n),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,a.aggregate(o.map((function(t){return[t[0].toLowerCase(),h.encodeFunctionData(t[1],t[2])]})),s||{})];case 2:return u=r.sent(),[2,u[1].map((function(t,e){return h.decodeFunctionResult(o[e][1],t)}))];case 3:return l=r.sent(),[2,Promise.reject(l)];case 4:return[2]}}))}))}function tb(i,n,o){return void 0===o&&(o={}),e(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,h(i,{method:"POST",headers:t({Accept:"application/json","Content-Type":"application/json"},null==o?void 0:o.headers),body:JSON.stringify({query:hu.jsonToGraphQLQuery({query:n})})})];case 1:return[4,e.sent().json()];case 2:return[2,e.sent().data||{}]}}))}))}function eb(t,n,o,s,a,h){return void 0===h&&(h={}),e(this,void 0,void 0,(function(){var e,u,l;return r(this,(function(r){switch(r.label){case 0:return e=t.getSigner(),u=new ru(n,o,t),[4,(l=u.connect(e))[s].apply(l,i(a,[h]))];case 1:return[2,r.sent()]}}))}))}function rb(t,i,n,o,s,a){return void 0===a&&(a="latest"),e(this,void 0,void 0,(function(){var e,o;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),e={space:t,network:n,snapshot:a,strategies:i,addresses:s},[4,h("https://score.snapshot.org/api/scores",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({params:e})})];case 1:return[4,r.sent().json()];case 2:return[2,r.sent().result.scores];case 3:return o=r.sent(),[2,Promise.reject(o)];case 4:return[2]}}))}))}var ib={call:YM,multicall:QM,subgraphRequest:tb,ipfsGet:function(t,i,n){return void 0===n&&(n="ipfs"),e(this,void 0,void 0,(function(){return r(this,(function(e){return[2,h("https://"+t+"/"+n+"/"+i).then((function(t){return t.json()}))]}))}))},getUrl:function(t,e){void 0===e&&(e=XM[0]);var r="https://"+e;if(!t)return null;if(!t.includes("ipfs")&&!t.includes("ipns")&&!t.includes("http"))return r+"/ipfs/"+t;var i=t.split("://")[0];return"ipfs"===i?t.replace("ipfs://",r+"/ipfs/"):"ipns"===i?t.replace("ipns://",r+"/ipns/"):t},sendTransaction:eb,getScores:rb,validateSchema:function(t,e){var r=new lf({allErrors:!0,allowUnionTypes:!0,$data:!0});df(r);var i=r.compile(t),n=i(e);return n||i.errors},getProvider:ay,signMessage:R,getBlockNumber:function(t){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.getBlockNumber()];case 1:return e=r.sent(),[2,parseInt(e)];case 2:return r.sent(),[2,Promise.reject()];case 3:return[2]}}))}))},Multicaller:oc,validations:hy,getHash:JM,verify:function(t,i,n){return e(this,void 0,void 0,(function(){var e,o,s,a,h;return r(this,(function(r){switch(r.label){case 0:return e=n.domain,o=n.types,s=n.message,a=function(t,e,r,i){return ZM(mw.hash(t,e,r),i)}(e,o,s,i),h=JM(n),console.log("Hash",h),console.log("Address",t),console.log("Recover address",a),t===a?[2,!0]:(console.log("Check EIP1271 signature"),[4,WM(t,i,h)]);case 1:return[2,r.sent()]}}))}))}},nb=""+"0x".padEnd(42,"0"),ob={1:"https://api.thegraph.com/subgraphs/name/aragon/aragon-govern-mainnet",4:"https://api.thegraph.com/subgraphs/name/aragon/aragon-govern-rinkeby"},sb=[{inputs:[{components:[{components:[{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"executionTime",type:"uint256"},{internalType:"address",name:"submitter",type:"address"},{internalType:"contract IERC3000Executor",name:"executor",type:"address"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct ERC3000Data.Action[]",name:"actions",type:"tuple[]"},{internalType:"bytes32",name:"allowFailuresMap",type:"bytes32"},{internalType:"bytes",name:"proof",type:"bytes"}],internalType:"struct ERC3000Data.Payload",name:"payload",type:"tuple"},{components:[{internalType:"uint256",name:"executionDelay",type:"uint256"},{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ERC3000Data.Collateral",name:"scheduleDeposit",type:"tuple"},{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ERC3000Data.Collateral",name:"challengeDeposit",type:"tuple"},{internalType:"address",name:"resolver",type:"address"},{internalType:"bytes",name:"rules",type:"bytes"},{internalType:"uint256",name:"maxCalldataSize",type:"uint256"}],internalType:"struct ERC3000Data.Config",name:"config",type:"tuple"}],internalType:"struct ERC3000Data.Container",name:"_container",type:"tuple"}],name:"schedule",outputs:[{internalType:"bytes32",name:"containerHash",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"nonce",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],ab=[{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],hb={registryEntry:{__args:{id:void 0},executor:{address:!0},queue:{address:!0,config:{executionDelay:!0,scheduleDeposit:{token:!0,amount:!0},challengeDeposit:{token:!0,amount:!0},resolver:!0,rules:!0,maxCalldataSize:!0}}}};function ub(t,i,n,o,s,a){return e(this,void 0,void 0,(function(){var e,h,u,l,f,c,d,m;return r(this,(function(r){switch(r.label){case 0:return(e=hb).registryEntry.__args.id=n,[4,tb(ob[t],e)];case 1:return h=r.sent(),u=h.registryEntry.queue.config,[4,YM(i,sb,[h.registryEntry.queue.address,"nonce"])];case 2:return l=r.sent(),f=Wt.from(l),c=f.add(Wt.from(1)),d=Math.round(Date.now()/1e3)+Number(u.executionDelay)+60,[4,YM(i,ab,[u.scheduleDeposit.token,"allowance",[o,h.registryEntry.queue.address]])];case 3:return(m=r.sent()).lt(u.scheduleDeposit.amount)&&u.scheduleDeposit.token!==nb?m.isZero()?[3,6]:[4,eb(i,u.scheduleDeposit.token,ab,"approve",[h.registryEntry.queue.address,"0"])]:[3,8];case 4:return[4,r.sent().wait(1)];case 5:r.sent(),r.label=6;case 6:return[4,eb(i,u.scheduleDeposit.token,ab,"approve",[h.registryEntry.queue.address,u.scheduleDeposit.amount])];case 7:r.sent(),r.label=8;case 8:return[4,eb(i,h.registryEntry.queue.address,sb,"schedule",[{payload:{nonce:c.toString(),executionTime:d,submitter:o,executor:h.registryEntry.executor.address,actions:a,allowFailuresMap:"0x0000000000000000000000000000000000000000000000000000000000000000",proof:s?Ae(s):"0x00"},config:{executionDelay:u.executionDelay,scheduleDeposit:{token:u.scheduleDeposit.token,amount:u.scheduleDeposit.amount},challengeDeposit:{token:u.challengeDeposit.token,amount:u.challengeDeposit.amount},resolver:u.resolver,rules:u.rules,maxCalldataSize:u.maxCalldataSize}}],{gasLimit:5e5})];case 9:return[2,r.sent()]}}))}))}var lb=function(){function t(){this.author="Evalir",this.version="0.1.3",this.name="Aragon Govern",this.website="https://aragon.org/blog/snapshot"}return t.prototype.action=function(t,i,n,o,s,a){return e(this,void 0,void 0,(function(){var e,h;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,i.listAccounts()];case 1:return e=r.sent()[0],[4,ub(t,i,n.id,e,s,o["choice"+a].actions)];case 2:return[2,r.sent()];case 3:return h=r.sent(),console.error(h),[3,4];case 4:return[2]}}))}))},t}(),fb={1:"https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2",4:"https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2-rinkeby",100:"https://api.thegraph.com/subgraphs/name/1hive/uniswap-v2"},cb={1:"https://api.thegraph.com/subgraphs/name/protofire/omen",4:"https://api.thegraph.com/subgraphs/name/protofire/omen-rinkeby",100:"https://api.thegraph.com/subgraphs/name/protofire/omen-xdai"},db={1:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",4:"0xc778417e063141139fce010982780140aa0cd5ab",100:"0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1"},mb={condition:{__args:{id:void 0},id:!0,fixedProductMarketMakers:{id:!0,collateralToken:!0,outcomeTokenAmounts:!0,outcomeTokenMarginalPrices:!0}}},pb={pairsTokens:{__aliasFor:"pairs",__args:{where:{token0:!0,token1:!0}},token0Price:!0},pairsTokensInverted:{__aliasFor:"pairs",__args:{where:{token0:!0,token1:!0}},token1Price:!0},pairsTokens0:{__aliasFor:"pairs",__args:{where:{token0:!0,token1:!0}},token0Price:!0},pairsTokens1:{__aliasFor:"pairs",__args:{where:{token0:!0,token1:!0}},token0Price:!0}},gb=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_upgradedAddress",type:"address"}],name:"deprecate",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"deprecated",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_evilUser",type:"address"}],name:"addBlackList",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"upgradedAddress",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"balances",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"maximumFee",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"_totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[],name:"unpause",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_maker",type:"address"}],name:"getBlackListStatus",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"},{name:"",type:"address"}],name:"allowed",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"paused",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"who",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[],name:"pause",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"getOwner",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"owner",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"newBasisPoints",type:"uint256"},{name:"newMaxFee",type:"uint256"}],name:"setParams",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"amount",type:"uint256"}],name:"issue",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"amount",type:"uint256"}],name:"redeem",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"remaining",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"basisPointsRate",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"isBlackListed",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_clearedUser",type:"address"}],name:"removeBlackList",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"MAX_UINT",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"_blackListedUser",type:"address"}],name:"destroyBlackFunds",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{inputs:[{name:"_initialSupply",type:"uint256"},{name:"_name",type:"string"},{name:"_symbol",type:"string"},{name:"_decimals",type:"uint256"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,name:"amount",type:"uint256"}],name:"Issue",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"amount",type:"uint256"}],name:"Redeem",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"newAddress",type:"address"}],name:"Deprecate",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"feeBasisPoints",type:"uint256"},{indexed:!1,name:"maxFee",type:"uint256"}],name:"Params",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"_blackListedUser",type:"address"},{indexed:!1,name:"_balance",type:"uint256"}],name:"DestroyedBlackFunds",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"_user",type:"address"}],name:"AddedBlackList",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"_user",type:"address"}],name:"RemovedBlackList",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[],name:"Pause",type:"event"},{anonymous:!1,inputs:[],name:"Unpause",type:"event"}],vb=function(t,i){return e(void 0,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,QM(t._network.chainId.toString(),t,gb,[[i,"name"],[i,"symbol"]])];case 1:return[2,e.sent()]}}))}))},yb=function(){function t(){this.author="davidalbela",this.version="0.0.1",this.name="Gnosis Impact",this.website="https://gnosis.io"}return t.prototype.getTokenInfo=function(t,i){return e(this,void 0,void 0,(function(){var e,n;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,vb(t,i)];case 1:return e=r.sent(),[2,{address:i,checksumAddress:Ch(i),name:e[0][0],symbol:e[1][0]}];case 2:throw n=r.sent(),new Error(n);case 3:return[2]}}))}))},t.prototype.getOmenCondition=function(t,i){return e(this,void 0,void 0,(function(){var e,n;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(e=mb).condition.__args.id=i,[4,tb(cb[t],e)];case 1:return[2,r.sent()];case 2:return n=r.sent(),console.error(n),[3,3];case 3:return[2]}}))}))},t.prototype.getUniswapPair=function(t,i,n){return e(this,void 0,void 0,(function(){var e,o,s;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(e=pb).pairsTokens.__args.where={token0:i.toLowerCase(),token1:n.toLowerCase()},e.pairsTokensInverted.__args.where={token0:n.toLowerCase(),token1:i.toLowerCase()},e.pairsTokens0.__args.where={token0:i.toLowerCase(),token1:db[t]},e.pairsTokens1.__args.where={token0:n.toLowerCase(),token1:db[t]},[4,tb(fb[t],e)];case 1:if((o=r.sent()).pairsTokens.length>0)return[2,o.pairsTokens[0]];if(o.pairsTokensInverted.length>0)return[2,{token0Price:o.pairsTokensInverted[0].token1Price}];if(o.pairsTokens0.length>0&&o.pairsTokens1.length>0)return[2,{token0Price:(parseFloat(o.pairsTokens0[0].token0Price)/parseFloat(o.pairsTokens1[0].token0Price)).toString()}];throw new Error("Does not exist market pairs for "+i+" and "+n+".");case 2:return s=r.sent(),console.error(s),[3,3];case 3:return[2]}}))}))},t}(),wb=Object.defineProperty({version:"bignumber/5.0.12"},"__esModule",{value:!0}),Mb=s(Gt),bb=s(y),Eb=(n&&n.__importDefault||function(t){return t&&t.__esModule?t:{default:t}})(kt).default.BN,_b=new bb.Logger(wb.version),Nb={};var Ab=function(t){return null!=t&&(Rb.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||Mb.isHexString(t)||"bigint"==typeof t||Mb.isBytes(t))},Sb=!1,Rb=function(){function t(e,r){var i=this.constructor;_b.checkNew(i,t),e!==Nb&&_b.throwError("cannot call constructor directly; use BigNumber.from",bb.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}return t.prototype.fromTwos=function(t){return kb(Tb(this).fromTwos(t))},t.prototype.toTwos=function(t){return kb(Tb(this).toTwos(t))},t.prototype.abs=function(){return"-"===this._hex[0]?t.from(this._hex.substring(1)):this},t.prototype.add=function(t){return kb(Tb(this).add(Tb(t)))},t.prototype.sub=function(t){return kb(Tb(this).sub(Tb(t)))},t.prototype.div=function(e){return t.from(e).isZero()&&Ob("division by zero","div"),kb(Tb(this).div(Tb(e)))},t.prototype.mul=function(t){return kb(Tb(this).mul(Tb(t)))},t.prototype.mod=function(t){var e=Tb(t);return e.isNeg()&&Ob("cannot modulo negative values","mod"),kb(Tb(this).umod(e))},t.prototype.pow=function(t){var e=Tb(t);return e.isNeg()&&Ob("cannot raise to negative values","pow"),kb(Tb(this).pow(e))},t.prototype.and=function(t){var e=Tb(t);return(this.isNegative()||e.isNeg())&&Ob("cannot 'and' negative values","and"),kb(Tb(this).and(e))},t.prototype.or=function(t){var e=Tb(t);return(this.isNegative()||e.isNeg())&&Ob("cannot 'or' negative values","or"),kb(Tb(this).or(e))},t.prototype.xor=function(t){var e=Tb(t);return(this.isNegative()||e.isNeg())&&Ob("cannot 'xor' negative values","xor"),kb(Tb(this).xor(e))},t.prototype.mask=function(t){return(this.isNegative()||t<0)&&Ob("cannot mask negative values","mask"),kb(Tb(this).maskn(t))},t.prototype.shl=function(t){return(this.isNegative()||t<0)&&Ob("cannot shift negative values","shl"),kb(Tb(this).shln(t))},t.prototype.shr=function(t){return(this.isNegative()||t<0)&&Ob("cannot shift negative values","shr"),kb(Tb(this).shrn(t))},t.prototype.eq=function(t){return Tb(this).eq(Tb(t))},t.prototype.lt=function(t){return Tb(this).lt(Tb(t))},t.prototype.lte=function(t){return Tb(this).lte(Tb(t))},t.prototype.gt=function(t){return Tb(this).gt(Tb(t))},t.prototype.gte=function(t){return Tb(this).gte(Tb(t))},t.prototype.isNegative=function(){return"-"===this._hex[0]},t.prototype.isZero=function(){return Tb(this).isZero()},t.prototype.toNumber=function(){try{return Tb(this).toNumber()}catch(t){Ob("overflow","toNumber",this.toString())}return null},t.prototype.toString=function(){return arguments.length>0&&(10===arguments[0]?Sb||(Sb=!0,_b.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?_b.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",bb.Logger.errors.UNEXPECTED_ARGUMENT,{}):_b.throwError("BigNumber.toString does not accept parameters",bb.Logger.errors.UNEXPECTED_ARGUMENT,{})),Tb(this).toString(10)},t.prototype.toHexString=function(){return this._hex},t.prototype.toJSON=function(t){return{type:"BigNumber",hex:this.toHexString()}},t.from=function(e){if(e instanceof t)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new t(Nb,Ib(e)):e.match(/^-?[0-9]+$/)?new t(Nb,Ib(new Eb(e))):_b.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Ob("underflow","BigNumber.from",e),(e>=9007199254740991||e<=-9007199254740991)&&Ob("overflow","BigNumber.from",e),t.from(String(e));var r,i=e;if("bigint"==typeof i)return t.from(i.toString());if(Mb.isBytes(i))return t.from(Mb.hexlify(i));if(i)if(i.toHexString){if("string"==typeof(r=i.toHexString()))return t.from(r)}else if(null==(r=i._hex)&&"BigNumber"===i.type&&(r=i.hex),"string"==typeof r&&(Mb.isHexString(r)||"-"===r[0]&&Mb.isHexString(r.substring(1))))return t.from(r);return _b.throwArgumentError("invalid BigNumber value","value",e)},t.isBigNumber=function(t){return!(!t||!t._isBigNumber)},t}(),xb=Rb;function Ib(t){if("string"!=typeof t)return Ib(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&_b.throwArgumentError("invalid hex","value",t),"0x00"===(t=Ib(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function kb(t){return Rb.from(Ib(t))}function Tb(t){var e=Rb.from(t).toHexString();return"-"===e[0]?new Eb("-"+e.substring(3),16):new Eb(e.substring(2),16)}function Ob(t,e,r){var i={fault:t,operation:e};return null!=r&&(i.value=r),_b.throwError(t,bb.Logger.errors.NUMERIC_FAULT,i)}Wt.from(-1),Wt.from(0),Wt.from(1),Wt.from(2),Wt.from("1000000000000000000"),Wt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Pb=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,f=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!==(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);i=(m=m.idivn(d)).isZero()?p+i:u[c-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),l=this.clone();if(h){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],M=8191&w,b=w>>>13,E=0|s[4],_=8191&E,N=E>>>13,A=0|s[5],S=8191&A,R=A>>>13,x=0|s[6],I=8191&x,k=x>>>13,T=0|s[7],O=8191&T,P=T>>>13,C=0|s[8],U=8191&C,F=C>>>13,B=0|s[9],D=8191&B,L=B>>>13,$=0|a[0],j=8191&$,z=$>>>13,q=0|a[1],G=8191&q,V=q>>>13,Z=0|a[2],K=8191&Z,H=Z>>>13,W=0|a[3],J=8191&W,X=W>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(c,j)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,j),n=(n=Math.imul(v,z))+Math.imul(y,j)|0,o=Math.imul(y,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,V)|0;var yt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,z))+Math.imul(b,j)|0,o=Math.imul(b,z),i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,X)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(_,j),n=(n=Math.imul(_,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,X)|0;var Mt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(k,j)|0,o=Math.imul(k,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Et=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(u+(i=i+Math.imul(f,ht)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,z))+Math.imul(F,j)|0,o=Math.imul(F,z),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Nt=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,V)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(M,ot)|0,n=(n=n+Math.imul(M,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ht)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var At=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;u=((o=o+Math.imul(c,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,V))+Math.imul(L,G)|0,o=Math.imul(L,V),i=i+Math.imul(U,K)|0,n=(n=n+Math.imul(U,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var St=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,H))+Math.imul(L,K)|0,o=Math.imul(L,H),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,X)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,X))+Math.imul(L,J)|0,o=Math.imul(L,X),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var xt=(u+(i=i+Math.imul(M,mt)|0)|0)+((8191&(n=(n=n+Math.imul(M,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var It=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(U,ot)|0,n=(n=n+Math.imul(U,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ft)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(S,mt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(U,ht)|0,n=(n=n+Math.imul(U,ut)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(U,ft)|0,n=(n=n+Math.imul(U,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Ot=(u+(i=i+Math.imul(O,mt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ft),n=(n=Math.imul(D,ct))+Math.imul(L,ft)|0,o=Math.imul(L,ct);var Pt=(u+(i=i+Math.imul(U,mt)|0)|0)+((8191&(n=(n=n+Math.imul(U,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ct=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=Et,h[7]=_t,h[8]=Nt,h[9]=At,h[10]=St,h[11]=Rt,h[12]=xt,h[13]=It,h[14]=kt,h[15]=Tt,h[16]=Ot,h[17]=Pt,h[18]=Ct,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),c=67108863&f;a=67108863&(c=c+a|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},p.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},p.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var f=h,c=u,d=0;d<s;d++){var m=r[l+d],p=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=m+g,i[l+d]=p+v,r[l+d+s]=m-g,i[l+d+s]=p-v,d!==a&&(y=h*f-u*c,c=h*c+u*f,f=y)}},p.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},p.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},p.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,l,f,i,n);for(var d=0;d<i;d++){var m=a[d]*l[d]-h[d]*f[d];h[d]=a[d]*f[d]+h[d]*l[d],a[d]=m}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var f=h-1;f>=0;f--){var c=67108864*(0|i.words[o.length+f])+(0|i.words[o.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(f)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(M,v),i(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var v=this.pow(f,new n(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new _(t)},i(_,E),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,n)}));let Cb=!1,Ub=!1;const Fb={debug:1,default:2,info:2,warning:3,error:4,off:5};let Bb=Fb.default,Db=null;const Lb=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var $b,jb;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}($b||($b={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT"}(jb||(jb={}));class zb{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Fb[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Bb>Fb[r]||console.log.apply(console,e)}debug(...t){this._log(zb.levels.DEBUG,t)}info(...t){this._log(zb.levels.INFO,t)}warn(...t){this._log(zb.levels.WARNING,t)}makeError(t,e,r){if(Ub)return this.makeError("censored error",e,{});e||(e=zb.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,zb.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){Lb&&this.throwError("platform missing String.prototype.normalize",zb.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Lb})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,zb.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,zb.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,zb.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,zb.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",zb.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",zb.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",zb.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Db||(Db=new zb("logger/5.0.10")),Db}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",zb.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Cb){if(!t)return;this.globalLogger().throwError("error censorship permanent",zb.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ub=!!t,Cb=!!e}static setLogLevel(t){const e=Fb[t.toLowerCase()];null!=e?Bb=e:zb.globalLogger().warn("invalid log level - "+t)}static from(t){return new zb(t)}}zb.errors=jb,zb.levels=$b;const qb=new zb("bytes/5.0.11");function Gb(t){return!!t.toHexString}function Vb(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Vb(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Zb(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function Kb(t,e){if(e||(e={}),"number"==typeof t){qb.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Vb(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Gb(t)&&(t=t.toHexString()),Jb(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":qb.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return Vb(new Uint8Array(i))}return Zb(t)?Vb(new Uint8Array(t)):qb.throwArgumentError("invalid arrayify value","value",t)}function Hb(t){const e=t.map(t=>Kb(t)),r=e.reduce((t,e)=>t+e.length,0),i=new Uint8Array(r);return e.reduce((t,e)=>(i.set(e,t),t+e.length),0),Vb(i)}function Wb(t,e){(t=Kb(t)).length>e&&qb.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Vb(r)}function Jb(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function Xb(t,e){if(e||(e={}),"number"==typeof t){qb.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Gb(t))return t.toHexString();if(Jb(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":qb.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Zb(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return qb.throwArgumentError("invalid hexlify value","value",t)}var Yb=Pb.BN;const Qb=new zb("bignumber/5.0.15"),tE={};let eE=!1;class rE{constructor(t,e){Qb.checkNew(new.target,rE),t!==tE&&Qb.throwError("cannot call constructor directly; use BigNumber.from",zb.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return nE(oE(this).fromTwos(t))}toTwos(t){return nE(oE(this).toTwos(t))}abs(){return"-"===this._hex[0]?rE.from(this._hex.substring(1)):this}add(t){return nE(oE(this).add(oE(t)))}sub(t){return nE(oE(this).sub(oE(t)))}div(t){return rE.from(t).isZero()&&sE("division by zero","div"),nE(oE(this).div(oE(t)))}mul(t){return nE(oE(this).mul(oE(t)))}mod(t){const e=oE(t);return e.isNeg()&&sE("cannot modulo negative values","mod"),nE(oE(this).umod(e))}pow(t){const e=oE(t);return e.isNeg()&&sE("cannot raise to negative values","pow"),nE(oE(this).pow(e))}and(t){const e=oE(t);return(this.isNegative()||e.isNeg())&&sE("cannot 'and' negative values","and"),nE(oE(this).and(e))}or(t){const e=oE(t);return(this.isNegative()||e.isNeg())&&sE("cannot 'or' negative values","or"),nE(oE(this).or(e))}xor(t){const e=oE(t);return(this.isNegative()||e.isNeg())&&sE("cannot 'xor' negative values","xor"),nE(oE(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&sE("cannot mask negative values","mask"),nE(oE(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&sE("cannot shift negative values","shl"),nE(oE(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&sE("cannot shift negative values","shr"),nE(oE(this).shrn(t))}eq(t){return oE(this).eq(oE(t))}lt(t){return oE(this).lt(oE(t))}lte(t){return oE(this).lte(oE(t))}gt(t){return oE(this).gt(oE(t))}gte(t){return oE(this).gte(oE(t))}isNegative(){return"-"===this._hex[0]}isZero(){return oE(this).isZero()}toNumber(){try{return oE(this).toNumber()}catch(t){sE("overflow","toNumber",this.toString())}return null}toString(){return arguments.length>0&&(10===arguments[0]?eE||(eE=!0,Qb.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Qb.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",zb.errors.UNEXPECTED_ARGUMENT,{}):Qb.throwError("BigNumber.toString does not accept parameters",zb.errors.UNEXPECTED_ARGUMENT,{})),oE(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof rE)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new rE(tE,iE(t)):t.match(/^-?[0-9]+$/)?new rE(tE,iE(new Yb(t))):Qb.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&sE("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&sE("overflow","BigNumber.from",t),rE.from(String(t));const e=t;if("bigint"==typeof e)return rE.from(e.toString());if(Zb(e))return rE.from(Xb(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return rE.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Jb(t)||"-"===t[0]&&Jb(t.substring(1))))return rE.from(t)}return Qb.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function iE(t){if("string"!=typeof t)return iE(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Qb.throwArgumentError("invalid hex","value",t),"0x00"===(t=iE(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function nE(t){return rE.from(iE(t))}function oE(t){const e=rE.from(t).toHexString();return"-"===e[0]?new Yb("-"+e.substring(3),16):new Yb(e.substring(2),16)}function sE(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Qb.throwError(t,zb.errors.NUMERIC_FAULT,i)}const aE=new zb("strings/5.0.10");var hE,uE;function lE(t,e,r,i,n){if(t===uE.BAD_PREFIX||t===uE.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===uE.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(hE||(hE={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(uE||(uE={}));Object.freeze({error:function(t,e,r,i,n){return aE.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:lE,replace:function(t,e,r,i,n){return t===uE.OVERLONG?(i.push(n),0):(i.push(65533),lE(t,e,r))}});const fE=new RegExp("^bytes([0-9]+)$"),cE=new RegExp("^(u?int)([0-9]*)$"),dE=new RegExp("^(.*)\\[([0-9]*)\\]$");function mE(t,e,r){switch(t){case"address":return r?Wb(e,32):Kb(e);case"string":return function(t,e=hE.current){e!=hE.current&&(aE.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&i)<<10)+(1023&n);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(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return Kb(r)}(e);case"bytes":return Kb(e);case"bool":return e=e?"0x01":"0x00",r?Wb(e,32):Kb(e)}let i=t.match(cE);if(i){let n=parseInt(i[2]||"256");if(i[2]&&String(n)!==i[2]||n%8!=0||0===n||n>256)throw new Error("invalid number type - "+t);return r&&(n=256),Wb(e=rE.from(e).toTwos(n),n/8)}if(i=t.match(fE),i){const n=parseInt(i[1]);if(String(n)!==i[1]||0===n||n>32)throw new Error("invalid bytes type - "+t);if(Kb(e).byteLength!==n)throw new Error("invalid value for "+t);return r?Kb((e+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):e}if(i=t.match(dE),i&&Array.isArray(e)){const r=i[1];if(parseInt(i[2]||String(e.length))!=e.length)throw new Error("invalid value for "+t);const n=[];return e.forEach((function(t){n.push(mE(r,t,!0))})),Hb(n)}throw new Error("invalid type - "+t)}function pE(t,e){return r=function(t,e){if(t.length!=e.length)throw new Error("type/value count mismatch");const r=[];return t.forEach((function(t,i){r.push(mE(t,e[i]))})),Xb(Hb(r))}(t,e),"0x"+si.keccak_256(Kb(r));var r}var gE={Transaction:[{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"},{name:"operation",type:"uint8"},{name:"nonce",type:"uint256"}]},vE=["event ProposalQuestionCreated(bytes32 indexed questionId, string indexed proposalId)","function executor() view returns (address)","function oracle() view returns (address)","function questionCooldown() view returns (uint32)","function buildQuestion(string proposalId, bytes32[] txHashes) view returns (string)","function executedProposalTransactions(bytes32 questionHash, bytes32 txHash) view returns (bool)","function questionIds(bytes32 questionHash) view returns (bytes32)","function minimumBond() view returns (uint256)","function addProposal(string proposalId, bytes32[] txHashes)","function executeProposalWithIndex(string proposalId, bytes32[] txHashes, address to, uint256 value, bytes data, uint8 operation, uint256 txIndex)"],yE=["event LogNewAnswer(\n bytes32 answer,\n bytes32 indexed question_id,\n bytes32 history_hash,\n address indexed user,\n uint256 bond,\n uint256 ts,\n bool is_commitment\n )","function resultFor(bytes32 question_id) view returns (bytes32)","function getFinalizeTS(bytes32 question_id) view returns (uint32)","function getBond(bytes32 question_id) view returns (uint256)","function getBestAnswer(bytes32 question_id) view returns (uint32)","function balanceOf(address) view returns (uint256)","function getHistoryHash(bytes32 question_id) view returns (bytes32)","function isFinalized(bytes32 question_id) view returns (bool)","function token() view returns (address)","function submitAnswer(bytes32 question_id, bytes32 answer, uint256 max_previous) external payable","function submitAnswerERC20(bytes32 question_id, bytes32 answer, uint256 max_previous, uint256 tokens) external","function claimMultipleAndWithdrawBalance(\n bytes32[] question_ids,\n uint256[] lengths,\n bytes32[] hist_hashes,\n address[] addrs,\n uint256[] bonds,\n bytes32[] answers\n ) public","function withdraw() public"],wE=["function balanceOf(address account) view returns (uint256)","function decimals() view returns (uint32)","function symbol() view returns (string)","function allowance(address owner, address spender) external view returns (uint256)","function approve(address spender, uint256 value) external returns (bool)"],ME={1:6531147,4:3175028},bE=function(t,i){return e(void 0,void 0,void 0,(function(){var e;return r(this,(function(r){return e=pE(["bytes32[]"],[i]).slice(2),[2,t+"␟"+e]}))}))},EE=function(t,i,n,o,s){return e(void 0,void 0,void 0,(function(){var e,a,h;return r(this,(function(r){switch(r.label){case 0:return[4,QM(i,t,vE,[[n,"questionIds",[o]]].concat(s.map((function(t){return[n,"executedProposalTransactions",[o,t]]}))))];case 1:return e=r.sent().map((function(t){return t[0]})),a=e[0],h=e.indexOf(!1,1)-1,[2,{questionId:"0x0000000000000000000000000000000000000000000000000000000000000000"!==a?a:void 0,nextTxIndex:h<0||h>=s.length?void 0:h}]}}))}))},_E=function(t,i,n){return e(void 0,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return[4,QM(i,t,vE,[[n,"executor"],[n,"oracle"],[n,"questionCooldown"],[n,"minimumBond"]])];case 1:return[2,{dao:(e=r.sent())[0][0],oracle:e[1][0],cooldown:e[2][0],minimumBond:e[3][0]}]}}))}))},NE=function(t,i,n,o){return e(void 0,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:if(!o)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,QM(i,t,yE,[[n,"resultFor",[o]],[n,"getFinalizeTS",[o]]])];case 2:return e=r.sent(),[2,{executionApproved:xb.from(e[0][0]).eq(xb.from(1)),finalizedAt:xb.from(e[1][0]).toNumber()}];case 3:return r.sent(),[3,4];case 4:return[2,{executionApproved:!1,finalizedAt:void 0}]}}))}))},AE=function(t,i,n,o){return e(void 0,void 0,void 0,(function(){var e,s,a;return r(this,(function(r){switch(r.label){case 0:return o?[4,QM(i,t,yE,[[n,"getFinalizeTS",[o]],[n,"getBond",[o]],[n,"getBestAnswer",[o]]])]:[3,2];case 1:return e=r.sent(),s=xb.from(e[1][0]),a=xb.from(e[2][0]),[2,{currentBond:s,isApproved:a.eq(xb.from(1)),endTime:xb.from(e[0][0]).toNumber()}];case 2:return[2,{currentBond:void 0,isApproved:!1,endTime:void 0}]}}))}))},SE=function(){function n(){this.author="Gnosis",this.version="1.0.0",this.name="SafeSnap",this.website="https://safe.gnosis.io"}return n.prototype.validateTransaction=function(t){var e=""===t.to||function(t){try{return Ch(t),!0}catch(t){}return!1}(t.to);return Ab(t.value)&&e&&(!t.data||N(t.data))&&t.operation in["0","1"]&&Ab(t.nonce)},n.prototype.calcTransactionHash=function(t,i,n){return e(this,void 0,void 0,(function(){var e,o;return r(this,(function(r){return e=parseInt(t),o={chainId:e,verifyingContract:i},[2,Hn.hash(o,gE,n)]}))}))},n.prototype.calcTransactionHashes=function(i,n,o){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){return e={chainId:i,verifyingContract:n},[2,o.map((function(r){return Hn.hash(e,gE,t({nonce:"0",data:"0x"},r))}))]}))}))},n.prototype.getExecutionDetails=function(i,n,o,s){return e(this,void 0,void 0,(function(){var e,a,h,u,l,f,c,d,m;return r(this,(function(r){switch(r.label){case 0:return e=ay(i),a=parseInt(i),[4,this.calcTransactionHashes(a,n,s)];case 1:return h=r.sent(),[4,bE(o,h)];case 2:return u=r.sent(),l=pE(["string"],[u]),[4,EE(e,i,n,l,h)];case 3:return f=r.sent(),[4,_E(e,i,n)];case 4:return c=r.sent(),[4,NE(e,i,c.oracle,f.questionId)];case 5:return d=r.sent(),[4,AE(e,i,c.oracle,f.questionId)];case 6:m=r.sent();try{return[2,t(t(t(t(t(t({},c),{proposalId:o}),d),f),{transactions:s,txHashes:h}),m)]}catch(t){throw new Error(t)}return[2]}}))}))},n.prototype.getModuleDetails=function(t,i){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){return e=ay(t),[2,_E(e,t,i)]}))}))},n.prototype.submitProposal=function(t,i,n,o){return e(this,void 0,void 0,(function(){var e,s;return r(this,(function(r){switch(r.label){case 0:return[4,this.calcTransactionHashes(t.network.chainId,i,o)];case 1:return e=r.sent(),[4,eb(t,i,vE,"addProposal",[n,e])];case 2:return[4,r.sent().wait()];case 3:return s=r.sent(),console.log("[DAO module] submitted proposal:",s),[2]}}))}))},n.prototype.loadClaimBondData=function(t,i,n,o){return e(this,void 0,void 0,(function(){var e,s,a,h,u,l,f,c,d,m,p,g,v,y,w,M,b,E,_,N,A,S,R,x;return r(this,(function(r){switch(r.label){case 0:return e=new ru(o,yE,t),s=ay(i),[4,QM(i,s,yE,[[o,"balanceOf",[t.provider.selectedAddress]],[o,"getBestAnswer",[n]],[o,"getHistoryHash",[n]],[o,"isFinalized",[n]]])];case 1:a=r.sent(),h=a[0][0],u=a[1][0],l=a[2][0],f=a[3][0],c="ETH",d=18,r.label=2;case 2:return r.trys.push([2,5,,6]),[4,YM(s,yE,[o,"token",[]])];case 3:return m=r.sent(),[4,QM(i,s,wE,[[m,"symbol",[]],[m,"decimals",[]]])];case 4:return p=r.sent(),g=p[0][0],v=p[1][0],c=g,d=v,[3,6];case 5:return r.sent(),[3,6];case 6:return y=e.filters.LogNewAnswer(null,n),[4,e.queryFilter(y,ME[i])];case 7:return w=r.sent(),M=[],b=[],E=[],_=[],w.reverse().forEach((function(t){var e=t.args;M.push(null==e?void 0:e.user.toLowerCase()),b.push(null==e?void 0:e.history_hash),E.push(null==e?void 0:e.bond),_.push(null==e?void 0:e.answer)})),N=xb.from(l).eq(0),A=t.provider.selectedAddress.toLowerCase(),S=M.map((function(t,e){if(t===A)return _[e]})),R=S.some((function(t){if(t)return xb.from(t).eq(u)}))&&f,x=!h.eq(0)&&f,b.shift(),"0x0000000000000000000000000000000000000000000000000000000000000000",b.push("0x0000000000000000000000000000000000000000000000000000000000000000"),[2,{tokenSymbol:c,tokenDecimals:d,canClaim:!N&&R||x,data:{length:[E.length.toString()],historyHashes:b,users:M,bonds:E,answers:_}}]}}))}))},n.prototype.claimBond=function(t,n,o,s){return e(this,void 0,void 0,(function(){var e,a,h;return r(this,(function(r){switch(r.label){case 0:return[4,YM(t,yE,[n,"getHistoryHash",[o]])];case 1:return e=r.sent(),xb.from(e).eq(0)?[4,eb(t,n,yE,"withdraw",[])]:[3,4];case 2:return[4,r.sent().wait()];case 3:return a=r.sent(),console.log("[Realitio] executed withdraw:",a),[2];case 4:return[4,eb(t,n,yE,"claimMultipleAndWithdrawBalance",i([[o]],s))];case 5:return[4,r.sent().wait()];case 6:return h=r.sent(),console.log("[Realitio] executed claimMultipleAndWithdrawBalance:",h),[2]}}))}))},n.prototype.executeProposal=function(t,i,n,o,s){return e(this,void 0,void 0,(function(){var e,a,h;return r(this,(function(r){switch(r.label){case 0:return[4,this.calcTransactionHashes(t.network.chainId,i,o)];case 1:return e=r.sent(),a=o[s],[4,eb(t,i,vE,"executeProposalWithIndex",[n,e,a.to,a.value,a.data||"0x",a.operation,s])];case 2:return[4,r.sent().wait()];case 3:return h=r.sent(),console.log("[DAO module] executed proposal:",h),[2]}}))}))},n.prototype.voteForQuestion=function(t,n,o,s,a,h){return e(this,void 0,void 0,(function(){var e,u,l,f,c,d,m,p,g,v,y;return r(this,(function(r){switch(r.label){case 0:return[4,YM(n,yE,[o,"getBond",[s]])];case 1:e=r.sent(),f={},c=[s,"0x000000000000000000000000000000000000000000000000000000000000000"+h],e.eq(xb.from(0))?(d=xb.from(a).eq(0),u=d?xb.from(10):a):u=e.mul(2),r.label=2;case 2:return r.trys.push([2,8,,9]),[4,YM(n,yE,[o,"token",[]])];case 3:return m=r.sent(),[4,QM(t,n,wE,[[m,"decimals",[]],[m,"allowance",[n.provider.selectedAddress,o]]])];case 4:return p=r.sent(),g=p[0][0],v=p[1][0],u.eq(10)&&(u=u.pow(g)),v.lt(u)?[4,eb(n,m,wE,"approve",[o,u],{})]:[3,7];case 5:return[4,r.sent().wait()];case 6:r.sent(),r.label=7;case 7:return c=i(c,[u,u]),l="submitAnswerERC20",[3,9];case 8:return r.sent(),u.eq(10)&&(u=u.pow(18)),c=i(c,[u]),f.value=u.toString(),l="submitAnswer",[3,9];case 9:return[4,eb(n,o,yE,l,c,f)];case 10:return[4,r.sent().wait()];case 11:return y=r.sent(),console.log("[DAO module] executed vote on oracle:",y),[2]}}))}))},n}(),RE=function(){function t(){this.author="lbeder",this.version="0.1.0",this.name="Quorum"}return t.prototype.getTotalVotingPower=function(t,i,n){return e(this,void 0,void 0,(function(){var e,o,s,a,h,u,l;return r(this,(function(r){switch(r.label){case 0:switch(r.trys.push([0,6,,7]),e=i.strategy,e){case"static":return[3,1];case"balance":return[3,2]}return[3,4];case 1:return[2,i.total];case 2:return o=i.address,s=i.methodABI,a=i.decimals,h="latest"===n?n:parseInt(n),[4,YM(t,[s],[o,s.name],{blockTag:h})];case 3:return u=r.sent(),[2,Wt.from(u).div(Wt.from(10).pow(a)).toNumber()];case 4:throw new Error("Unsupported quorum strategy: "+e);case 5:return[3,7];case 6:throw l=r.sent(),new Error(l);case 7:return[2]}}))}))},t}(),xE=function(){function t(){this.author="Poap-xyz",this.version="1.0.0",this.name="Poap Module"}return t.prototype.openScanPage=function(t){window.open("https://app.poap.xyz/scan/"+t,"_blank")},t.prototype.getCurrentState=function(t,i){return e(this,void 0,void 0,(function(){var e,n,o,s,a,h,u;return r(this,(function(r){switch(r.label){case 0:return[4,fetch("https://api.poap.xyz/snapshot/proposal/"+t)];case 1:return(e=r.sent()).ok?[4,e.json()]:[2,{image_url:"",currentState:"NO_POAP"}];case 2:return n=r.sent().image_url,i?[4,fetch("https://api.poap.xyz/snapshot/proposal/"+t+"/"+i)]:[2,{image_url:n,currentState:"NOT_VOTED"}];case 3:return(o=r.sent()).ok?[4,o.json()]:[2,{image_url:n,currentState:"NOT_VOTED"}];case 4:return s=r.sent(),a=s.claimed,h=s.status,u=s.voted,a?a&&"passed"!==h?[2,{image_url:n,currentState:"LOADING"}]:[2,{image_url:n,currentState:"CLAIMED"}]:u?[2,{image_url:n,currentState:"UNCLAIMED"}]:[2,{image_url:n,currentState:"NOT_VOTED"}]}}))}))},t.prototype.claim=function(t,i){return e(this,void 0,void 0,(function(){var e,n;return r(this,(function(r){switch(r.label){case 0:return e={snapshotProposalHash:t,address:i},[4,fetch("https://api.poap.xyz/claim/snapshot-proposal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return(n=r.sent()).ok?[2,"LOADING"]:(console.log(n.json()),[2,"UNCLAIMED"])}}))}))},t}(),IE={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Proposal",definitions:{Proposal:{title:"Proposal",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0,maxLength:1e4},choices:{type:"array",title:"choices",minItems:2,maxItems:64},type:{type:"string",enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom"]},snapshot:{type:"number",title:"snapshot"},start:{type:"number",title:"start",minimum:1e9,maximum:2e9},end:{type:"number",title:"end",minimum:1e9,maximum:2e9,exclusiveMinimum:{$data:"1/start"}},metadata:{type:"object",title:"metadata"}},required:["name","body","choices","snapshot","start","end"],additionalProperties:!1}}},kE={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Vote",definitions:{Vote:{title:"Vote",type:"object",properties:{proposal:{type:"string",title:"proposal"},choice:{type:["number","array","object","boolean"],title:"choice"},metadata:{type:"object",title:"metadata"}},required:["proposal","choice"],additionalProperties:!1}}};return{Client:I,plugins:{aragon:lb,gnosis:yb,safeSnap:SE,poap:xE,quorum:RE},schemas:{space:{$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Space",definitions:{Space:{title:"Space",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:32},private:{type:"boolean"},about:{type:"string",title:"about",maxLength:160},guidelines:{type:"string",title:"guidelines",maxLength:1024},terms:{type:"string",title:"terms",format:"uri",maxLength:128},avatar:{type:"string",title:"avatar",format:"uri",maxLength:256},location:{type:"string",title:"location",maxLength:24},website:{type:"string",title:"website",format:"uri",maxLength:128},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},email:{type:"string",title:"email",maxLength:32},network:{type:"string",title:"network",minLength:1,maxLength:32},symbol:{type:"string",title:"symbol",minLength:1,maxLength:12},skin:{type:"string",title:"skin",maxLength:32},domain:{type:"string",title:"domain",maxLength:64},strategies:{type:"array",minItems:1,maxItems:8,items:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},title:"strategies"},members:{type:"array",items:{type:"string",pattern:"^[A-Za-z0-9]*$",minLength:42,maxLength:42},title:"members"},admins:{type:"array",items:{type:"string",pattern:"^[A-Za-z0-9]*$",minLength:42,maxLength:42},title:"admins"},filters:{type:"object",properties:{defaultTab:{type:"string"},minScore:{type:"number",minimum:0},onlyMembers:{type:"boolean"},invalids:{type:"array",items:{type:"string",maxLength:64},title:"invalids"}},additionalProperties:!1},validation:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},plugins:{type:"object"}},required:["name","network","symbol","strategies"],additionalProperties:!1}}}.definitions.Space,proposal:IE.definitions.Proposal,vote:kE.definitions.Vote},utils:ib}}));
|
|
21
|
+
deps: ${r}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(t){const[e,r]=function({schema:t}){const e={},r={};for(const i in t){if("__proto__"===i)continue;(Array.isArray(t[i])?e:r)[i]=t[i]}return[e,r]}(t);i(t,e),n(t,r)}};function i(t,e=t.schema){const{gen:r,data:i,it:n}=t;if(0===Object.keys(e).length)return;const o=r.let("missing");for(const s in e){const a=e[s];if(0===a.length)continue;const h=bu.propertyInData(r,i,s,n.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(h,()=>{for(const e of a)bu.checkReportMissingProp(t,e)}):(r.if(fu._`${h} && (${bu.checkMissingProp(t,a,o)})`),bu.reportMissingProp(t,o),r.else())}}function n(t,e=t.schema){const{gen:r,data:i,keyword:n,it:o}=t,s=r.name("valid");for(const a in e)cu.alwaysValidSchema(o,e[a])||(r.if(bu.propertyInData(r,i,a,o.opts.ownProperties),()=>{const e=t.subschema({keyword:n,schemaProp:a},s);t.mergeValidEvaluated(e,s)},()=>r.var(s,!0)),t.ok(s))}e.validatePropertyDeps=i,e.validateSchemaDeps=n,e.default=r}));var xl={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>fu._`{propertyName: ${t.propertyName}}`},code(t){const{gen:e,schema:r,data:i,it:n}=t;if(cu.alwaysValidSchema(n,r))return;const o=e.name("valid");e.forIn("key",i,r=>{t.setParams({propertyName:r}),t.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),e.if(fu.not(o),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(o)}},Il=Object.defineProperty({default:xl},"__esModule",{value:!0});var kl={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:t})=>fu._`{additionalProperty: ${t.additionalProperty}}`},code(t){const{gen:e,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");const{allErrors:a,opts:h}=s;if(s.props=!0,"all"!==h.removeAdditional&&cu.alwaysValidSchema(s,r))return;const u=bu.allSchemaProperties(i.properties),l=bu.allSchemaProperties(i.patternProperties);function f(t){e.code(fu._`delete ${n}[${t}]`)}function c(i){if("all"===h.removeAdditional||h.removeAdditional&&!1===r)f(i);else{if(!1===r)return t.setParams({additionalProperty:i}),t.error(),void(a||e.break());if("object"==typeof r&&!cu.alwaysValidSchema(s,r)){const r=e.name("valid");"failing"===h.removeAdditional?(d(i,r,!1),e.if(fu.not(r),()=>{t.reset(),f(i)})):(d(i,r),a||e.if(fu.not(r),()=>e.break()))}}}function d(e,r,i){const n={keyword:"additionalProperties",dataProp:e,dataPropType:cu.Type.Str};!1===i&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(n,r)}e.forIn("key",n,r=>{u.length||l.length?e.if(function(r){let n;if(u.length>8){const t=cu.schemaRefOrVal(s,i.properties,"properties");n=bu.isOwnProperty(e,t,r)}else n=u.length?fu.or(...u.map(t=>fu._`${r} === ${t}`)):fu.nil;return l.length&&(n=fu.or(n,...l.map(e=>fu._`${bu.usePattern(t,e)}.test(${r})`))),fu.not(n)}(r),()=>c(r)):c(r)}),t.ok(fu._`${o} === ${mu.default.errors}`)}},Tl=Object.defineProperty({default:kl},"__esModule",{value:!0});var Ol={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,parentSchema:i,data:n,it:o}=t;"all"===o.opts.removeAdditional&&void 0===i.additionalProperties&&Tl.default.code(new xu.KeywordCxt(o,Tl.default,"additionalProperties"));const s=bu.allSchemaProperties(r);for(const t of s)o.definedProperties.add(t);o.opts.unevaluated&&s.length&&!0!==o.props&&(o.props=cu.mergeEvaluated.props(e,cu.toHash(s),o.props));const a=s.filter(t=>!cu.alwaysValidSchema(o,r[t]));if(0===a.length)return;const h=e.name("valid");for(const r of a)u(r)?l(r):(e.if(bu.propertyInData(e,n,r,o.opts.ownProperties)),l(r),o.allErrors||e.else().var(h,!0),e.endIf()),t.it.definedProperties.add(r),t.ok(h);function u(t){return o.opts.useDefaults&&!o.compositeRule&&void 0!==r[t].default}function l(e){t.subschema({keyword:"properties",schemaProp:e,dataProp:e},h)}}},Pl=Object.defineProperty({default:Ol},"__esModule",{value:!0});const Cl=cu;var Ul={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,data:i,parentSchema:n,it:o}=t,{opts:s}=o,a=bu.allSchemaProperties(r),h=a.filter(t=>cu.alwaysValidSchema(o,r[t]));if(0===a.length||h.length===a.length&&(!o.opts.unevaluated||!0===o.props))return;const u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,l=e.name("valid");!0===o.props||o.props instanceof fu.Name||(o.props=Cl.evaluatedPropsToName(e,o.props));const{props:f}=o;function c(t){for(const e in u)new RegExp(t).test(e)&&cu.checkStrictMode(o,`property ${e} matches pattern ${t} (use allowMatchingProperties)`)}function d(r){e.forIn("key",i,i=>{e.if(fu._`${bu.usePattern(t,r)}.test(${i})`,()=>{const n=h.includes(r);n||t.subschema({keyword:"patternProperties",schemaProp:r,dataProp:i,dataPropType:Cl.Type.Str},l),o.opts.unevaluated&&!0!==f?e.assign(fu._`${f}[${i}]`,!0):n||o.allErrors||e.if(fu.not(l),()=>e.break())})})}!function(){for(const t of a)u&&c(t),o.allErrors?d(t):(e.var(l,!0),d(t),e.if(l))}()}},Fl=Object.defineProperty({default:Ul},"__esModule",{value:!0});var Bl={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:r,it:i}=t;if(cu.alwaysValidSchema(i,r))return void t.fail();const n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.result(n,()=>t.error(),()=>t.reset())},error:{message:"must NOT be valid"}},Dl=Object.defineProperty({default:Bl},"__esModule",{value:!0});var Ll={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:bu.validateUnion,error:{message:"must match a schema in anyOf"}},$l=Object.defineProperty({default:Ll},"__esModule",{value:!0});var jl={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>fu._`{passingSchemas: ${t.passing}}`},code(t){const{gen:e,schema:r,parentSchema:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;const o=r,s=e.let("valid",!1),a=e.let("passing",null),h=e.name("_valid");t.setParams({passing:a}),e.block((function(){o.forEach((r,i)=>{let o;cu.alwaysValidSchema(n,r)?e.var(h,!0):o=t.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},h),i>0&&e.if(fu._`${h} && ${s}`).assign(s,!1).assign(a,fu._`[${a}, ${i}]`).else(),e.if(h,()=>{e.assign(s,!0),e.assign(a,i),o&&t.mergeEvaluated(o,fu.Name)})})})),t.result(s,()=>t.reset(),()=>t.error(!0))}},zl=Object.defineProperty({default:jl},"__esModule",{value:!0});var ql={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:r,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");const n=e.name("valid");r.forEach((e,r)=>{if(cu.alwaysValidSchema(i,e))return;const o=t.subschema({keyword:"allOf",schemaProp:r},n);t.ok(n),t.mergeEvaluated(o)})}},Gl=Object.defineProperty({default:ql},"__esModule",{value:!0});function Vl(t,e){const r=t.schema[e];return void 0!==r&&!cu.alwaysValidSchema(t,r)}var Zl={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>fu.str`must match "${t.ifClause}" schema`,params:({params:t})=>fu._`{failingKeyword: ${t.ifClause}}`},code(t){const{gen:e,parentSchema:r,it:i}=t;void 0===r.then&&void 0===r.else&&cu.checkStrictMode(i,'"if" without "then" and "else" is ignored');const n=Vl(i,"then"),o=Vl(i,"else");if(!n&&!o)return;const s=e.let("valid",!0),a=e.name("_valid");if(function(){const e=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(e)}(),t.reset(),n&&o){const r=e.let("ifClause");t.setParams({ifClause:r}),e.if(a,h("then",r),h("else",r))}else n?e.if(a,h("then")):e.if(fu.not(a),h("else"));function h(r,i){return()=>{const n=t.subschema({keyword:r},a);e.assign(s,a),t.mergeValidEvaluated(n,s),i?e.assign(i,fu._`${r}`):t.setParams({ifClause:r})}}t.pass(s,()=>t.error(!0))}},Kl=Object.defineProperty({default:Zl},"__esModule",{value:!0});var Hl={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){void 0===e.if&&cu.checkStrictMode(r,`"${t}" without "if" is ignored`)}},Wl=Object.defineProperty({default:Hl},"__esModule",{value:!0});var Jl=function(t=!1){const e=[Dl.default,$l.default,zl.default,Gl.default,Kl.default,Wl.default,Il.default,Tl.default,Rl.default,Pl.default,Fl.default];return t?e.push(El.default,Nl.default):e.push(wl.default,Ml.default),e.push(Sl.default),e},Xl=Object.defineProperty({default:Jl},"__esModule",{value:!0});var Yl={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>fu.str`must match format "${t}"`,params:({schemaCode:t})=>fu._`{format: ${t}}`},code(t,e){const{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=t,{opts:h,errSchemaPath:u,schemaEnv:l,self:f}=a;h.validateFormats&&(n?function(){const n=r.scopeValue("formats",{ref:f.formats,code:h.code.formats}),o=r.const("fDef",fu._`${n}[${s}]`),a=r.let("fType"),u=r.let("format");r.if(fu._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(a,fu._`${o}.type || "string"`).assign(u,fu._`${o}.validate`),()=>r.assign(a,fu._`"string"`).assign(u,o)),t.fail$data(fu.or(!1===h.strictSchema?fu.nil:fu._`${s} && !${u}`,function(){const t=l.$async?fu._`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:fu._`${u}(${i})`,r=fu._`(typeof ${u} == "function" ? ${t} : ${u}.test(${i}))`;return fu._`${u} && ${u} !== true && ${a} === ${e} && !${r}`}()))}():function(){const n=f.formats[o];if(!n)return void function(){if(!1===h.strictSchema)return void f.logger.warn(t());throw new Error(t());function t(){return`unknown format "${o}" ignored in schema at path "${u}"`}}();if(!0===n)return;const[s,a,c]=function(t){const e=t instanceof RegExp?fu.regexpCode(t):h.code.formats?fu._`${h.code.formats}${fu.getProperty(o)}`:void 0,i=r.scopeValue("formats",{key:o,ref:t,code:e});if("object"==typeof t&&!(t instanceof RegExp))return[t.type||"string",t.validate,fu._`${i}.validate`];return["string",t,i]}(n);s===e&&t.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.async){if(!l.$async)throw new Error("async format in sync schema");return fu._`await ${c}(${i})`}return"function"==typeof a?fu._`${c}(${i})`:fu._`${c}.test(${i})`}())}())}};var Ql=[Object.defineProperty({default:Yl},"__esModule",{value:!0}).default],tf=Object.defineProperty({default:Ql},"__esModule",{value:!0}),ef=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}));var rf=[zu.default,yl.default,Xl.default(),tf.default,ef.metadataVocabulary,ef.contentVocabulary],nf=Object.defineProperty({default:rf},"__esModule",{value:!0}),of=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))}));var sf={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:t,tagName:e}})=>t===of.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>fu._`{error: ${t}, tag: ${r}, tagValue: ${e}}`},code(t){const{gen:e,data:r,schema:i,parentSchema:n,it:o}=t,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=i.propertyName;if("string"!=typeof a)throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");const h=e.let("valid",!1),u=e.const("tag",fu._`${r}${fu.getProperty(a)}`);function l(r){const i=e.name("valid"),n=t.subschema({keyword:"oneOf",schemaProp:r},i);return t.mergeEvaluated(n,fu.Name),i}e.if(fu._`typeof ${u} == "string"`,()=>function(){const r=function(){var t;const e={},r=o(n);let i=!0;for(let e=0;e<s.length;e++){const n=s[e],u=null===(t=n.properties)||void 0===t?void 0:t[a];if("object"!=typeof u)throw new Error(`discriminator: oneOf schemas must have "properties/${a}"`);i=i&&(r||o(n)),h(u,e)}if(!i)throw new Error(`discriminator: "${a}" must be required`);return e;function o({required:t}){return Array.isArray(t)&&t.includes(a)}function h(t,e){if(t.const)u(t.const,e);else{if(!t.enum)throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`);for(const r of t.enum)u(r,e)}}function u(t,r){if("string"!=typeof t||t in e)throw new Error(`discriminator: "${a}" values must be unique strings`);e[t]=r}}();e.if(!1);for(const t in r)e.elseIf(fu._`${u} === ${t}`),e.assign(h,l(r[t]));e.else(),t.error(!1,{discrError:of.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}(),()=>t.error(!1,{discrError:of.DiscrError.Tag,tag:u,tagName:a})),t.ok(h)}},af=Object.defineProperty({default:sf},"__esModule",{value:!0}),hf={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0},uf=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;const r=["/properties"],i="http://json-schema.org/draft-07/schema";class n extends Bu.default{_addVocabularies(){super._addVocabularies(),nf.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(af.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(hf,r):hf;this.addMetaSchema(t,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n,Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return xu.KeywordCxt}}),Object.defineProperty(e,"_",{enumerable:!0,get:function(){return fu._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return fu.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return fu.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return fu.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return fu.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return fu.CodeGen}})})),lf=o(uf),ff=a((function(t,e){function r(t,e){return{validate:t,compare:e}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:r(o,s),time:r(h,u),"date-time":r((function(t){const e=t.split(l);return 2===e.length&&o(e[0])&&h(e[1],!0)}),f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(t){return c.test(t)&&d.test(t)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(t){if(p.test(t))return!1;try{return new RegExp(t),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,int32:{type:"number",validate:function(t){return Number.isInteger(t)&&t<=2147483647&&t>=-2147483648}},int64:{type:"number",validate:function(t){return Number.isInteger(t)}},float:{type:"number",validate:m},double:{type:"number",validate:m},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);const i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(t){const e=i.exec(t);if(!e)return!1;const r=+e[1],o=+e[2],s=+e[3];return o>=1&&o<=12&&s>=1&&s<=(2===o&&function(t){return t%4==0&&(t%100!=0||t%400==0)}(r)?29:n[o])}function s(t,e){if(t&&e)return t>e?1:t<e?-1:0}const a=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function h(t,e){const r=a.exec(t);if(!r)return!1;const i=+r[1],n=+r[2],o=+r[3],s=r[5];return(i<=23&&n<=59&&o<=59||23===i&&59===n&&60===o)&&(!e||""!==s)}function u(t,e){if(!t||!e)return;const r=a.exec(t),i=a.exec(e);return r&&i?(t=r[1]+r[2]+r[3]+(r[4]||""))>(e=i[1]+i[2]+i[3]+(i[4]||""))?1:t<e?-1:0:void 0}const l=/t|\s/i;function f(t,e){if(!t||!e)return;const[r,i]=t.split(l),[n,o]=e.split(l),a=s(r,n);return void 0!==a?a||u(i,o):void 0}const c=/\/|:/,d=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function m(){return!0}const p=/[^\\]\\Z/})),cf=a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const r=fu.operators,i={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={message:({keyword:t,schemaCode:e})=>fu.str`should be ${i[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>fu._`{comparison: ${i[t].okStr}, limit: ${e}}`};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:n,code(t){const{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:a,self:h}=s;if(!a.validateFormats)return;const u=new uf.KeywordCxt(s,h.RULES.all.format.definition,"format");function l(t){return fu._`${t}.compare(${r}, ${n}) ${i[o].fail} 0`}u.$data?function(){const r=e.scopeValue("formats",{ref:h.formats,code:a.code.formats}),i=e.const("fmt",fu._`${r}[${u.schemaCode}]`);t.fail$data(fu.or(fu._`typeof ${i} != "object"`,fu._`${i} instanceof RegExp`,fu._`typeof ${i}.compare != "function"`,l(i)))}():function(){const r=u.schema,i=h.formats[r];if(!i||!0===i)return;if("object"!=typeof i||i instanceof RegExp||"function"!=typeof i.compare)throw new Error(`"${o}": format "${r}" does not define "compare" function`);const n=e.scopeValue("formats",{key:r,ref:i,code:a.code.formats?fu._`${a.code.formats}${fu.getProperty(r)}`:void 0});t.fail$data(l(n))}()},dependencies:["format"]};e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),df=o(a((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=new fu.Name("fullFormats"),i=new fu.Name("fastFormats"),n=(t,e={keywords:!0})=>{if(Array.isArray(e))return o(t,e,ff.fullFormats,r),t;const[n,s]="fast"===e.mode?[ff.fastFormats,i]:[ff.fullFormats,r];return o(t,e.formats||ff.formatNames,n,s),e.keywords&&cf.default(t),t};function o(t,e,r,i){var n,o;null!==(n=(o=t.opts.code).formats)&&void 0!==n||(o.formats=fu._`require("ajv-formats/dist/formats").${i}`);for(const i of e)t.addFormat(i,r[i])}n.get=(t,e="full")=>{const r=("fast"===e?ff.fastFormats:ff.fullFormats)[t];if(!r)throw new Error(`Unknown format "${t}"`);return r},t.exports=e=n,Object.defineProperty(e,"__esModule",{value:!0}),e.default=n}))),mf="[object GeneratorFunction]",pf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gf=/^\w*$/,vf=/^\./,yf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wf=/\\(\\)?/g,Mf=/^\[object .+?Constructor\]$/,bf=/^(?:0|[1-9]\d*)$/,Ef="object"==typeof n&&n&&n.Object===Object&&n,_f="object"==typeof self&&self&&self.Object===Object&&self,Nf=Ef||_f||Function("return this")();var Af,Sf=Array.prototype,Rf=Function.prototype,xf=Object.prototype,If=Nf["__core-js_shared__"],kf=(Af=/[^.]+$/.exec(If&&If.keys&&If.keys.IE_PROTO||""))?"Symbol(src)_1."+Af:"",Tf=Rf.toString,Of=xf.hasOwnProperty,Pf=xf.toString,Cf=RegExp("^"+Tf.call(Of).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Uf=Nf.Symbol,Ff=Sf.splice,Bf=Wf(Nf,"Map"),Df=Wf(Object,"create"),Lf=Uf?Uf.prototype:void 0,$f=Lf?Lf.toString:void 0;function jf(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function zf(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function qf(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function Gf(t,e,r){var i=t[e];Of.call(t,e)&&tc(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function Vf(t,e){for(var r=t.length;r--;)if(tc(t[r][0],e))return r;return-1}function Zf(t){return!(!rc(t)||(e=t,kf&&kf in e))&&(function(t){var e=rc(t)?Pf.call(t):"";return"[object Function]"==e||e==mf}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?Cf:Mf).test(function(t){if(null!=t){try{return Tf.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function Kf(t,e,r,i){if(!rc(t))return t;for(var n=-1,o=(e=function(t,e){if(ec(t))return!1;var r=typeof t;if("number"==r||"symbol"==r||"boolean"==r||null==t||ic(t))return!0;return gf.test(t)||!pf.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return ec(t)?t:Xf(t)}(e)).length,s=o-1,a=t;null!=a&&++n<o;){var h=Yf(e[n]),u=r;if(n!=s){var l=a[h];void 0===(u=i?i(l,h,a):void 0)&&(u=rc(l)?l:Jf(e[n+1])?[]:{})}Gf(a,h,u),a=a[h]}return t}function Hf(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function Wf(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Zf(r)?r:void 0}function Jf(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||bf.test(t))&&t>-1&&t%1==0&&t<e}jf.prototype.clear=function(){this.__data__=Df?Df(null):{}},jf.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},jf.prototype.get=function(t){var e=this.__data__;if(Df){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return Of.call(e,t)?e[t]:void 0},jf.prototype.has=function(t){var e=this.__data__;return Df?void 0!==e[t]:Of.call(e,t)},jf.prototype.set=function(t,e){return this.__data__[t]=Df&&void 0===e?"__lodash_hash_undefined__":e,this},zf.prototype.clear=function(){this.__data__=[]},zf.prototype.delete=function(t){var e=this.__data__,r=Vf(e,t);return!(r<0)&&(r==e.length-1?e.pop():Ff.call(e,r,1),!0)},zf.prototype.get=function(t){var e=this.__data__,r=Vf(e,t);return r<0?void 0:e[r][1]},zf.prototype.has=function(t){return Vf(this.__data__,t)>-1},zf.prototype.set=function(t,e){var r=this.__data__,i=Vf(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},qf.prototype.clear=function(){this.__data__={hash:new jf,map:new(Bf||zf),string:new jf}},qf.prototype.delete=function(t){return Hf(this,t).delete(t)},qf.prototype.get=function(t){return Hf(this,t).get(t)},qf.prototype.has=function(t){return Hf(this,t).has(t)},qf.prototype.set=function(t,e){return Hf(this,t).set(t,e),this};var Xf=Qf((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(ic(t))return $f?$f.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var r=[];return vf.test(t)&&r.push(""),t.replace(yf,(function(t,e,i,n){r.push(i?n.replace(wf,"$1"):e||t)})),r}));function Yf(t){if("string"==typeof t||ic(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function Qf(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=t.apply(this,i);return r.cache=o.set(n,s),s};return r.cache=new(Qf.Cache||qf),r}function tc(t,e){return t===e||t!=t&&e!=e}Qf.Cache=qf;var ec=Array.isArray;function rc(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ic(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==Pf.call(t)}var nc=function(t,e,r){return null==t?t:Kf(t,e,r)},oc=function(){function t(t,e,r,i){this.options={},this.calls=[],this.paths=[],this.network=t,this.provider=e,this.abi=r,this.options=i||{}}return t.prototype.call=function(t,e,r,i){return this.calls.push([e,r,i]),this.paths.push(t),this},t.prototype.execute=function(t){return e(this,void 0,void 0,(function(){var e,i=this;return r(this,(function(r){switch(r.label){case 0:return e=t||{},[4,QM(this.network,this.provider,this.abi,this.calls,this.options)];case 1:return r.sent().forEach((function(t,r){return nc(e,i.paths[r],t.length>1?t:t[0])})),this.calls=[],this.paths=[],[2,e]}}))}))},t}();let sc=!1,ac=!1;const hc={debug:1,default:2,info:2,warning:3,error:4,off:5};let uc=hc.default,lc=null;const fc=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var cc,dc;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(cc||(cc={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(dc||(dc={}));class mc{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==hc[r]&&this.throwArgumentError("invalid log level name","logLevel",t),uc>hc[r]||console.log.apply(console,e)}debug(...t){this._log(mc.levels.DEBUG,t)}info(...t){this._log(mc.levels.INFO,t)}warn(...t){this._log(mc.levels.WARNING,t)}makeError(t,e,r){if(ac)return this.makeError("censored error",e,{});e||(e=mc.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,mc.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){fc&&this.throwError("platform missing String.prototype.normalize",mc.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:fc})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,mc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,mc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,mc.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,mc.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",mc.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",mc.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",mc.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return lc||(lc=new mc("logger/5.3.0")),lc}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",mc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),sc){if(!t)return;this.globalLogger().throwError("error censorship permanent",mc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ac=!!t,sc=!!e}static setLogLevel(t){const e=hc[t.toLowerCase()];null!=e?uc=e:mc.globalLogger().warn("invalid log level - "+t)}static from(t){return new mc(t)}}mc.errors=dc,mc.levels=cc;const pc=new mc("networks/5.3.1");function gc(t){const e=function(e,r){null==r&&(r={});const i=[];if(e.InfuraProvider)try{i.push(new e.InfuraProvider(t,r.infura))}catch(t){}if(e.EtherscanProvider)try{i.push(new e.EtherscanProvider(t,r.etherscan))}catch(t){}if(e.AlchemyProvider)try{i.push(new e.AlchemyProvider(t,r.alchemy))}catch(t){}if(e.CloudflareProvider)try{i.push(new e.CloudflareProvider(t))}catch(t){}if(0===i.length)return null;if(e.FallbackProvider){let n=1;return null!=r.quorum?n=r.quorum:"homestead"===t&&(n=2),new e.FallbackProvider(i,n)}return i[0]};return e.renetwork=function(t){return gc(t)},e}function vc(t,e){const r=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null};return r.renetwork=function(e){return vc(t,e)},r}const yc={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:gc("homestead")},wc={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:gc("ropsten")},Mc={chainId:63,name:"classicMordor",_defaultProvider:vc("https://www.ethercluster.com/mordor","classicMordor")},bc={unspecified:{chainId:0,name:"unspecified"},homestead:yc,mainnet:yc,morden:{chainId:2,name:"morden"},ropsten:wc,testnet:wc,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:gc("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:gc("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:gc("goerli")},classic:{chainId:61,name:"classic",_defaultProvider:vc("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Mc,classicTestnet:Mc,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:vc("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic"},maticmum:{chainId:80001,name:"maticmum"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};let Ec=!1,_c=!1;const Nc={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ac=Nc.default,Sc=null;const Rc=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var xc,Ic;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(xc||(xc={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(Ic||(Ic={}));class kc{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Nc[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Ac>Nc[r]||console.log.apply(console,e)}debug(...t){this._log(kc.levels.DEBUG,t)}info(...t){this._log(kc.levels.INFO,t)}warn(...t){this._log(kc.levels.WARNING,t)}makeError(t,e,r){if(_c)return this.makeError("censored error",e,{});e||(e=kc.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,kc.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){Rc&&this.throwError("platform missing String.prototype.normalize",kc.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Rc})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,kc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,kc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,kc.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,kc.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",kc.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",kc.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",kc.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Sc||(Sc=new kc("logger/5.3.0")),Sc}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",kc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ec){if(!t)return;this.globalLogger().throwError("error censorship permanent",kc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_c=!!t,Ec=!!e}static setLogLevel(t){const e=Nc[t.toLowerCase()];null!=e?Ac=e:kc.globalLogger().warn("invalid log level - "+t)}static from(t){return new kc(t)}}kc.errors=Ic,kc.levels=xc;const Tc=new kc("bytes/5.3.0");function Oc(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Oc(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Pc(t,e){if(e||(e={}),"number"==typeof t){Tc.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Oc(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){if("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))return!1;if(e&&t.length!==2+2*e)return!1;return!0}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":Tc.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return Oc(new Uint8Array(i))}return function(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}(t)?Oc(new Uint8Array(t)):Tc.throwArgumentError("invalid arrayify value","value",t)}window&&window.__awaiter;new kc("properties/5.3.0");function Cc(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}class Uc{constructor(t){Cc(this,"alphabet",t),Cc(this,"base",t.length),Cc(this,"_alphabetMap",{}),Cc(this,"_leader",t.charAt(0));for(let e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}encode(t){let e=Pc(t);if(0===e.length)return"";let r=[0];for(let t=0;t<e.length;++t){let i=e[t];for(let t=0;t<r.length;++t)i+=r[t]<<8,r[t]=i%this.base,i=i/this.base|0;for(;i>0;)r.push(i%this.base),i=i/this.base|0}let i="";for(let t=0;0===e[t]&&t<e.length-1;++t)i+=this._leader;for(let t=r.length-1;t>=0;--t)i+=this.alphabet[r[t]];return i}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let r=0;r<t.length;r++){let i=this._alphabetMap[t[r]];if(void 0===i)throw new Error("Non-base"+this.base+" character");let n=i;for(let t=0;t<e.length;++t)n+=e[t]*this.base,e[t]=255&n,n>>=8;for(;n>0;)e.push(255&n),n>>=8}for(let r=0;t[r]===this._leader&&r<t.length-1;++r)e.push(0);return Pc(new Uint8Array(e.reverse()))}}new Uc("abcdefghijklmnopqrstuvwxyz234567");const Fc=new Uc("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Bc=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,f=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!==(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);i=(m=m.idivn(d)).isZero()?p+i:u[c-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),l=this.clone();if(h){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],M=8191&w,b=w>>>13,E=0|s[4],_=8191&E,N=E>>>13,A=0|s[5],S=8191&A,R=A>>>13,x=0|s[6],I=8191&x,k=x>>>13,T=0|s[7],O=8191&T,P=T>>>13,C=0|s[8],U=8191&C,F=C>>>13,B=0|s[9],D=8191&B,L=B>>>13,$=0|a[0],j=8191&$,z=$>>>13,q=0|a[1],G=8191&q,V=q>>>13,Z=0|a[2],K=8191&Z,H=Z>>>13,W=0|a[3],J=8191&W,X=W>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(c,j)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,j),n=(n=Math.imul(v,z))+Math.imul(y,j)|0,o=Math.imul(y,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,V)|0;var yt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,z))+Math.imul(b,j)|0,o=Math.imul(b,z),i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,X)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(_,j),n=(n=Math.imul(_,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,X)|0;var Mt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(k,j)|0,o=Math.imul(k,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Et=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(u+(i=i+Math.imul(f,ht)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,z))+Math.imul(F,j)|0,o=Math.imul(F,z),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Nt=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,V)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(M,ot)|0,n=(n=n+Math.imul(M,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ht)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var At=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;u=((o=o+Math.imul(c,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,V))+Math.imul(L,G)|0,o=Math.imul(L,V),i=i+Math.imul(U,K)|0,n=(n=n+Math.imul(U,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var St=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,H))+Math.imul(L,K)|0,o=Math.imul(L,H),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,X)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,X))+Math.imul(L,J)|0,o=Math.imul(L,X),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var xt=(u+(i=i+Math.imul(M,mt)|0)|0)+((8191&(n=(n=n+Math.imul(M,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var It=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(U,ot)|0,n=(n=n+Math.imul(U,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ft)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(S,mt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(U,ht)|0,n=(n=n+Math.imul(U,ut)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(U,ft)|0,n=(n=n+Math.imul(U,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Ot=(u+(i=i+Math.imul(O,mt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ft),n=(n=Math.imul(D,ct))+Math.imul(L,ft)|0,o=Math.imul(L,ct);var Pt=(u+(i=i+Math.imul(U,mt)|0)|0)+((8191&(n=(n=n+Math.imul(U,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ct=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=Et,h[7]=_t,h[8]=Nt,h[9]=At,h[10]=St,h[11]=Rt,h[12]=xt,h[13]=It,h[14]=kt,h[15]=Tt,h[16]=Ot,h[17]=Pt,h[18]=Ct,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),c=67108863&f;a=67108863&(c=c+a|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},p.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},p.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var f=h,c=u,d=0;d<s;d++){var m=r[l+d],p=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=m+g,i[l+d]=p+v,r[l+d+s]=m-g,i[l+d+s]=p-v,d!==a&&(y=h*f-u*c,c=h*c+u*f,f=y)}},p.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},p.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},p.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,l,f,i,n);for(var d=0;d<i;d++){var m=a[d]*l[d]-h[d]*f[d];h[d]=a[d]*f[d]+h[d]*l[d],a[d]=m}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var f=h-1;f>=0;f--){var c=67108864*(0|i.words[o.length+f])+(0|i.words[o.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(f)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(M,v),i(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var v=this.pow(f,new n(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new _(t)},i(_,E),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,n)}));const Dc=new mc("bytes/5.3.0");function Lc(t){return!!t.toHexString}function $c(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return $c(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function jc(t){return Zc(t)&&!(t.length%2)||zc(t)}function zc(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function qc(t,e){if(e||(e={}),"number"==typeof t){Dc.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),$c(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Lc(t)&&(t=t.toHexString()),Zc(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":Dc.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return $c(new Uint8Array(i))}return zc(t)?$c(new Uint8Array(t)):Dc.throwArgumentError("invalid arrayify value","value",t)}function Gc(t){const e=t.map(t=>qc(t)),r=e.reduce((t,e)=>t+e.length,0),i=new Uint8Array(r);return e.reduce((t,e)=>(i.set(e,t),t+e.length),0),$c(i)}function Vc(t){let e=qc(t);if(0===e.length)return e;let r=0;for(;r<e.length&&0===e[r];)r++;return r&&(e=e.slice(r)),e}function Zc(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function Kc(t,e){if(e||(e={}),"number"==typeof t){Dc.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Lc(t))return t.toHexString();if(Zc(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Dc.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(zc(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return Dc.throwArgumentError("invalid hexlify value","value",t)}function Hc(t){if("string"!=typeof t)t=Kc(t);else if(!Zc(t)||t.length%2)return null;return(t.length-2)/2}function Wc(t,e,r){return"string"!=typeof t?t=Kc(t):(!Zc(t)||t.length%2)&&Dc.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Jc(t){let e="0x";return t.forEach(t=>{e+=Kc(t).substring(2)}),e}function Xc(t){const e=function(t){"string"!=typeof t&&(t=Kc(t));Zc(t)||Dc.throwArgumentError("invalid hex string","value",t);t=t.substring(2);let e=0;for(;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}(Kc(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function Yc(t,e){for("string"!=typeof t?t=Kc(t):Zc(t)||Dc.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Dc.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Qc(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(jc(t)){const r=qc(t);65!==r.length&&Dc.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),e.r=Kc(r.slice(0,32)),e.s=Kc(r.slice(32,64)),e.v=r[64],e.v<27&&(0===e.v||1===e.v?e.v+=27:Dc.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Kc(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=qc(t)).length>e&&Dc.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),$c(r)}(qc(e._vs),32);e._vs=Kc(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&Dc.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const n=Kc(r);null==e.s?e.s=n:e.s!==n&&Dc.throwArgumentError("signature v mismatch _vs","signature",t)}null==e.recoveryParam?null==e.v?Dc.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2:null==e.v?e.v=27+e.recoveryParam:e.recoveryParam!==1-e.v%2&&Dc.throwArgumentError("signature recoveryParam mismatch v","signature",t),null!=e.r&&Zc(e.r)?e.r=Yc(e.r,32):Dc.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Zc(e.s)?e.s=Yc(e.s,32):Dc.throwArgumentError("signature missing or invalid s","signature",t);const r=qc(e.s);r[0]>=128&&Dc.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=Kc(r);e._vs&&(Zc(e._vs)||Dc.throwArgumentError("signature invalid _vs","signature",t),e._vs=Yc(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&Dc.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e}var td=Bc.BN;const ed=new mc("bignumber/5.3.0"),rd={};let id=!1;class nd{constructor(t,e){ed.checkNew(new.target,nd),t!==rd&&ed.throwError("cannot call constructor directly; use BigNumber.from",mc.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return sd(ad(this).fromTwos(t))}toTwos(t){return sd(ad(this).toTwos(t))}abs(){return"-"===this._hex[0]?nd.from(this._hex.substring(1)):this}add(t){return sd(ad(this).add(ad(t)))}sub(t){return sd(ad(this).sub(ad(t)))}div(t){return nd.from(t).isZero()&&hd("division by zero","div"),sd(ad(this).div(ad(t)))}mul(t){return sd(ad(this).mul(ad(t)))}mod(t){const e=ad(t);return e.isNeg()&&hd("cannot modulo negative values","mod"),sd(ad(this).umod(e))}pow(t){const e=ad(t);return e.isNeg()&&hd("cannot raise to negative values","pow"),sd(ad(this).pow(e))}and(t){const e=ad(t);return(this.isNegative()||e.isNeg())&&hd("cannot 'and' negative values","and"),sd(ad(this).and(e))}or(t){const e=ad(t);return(this.isNegative()||e.isNeg())&&hd("cannot 'or' negative values","or"),sd(ad(this).or(e))}xor(t){const e=ad(t);return(this.isNegative()||e.isNeg())&&hd("cannot 'xor' negative values","xor"),sd(ad(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&hd("cannot mask negative values","mask"),sd(ad(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&hd("cannot shift negative values","shl"),sd(ad(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&hd("cannot shift negative values","shr"),sd(ad(this).shrn(t))}eq(t){return ad(this).eq(ad(t))}lt(t){return ad(this).lt(ad(t))}lte(t){return ad(this).lte(ad(t))}gt(t){return ad(this).gt(ad(t))}gte(t){return ad(this).gte(ad(t))}isNegative(){return"-"===this._hex[0]}isZero(){return ad(this).isZero()}toNumber(){try{return ad(this).toNumber()}catch(t){hd("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return ed.throwError("this platform does not support BigInt",mc.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?id||(id=!0,ed.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?ed.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",mc.errors.UNEXPECTED_ARGUMENT,{}):ed.throwError("BigNumber.toString does not accept parameters",mc.errors.UNEXPECTED_ARGUMENT,{})),ad(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof nd)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new nd(rd,od(t)):t.match(/^-?[0-9]+$/)?new nd(rd,od(new td(t))):ed.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&hd("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&hd("overflow","BigNumber.from",t),nd.from(String(t));const e=t;if("bigint"==typeof e)return nd.from(e.toString());if(zc(e))return nd.from(Kc(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return nd.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Zc(t)||"-"===t[0]&&Zc(t.substring(1))))return nd.from(t)}return ed.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function od(t){if("string"!=typeof t)return od(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&ed.throwArgumentError("invalid hex","value",t),"0x00"===(t=od(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function sd(t){return nd.from(od(t))}function ad(t){const e=nd.from(t).toHexString();return"-"===e[0]?new td("-"+e.substring(3),16):new td(e.substring(2),16)}function hd(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),ed.throwError(t,mc.errors.NUMERIC_FAULT,i)}const ud=nd.from(0);function ld(t){return"0x"+si.keccak_256(qc(t))}const fd=new mc("strings/5.3.0");var cd,dd;function md(t,e,r,i,n){if(t===dd.BAD_PREFIX||t===dd.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===dd.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(cd||(cd={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(dd||(dd={}));const pd=Object.freeze({error:function(t,e,r,i,n){return fd.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:md,replace:function(t,e,r,i,n){return t===dd.OVERLONG?(i.push(n),0):(i.push(65533),md(t,e,r))}});function gd(t,e){null==e&&(e=pd.error),t=qc(t);const r=[];let i=0;for(;i<t.length;){const n=t[i++];if(n>>7==0){r.push(n);continue}let o=null,s=null;if(192==(224&n))o=1,s=127;else if(224==(240&n))o=2,s=2047;else{if(240!=(248&n)){i+=e(128==(192&n)?dd.UNEXPECTED_CONTINUE:dd.BAD_PREFIX,i-1,t,r);continue}o=3,s=65535}if(i-1+o>=t.length){i+=e(dd.OVERRUN,i-1,t,r);continue}let a=n&(1<<8-o-1)-1;for(let n=0;n<o;n++){let n=t[i];if(128!=(192&n)){i+=e(dd.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|63&n,i++}null!==a&&(a>1114111?i+=e(dd.OUT_OF_RANGE,i-1-o,t,r,a):a>=55296&&a<=57343?i+=e(dd.UTF16_SURROGATE,i-1-o,t,r,a):a<=s?i+=e(dd.OVERLONG,i-1-o,t,r,a):r.push(a))}return r}function vd(t,e=cd.current){e!=cd.current&&(fd.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&i)<<10)+(1023&n);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(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return qc(r)}function yd(t){return t.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t)))).join("")}function wd(t,e){return yd(gd(t,e))}function Md(t,e=cd.current){return gd(vd(t,e))}function bd(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,i={};return t.split(",").forEach(t=>{let n=t.split(":");r+=parseInt(n[0],16),i[r]=e(n[1])}),i}function Ed(t){let e=0;return t.split(",").map(t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let i=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:i,h:e}})}function _d(t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];if(r+=n.l,t>=r&&t<=r+n.h&&(t-r)%(n.d||1)==0){if(n.e&&-1!==n.e.indexOf(t-r))continue;return n}}return null}const Nd=Ed("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Ad="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),Sd=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Rd=bd("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),xd=bd("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Id=bd("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e})),kd=Ed("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function Td(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let e=Md(t);var r;r=e.map(t=>{if(Ad.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=_d(t,Sd);if(e)return[t+e.s];let r=Rd[t];if(r)return r;let i=xd[t];return i?[t+i[0]]:Id[t]||null}(t);return e||[t]}),e=r.reduce((t,e)=>(e.forEach(e=>{t.push(e)}),t),[]),e=Md(yd(e),cd.NFKC),e.forEach(t=>{if(_d(t,kd))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),e.forEach(t=>{if(_d(t,Nd))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let i=yd(e);if("-"===i.substring(0,1)||"--"===i.substring(2,4)||"-"===i.substring(i.length-1))throw new Error("invalid hyphen");if(i.length>63)throw new Error("too long");return i}function Od(t){return ld(vd(t))}const Pd=new mc("hash/5.3.0"),Cd=new Uint8Array(32);Cd.fill(0);const Ud=new RegExp("^((.*)\\.)?([^.]+)$");function Fd(t){"string"!=typeof t&&Pd.throwArgumentError("invalid ENS name; not a string","name",t);let e=t,r=Cd;for(;e.length;){const i=e.match(Ud);null!=i&&""!==i[2]||Pd.throwArgumentError("invalid ENS address; missing component","name",t);r=ld(Gc([r,ld(vd(Td(i[3])))])),e=i[2]||""}return Kc(r)}const Bd=new mc("rlp/5.3.0");function Dd(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function Ld(t,e,r){let i=0;for(let n=0;n<r;n++)i=256*i+t[e+n];return i}function $d(t){return Kc(function t(e){if(Array.isArray(e)){let r=[];if(e.forEach((function(e){r=r.concat(t(e))})),r.length<=55)return r.unshift(192+r.length),r;const i=Dd(r.length);return i.unshift(247+i.length),i.concat(r)}jc(e)||Bd.throwArgumentError("RLP object must be BytesLike","object",e);const r=Array.prototype.slice.call(qc(e));if(1===r.length&&r[0]<=127)return r;if(r.length<=55)return r.unshift(128+r.length),r;const i=Dd(r.length);return i.unshift(183+i.length),i.concat(r)}(t))}function jd(t,e,r,i){const n=[];for(;r<e+1+i;){const o=zd(t,r);n.push(o.result),(r+=o.consumed)>e+1+i&&Bd.throwError("child data too short",mc.errors.BUFFER_OVERRUN,{})}return{consumed:1+i,result:n}}function zd(t,e){if(0===t.length&&Bd.throwError("data too short",mc.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&Bd.throwError("data short segment too short",mc.errors.BUFFER_OVERRUN,{});const i=Ld(t,e+1,r);return e+1+r+i>t.length&&Bd.throwError("data long segment too short",mc.errors.BUFFER_OVERRUN,{}),jd(t,e,e+1+r,r+i)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&Bd.throwError("data array too short",mc.errors.BUFFER_OVERRUN,{}),jd(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&Bd.throwError("data array too short",mc.errors.BUFFER_OVERRUN,{});const i=Ld(t,e+1,r);e+1+r+i>t.length&&Bd.throwError("data array too short",mc.errors.BUFFER_OVERRUN,{});return{consumed:1+r+i,result:Kc(t.slice(e+1+r,e+1+r+i))}}if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&Bd.throwError("data too short",mc.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:Kc(t.slice(e+1,e+1+r))}}return{consumed:1,result:Kc(t[e])}}function qd(t){const e=qc(t),r=zd(e,0);return r.consumed!==e.length&&Bd.throwArgumentError("invalid rlp data","data",t),r.result}const Gd=new mc("address/5.3.0");function Vd(t){Zc(t,20)||Gd.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=qc(ld(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Zd={};for(let t=0;t<10;t++)Zd[String(t)]=String(t);for(let t=0;t<26;t++)Zd[String.fromCharCode(65+t)]=String(10+t);const Kd=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Hd(t){let e=null;if("string"!=typeof t&&Gd.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Vd(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Gd.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>Zd[t]).join("");for(;e.length>=Kd;){let t=e.substring(0,Kd);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&Gd.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new td(r,36).toString(16);e.length<40;)e="0"+e;e=Vd("0x"+e)}else Gd.throwArgumentError("invalid address","address",t);var r;return e}var Wd=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Jd=new mc("properties/5.3.0");function Xd(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Yd(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function Qd(t){return Wd(this,void 0,void 0,(function*(){const e=Object.keys(t).map(e=>{const r=t[e];return Promise.resolve(r).then(t=>({key:e,value:t}))});return(yield Promise.all(e)).reduce((t,e)=>(t[e.key]=e.value,t),{})}))}function tm(t){const e={};for(const r in t)e[r]=t[r];return e}const em={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function rm(t){if(function t(e){if(null==e||em[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const r=Object.keys(e);for(let i=0;i<r.length;i++)if(!t(e[r[i]]))return!1;return!0}return Jd.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}(t))return t;if(Array.isArray(t))return Object.freeze(t.map(t=>im(t)));if("object"==typeof t){const e={};for(const r in t){const i=t[r];void 0!==i&&Xd(e,r,im(i))}return e}return Jd.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function im(t){return rm(t)}var nm=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const om=new mc("hash/5.3.0"),sm=new Uint8Array(32);sm.fill(0);const am=nd.from(-1),hm=nd.from(0),um=nd.from(1),lm=nd.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const fm=Yc(um.toHexString(),32),cm=Yc(hm.toHexString(),32),dm={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},mm=["name","version","chainId","verifyingContract","salt"];function pm(t){return function(e){return"string"!=typeof e&&om.throwArgumentError("invalid domain value for "+JSON.stringify(t),"domain."+t,e),e}}const gm={name:pm("name"),version:pm("version"),chainId:function(t){try{return nd.from(t).toString()}catch(t){}return om.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Hd(t).toLowerCase()}catch(t){}return om.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=qc(t);if(32!==e.length)throw new Error("bad length");return Kc(e)}catch(t){}return om.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function vm(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&om.throwArgumentError("invalid numeric width","type",t);const n=lm.mask(r?i-1:i),o=r?n.add(um).mul(am):hm;return function(e){const r=nd.from(e);return(r.lt(o)||r.gt(n))&&om.throwArgumentError("value out-of-bounds for "+t,"value",e),Yc(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&om.throwArgumentError("invalid bytes width","type",t),function(e){return qc(e).length!==r&&om.throwArgumentError("invalid length for "+t,"value",e),function(t){const e=qc(t),r=e.length%32;return r?Jc([e,sm.slice(r)]):Kc(e)}(e)}}}switch(t){case"address":return function(t){return Yc(Hd(t),32)};case"bool":return function(t){return t?fm:cm};case"bytes":return function(t){return ld(t)};case"string":return function(t){return Od(t)}}return null}function ym(t,e){return`${t}(${e.map(({name:t,type:e})=>e+" "+t).join(",")})`}class wm{constructor(t){Xd(this,"types",Object.freeze(im(t))),Xd(this,"_encoderCache",{}),Xd(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach(t=>{e[t]={},r[t]=[],i[t]={}});for(const i in t){const n={};t[i].forEach(o=>{n[o.name]&&om.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===i&&om.throwArgumentError("circular type reference to "+JSON.stringify(s),"types",t);vm(s)||(r[s]||om.throwArgumentError("unknown type "+JSON.stringify(s),"types",t),r[s].push(i),e[i][s]=!0)})}const n=Object.keys(r).filter(t=>0===r[t].length);0===n.length?om.throwArgumentError("missing primary type","types",t):n.length>1&&om.throwArgumentError("ambiguous primary types or unused types: "+n.map(t=>JSON.stringify(t)).join(", "),"types",t),Xd(this,"primaryType",n[0]),function n(o,s){s[o]&&om.throwArgumentError("circular type reference to "+JSON.stringify(o),"types",t),s[o]=!0,Object.keys(e[o]).forEach(t=>{r[t]&&(n(t,s),Object.keys(s).forEach(e=>{i[e][t]=!0}))}),delete s[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=ym(e,t[e])+r.map(e=>ym(e,t[e])).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=vm(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&om.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(ld)),ld(Jc(n))}}const r=this.types[t];if(r){const e=Od(this._types[t]);return t=>{const i=r.map(({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?ld(i):i});return i.unshift(e),Jc(i)}}return om.throwArgumentError("unknown type: "+t,"type",t)}encodeType(t){const e=this._types[t];return e||om.throwArgumentError("unknown type: "+JSON.stringify(t),"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return ld(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(vm(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&om.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map(e=>this._visit(t,e,r))}const n=this.types[t];return n?n.reduce((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t),{}):om.throwArgumentError("unknown type: "+t,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new wm(t)}static getPrimaryType(t){return wm.from(t).primaryType}static hashStruct(t,e,r){return wm.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=dm[r];i||om.throwArgumentError("invalid typed-data domain key: "+JSON.stringify(r),"domain",t),e.push({name:r,type:i})}return e.sort((t,e)=>mm.indexOf(t.name)-mm.indexOf(e.name)),wm.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Jc(["0x1901",wm.hashDomain(t),wm.from(e).hash(r)])}static hash(t,e,r){return ld(wm.encode(t,e,r))}static resolveNames(t,e,r,i){return nm(this,void 0,void 0,(function*(){t=tm(t);const n={};t.verifyingContract&&!Zc(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=wm.from(e);o.visit(r,(t,e)=>("address"!==t||Zc(e,20)||(n[e]="0x"),e));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,(t,e)=>"address"===t&&n[e]?n[e]:e),{domain:t,value:r}}))}static getPayload(t,e,r){wm.hashDomain(t);const i={},n=[];mm.forEach(e=>{const r=t[e];null!=r&&(i[e]=gm[e](r),n.push({name:e,type:dm[e]}))});const o=wm.from(e),s=tm(e);return s.EIP712Domain?om.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=n,o.encode(r),{types:s,domain:i,primaryType:o.primaryType,message:o.visit(r,(t,e)=>{if(t.match(/^bytes(\d*)/))return Kc(qc(e));if(t.match(/^u?int/))return nd.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&om.throwArgumentError("invalid string","value",e),e}return om.throwArgumentError("unsupported type","type",t)})}}}var Mm=bm;function bm(t,e){if(!t)throw new Error(e||"Assertion failed")}function Em(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function _m(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function Nm(t){return 1===t.length?"0"+t:t}function Am(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}bm.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Sm={inherits:a((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),toArray:function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var o=t.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=63&o|128):Em(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n<t.length;n++)r[n]=0|t[n];return r},toHex:function(t){for(var e="",r=0;r<t.length;r++)e+=Nm(t[r].toString(16));return e},htonl:_m,toHex32:function(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];"little"===e&&(n=_m(n)),r+=Am(n.toString(16))}return r},zero2:Nm,zero8:Am,join32:function(t,e,r,i){var n=r-e;Mm(n%4==0);for(var o=new Array(n/4),s=0,a=e;s<o.length;s++,a+=4){var h;h="big"===i?t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],o[s]=h>>>0}return o},split32:function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i<t.length;i++,n+=4){var o=t[i];"big"===e?(r[n]=o>>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},rotr32:function(t,e){return t>>>e|t<<32-e},rotl32:function(t,e){return t<<e|t>>>32-e},sum32:function(t,e){return t+e>>>0},sum32_3:function(t,e,r){return t+e+r>>>0},sum32_4:function(t,e,r,i){return t+e+r+i>>>0},sum32_5:function(t,e,r,i,n){return t+e+r+i+n>>>0},sum64:function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,s=(o<i?1:0)+r+n;t[e]=s>>>0,t[e+1]=o},sum64_hi:function(t,e,r,i){return(e+i>>>0<e?1:0)+t+r>>>0},sum64_lo:function(t,e,r,i){return e+i>>>0},sum64_4_hi:function(t,e,r,i,n,o,s,a){var h=0,u=e;return h+=(u=u+i>>>0)<e?1:0,h+=(u=u+o>>>0)<o?1:0,t+r+n+s+(h+=(u=u+a>>>0)<a?1:0)>>>0},sum64_4_lo:function(t,e,r,i,n,o,s,a){return e+i+o+a>>>0},sum64_5_hi:function(t,e,r,i,n,o,s,a,h,u){var l=0,f=e;return l+=(f=f+i>>>0)<e?1:0,l+=(f=f+o>>>0)<o?1:0,l+=(f=f+a>>>0)<a?1:0,t+r+n+s+h+(l+=(f=f+u>>>0)<u?1:0)>>>0},sum64_5_lo:function(t,e,r,i,n,o,s,a,h,u){return e+i+o+a+u>>>0},rotr64_hi:function(t,e,r){return(e<<32-r|t>>>r)>>>0},rotr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0},shr64_hi:function(t,e,r){return t>>>r},shr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0}};function Rm(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var xm=Rm;Rm.prototype.update=function(t,e){if(t=Sm.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=Sm.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},Rm.prototype.digest=function(t){return this.update(this._pad()),Mm(null===this.pending),this._digest(t)},Rm.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=t>>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o<this.padLength;o++)i[n++]=0;return i};var Im={BlockHash:xm},km=Sm.rotr32;function Tm(t,e,r){return t&e^~t&r}function Om(t,e,r){return t&e^t&r^e&r}function Pm(t,e,r){return t^e^r}var Cm={ft_1:function(t,e,r,i){return 0===t?Tm(e,r,i):1===t||3===t?Pm(e,r,i):2===t?Om(e,r,i):void 0},ch32:Tm,maj32:Om,p32:Pm,s0_256:function(t){return km(t,2)^km(t,13)^km(t,22)},s1_256:function(t){return km(t,6)^km(t,11)^km(t,25)},g0_256:function(t){return km(t,7)^km(t,18)^t>>>3},g1_256:function(t){return km(t,17)^km(t,19)^t>>>10}},Um=Sm.rotl32,Fm=Sm.sum32,Bm=Sm.sum32_5,Dm=Cm.ft_1,Lm=Im.BlockHash,$m=[1518500249,1859775393,2400959708,3395469782];function jm(){if(!(this instanceof jm))return new jm;Lm.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Sm.inherits(jm,Lm);var zm=jm;jm.blockSize=512,jm.outSize=160,jm.hmacStrength=80,jm.padLength=64,jm.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=Um(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4];for(i=0;i<r.length;i++){var u=~~(i/20),l=Bm(Um(n,5),Dm(u,o,s,a),h,r[i],$m[u]);h=a,a=s,s=Um(o,30),o=n,n=l}this.h[0]=Fm(this.h[0],n),this.h[1]=Fm(this.h[1],o),this.h[2]=Fm(this.h[2],s),this.h[3]=Fm(this.h[3],a),this.h[4]=Fm(this.h[4],h)},jm.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h,"big"):Sm.split32(this.h,"big")};var qm=Sm.sum32,Gm=Sm.sum32_4,Vm=Sm.sum32_5,Zm=Cm.ch32,Km=Cm.maj32,Hm=Cm.s0_256,Wm=Cm.s1_256,Jm=Cm.g0_256,Xm=Cm.g1_256,Ym=Im.BlockHash,Qm=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function tp(){if(!(this instanceof tp))return new tp;Ym.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Qm,this.W=new Array(64)}Sm.inherits(tp,Ym);var ep=tp;function rp(){if(!(this instanceof rp))return new rp;ep.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}tp.blockSize=512,tp.outSize=256,tp.hmacStrength=192,tp.padLength=64,tp.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=Gm(Xm(r[i-2]),r[i-7],Jm(r[i-15]),r[i-16]);var n=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4],u=this.h[5],l=this.h[6],f=this.h[7];for(Mm(this.k.length===r.length),i=0;i<r.length;i++){var c=Vm(f,Wm(h),Zm(h,u,l),this.k[i],r[i]),d=qm(Hm(n),Km(n,o,s));f=l,l=u,u=h,h=qm(a,c),a=s,s=o,o=n,n=qm(c,d)}this.h[0]=qm(this.h[0],n),this.h[1]=qm(this.h[1],o),this.h[2]=qm(this.h[2],s),this.h[3]=qm(this.h[3],a),this.h[4]=qm(this.h[4],h),this.h[5]=qm(this.h[5],u),this.h[6]=qm(this.h[6],l),this.h[7]=qm(this.h[7],f)},tp.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h,"big"):Sm.split32(this.h,"big")},Sm.inherits(rp,ep);var ip=rp;rp.blockSize=512,rp.outSize=224,rp.hmacStrength=192,rp.padLength=64,rp.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h.slice(0,7),"big"):Sm.split32(this.h.slice(0,7),"big")};var np=Sm.rotr64_hi,op=Sm.rotr64_lo,sp=Sm.shr64_hi,ap=Sm.shr64_lo,hp=Sm.sum64,up=Sm.sum64_hi,lp=Sm.sum64_lo,fp=Sm.sum64_4_hi,cp=Sm.sum64_4_lo,dp=Sm.sum64_5_hi,mp=Sm.sum64_5_lo,pp=Im.BlockHash,gp=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function vp(){if(!(this instanceof vp))return new vp;pp.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=gp,this.W=new Array(160)}Sm.inherits(vp,pp);var yp=vp;function wp(t,e,r,i,n){var o=t&r^~t&n;return o<0&&(o+=4294967296),o}function Mp(t,e,r,i,n,o){var s=e&i^~e&o;return s<0&&(s+=4294967296),s}function bp(t,e,r,i,n){var o=t&r^t&n^r&n;return o<0&&(o+=4294967296),o}function Ep(t,e,r,i,n,o){var s=e&i^e&o^i&o;return s<0&&(s+=4294967296),s}function _p(t,e){var r=np(t,e,28)^np(e,t,2)^np(e,t,7);return r<0&&(r+=4294967296),r}function Np(t,e){var r=op(t,e,28)^op(e,t,2)^op(e,t,7);return r<0&&(r+=4294967296),r}function Ap(t,e){var r=np(t,e,14)^np(t,e,18)^np(e,t,9);return r<0&&(r+=4294967296),r}function Sp(t,e){var r=op(t,e,14)^op(t,e,18)^op(e,t,9);return r<0&&(r+=4294967296),r}function Rp(t,e){var r=np(t,e,1)^np(t,e,8)^sp(t,e,7);return r<0&&(r+=4294967296),r}function xp(t,e){var r=op(t,e,1)^op(t,e,8)^ap(t,e,7);return r<0&&(r+=4294967296),r}function Ip(t,e){var r=np(t,e,19)^np(e,t,29)^sp(t,e,6);return r<0&&(r+=4294967296),r}function kp(t,e){var r=op(t,e,19)^op(e,t,29)^ap(t,e,6);return r<0&&(r+=4294967296),r}function Tp(){if(!(this instanceof Tp))return new Tp;yp.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}vp.blockSize=1024,vp.outSize=512,vp.hmacStrength=192,vp.padLength=128,vp.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i<r.length;i+=2){var n=Ip(r[i-4],r[i-3]),o=kp(r[i-4],r[i-3]),s=r[i-14],a=r[i-13],h=Rp(r[i-30],r[i-29]),u=xp(r[i-30],r[i-29]),l=r[i-32],f=r[i-31];r[i]=fp(n,o,s,a,h,u,l,f),r[i+1]=cp(n,o,s,a,h,u,l,f)}},vp.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,i=this.h[0],n=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],h=this.h[5],u=this.h[6],l=this.h[7],f=this.h[8],c=this.h[9],d=this.h[10],m=this.h[11],p=this.h[12],g=this.h[13],v=this.h[14],y=this.h[15];Mm(this.k.length===r.length);for(var w=0;w<r.length;w+=2){var M=v,b=y,E=Ap(f,c),_=Sp(f,c),N=wp(f,c,d,m,p),A=Mp(f,c,d,m,p,g),S=this.k[w],R=this.k[w+1],x=r[w],I=r[w+1],k=dp(M,b,E,_,N,A,S,R,x,I),T=mp(M,b,E,_,N,A,S,R,x,I);M=_p(i,n),b=Np(i,n),E=bp(i,n,o,s,a),_=Ep(i,n,o,s,a,h);var O=up(M,b,E,_),P=lp(M,b,E,_);v=p,y=g,p=d,g=m,d=f,m=c,f=up(u,l,k,T),c=lp(l,l,k,T),u=a,l=h,a=o,h=s,o=i,s=n,i=up(k,T,O,P),n=lp(k,T,O,P)}hp(this.h,0,i,n),hp(this.h,2,o,s),hp(this.h,4,a,h),hp(this.h,6,u,l),hp(this.h,8,f,c),hp(this.h,10,d,m),hp(this.h,12,p,g),hp(this.h,14,v,y)},vp.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h,"big"):Sm.split32(this.h,"big")},Sm.inherits(Tp,yp);var Op=Tp;Tp.blockSize=1024,Tp.outSize=384,Tp.hmacStrength=192,Tp.padLength=128,Tp.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h.slice(0,12),"big"):Sm.split32(this.h.slice(0,12),"big")};var Pp={sha1:zm,sha224:ip,sha256:ep,sha384:Op,sha512:yp},Cp=Sm.rotl32,Up=Sm.sum32,Fp=Sm.sum32_3,Bp=Sm.sum32_4,Dp=Im.BlockHash;function Lp(){if(!(this instanceof Lp))return new Lp;Dp.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Sm.inherits(Lp,Dp);var $p=Lp;function jp(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function zp(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function qp(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}Lp.blockSize=512,Lp.outSize=160,Lp.hmacStrength=192,Lp.padLength=64,Lp.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],o=this.h[3],s=this.h[4],a=r,h=i,u=n,l=o,f=s,c=0;c<80;c++){var d=Up(Cp(Bp(r,jp(c,i,n,o),t[Gp[c]+e],zp(c)),Zp[c]),s);r=s,s=o,o=Cp(n,10),n=i,i=d,d=Up(Cp(Bp(a,jp(79-c,h,u,l),t[Vp[c]+e],qp(c)),Kp[c]),f),a=f,f=l,l=Cp(u,10),u=h,h=d}d=Fp(this.h[1],n,l),this.h[1]=Fp(this.h[2],o,f),this.h[2]=Fp(this.h[3],s,a),this.h[3]=Fp(this.h[4],r,h),this.h[4]=Fp(this.h[0],i,u),this.h[0]=d},Lp.prototype._digest=function(t){return"hex"===t?Sm.toHex32(this.h,"little"):Sm.split32(this.h,"little")};var Gp=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Vp=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Zp=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Kp=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Hp={ripemd160:$p};function Wp(t,e,r){if(!(this instanceof Wp))return new Wp(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(Sm.toArray(e,r))}var Jp=Wp;Wp.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),Mm(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},Wp.prototype.update=function(t,e){return this.inner.update(t,e),this},Wp.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};var Xp=a((function(t,e){var r=e;r.utils=Sm,r.common=Im,r.sha=Pp,r.ripemd=Hp,r.hmac=Jp,r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160}));let Yp=!1,Qp=!1;const tg={debug:1,default:2,info:2,warning:3,error:4,off:5};let eg=tg.default,rg=null;const ig=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var ng,og;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(ng||(ng={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(og||(og={}));class sg{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==tg[r]&&this.throwArgumentError("invalid log level name","logLevel",t),eg>tg[r]||console.log.apply(console,e)}debug(...t){this._log(sg.levels.DEBUG,t)}info(...t){this._log(sg.levels.INFO,t)}warn(...t){this._log(sg.levels.WARNING,t)}makeError(t,e,r){if(Qp)return this.makeError("censored error",e,{});e||(e=sg.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,sg.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){ig&&this.throwError("platform missing String.prototype.normalize",sg.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ig})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,sg.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,sg.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,sg.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,sg.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",sg.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",sg.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",sg.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return rg||(rg=new sg("logger/5.3.0")),rg}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",sg.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Yp){if(!t)return;this.globalLogger().throwError("error censorship permanent",sg.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Qp=!!t,Yp=!!e}static setLogLevel(t){const e=tg[t.toLowerCase()];null!=e?eg=e:sg.globalLogger().warn("invalid log level - "+t)}static from(t){return new sg(t)}}sg.errors=og,sg.levels=ng;const ag=new sg("bytes/5.3.0");function hg(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return hg(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function ug(t,e){if(e||(e={}),"number"==typeof t){ag.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),hg(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),function(t){return!!t.toHexString}(t)&&(t=t.toHexString()),function(t,e){if("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))return!1;if(e&&t.length!==2+2*e)return!1;return!0}(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":ag.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return hg(new Uint8Array(i))}return function(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}(t)?hg(new Uint8Array(t)):ag.throwArgumentError("invalid arrayify value","value",t)}new sg("sha2/5.3.0");function lg(t){return"0x"+Xp.sha256().update(ug(t)).digest("hex")}function fg(t){t=qc(t);let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}var cg=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};function dg(t,e){return cg(this,void 0,void 0,(function*(){null==e&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0,mode:"cors",cache:"no-cache",credentials:"same-origin",redirect:"follow",referrer:"client"},i=yield fetch(t,r),n=yield i.arrayBuffer(),o={};return i.headers.forEach?i.headers.forEach((t,e)=>{o[e.toLowerCase()]=t}):i.headers.keys().forEach(t=>{o[t.toLowerCase()]=i.headers.get(t)}),{headers:o,statusCode:i.status,statusMessage:i.statusText,body:qc(new Uint8Array(n))}}))}var mg=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const pg=new mc("web/5.3.0");function gg(t){return new Promise(e=>{setTimeout(e,t)})}function vg(t,e){if(null==t)return null;if("string"==typeof t)return t;if(jc(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return wd(t)}catch(t){}return Kc(t)}return t}function yg(t,e,r){let i=null;if(null!=e){i=vd(e);const r="string"==typeof t?{url:t}:tm(t);if(r.headers){0!==Object.keys(r.headers).filter(t=>"content-type"===t.toLowerCase()).length||(r.headers=tm(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};t=r}return function(t,e,r){const i="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;pg.assertArgument(i>0&&i%1==0,"invalid connection throttle limit","connection.throttleLimit",i);const n="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;pg.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s={};let a=null;const h={method:"GET"};let u=!1,l=12e4;if("string"==typeof t)a=t;else if("object"==typeof t){if(null!=t&&null!=t.url||pg.throwArgumentError("missing URL","connection.url",t),a=t.url,"number"==typeof t.timeout&&t.timeout>0&&(l=t.timeout),t.headers)for(const e in t.headers)s[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(u=!0);if(h.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==a.substring(0,6)&&!0!==t.allowInsecureAuthentication&&pg.throwError("basic authentication requires a secure https url",mc.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;s.authorization={key:"Authorization",value:"Basic "+fg(vd(e))}}}e&&(h.method="POST",h.body=e,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(e.length)}));const f={};Object.keys(s).forEach(t=>{const e=s[t];f[e.key]=e.value}),h.headers=f;const c=function(){let t=null;return{promise:new Promise((function(e,r){l&&(t=setTimeout(()=>{null!=t&&(t=null,r(pg.makeError("timeout",mc.errors.TIMEOUT,{requestBody:vg(h.body,f["content-type"]),requestMethod:h.method,timeout:l,url:a})))},l))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),d=function(){return mg(this,void 0,void 0,(function*(){for(let t=0;t<i;t++){let e=null;try{if(e=yield dg(a,h),429===e.statusCode&&t<i){let r=!0;if(n&&(r=yield n(t,a)),r){let r=0;const i=e.headers["retry-after"];r="string"==typeof i&&i.match(/^[1-9][0-9]*$/)?1e3*parseInt(i):o*parseInt(String(Math.random()*Math.pow(2,t))),yield gg(r);continue}}}catch(t){e=t.response,null==e&&(c.cancel(),pg.throwError("missing response",mc.errors.SERVER_ERROR,{requestBody:vg(h.body,f["content-type"]),requestMethod:h.method,serverError:t,url:a}))}let s=e.body;if(u&&304===e.statusCode?s=null:(e.statusCode<200||e.statusCode>=300)&&(c.cancel(),pg.throwError("bad response",mc.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:vg(s,e.headers?e.headers["content-type"]:null),requestBody:vg(h.body,f["content-type"]),requestMethod:h.method,url:a})),r)try{const t=yield r(s,e);return c.cancel(),t}catch(r){if(r.throttleRetry&&t<i){let e=!0;if(n&&(e=yield n(t,a)),e){const e=o*parseInt(String(Math.random()*Math.pow(2,t)));yield gg(e);continue}}c.cancel(),pg.throwError("processing response error",mc.errors.SERVER_ERROR,{body:vg(s,e.headers?e.headers["content-type"]:null),error:r,requestBody:vg(h.body,f["content-type"]),requestMethod:h.method,url:a})}return c.cancel(),s}return pg.throwError("failed response",mc.errors.SERVER_ERROR,{requestBody:vg(h.body,f["content-type"]),requestMethod:h.method,url:a})}))}();return Promise.race([c.promise,d])}(t,i,(t,e)=>{let i=null;if(null!=t)try{i=JSON.parse(wd(t))}catch(e){pg.throwError("invalid JSON",mc.errors.SERVER_ERROR,{body:t,error:e})}return r&&(i=r(i,e)),i})}function wg(t,e){return e||(e={}),null==(e=tm(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(r,i){let n=null,o=!1;const s=()=>!o&&(o=!0,n&&clearTimeout(n),!0);e.timeout&&(n=setTimeout(()=>{s()&&i(new Error("timeout"))},e.timeout));const a=e.retryLimit;let h=0;!function n(){return t().then((function(t){if(void 0!==t)s()&&r(t);else if(e.oncePoll)e.oncePoll.once("poll",n);else if(e.onceBlock)e.onceBlock.once("block",n);else if(!o){if(h++,h>a)return void(s()&&i(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,h)));t<e.floor&&(t=e.floor),t>e.ceiling&&(t=e.ceiling),setTimeout(n,t)}return null}),(function(t){s()&&i(t)}))}()}))}for(var Mg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",bg={},Eg=0;Eg<Mg.length;Eg++){var _g=Mg.charAt(Eg);if(void 0!==bg[_g])throw new TypeError(_g+" is ambiguous");bg[_g]=Eg}function Ng(t){var e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function Ag(t){for(var e=1,r=0;r<t.length;++r){var i=t.charCodeAt(r);if(i<33||i>126)return"Invalid prefix ("+t+")";e=Ng(e)^i>>5}for(e=Ng(e),r=0;r<t.length;++r){var n=t.charCodeAt(r);e=Ng(e)^31&n}return e}function Sg(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),i=t.toUpperCase();if(t!==r&&t!==i)return"Mixed-case string "+t;var n=(t=r).lastIndexOf("1");if(-1===n)return"No separator character for "+t;if(0===n)return"Missing prefix for "+t;var o=t.slice(0,n),s=t.slice(n+1);if(s.length<6)return"Data too short";var a=Ag(o);if("string"==typeof a)return a;for(var h=[],u=0;u<s.length;++u){var l=s.charAt(u),f=bg[l];if(void 0===f)return"Unknown character "+l;a=Ng(a)^f,u+6>=s.length||h.push(f)}return 1!==a?"Invalid checksum for "+t:{prefix:o,words:h}}function Rg(t,e,r,i){for(var n=0,o=0,s=(1<<r)-1,a=[],h=0;h<t.length;++h)for(n=n<<e|t[h],o+=e;o>=r;)o-=r,a.push(n>>o&s);if(i)o>0&&a.push(n<<r-o&s);else{if(o>=e)return"Excess padding";if(n<<r-o&s)return"Non-zero padding"}return a}var xg={decodeUnsafe:function(){var t=Sg.apply(null,arguments);if("object"==typeof t)return t},decode:function(t){var e=Sg.apply(null,arguments);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,e,r){if(r=r||90,t.length+7+e.length>r)throw new TypeError("Exceeds length limit");var i=Ag(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var n=t+"1",o=0;o<e.length;++o){var s=e[o];if(s>>5!=0)throw new Error("Non 5-bit word");i=Ng(i)^s,n+=Mg.charAt(s)}for(o=0;o<6;++o)i=Ng(i);for(i^=1,o=0;o<6;++o){n+=Mg.charAt(i>>5*(5-o)&31)}return n},toWordsUnsafe:function(t){var e=Rg(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=Rg(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=Rg(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=Rg(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}};const Ig="providers/5.3.1";function kg(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var Tg=Og;function Og(t,e){if(!t)throw new Error(e||"Assertion failed")}Og.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Pg=kg((function(t,e){var r=e;function i(t){return 1===t.length?"0"+t:t}function n(t){for(var e="",r=0;r<t.length;r++)e+=i(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var i=0;i<t.length;i++)r[i]=0|t[i];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(i=0;i<t.length;i++){var n=t.charCodeAt(i),o=n>>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=i,r.toHex=n,r.encode=function(t,e){return"hex"===e?n(t):t}})),Cg=kg((function(t,e){var r=e;r.assert=Tg,r.toArray=Pg.toArray,r.zero2=Pg.zero2,r.toHex=Pg.toHex,r.encode=Pg.encode,r.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<<e+1,o=t.clone(),s=0;s<i.length;s++){var a,h=o.andln(n-1);o.isOdd()?(a=h>(n>>1)-1?(n>>1)-h:h,o.isubn(a)):a=0,i[s]=a,o.iushrn(1)}return i},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var s,a,h=t.andln(3)+n&3,u=e.andln(3)+o&3;3===h&&(h=-1),3===u&&(u=-1),s=0==(1&h)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==u?h:-h,r[0].push(s),a=0==(1&u)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==h?u:-u,r[1].push(a),2*n===s+1&&(n=1-n),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new Bc(t,"hex","le")}})),Ug=Cg.getNAF,Fg=Cg.getJSF,Bg=Cg.assert;function Dg(t,e){this.type=t,this.p=new Bc(e.p,16),this.red=e.prime?Bc.red(e.prime):Bc.mont(this.p),this.zero=new Bc(0).toRed(this.red),this.one=new Bc(1).toRed(this.red),this.two=new Bc(2).toRed(this.red),this.n=e.n&&new Bc(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.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 Lg=Dg;function $g(t,e){this.curve=t,this.type=e,this.precomputed=null}Dg.prototype.point=function(){throw new Error("Not implemented")},Dg.prototype.validate=function(){throw new Error("Not implemented")},Dg.prototype._fixedNafMul=function(t,e){Bg(t.precomputed);var r=t._getDoubles(),i=Ug(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,s,a=[];for(o=0;o<i.length;o+=r.step){s=0;for(var h=o+r.step-1;h>=o;h--)s=(s<<1)+i[h];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=n;f>0;f--){for(o=0;o<a.length;o++)(s=a[o])===f?l=l.mixedAdd(r.points[o]):s===-f&&(l=l.mixedAdd(r.points[o].neg()));u=u.add(l)}return u.toP()},Dg.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=Ug(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var h=0;a>=0&&0===o[a];a--)h++;if(a>=0&&h++,s=s.dblp(h),a<0)break;var u=o[a];Bg(0!==u),s="affine"===t.type?u>0?s.mixedAdd(n[u-1>>1]):s.mixedAdd(n[-u-1>>1].neg()):u>0?s.add(n[u-1>>1]):s.add(n[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},Dg.prototype._wnafMulAdd=function(t,e,r,i,n){var o,s,a,h=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o<i;o++){var c=(a=e[o])._getNAFPoints(t);h[o]=c.wnd,u[o]=c.points}for(o=i-1;o>=1;o-=2){var d=o-1,m=o;if(1===h[d]&&1===h[m]){var p=[e[d],null,null,e[m]];0===e[d].y.cmp(e[m].y)?(p[1]=e[d].add(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg())):0===e[d].y.cmp(e[m].y.redNeg())?(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].add(e[m].neg())):(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Fg(r[d],r[m]);for(f=Math.max(v[0].length,f),l[d]=new Array(f),l[m]=new Array(f),s=0;s<f;s++){var y=0|v[0][s],w=0|v[1][s];l[d][s]=g[3*(y+1)+(w+1)],l[m][s]=0,u[d]=p}}else l[d]=Ug(r[d],h[d],this._bitLength),l[m]=Ug(r[m],h[m],this._bitLength),f=Math.max(l[d].length,f),f=Math.max(l[m].length,f)}var M=this.jpoint(null,null,null),b=this._wnafT4;for(o=f;o>=0;o--){for(var E=0;o>=0;){var _=!0;for(s=0;s<i;s++)b[s]=0|l[s][o],0!==b[s]&&(_=!1);if(!_)break;E++,o--}if(o>=0&&E++,M=M.dblp(E),o<0)break;for(s=0;s<i;s++){var N=b[s];0!==N&&(N>0?a=u[s][N-1>>1]:N<0&&(a=u[s][-N-1>>1].neg()),M="affine"===a.type?M.mixedAdd(a):M.add(a))}}for(o=0;o<i;o++)u[o]=null;return n?M:M.toP()},Dg.BasePoint=$g,$g.prototype.eq=function(){throw new Error("Not implemented")},$g.prototype.validate=function(){return this.curve.validate(this)},Dg.prototype.decodePoint=function(t,e){t=Cg.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?Bg(t[t.length-1]%2==0):7===t[0]&&Bg(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},$g.prototype.encodeCompressed=function(t){return this.encode(t,!0)},$g.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},$g.prototype.encode=function(t,e){return Cg.encode(this._encode(e),t)},$g.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},$g.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},$g.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var o=0;o<t;o++)i=i.dbl();r.push(i)}return{step:t,points:r}},$g.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},$g.prototype._getBeta=function(){return null},$g.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var jg=kg((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),zg=Cg.assert;function qg(t){Lg.call(this,"short",t),this.a=new Bc(t.a,16).toRed(this.red),this.b=new Bc(t.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(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}jg(qg,Lg);var Gg=qg;function Vg(t,e,r,i){Lg.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new Bc(e,16),this.y=new Bc(r,16),i&&(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 Zg(t,e,r,i){Lg.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Bc(0)):(this.x=new Bc(e,16),this.y=new Bc(r,16),this.z=new Bc(i,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}qg.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new Bc(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new Bc(t.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(e))?r=n[0]:(r=n[1],zg(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new Bc(t.a,16),b:new Bc(t.b,16)}})):this._getEndoBasis(r)}}},qg.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:Bc.mont(t),r=new Bc(2).toRed(e).redInvm(),i=r.redNeg(),n=new Bc(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},qg.prototype._getEndoBasis=function(t){for(var e,r,i,n,o,s,a,h,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=t,c=this.n.clone(),d=new Bc(1),m=new Bc(0),p=new Bc(0),g=new Bc(1),v=0;0!==f.cmpn(0);){var y=c.div(f);h=c.sub(y.mul(f)),u=p.sub(y.mul(d));var w=g.sub(y.mul(m));if(!i&&h.cmp(l)<0)e=a.neg(),r=d,i=h.neg(),n=u;else if(i&&2==++v)break;a=h,c=f,f=h,p=d,d=u,g=m,m=w}o=h.neg(),s=u;var M=i.sqr().add(n.sqr());return o.sqr().add(s.sqr()).cmp(M)>=0&&(o=e,s=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:n},{a:o,b:s}]},qg.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=n.mul(r.a),a=o.mul(i.a),h=n.mul(r.b),u=o.mul(i.b);return{k1:t.sub(s).sub(a),k2:h.add(u).neg()}},qg.prototype.pointFromX=function(t,e){(t=new Bc(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},qg.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},qg.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],h=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),h=h.neg(!0)),i[2*o]=a,i[2*o+1]=h,n[2*o]=s.k1,n[2*o+1]=s.k2}for(var u=this._wnafMulAdd(1,i,n,2*o,r),l=0;l<2*o;l++)i[l]=null,n[l]=null;return u},jg(Vg,Lg.BasePoint),qg.prototype.point=function(t,e,r){return new Vg(this,t,e,r)},qg.prototype.pointFromJSON=function(t,e){return Vg.fromJSON(this,t,e)},Vg.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},Vg.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]},Vg.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(e){return t.point(e[0],e[1],r)}var o=e[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(n))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(n))}},i},Vg.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)+">"},Vg.prototype.isInfinity=function(){return this.inf},Vg.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Vg.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),s=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},Vg.prototype.getX=function(){return this.x.fromRed()},Vg.prototype.getY=function(){return this.y.fromRed()},Vg.prototype.mul=function(t){return t=new Bc(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Vg.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Vg.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Vg.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Vg.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},Vg.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},jg(Zg,Lg.BasePoint),qg.prototype.jpoint=function(t,e,r){return new Zg(this,t,e,r)},Zg.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},Zg.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Zg.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),h=o.redSub(s);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),f=i.redMul(u),c=h.redSqr().redIAdd(l).redISub(f).redISub(f),d=h.redMul(f.redISub(c)).redISub(o.redMul(l)),m=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(c,d,m)},Zg.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(i),a=n.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),u=h.redMul(s),l=r.redMul(h),f=a.redSqr().redIAdd(u).redISub(l).redISub(l),c=a.redMul(l.redISub(f)).redISub(n.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(f,c,d)},Zg.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,o=this.x,s=this.y,a=this.z,h=a.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var l=o.redSqr(),f=u.redSqr(),c=f.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(h)),m=o.redMul(f),p=d.redSqr().redISub(m.redAdd(m)),g=m.redISub(p),v=d.redMul(g);v=v.redIAdd(v).redISub(c);var y=u.redMul(a);e+1<t&&(h=h.redMul(c)),o=p,a=y,u=v}return this.curve.jpoint(o,u.redMul(n),a)},Zg.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Zg.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var a=i.redAdd(i).redIAdd(i),h=a.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=h,e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),f=this.y.redSqr(),c=f.redSqr(),d=this.x.redAdd(f).redSqr().redISub(l).redISub(c);d=d.redIAdd(d);var m=l.redAdd(l).redIAdd(l),p=m.redSqr(),g=c.redIAdd(c);g=(g=g.redIAdd(g)).redIAdd(g),t=p.redISub(d).redISub(d),e=m.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},Zg.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),h=a.redSqr().redISub(s).redISub(s);t=h;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),f=this.y.redSqr(),c=this.x.redMul(f),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var m=c.redIAdd(c),p=(m=m.redIAdd(m)).redAdd(m);t=d.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(l);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(m.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},Zg.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(n)),h=e.redAdd(e),u=(h=h.redIAdd(h)).redMul(s),l=a.redSqr().redISub(u.redAdd(u)),f=u.redISub(l),c=s.redSqr();c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=a.redMul(f).redISub(c),m=r.redAdd(r).redMul(i);return this.curve.jpoint(l,d,m)},Zg.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),o=n.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(i),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),h=i.redIAdd(i);h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var u=n.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(h),l=e.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.x.redMul(a).redISub(l);f=(f=f.redIAdd(f)).redIAdd(f);var c=this.y.redMul(u.redMul(h.redISub(u)).redISub(s.redMul(a)));c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(f,c,d)},Zg.prototype.mul=function(t,e){return t=new Bc(t,e),this.curve._wnafMul(this,t)},Zg.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return 0===this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)},Zg.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},Zg.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)+">"},Zg.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Kg=kg((function(t,e){var r=e;r.base=Lg,r.short=Gg,r.mont=null,r.edwards=null})),Hg=kg((function(t,e){var r,i=e,n=Cg.assert;function o(t){"short"===t.type?this.curve=new Kg.short(t):"edwards"===t.type?this.curve=new Kg.edwards(t):this.curve=new Kg.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){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:Xp.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function Wg(t){if(!(this instanceof Wg))return new Wg(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Pg.toArray(t.entropy,t.entropyEnc||"hex"),r=Pg.toArray(t.nonce,t.nonceEnc||"hex"),i=Pg.toArray(t.pers,t.persEnc||"hex");Tg(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var Jg=Wg;Wg.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},Wg.prototype._hmac=function(){return new Xp.hmac(this.hash,this.K)},Wg.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},Wg.prototype.reseed=function(t,e,r,i){"string"!=typeof e&&(i=r,r=e,e=null),t=Pg.toArray(t,e),r=Pg.toArray(r,i),Tg(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Wg.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=Pg.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<t;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var o=n.slice(0,t);return this._update(r),this._reseed++,Pg.encode(o,e)};var Xg=Cg.assert;function Yg(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Qg=Yg;Yg.fromPublic=function(t,e,r){return e instanceof Yg?e:new Yg(t,{pub:e,pubEnc:r})},Yg.fromPrivate=function(t,e,r){return e instanceof Yg?e:new Yg(t,{priv:e,privEnc:r})},Yg.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},Yg.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Yg.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},Yg.prototype._importPrivate=function(t,e){this.priv=new Bc(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Yg.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?Xg(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Xg(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},Yg.prototype.derive=function(t){return t.validate()||Xg(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Yg.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Yg.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Yg.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var tv=Cg.assert;function ev(t,e){if(t instanceof ev)return t;this._importDER(t,e)||(tv(t.r&&t.s,"Signature without r or s"),this.r=new Bc(t.r,16),this.s=new Bc(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var rv=ev;function iv(){this.place=0}function nv(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,s=e.place;o<i;o++,s++)n<<=8,n|=t[s],n>>>=0;return!(n<=127)&&(e.place=s,n)}function ov(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function sv(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}ev.prototype._importDER=function(t,e){t=Cg.toArray(t,e);var r=new iv;if(48!==t[r.place++])return!1;var i=nv(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=nv(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var s=nv(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.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 Bc(o),this.s=new Bc(a),this.recoveryParam=null,!0},ev.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=ov(e),r=ov(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];sv(i,e.length),(i=i.concat(e)).push(2),sv(i,r.length);var n=i.concat(r),o=[48];return sv(o,n.length),o=o.concat(n),Cg.encode(o,t)};var av=function(){throw new Error("unsupported")},hv=Cg.assert;function uv(t){if(!(this instanceof uv))return new uv(t);"string"==typeof t&&(hv(Object.prototype.hasOwnProperty.call(Hg,t),"Unknown curve "+t),t=Hg[t]),t instanceof Hg.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var lv=uv;uv.prototype.keyPair=function(t){return new Qg(this,t)},uv.prototype.keyFromPrivate=function(t,e){return Qg.fromPrivate(this,t,e)},uv.prototype.keyFromPublic=function(t,e){return Qg.fromPublic(this,t,e)},uv.prototype.genKeyPair=function(t){t||(t={});for(var e=new Jg({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||av(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new Bc(2));;){var n=new Bc(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},uv.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},uv.prototype.sign=function(t,e,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new Bc(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),s=t.toArray("be",n),a=new Jg({hash:this.hash,entropy:o,nonce:s,pers:i.pers,persEnc:i.persEnc||"utf8"}),h=this.n.sub(new Bc(1)),u=0;;u++){var l=i.k?i.k(u):new Bc(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var f=this.g.mul(l);if(!f.isInfinity()){var c=f.getX(),d=c.umod(this.n);if(0!==d.cmpn(0)){var m=l.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var p=(f.getY().isOdd()?1:0)|(0!==c.cmp(d)?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),p^=1),new rv({r:d,s:m,recoveryParam:p})}}}}}},uv.prototype.verify=function(t,e,r,i){t=this._truncateToN(new Bc(t,16)),r=this.keyFromPublic(r,i);var n=(e=new rv(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.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),h=a.mul(t).umod(this.n),u=a.mul(n).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(h,r.getPublic(),u)).isInfinity()&&s.eqXToP(n):!(s=this.g.mulAdd(h,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(n)},uv.prototype.recoverPubKey=function(t,e,r,i){hv((3&r)===r,"The recovery param is more than two bits"),e=new rv(e,i);var n=this.n,o=new Bc(t),s=e.r,a=e.s,h=1&r,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");s=u?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var l=e.r.invm(n),f=n.sub(o).mul(l).umod(n),c=a.mul(l).umod(n);return this.g.mulAdd(f,s,c)},uv.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new rv(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var fv=kg((function(t,e){var r=e;r.version="6.5.4",r.utils=Cg,r.rand=function(){throw new Error("unsupported")},r.curve=Kg,r.curves=Hg,r.ec=lv,r.eddsa=null})).ec;const cv=new mc("signing-key/5.3.0");let dv=null;function mv(){return dv||(dv=new fv("secp256k1")),dv}class pv{constructor(t){Xd(this,"curve","secp256k1"),Xd(this,"privateKey",Kc(t));const e=mv().keyFromPrivate(qc(this.privateKey));Xd(this,"publicKey","0x"+e.getPublic(!1,"hex")),Xd(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Xd(this,"_isSigningKey",!0)}_addPoint(t){const e=mv().keyFromPublic(qc(this.publicKey)),r=mv().keyFromPublic(qc(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=mv().keyFromPrivate(qc(this.privateKey)),r=qc(t);32!==r.length&&cv.throwArgumentError("bad digest length","digest",t);const i=e.sign(r,{canonical:!0});return Qc({recoveryParam:i.recoveryParam,r:Yc("0x"+i.r.toString(16),32),s:Yc("0x"+i.s.toString(16),32)})}computeSharedSecret(t){const e=mv().keyFromPrivate(qc(this.privateKey)),r=mv().keyFromPublic(qc(gv(t)));return Yc("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function gv(t,e){const r=qc(t);if(32===r.length){const t=new pv(r);return e?"0x"+mv().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?Kc(r):"0x"+mv().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+mv().keyFromPublic(r).getPublic(!0,"hex"):Kc(r):cv.throwArgumentError("invalid public or private key","key","[REDACTED]")}const vv=new mc("transactions/5.3.0");function yv(t){return"0x"===t?null:Hd(t)}function wv(t){return"0x"===t?ud:nd.from(t)}function Mv(t,e){return function(t){return Hd(Wc(ld(Wc(gv(t),1)),12))}(function(t,e){const r=Qc(e),i={r:qc(r.r),s:qc(r.s)};return"0x"+mv().recoverPubKey(qc(t),i,r.recoveryParam).encode("hex",!1)}(qc(t),e))}function bv(t,e){const r=Vc(nd.from(t).toHexString());return r.length>32&&vv.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Ev(t,e){return{address:Hd(t),storageKeys:(e||[]).map((e,r)=>(32!==Hc(e)&&vv.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase()))}}function _v(t){if(Array.isArray(t))return t.map((t,e)=>Array.isArray(t)?(t.length>2&&vv.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),Ev(t[0],t[1])):Ev(t.address,t.storageKeys));const e=Object.keys(t).map(e=>{const r=t[e].reduce((t,e)=>(t[e]=!0,t),{});return Ev(e,Object.keys(r).sort())});return e.sort((t,e)=>t.address.localeCompare(e.address)),e}function Nv(t){const e=qd(t.slice(1));8!==e.length&&11!==e.length&&vv.throwArgumentError("invalid component count for transaction type: 1","payload",Kc(t));const r={type:1,chainId:wv(e[0]).toNumber(),nonce:wv(e[1]).toNumber(),gasPrice:wv(e[2]),gasLimit:wv(e[3]),to:yv(e[4]),value:wv(e[5]),data:e[6],accessList:_v(e[7])};if(8===e.length)return r;try{const t=wv(e[8]).toNumber();if(0!==t&&1!==t)throw new Error("bad recid");r.v=t}catch(t){vv.throwArgumentError("invalid v for transaction type: 1","v",e[8])}r.r=Yc(e[9],32),r.s=Yc(e[10],32);try{const t=ld(function(t,e){const r=[bv(t.chainId||0,"chainId"),bv(t.nonce||0,"nonce"),bv(t.gasPrice||0,"gasPrice"),bv(t.gasLimit||0,"gasLimit"),null!=t.to?Hd(t.to):"0x",bv(t.value||0,"value"),t.data||"0x",(i=t.accessList||[],_v(i).map(t=>[t.address,t.storageKeys]))];var i;if(e){const t=Qc(e);r.push(bv(t.recoveryParam,"recoveryParam")),r.push(Vc(t.r)),r.push(Vc(t.s))}return Jc(["0x01",$d(r)])}(r));r.from=Mv(t,{r:r.r,s:r.s,recoveryParam:r.v})}catch(t){console.log(t)}return r.hash=ld(t),r}function Av(t){const e=qc(t);if(e[0]>127)return function(t){const e=qd(t);9!==e.length&&6!==e.length&&vv.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:wv(e[0]).toNumber(),gasPrice:wv(e[1]),gasLimit:wv(e[2]),to:yv(e[3]),value:wv(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=nd.from(e[6]).toNumber()}catch(t){return console.log(t),r}if(r.r=Yc(e[7],32),r.s=Yc(e[8],32),nd.from(r.r).isZero()&&nd.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 i=r.v-27;const n=e.slice(0,6);0!==r.chainId&&(n.push(Kc(r.chainId)),n.push("0x"),n.push("0x"),i-=2*r.chainId+8);const o=ld($d(n));try{r.from=Mv(o,{r:Kc(r.r),s:Kc(r.s),recoveryParam:i})}catch(t){console.log(t)}r.hash=ld(t)}return r.type=null,r}(e);switch(e[0]){case 1:return Nv(e)}return vv.throwError("unsupported transaction type: "+e[0],mc.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const Sv=new mc(Ig);class Rv{constructor(){Sv.checkNew(new.target,Rv),this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),n=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),a=this.number.bind(this);return t.transaction={hash:o,type:Rv.allowNull(a,null),accessList:Rv.allowNull(this.accessList.bind(this),null),blockHash:Rv.allowNull(o,null),blockNumber:Rv.allowNull(a,null),transactionIndex:Rv.allowNull(a,null),confirmations:Rv.allowNull(a,null),from:e,gasPrice:r,gasLimit:r,to:Rv.allowNull(e,null),value:r,nonce:a,data:n,r:Rv.allowNull(this.uint256),s:Rv.allowNull(this.uint256),v:Rv.allowNull(a),creates:Rv.allowNull(e,null),raw:Rv.allowNull(n)},t.transactionRequest={from:Rv.allowNull(e),nonce:Rv.allowNull(a),gasLimit:Rv.allowNull(r),gasPrice:Rv.allowNull(r),to:Rv.allowNull(e),value:Rv.allowNull(r),data:Rv.allowNull(t=>this.data(t,!0)),type:Rv.allowNull(a),accessList:Rv.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:e,topics:Rv.arrayOf(o),data:n,logIndex:a,blockHash:o},t.receipt={to:Rv.allowNull(this.address,null),from:Rv.allowNull(this.address,null),contractAddress:Rv.allowNull(e,null),transactionIndex:a,root:Rv.allowNull(s),gasUsed:r,logsBloom:Rv.allowNull(n),blockHash:o,transactionHash:o,logs:Rv.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Rv.allowNull(a,null),cumulativeGasUsed:r,status:Rv.allowNull(a)},t.block={hash:o,parentHash:o,number:a,timestamp:a,nonce:Rv.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:e,extraData:n,transactions:Rv.allowNull(Rv.arrayOf(o))},t.blockWithTransactions=tm(t.block),t.blockWithTransactions.transactions=Rv.allowNull(Rv.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Rv.allowNull(i,void 0),toBlock:Rv.allowNull(i,void 0),blockHash:Rv.allowNull(o,void 0),address:Rv.allowNull(e,void 0),topics:Rv.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Rv.allowNull(a),blockHash:Rv.allowNull(o),transactionIndex:a,removed:Rv.allowNull(this.boolean.bind(this)),address:e,data:Rv.allowFalsish(n,"0x"),topics:Rv.arrayOf(o),transactionHash:o,logIndex:a},t}accessList(t){return _v(t||[])}number(t){return"0x"===t?0:nd.from(t).toNumber()}bigNumber(t){return nd.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),Zc(t))?t.toLowerCase():Sv.throwArgumentError("invalid hash","value",t)}data(t,e){const r=this.hex(t,e);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+t);return r}address(t){return Hd(t)}callAddress(t){if(!Zc(t,32))return null;const e=Hd(Wc(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e}contractAddress(t){return function(t){let e=null;try{e=Hd(t.from)}catch(e){Gd.throwArgumentError("missing from address","transaction",t)}return Hd(Wc(ld($d([e,Vc(qc(nd.from(t.nonce).toHexString()))])),12))}(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"==typeof t||Zc(t))return Xc(t);throw new Error("invalid blockTag")}hash(t,e){const r=this.hex(t,e);return 32!==Hc(r)?Sv.throwArgumentError("invalid hash","value",t):r}difficulty(t){if(null==t)return null;const e=nd.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!Zc(t))throw new Error("invalid uint256");return Yc(t,32)}_block(t,e){return null!=t.author&&null==t.miner&&(t.miner=t.author),Rv.check(e,t)}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Rv.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&nd.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1===t.type&&null==t.accessList&&(t.accessList=[]);const e=Rv.check(this.formats.transaction,t);if(null!=t.chainId){let r=t.chainId;Zc(r)&&(r=nd.from(r).toNumber()),e.chainId=r}else{let r=t.networkId;null==r&&null==e.v&&(r=t.chainId),Zc(r)&&(r=nd.from(r).toNumber()),"number"!=typeof r&&null!=e.v&&(r=(e.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),e.chainId=r}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return Av(t)}receiptLog(t){return Rv.check(this.formats.receiptLog,t)}receipt(t){const e=Rv.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=nd.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&Sv.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):Sv.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&Sv.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map(t=>this.topics(t)):null!=t?this.hash(t,!0):null}filter(t){return Rv.check(this.formats.filter,t)}filterLog(t){return Rv.check(this.formats.filterLog,t)}static check(t,e){const r={};for(const i in t)try{const n=t[i](e[i]);void 0!==n&&(r[i]=n)}catch(t){throw t.checkKey=i,t.checkValue=e[i],t}return r}static allowNull(t,e){return function(r){return null==r?e:t(r)}}static allowFalsish(t,e){return function(r){return r?t(r):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const r=[];return e.forEach((function(e){r.push(t(e))})),r}}}var xv=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Iv=new mc(Ig);function kv(t){return null==t?"null":(32!==Hc(t)&&Iv.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Tv(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map(t=>{if(Array.isArray(t)){const e={};t.forEach(t=>{e[kv(t)]=!0});const r=Object.keys(e);return r.sort(),r.join("|")}return kv(t)}).join("&")}function Ov(t){if("string"==typeof t){if(32===Hc(t=t.toLowerCase()))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+Tv(t);if(class extends class{constructor(t){for(const e in t)this[e]=Da(t[e])}}{static isForkEvent(t){return!(!t||!t._isForkEvent)}}.isForkEvent(t))throw Iv.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+Tv(t.topics||[])}throw new Error("invalid event - "+t)}function Pv(){return(new Date).getTime()}function Cv(t){return new Promise(e=>{setTimeout(e,t)})}const Uv=["block","network","pending","poll"];class Fv{constructor(t,e,r){Xd(this,"tag",t),Xd(this,"listener",e),Xd(this,"once",r)}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 t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],r=""===(i=t[2])?[]:i.split(/&/g).map(t=>{if(""===t)return[];const e=t.split("|").map(t=>"null"===t?null:t);return 1===e.length?e[0]:e});var i;const n={};return r.length>0&&(n.topics=r),e&&"*"!==e&&(n.address=e),n}pollable(){return this.tag.indexOf(":")>=0||Uv.indexOf(this.tag)>=0}}const Bv={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 Dv(t){return Yc(nd.from(t).toHexString(),32)}function Lv(t){return Fc.encode(Gc([t,Wc(lg(lg(t)),0,4)]))}class $v{constructor(t,e,r){Xd(this,"provider",t),Xd(this,"name",r),Xd(this,"address",t.formatter.address(e))}_fetchBytes(t,e){return xv(this,void 0,void 0,(function*(){const r={to:this.address,data:Jc([t,Fd(this.name),e||"0x"])},i=yield this.provider.call(r);if("0x"===i)return null;const n=nd.from(Wc(i,0,32)).toNumber(),o=nd.from(Wc(i,n,n+32)).toNumber();return Wc(i,n+32,n+32+o)}))}_getAddress(t,e){const r=Bv[String(t)];if(null==r&&Iv.throwError("unsupported coin type: "+t,mc.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===r.ilk)return this.provider.formatter.address(e);const i=qc(e);if(null!=r.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return Lv(Gc([[r.p2pkh],"0x"+t[2]]))}}if(null!=r.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return Lv(Gc([[r.p2sh],"0x"+t[2]]))}}if(null!=r.prefix){const t=i[1];let e=i[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&i.length===2+t&&t>=1&&t<=75){const t=xg.toWords(i.slice(2));return t.unshift(e),xg.encode(r.prefix,t)}}return null}getAddress(t){return xv(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t){const t={to:this.address,data:"0x3b3b57de"+Fd(this.name).substring(2)},e=yield this.provider.call(t);return"0x"===e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e?null:this.provider.formatter.callAddress(e)}const e=yield this._fetchBytes("0xf1cb7e06",Dv(t));if(null==e||"0x"===e)return null;const r=this._getAddress(t,e);return null==r&&Iv.throwError("invalid or unsupported coin data",mc.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),r}))}getContentHash(){return xv(this,void 0,void 0,(function*(){const t=yield this._fetchBytes("0xbc1c58d1");if(null==t||"0x"===t)return null;const e=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(e){const t=parseInt(e[3],16);if(e[4].length===2*t)return"ipfs://"+Fc.encode("0x"+e[1])}const r=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);return r&&64===r[1].length?"bzz://"+r[1]:Iv.throwError("invalid or unsupported content hash data",mc.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return xv(this,void 0,void 0,(function*(){let e=vd(t);e=Gc([Dv(64),Dv(e.length),e]),e.length%32!=0&&(e=Gc([e,Yc("0x",32-t.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",Kc(e));return null==r||"0x"===r?null:wd(r)}))}}let jv=null,zv=1;class qv extends $a{constructor(t){if(Iv.checkNew(new.target,$a),super(),this._events=[],this._emitted={block:-2},this.formatter=new.target.getFormatter(),Xd(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch(t=>{}),this._ready().catch(t=>{});else{const e=Yd(new.target,"getNetwork")(t);e?(Xd(this,"_network",e),this.emit("network",e,null)):Iv.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return xv(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||Iv.throwError("no network detected",mc.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:Xd(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return wg(()=>this._ready().then(t=>t,t=>{if(t.code!==mc.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))}static getFormatter(){return null==jv&&(jv=new Rv),jv}static getNetwork(t){return function(t){if(null==t)return null;if("number"==typeof t){for(const e in bc){const r=bc[e];if(r.chainId===t)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=bc[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=bc[t.name];if(!e)return"number"!=typeof t.chainId&&pc.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&pc.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;var i;return null==r&&e._defaultProvider&&(r=(i=e._defaultProvider)&&"function"==typeof i.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}(null==t?"homestead":t)}_getInternalBlockNumber(t){return xv(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const r=yield e;if(Pv()-r.respTime<=t)return r.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=Pv(),r=Qd({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(t=>null,t=>t)}).then(({blockNumber:t,networkError:i})=>{if(i)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),i;const n=Pv();return(t=nd.from(t).toNumber())<this._maxInternalBlockNumber&&(t=this._maxInternalBlockNumber),this._maxInternalBlockNumber=t,this._setFastBlockNumber(t),{blockNumber:t,reqTime:e,respTime:n}});return this._internalBlockNumber=r,r.catch(t=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber}))}poll(){return xv(this,void 0,void 0,(function*(){const t=zv++,e=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(r),this.emit("poll",t,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Iv.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Iv.makeError("network block skew detected",mc.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let t=this._emitted.block+1;t<=r;t++)this.emit("block",t);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&r-e>12&&delete this._emitted[t]})),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach(t=>{switch(t.type){case"tx":{const r=t.hash;let i=this.getTransactionReceipt(r).then(t=>t&&null!=t.blockNumber?(this._emitted["t:"+r]=t.blockNumber,this.emit(r,t),null):null).catch(t=>{this.emit("error",t)});e.push(i);break}case"filter":{const i=t.filter;i.fromBlock=this._lastBlockNumber+1,i.toBlock=r;const n=this.getLogs(i).then(t=>{0!==t.length&&t.forEach(t=>{this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(i,t)})}).catch(t=>{this.emit("error",t)});e.push(n);break}}}),this._lastBlockNumber=r,Promise.all(e).then(()=>{this.emit("didPoll",t)}).catch(t=>{this.emit("error",t)})}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return xv(this,void 0,void 0,(function*(){return Iv.throwError("provider does not support network detection",mc.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return xv(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,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",e,t),yield Cv(0),this._network;const r=Iv.makeError("underlying network changed",mc.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",r),r}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(t=>{this._setFastBlockNumber(t)},t=>{}),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!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))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const t=Pv();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then(t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&t<this._fastBlockNumber||(this._fastQueryDate=Pv(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,r){return xv(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,r||0,null)}))}_waitForTransaction(t,e,r,i){return xv(this,void 0,void 0,(function*(){const n=yield this.getTransactionReceipt(t);return(n?n.confirmations:0)>=e?n:new Promise((n,o)=>{const s=[];let a=!1;const h=function(){return!!a||(a=!0,s.forEach(t=>{t()}),!1)},u=t=>{t.confirmations<e||h()||n(t)};if(this.on(t,u),s.push(()=>{this.removeListener(t,u)}),i){let r=i.startBlock,n=null;const u=s=>xv(this,void 0,void 0,(function*(){a||(yield Cv(1e3),this.getTransactionCount(i.from).then(l=>xv(this,void 0,void 0,(function*(){if(!a){if(l<=i.nonce)r=s;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==n&&(n=r-3,n<i.startBlock&&(n=i.startBlock));n<=s;){if(a)return;const r=yield this.getBlockWithTransactions(n);for(let n=0;n<r.transactions.length;n++){const s=r.transactions[n];if(s.hash===t)return;if(s.from===i.from&&s.nonce===i.nonce){if(a)return;const r=yield this.waitForTransaction(s.hash,e);if(h())return;let n="replaced";return s.data===i.data&&s.to===i.to&&s.value.eq(i.value)?n="repriced":"0x"===s.data&&s.from===s.to&&s.value.isZero()&&(n="cancelled"),void o(Iv.makeError("transaction was replaced",mc.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===n||"cancelled"===n,reason:n,replacement:this._wrapTransaction(s),hash:t,receipt:r}))}}n++}}a||this.once("block",u)}})),t=>{a||this.once("block",u)}))}));if(a)return;this.once("block",u),s.push(()=>{this.removeListener("block",u)})}if("number"==typeof r&&r>0){const t=setTimeout(()=>{h()||o(Iv.makeError("timeout exceeded",mc.errors.TIMEOUT,{timeout:r}))},r);t.unref&&t.unref(),s.push(()=>{clearTimeout(t)})}})}))}getBlockNumber(){return xv(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return nd.from(t)}catch(e){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Qd({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getBalance",r);try{return nd.from(i)}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:t})}}))}getTransactionCount(t,e){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Qd({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getTransactionCount",r);try{return nd.from(i).toNumber()}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:t})}}))}getCode(t,e){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Qd({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("getCode",r);try{return Kc(i)}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:t})}}))}getStorageAt(t,e,r){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const i=yield Qd({address:this._getAddress(t),blockTag:this._getBlockTag(r),position:Promise.resolve(e).then(t=>Xc(t))}),n=yield this.perform("getStorageAt",i);try{return Kc(n)}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:n,error:t})}}))}_wrapTransaction(t,e,r){if(null!=e&&32!==Hc(e))throw new Error("invalid response - sendTransaction");const i=t;return null!=e&&t.hash!==e&&Iv.throwError("Transaction hash mismatch from Provider.sendTransaction.",mc.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),i.wait=(e,i)=>xv(this,void 0,void 0,(function*(){null==e&&(e=1),null==i&&(i=0);let n=void 0;0!==e&&null!=r&&(n={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:r});const o=yield this._waitForTransaction(t.hash,e,i,n);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&Iv.throwError("transaction failed",mc.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),i}sendTransaction(t){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then(t=>Kc(t)),r=this.formatter.transaction(t),i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(r,t,i)}catch(t){throw t.transaction=r,t.transactionHash=r.hash,t}}))}_getTransactionRequest(t){return xv(this,void 0,void 0,(function*(){const e=yield t,r={};return["from","to"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?this._getAddress(t):null))}),["gasLimit","gasPrice","value"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?nd.from(t):null))}),["type"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>null!=t?t:null))}),e.accessList&&(r.accessList=this.formatter.accessList(e.accessList)),["data"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?Kc(t):null))}),this.formatter.transactionRequest(yield Qd(r))}))}_getFilter(t){return xv(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach(r=>{null!=t[r]&&(e[r]=t[r])}),["fromBlock","toBlock"].forEach(r=>{null!=t[r]&&(e[r]=this._getBlockTag(t[r]))}),this.formatter.filter(yield Qd(e))}))}call(t,e){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Qd({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(e)}),i=yield this.perform("call",r);try{return Kc(i)}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"call",params:r,result:i,error:t})}}))}estimateGas(t){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Qd({transaction:this._getTransactionRequest(t)}),r=yield this.perform("estimateGas",e);try{return nd.from(r)}catch(t){return Iv.throwError("bad result from backend",mc.errors.SERVER_ERROR,{method:"estimateGas",params:e,result:r,error:t})}}))}_getAddress(t){return xv(this,void 0,void 0,(function*(){const e=yield this.resolveName(t);return null==e&&Iv.throwError("ENS name not configured",mc.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),e}))}_getBlock(t,e){return xv(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;let r=-128;const i={includeTransactions:!!e};if(Zc(t,32))i.blockHash=t;else try{i.blockTag=this.formatter.blockTag(yield this._getBlockTag(t)),Zc(i.blockTag)&&(r=parseInt(i.blockTag.substring(2),16))}catch(e){Iv.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return wg(()=>xv(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",i);if(null==t)return null!=i.blockHash&&null==this._emitted["b:"+i.blockHash]||null!=i.blockTag&&r>this._emitted.block?null:void 0;if(e){let e=null;for(let r=0;r<t.transactions.length;r++){const i=t.transactions[r];if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){null==e&&(e=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let t=e-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}}return this.formatter.blockWithTransactions(t)}return this.formatter.block(t)})),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return xv(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return wg(()=>xv(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;const i=this.formatter.transactionResponse(r);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}return this._wrapTransaction(i)})),{oncePoll:this})}))}getTransactionReceipt(t){return xv(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return wg(()=>xv(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;if(null==r.blockHash)return;const i=this.formatter.receipt(r);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;t<=0&&(t=1),i.confirmations=t}return i})),{oncePoll:this})}))}getLogs(t){return xv(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Qd({filter:this._getFilter(t)}),r=yield this.perform("getLogs",e);return r.forEach(t=>{null==t.removed&&(t.removed=!1)}),Rv.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return xv(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return xv(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&Iv.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return xv(this,void 0,void 0,(function*(){const e=yield this._getResolver(t);return null==e?null:new $v(this,e,t)}))}_getResolver(t){return xv(this,void 0,void 0,(function*(){const e=yield this.getNetwork();e.ensAddress||Iv.throwError("network does not support ENS",mc.errors.UNSUPPORTED_OPERATION,{operation:"ENS",network:e.name});const r={to:e.ensAddress,data:"0x0178b8bf"+Fd(t).substring(2)};return this.formatter.callAddress(yield this.call(r))}))}resolveName(t){return xv(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if(Zc(t))throw e}"string"!=typeof t&&Iv.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return xv(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(e);if(!r)return null;let i=qc(yield this.call({to:r,data:"0x691f3431"+Fd(e).substring(2)}));if(i.length<32||!nd.from(i.slice(0,32)).eq(32))return null;if(i=i.slice(32),i.length<32)return null;const n=nd.from(i.slice(0,32)).toNumber();if(i=i.slice(32),n>i.length)return null;const o=wd(i.slice(0,n));return(yield this.resolveName(o))!=t?null:o}))}perform(t,e){return Iv.throwError(t+" not implemented",mc.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter(t=>t.pollable()).length>0}_stopEvent(t){this.polling=this._events.filter(t=>t.pollable()).length>0}_addEventListener(t,e,r){const i=new Fv(Ov(t),e,r);return this._events.push(i),this._startEvent(i),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let r=!1,i=[],n=Ov(t);return this._events=this._events.filter(t=>t.tag!==n||(setTimeout(()=>{t.listener.apply(this,e)},0),r=!0,!t.once||(i.push(t),!1))),i.forEach(t=>{this._stopEvent(t)}),r}listenerCount(t){if(!t)return this._events.length;let e=Ov(t);return this._events.filter(t=>t.tag===e).length}listeners(t){if(null==t)return this._events.map(t=>t.listener);let e=Ov(t);return this._events.filter(t=>t.tag===e).map(t=>t.listener)}off(t,e){if(null==e)return this.removeAllListeners(t);const r=[];let i=!1,n=Ov(t);return this._events=this._events.filter(t=>t.tag!==n||t.listener!=e||(!!i||(i=!0,r.push(t),!1))),r.forEach(t=>{this._stopEvent(t)}),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const r=Ov(t);this._events=this._events.filter(t=>t.tag!==r||(e.push(t),!1))}return e.forEach(t=>{this._stopEvent(t)}),this}}var Gv=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const Vv=new mc(Ig),Zv=["call","estimateGas"];function Kv(t,e,r){if("call"===t&&e.code===mc.errors.SERVER_ERROR){const t=e.error;if(t&&t.message.match("reverted")&&Zc(t.data))return t.data}let i=e.message;e.code===mc.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?i=e.error.message:"string"==typeof e.body?i=e.body:"string"==typeof e.responseText&&(i=e.responseText),i=(i||"").toLowerCase();const n=r.transaction||r.signedTransaction;throw i.match(/insufficient funds/)&&Vv.throwError("insufficient funds for intrinsic transaction cost",mc.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce too low/)&&Vv.throwError("nonce has already been used",mc.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced/)&&Vv.throwError("replacement fee too low",mc.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/)&&Vv.throwError("legacy pre-eip-155 transactions not supported",mc.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),Zv.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted/)&&Vv.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",mc.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Hv(t){return new Promise((function(e){setTimeout(e,t)}))}function Wv(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function Jv(t){return t?t.toLowerCase():t}const Xv={};class Yv extends ih{constructor(t,e,r){if(Vv.checkNew(new.target,Yv),super(),t!==Xv)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Xd(this,"provider",e),null==r&&(r=0),"string"==typeof r?(Xd(this,"_address",this.provider.formatter.address(r)),Xd(this,"_index",null)):"number"==typeof r?(Xd(this,"_index",r),Xd(this,"_address",null)):Vv.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(t){return Vv.throwError("cannot alter JSON-RPC Signer connection",mc.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Qv(Xv,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(t=>(t.length<=this._index&&Vv.throwError("unknown account #"+this._index,mc.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index])))}sendUncheckedTransaction(t){t=tm(t);const e=this.getAddress().then(t=>(t&&(t=t.toLowerCase()),t));if(null==t.gasLimit){const r=tm(t);r.from=e,t.gasLimit=this.provider.estimateGas(r)}return Qd({tx:Qd(t),sender:e}).then(({tx:e,sender:r})=>{null!=e.from?e.from.toLowerCase()!==r&&Vv.throwArgumentError("from address mismatch","transaction",t):e.from=r;const i=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[i]).then(t=>t,t=>Kv("sendTransaction",t,i))})}signTransaction(t){return Vv.throwError("signing transactions is unsupported",mc.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return Gv(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(t);try{return yield wg(()=>Gv(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(r);if(null!==t)return this.provider._wrapTransaction(t,r,e)})),{oncePoll:this.provider})}catch(t){throw t.transactionHash=r,t}}))}signMessage(t){return Gv(this,void 0,void 0,(function*(){const e="string"==typeof t?vd(t):t,r=yield this.getAddress();return yield this.provider.send("eth_sign",[r.toLowerCase(),Kc(e)])}))}_signTypedData(t,e,r){return Gv(this,void 0,void 0,(function*(){const i=yield wm.resolveNames(t,e,r,t=>this.provider.resolveName(t)),n=yield this.getAddress();return yield this.provider.send("eth_signTypedData_v4",[n.toLowerCase(),JSON.stringify(wm.getPayload(i.domain,e,i.value))])}))}unlock(t){return Gv(this,void 0,void 0,(function*(){const e=this.provider,r=yield this.getAddress();return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])}))}}class Qv extends Yv{sendTransaction(t){return this.sendUncheckedTransaction(t).then(t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)}))}}const ty={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0};class ey extends qv{constructor(t,e){Vv.checkNew(new.target,ey);let r=e;null==r&&(r=new Promise((t,e)=>{setTimeout(()=>{this.detectNetwork().then(e=>{t(e)},t=>{e(t)})},0)})),super(r),t||(t=Yd(this.constructor,"defaultUrl")()),Xd(this,"connection","string"==typeof t?Object.freeze({url:t}):Object.freeze(tm(t))),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 Gv(this,void 0,void 0,(function*(){yield Hv(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=Yd(this.constructor,"getNetwork");try{return e(nd.from(t).toNumber())}catch(e){return Vv.throwError("could not detect network",mc.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return Vv.throwError("could not detect network",mc.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new Yv(Xv,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(t=>t.map(t=>this.formatter.address(t)))}send(t,e){const r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:im(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(i&&this._cache[t])return this._cache[t];const n=yg(this.connection,JSON.stringify(r),Wv).then(t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t),t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t});return i&&(this._cache[t]=n,setTimeout(()=>{this._cache[t]=null},0)),n}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[Jv(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Jv(e.address),e.blockTag]];case"getCode":return["eth_getCode",[Jv(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Jv(e.address),e.position,e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[Yd(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[Yd(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=Jv(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return Gv(this,void 0,void 0,(function*(){const r=this.prepareRequest(t,e);null==r&&Vv.throwError(t+" not implemented",mc.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(r[0],r[1])}catch(r){return Kv(t,r,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(r){return function i(){t.send("eth_getFilterChanges",[r]).then((function(r){if(t._pendingFilter!=e)return null;let i=Promise.resolve();return r.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",i=i.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),i.then((function(){return Hv(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){i()}),0),null;t.send("eth_uninstallFilter",[r])})).catch(t=>{})}(),r})).catch(t=>{})}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const r=tm(ty);if(e)for(const t in e)e[t]&&(r[t]=!0);!function(t,e){t&&"object"==typeof t||Jd.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Jd.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}(t,r);const i={};return["gasLimit","gasPrice","type","nonce","value"].forEach((function(e){if(null==t[e])return;const r=Xc(t[e]);"gasLimit"===e&&(e="gas"),i[e]=r})),["from","to","data"].forEach((function(e){null!=t[e]&&(i[e]=Kc(t[e]))})),t.accessList&&(i.accessList=_v(t.accessList)),i}}var ry=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const iy=new mc(Ig);class ny extends ey{detectNetwork(){const t=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return ry(this,void 0,void 0,(function*(){let e=this.network;return null==e&&(e=yield t.detectNetwork.call(this),e||iy.throwError("no network detected",mc.errors.UNKNOWN_ERROR,{}),null==this._network&&(Xd(this,"_network",e),this.emit("network",e,null))),e}))}}var oy={1:{key:"1",name:"Ethereum Mainnet",chainId:1,network:"homestead",multicall:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",rpc:[{url:"https://api-geth-archive.ankr.com",user:"balancer_user",password:"balancerAnkr20201015"},"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive","https://apis.ankr.com/e62bc219f9c9462b8749defe472d2dc5/6106d4a3ec1d1bcc87ec72158f8fd089/eth/archive/main","https://eth-archival.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://eth-mainnet.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv","https://cloudflare-eth.com"],ws:["wss://eth-mainnet.ws.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],explorer:"https://etherscan.io"},3:{key:"3",name:"Ethereum Testnet Ropsten",shortName:"Ropsten",chainId:3,network:"ropsten",multicall:"0x53c43764255c17bd724f74c4ef150724ac50a3ed",rpc:["https://eth-ropsten.alchemyapi.io/v2/QzGz6gdkpTyDzebi3PjxIaKO7bDTGnSy"],explorer:"https://ropsten.etherscan.io"},4:{key:"4",name:"Ethereum Testnet Rinkeby",shortName:"Rinkeby",chainId:4,network:"rinkeby",multicall:"0x42ad527de7d4e9d9d011ac45b31d8551f8fe9821",rpc:["https://eth-rinkeby.alchemyapi.io/v2/ugiPEBqMebLQbjro42kalZ1h4StpW_fR","https://eth-rinkeby.gateway.pokt.network/v1/5f76124fb90218002e9ce985"],ws:["wss://eth-rinkeby.ws.alchemyapi.io/v2/twReQE9Px03E-E_N_Fbb3OVF7YgHxoGq"],explorer:"https://rinkeby.etherscan.io"},5:{key:"5",name:"Ethereum Testnet Görli",shortName:"Görli",chainId:5,network:"goerli",multicall:"0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e",rpc:["https://eth-goerli.alchemyapi.io/v2/v4nqH_J-J3STit45Mm07TxuYexMHQsYZ"],explorer:"https://goerli.etherscan.io"},7:{key:"7",name:"ThaiChain",chainId:7,network:"mainnet",multicall:"0xB9cb900E526e7Ad32A2f26f1fF6Dee63350fcDc5",rpc:["https://rpc.dome.cloud"],ws:["wss://ws.dome.cloud"],explorer:"https://exp.tch.in.th"},30:{key:"30",name:"RSK Mainnet",chainId:30,network:"rsk mainnet",multicall:"0x4eeebb5580769ba6d26bfd07be636300076d1831",rpc:["https://public-node.rsk.co"],explorer:"https://explorer.rsk.co"},31:{key:"31",name:"RSK Testnet",chainId:31,network:"rsk testnet",multicall:"0x4eeebb5580769ba6d26bfd07be636300076d1831",rpc:["https://public-node.testnet.rsk.co"],explorer:"https://explorer.testnet.rsk.co"},42:{key:"42",name:"Ethereum Testnet Kovan",shortName:"Kovan",chainId:42,network:"kovan",multicall:"0x2cc8688c5f75e365aaeeb4ea8d6a480405a48d2a",rpc:["https://eth-kovan.alchemyapi.io/v2/s96TIUFYg0LuddgpmafA040ZyUaZbrpM","https://poa-kovan.gateway.pokt.network/v1/5f76124fb90218002e9ce985"],ws:["wss://eth-kovan.ws.alchemyapi.io/v2/QCsM2iU0bQ49eGDmZ7-Y--Wpu0lVWXSO"],explorer:"https://kovan.etherscan.io"},50:{key:"50",name:"XinFin MainNet",shortName:"XDC",chainId:50,network:"mainnet",multicall:"",rpc:["https://rpc.xinfin.network"],ws:["wss://ws.xinfin.network"],explorer:"http://explorer.xinfin.network/"},56:{key:"56",name:"Binance Smart Chain Mainnet",shortName:"BSC",chainId:56,network:"mainnet",multicall:"0x1ee38d535d541c55c9dae27b12edf090c608e6fb",rpc:["https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive","https://apis.ankr.com/c0d871dd3c6d4529b01c9362a9b79e89/6106d4a3ec1d1bcc87ec72158f8fd089/binance/archive/main","https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7","https://bsc-private-dataseed1.nariox.org","https://bsc-private-dataseed2.nariox.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed1.binance.org","https://bsc-dataseed2.binance.org","https://bsc-dataseed3.binance.org"],explorer:"https://bscscan.com"},61:{key:"61",name:"Ethereum Classic Mainnet",shortName:"Ethereum Classic",chainId:61,network:"mainnet",multicall:"",rpc:["https://ethereumclassic.network"],explorer:"https://blockscout.com/etc/mainnet"},65:{key:"65",name:"OKExChain Testnet",shortName:"OEC Testnet",chainId:65,network:"oec testnet",multicall:"0x04c68A7fB750ca0Ba232105B3b094926a0f77645",rpc:["https://exchaintestrpc.okex.org"],ws:["wss://exchaintestws.okex.org:8443"],explorer:"https://www.oklink.com/okexchain-test"},66:{key:"66",name:"OKExChain Mainnet",shortName:"OEC Mainnet",chainId:66,network:"oec mainnet",multicall:"0x6EB187d8197Ac265c945b69f3c3064A6f3831866",rpc:["https://exchainrpc.okex.org"],ws:["wss://exchainws.okex.org:8443"],explorer:"https://www.oklink.com/okexchain"},70:{key:"70",name:"Hoo Smart Chain Mainnet",shortName:"hsc",chainId:70,network:"Mainnet",multicall:"0xd4b794b89baccb70ef851830099bee4d69f19ebc",rpc:["https://http-mainnet2.hoosmartchain.com"],ws:["wss://ws-mainnet2.hoosmartchain.com"],explorer:"https://hscscan.com"},80:{key:"80",name:"GeneChain",chainId:80,network:"Mainnet",multicall:"0x9e6ed491171A0D9089892aA5F14800f9f32038eb",rpc:["https://rpc.genechain.io"],explorer:"https://scan.genechain.io"},82:{key:"82",name:"Meter Mainnet",shortName:"Meter",chainId:82,network:"mainnet",multicall:"0x579De77CAEd0614e3b158cb738fcD5131B9719Ae",rpc:["https://rpc.meter.io"],explorer:"https://scan.meter.io"},97:{key:"97",name:"Binance Smart Chain Testnet",shortName:"BSC Testnet",chainId:97,network:"testnet",multicall:"0x8b54247c6BAe96A6ccAFa468ebae96c4D7445e46",rpc:["https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/bsc/testnet/archive","https://data-seed-prebsc-1-s1.binance.org:8545"],explorer:"https://testnet.bscscan.com"},99:{key:"99",name:"POA Core",shortName:"POA",chainId:99,network:"mainnet",multicall:"",rpc:["https://core.poa.network"],explorer:"https://blockscout.com/poa/core/"},100:{key:"100",name:"xDAI Chain",shortName:"xDAI",chainId:100,network:"mainnet",multicall:"0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a",rpc:["https://xdai-archive.blockscout.com","https://poa-xdai.gateway.pokt.network/v1/5f76124fb90218002e9ce985"],ws:["wss://rpc.xdaichain.com/wss"],explorer:"https://blockscout.com/poa/xdai"},108:{key:"108",name:"Thundercore Mainnet",chainId:108,network:"mainnet",multicall:"",rpc:["https://mainnet-rpc.thundercore.com"],explorer:"https://scan.thundercore.com"},122:{key:"122",name:"Fuse Mainnet",shortName:"Fuse",chainId:122,network:"mainnet",multicall:"0x7a59441fb06666F6d2D766393d876945D06a169c",rpc:["https://oefusefull1.liquify.info/"],explorer:"https://explorer.fuse.io"},128:{key:"128",name:"Huobi Eco Chain Mainnet",shortName:"heco",chainId:128,network:"Mainnet",multicall:"0x37ab26db3df780e7026f3e767f65efb739f48d8e",rpc:["https://pub001.hg.network/rpc"],ws:["wss://pub001.hg.network/ws"],explorer:"https://hecoinfo.com"},137:{key:"137",name:"Polygon Mainnet",shortName:"Polygon",chainId:137,network:"mainnet",multicall:"0xCBca837161be50EfA5925bB9Cc77406468e76751",rpc:["https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mainnet/archive","https://rpc-mainnet.maticvigil.com/v1/1cfd7598e5ba6dcf0b4db58e8be484badc6ea08e","https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/polygon/mainnet/archive"],ws:["wss://ws-mainnet.matic.network"],explorer:"https://polygonscan.com"},246:{key:"246",name:"Energy Web Chain",shortName:"EWC",chainId:246,network:"mainnet",multicall:"0x0767F26d0D568aB61A98b279C0b28a4164A6f05e",rpc:["https://voting-rpc.carbonswap.exchange"],explorer:"https://explorer.energyweb.org"},250:{key:"250",name:"Fantom Opera",shortName:"fantom",chainId:250,network:"Mainnet",multicall:"0x7f6A10218264a22B4309F3896745687E712962a0",rpc:["https://rpc.ftm.tools","https://rpcapi.fantom.network"],explorer:"https://ftmscan.com"},256:{key:"256",name:"Huobi Eco Chain Testnet",shortName:"heco",chainId:256,network:"testnet",multicall:"0xC33994Eb943c61a8a59a918E2de65e03e4e385E0",rpc:["https://http-testnet.hecochain.com"],ws:["wss://ws-testnet.hecochain.com"],explorer:"https://testnet.hecoinfo.com"},321:{key:"321",name:"KCC Mainnet",shortName:"KCC",chainId:321,network:"mainnet",multicall:"0xa64D6AFb48225BDA3259246cfb418c0b91de6D7a",rpc:["https://rpc-mainnet.kcc.network"],ws:["wss://rpc-ws-mainnet.kcc.network"],explorer:"https://explorer.kcc.io"},499:{key:"499",name:"Rupaya",shortName:"RUPX",chainId:499,network:"mainnet",multicall:"0x7955FF653FfDBf13056FeAe227f655CfF5C194D5",rpc:["https://rpc.rupx.io"],ws:["wss://ws.rupx.io"],explorer:"http://scan.rupx.io"},1285:{key:"1285",name:"Moonriver (Kusama)",shortName:"Moonriver",chainId:1285,network:"mainnet",multicall:"0x537004440ffFE1D4AE9F009031Fc2b0385FCA9F1",rpc:["https://rpc.moonriver.moonbeam.network"],explorer:"https://blockscout.moonriver.moonbeam.network/"},1287:{key:"1287",name:"Moonbase Alpha TestNet",shortName:"Moonbase",chainId:1287,network:"testnet",multicall:"0xD7bA481DE7fB53A7a29641c43232B09e5D9CAe7b",rpc:["https://rpc.testnet.moonbeam.network"],explorer:"https://moonbase-blockscout.testnet.moonbeam.network/"},4689:{key:"4689",name:"IoTeX Mainnet",shortName:"IoTeX",chainId:4689,network:"mainnet",multicall:"0x9c8B105c94282CDB0F3ecF27e3cfA96A35c07be6",rpc:["https://babel-api.mainnet.iotex.io"],explorer:"https://iotexscan.io"},4690:{key:"4690",name:"IoTeX Testnet",shortName:"IoTeX",chainId:4690,network:"testnet",multicall:"0x30aE8783d26aBE7Fbb9d83549CCb7430AE4A301F",rpc:["https://babel-api.testnet.iotex.io"],explorer:"https://testnet.iotexscan.io"},32659:{key:"32659",name:"Fusion Mainnet",chainId:32659,network:"mainnet",multicall:"",rpc:["https://vote.anyswap.exchange/mainnet"],ws:["wss://mainnetpublicgateway1.fusionnetwork.io:10001"],explorer:"https://fsnex.com"},42220:{key:"42220",name:"Celo Mainnet",shortName:"Celo",chainId:42220,network:"mainnet",multicall:"0xb8d0d2C1391eeB350d2Cd39EfABBaaEC297368D9",rpc:["https://celo-mainnet--rpc.datahub.figment.io/apikey/e892a66dc36e4d2d98a5d6406d609796/"],explorer:"https://explorer.celo.org"},43114:{key:"43114",name:"Avalanche",chainId:43114,network:"mainnet",multicall:"0x7E9985aE4C8248fdB07607648406a48C76e9e7eD",rpc:["https://api.avax.network/ext/bc/C/rpc"],explorer:"https://cchain.explorer.avax.network"},80001:{key:"80001",name:"Matic Mumbai",chainId:80001,network:"testnet",multicall:"0x08411ADd0b5AA8ee47563b146743C13b3556c9Cc",rpc:["https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mumbai/archive","https://rpc-mumbai.matic.today"],ws:["wss://ws-mumbai.matic.today"],explorer:""},333888:{key:"333888",name:"Polis Sparta",shortName:"Sparta",chainId:333888,network:"testnet",multicall:"0xA4c03972023d5f684d35eF1C541752490975383e",rpc:["https://sparta-rpc.polis.tech"],explorer:"https://sparta-explorer.polis.tech"},333999:{key:"333999",name:"Polis Olympus",shortName:"Olympus",chainId:333999,network:"mainnet",multicall:"0x34b99C2a4a4620F10ac779c36b8c61F90FD61732",rpc:["https://rpc.polis.tech"],explorer:"https://explorer.polis.tech"},16666e5:{key:"1666600000",name:"Harmony Mainnet",shortName:"HarmonyMainnet",chainId:16666e5,network:"mainnet",multicall:"0x9c31392D2e0229dC4Aa250F043d46B9E82074BF8",rpc:["https://a.api.s0.t.hmny.io"],ws:["wss://ws.s0.t.hmny.io"],explorer:"https://explorer.harmony.one"},16667e5:{key:"1666700000",name:"Harmony Testnet",shortName:"HarmonyTestnet",chainId:16667e5,network:"testnet",multicall:"0x9923589503Fd205feE3d367DDFF2378f0F7dD2d4",rpc:["https://api.s0.b.hmny.io"],ws:["wss://ws.s0.b.hmny.io"],explorer:"https://explorer.pops.one"},wanchain:{key:"wanchain",name:"Wanchain",chainId:1,network:"mainnet",multicall:"0xba5934ab3056fca1fa458d30fbb3810c3eb5145f",rpc:["https://gwan-ssl.wandevs.org:56891"],ws:["wss://api.wanchain.org:8443/ws/v3/ddd16770c68f30350a21114802d5418eafe039b722de52b488e7eee1ee2cd73f"],explorer:"https://www.wanscan.org"},11297108109:{key:"11297108109",name:"Palm Mainnet",shortName:"Palm",chainId:11297108109,network:"mainnet",multicall:"0xfFE2FF36c5b8D948f788a34f867784828aa7415D",rpc:["https://palm-mainnet.infura.io/v3/3a961d6501e54add9a41aa53f15de99b"],explorer:"https://explorer.palm.io"}},sy={};function ay(t){var e=oy[t].rpc[0];return sy[t]||(sy[t]=new ny(e)),sy[t]}var hy={basic:function(t,i,n,o){var s,a;return e(this,void 0,void 0,(function(){var e,n,h,u;return r(this,(function(r){switch(r.label){case 0:return e=o.strategies||i.strategies,n=o.onlyMembers||(null===(s=i.filters)||void 0===s?void 0:s.onlyMembers),h=o.minScore||(null===(a=i.filters)||void 0===a?void 0:a.minScore),(i.members||[]).map((function(t){return t.toLowerCase()})).includes(t.toLowerCase())?[2,!0]:n?[2,!1]:h?[4,rb(i.id||i.key,e,i.network,"",[t])]:[3,2];case 1:if(u=r.sent(),u.map((function(t){return Object.values(t).reduce((function(t,e){return t+e}),0)})).reduce((function(t,e){return t+e}),0)<h)return[2,!1];r.label=2;case 2:return[2,!0]}}))}))},aave:function(t,n,o,s){var a,h;return e(this,void 0,void 0,(function(){var e,o,u,l,f,c;return r(this,(function(r){switch(r.label){case 0:return e=s.onlyMembers||(null===(a=n.filters)||void 0===a?void 0:a.onlyMembers),o=s.minScore||(null===(h=n.filters)||void 0===h?void 0:h.minScore),u=(n.members||[]).map((function(t){return t.toLowerCase()})),l=i(n.strategies),(f=l.findIndex((function(t){return"aave-governance-power"===t.name})))>=0&&(l[f].params.powerType="proposition"),u.includes(t.toLowerCase())?[2,!0]:e?[2,!1]:o?[4,rb(n.id||n.key,l,n.network,"",[t])]:[3,2];case 1:if(c=r.sent(),c.map((function(t){return Object.values(t).reduce((function(t,e){return t+e}),0)})).reduce((function(t,e){return t+e}),0)<o)return[2,!1];r.label=2;case 2:return[2,!0]}}))}))}};let uy=!1,ly=!1;const fy={debug:1,default:2,info:2,warning:3,error:4,off:5};let cy=fy.default,dy=null;const my=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var py,gy;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(py||(py={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(gy||(gy={}));class vy{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==fy[r]&&this.throwArgumentError("invalid log level name","logLevel",t),cy>fy[r]||console.log.apply(console,e)}debug(...t){this._log(vy.levels.DEBUG,t)}info(...t){this._log(vy.levels.INFO,t)}warn(...t){this._log(vy.levels.WARNING,t)}makeError(t,e,r){if(ly)return this.makeError("censored error",e,{});e||(e=vy.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,vy.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){my&&this.throwError("platform missing String.prototype.normalize",vy.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:my})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,vy.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,vy.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,vy.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,vy.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",vy.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",vy.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",vy.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return dy||(dy=new vy("logger/5.4.0")),dy}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",vy.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),uy){if(!t)return;this.globalLogger().throwError("error censorship permanent",vy.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ly=!!t,uy=!!e}static setLogLevel(t){const e=fy[t.toLowerCase()];null!=e?cy=e:vy.globalLogger().warn("invalid log level - "+t)}static from(t){return new vy(t)}}vy.errors=gy,vy.levels=py;const yy=new vy("bytes/5.4.0");function wy(t){return!!t.toHexString}function My(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return My(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function by(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function Ey(t,e){if(e||(e={}),"number"==typeof t){yy.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),My(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),wy(t)&&(t=t.toHexString()),_y(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":yy.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return My(new Uint8Array(i))}return by(t)?My(new Uint8Array(t)):yy.throwArgumentError("invalid arrayify value","value",t)}function _y(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function Ny(t,e){if(e||(e={}),"number"==typeof t){yy.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),wy(t))return t.toHexString();if(_y(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":yy.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(by(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return yy.throwArgumentError("invalid hexlify value","value",t)}function Ay(t){let e="0x";return t.forEach(t=>{e+=Ny(t).substring(2)}),e}function Sy(t,e){for("string"!=typeof t?t=Ny(t):_y(t)||yy.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&yy.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var Ry=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,f=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!==(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);i=(m=m.idivn(d)).isZero()?p+i:u[c-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),l=this.clone();if(h){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],M=8191&w,b=w>>>13,E=0|s[4],_=8191&E,N=E>>>13,A=0|s[5],S=8191&A,R=A>>>13,x=0|s[6],I=8191&x,k=x>>>13,T=0|s[7],O=8191&T,P=T>>>13,C=0|s[8],U=8191&C,F=C>>>13,B=0|s[9],D=8191&B,L=B>>>13,$=0|a[0],j=8191&$,z=$>>>13,q=0|a[1],G=8191&q,V=q>>>13,Z=0|a[2],K=8191&Z,H=Z>>>13,W=0|a[3],J=8191&W,X=W>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(c,j)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,j),n=(n=Math.imul(v,z))+Math.imul(y,j)|0,o=Math.imul(y,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,V)|0;var yt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,z))+Math.imul(b,j)|0,o=Math.imul(b,z),i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,X)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(_,j),n=(n=Math.imul(_,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,X)|0;var Mt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(k,j)|0,o=Math.imul(k,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Et=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(u+(i=i+Math.imul(f,ht)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,z))+Math.imul(F,j)|0,o=Math.imul(F,z),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Nt=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,V)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(M,ot)|0,n=(n=n+Math.imul(M,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ht)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var At=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;u=((o=o+Math.imul(c,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,V))+Math.imul(L,G)|0,o=Math.imul(L,V),i=i+Math.imul(U,K)|0,n=(n=n+Math.imul(U,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var St=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,H))+Math.imul(L,K)|0,o=Math.imul(L,H),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,X)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,X))+Math.imul(L,J)|0,o=Math.imul(L,X),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var xt=(u+(i=i+Math.imul(M,mt)|0)|0)+((8191&(n=(n=n+Math.imul(M,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var It=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(U,ot)|0,n=(n=n+Math.imul(U,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ft)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(S,mt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(U,ht)|0,n=(n=n+Math.imul(U,ut)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(U,ft)|0,n=(n=n+Math.imul(U,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Ot=(u+(i=i+Math.imul(O,mt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ft),n=(n=Math.imul(D,ct))+Math.imul(L,ft)|0,o=Math.imul(L,ct);var Pt=(u+(i=i+Math.imul(U,mt)|0)|0)+((8191&(n=(n=n+Math.imul(U,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ct=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=Et,h[7]=_t,h[8]=Nt,h[9]=At,h[10]=St,h[11]=Rt,h[12]=xt,h[13]=It,h[14]=kt,h[15]=Tt,h[16]=Ot,h[17]=Pt,h[18]=Ct,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),c=67108863&f;a=67108863&(c=c+a|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},p.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},p.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var f=h,c=u,d=0;d<s;d++){var m=r[l+d],p=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=m+g,i[l+d]=p+v,r[l+d+s]=m-g,i[l+d+s]=p-v,d!==a&&(y=h*f-u*c,c=h*c+u*f,f=y)}},p.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},p.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},p.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,l,f,i,n);for(var d=0;d<i;d++){var m=a[d]*l[d]-h[d]*f[d];h[d]=a[d]*f[d]+h[d]*l[d],a[d]=m}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var f=h-1;f>=0;f--){var c=67108864*(0|i.words[o.length+f])+(0|i.words[o.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(f)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(M,v),i(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var v=this.pow(f,new n(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new _(t)},i(_,E),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,n)})).BN;const xy=new vy("bignumber/5.4.0"),Iy={};let ky=!1;class Ty{constructor(t,e){xy.checkNew(new.target,Ty),t!==Iy&&xy.throwError("cannot call constructor directly; use BigNumber.from",vy.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Py(Cy(this).fromTwos(t))}toTwos(t){return Py(Cy(this).toTwos(t))}abs(){return"-"===this._hex[0]?Ty.from(this._hex.substring(1)):this}add(t){return Py(Cy(this).add(Cy(t)))}sub(t){return Py(Cy(this).sub(Cy(t)))}div(t){return Ty.from(t).isZero()&&Uy("division by zero","div"),Py(Cy(this).div(Cy(t)))}mul(t){return Py(Cy(this).mul(Cy(t)))}mod(t){const e=Cy(t);return e.isNeg()&&Uy("cannot modulo negative values","mod"),Py(Cy(this).umod(e))}pow(t){const e=Cy(t);return e.isNeg()&&Uy("cannot raise to negative values","pow"),Py(Cy(this).pow(e))}and(t){const e=Cy(t);return(this.isNegative()||e.isNeg())&&Uy("cannot 'and' negative values","and"),Py(Cy(this).and(e))}or(t){const e=Cy(t);return(this.isNegative()||e.isNeg())&&Uy("cannot 'or' negative values","or"),Py(Cy(this).or(e))}xor(t){const e=Cy(t);return(this.isNegative()||e.isNeg())&&Uy("cannot 'xor' negative values","xor"),Py(Cy(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Uy("cannot mask negative values","mask"),Py(Cy(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Uy("cannot shift negative values","shl"),Py(Cy(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Uy("cannot shift negative values","shr"),Py(Cy(this).shrn(t))}eq(t){return Cy(this).eq(Cy(t))}lt(t){return Cy(this).lt(Cy(t))}lte(t){return Cy(this).lte(Cy(t))}gt(t){return Cy(this).gt(Cy(t))}gte(t){return Cy(this).gte(Cy(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Cy(this).isZero()}toNumber(){try{return Cy(this).toNumber()}catch(t){Uy("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return xy.throwError("this platform does not support BigInt",vy.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ky||(ky=!0,xy.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?xy.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",vy.errors.UNEXPECTED_ARGUMENT,{}):xy.throwError("BigNumber.toString does not accept parameters",vy.errors.UNEXPECTED_ARGUMENT,{})),Cy(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ty)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Ty(Iy,Oy(t)):t.match(/^-?[0-9]+$/)?new Ty(Iy,Oy(new Ry(t))):xy.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Uy("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&Uy("overflow","BigNumber.from",t),Ty.from(String(t));const e=t;if("bigint"==typeof e)return Ty.from(e.toString());if(by(e))return Ty.from(Ny(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Ty.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(_y(t)||"-"===t[0]&&_y(t.substring(1))))return Ty.from(t)}return xy.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Oy(t){if("string"!=typeof t)return Oy(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&xy.throwArgumentError("invalid hex","value",t),"0x00"===(t=Oy(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Py(t){return Ty.from(Oy(t))}function Cy(t){const e=Ty.from(t).toHexString();return"-"===e[0]?new Ry("-"+e.substring(3),16):new Ry(e.substring(2),16)}function Uy(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),xy.throwError(t,vy.errors.NUMERIC_FAULT,i)}function Fy(t){return"0x"+si.keccak_256(Ey(t))}const By=new vy("address/5.4.0");function Dy(t){_y(t,20)||By.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=Ey(Fy(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Ly={};for(let t=0;t<10;t++)Ly[String(t)]=String(t);for(let t=0;t<26;t++)Ly[String.fromCharCode(65+t)]=String(10+t);const $y=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function jy(t){let e=null;if("string"!=typeof t&&By.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Dy(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&By.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>Ly[t]).join("");for(;e.length>=$y;){let t=e.substring(0,$y);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&By.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Ry(r,36).toString(16);e.length<40;)e="0"+e;e=Dy("0x"+e)}else By.throwArgumentError("invalid address","address",t);var r;return e}window&&window.__awaiter;const zy=new vy("properties/5.4.0");function qy(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Gy(t){const e={};for(const r in t)e[r]=t[r];return e}const Vy={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Zy(t){if(function t(e){if(null==e||Vy[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const r=Object.keys(e);for(let i=0;i<r.length;i++)if(!t(e[r[i]]))return!1;return!0}return zy.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}(t))return t;if(Array.isArray(t))return Object.freeze(t.map(t=>Ky(t)));if("object"==typeof t){const e={};for(const r in t){const i=t[r];void 0!==i&&qy(e,r,Ky(i))}return e}return zy.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Ky(t){return Zy(t)}const Hy=new vy("strings/5.4.0");var Wy,Jy;function Xy(t,e,r,i,n){if(t===Jy.BAD_PREFIX||t===Jy.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===Jy.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Wy||(Wy={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Jy||(Jy={}));Object.freeze({error:function(t,e,r,i,n){return Hy.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Xy,replace:function(t,e,r,i,n){return t===Jy.OVERLONG?(i.push(n),0):(i.push(65533),Xy(t,e,r))}});function Yy(t){return Fy(function(t,e=Wy.current){e!=Wy.current&&(Hy.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&i)<<10)+(1023&n);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(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return Ey(r)}(t))}var Qy=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((i=i.apply(t,e||[])).next())}))};const tw=new vy("hash/5.4.0"),ew=new Uint8Array(32);ew.fill(0);const rw=Ty.from(-1),iw=Ty.from(0),nw=Ty.from(1),ow=Ty.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const sw=Sy(nw.toHexString(),32),aw=Sy(iw.toHexString(),32),hw={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},uw=["name","version","chainId","verifyingContract","salt"];function lw(t){return function(e){return"string"!=typeof e&&tw.throwArgumentError("invalid domain value for "+JSON.stringify(t),"domain."+t,e),e}}const fw={name:lw("name"),version:lw("version"),chainId:function(t){try{return Ty.from(t).toString()}catch(t){}return tw.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return jy(t).toLowerCase()}catch(t){}return tw.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=Ey(t);if(32!==e.length)throw new Error("bad length");return Ny(e)}catch(t){}return tw.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function cw(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&tw.throwArgumentError("invalid numeric width","type",t);const n=ow.mask(r?i-1:i),o=r?n.add(nw).mul(rw):iw;return function(e){const r=Ty.from(e);return(r.lt(o)||r.gt(n))&&tw.throwArgumentError("value out-of-bounds for "+t,"value",e),Sy(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&tw.throwArgumentError("invalid bytes width","type",t),function(e){return Ey(e).length!==r&&tw.throwArgumentError("invalid length for "+t,"value",e),function(t){const e=Ey(t),r=e.length%32;return r?Ay([e,ew.slice(r)]):Ny(e)}(e)}}}switch(t){case"address":return function(t){return Sy(jy(t),32)};case"bool":return function(t){return t?sw:aw};case"bytes":return function(t){return Fy(t)};case"string":return function(t){return Yy(t)}}return null}function dw(t,e){return`${t}(${e.map(({name:t,type:e})=>e+" "+t).join(",")})`}class mw{constructor(t){qy(this,"types",Object.freeze(Ky(t))),qy(this,"_encoderCache",{}),qy(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach(t=>{e[t]={},r[t]=[],i[t]={}});for(const i in t){const n={};t[i].forEach(o=>{n[o.name]&&tw.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===i&&tw.throwArgumentError("circular type reference to "+JSON.stringify(s),"types",t);cw(s)||(r[s]||tw.throwArgumentError("unknown type "+JSON.stringify(s),"types",t),r[s].push(i),e[i][s]=!0)})}const n=Object.keys(r).filter(t=>0===r[t].length);0===n.length?tw.throwArgumentError("missing primary type","types",t):n.length>1&&tw.throwArgumentError("ambiguous primary types or unused types: "+n.map(t=>JSON.stringify(t)).join(", "),"types",t),qy(this,"primaryType",n[0]),function n(o,s){s[o]&&tw.throwArgumentError("circular type reference to "+JSON.stringify(o),"types",t),s[o]=!0,Object.keys(e[o]).forEach(t=>{r[t]&&(n(t,s),Object.keys(s).forEach(e=>{i[e][t]=!0}))}),delete s[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=dw(e,t[e])+r.map(e=>dw(e,t[e])).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=cw(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&tw.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(Fy)),Fy(Ay(n))}}const r=this.types[t];if(r){const e=Yy(this._types[t]);return t=>{const i=r.map(({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?Fy(i):i});return i.unshift(e),Ay(i)}}return tw.throwArgumentError("unknown type: "+t,"type",t)}encodeType(t){const e=this._types[t];return e||tw.throwArgumentError("unknown type: "+JSON.stringify(t),"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return Fy(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(cw(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&tw.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map(e=>this._visit(t,e,r))}const n=this.types[t];return n?n.reduce((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t),{}):tw.throwArgumentError("unknown type: "+t,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new mw(t)}static getPrimaryType(t){return mw.from(t).primaryType}static hashStruct(t,e,r){return mw.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=hw[r];i||tw.throwArgumentError("invalid typed-data domain key: "+JSON.stringify(r),"domain",t),e.push({name:r,type:i})}return e.sort((t,e)=>uw.indexOf(t.name)-uw.indexOf(e.name)),mw.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return Ay(["0x1901",mw.hashDomain(t),mw.from(e).hash(r)])}static hash(t,e,r){return Fy(mw.encode(t,e,r))}static resolveNames(t,e,r,i){return Qy(this,void 0,void 0,(function*(){t=Gy(t);const n={};t.verifyingContract&&!_y(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=mw.from(e);o.visit(r,(t,e)=>("address"!==t||_y(e,20)||(n[e]="0x"),e));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,(t,e)=>"address"===t&&n[e]?n[e]:e),{domain:t,value:r}}))}static getPayload(t,e,r){mw.hashDomain(t);const i={},n=[];uw.forEach(e=>{const r=t[e];null!=r&&(i[e]=fw[e](r),n.push({name:e,type:hw[e]}))});const o=mw.from(e),s=Gy(e);return s.EIP712Domain?tw.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=n,o.encode(r),{types:s,domain:i,primaryType:o.primaryType,message:o.visit(r,(t,e)=>{if(t.match(/^bytes(\d*)/))return Ny(Ey(e));if(t.match(/^u?int/))return Ty.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&tw.throwArgumentError("invalid string","value",e),e}return tw.throwArgumentError("unsupported type","type",t)})}}}var pw=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,f=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!==(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);i=(m=m.idivn(d)).isZero()?p+i:u[c-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),l=this.clone();if(h){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],M=8191&w,b=w>>>13,E=0|s[4],_=8191&E,N=E>>>13,A=0|s[5],S=8191&A,R=A>>>13,x=0|s[6],I=8191&x,k=x>>>13,T=0|s[7],O=8191&T,P=T>>>13,C=0|s[8],U=8191&C,F=C>>>13,B=0|s[9],D=8191&B,L=B>>>13,$=0|a[0],j=8191&$,z=$>>>13,q=0|a[1],G=8191&q,V=q>>>13,Z=0|a[2],K=8191&Z,H=Z>>>13,W=0|a[3],J=8191&W,X=W>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(c,j)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,j),n=(n=Math.imul(v,z))+Math.imul(y,j)|0,o=Math.imul(y,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,V)|0;var yt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,z))+Math.imul(b,j)|0,o=Math.imul(b,z),i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,X)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(_,j),n=(n=Math.imul(_,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,X)|0;var Mt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(k,j)|0,o=Math.imul(k,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Et=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(u+(i=i+Math.imul(f,ht)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,z))+Math.imul(F,j)|0,o=Math.imul(F,z),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Nt=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,V)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(M,ot)|0,n=(n=n+Math.imul(M,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ht)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var At=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;u=((o=o+Math.imul(c,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,V))+Math.imul(L,G)|0,o=Math.imul(L,V),i=i+Math.imul(U,K)|0,n=(n=n+Math.imul(U,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var St=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,H))+Math.imul(L,K)|0,o=Math.imul(L,H),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,X)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,X))+Math.imul(L,J)|0,o=Math.imul(L,X),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var xt=(u+(i=i+Math.imul(M,mt)|0)|0)+((8191&(n=(n=n+Math.imul(M,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var It=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(U,ot)|0,n=(n=n+Math.imul(U,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ft)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(S,mt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(U,ht)|0,n=(n=n+Math.imul(U,ut)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(U,ft)|0,n=(n=n+Math.imul(U,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Ot=(u+(i=i+Math.imul(O,mt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ft),n=(n=Math.imul(D,ct))+Math.imul(L,ft)|0,o=Math.imul(L,ct);var Pt=(u+(i=i+Math.imul(U,mt)|0)|0)+((8191&(n=(n=n+Math.imul(U,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ct=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=Et,h[7]=_t,h[8]=Nt,h[9]=At,h[10]=St,h[11]=Rt,h[12]=xt,h[13]=It,h[14]=kt,h[15]=Tt,h[16]=Ot,h[17]=Pt,h[18]=Ct,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),c=67108863&f;a=67108863&(c=c+a|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},p.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},p.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var f=h,c=u,d=0;d<s;d++){var m=r[l+d],p=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=m+g,i[l+d]=p+v,r[l+d+s]=m-g,i[l+d+s]=p-v,d!==a&&(y=h*f-u*c,c=h*c+u*f,f=y)}},p.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},p.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},p.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,l,f,i,n);for(var d=0;d<i;d++){var m=a[d]*l[d]-h[d]*f[d];h[d]=a[d]*f[d]+h[d]*l[d],a[d]=m}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var f=h-1;f>=0;f--){var c=67108864*(0|i.words[o.length+f])+(0|i.words[o.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(f)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(M,v),i(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var v=this.pow(f,new n(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new _(t)},i(_,E),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,n)}));function gw(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var vw=yw;function yw(t,e){if(!t)throw new Error(e||"Assertion failed")}yw.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var ww=gw((function(t,e){var r=e;function i(t){return 1===t.length?"0"+t:t}function n(t){for(var e="",r=0;r<t.length;r++)e+=i(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var i=0;i<t.length;i++)r[i]=0|t[i];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(i=0;i<t.length;i++){var n=t.charCodeAt(i),o=n>>8,s=255&n;o?r.push(o,s):r.push(s)}return r},r.zero2=i,r.toHex=n,r.encode=function(t,e){return"hex"===e?n(t):t}})),Mw=gw((function(t,e){var r=e;r.assert=vw,r.toArray=ww.toArray,r.zero2=ww.zero2,r.toHex=ww.toHex,r.encode=ww.encode,r.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<<e+1,o=t.clone(),s=0;s<i.length;s++){var a,h=o.andln(n-1);o.isOdd()?(a=h>(n>>1)-1?(n>>1)-h:h,o.isubn(a)):a=0,i[s]=a,o.iushrn(1)}return i},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var s,a,h=t.andln(3)+n&3,u=e.andln(3)+o&3;3===h&&(h=-1),3===u&&(u=-1),s=0==(1&h)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==u?h:-h,r[0].push(s),a=0==(1&u)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==h?u:-u,r[1].push(a),2*n===s+1&&(n=1-n),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new pw(t,"hex","le")}})),bw=Mw.getNAF,Ew=Mw.getJSF,_w=Mw.assert;function Nw(t,e){this.type=t,this.p=new pw(e.p,16),this.red=e.prime?pw.red(e.prime):pw.mont(this.p),this.zero=new pw(0).toRed(this.red),this.one=new pw(1).toRed(this.red),this.two=new pw(2).toRed(this.red),this.n=e.n&&new pw(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.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 Aw=Nw;function Sw(t,e){this.curve=t,this.type=e,this.precomputed=null}Nw.prototype.point=function(){throw new Error("Not implemented")},Nw.prototype.validate=function(){throw new Error("Not implemented")},Nw.prototype._fixedNafMul=function(t,e){_w(t.precomputed);var r=t._getDoubles(),i=bw(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,s,a=[];for(o=0;o<i.length;o+=r.step){s=0;for(var h=o+r.step-1;h>=o;h--)s=(s<<1)+i[h];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=n;f>0;f--){for(o=0;o<a.length;o++)(s=a[o])===f?l=l.mixedAdd(r.points[o]):s===-f&&(l=l.mixedAdd(r.points[o].neg()));u=u.add(l)}return u.toP()},Nw.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=bw(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var h=0;a>=0&&0===o[a];a--)h++;if(a>=0&&h++,s=s.dblp(h),a<0)break;var u=o[a];_w(0!==u),s="affine"===t.type?u>0?s.mixedAdd(n[u-1>>1]):s.mixedAdd(n[-u-1>>1].neg()):u>0?s.add(n[u-1>>1]):s.add(n[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},Nw.prototype._wnafMulAdd=function(t,e,r,i,n){var o,s,a,h=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o<i;o++){var c=(a=e[o])._getNAFPoints(t);h[o]=c.wnd,u[o]=c.points}for(o=i-1;o>=1;o-=2){var d=o-1,m=o;if(1===h[d]&&1===h[m]){var p=[e[d],null,null,e[m]];0===e[d].y.cmp(e[m].y)?(p[1]=e[d].add(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg())):0===e[d].y.cmp(e[m].y.redNeg())?(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].add(e[m].neg())):(p[1]=e[d].toJ().mixedAdd(e[m]),p[2]=e[d].toJ().mixedAdd(e[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Ew(r[d],r[m]);for(f=Math.max(v[0].length,f),l[d]=new Array(f),l[m]=new Array(f),s=0;s<f;s++){var y=0|v[0][s],w=0|v[1][s];l[d][s]=g[3*(y+1)+(w+1)],l[m][s]=0,u[d]=p}}else l[d]=bw(r[d],h[d],this._bitLength),l[m]=bw(r[m],h[m],this._bitLength),f=Math.max(l[d].length,f),f=Math.max(l[m].length,f)}var M=this.jpoint(null,null,null),b=this._wnafT4;for(o=f;o>=0;o--){for(var E=0;o>=0;){var _=!0;for(s=0;s<i;s++)b[s]=0|l[s][o],0!==b[s]&&(_=!1);if(!_)break;E++,o--}if(o>=0&&E++,M=M.dblp(E),o<0)break;for(s=0;s<i;s++){var N=b[s];0!==N&&(N>0?a=u[s][N-1>>1]:N<0&&(a=u[s][-N-1>>1].neg()),M="affine"===a.type?M.mixedAdd(a):M.add(a))}}for(o=0;o<i;o++)u[o]=null;return n?M:M.toP()},Nw.BasePoint=Sw,Sw.prototype.eq=function(){throw new Error("Not implemented")},Sw.prototype.validate=function(){return this.curve.validate(this)},Nw.prototype.decodePoint=function(t,e){t=Mw.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?_w(t[t.length-1]%2==0):7===t[0]&&_w(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},Sw.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Sw.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},Sw.prototype.encode=function(t,e){return Mw.encode(this._encode(e),t)},Sw.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},Sw.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},Sw.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var o=0;o<t;o++)i=i.dbl();r.push(i)}return{step:t,points:r}},Sw.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},Sw.prototype._getBeta=function(){return null},Sw.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var Rw=gw((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),xw=Mw.assert;function Iw(t){Aw.call(this,"short",t),this.a=new pw(t.a,16).toRed(this.red),this.b=new pw(t.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(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Rw(Iw,Aw);var kw=Iw;function Tw(t,e,r,i){Aw.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new pw(e,16),this.y=new pw(r,16),i&&(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 Ow(t,e,r,i){Aw.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new pw(0)):(this.x=new pw(e,16),this.y=new pw(r,16),this.z=new pw(i,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}Iw.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new pw(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new pw(t.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(e))?r=n[0]:(r=n[1],xw(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new pw(t.a,16),b:new pw(t.b,16)}})):this._getEndoBasis(r)}}},Iw.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:pw.mont(t),r=new pw(2).toRed(e).redInvm(),i=r.redNeg(),n=new pw(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},Iw.prototype._getEndoBasis=function(t){for(var e,r,i,n,o,s,a,h,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=t,c=this.n.clone(),d=new pw(1),m=new pw(0),p=new pw(0),g=new pw(1),v=0;0!==f.cmpn(0);){var y=c.div(f);h=c.sub(y.mul(f)),u=p.sub(y.mul(d));var w=g.sub(y.mul(m));if(!i&&h.cmp(l)<0)e=a.neg(),r=d,i=h.neg(),n=u;else if(i&&2==++v)break;a=h,c=f,f=h,p=d,d=u,g=m,m=w}o=h.neg(),s=u;var M=i.sqr().add(n.sqr());return o.sqr().add(s.sqr()).cmp(M)>=0&&(o=e,s=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:n},{a:o,b:s}]},Iw.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=n.mul(r.a),a=o.mul(i.a),h=n.mul(r.b),u=o.mul(i.b);return{k1:t.sub(s).sub(a),k2:h.add(u).neg()}},Iw.prototype.pointFromX=function(t,e){(t=new pw(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},Iw.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},Iw.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],h=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),h=h.neg(!0)),i[2*o]=a,i[2*o+1]=h,n[2*o]=s.k1,n[2*o+1]=s.k2}for(var u=this._wnafMulAdd(1,i,n,2*o,r),l=0;l<2*o;l++)i[l]=null,n[l]=null;return u},Rw(Tw,Aw.BasePoint),Iw.prototype.point=function(t,e,r){return new Tw(this,t,e,r)},Iw.prototype.pointFromJSON=function(t,e){return Tw.fromJSON(this,t,e)},Tw.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},Tw.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]},Tw.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(e){return t.point(e[0],e[1],r)}var o=e[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(n))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(n))}},i},Tw.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)+">"},Tw.prototype.isInfinity=function(){return this.inf},Tw.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Tw.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),s=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},Tw.prototype.getX=function(){return this.x.fromRed()},Tw.prototype.getY=function(){return this.y.fromRed()},Tw.prototype.mul=function(t){return t=new pw(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Tw.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Tw.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Tw.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Tw.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},Tw.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Rw(Ow,Aw.BasePoint),Iw.prototype.jpoint=function(t,e,r){return new Ow(this,t,e,r)},Ow.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},Ow.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Ow.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),h=o.redSub(s);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),f=i.redMul(u),c=h.redSqr().redIAdd(l).redISub(f).redISub(f),d=h.redMul(f.redISub(c)).redISub(o.redMul(l)),m=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(c,d,m)},Ow.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(i),a=n.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),u=h.redMul(s),l=r.redMul(h),f=a.redSqr().redIAdd(u).redISub(l).redISub(l),c=a.redMul(l.redISub(f)).redISub(n.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(f,c,d)},Ow.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,o=this.x,s=this.y,a=this.z,h=a.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var l=o.redSqr(),f=u.redSqr(),c=f.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(h)),m=o.redMul(f),p=d.redSqr().redISub(m.redAdd(m)),g=m.redISub(p),v=d.redMul(g);v=v.redIAdd(v).redISub(c);var y=u.redMul(a);e+1<t&&(h=h.redMul(c)),o=p,a=y,u=v}return this.curve.jpoint(o,u.redMul(n),a)},Ow.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Ow.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var a=i.redAdd(i).redIAdd(i),h=a.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=h,e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),f=this.y.redSqr(),c=f.redSqr(),d=this.x.redAdd(f).redSqr().redISub(l).redISub(c);d=d.redIAdd(d);var m=l.redAdd(l).redIAdd(l),p=m.redSqr(),g=c.redIAdd(c);g=(g=g.redIAdd(g)).redIAdd(g),t=p.redISub(d).redISub(d),e=m.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},Ow.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),s=this.x.redAdd(n).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),h=a.redSqr().redISub(s).redISub(s);t=h;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),f=this.y.redSqr(),c=this.x.redMul(f),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var m=c.redIAdd(c),p=(m=m.redIAdd(m)).redAdd(m);t=d.redSqr().redISub(p),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(l);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(m.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},Ow.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(n)),h=e.redAdd(e),u=(h=h.redIAdd(h)).redMul(s),l=a.redSqr().redISub(u.redAdd(u)),f=u.redISub(l),c=s.redSqr();c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=a.redMul(f).redISub(c),m=r.redAdd(r).redMul(i);return this.curve.jpoint(l,d,m)},Ow.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),o=n.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(i),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),h=i.redIAdd(i);h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var u=n.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(h),l=e.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.x.redMul(a).redISub(l);f=(f=f.redIAdd(f)).redIAdd(f);var c=this.y.redMul(u.redMul(h.redISub(u)).redISub(s.redMul(a)));c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(f,c,d)},Ow.prototype.mul=function(t,e){return t=new pw(t,e),this.curve._wnafMul(this,t)},Ow.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return 0===this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)},Ow.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},Ow.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)+">"},Ow.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Pw=gw((function(t,e){var r=e;r.base=Aw,r.short=kw,r.mont=null,r.edwards=null})),Cw=gw((function(t,e){var r,i=e,n=Mw.assert;function o(t){"short"===t.type?this.curve=new Pw.short(t):"edwards"===t.type?this.curve=new Pw.edwards(t):this.curve=new Pw.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.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:Xp.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){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:Xp.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function Uw(t){if(!(this instanceof Uw))return new Uw(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ww.toArray(t.entropy,t.entropyEnc||"hex"),r=ww.toArray(t.nonce,t.nonceEnc||"hex"),i=ww.toArray(t.pers,t.persEnc||"hex");vw(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var Fw=Uw;Uw.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},Uw.prototype._hmac=function(){return new Xp.hmac(this.hash,this.K)},Uw.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},Uw.prototype.reseed=function(t,e,r,i){"string"!=typeof e&&(i=r,r=e,e=null),t=ww.toArray(t,e),r=ww.toArray(r,i),vw(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Uw.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=ww.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<t;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var o=n.slice(0,t);return this._update(r),this._reseed++,ww.encode(o,e)};var Bw=Mw.assert;function Dw(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Lw=Dw;Dw.fromPublic=function(t,e,r){return e instanceof Dw?e:new Dw(t,{pub:e,pubEnc:r})},Dw.fromPrivate=function(t,e,r){return e instanceof Dw?e:new Dw(t,{priv:e,privEnc:r})},Dw.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},Dw.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Dw.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},Dw.prototype._importPrivate=function(t,e){this.priv=new pw(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Dw.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?Bw(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Bw(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},Dw.prototype.derive=function(t){return t.validate()||Bw(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Dw.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Dw.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Dw.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var $w=Mw.assert;function jw(t,e){if(t instanceof jw)return t;this._importDER(t,e)||($w(t.r&&t.s,"Signature without r or s"),this.r=new pw(t.r,16),this.s=new pw(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var zw=jw;function qw(){this.place=0}function Gw(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,o=0,s=e.place;o<i;o++,s++)n<<=8,n|=t[s],n>>>=0;return!(n<=127)&&(e.place=s,n)}function Vw(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function Zw(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}jw.prototype._importDER=function(t,e){t=Mw.toArray(t,e);var r=new qw;if(48!==t[r.place++])return!1;var i=Gw(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=Gw(t,r);if(!1===n)return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var s=Gw(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.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 pw(o),this.s=new pw(a),this.recoveryParam=null,!0},jw.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=Vw(e),r=Vw(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];Zw(i,e.length),(i=i.concat(e)).push(2),Zw(i,r.length);var n=i.concat(r),o=[48];return Zw(o,n.length),o=o.concat(n),Mw.encode(o,t)};var Kw=function(){throw new Error("unsupported")},Hw=Mw.assert;function Ww(t){if(!(this instanceof Ww))return new Ww(t);"string"==typeof t&&(Hw(Object.prototype.hasOwnProperty.call(Cw,t),"Unknown curve "+t),t=Cw[t]),t instanceof Cw.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Jw=Ww;Ww.prototype.keyPair=function(t){return new Lw(this,t)},Ww.prototype.keyFromPrivate=function(t,e){return Lw.fromPrivate(this,t,e)},Ww.prototype.keyFromPublic=function(t,e){return Lw.fromPublic(this,t,e)},Ww.prototype.genKeyPair=function(t){t||(t={});for(var e=new Fw({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Kw(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new pw(2));;){var n=new pw(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},Ww.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Ww.prototype.sign=function(t,e,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new pw(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),s=t.toArray("be",n),a=new Fw({hash:this.hash,entropy:o,nonce:s,pers:i.pers,persEnc:i.persEnc||"utf8"}),h=this.n.sub(new pw(1)),u=0;;u++){var l=i.k?i.k(u):new pw(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var f=this.g.mul(l);if(!f.isInfinity()){var c=f.getX(),d=c.umod(this.n);if(0!==d.cmpn(0)){var m=l.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(m=m.umod(this.n)).cmpn(0)){var p=(f.getY().isOdd()?1:0)|(0!==c.cmp(d)?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),p^=1),new zw({r:d,s:m,recoveryParam:p})}}}}}},Ww.prototype.verify=function(t,e,r,i){t=this._truncateToN(new pw(t,16)),r=this.keyFromPublic(r,i);var n=(e=new zw(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.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),h=a.mul(t).umod(this.n),u=a.mul(n).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(h,r.getPublic(),u)).isInfinity()&&s.eqXToP(n):!(s=this.g.mulAdd(h,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(n)},Ww.prototype.recoverPubKey=function(t,e,r,i){Hw((3&r)===r,"The recovery param is more than two bits"),e=new zw(e,i);var n=this.n,o=new pw(t),s=e.r,a=e.s,h=1&r,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");s=u?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var l=e.r.invm(n),f=n.sub(o).mul(l).umod(n),c=a.mul(l).umod(n);return this.g.mulAdd(f,s,c)},Ww.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new zw(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var Xw=gw((function(t,e){var r=e;r.version="6.5.4",r.utils=Mw,r.rand=function(){throw new Error("unsupported")},r.curve=Pw,r.curves=Cw,r.ec=Jw,r.eddsa=null})).ec;let Yw=!1,Qw=!1;const tM={debug:1,default:2,info:2,warning:3,error:4,off:5};let eM=tM.default,rM=null;const iM=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var nM,oM;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(nM||(nM={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(oM||(oM={}));class sM{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==tM[r]&&this.throwArgumentError("invalid log level name","logLevel",t),eM>tM[r]||console.log.apply(console,e)}debug(...t){this._log(sM.levels.DEBUG,t)}info(...t){this._log(sM.levels.INFO,t)}warn(...t){this._log(sM.levels.WARNING,t)}makeError(t,e,r){if(Qw)return this.makeError("censored error",e,{});e||(e=sM.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,sM.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){iM&&this.throwError("platform missing String.prototype.normalize",sM.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:iM})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,sM.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,sM.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,sM.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,sM.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",sM.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",sM.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",sM.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return rM||(rM=new sM("logger/5.4.0")),rM}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",sM.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Yw){if(!t)return;this.globalLogger().throwError("error censorship permanent",sM.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Qw=!!t,Yw=!!e}static setLogLevel(t){const e=tM[t.toLowerCase()];null!=e?eM=e:sM.globalLogger().warn("invalid log level - "+t)}static from(t){return new sM(t)}}sM.errors=oM,sM.levels=nM;const aM=new sM("bytes/5.4.0");function hM(t){return!!t.toHexString}function uM(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return uM(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function lM(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function fM(t,e){if(e||(e={}),"number"==typeof t){aM.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),uM(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),hM(t)&&(t=t.toHexString()),cM(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":aM.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return uM(new Uint8Array(i))}return lM(t)?uM(new Uint8Array(t)):aM.throwArgumentError("invalid arrayify value","value",t)}function cM(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function dM(t,e){if(e||(e={}),"number"==typeof t){aM.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),hM(t))return t.toHexString();if(cM(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":aM.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(lM(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return aM.throwArgumentError("invalid hexlify value","value",t)}function mM(t,e){for("string"!=typeof t?t=dM(t):cM(t)||aM.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&aM.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function pM(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(cM(r=t)&&!(r.length%2)||lM(r)){const r=fM(t);65!==r.length&&aM.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),e.r=dM(r.slice(0,32)),e.s=dM(r.slice(32,64)),e.v=r[64],e.v<27&&(0===e.v||1===e.v?e.v+=27:aM.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=dM(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=fM(t)).length>e&&aM.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),uM(r)}(fM(e._vs),32);e._vs=dM(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&aM.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const n=dM(r);null==e.s?e.s=n:e.s!==n&&aM.throwArgumentError("signature v mismatch _vs","signature",t)}null==e.recoveryParam?null==e.v?aM.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2:null==e.v?e.v=27+e.recoveryParam:e.recoveryParam!==1-e.v%2&&aM.throwArgumentError("signature recoveryParam mismatch v","signature",t),null!=e.r&&cM(e.r)?e.r=mM(e.r,32):aM.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&cM(e.s)?e.s=mM(e.s,32):aM.throwArgumentError("signature missing or invalid s","signature",t);const r=fM(e.s);r[0]>=128&&aM.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=dM(r);e._vs&&(cM(e._vs)||aM.throwArgumentError("signature invalid _vs","signature",t),e._vs=mM(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&aM.throwArgumentError("signature _vs mismatch v and s","signature",t)}var r;return e}window&&window.__awaiter;new sM("properties/5.4.0");function gM(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}const vM=new sM("signing-key/5.4.0");let yM=null;function wM(){return yM||(yM=new Xw("secp256k1")),yM}class MM{constructor(t){gM(this,"curve","secp256k1"),gM(this,"privateKey",dM(t));const e=wM().keyFromPrivate(fM(this.privateKey));gM(this,"publicKey","0x"+e.getPublic(!1,"hex")),gM(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),gM(this,"_isSigningKey",!0)}_addPoint(t){const e=wM().keyFromPublic(fM(this.publicKey)),r=wM().keyFromPublic(fM(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=wM().keyFromPrivate(fM(this.privateKey)),r=fM(t);32!==r.length&&vM.throwArgumentError("bad digest length","digest",t);const i=e.sign(r,{canonical:!0});return pM({recoveryParam:i.recoveryParam,r:mM("0x"+i.r.toString(16),32),s:mM("0x"+i.s.toString(16),32)})}computeSharedSecret(t){const e=wM().keyFromPrivate(fM(this.privateKey)),r=wM().keyFromPublic(fM(bM(t)));return mM("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function bM(t,e){const r=fM(t);if(32===r.length){const t=new MM(r);return e?"0x"+wM().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?dM(r):"0x"+wM().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+wM().keyFromPublic(r).getPublic(!0,"hex"):dM(r):vM.throwArgumentError("invalid public or private key","key","[REDACTED]")}let EM=!1,_M=!1;const NM={debug:1,default:2,info:2,warning:3,error:4,off:5};let AM=NM.default,SM=null;const RM=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var xM,IM;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(xM||(xM={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(IM||(IM={}));class kM{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==NM[r]&&this.throwArgumentError("invalid log level name","logLevel",t),AM>NM[r]||console.log.apply(console,e)}debug(...t){this._log(kM.levels.DEBUG,t)}info(...t){this._log(kM.levels.INFO,t)}warn(...t){this._log(kM.levels.WARNING,t)}makeError(t,e,r){if(_M)return this.makeError("censored error",e,{});e||(e=kM.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,kM.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){RM&&this.throwError("platform missing String.prototype.normalize",kM.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:RM})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,kM.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,kM.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,kM.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,kM.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",kM.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",kM.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",kM.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return SM||(SM=new kM("logger/5.4.0")),SM}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",kM.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),EM){if(!t)return;this.globalLogger().throwError("error censorship permanent",kM.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_M=!!t,EM=!!e}static setLogLevel(t){const e=NM[t.toLowerCase()];null!=e?AM=e:kM.globalLogger().warn("invalid log level - "+t)}static from(t){return new kM(t)}}kM.errors=IM,kM.levels=xM;const TM=new kM("bytes/5.4.0");function OM(t){return!!t.toHexString}function PM(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return PM(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function CM(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function UM(t,e){if(e||(e={}),"number"==typeof t){TM.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),PM(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),OM(t)&&(t=t.toHexString()),FM(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":TM.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return PM(new Uint8Array(i))}return CM(t)?PM(new Uint8Array(t)):TM.throwArgumentError("invalid arrayify value","value",t)}function FM(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function BM(t,e,r){return"string"!=typeof t?t=function(t,e){if(e||(e={}),"number"==typeof t){TM.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),OM(t))return t.toHexString();if(FM(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":TM.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(CM(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return TM.throwArgumentError("invalid hexlify value","value",t)}(t):(!FM(t)||t.length%2)&&TM.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}var DM=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,f=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!==(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);i=(m=m.idivn(d)).isZero()?p+i:u[c-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),l=this.clone();if(h){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],M=8191&w,b=w>>>13,E=0|s[4],_=8191&E,N=E>>>13,A=0|s[5],S=8191&A,R=A>>>13,x=0|s[6],I=8191&x,k=x>>>13,T=0|s[7],O=8191&T,P=T>>>13,C=0|s[8],U=8191&C,F=C>>>13,B=0|s[9],D=8191&B,L=B>>>13,$=0|a[0],j=8191&$,z=$>>>13,q=0|a[1],G=8191&q,V=q>>>13,Z=0|a[2],K=8191&Z,H=Z>>>13,W=0|a[3],J=8191&W,X=W>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(c,j)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,j),n=(n=Math.imul(v,z))+Math.imul(y,j)|0,o=Math.imul(y,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,V)|0;var yt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,z))+Math.imul(b,j)|0,o=Math.imul(b,z),i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,X)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(_,j),n=(n=Math.imul(_,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,X)|0;var Mt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(k,j)|0,o=Math.imul(k,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Et=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(u+(i=i+Math.imul(f,ht)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,z))+Math.imul(F,j)|0,o=Math.imul(F,z),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Nt=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,V)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(M,ot)|0,n=(n=n+Math.imul(M,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ht)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var At=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;u=((o=o+Math.imul(c,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,V))+Math.imul(L,G)|0,o=Math.imul(L,V),i=i+Math.imul(U,K)|0,n=(n=n+Math.imul(U,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var St=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,H))+Math.imul(L,K)|0,o=Math.imul(L,H),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,X)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,X))+Math.imul(L,J)|0,o=Math.imul(L,X),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var xt=(u+(i=i+Math.imul(M,mt)|0)|0)+((8191&(n=(n=n+Math.imul(M,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var It=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(U,ot)|0,n=(n=n+Math.imul(U,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ft)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(S,mt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(U,ht)|0,n=(n=n+Math.imul(U,ut)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(U,ft)|0,n=(n=n+Math.imul(U,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Ot=(u+(i=i+Math.imul(O,mt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ft),n=(n=Math.imul(D,ct))+Math.imul(L,ft)|0,o=Math.imul(L,ct);var Pt=(u+(i=i+Math.imul(U,mt)|0)|0)+((8191&(n=(n=n+Math.imul(U,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ct=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=Et,h[7]=_t,h[8]=Nt,h[9]=At,h[10]=St,h[11]=Rt,h[12]=xt,h[13]=It,h[14]=kt,h[15]=Tt,h[16]=Ot,h[17]=Pt,h[18]=Ct,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),c=67108863&f;a=67108863&(c=c+a|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},p.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},p.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var f=h,c=u,d=0;d<s;d++){var m=r[l+d],p=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=m+g,i[l+d]=p+v,r[l+d+s]=m-g,i[l+d+s]=p-v,d!==a&&(y=h*f-u*c,c=h*c+u*f,f=y)}},p.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},p.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},p.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,l,f,i,n);for(var d=0;d<i;d++){var m=a[d]*l[d]-h[d]*f[d];h[d]=a[d]*f[d]+h[d]*l[d],a[d]=m}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var f=h-1;f>=0;f--){var c=67108864*(0|i.words[o.length+f])+(0|i.words[o.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(f)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(M,v),i(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var v=this.pow(f,new n(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new _(t)},i(_,E),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,n)})).BN;new kM("bignumber/5.4.0");function LM(t){return"0x"+si.keccak_256(UM(t))}const $M=new kM("address/5.4.0");function jM(t){FM(t,20)||$M.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=UM(LM(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const zM={};for(let t=0;t<10;t++)zM[String(t)]=String(t);for(let t=0;t<26;t++)zM[String.fromCharCode(65+t)]=String(10+t);const qM=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function GM(t){let e=null;if("string"!=typeof t&&$M.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=jM(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&$M.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>zM[t]).join("");for(;e.length>=qM;){let t=e.substring(0,qM);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&$M.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new DM(r,36).toString(16);e.length<40;)e="0"+e;e=jM("0x"+e)}else $M.throwArgumentError("invalid address","address",t);var r;return e}new kM("transactions/5.4.0");var VM;function ZM(t,e){return function(t){return GM(BM(LM(BM(bM(t),1)),12))}(function(t,e){const r=pM(e),i={r:fM(r.r),s:fM(r.s)};return"0x"+wM().recoverPubKey(fM(t),i,r.recoveryParam).encode("hex",!1)}(UM(t),e))}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(VM||(VM={}));window&&window.__awaiter;new vy("wallet/5.4.0");function KM(t,i,n,o){return e(this,void 0,void 0,(function(){var e,s,a,h;return r(this,(function(r){switch(r.label){case 0:s="0x1626ba7e",a="function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4 magicValue)",r.label=1;case 1:return r.trys.push([1,3,,4]),[4,YM(o,[a],[t,"isValidSignature",[_(n),i]])];case 2:return e=r.sent(),[3,4];case 3:return h=r.sent(),console.log(h),[2,!1];case 4:return[2,e.toLowerCase()===s.toLowerCase()]}}))}))}function HM(t,i,n,o){return e(this,void 0,void 0,(function(){var e,s,a,h;return r(this,(function(r){switch(r.label){case 0:s="0x20c13b0b",a="function isValidSignature(bytes _hash, bytes memory _signature) public view returns (bytes4 magicValue)",r.label=1;case 1:return r.trys.push([1,3,,4]),[4,YM(o,[a],[t,"isValidSignature",[_(n),i]])];case 2:return e=r.sent(),[3,4];case 3:return h=r.sent(),console.log(h),[2,!1];case 4:return[2,e.toLowerCase()===s.toLowerCase()]}}))}))}function WM(t,i,n,o){return void 0===o&&(o="1"),e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return e=ay(o),[4,KM(t,i,n,e)];case 1:return r.sent()?[2,!0]:[4,HM(t,i,n,e)];case 2:return[2,r.sent()]}}))}))}function JM(t){var e=t.domain,r=t.types,i=t.message;return Hn.hash(e,r,i)}var XM=["cloudflare-ipfs.com","cf-ipfs.com","ipfs.io","ipfs.fleek.co","gateway.pinata.cloud","dweb.link","ipfs.infura.io"];function YM(t,n,o,s){return e(this,void 0,void 0,(function(){var e,a,h;return r(this,(function(r){switch(r.label){case 0:e=new ru(o[0],n,t),r.label=1;case 1:return r.trys.push([1,3,,4]),a=o[2]||[],[4,e[o[1]].apply(e,i(a,[s||{}]))];case 2:return[2,r.sent()];case 3:return h=r.sent(),[2,Promise.reject(h)];case 4:return[2]}}))}))}function QM(t,i,n,o,s){return e(this,void 0,void 0,(function(){var e,a,h,u,l;return r(this,(function(r){switch(r.label){case 0:e=["function aggregate(tuple(address target, bytes callData)[] calls) view returns (uint256 blockNumber, bytes[] returnData)"],a=new ru(oy[t].multicall,e,i),h=new eo(n),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,a.aggregate(o.map((function(t){return[t[0].toLowerCase(),h.encodeFunctionData(t[1],t[2])]})),s||{})];case 2:return u=r.sent(),[2,u[1].map((function(t,e){return h.decodeFunctionResult(o[e][1],t)}))];case 3:return l=r.sent(),[2,Promise.reject(l)];case 4:return[2]}}))}))}function tb(i,n,o){return void 0===o&&(o={}),e(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,h(i,{method:"POST",headers:t({Accept:"application/json","Content-Type":"application/json"},null==o?void 0:o.headers),body:JSON.stringify({query:hu.jsonToGraphQLQuery({query:n})})})];case 1:return[4,e.sent().json()];case 2:return[2,e.sent().data||{}]}}))}))}function eb(t,n,o,s,a,h){return void 0===h&&(h={}),e(this,void 0,void 0,(function(){var e,u,l;return r(this,(function(r){switch(r.label){case 0:return e=t.getSigner(),u=new ru(n,o,t),[4,(l=u.connect(e))[s].apply(l,i(a,[h]))];case 1:return[2,r.sent()]}}))}))}function rb(t,i,n,o,s,a){return void 0===a&&(a="latest"),e(this,void 0,void 0,(function(){var e,o;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),e={space:t,network:n,snapshot:a,strategies:i,addresses:s},[4,h("https://score.snapshot.org/api/scores",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({params:e})})];case 1:return[4,r.sent().json()];case 2:return[2,r.sent().result.scores];case 3:return o=r.sent(),[2,Promise.reject(o)];case 4:return[2]}}))}))}var ib={call:YM,multicall:QM,subgraphRequest:tb,ipfsGet:function(t,i,n){return void 0===n&&(n="ipfs"),e(this,void 0,void 0,(function(){return r(this,(function(e){return[2,h("https://"+t+"/"+n+"/"+i).then((function(t){return t.json()}))]}))}))},getUrl:function(t,e){void 0===e&&(e=XM[0]);var r="https://"+e;if(!t)return null;if(!t.includes("ipfs")&&!t.includes("ipns")&&!t.includes("http"))return r+"/ipfs/"+t;var i=t.split("://")[0];return"ipfs"===i?t.replace("ipfs://",r+"/ipfs/"):"ipns"===i?t.replace("ipns://",r+"/ipns/"):t},sendTransaction:eb,getScores:rb,validateSchema:function(t,e){var r=new lf({allErrors:!0,allowUnionTypes:!0,$data:!0});df(r);var i=r.compile(t),n=i(e);return n||i.errors},getProvider:ay,signMessage:R,getBlockNumber:function(t){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.getBlockNumber()];case 1:return e=r.sent(),[2,parseInt(e)];case 2:return r.sent(),[2,Promise.reject()];case 3:return[2]}}))}))},Multicaller:oc,validations:hy,getHash:JM,verify:function(t,i,n){return e(this,void 0,void 0,(function(){var e,o,s,a,h;return r(this,(function(r){switch(r.label){case 0:return e=n.domain,o=n.types,s=n.message,a=function(t,e,r,i){return ZM(mw.hash(t,e,r),i)}(e,o,s,i),h=JM(n),console.log("Hash",h),console.log("Address",t),console.log("Recover address",a),t===a?[2,!0]:(console.log("Check EIP1271 signature"),[4,WM(t,i,h)]);case 1:return[2,r.sent()]}}))}))}},nb=""+"0x".padEnd(42,"0"),ob={1:"https://api.thegraph.com/subgraphs/name/aragon/aragon-govern-mainnet",4:"https://api.thegraph.com/subgraphs/name/aragon/aragon-govern-rinkeby"},sb=[{inputs:[{components:[{components:[{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"executionTime",type:"uint256"},{internalType:"address",name:"submitter",type:"address"},{internalType:"contract IERC3000Executor",name:"executor",type:"address"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct ERC3000Data.Action[]",name:"actions",type:"tuple[]"},{internalType:"bytes32",name:"allowFailuresMap",type:"bytes32"},{internalType:"bytes",name:"proof",type:"bytes"}],internalType:"struct ERC3000Data.Payload",name:"payload",type:"tuple"},{components:[{internalType:"uint256",name:"executionDelay",type:"uint256"},{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ERC3000Data.Collateral",name:"scheduleDeposit",type:"tuple"},{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ERC3000Data.Collateral",name:"challengeDeposit",type:"tuple"},{internalType:"address",name:"resolver",type:"address"},{internalType:"bytes",name:"rules",type:"bytes"},{internalType:"uint256",name:"maxCalldataSize",type:"uint256"}],internalType:"struct ERC3000Data.Config",name:"config",type:"tuple"}],internalType:"struct ERC3000Data.Container",name:"_container",type:"tuple"}],name:"schedule",outputs:[{internalType:"bytes32",name:"containerHash",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"nonce",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],ab=[{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],hb={registryEntry:{__args:{id:void 0},executor:{address:!0},queue:{address:!0,config:{executionDelay:!0,scheduleDeposit:{token:!0,amount:!0},challengeDeposit:{token:!0,amount:!0},resolver:!0,rules:!0,maxCalldataSize:!0}}}};function ub(t,i,n,o,s,a){return e(this,void 0,void 0,(function(){var e,h,u,l,f,c,d,m;return r(this,(function(r){switch(r.label){case 0:return(e=hb).registryEntry.__args.id=n,[4,tb(ob[t],e)];case 1:return h=r.sent(),u=h.registryEntry.queue.config,[4,YM(i,sb,[h.registryEntry.queue.address,"nonce"])];case 2:return l=r.sent(),f=Wt.from(l),c=f.add(Wt.from(1)),d=Math.round(Date.now()/1e3)+Number(u.executionDelay)+60,[4,YM(i,ab,[u.scheduleDeposit.token,"allowance",[o,h.registryEntry.queue.address]])];case 3:return(m=r.sent()).lt(u.scheduleDeposit.amount)&&u.scheduleDeposit.token!==nb?m.isZero()?[3,6]:[4,eb(i,u.scheduleDeposit.token,ab,"approve",[h.registryEntry.queue.address,"0"])]:[3,8];case 4:return[4,r.sent().wait(1)];case 5:r.sent(),r.label=6;case 6:return[4,eb(i,u.scheduleDeposit.token,ab,"approve",[h.registryEntry.queue.address,u.scheduleDeposit.amount])];case 7:r.sent(),r.label=8;case 8:return[4,eb(i,h.registryEntry.queue.address,sb,"schedule",[{payload:{nonce:c.toString(),executionTime:d,submitter:o,executor:h.registryEntry.executor.address,actions:a,allowFailuresMap:"0x0000000000000000000000000000000000000000000000000000000000000000",proof:s?Ae(s):"0x00"},config:{executionDelay:u.executionDelay,scheduleDeposit:{token:u.scheduleDeposit.token,amount:u.scheduleDeposit.amount},challengeDeposit:{token:u.challengeDeposit.token,amount:u.challengeDeposit.amount},resolver:u.resolver,rules:u.rules,maxCalldataSize:u.maxCalldataSize}}],{gasLimit:5e5})];case 9:return[2,r.sent()]}}))}))}var lb=function(){function t(){this.author="Evalir",this.version="0.1.3",this.name="Aragon Govern",this.website="https://aragon.org/blog/snapshot"}return t.prototype.action=function(t,i,n,o,s,a){return e(this,void 0,void 0,(function(){var e,h;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,i.listAccounts()];case 1:return e=r.sent()[0],[4,ub(t,i,n.id,e,s,o["choice"+a].actions)];case 2:return[2,r.sent()];case 3:return h=r.sent(),console.error(h),[3,4];case 4:return[2]}}))}))},t}(),fb=function(){this.author="zerquix18",this.version="0.1.0",this.name="Charts"},cb={1:"https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2",4:"https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2-rinkeby",100:"https://api.thegraph.com/subgraphs/name/1hive/uniswap-v2"},db={1:"https://api.thegraph.com/subgraphs/name/protofire/omen",4:"https://api.thegraph.com/subgraphs/name/protofire/omen-rinkeby",100:"https://api.thegraph.com/subgraphs/name/protofire/omen-xdai"},mb={1:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",4:"0xc778417e063141139fce010982780140aa0cd5ab",100:"0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1"},pb={condition:{__args:{id:void 0},id:!0,fixedProductMarketMakers:{id:!0,collateralToken:!0,outcomeTokenAmounts:!0,outcomeTokenMarginalPrices:!0}}},gb={pairsTokens:{__aliasFor:"pairs",__args:{where:{token0:!0,token1:!0}},token0Price:!0},pairsTokensInverted:{__aliasFor:"pairs",__args:{where:{token0:!0,token1:!0}},token1Price:!0},pairsTokens0:{__aliasFor:"pairs",__args:{where:{token0:!0,token1:!0}},token0Price:!0},pairsTokens1:{__aliasFor:"pairs",__args:{where:{token0:!0,token1:!0}},token0Price:!0}},vb=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_upgradedAddress",type:"address"}],name:"deprecate",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"deprecated",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_evilUser",type:"address"}],name:"addBlackList",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"upgradedAddress",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"balances",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"maximumFee",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"_totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[],name:"unpause",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_maker",type:"address"}],name:"getBlackListStatus",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"},{name:"",type:"address"}],name:"allowed",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"paused",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"who",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[],name:"pause",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"getOwner",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"owner",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"newBasisPoints",type:"uint256"},{name:"newMaxFee",type:"uint256"}],name:"setParams",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"amount",type:"uint256"}],name:"issue",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"amount",type:"uint256"}],name:"redeem",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"remaining",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"basisPointsRate",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"isBlackListed",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_clearedUser",type:"address"}],name:"removeBlackList",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"MAX_UINT",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"_blackListedUser",type:"address"}],name:"destroyBlackFunds",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{inputs:[{name:"_initialSupply",type:"uint256"},{name:"_name",type:"string"},{name:"_symbol",type:"string"},{name:"_decimals",type:"uint256"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,name:"amount",type:"uint256"}],name:"Issue",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"amount",type:"uint256"}],name:"Redeem",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"newAddress",type:"address"}],name:"Deprecate",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"feeBasisPoints",type:"uint256"},{indexed:!1,name:"maxFee",type:"uint256"}],name:"Params",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"_blackListedUser",type:"address"},{indexed:!1,name:"_balance",type:"uint256"}],name:"DestroyedBlackFunds",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"_user",type:"address"}],name:"AddedBlackList",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"_user",type:"address"}],name:"RemovedBlackList",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[],name:"Pause",type:"event"},{anonymous:!1,inputs:[],name:"Unpause",type:"event"}],yb=function(t,i){return e(void 0,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,QM(t._network.chainId.toString(),t,vb,[[i,"name"],[i,"symbol"]])];case 1:return[2,e.sent()]}}))}))},wb=function(){function t(){this.author="davidalbela",this.version="0.0.1",this.name="Gnosis Impact",this.website="https://gnosis.io"}return t.prototype.getTokenInfo=function(t,i){return e(this,void 0,void 0,(function(){var e,n;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,yb(t,i)];case 1:return e=r.sent(),[2,{address:i,checksumAddress:Ch(i),name:e[0][0],symbol:e[1][0]}];case 2:throw n=r.sent(),new Error(n);case 3:return[2]}}))}))},t.prototype.getOmenCondition=function(t,i){return e(this,void 0,void 0,(function(){var e,n;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(e=pb).condition.__args.id=i,[4,tb(db[t],e)];case 1:return[2,r.sent()];case 2:return n=r.sent(),console.error(n),[3,3];case 3:return[2]}}))}))},t.prototype.getUniswapPair=function(t,i,n){return e(this,void 0,void 0,(function(){var e,o,s;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(e=gb).pairsTokens.__args.where={token0:i.toLowerCase(),token1:n.toLowerCase()},e.pairsTokensInverted.__args.where={token0:n.toLowerCase(),token1:i.toLowerCase()},e.pairsTokens0.__args.where={token0:i.toLowerCase(),token1:mb[t]},e.pairsTokens1.__args.where={token0:n.toLowerCase(),token1:mb[t]},[4,tb(cb[t],e)];case 1:if((o=r.sent()).pairsTokens.length>0)return[2,o.pairsTokens[0]];if(o.pairsTokensInverted.length>0)return[2,{token0Price:o.pairsTokensInverted[0].token1Price}];if(o.pairsTokens0.length>0&&o.pairsTokens1.length>0)return[2,{token0Price:(parseFloat(o.pairsTokens0[0].token0Price)/parseFloat(o.pairsTokens1[0].token0Price)).toString()}];throw new Error("Does not exist market pairs for "+i+" and "+n+".");case 2:return s=r.sent(),console.error(s),[3,3];case 3:return[2]}}))}))},t}(),Mb=Object.defineProperty({version:"bignumber/5.0.12"},"__esModule",{value:!0}),bb=s(Gt),Eb=s(y),_b=(n&&n.__importDefault||function(t){return t&&t.__esModule?t:{default:t}})(kt).default.BN,Nb=new Eb.Logger(Mb.version),Ab={};var Sb=function(t){return null!=t&&(xb.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||bb.isHexString(t)||"bigint"==typeof t||bb.isBytes(t))},Rb=!1,xb=function(){function t(e,r){var i=this.constructor;Nb.checkNew(i,t),e!==Ab&&Nb.throwError("cannot call constructor directly; use BigNumber.from",Eb.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}return t.prototype.fromTwos=function(t){return Tb(Ob(this).fromTwos(t))},t.prototype.toTwos=function(t){return Tb(Ob(this).toTwos(t))},t.prototype.abs=function(){return"-"===this._hex[0]?t.from(this._hex.substring(1)):this},t.prototype.add=function(t){return Tb(Ob(this).add(Ob(t)))},t.prototype.sub=function(t){return Tb(Ob(this).sub(Ob(t)))},t.prototype.div=function(e){return t.from(e).isZero()&&Pb("division by zero","div"),Tb(Ob(this).div(Ob(e)))},t.prototype.mul=function(t){return Tb(Ob(this).mul(Ob(t)))},t.prototype.mod=function(t){var e=Ob(t);return e.isNeg()&&Pb("cannot modulo negative values","mod"),Tb(Ob(this).umod(e))},t.prototype.pow=function(t){var e=Ob(t);return e.isNeg()&&Pb("cannot raise to negative values","pow"),Tb(Ob(this).pow(e))},t.prototype.and=function(t){var e=Ob(t);return(this.isNegative()||e.isNeg())&&Pb("cannot 'and' negative values","and"),Tb(Ob(this).and(e))},t.prototype.or=function(t){var e=Ob(t);return(this.isNegative()||e.isNeg())&&Pb("cannot 'or' negative values","or"),Tb(Ob(this).or(e))},t.prototype.xor=function(t){var e=Ob(t);return(this.isNegative()||e.isNeg())&&Pb("cannot 'xor' negative values","xor"),Tb(Ob(this).xor(e))},t.prototype.mask=function(t){return(this.isNegative()||t<0)&&Pb("cannot mask negative values","mask"),Tb(Ob(this).maskn(t))},t.prototype.shl=function(t){return(this.isNegative()||t<0)&&Pb("cannot shift negative values","shl"),Tb(Ob(this).shln(t))},t.prototype.shr=function(t){return(this.isNegative()||t<0)&&Pb("cannot shift negative values","shr"),Tb(Ob(this).shrn(t))},t.prototype.eq=function(t){return Ob(this).eq(Ob(t))},t.prototype.lt=function(t){return Ob(this).lt(Ob(t))},t.prototype.lte=function(t){return Ob(this).lte(Ob(t))},t.prototype.gt=function(t){return Ob(this).gt(Ob(t))},t.prototype.gte=function(t){return Ob(this).gte(Ob(t))},t.prototype.isNegative=function(){return"-"===this._hex[0]},t.prototype.isZero=function(){return Ob(this).isZero()},t.prototype.toNumber=function(){try{return Ob(this).toNumber()}catch(t){Pb("overflow","toNumber",this.toString())}return null},t.prototype.toString=function(){return arguments.length>0&&(10===arguments[0]?Rb||(Rb=!0,Nb.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Nb.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Eb.Logger.errors.UNEXPECTED_ARGUMENT,{}):Nb.throwError("BigNumber.toString does not accept parameters",Eb.Logger.errors.UNEXPECTED_ARGUMENT,{})),Ob(this).toString(10)},t.prototype.toHexString=function(){return this._hex},t.prototype.toJSON=function(t){return{type:"BigNumber",hex:this.toHexString()}},t.from=function(e){if(e instanceof t)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new t(Ab,kb(e)):e.match(/^-?[0-9]+$/)?new t(Ab,kb(new _b(e))):Nb.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Pb("underflow","BigNumber.from",e),(e>=9007199254740991||e<=-9007199254740991)&&Pb("overflow","BigNumber.from",e),t.from(String(e));var r,i=e;if("bigint"==typeof i)return t.from(i.toString());if(bb.isBytes(i))return t.from(bb.hexlify(i));if(i)if(i.toHexString){if("string"==typeof(r=i.toHexString()))return t.from(r)}else if(null==(r=i._hex)&&"BigNumber"===i.type&&(r=i.hex),"string"==typeof r&&(bb.isHexString(r)||"-"===r[0]&&bb.isHexString(r.substring(1))))return t.from(r);return Nb.throwArgumentError("invalid BigNumber value","value",e)},t.isBigNumber=function(t){return!(!t||!t._isBigNumber)},t}(),Ib=xb;function kb(t){if("string"!=typeof t)return kb(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Nb.throwArgumentError("invalid hex","value",t),"0x00"===(t=kb(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Tb(t){return xb.from(kb(t))}function Ob(t){var e=xb.from(t).toHexString();return"-"===e[0]?new _b("-"+e.substring(3),16):new _b(e.substring(2),16)}function Pb(t,e,r){var i={fault:t,operation:e};return null!=r&&(i.value=r),Nb.throwError(t,Eb.Logger.errors.NUMERIC_FAULT,i)}Wt.from(-1),Wt.from(0),Wt.from(1),Wt.from(2),Wt.from("1000000000000000000"),Wt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Cb=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:It.Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,s=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var f=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,f=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var m=u-d|0;l+=(s=(n=0|t.words[m])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<n|o)).toString(16);i=0!==(o=a>>>24-n&16777215)||s!==this.length-1?u[6-h.length]+h+i:h+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modn(d).toString(t);i=(m=m.idivn(d)).isZero()?p+i:u[c-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,h="le"===e,u=new t(o),l=this.clone();if(h){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a<o;a++)u[a]=0}else{for(a=0;a<o-n;a++)u[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[o-a-1]=s}return u},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],m=8191&d,p=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,w=0|s[3],M=8191&w,b=w>>>13,E=0|s[4],_=8191&E,N=E>>>13,A=0|s[5],S=8191&A,R=A>>>13,x=0|s[6],I=8191&x,k=x>>>13,T=0|s[7],O=8191&T,P=T>>>13,C=0|s[8],U=8191&C,F=C>>>13,B=0|s[9],D=8191&B,L=B>>>13,$=0|a[0],j=8191&$,z=$>>>13,q=0|a[1],G=8191&q,V=q>>>13,Z=0|a[2],K=8191&Z,H=Z>>>13,W=0|a[3],J=8191&W,X=W>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],ot=8191&nt,st=nt>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],mt=8191&dt,pt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,z))+Math.imul(c,j)|0))<<13)|0;u=((o=Math.imul(c,z))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,j),n=(n=Math.imul(m,z))+Math.imul(p,j)|0,o=Math.imul(p,z);var vt=(u+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0;u=((o=o+Math.imul(c,V)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,j),n=(n=Math.imul(v,z))+Math.imul(y,j)|0,o=Math.imul(y,z),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,G)|0,o=o+Math.imul(p,V)|0;var yt=(u+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,K)|0))<<13)|0;u=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,z))+Math.imul(b,j)|0,o=Math.imul(b,z),i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,i=i+Math.imul(m,K)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,K)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,X)|0)+Math.imul(c,J)|0))<<13)|0;u=((o=o+Math.imul(c,X)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(_,j),n=(n=Math.imul(_,z))+Math.imul(N,j)|0,o=Math.imul(N,z),i=i+Math.imul(M,G)|0,n=(n=n+Math.imul(M,V)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,X)|0)+Math.imul(p,J)|0,o=o+Math.imul(p,X)|0;var Mt=(u+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,z))+Math.imul(R,j)|0,o=Math.imul(R,z),i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,V)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,H)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,o=o+Math.imul(p,tt)|0;var bt=(u+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(I,j),n=(n=Math.imul(I,z))+Math.imul(k,j)|0,o=Math.imul(k,z),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,X)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Et=(u+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;u=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,j),n=(n=Math.imul(O,z))+Math.imul(P,j)|0,o=Math.imul(P,z),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,H)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,st)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,st)|0;var _t=(u+(i=i+Math.imul(f,ht)|0)|0)+((8191&(n=(n=n+Math.imul(f,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((o=o+Math.imul(c,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(U,j),n=(n=Math.imul(U,z))+Math.imul(F,j)|0,o=Math.imul(F,z),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,V)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,X)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Nt=(u+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;u=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,j),n=(n=Math.imul(D,z))+Math.imul(L,j)|0,o=Math.imul(L,z),i=i+Math.imul(U,G)|0,n=(n=n+Math.imul(U,V)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,V)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(M,ot)|0,n=(n=n+Math.imul(M,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ht)|0,n=(n=n+Math.imul(v,ut)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,ut)|0,i=i+Math.imul(m,ft)|0,n=(n=n+Math.imul(m,ct)|0)+Math.imul(p,ft)|0,o=o+Math.imul(p,ct)|0;var At=(u+(i=i+Math.imul(f,mt)|0)|0)+((8191&(n=(n=n+Math.imul(f,pt)|0)+Math.imul(c,mt)|0))<<13)|0;u=((o=o+Math.imul(c,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,V))+Math.imul(L,G)|0,o=Math.imul(L,V),i=i+Math.imul(U,K)|0,n=(n=n+Math.imul(U,H)|0)+Math.imul(F,K)|0,o=o+Math.imul(F,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(M,ht)|0,n=(n=n+Math.imul(M,ut)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,ut)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var St=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,H))+Math.imul(L,K)|0,o=Math.imul(L,H),i=i+Math.imul(U,J)|0,n=(n=n+Math.imul(U,X)|0)+Math.imul(F,J)|0,o=o+Math.imul(F,X)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,ut)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var Rt=(u+(i=i+Math.imul(v,mt)|0)|0)+((8191&(n=(n=n+Math.imul(v,pt)|0)+Math.imul(y,mt)|0))<<13)|0;u=((o=o+Math.imul(y,pt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,X))+Math.imul(L,J)|0,o=Math.imul(L,X),i=i+Math.imul(U,Q)|0,n=(n=n+Math.imul(U,tt)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,tt)|0,i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,i=i+Math.imul(_,ft)|0,n=(n=n+Math.imul(_,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var xt=(u+(i=i+Math.imul(M,mt)|0)|0)+((8191&(n=(n=n+Math.imul(M,pt)|0)+Math.imul(b,mt)|0))<<13)|0;u=((o=o+Math.imul(b,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(L,Q)|0,o=Math.imul(L,tt),i=i+Math.imul(U,rt)|0,n=(n=n+Math.imul(U,it)|0)+Math.imul(F,rt)|0,o=o+Math.imul(F,it)|0,i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(R,ft)|0,o=o+Math.imul(R,ct)|0;var It=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(N,mt)|0))<<13)|0;u=((o=o+Math.imul(N,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(L,rt)|0,o=Math.imul(L,it),i=i+Math.imul(U,ot)|0,n=(n=n+Math.imul(U,st)|0)+Math.imul(F,ot)|0,o=o+Math.imul(F,st)|0,i=i+Math.imul(O,ht)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(I,ft)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(S,mt)|0)|0)+((8191&(n=(n=n+Math.imul(S,pt)|0)+Math.imul(R,mt)|0))<<13)|0;u=((o=o+Math.imul(R,pt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),i=i+Math.imul(U,ht)|0,n=(n=n+Math.imul(U,ut)|0)+Math.imul(F,ht)|0,o=o+Math.imul(F,ut)|0,i=i+Math.imul(O,ft)|0,n=(n=n+Math.imul(O,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Tt=(u+(i=i+Math.imul(I,mt)|0)|0)+((8191&(n=(n=n+Math.imul(I,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul(L,ht)|0,o=Math.imul(L,ut),i=i+Math.imul(U,ft)|0,n=(n=n+Math.imul(U,ct)|0)+Math.imul(F,ft)|0,o=o+Math.imul(F,ct)|0;var Ot=(u+(i=i+Math.imul(O,mt)|0)|0)+((8191&(n=(n=n+Math.imul(O,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(D,ft),n=(n=Math.imul(D,ct))+Math.imul(L,ft)|0,o=Math.imul(L,ct);var Pt=(u+(i=i+Math.imul(U,mt)|0)|0)+((8191&(n=(n=n+Math.imul(U,pt)|0)+Math.imul(F,mt)|0))<<13)|0;u=((o=o+Math.imul(F,pt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Ct=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul(L,mt)|0))<<13)|0;return u=((o=Math.imul(L,pt))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=Et,h[7]=_t,h[8]=Nt,h[9]=At,h[10]=St,h[11]=Rt,h[12]=xt,h[13]=It,h[14]=kt,h[15]=Tt,h[16]=Ot,h[17]=Pt,h[18]=Ct,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(d=c),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var a=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,f=(0|t.words[l])*(0|e.words[u]),c=67108863&f;a=67108863&(c=c+a|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=a,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},p.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},p.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var a=s<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var f=h,c=u,d=0;d<s;d++){var m=r[l+d],p=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=m+g,i[l+d]=p+v,r[l+d+s]=m-g,i[l+d+s]=p-v,d!==a&&(y=h*f-u*c,c=h*c+u*f,f=y)}},p.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},p.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},p.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},p.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},p.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),a=new Array(i),h=new Array(i),u=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,u,i),this.transform(s,o,a,h,i,n),this.transform(u,o,l,f,i,n);for(var d=0;d<i;d++){var m=a[d]*l[d]-h[d]*f[d];h[d]=a[d]*f[d]+h[d]*l[d],a[d]=m}return this.conjugate(a,h,i),this.transform(a,h,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),m(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<i;this.words[e]=h|s,s=a>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=i;if(n-=s,n=Math.max(0,n),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,s=t.length+i;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var h=(0|t.words[n])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),i.iushln(r),s=0|o.words[o.length-1]);var a,h=i.length-o.length;if("mod"!==e){(a=new n(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,a&&(a.words[h]=1));for(var f=h-1;f>=0;f--){var c=67108864*(0|i.words[o.length+f])+(0|i.words[o.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(o,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=c)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),i&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(e*i+(0|this.words[n]))%t;return i},n.prototype.idivn=function(t){r(t<=67108863);for(var e=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*e;this.words[i]=n/t|0,e=n%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),s=new n(0),a=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(f)),o.iushrn(1),s.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(f)),a.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(a),s.isub(h)):(i.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new n(1),a=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var f=0,c=1;0==(i.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a)):(i.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,s=i;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this.strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function _(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var n=t.words[9];for(e.words[e.length++]=4194303&n,i=10;i<t.length;i++){var o=0|t.words[i];t.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,v),i(M,v),i(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new n(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),m=s;0!==d.cmp(a);){for(var p=d,g=0;0!==p.cmp(a);g++)p=p.redSqr();r(g<m);var v=this.pow(f,new n(1).iushln(m-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),m=g}return c},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===i&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new _(t)},i(_,E),_.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},_.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},_.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},_.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},_.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,n)}));let Ub=!1,Fb=!1;const Bb={debug:1,default:2,info:2,warning:3,error:4,off:5};let Db=Bb.default,Lb=null;const $b=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var jb,zb;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(jb||(jb={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT"}(zb||(zb={}));class qb{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Bb[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Db>Bb[r]||console.log.apply(console,e)}debug(...t){this._log(qb.levels.DEBUG,t)}info(...t){this._log(qb.levels.INFO,t)}warn(...t){this._log(qb.levels.WARNING,t)}makeError(t,e,r){if(Fb)return this.makeError("censored error",e,{});e||(e=qb.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(t=>{try{i.push(t+"="+JSON.stringify(r[t]))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push("code="+e),i.push("version="+this.version);const n=t;i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,qb.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){$b&&this.throwError("platform missing String.prototype.normalize",qb.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:$b})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,qb.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,qb.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,qb.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,qb.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",qb.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",qb.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",qb.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Lb||(Lb=new qb("logger/5.0.10")),Lb}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",qb.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ub){if(!t)return;this.globalLogger().throwError("error censorship permanent",qb.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Fb=!!t,Ub=!!e}static setLogLevel(t){const e=Bb[t.toLowerCase()];null!=e?Db=e:qb.globalLogger().warn("invalid log level - "+t)}static from(t){return new qb(t)}}qb.errors=zb,qb.levels=jb;const Gb=new qb("bytes/5.0.11");function Vb(t){return!!t.toHexString}function Zb(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Zb(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Kb(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function Hb(t,e){if(e||(e={}),"number"==typeof t){Gb.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Zb(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Vb(t)&&(t=t.toHexString()),Xb(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":Gb.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return Zb(new Uint8Array(i))}return Kb(t)?Zb(new Uint8Array(t)):Gb.throwArgumentError("invalid arrayify value","value",t)}function Wb(t){const e=t.map(t=>Hb(t)),r=e.reduce((t,e)=>t+e.length,0),i=new Uint8Array(r);return e.reduce((t,e)=>(i.set(e,t),t+e.length),0),Zb(i)}function Jb(t,e){(t=Hb(t)).length>e&&Gb.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Zb(r)}function Xb(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function Yb(t,e){if(e||(e={}),"number"==typeof t){Gb.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Vb(t))return t.toHexString();if(Xb(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Gb.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Kb(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return e}return Gb.throwArgumentError("invalid hexlify value","value",t)}var Qb=Cb.BN;const tE=new qb("bignumber/5.0.15"),eE={};let rE=!1;class iE{constructor(t,e){tE.checkNew(new.target,iE),t!==eE&&tE.throwError("cannot call constructor directly; use BigNumber.from",qb.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return oE(sE(this).fromTwos(t))}toTwos(t){return oE(sE(this).toTwos(t))}abs(){return"-"===this._hex[0]?iE.from(this._hex.substring(1)):this}add(t){return oE(sE(this).add(sE(t)))}sub(t){return oE(sE(this).sub(sE(t)))}div(t){return iE.from(t).isZero()&&aE("division by zero","div"),oE(sE(this).div(sE(t)))}mul(t){return oE(sE(this).mul(sE(t)))}mod(t){const e=sE(t);return e.isNeg()&&aE("cannot modulo negative values","mod"),oE(sE(this).umod(e))}pow(t){const e=sE(t);return e.isNeg()&&aE("cannot raise to negative values","pow"),oE(sE(this).pow(e))}and(t){const e=sE(t);return(this.isNegative()||e.isNeg())&&aE("cannot 'and' negative values","and"),oE(sE(this).and(e))}or(t){const e=sE(t);return(this.isNegative()||e.isNeg())&&aE("cannot 'or' negative values","or"),oE(sE(this).or(e))}xor(t){const e=sE(t);return(this.isNegative()||e.isNeg())&&aE("cannot 'xor' negative values","xor"),oE(sE(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&aE("cannot mask negative values","mask"),oE(sE(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&aE("cannot shift negative values","shl"),oE(sE(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&aE("cannot shift negative values","shr"),oE(sE(this).shrn(t))}eq(t){return sE(this).eq(sE(t))}lt(t){return sE(this).lt(sE(t))}lte(t){return sE(this).lte(sE(t))}gt(t){return sE(this).gt(sE(t))}gte(t){return sE(this).gte(sE(t))}isNegative(){return"-"===this._hex[0]}isZero(){return sE(this).isZero()}toNumber(){try{return sE(this).toNumber()}catch(t){aE("overflow","toNumber",this.toString())}return null}toString(){return arguments.length>0&&(10===arguments[0]?rE||(rE=!0,tE.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?tE.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",qb.errors.UNEXPECTED_ARGUMENT,{}):tE.throwError("BigNumber.toString does not accept parameters",qb.errors.UNEXPECTED_ARGUMENT,{})),sE(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof iE)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new iE(eE,nE(t)):t.match(/^-?[0-9]+$/)?new iE(eE,nE(new Qb(t))):tE.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&aE("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&aE("overflow","BigNumber.from",t),iE.from(String(t));const e=t;if("bigint"==typeof e)return iE.from(e.toString());if(Kb(e))return iE.from(Yb(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return iE.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Xb(t)||"-"===t[0]&&Xb(t.substring(1))))return iE.from(t)}return tE.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function nE(t){if("string"!=typeof t)return nE(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&tE.throwArgumentError("invalid hex","value",t),"0x00"===(t=nE(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function oE(t){return iE.from(nE(t))}function sE(t){const e=iE.from(t).toHexString();return"-"===e[0]?new Qb("-"+e.substring(3),16):new Qb(e.substring(2),16)}function aE(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),tE.throwError(t,qb.errors.NUMERIC_FAULT,i)}const hE=new qb("strings/5.0.10");var uE,lE;function fE(t,e,r,i,n){if(t===lE.BAD_PREFIX||t===lE.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===lE.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(uE||(uE={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(lE||(lE={}));Object.freeze({error:function(t,e,r,i,n){return hE.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:fE,replace:function(t,e,r,i,n){return t===lE.OVERLONG?(i.push(n),0):(i.push(65533),fE(t,e,r))}});const cE=new RegExp("^bytes([0-9]+)$"),dE=new RegExp("^(u?int)([0-9]*)$"),mE=new RegExp("^(.*)\\[([0-9]*)\\]$");function pE(t,e,r){switch(t){case"address":return r?Jb(e,32):Hb(e);case"string":return function(t,e=uE.current){e!=uE.current&&(hE.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const o=65536+((1023&i)<<10)+(1023&n);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(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return Hb(r)}(e);case"bytes":return Hb(e);case"bool":return e=e?"0x01":"0x00",r?Jb(e,32):Hb(e)}let i=t.match(dE);if(i){let n=parseInt(i[2]||"256");if(i[2]&&String(n)!==i[2]||n%8!=0||0===n||n>256)throw new Error("invalid number type - "+t);return r&&(n=256),Jb(e=iE.from(e).toTwos(n),n/8)}if(i=t.match(cE),i){const n=parseInt(i[1]);if(String(n)!==i[1]||0===n||n>32)throw new Error("invalid bytes type - "+t);if(Hb(e).byteLength!==n)throw new Error("invalid value for "+t);return r?Hb((e+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):e}if(i=t.match(mE),i&&Array.isArray(e)){const r=i[1];if(parseInt(i[2]||String(e.length))!=e.length)throw new Error("invalid value for "+t);const n=[];return e.forEach((function(t){n.push(pE(r,t,!0))})),Wb(n)}throw new Error("invalid type - "+t)}function gE(t,e){return r=function(t,e){if(t.length!=e.length)throw new Error("type/value count mismatch");const r=[];return t.forEach((function(t,i){r.push(pE(t,e[i]))})),Yb(Wb(r))}(t,e),"0x"+si.keccak_256(Hb(r));var r}var vE={Transaction:[{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"},{name:"operation",type:"uint8"},{name:"nonce",type:"uint256"}]},yE=["event ProposalQuestionCreated(bytes32 indexed questionId, string indexed proposalId)","function avatar() view returns (address)","function executor() view returns (address)","function oracle() view returns (address)","function questionCooldown() view returns (uint32)","function buildQuestion(string proposalId, bytes32[] txHashes) view returns (string)","function executedProposalTransactions(bytes32 questionHash, bytes32 txHash) view returns (bool)","function questionIds(bytes32 questionHash) view returns (bytes32)","function minimumBond() view returns (uint256)","function addProposal(string proposalId, bytes32[] txHashes)","function executeProposalWithIndex(string proposalId, bytes32[] txHashes, address to, uint256 value, bytes data, uint8 operation, uint256 txIndex)"],wE=["event LogNewAnswer(\n bytes32 answer,\n bytes32 indexed question_id,\n bytes32 history_hash,\n address indexed user,\n uint256 bond,\n uint256 ts,\n bool is_commitment\n )","function resultFor(bytes32 question_id) view returns (bytes32)","function getFinalizeTS(bytes32 question_id) view returns (uint32)","function getBond(bytes32 question_id) view returns (uint256)","function getBestAnswer(bytes32 question_id) view returns (uint32)","function balanceOf(address) view returns (uint256)","function getHistoryHash(bytes32 question_id) view returns (bytes32)","function isFinalized(bytes32 question_id) view returns (bool)","function token() view returns (address)","function submitAnswer(bytes32 question_id, bytes32 answer, uint256 max_previous) external payable","function submitAnswerERC20(bytes32 question_id, bytes32 answer, uint256 max_previous, uint256 tokens) external","function claimMultipleAndWithdrawBalance(\n bytes32[] question_ids,\n uint256[] lengths,\n bytes32[] hist_hashes,\n address[] addrs,\n uint256[] bonds,\n bytes32[] answers\n ) public","function withdraw() public"],ME=["function balanceOf(address account) view returns (uint256)","function decimals() view returns (uint32)","function symbol() view returns (string)","function allowance(address owner, address spender) external view returns (uint256)","function approve(address spender, uint256 value) external returns (bool)"],bE={1:6531147,4:3175028},EE=function(t,i){return e(void 0,void 0,void 0,(function(){var e;return r(this,(function(r){return e=gE(["bytes32[]"],[i]).slice(2),[2,t+"␟"+e]}))}))},_E=function(t,i,n,o,s){return e(void 0,void 0,void 0,(function(){var e,a,h;return r(this,(function(r){switch(r.label){case 0:return[4,QM(i,t,yE,[[n,"questionIds",[o]]].concat(s.map((function(t){return[n,"executedProposalTransactions",[o,t]]}))))];case 1:return e=r.sent().map((function(t){return t[0]})),a=e[0],h=e.indexOf(!1,1)-1,[2,{questionId:"0x0000000000000000000000000000000000000000000000000000000000000000"!==a?a:void 0,nextTxIndex:h<0||h>=s.length?void 0:h}]}}))}))},NE=function(t,i,n){return e(void 0,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,4]),[4,QM(i,t,yE,[[n,"avatar"],[n,"oracle"],[n,"questionCooldown"],[n,"minimumBond"]])];case 1:return e=r.sent(),[3,4];case 2:return r.sent(),[4,QM(i,t,yE,[[n,"executor"],[n,"oracle"],[n,"questionCooldown"],[n,"minimumBond"]])];case 3:return e=r.sent(),[3,4];case 4:return[2,{dao:e[0][0],oracle:e[1][0],cooldown:e[2][0],minimumBond:e[3][0]}]}}))}))},AE=function(t,i,n,o){return e(void 0,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:if(!o)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,QM(i,t,wE,[[n,"resultFor",[o]],[n,"getFinalizeTS",[o]]])];case 2:return e=r.sent(),[2,{executionApproved:Ib.from(e[0][0]).eq(Ib.from(1)),finalizedAt:Ib.from(e[1][0]).toNumber()}];case 3:return r.sent(),[3,4];case 4:return[2,{executionApproved:!1,finalizedAt:void 0}]}}))}))},SE=function(t,i,n,o){return e(void 0,void 0,void 0,(function(){var e,s,a;return r(this,(function(r){switch(r.label){case 0:return o?[4,QM(i,t,wE,[[n,"getFinalizeTS",[o]],[n,"getBond",[o]],[n,"getBestAnswer",[o]]])]:[3,2];case 1:return e=r.sent(),s=Ib.from(e[1][0]),a=Ib.from(e[2][0]),[2,{currentBond:s,isApproved:a.eq(Ib.from(1)),endTime:Ib.from(e[0][0]).toNumber()}];case 2:return[2,{currentBond:void 0,isApproved:!1,endTime:void 0}]}}))}))},RE=function(){function n(){this.author="Gnosis",this.version="1.0.0",this.name="SafeSnap",this.website="https://safe.gnosis.io"}return n.prototype.validateTransaction=function(t){var e=""===t.to||function(t){try{return Ch(t),!0}catch(t){}return!1}(t.to);return Sb(t.value)&&e&&(!t.data||N(t.data))&&t.operation in["0","1"]&&Sb(t.nonce)},n.prototype.calcTransactionHash=function(t,i,n){return e(this,void 0,void 0,(function(){var e,o;return r(this,(function(r){return e=parseInt(t),o={chainId:e,verifyingContract:i},[2,Hn.hash(o,vE,n)]}))}))},n.prototype.calcTransactionHashes=function(i,n,o){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){return e={chainId:i,verifyingContract:n},[2,o.map((function(r){return Hn.hash(e,vE,t({nonce:"0",data:"0x"},r))}))]}))}))},n.prototype.getExecutionDetails=function(i,n,o,s){return e(this,void 0,void 0,(function(){var e,a,h,u,l,f,c,d,m;return r(this,(function(r){switch(r.label){case 0:return e=ay(i),a=parseInt(i),[4,this.calcTransactionHashes(a,n,s)];case 1:return h=r.sent(),[4,EE(o,h)];case 2:return u=r.sent(),l=gE(["string"],[u]),[4,_E(e,i,n,l,h)];case 3:return f=r.sent(),[4,NE(e,i,n)];case 4:return c=r.sent(),[4,AE(e,i,c.oracle,f.questionId)];case 5:return d=r.sent(),[4,SE(e,i,c.oracle,f.questionId)];case 6:m=r.sent();try{return[2,t(t(t(t(t(t({},c),{proposalId:o}),d),f),{transactions:s,txHashes:h}),m)]}catch(t){throw new Error(t)}return[2]}}))}))},n.prototype.getModuleDetails=function(t,i){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){return e=ay(t),[2,NE(e,t,i)]}))}))},n.prototype.submitProposal=function(t,i,n,o){return e(this,void 0,void 0,(function(){var e,s;return r(this,(function(r){switch(r.label){case 0:return[4,this.calcTransactionHashes(t.network.chainId,i,o)];case 1:return e=r.sent(),[4,eb(t,i,yE,"addProposal",[n,e])];case 2:return[4,r.sent().wait()];case 3:return s=r.sent(),console.log("[DAO module] submitted proposal:",s),[2]}}))}))},n.prototype.loadClaimBondData=function(t,i,n,o){return e(this,void 0,void 0,(function(){var e,s,a,h,u,l,f,c,d,m,p,g,v,y,w,M,b,E,_,N,A,S,R,x;return r(this,(function(r){switch(r.label){case 0:return e=new ru(o,wE,t),s=ay(i),[4,QM(i,s,wE,[[o,"balanceOf",[t.provider.selectedAddress]],[o,"getBestAnswer",[n]],[o,"getHistoryHash",[n]],[o,"isFinalized",[n]]])];case 1:a=r.sent(),h=a[0][0],u=a[1][0],l=a[2][0],f=a[3][0],c="ETH",d=18,r.label=2;case 2:return r.trys.push([2,5,,6]),[4,YM(s,wE,[o,"token",[]])];case 3:return m=r.sent(),[4,QM(i,s,ME,[[m,"symbol",[]],[m,"decimals",[]]])];case 4:return p=r.sent(),g=p[0][0],v=p[1][0],c=g,d=v,[3,6];case 5:return r.sent(),[3,6];case 6:return y=e.filters.LogNewAnswer(null,n),[4,e.queryFilter(y,bE[i])];case 7:return w=r.sent(),M=[],b=[],E=[],_=[],w.reverse().forEach((function(t){var e=t.args;M.push(null==e?void 0:e.user.toLowerCase()),b.push(null==e?void 0:e.history_hash),E.push(null==e?void 0:e.bond),_.push(null==e?void 0:e.answer)})),N=Ib.from(l).eq(0),A=t.provider.selectedAddress.toLowerCase(),S=M.map((function(t,e){if(t===A)return _[e]})),R=S.some((function(t){if(t)return Ib.from(t).eq(u)}))&&f,x=!h.eq(0)&&f,b.shift(),"0x0000000000000000000000000000000000000000000000000000000000000000",b.push("0x0000000000000000000000000000000000000000000000000000000000000000"),[2,{tokenSymbol:c,tokenDecimals:d,canClaim:!N&&R||x,data:{length:[E.length.toString()],historyHashes:b,users:M,bonds:E,answers:_}}]}}))}))},n.prototype.claimBond=function(t,n,o,s){return e(this,void 0,void 0,(function(){var e,a,h;return r(this,(function(r){switch(r.label){case 0:return[4,YM(t,wE,[n,"getHistoryHash",[o]])];case 1:return e=r.sent(),Ib.from(e).eq(0)?[4,eb(t,n,wE,"withdraw",[])]:[3,4];case 2:return[4,r.sent().wait()];case 3:return a=r.sent(),console.log("[Realitio] executed withdraw:",a),[2];case 4:return[4,eb(t,n,wE,"claimMultipleAndWithdrawBalance",i([[o]],s))];case 5:return[4,r.sent().wait()];case 6:return h=r.sent(),console.log("[Realitio] executed claimMultipleAndWithdrawBalance:",h),[2]}}))}))},n.prototype.executeProposal=function(t,i,n,o,s){return e(this,void 0,void 0,(function(){var e,a,h;return r(this,(function(r){switch(r.label){case 0:return[4,this.calcTransactionHashes(t.network.chainId,i,o)];case 1:return e=r.sent(),a=o[s],[4,eb(t,i,yE,"executeProposalWithIndex",[n,e,a.to,a.value,a.data||"0x",a.operation,s])];case 2:return[4,r.sent().wait()];case 3:return h=r.sent(),console.log("[DAO module] executed proposal:",h),[2]}}))}))},n.prototype.voteForQuestion=function(t,n,o,s,a,h){return e(this,void 0,void 0,(function(){var e,u,l,f,c,d,m,p,g,v,y;return r(this,(function(r){switch(r.label){case 0:return[4,YM(n,wE,[o,"getBond",[s]])];case 1:e=r.sent(),f={},c=[s,"0x000000000000000000000000000000000000000000000000000000000000000"+h],e.eq(Ib.from(0))?(d=Ib.from(a).eq(0),u=d?Ib.from(10):a):u=e.mul(2),r.label=2;case 2:return r.trys.push([2,8,,9]),[4,YM(n,wE,[o,"token",[]])];case 3:return m=r.sent(),[4,QM(t,n,ME,[[m,"decimals",[]],[m,"allowance",[n.provider.selectedAddress,o]]])];case 4:return p=r.sent(),g=p[0][0],v=p[1][0],u.eq(10)&&(u=u.pow(g)),v.lt(u)?[4,eb(n,m,ME,"approve",[o,u],{})]:[3,7];case 5:return[4,r.sent().wait()];case 6:r.sent(),r.label=7;case 7:return c=i(c,[u,u]),l="submitAnswerERC20",[3,9];case 8:return r.sent(),u.eq(10)&&(u=u.pow(18)),c=i(c,[u]),f.value=u.toString(),l="submitAnswer",[3,9];case 9:return[4,eb(n,o,wE,l,c,f)];case 10:return[4,r.sent().wait()];case 11:return y=r.sent(),console.log("[DAO module] executed vote on oracle:",y),[2]}}))}))},n}(),xE=function(){function t(){this.author="lbeder",this.version="0.1.0",this.name="Quorum"}return t.prototype.getTotalVotingPower=function(t,i,n){return e(this,void 0,void 0,(function(){var e,o,s,a,h,u,l;return r(this,(function(r){switch(r.label){case 0:switch(r.trys.push([0,6,,7]),e=i.strategy,e){case"static":return[3,1];case"balance":return[3,2]}return[3,4];case 1:return[2,i.total];case 2:return o=i.address,s=i.methodABI,a=i.decimals,h="latest"===n?n:parseInt(n),[4,YM(t,[s],[o,s.name],{blockTag:h})];case 3:return u=r.sent(),[2,Wt.from(u).div(Wt.from(10).pow(a)).toNumber()];case 4:throw new Error("Unsupported quorum strategy: "+e);case 5:return[3,7];case 6:throw l=r.sent(),new Error(l);case 7:return[2]}}))}))},t}(),IE=function(){function t(){this.author="Poap-xyz",this.version="1.0.0",this.name="Poap Module"}return t.prototype.openScanPage=function(t){window.open("https://app.poap.xyz/scan/"+t,"_blank")},t.prototype.getCurrentState=function(t,i){return e(this,void 0,void 0,(function(){var e,n,o,s,a,h,u;return r(this,(function(r){switch(r.label){case 0:return[4,fetch("https://api.poap.xyz/snapshot/proposal/"+t)];case 1:return(e=r.sent()).ok?[4,e.json()]:[2,{image_url:"",currentState:"NO_POAP"}];case 2:return n=r.sent().image_url,i?[4,fetch("https://api.poap.xyz/snapshot/proposal/"+t+"/"+i)]:[2,{image_url:n,currentState:"NOT_VOTED"}];case 3:return(o=r.sent()).ok?[4,o.json()]:[2,{image_url:n,currentState:"NOT_VOTED"}];case 4:return s=r.sent(),a=s.claimed,h=s.status,u=s.voted,a?a&&"passed"!==h?[2,{image_url:n,currentState:"LOADING"}]:[2,{image_url:n,currentState:"CLAIMED"}]:u?[2,{image_url:n,currentState:"UNCLAIMED"}]:[2,{image_url:n,currentState:"NOT_VOTED"}]}}))}))},t.prototype.claim=function(t,i){return e(this,void 0,void 0,(function(){var e,n;return r(this,(function(r){switch(r.label){case 0:return e={snapshotProposalHash:t,address:i},[4,fetch("https://api.poap.xyz/claim/snapshot-proposal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return(n=r.sent()).ok?[2,"LOADING"]:(console.log(n.json()),[2,"UNCLAIMED"])}}))}))},t}(),kE={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Proposal",definitions:{Proposal:{title:"Proposal",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0,maxLength:1e4},choices:{type:"array",title:"choices",minItems:2,maxItems:64},type:{type:"string",enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom"]},snapshot:{type:"number",title:"snapshot"},start:{type:"number",title:"start",minimum:1e9,maximum:2e9},end:{type:"number",title:"end",minimum:1e9,maximum:2e9,exclusiveMinimum:{$data:"1/start"}},metadata:{type:"object",title:"metadata"}},required:["name","body","choices","snapshot","start","end"],additionalProperties:!1}}},TE={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Vote",definitions:{Vote:{title:"Vote",type:"object",properties:{proposal:{type:"string",title:"proposal"},choice:{type:["number","array","object","boolean"],title:"choice"},metadata:{type:"object",title:"metadata"}},required:["proposal","choice"],additionalProperties:!1}}};return{Client:I,plugins:{aragon:lb,charts:fb,gnosis:wb,safeSnap:RE,poap:IE,quorum:xE,commentBox:function(){this.author="spiritbro1",this.version="0.0.1",this.name="Comment Box"}},schemas:{space:{$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Space",definitions:{Space:{title:"Space",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:32},private:{type:"boolean"},about:{type:"string",title:"about",maxLength:160},guidelines:{type:"string",title:"guidelines",maxLength:1024},terms:{type:"string",title:"terms",format:"uri",maxLength:128},avatar:{type:"string",title:"avatar",format:"uri",maxLength:256},location:{type:"string",title:"location",maxLength:24},website:{type:"string",title:"website",format:"uri",maxLength:128},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},email:{type:"string",title:"email",maxLength:32},network:{type:"string",title:"network",minLength:1,maxLength:32},symbol:{type:"string",title:"symbol",minLength:1,maxLength:12},skin:{type:"string",title:"skin",maxLength:32},domain:{type:"string",title:"domain",maxLength:64},strategies:{type:"array",minItems:1,maxItems:8,items:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},title:"strategies"},members:{type:"array",items:{type:"string",pattern:"^[A-Za-z0-9]*$",minLength:42,maxLength:42},title:"members"},admins:{type:"array",items:{type:"string",pattern:"^[A-Za-z0-9]*$",minLength:42,maxLength:42},title:"admins"},filters:{type:"object",properties:{defaultTab:{type:"string"},minScore:{type:"number",minimum:0},onlyMembers:{type:"boolean"},invalids:{type:"array",items:{type:"string",maxLength:64},title:"invalids"}},additionalProperties:!1},validation:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},plugins:{type:"object"}},required:["name","network","symbol","strategies"],additionalProperties:!1}}}.definitions.Space,proposal:kE.definitions.Proposal,vote:TE.definitions.Vote},utils:ib}}));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const author = "lucid-eleven";
|
|
2
|
+
export declare const version = "0.1.0";
|
|
3
|
+
export declare const examples: {
|
|
4
|
+
name: string;
|
|
5
|
+
strategy: {
|
|
6
|
+
name: string;
|
|
7
|
+
params: {
|
|
8
|
+
address: string;
|
|
9
|
+
symbol: string;
|
|
10
|
+
decimals: number;
|
|
11
|
+
thresholds: {
|
|
12
|
+
threshold: number;
|
|
13
|
+
votes: number;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
network: string;
|
|
18
|
+
addresses: string[];
|
|
19
|
+
snapshot: number;
|
|
20
|
+
}[];
|
|
21
|
+
export declare const about: string;
|
|
22
|
+
export declare function strategy(space: any, network: any, provider: any, addresses: any, options: any, snapshot: any): Promise<{
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
[x: number]: any;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const author = "kibagateaux";
|
|
2
|
+
export declare const version = "0.1.0";
|
|
3
|
+
export declare function strategy(space: any, network: any, provider: any, addresses: any, options: any, snapshot: any): Promise<{
|
|
4
|
+
[x: string]: number;
|
|
5
|
+
[x: number]: number;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const author = "fragosti";
|
|
2
|
+
export declare const version = "0.1.0";
|
|
3
|
+
export declare const SUBGRAPH_URL: {
|
|
4
|
+
1: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function strategy(_space: any, network: any, _provider: any, addresses: any, options: any, snapshot: any): Promise<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Web3Provider } from '@ethersproject/providers';
|
|
2
|
+
export declare const author = "mccallofthewild";
|
|
3
|
+
export declare const version = "0.1.0";
|
|
4
|
+
export declare function strategy(...args: [string, string, Web3Provider, string[], {
|
|
5
|
+
coeff?: number;
|
|
6
|
+
receivingAddresses: string[];
|
|
7
|
+
contractAddress: string;
|
|
8
|
+
decimals: number;
|
|
9
|
+
dfuseApiKey?: string;
|
|
10
|
+
}, number]): Promise<{}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const author = "dimsome";
|
|
2
|
+
export declare const version = "0.1.0";
|
|
3
|
+
export declare const examples: {
|
|
4
|
+
name: string;
|
|
5
|
+
strategy: {
|
|
6
|
+
name: string;
|
|
7
|
+
params: {
|
|
8
|
+
address: string;
|
|
9
|
+
symbol: string;
|
|
10
|
+
tokenIds: string[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
network: string;
|
|
14
|
+
addresses: string[];
|
|
15
|
+
snapshot: number;
|
|
16
|
+
}[];
|
|
17
|
+
export declare const about: string;
|
|
18
|
+
export declare function strategy(space: any, network: any, provider: any, addresses: any, options: any, snapshot: any): Promise<{
|
|
19
|
+
[x: string]: any;
|
|
20
|
+
[x: number]: any;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Web3Provider } from '@ethersproject/providers';
|
|
2
|
+
export declare const author = "mccallofthewild";
|
|
3
|
+
export declare const version = "0.1.0";
|
|
4
|
+
export declare function strategy(...args: [string, string, Web3Provider, string[], {
|
|
5
|
+
coeff?: number;
|
|
6
|
+
}, number]): Promise<{}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface ElasticSearchTxResult {
|
|
2
|
+
took: number;
|
|
3
|
+
timed_out: boolean;
|
|
4
|
+
_shards: Shards;
|
|
5
|
+
hits: Hits;
|
|
6
|
+
}
|
|
7
|
+
export interface Shards {
|
|
8
|
+
total: number;
|
|
9
|
+
successful: number;
|
|
10
|
+
skipped: number;
|
|
11
|
+
failed: number;
|
|
12
|
+
}
|
|
13
|
+
export interface Hits {
|
|
14
|
+
total: Total;
|
|
15
|
+
max_score: number;
|
|
16
|
+
hits: Hit[];
|
|
17
|
+
}
|
|
18
|
+
export interface Hit {
|
|
19
|
+
_index: Index;
|
|
20
|
+
_type: Type;
|
|
21
|
+
_id: string;
|
|
22
|
+
_score: number;
|
|
23
|
+
_source: Source;
|
|
24
|
+
}
|
|
25
|
+
export declare enum Index {
|
|
26
|
+
The0011EthereumEthereumMainnetTx = "0011-ethereum-ethereum-mainnet-tx"
|
|
27
|
+
}
|
|
28
|
+
export interface Source {
|
|
29
|
+
blockHash: string;
|
|
30
|
+
blockNumber: BlockNumber;
|
|
31
|
+
cumulativeGasUsed: BlockNumber;
|
|
32
|
+
from: string;
|
|
33
|
+
gas: BlockNumber;
|
|
34
|
+
gasPrice: BlockNumber;
|
|
35
|
+
gasUsed: BlockNumber;
|
|
36
|
+
hash: string;
|
|
37
|
+
input: string;
|
|
38
|
+
logsBloom: string;
|
|
39
|
+
nonce: BlockNumber;
|
|
40
|
+
r: string;
|
|
41
|
+
s: string;
|
|
42
|
+
status: boolean;
|
|
43
|
+
timestamp: number;
|
|
44
|
+
to: string;
|
|
45
|
+
publicKey?: string;
|
|
46
|
+
transactionIndex: BlockNumber;
|
|
47
|
+
standardV?: string;
|
|
48
|
+
v: V;
|
|
49
|
+
value: Value;
|
|
50
|
+
}
|
|
51
|
+
export interface BlockNumber {
|
|
52
|
+
raw: string;
|
|
53
|
+
num: number;
|
|
54
|
+
}
|
|
55
|
+
export declare enum V {
|
|
56
|
+
The0X25 = "0x25",
|
|
57
|
+
The0X26 = "0x26"
|
|
58
|
+
}
|
|
59
|
+
export interface Value {
|
|
60
|
+
raw: string;
|
|
61
|
+
padded: string;
|
|
62
|
+
eth: number;
|
|
63
|
+
num: number;
|
|
64
|
+
}
|
|
65
|
+
export declare enum Type {
|
|
66
|
+
Doc = "_doc"
|
|
67
|
+
}
|
|
68
|
+
export interface Total {
|
|
69
|
+
value: number;
|
|
70
|
+
relation: string;
|
|
71
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Web3Provider } from '@ethersproject/providers';
|
|
2
|
+
export declare const author = "mccallofthewild";
|
|
3
|
+
export declare const version = "0.1.0";
|
|
4
|
+
export declare function strategy(...args: [string, string, Web3Provider, string[], {
|
|
5
|
+
coeff?: number;
|
|
6
|
+
receivingAddresses: string[];
|
|
7
|
+
}, number]): Promise<{}>;
|