From 24263e2b7211b7de50e1c48923a8308b2c25ed60 Mon Sep 17 00:00:00 2001 From: Anson Date: Thu, 21 Nov 2024 00:55:31 +0700 Subject: [PATCH] feat: tinny pkg works --- local-tests/.gitignore | 1 + local-tests/build.mjs | 23 + local-tests/index.js | 112616 +++++++++++++++ local-tests/index.ts | 25 + local-tests/package.json | 93 + local-tests/setup/accs/accs.js | 50 + .../session-sigs/get-eoa-session-sigs.js | 113 + .../get-lit-action-session-sigs.js | 130 + .../session-sigs/get-pkp-session-sigs.js | 32 + local-tests/setup/shiva-client.js | 203 + local-tests/setup/tinny-config.js | 2 + local-tests/setup/tinny-environment.js | 465 + local-tests/setup/tinny-operations.js | 175 + local-tests/setup/tinny-person.js | 147 + local-tests/setup/tinny-utils.js | 69 + local-tests/test.js | 25 + local-tests/test.ts | 299 +- local-tests/tests.js | 366 + local-tests/tests.ts | 396 + local-tests/tests/test-bundle-speed.js | 13 + local-tests/tests/test-example.js | 33 + ...testCosmosAuthSigToEncryptDecryptString.js | 54 + ...pacityCreditsNFTToAnotherPkpToExecuteJs.js | 96 + ...ityCreditsNFTToAnotherWalletToExecuteJs.js | 88 + ...acityCreditsNFTToAnotherWalletToPkpSign.js | 71 + .../testEthAuthSigToEncryptDecryptString.js | 52 + .../tests/testExecuteJsBroadcastAndCollect.js | 36 + .../tests/testExecuteJsDecryptAndCombine.js | 60 + .../tests/testExecuteJsSignAndCombineEcdsa.js | 81 + ...estPkpEthersWithEoaSessionSigsToEthSign.js | 51 + ...sWithEoaSessionSigsToEthSignTransaction.js | 87 + ...ersWithEoaSessionSigsToEthSignTypedData.js | 82 + ...ithEoaSessionSigsToEthSignTypedDataUtil.js | 76 + ...sWithEoaSessionSigsToEthSignTypedDataV1.js | 64 + ...sWithEoaSessionSigsToEthSignTypedDataV3.js | 93 + ...sWithEoaSessionSigsToEthSignTypedDataV4.js | 93 + ...pEthersWithEoaSessionSigsToPersonalSign.js | 52 + ...testPkpEthersWithEoaSessionSigsToSendTx.js | 57 + ...kpEthersWithEoaSessionSigsToSignMessage.js | 30 + ...WithEoaSessionSigsToSignWithAuthContext.js | 58 + ...EthersWithLitActionSessionSigsToEthSign.js | 51 + ...itActionSessionSigsToEthSignTransaction.js | 87 + ...hLitActionSessionSigsToEthSignTypedData.js | 82 + ...ActionSessionSigsToEthSignTypedDataUtil.js | 76 + ...itActionSessionSigsToEthSignTypedDataV1.js | 64 + ...itActionSessionSigsToEthSignTypedDataV3.js | 93 + ...itActionSessionSigsToEthSignTypedDataV4.js | 93 + ...sWithLitActionSessionSigsToPersonalSign.js | 52 + ...pEthersWithLitActionSessionSigsToSendTx.js | 57 + ...rsWithLitActionSessionSigsToSignMessage.js | 30 + ...estPkpEthersWithPkpSessionSigsToEthSign.js | 51 + ...sWithPkpSessionSigsToEthSignTransaction.js | 87 + ...ersWithPkpSessionSigsToEthSignTypedData.js | 82 + ...ithPkpSessionSigsToEthSignTypedDataUtil.js | 76 + ...sWithPkpSessionSigsToEthSignTypedDataV1.js | 64 + ...sWithPkpSessionSigsToEthSignTypedDataV3.js | 93 + ...sWithPkpSessionSigsToEthSignTypedDataV4.js | 93 + ...pEthersWithPkpSessionSigsToPersonalSign.js | 52 + ...testPkpEthersWithPkpSessionSigsToSendTx.js | 57 + ...kpEthersWithPkpSessionSigsToSignMessage.js | 30 + local-tests/tests/testRelayer.js | 94 + .../testSolAuthSigToEncryptDecryptString.js | 43 + ...thUnspecifiedCapacityTokenIdToExecuteJs.js | 91 + ...WithUnspecifiedCapacityTokenIdToPkpSign.js | 73 + ...SigWithUnspecifiedDelegateesToExecuteJs.js | 89 + ...thSigWithUnspecifiedDelegateesToPkpSign.js | 71 + ...CustomAuthSessionSigsToPkpSignExecuteJs.js | 121 + ...stUseEoaSessionSigsToEncryptDecryptFile.js | 66 + ...UseEoaSessionSigsToEncryptDecryptString.js | 57 + ...oaSessionSigsToEncryptDecryptUint8Array.js | 61 + ...stUseEoaSessionSigsToExecuteJsClaimKeys.js | 160 + ...SessionSigsToExecuteJsClaimMultipleKeys.js | 94 + ...tUseEoaSessionSigsToExecuteJsConsoleLog.js | 42 + ...seEoaSessionSigsToExecuteJsJsonResponse.js | 55 + ...testUseEoaSessionSigsToExecuteJsSigning.js | 55 + ...SessionSigsToExecuteJsSigningInParallel.js | 106 + .../tests/testUseEoaSessionSigsToPkpSign.js | 51 + ...seEoaSessionSigsToRequestSingleResponse.js | 47 + ...validLitActionCodeToGenerateSessionSigs.js | 26 + ...dLitActionIpfsCodeToGenerateSessionSigs.js | 25 + ...stUsePkpSessionSigsToEncryptDecryptFile.js | 66 + ...UsePkpSessionSigsToEncryptDecryptString.js | 56 + ...stUsePkpSessionSigsToExecuteJsClaimKeys.js | 151 + ...SessionSigsToExecuteJsClaimMultipleKeys.js | 94 + ...tUsePkpSessionSigsToExecuteJsConsoleLog.js | 41 + ...sePkpSessionSigsToExecuteJsJsonResponse.js | 55 + ...testUsePkpSessionSigsToExecuteJsSigning.js | 67 + ...SessionSigsToExecuteJsSigningInParallel.js | 106 + .../tests/testUsePkpSessionSigsToPkpSign.js | 51 + ...eneratedSessionSigsToEncryptDecryptFile.js | 67 + ...eratedSessionSigsToEncryptDecryptString.js | 57 + ...eneratedSessionSigsToExecuteJsClaimKeys.js | 104 + ...SessionSigsToExecuteJsClaimMultipleKeys.js | 93 + ...neratedSessionSigsToExecuteJsConsoleLog.js | 52 + ...ratedSessionSigsToExecuteJsJsonResponse.js | 54 + ...eGeneratedSessionSigsToExecuteJsSigning.js | 70 + ...SessionSigsToExecuteJsSigningInParallel.js | 105 + ...ActionCodeGeneratedSessionSigsToPkpSign.js | 51 + ...eGeneratedSessionSigsToExecuteJsSigning.js | 70 + ...onIpfsCodeGeneratedSessionSigsToPkpSign.js | 59 + .../testBatchGeneratePrivateKeys.js | 90 + ...thereumBroadcastTransactionGeneratedKey.js | 55 + ...tEthereumBroadcastTransactionWrappedKey.js | 60 + ...umBroadcastWrappedKeyWithFetchGasParams.js | 62 + .../testEthereumSignMessageGeneratedKey.js | 63 + .../testEthereumSignMessageWrappedKey.js | 66 + .../testEthereumSignTransactionWrappedKey.js | 55 + .../wrapped-keys/testExportWrappedKey.js | 47 + ...nTransactionWrappedKeyInvalidDecryption.js | 65 + ...gnTransactionWrappedKeyWithInvalidParam.js | 66 + ...gnTransactionWrappedKeyWithMissingParam.js | 62 + ...tFailImportWrappedKeysWithEoaSessionSig.js | 43 + ...lImportWrappedKeysWithExpiredSessionSig.js | 58 + ...lImportWrappedKeysWithInvalidSessionSig.js | 57 + ...mportWrappedKeysWithMaxExpirySessionSig.js | 42 + ...FailImportWrappedKeysWithSamePrivateKey.js | 50 + .../testFailStoreEncryptedKeyBatchIsAtomic.js | 93 + .../testGenerateEthereumWrappedKey.js | 46 + .../testGenerateSolanaWrappedKey.js | 62 + .../wrapped-keys/testImportWrappedKey.js | 43 + .../testSignMessageWithSolanaEncryptedKey.js | 52 + ...stSignTransactionWithSolanaEncryptedKey.js | 95 + local-tests/tests/wrapped-keys/util.js | 76 + 123 files changed, 121937 insertions(+), 294 deletions(-) create mode 100644 local-tests/.gitignore create mode 100644 local-tests/index.js create mode 100644 local-tests/index.ts create mode 100644 local-tests/package.json create mode 100644 local-tests/setup/accs/accs.js create mode 100644 local-tests/setup/session-sigs/get-eoa-session-sigs.js create mode 100644 local-tests/setup/session-sigs/get-lit-action-session-sigs.js create mode 100644 local-tests/setup/session-sigs/get-pkp-session-sigs.js create mode 100644 local-tests/setup/shiva-client.js create mode 100644 local-tests/setup/tinny-config.js create mode 100644 local-tests/setup/tinny-environment.js create mode 100644 local-tests/setup/tinny-operations.js create mode 100644 local-tests/setup/tinny-person.js create mode 100644 local-tests/setup/tinny-utils.js create mode 100644 local-tests/test.js create mode 100644 local-tests/tests.js create mode 100644 local-tests/tests.ts create mode 100644 local-tests/tests/test-bundle-speed.js create mode 100644 local-tests/tests/test-example.js create mode 100644 local-tests/tests/testCosmosAuthSigToEncryptDecryptString.js create mode 100644 local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.js create mode 100644 local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.js create mode 100644 local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.js create mode 100644 local-tests/tests/testEthAuthSigToEncryptDecryptString.js create mode 100644 local-tests/tests/testExecuteJsBroadcastAndCollect.js create mode 100644 local-tests/tests/testExecuteJsDecryptAndCombine.js create mode 100644 local-tests/tests/testExecuteJsSignAndCombineEcdsa.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSign.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToPersonalSign.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToSendTx.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToSignMessage.js create mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext.js create mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSign.js create mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction.js create mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData.js create mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil.js create mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1.js create mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3.js create mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4.js create mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToPersonalSign.js create mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToSendTx.js create mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToSignMessage.js create mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSign.js create mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction.js create mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData.js create mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil.js create mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1.js create mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3.js create mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4.js create mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToPersonalSign.js create mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToSendTx.js create mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToSignMessage.js create mode 100644 local-tests/tests/testRelayer.js create mode 100644 local-tests/tests/testSolAuthSigToEncryptDecryptString.js create mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.js create mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.js create mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.js create mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.js create mode 100644 local-tests/tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToEncryptDecryptUint8Array.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToPkpSign.js create mode 100644 local-tests/tests/testUseEoaSessionSigsToRequestSingleResponse.js create mode 100644 local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.js create mode 100644 local-tests/tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs.js create mode 100644 local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.js create mode 100644 local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.js create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.js create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.js create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.js create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.js create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.js create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.js create mode 100644 local-tests/tests/testUsePkpSessionSigsToPkpSign.js create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.js create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.js create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.js create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.js create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.js create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.js create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.js create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.js create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.js create mode 100644 local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning.js create mode 100644 local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign.js create mode 100644 local-tests/tests/wrapped-keys/testBatchGeneratePrivateKeys.js create mode 100644 local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey.js create mode 100644 local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey.js create mode 100644 local-tests/tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams.js create mode 100644 local-tests/tests/wrapped-keys/testEthereumSignMessageGeneratedKey.js create mode 100644 local-tests/tests/wrapped-keys/testEthereumSignMessageWrappedKey.js create mode 100644 local-tests/tests/wrapped-keys/testEthereumSignTransactionWrappedKey.js create mode 100644 local-tests/tests/wrapped-keys/testExportWrappedKey.js create mode 100644 local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption.js create mode 100644 local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam.js create mode 100644 local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam.js create mode 100644 local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig.js create mode 100644 local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig.js create mode 100644 local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig.js create mode 100644 local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig.js create mode 100644 local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey.js create mode 100644 local-tests/tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic.js create mode 100644 local-tests/tests/wrapped-keys/testGenerateEthereumWrappedKey.js create mode 100644 local-tests/tests/wrapped-keys/testGenerateSolanaWrappedKey.js create mode 100644 local-tests/tests/wrapped-keys/testImportWrappedKey.js create mode 100644 local-tests/tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey.js create mode 100644 local-tests/tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey.js create mode 100644 local-tests/tests/wrapped-keys/util.js diff --git a/local-tests/.gitignore b/local-tests/.gitignore new file mode 100644 index 0000000000..9988788f26 --- /dev/null +++ b/local-tests/.gitignore @@ -0,0 +1 @@ +*.js.map \ No newline at end of file diff --git a/local-tests/build.mjs b/local-tests/build.mjs index 79fd5883d7..9a8faf6f76 100644 --- a/local-tests/build.mjs +++ b/local-tests/build.mjs @@ -30,6 +30,29 @@ export const build = async () => { inject: [`./${TEST_DIR}/shim.mjs`], mainFields: ['module', 'main'], }); + + await esbuild.build({ + entryPoints: [`${TEST_DIR}/index.ts`], + outfile: `./${TEST_DIR}/index.js`, + bundle: true, + globalName: 'tinnySdk', + plugins: [ + nodeExternalsPlugin({ + allowList: [ + 'ethers', + '@lit-protocol/accs-schemas', + '@lit-protocol/contracts', + 'crypto', + 'secp256k1', + ], + }), + ], + platform: 'node', + target: 'esnext', + format: 'esm', + inject: [`./${TEST_DIR}/shim.mjs`], + mainFields: ['module', 'main'], + }); }; /** diff --git a/local-tests/index.js b/local-tests/index.js new file mode 100644 index 0000000000..9ad487d071 --- /dev/null +++ b/local-tests/index.js @@ -0,0 +1,112616 @@ +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value; +var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { + get: (a2, b) => (typeof require !== "undefined" ? require : a2)[b] +}) : x)(function(x) { + if (typeof require !== "undefined") + return require.apply(this, arguments); + throw new Error('Dynamic require of "' + x + '" is not supported'); +}); +var __esm = (fn, res) => function __init() { + return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; +}; +var __commonJS = (cb, mod) => function __require2() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key2 of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key2) && key2 !== except) + __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var __publicField = (obj, key2, value) => { + __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value); + return value; +}; + +// local-tests/shim.mjs +import { createRequire } from "module"; +var require2; +var init_shim = __esm({ + "local-tests/shim.mjs"() { + require2 = createRequire(import.meta.url); + global.require = require2; + } +}); + +// node_modules/@ethersproject/bignumber/node_modules/bn.js/lib/bn.js +var require_bn = __commonJS({ + "node_modules/@ethersproject/bignumber/node_modules/bn.js/lib/bn.js"(exports, module2) { + init_shim(); + (function(module3, exports2) { + "use strict"; + function assert2(val, msg) { + if (!val) + throw new Error(msg || "Assertion failed"); + } + function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + function BN3(number, base2, endian) { + if (BN3.isBN(number)) { + return number; + } + this.negative = 0; + this.words = null; + this.length = 0; + this.red = null; + if (number !== null) { + if (base2 === "le" || base2 === "be") { + endian = base2; + base2 = 10; + } + this._init(number || 0, base2 || 10, endian || "be"); + } + } + if (typeof module3 === "object") { + module3.exports = BN3; + } else { + exports2.BN = BN3; + } + BN3.BN = BN3; + BN3.wordSize = 26; + var Buffer4; + try { + if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") { + Buffer4 = window.Buffer; + } else { + Buffer4 = __require("buffer").Buffer; + } + } catch (e2) { + } + BN3.isBN = function isBN(num) { + if (num instanceof BN3) { + return true; + } + return num !== null && typeof num === "object" && num.constructor.wordSize === BN3.wordSize && Array.isArray(num.words); + }; + BN3.max = function max(left, right) { + if (left.cmp(right) > 0) + return left; + return right; + }; + BN3.min = function min(left, right) { + if (left.cmp(right) < 0) + return left; + return right; + }; + BN3.prototype._init = function init2(number, base2, endian) { + if (typeof number === "number") { + return this._initNumber(number, base2, endian); + } + if (typeof number === "object") { + return this._initArray(number, base2, endian); + } + if (base2 === "hex") { + base2 = 16; + } + assert2(base2 === (base2 | 0) && base2 >= 2 && base2 <= 36); + number = number.toString().replace(/\s+/g, ""); + var start = 0; + if (number[0] === "-") { + start++; + this.negative = 1; + } + if (start < number.length) { + if (base2 === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base2, start); + if (endian === "le") { + this._initArray(this.toArray(), base2, endian); + } + } + } + }; + BN3.prototype._initNumber = function _initNumber(number, base2, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 67108864) { + this.words = [number & 67108863]; + this.length = 1; + } else if (number < 4503599627370496) { + this.words = [ + number & 67108863, + number / 67108864 & 67108863 + ]; + this.length = 2; + } else { + assert2(number < 9007199254740992); + this.words = [ + number & 67108863, + number / 67108864 & 67108863, + 1 + ]; + this.length = 3; + } + if (endian !== "le") + return; + this._initArray(this.toArray(), base2, endian); + }; + BN3.prototype._initArray = function _initArray(number, base2, endian) { + assert2(typeof number.length === "number"); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i2 = 0; i2 < this.length; i2++) { + this.words[i2] = 0; + } + var j, w; + var off = 0; + if (endian === "be") { + for (i2 = number.length - 1, j = 0; i2 >= 0; i2 -= 3) { + w = number[i2] | number[i2 - 1] << 8 | number[i2 - 2] << 16; + this.words[j] |= w << off & 67108863; + this.words[j + 1] = w >>> 26 - off & 67108863; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === "le") { + for (i2 = 0, j = 0; i2 < number.length; i2 += 3) { + w = number[i2] | number[i2 + 1] << 8 | number[i2 + 2] << 16; + this.words[j] |= w << off & 67108863; + this.words[j + 1] = w >>> 26 - off & 67108863; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this._strip(); + }; + function parseHex4Bits(string, index) { + var c = string.charCodeAt(index); + if (c >= 48 && c <= 57) { + return c - 48; + } else if (c >= 65 && c <= 70) { + return c - 55; + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + assert2(false, "Invalid character in " + string); + } + } + function parseHexByte(string, lowerBound, index) { + var r3 = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r3 |= parseHex4Bits(string, index - 1) << 4; + } + return r3; + } + BN3.prototype._parseHex = function _parseHex(number, start, endian) { + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i2 = 0; i2 < this.length; i2++) { + this.words[i2] = 0; + } + var off = 0; + var j = 0; + var w; + if (endian === "be") { + for (i2 = number.length - 1; i2 >= start; i2 -= 2) { + w = parseHexByte(number, start, i2) << off; + this.words[j] |= w & 67108863; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i2 = parseLength % 2 === 0 ? start + 1 : start; i2 < number.length; i2 += 2) { + w = parseHexByte(number, start, i2) << off; + this.words[j] |= w & 67108863; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + this._strip(); + }; + function parseBase(str, start, end, mul3) { + var r3 = 0; + var b = 0; + var len = Math.min(str.length, end); + for (var i2 = start; i2 < len; i2++) { + var c = str.charCodeAt(i2) - 48; + r3 *= mul3; + if (c >= 49) { + b = c - 49 + 10; + } else if (c >= 17) { + b = c - 17 + 10; + } else { + b = c; + } + assert2(c >= 0 && b < mul3, "Invalid character"); + r3 += b; + } + return r3; + } + BN3.prototype._parseBase = function _parseBase(number, base2, start) { + this.words = [0]; + this.length = 1; + for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base2) { + limbLen++; + } + limbLen--; + limbPow = limbPow / base2 | 0; + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + var word = 0; + for (var i2 = start; i2 < end; i2 += limbLen) { + word = parseBase(number, i2, i2 + limbLen, base2); + this.imuln(limbPow); + if (this.words[0] + word < 67108864) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i2, number.length, base2); + for (i2 = 0; i2 < mod; i2++) { + pow *= base2; + } + this.imuln(pow); + if (this.words[0] + word < 67108864) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + this._strip(); + }; + BN3.prototype.copy = function copy(dest) { + dest.words = new Array(this.length); + for (var i2 = 0; i2 < this.length; i2++) { + dest.words[i2] = this.words[i2]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + function move(dest, src) { + dest.words = src.words; + dest.length = src.length; + dest.negative = src.negative; + dest.red = src.red; + } + BN3.prototype._move = function _move(dest) { + move(dest, this); + }; + BN3.prototype.clone = function clone() { + var r3 = new BN3(null); + this.copy(r3); + return r3; + }; + BN3.prototype._expand = function _expand(size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + BN3.prototype._strip = function strip() { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + BN3.prototype._normSign = function _normSign() { + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + if (typeof Symbol !== "undefined" && typeof Symbol.for === "function") { + try { + BN3.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect4; + } catch (e2) { + BN3.prototype.inspect = inspect4; + } + } else { + BN3.prototype.inspect = inspect4; + } + function inspect4() { + return (this.red ? ""; + } + var zeros2 = [ + "", + "0", + "00", + "000", + "0000", + "00000", + "000000", + "0000000", + "00000000", + "000000000", + "0000000000", + "00000000000", + "000000000000", + "0000000000000", + "00000000000000", + "000000000000000", + "0000000000000000", + "00000000000000000", + "000000000000000000", + "0000000000000000000", + "00000000000000000000", + "000000000000000000000", + "0000000000000000000000", + "00000000000000000000000", + "000000000000000000000000", + "0000000000000000000000000" + ]; + var groupSizes = [ + 0, + 0, + 25, + 16, + 12, + 11, + 10, + 9, + 8, + 8, + 7, + 7, + 7, + 7, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5 + ]; + var groupBases = [ + 0, + 0, + 33554432, + 43046721, + 16777216, + 48828125, + 60466176, + 40353607, + 16777216, + 43046721, + 1e7, + 19487171, + 35831808, + 62748517, + 7529536, + 11390625, + 16777216, + 24137569, + 34012224, + 47045881, + 64e6, + 4084101, + 5153632, + 6436343, + 7962624, + 9765625, + 11881376, + 14348907, + 17210368, + 20511149, + 243e5, + 28629151, + 33554432, + 39135393, + 45435424, + 52521875, + 60466176 + ]; + BN3.prototype.toString = function toString2(base2, padding2) { + base2 = base2 || 10; + padding2 = padding2 | 0 || 1; + var out; + if (base2 === 16 || base2 === "hex") { + out = ""; + var off = 0; + var carry = 0; + for (var i2 = 0; i2 < this.length; i2++) { + var w = this.words[i2]; + var word = ((w << off | carry) & 16777215).toString(16); + carry = w >>> 24 - off & 16777215; + off += 2; + if (off >= 26) { + off -= 26; + i2--; + } + if (carry !== 0 || i2 !== this.length - 1) { + out = zeros2[6 - word.length] + word + out; + } else { + out = word + out; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding2 !== 0) { + out = "0" + out; + } + if (this.negative !== 0) { + out = "-" + out; + } + return out; + } + if (base2 === (base2 | 0) && base2 >= 2 && base2 <= 36) { + var groupSize = groupSizes[base2]; + var groupBase = groupBases[base2]; + out = ""; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r3 = c.modrn(groupBase).toString(base2); + c = c.idivn(groupBase); + if (!c.isZero()) { + out = zeros2[groupSize - r3.length] + r3 + out; + } else { + out = r3 + out; + } + } + if (this.isZero()) { + out = "0" + out; + } + while (out.length % padding2 !== 0) { + out = "0" + out; + } + if (this.negative !== 0) { + out = "-" + out; + } + return out; + } + assert2(false, "Base should be between 2 and 36"); + }; + BN3.prototype.toNumber = function toNumber() { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 67108864; + } else if (this.length === 3 && this.words[2] === 1) { + ret += 4503599627370496 + this.words[1] * 67108864; + } else if (this.length > 2) { + assert2(false, "Number can only safely store up to 53 bits"); + } + return this.negative !== 0 ? -ret : ret; + }; + BN3.prototype.toJSON = function toJSON2() { + return this.toString(16, 2); + }; + if (Buffer4) { + BN3.prototype.toBuffer = function toBuffer(endian, length) { + return this.toArrayLike(Buffer4, endian, length); + }; + } + BN3.prototype.toArray = function toArray(endian, length) { + return this.toArrayLike(Array, endian, length); + }; + var allocate = function allocate2(ArrayType, size) { + if (ArrayType.allocUnsafe) { + return ArrayType.allocUnsafe(size); + } + return new ArrayType(size); + }; + BN3.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) { + this._strip(); + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert2(byteLength <= reqLength, "byte array longer than desired length"); + assert2(reqLength > 0, "Requested array length <= 0"); + var res = allocate(ArrayType, reqLength); + var postfix = endian === "le" ? "LE" : "BE"; + this["_toArrayLike" + postfix](res, byteLength); + return res; + }; + BN3.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) { + var position = 0; + var carry = 0; + for (var i2 = 0, shift = 0; i2 < this.length; i2++) { + var word = this.words[i2] << shift | carry; + res[position++] = word & 255; + if (position < res.length) { + res[position++] = word >> 8 & 255; + } + if (position < res.length) { + res[position++] = word >> 16 & 255; + } + if (shift === 6) { + if (position < res.length) { + res[position++] = word >> 24 & 255; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + if (position < res.length) { + res[position++] = carry; + while (position < res.length) { + res[position++] = 0; + } + } + }; + BN3.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) { + var position = res.length - 1; + var carry = 0; + for (var i2 = 0, shift = 0; i2 < this.length; i2++) { + var word = this.words[i2] << shift | carry; + res[position--] = word & 255; + if (position >= 0) { + res[position--] = word >> 8 & 255; + } + if (position >= 0) { + res[position--] = word >> 16 & 255; + } + if (shift === 6) { + if (position >= 0) { + res[position--] = word >> 24 & 255; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + if (position >= 0) { + res[position--] = carry; + while (position >= 0) { + res[position--] = 0; + } + } + }; + if (Math.clz32) { + BN3.prototype._countBits = function _countBits(w) { + return 32 - Math.clz32(w); + }; + } else { + BN3.prototype._countBits = function _countBits(w) { + var t2 = w; + var r3 = 0; + if (t2 >= 4096) { + r3 += 13; + t2 >>>= 13; + } + if (t2 >= 64) { + r3 += 7; + t2 >>>= 7; + } + if (t2 >= 8) { + r3 += 4; + t2 >>>= 4; + } + if (t2 >= 2) { + r3 += 2; + t2 >>>= 2; + } + return r3 + t2; + }; + } + BN3.prototype._zeroBits = function _zeroBits(w) { + if (w === 0) + return 26; + var t2 = w; + var r3 = 0; + if ((t2 & 8191) === 0) { + r3 += 13; + t2 >>>= 13; + } + if ((t2 & 127) === 0) { + r3 += 7; + t2 >>>= 7; + } + if ((t2 & 15) === 0) { + r3 += 4; + t2 >>>= 4; + } + if ((t2 & 3) === 0) { + r3 += 2; + t2 >>>= 2; + } + if ((t2 & 1) === 0) { + r3++; + } + return r3; + }; + BN3.prototype.bitLength = function bitLength() { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + function toBitArray(num) { + var w = new Array(num.bitLength()); + for (var bit = 0; bit < w.length; bit++) { + var off = bit / 26 | 0; + var wbit = bit % 26; + w[bit] = num.words[off] >>> wbit & 1; + } + return w; + } + BN3.prototype.zeroBits = function zeroBits() { + if (this.isZero()) + return 0; + var r3 = 0; + for (var i2 = 0; i2 < this.length; i2++) { + var b = this._zeroBits(this.words[i2]); + r3 += b; + if (b !== 26) + break; + } + return r3; + }; + BN3.prototype.byteLength = function byteLength() { + return Math.ceil(this.bitLength() / 8); + }; + BN3.prototype.toTwos = function toTwos(width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + BN3.prototype.fromTwos = function fromTwos(width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + BN3.prototype.isNeg = function isNeg() { + return this.negative !== 0; + }; + BN3.prototype.neg = function neg3() { + return this.clone().ineg(); + }; + BN3.prototype.ineg = function ineg() { + if (!this.isZero()) { + this.negative ^= 1; + } + return this; + }; + BN3.prototype.iuor = function iuor(num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + for (var i2 = 0; i2 < num.length; i2++) { + this.words[i2] = this.words[i2] | num.words[i2]; + } + return this._strip(); + }; + BN3.prototype.ior = function ior(num) { + assert2((this.negative | num.negative) === 0); + return this.iuor(num); + }; + BN3.prototype.or = function or(num) { + if (this.length > num.length) + return this.clone().ior(num); + return num.clone().ior(this); + }; + BN3.prototype.uor = function uor(num) { + if (this.length > num.length) + return this.clone().iuor(num); + return num.clone().iuor(this); + }; + BN3.prototype.iuand = function iuand(num) { + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + for (var i2 = 0; i2 < b.length; i2++) { + this.words[i2] = this.words[i2] & num.words[i2]; + } + this.length = b.length; + return this._strip(); + }; + BN3.prototype.iand = function iand(num) { + assert2((this.negative | num.negative) === 0); + return this.iuand(num); + }; + BN3.prototype.and = function and(num) { + if (this.length > num.length) + return this.clone().iand(num); + return num.clone().iand(this); + }; + BN3.prototype.uand = function uand(num) { + if (this.length > num.length) + return this.clone().iuand(num); + return num.clone().iuand(this); + }; + BN3.prototype.iuxor = function iuxor(num) { + var a2; + var b; + if (this.length > num.length) { + a2 = this; + b = num; + } else { + a2 = num; + b = this; + } + for (var i2 = 0; i2 < b.length; i2++) { + this.words[i2] = a2.words[i2] ^ b.words[i2]; + } + if (this !== a2) { + for (; i2 < a2.length; i2++) { + this.words[i2] = a2.words[i2]; + } + } + this.length = a2.length; + return this._strip(); + }; + BN3.prototype.ixor = function ixor(num) { + assert2((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + BN3.prototype.xor = function xor(num) { + if (this.length > num.length) + return this.clone().ixor(num); + return num.clone().ixor(this); + }; + BN3.prototype.uxor = function uxor(num) { + if (this.length > num.length) + return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + BN3.prototype.inotn = function inotn(width) { + assert2(typeof width === "number" && width >= 0); + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + this._expand(bytesNeeded); + if (bitsLeft > 0) { + bytesNeeded--; + } + for (var i2 = 0; i2 < bytesNeeded; i2++) { + this.words[i2] = ~this.words[i2] & 67108863; + } + if (bitsLeft > 0) { + this.words[i2] = ~this.words[i2] & 67108863 >> 26 - bitsLeft; + } + return this._strip(); + }; + BN3.prototype.notn = function notn(width) { + return this.clone().inotn(width); + }; + BN3.prototype.setn = function setn(bit, val) { + assert2(typeof bit === "number" && bit >= 0); + var off = bit / 26 | 0; + var wbit = bit % 26; + this._expand(off + 1); + if (val) { + this.words[off] = this.words[off] | 1 << wbit; + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + return this._strip(); + }; + BN3.prototype.iadd = function iadd(num) { + var r3; + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r3 = this.isub(num); + this.negative ^= 1; + return this._normSign(); + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r3 = this.isub(num); + num.negative = 1; + return r3._normSign(); + } + var a2, b; + if (this.length > num.length) { + a2 = this; + b = num; + } else { + a2 = num; + b = this; + } + var carry = 0; + for (var i2 = 0; i2 < b.length; i2++) { + r3 = (a2.words[i2] | 0) + (b.words[i2] | 0) + carry; + this.words[i2] = r3 & 67108863; + carry = r3 >>> 26; + } + for (; carry !== 0 && i2 < a2.length; i2++) { + r3 = (a2.words[i2] | 0) + carry; + this.words[i2] = r3 & 67108863; + carry = r3 >>> 26; + } + this.length = a2.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + } else if (a2 !== this) { + for (; i2 < a2.length; i2++) { + this.words[i2] = a2.words[i2]; + } + } + return this; + }; + BN3.prototype.add = function add5(num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + if (this.length > num.length) + return this.clone().iadd(num); + return num.clone().iadd(this); + }; + BN3.prototype.isub = function isub(num) { + if (num.negative !== 0) { + num.negative = 0; + var r3 = this.iadd(num); + num.negative = 1; + return r3._normSign(); + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + var cmp = this.cmp(num); + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + var a2, b; + if (cmp > 0) { + a2 = this; + b = num; + } else { + a2 = num; + b = this; + } + var carry = 0; + for (var i2 = 0; i2 < b.length; i2++) { + r3 = (a2.words[i2] | 0) - (b.words[i2] | 0) + carry; + carry = r3 >> 26; + this.words[i2] = r3 & 67108863; + } + for (; carry !== 0 && i2 < a2.length; i2++) { + r3 = (a2.words[i2] | 0) + carry; + carry = r3 >> 26; + this.words[i2] = r3 & 67108863; + } + if (carry === 0 && i2 < a2.length && a2 !== this) { + for (; i2 < a2.length; i2++) { + this.words[i2] = a2.words[i2]; + } + } + this.length = Math.max(this.length, i2); + if (a2 !== this) { + this.negative = 1; + } + return this._strip(); + }; + BN3.prototype.sub = function sub(num) { + return this.clone().isub(num); + }; + function smallMulTo(self2, num, out) { + out.negative = num.negative ^ self2.negative; + var len = self2.length + num.length | 0; + out.length = len; + len = len - 1 | 0; + var a2 = self2.words[0] | 0; + var b = num.words[0] | 0; + var r3 = a2 * b; + var lo = r3 & 67108863; + var carry = r3 / 67108864 | 0; + out.words[0] = lo; + for (var k = 1; k < len; k++) { + var ncarry = carry >>> 26; + var rword = carry & 67108863; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) { + var i2 = k - j | 0; + a2 = self2.words[i2] | 0; + b = num.words[j] | 0; + r3 = a2 * b + rword; + ncarry += r3 / 67108864 | 0; + rword = r3 & 67108863; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + return out._strip(); + } + var comb10MulTo = function comb10MulTo2(self2, num, out) { + var a2 = self2.words; + var b = num.words; + var o2 = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a2[0] | 0; + var al0 = a0 & 8191; + var ah0 = a0 >>> 13; + var a1 = a2[1] | 0; + var al1 = a1 & 8191; + var ah1 = a1 >>> 13; + var a22 = a2[2] | 0; + var al2 = a22 & 8191; + var ah2 = a22 >>> 13; + var a3 = a2[3] | 0; + var al3 = a3 & 8191; + var ah3 = a3 >>> 13; + var a4 = a2[4] | 0; + var al4 = a4 & 8191; + var ah4 = a4 >>> 13; + var a5 = a2[5] | 0; + var al5 = a5 & 8191; + var ah5 = a5 >>> 13; + var a6 = a2[6] | 0; + var al6 = a6 & 8191; + var ah6 = a6 >>> 13; + var a7 = a2[7] | 0; + var al7 = a7 & 8191; + var ah7 = a7 >>> 13; + var a8 = a2[8] | 0; + var al8 = a8 & 8191; + var ah8 = a8 >>> 13; + var a9 = a2[9] | 0; + var al9 = a9 & 8191; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 8191; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 8191; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 8191; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 8191; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 8191; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 8191; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 8191; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 8191; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 8191; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 8191; + var bh9 = b9 >>> 13; + out.negative = self2.negative ^ num.negative; + out.length = 19; + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = mid + Math.imul(ah0, bl0) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0; + w0 &= 67108863; + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = mid + Math.imul(ah1, bl0) | 0; + hi = Math.imul(ah1, bh0); + lo = lo + Math.imul(al0, bl1) | 0; + mid = mid + Math.imul(al0, bh1) | 0; + mid = mid + Math.imul(ah0, bl1) | 0; + hi = hi + Math.imul(ah0, bh1) | 0; + var w1 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0; + w1 &= 67108863; + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = mid + Math.imul(ah2, bl0) | 0; + hi = Math.imul(ah2, bh0); + lo = lo + Math.imul(al1, bl1) | 0; + mid = mid + Math.imul(al1, bh1) | 0; + mid = mid + Math.imul(ah1, bl1) | 0; + hi = hi + Math.imul(ah1, bh1) | 0; + lo = lo + Math.imul(al0, bl2) | 0; + mid = mid + Math.imul(al0, bh2) | 0; + mid = mid + Math.imul(ah0, bl2) | 0; + hi = hi + Math.imul(ah0, bh2) | 0; + var w2 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0; + w2 &= 67108863; + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = mid + Math.imul(ah3, bl0) | 0; + hi = Math.imul(ah3, bh0); + lo = lo + Math.imul(al2, bl1) | 0; + mid = mid + Math.imul(al2, bh1) | 0; + mid = mid + Math.imul(ah2, bl1) | 0; + hi = hi + Math.imul(ah2, bh1) | 0; + lo = lo + Math.imul(al1, bl2) | 0; + mid = mid + Math.imul(al1, bh2) | 0; + mid = mid + Math.imul(ah1, bl2) | 0; + hi = hi + Math.imul(ah1, bh2) | 0; + lo = lo + Math.imul(al0, bl3) | 0; + mid = mid + Math.imul(al0, bh3) | 0; + mid = mid + Math.imul(ah0, bl3) | 0; + hi = hi + Math.imul(ah0, bh3) | 0; + var w3 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0; + w3 &= 67108863; + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = mid + Math.imul(ah4, bl0) | 0; + hi = Math.imul(ah4, bh0); + lo = lo + Math.imul(al3, bl1) | 0; + mid = mid + Math.imul(al3, bh1) | 0; + mid = mid + Math.imul(ah3, bl1) | 0; + hi = hi + Math.imul(ah3, bh1) | 0; + lo = lo + Math.imul(al2, bl2) | 0; + mid = mid + Math.imul(al2, bh2) | 0; + mid = mid + Math.imul(ah2, bl2) | 0; + hi = hi + Math.imul(ah2, bh2) | 0; + lo = lo + Math.imul(al1, bl3) | 0; + mid = mid + Math.imul(al1, bh3) | 0; + mid = mid + Math.imul(ah1, bl3) | 0; + hi = hi + Math.imul(ah1, bh3) | 0; + lo = lo + Math.imul(al0, bl4) | 0; + mid = mid + Math.imul(al0, bh4) | 0; + mid = mid + Math.imul(ah0, bl4) | 0; + hi = hi + Math.imul(ah0, bh4) | 0; + var w4 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0; + w4 &= 67108863; + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = mid + Math.imul(ah5, bl0) | 0; + hi = Math.imul(ah5, bh0); + lo = lo + Math.imul(al4, bl1) | 0; + mid = mid + Math.imul(al4, bh1) | 0; + mid = mid + Math.imul(ah4, bl1) | 0; + hi = hi + Math.imul(ah4, bh1) | 0; + lo = lo + Math.imul(al3, bl2) | 0; + mid = mid + Math.imul(al3, bh2) | 0; + mid = mid + Math.imul(ah3, bl2) | 0; + hi = hi + Math.imul(ah3, bh2) | 0; + lo = lo + Math.imul(al2, bl3) | 0; + mid = mid + Math.imul(al2, bh3) | 0; + mid = mid + Math.imul(ah2, bl3) | 0; + hi = hi + Math.imul(ah2, bh3) | 0; + lo = lo + Math.imul(al1, bl4) | 0; + mid = mid + Math.imul(al1, bh4) | 0; + mid = mid + Math.imul(ah1, bl4) | 0; + hi = hi + Math.imul(ah1, bh4) | 0; + lo = lo + Math.imul(al0, bl5) | 0; + mid = mid + Math.imul(al0, bh5) | 0; + mid = mid + Math.imul(ah0, bl5) | 0; + hi = hi + Math.imul(ah0, bh5) | 0; + var w5 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0; + w5 &= 67108863; + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = mid + Math.imul(ah6, bl0) | 0; + hi = Math.imul(ah6, bh0); + lo = lo + Math.imul(al5, bl1) | 0; + mid = mid + Math.imul(al5, bh1) | 0; + mid = mid + Math.imul(ah5, bl1) | 0; + hi = hi + Math.imul(ah5, bh1) | 0; + lo = lo + Math.imul(al4, bl2) | 0; + mid = mid + Math.imul(al4, bh2) | 0; + mid = mid + Math.imul(ah4, bl2) | 0; + hi = hi + Math.imul(ah4, bh2) | 0; + lo = lo + Math.imul(al3, bl3) | 0; + mid = mid + Math.imul(al3, bh3) | 0; + mid = mid + Math.imul(ah3, bl3) | 0; + hi = hi + Math.imul(ah3, bh3) | 0; + lo = lo + Math.imul(al2, bl4) | 0; + mid = mid + Math.imul(al2, bh4) | 0; + mid = mid + Math.imul(ah2, bl4) | 0; + hi = hi + Math.imul(ah2, bh4) | 0; + lo = lo + Math.imul(al1, bl5) | 0; + mid = mid + Math.imul(al1, bh5) | 0; + mid = mid + Math.imul(ah1, bl5) | 0; + hi = hi + Math.imul(ah1, bh5) | 0; + lo = lo + Math.imul(al0, bl6) | 0; + mid = mid + Math.imul(al0, bh6) | 0; + mid = mid + Math.imul(ah0, bl6) | 0; + hi = hi + Math.imul(ah0, bh6) | 0; + var w6 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0; + w6 &= 67108863; + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = mid + Math.imul(ah7, bl0) | 0; + hi = Math.imul(ah7, bh0); + lo = lo + Math.imul(al6, bl1) | 0; + mid = mid + Math.imul(al6, bh1) | 0; + mid = mid + Math.imul(ah6, bl1) | 0; + hi = hi + Math.imul(ah6, bh1) | 0; + lo = lo + Math.imul(al5, bl2) | 0; + mid = mid + Math.imul(al5, bh2) | 0; + mid = mid + Math.imul(ah5, bl2) | 0; + hi = hi + Math.imul(ah5, bh2) | 0; + lo = lo + Math.imul(al4, bl3) | 0; + mid = mid + Math.imul(al4, bh3) | 0; + mid = mid + Math.imul(ah4, bl3) | 0; + hi = hi + Math.imul(ah4, bh3) | 0; + lo = lo + Math.imul(al3, bl4) | 0; + mid = mid + Math.imul(al3, bh4) | 0; + mid = mid + Math.imul(ah3, bl4) | 0; + hi = hi + Math.imul(ah3, bh4) | 0; + lo = lo + Math.imul(al2, bl5) | 0; + mid = mid + Math.imul(al2, bh5) | 0; + mid = mid + Math.imul(ah2, bl5) | 0; + hi = hi + Math.imul(ah2, bh5) | 0; + lo = lo + Math.imul(al1, bl6) | 0; + mid = mid + Math.imul(al1, bh6) | 0; + mid = mid + Math.imul(ah1, bl6) | 0; + hi = hi + Math.imul(ah1, bh6) | 0; + lo = lo + Math.imul(al0, bl7) | 0; + mid = mid + Math.imul(al0, bh7) | 0; + mid = mid + Math.imul(ah0, bl7) | 0; + hi = hi + Math.imul(ah0, bh7) | 0; + var w7 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0; + w7 &= 67108863; + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = mid + Math.imul(ah8, bl0) | 0; + hi = Math.imul(ah8, bh0); + lo = lo + Math.imul(al7, bl1) | 0; + mid = mid + Math.imul(al7, bh1) | 0; + mid = mid + Math.imul(ah7, bl1) | 0; + hi = hi + Math.imul(ah7, bh1) | 0; + lo = lo + Math.imul(al6, bl2) | 0; + mid = mid + Math.imul(al6, bh2) | 0; + mid = mid + Math.imul(ah6, bl2) | 0; + hi = hi + Math.imul(ah6, bh2) | 0; + lo = lo + Math.imul(al5, bl3) | 0; + mid = mid + Math.imul(al5, bh3) | 0; + mid = mid + Math.imul(ah5, bl3) | 0; + hi = hi + Math.imul(ah5, bh3) | 0; + lo = lo + Math.imul(al4, bl4) | 0; + mid = mid + Math.imul(al4, bh4) | 0; + mid = mid + Math.imul(ah4, bl4) | 0; + hi = hi + Math.imul(ah4, bh4) | 0; + lo = lo + Math.imul(al3, bl5) | 0; + mid = mid + Math.imul(al3, bh5) | 0; + mid = mid + Math.imul(ah3, bl5) | 0; + hi = hi + Math.imul(ah3, bh5) | 0; + lo = lo + Math.imul(al2, bl6) | 0; + mid = mid + Math.imul(al2, bh6) | 0; + mid = mid + Math.imul(ah2, bl6) | 0; + hi = hi + Math.imul(ah2, bh6) | 0; + lo = lo + Math.imul(al1, bl7) | 0; + mid = mid + Math.imul(al1, bh7) | 0; + mid = mid + Math.imul(ah1, bl7) | 0; + hi = hi + Math.imul(ah1, bh7) | 0; + lo = lo + Math.imul(al0, bl8) | 0; + mid = mid + Math.imul(al0, bh8) | 0; + mid = mid + Math.imul(ah0, bl8) | 0; + hi = hi + Math.imul(ah0, bh8) | 0; + var w8 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0; + w8 &= 67108863; + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = mid + Math.imul(ah9, bl0) | 0; + hi = Math.imul(ah9, bh0); + lo = lo + Math.imul(al8, bl1) | 0; + mid = mid + Math.imul(al8, bh1) | 0; + mid = mid + Math.imul(ah8, bl1) | 0; + hi = hi + Math.imul(ah8, bh1) | 0; + lo = lo + Math.imul(al7, bl2) | 0; + mid = mid + Math.imul(al7, bh2) | 0; + mid = mid + Math.imul(ah7, bl2) | 0; + hi = hi + Math.imul(ah7, bh2) | 0; + lo = lo + Math.imul(al6, bl3) | 0; + mid = mid + Math.imul(al6, bh3) | 0; + mid = mid + Math.imul(ah6, bl3) | 0; + hi = hi + Math.imul(ah6, bh3) | 0; + lo = lo + Math.imul(al5, bl4) | 0; + mid = mid + Math.imul(al5, bh4) | 0; + mid = mid + Math.imul(ah5, bl4) | 0; + hi = hi + Math.imul(ah5, bh4) | 0; + lo = lo + Math.imul(al4, bl5) | 0; + mid = mid + Math.imul(al4, bh5) | 0; + mid = mid + Math.imul(ah4, bl5) | 0; + hi = hi + Math.imul(ah4, bh5) | 0; + lo = lo + Math.imul(al3, bl6) | 0; + mid = mid + Math.imul(al3, bh6) | 0; + mid = mid + Math.imul(ah3, bl6) | 0; + hi = hi + Math.imul(ah3, bh6) | 0; + lo = lo + Math.imul(al2, bl7) | 0; + mid = mid + Math.imul(al2, bh7) | 0; + mid = mid + Math.imul(ah2, bl7) | 0; + hi = hi + Math.imul(ah2, bh7) | 0; + lo = lo + Math.imul(al1, bl8) | 0; + mid = mid + Math.imul(al1, bh8) | 0; + mid = mid + Math.imul(ah1, bl8) | 0; + hi = hi + Math.imul(ah1, bh8) | 0; + lo = lo + Math.imul(al0, bl9) | 0; + mid = mid + Math.imul(al0, bh9) | 0; + mid = mid + Math.imul(ah0, bl9) | 0; + hi = hi + Math.imul(ah0, bh9) | 0; + var w9 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0; + w9 &= 67108863; + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = mid + Math.imul(ah9, bl1) | 0; + hi = Math.imul(ah9, bh1); + lo = lo + Math.imul(al8, bl2) | 0; + mid = mid + Math.imul(al8, bh2) | 0; + mid = mid + Math.imul(ah8, bl2) | 0; + hi = hi + Math.imul(ah8, bh2) | 0; + lo = lo + Math.imul(al7, bl3) | 0; + mid = mid + Math.imul(al7, bh3) | 0; + mid = mid + Math.imul(ah7, bl3) | 0; + hi = hi + Math.imul(ah7, bh3) | 0; + lo = lo + Math.imul(al6, bl4) | 0; + mid = mid + Math.imul(al6, bh4) | 0; + mid = mid + Math.imul(ah6, bl4) | 0; + hi = hi + Math.imul(ah6, bh4) | 0; + lo = lo + Math.imul(al5, bl5) | 0; + mid = mid + Math.imul(al5, bh5) | 0; + mid = mid + Math.imul(ah5, bl5) | 0; + hi = hi + Math.imul(ah5, bh5) | 0; + lo = lo + Math.imul(al4, bl6) | 0; + mid = mid + Math.imul(al4, bh6) | 0; + mid = mid + Math.imul(ah4, bl6) | 0; + hi = hi + Math.imul(ah4, bh6) | 0; + lo = lo + Math.imul(al3, bl7) | 0; + mid = mid + Math.imul(al3, bh7) | 0; + mid = mid + Math.imul(ah3, bl7) | 0; + hi = hi + Math.imul(ah3, bh7) | 0; + lo = lo + Math.imul(al2, bl8) | 0; + mid = mid + Math.imul(al2, bh8) | 0; + mid = mid + Math.imul(ah2, bl8) | 0; + hi = hi + Math.imul(ah2, bh8) | 0; + lo = lo + Math.imul(al1, bl9) | 0; + mid = mid + Math.imul(al1, bh9) | 0; + mid = mid + Math.imul(ah1, bl9) | 0; + hi = hi + Math.imul(ah1, bh9) | 0; + var w10 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0; + w10 &= 67108863; + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = mid + Math.imul(ah9, bl2) | 0; + hi = Math.imul(ah9, bh2); + lo = lo + Math.imul(al8, bl3) | 0; + mid = mid + Math.imul(al8, bh3) | 0; + mid = mid + Math.imul(ah8, bl3) | 0; + hi = hi + Math.imul(ah8, bh3) | 0; + lo = lo + Math.imul(al7, bl4) | 0; + mid = mid + Math.imul(al7, bh4) | 0; + mid = mid + Math.imul(ah7, bl4) | 0; + hi = hi + Math.imul(ah7, bh4) | 0; + lo = lo + Math.imul(al6, bl5) | 0; + mid = mid + Math.imul(al6, bh5) | 0; + mid = mid + Math.imul(ah6, bl5) | 0; + hi = hi + Math.imul(ah6, bh5) | 0; + lo = lo + Math.imul(al5, bl6) | 0; + mid = mid + Math.imul(al5, bh6) | 0; + mid = mid + Math.imul(ah5, bl6) | 0; + hi = hi + Math.imul(ah5, bh6) | 0; + lo = lo + Math.imul(al4, bl7) | 0; + mid = mid + Math.imul(al4, bh7) | 0; + mid = mid + Math.imul(ah4, bl7) | 0; + hi = hi + Math.imul(ah4, bh7) | 0; + lo = lo + Math.imul(al3, bl8) | 0; + mid = mid + Math.imul(al3, bh8) | 0; + mid = mid + Math.imul(ah3, bl8) | 0; + hi = hi + Math.imul(ah3, bh8) | 0; + lo = lo + Math.imul(al2, bl9) | 0; + mid = mid + Math.imul(al2, bh9) | 0; + mid = mid + Math.imul(ah2, bl9) | 0; + hi = hi + Math.imul(ah2, bh9) | 0; + var w11 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0; + w11 &= 67108863; + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = mid + Math.imul(ah9, bl3) | 0; + hi = Math.imul(ah9, bh3); + lo = lo + Math.imul(al8, bl4) | 0; + mid = mid + Math.imul(al8, bh4) | 0; + mid = mid + Math.imul(ah8, bl4) | 0; + hi = hi + Math.imul(ah8, bh4) | 0; + lo = lo + Math.imul(al7, bl5) | 0; + mid = mid + Math.imul(al7, bh5) | 0; + mid = mid + Math.imul(ah7, bl5) | 0; + hi = hi + Math.imul(ah7, bh5) | 0; + lo = lo + Math.imul(al6, bl6) | 0; + mid = mid + Math.imul(al6, bh6) | 0; + mid = mid + Math.imul(ah6, bl6) | 0; + hi = hi + Math.imul(ah6, bh6) | 0; + lo = lo + Math.imul(al5, bl7) | 0; + mid = mid + Math.imul(al5, bh7) | 0; + mid = mid + Math.imul(ah5, bl7) | 0; + hi = hi + Math.imul(ah5, bh7) | 0; + lo = lo + Math.imul(al4, bl8) | 0; + mid = mid + Math.imul(al4, bh8) | 0; + mid = mid + Math.imul(ah4, bl8) | 0; + hi = hi + Math.imul(ah4, bh8) | 0; + lo = lo + Math.imul(al3, bl9) | 0; + mid = mid + Math.imul(al3, bh9) | 0; + mid = mid + Math.imul(ah3, bl9) | 0; + hi = hi + Math.imul(ah3, bh9) | 0; + var w12 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0; + w12 &= 67108863; + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = mid + Math.imul(ah9, bl4) | 0; + hi = Math.imul(ah9, bh4); + lo = lo + Math.imul(al8, bl5) | 0; + mid = mid + Math.imul(al8, bh5) | 0; + mid = mid + Math.imul(ah8, bl5) | 0; + hi = hi + Math.imul(ah8, bh5) | 0; + lo = lo + Math.imul(al7, bl6) | 0; + mid = mid + Math.imul(al7, bh6) | 0; + mid = mid + Math.imul(ah7, bl6) | 0; + hi = hi + Math.imul(ah7, bh6) | 0; + lo = lo + Math.imul(al6, bl7) | 0; + mid = mid + Math.imul(al6, bh7) | 0; + mid = mid + Math.imul(ah6, bl7) | 0; + hi = hi + Math.imul(ah6, bh7) | 0; + lo = lo + Math.imul(al5, bl8) | 0; + mid = mid + Math.imul(al5, bh8) | 0; + mid = mid + Math.imul(ah5, bl8) | 0; + hi = hi + Math.imul(ah5, bh8) | 0; + lo = lo + Math.imul(al4, bl9) | 0; + mid = mid + Math.imul(al4, bh9) | 0; + mid = mid + Math.imul(ah4, bl9) | 0; + hi = hi + Math.imul(ah4, bh9) | 0; + var w13 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0; + w13 &= 67108863; + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = mid + Math.imul(ah9, bl5) | 0; + hi = Math.imul(ah9, bh5); + lo = lo + Math.imul(al8, bl6) | 0; + mid = mid + Math.imul(al8, bh6) | 0; + mid = mid + Math.imul(ah8, bl6) | 0; + hi = hi + Math.imul(ah8, bh6) | 0; + lo = lo + Math.imul(al7, bl7) | 0; + mid = mid + Math.imul(al7, bh7) | 0; + mid = mid + Math.imul(ah7, bl7) | 0; + hi = hi + Math.imul(ah7, bh7) | 0; + lo = lo + Math.imul(al6, bl8) | 0; + mid = mid + Math.imul(al6, bh8) | 0; + mid = mid + Math.imul(ah6, bl8) | 0; + hi = hi + Math.imul(ah6, bh8) | 0; + lo = lo + Math.imul(al5, bl9) | 0; + mid = mid + Math.imul(al5, bh9) | 0; + mid = mid + Math.imul(ah5, bl9) | 0; + hi = hi + Math.imul(ah5, bh9) | 0; + var w14 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0; + w14 &= 67108863; + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = mid + Math.imul(ah9, bl6) | 0; + hi = Math.imul(ah9, bh6); + lo = lo + Math.imul(al8, bl7) | 0; + mid = mid + Math.imul(al8, bh7) | 0; + mid = mid + Math.imul(ah8, bl7) | 0; + hi = hi + Math.imul(ah8, bh7) | 0; + lo = lo + Math.imul(al7, bl8) | 0; + mid = mid + Math.imul(al7, bh8) | 0; + mid = mid + Math.imul(ah7, bl8) | 0; + hi = hi + Math.imul(ah7, bh8) | 0; + lo = lo + Math.imul(al6, bl9) | 0; + mid = mid + Math.imul(al6, bh9) | 0; + mid = mid + Math.imul(ah6, bl9) | 0; + hi = hi + Math.imul(ah6, bh9) | 0; + var w15 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0; + w15 &= 67108863; + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = mid + Math.imul(ah9, bl7) | 0; + hi = Math.imul(ah9, bh7); + lo = lo + Math.imul(al8, bl8) | 0; + mid = mid + Math.imul(al8, bh8) | 0; + mid = mid + Math.imul(ah8, bl8) | 0; + hi = hi + Math.imul(ah8, bh8) | 0; + lo = lo + Math.imul(al7, bl9) | 0; + mid = mid + Math.imul(al7, bh9) | 0; + mid = mid + Math.imul(ah7, bl9) | 0; + hi = hi + Math.imul(ah7, bh9) | 0; + var w16 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0; + w16 &= 67108863; + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = mid + Math.imul(ah9, bl8) | 0; + hi = Math.imul(ah9, bh8); + lo = lo + Math.imul(al8, bl9) | 0; + mid = mid + Math.imul(al8, bh9) | 0; + mid = mid + Math.imul(ah8, bl9) | 0; + hi = hi + Math.imul(ah8, bh9) | 0; + var w17 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0; + w17 &= 67108863; + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = mid + Math.imul(ah9, bl9) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0; + w18 &= 67108863; + o2[0] = w0; + o2[1] = w1; + o2[2] = w2; + o2[3] = w3; + o2[4] = w4; + o2[5] = w5; + o2[6] = w6; + o2[7] = w7; + o2[8] = w8; + o2[9] = w9; + o2[10] = w10; + o2[11] = w11; + o2[12] = w12; + o2[13] = w13; + o2[14] = w14; + o2[15] = w15; + o2[16] = w16; + o2[17] = w17; + o2[18] = w18; + if (c !== 0) { + o2[19] = c; + out.length++; + } + return out; + }; + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + function bigMulTo(self2, num, out) { + out.negative = num.negative ^ self2.negative; + out.length = self2.length + num.length; + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 67108863; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) { + var i2 = k - j; + var a2 = self2.words[i2] | 0; + var b = num.words[j] | 0; + var r3 = a2 * b; + var lo = r3 & 67108863; + ncarry = ncarry + (r3 / 67108864 | 0) | 0; + lo = lo + rword | 0; + rword = lo & 67108863; + ncarry = ncarry + (lo >>> 26) | 0; + hncarry += ncarry >>> 26; + ncarry &= 67108863; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + return out._strip(); + } + function jumboMulTo(self2, num, out) { + return bigMulTo(self2, num, out); + } + BN3.prototype.mulTo = function mulTo(num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + return res; + }; + function FFTM(x, y) { + this.x = x; + this.y = y; + } + FFTM.prototype.makeRBT = function makeRBT(N2) { + var t2 = new Array(N2); + var l2 = BN3.prototype._countBits(N2) - 1; + for (var i2 = 0; i2 < N2; i2++) { + t2[i2] = this.revBin(i2, l2, N2); + } + return t2; + }; + FFTM.prototype.revBin = function revBin(x, l2, N2) { + if (x === 0 || x === N2 - 1) + return x; + var rb = 0; + for (var i2 = 0; i2 < l2; i2++) { + rb |= (x & 1) << l2 - i2 - 1; + x >>= 1; + } + return rb; + }; + FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N2) { + for (var i2 = 0; i2 < N2; i2++) { + rtws[i2] = rws[rbt[i2]]; + itws[i2] = iws[rbt[i2]]; + } + }; + FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N2, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N2); + for (var s2 = 1; s2 < N2; s2 <<= 1) { + var l2 = s2 << 1; + var rtwdf = Math.cos(2 * Math.PI / l2); + var itwdf = Math.sin(2 * Math.PI / l2); + for (var p = 0; p < N2; p += l2) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + for (var j = 0; j < s2; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + var ro = rtws[p + j + s2]; + var io = itws[p + j + s2]; + var rx = rtwdf_ * ro - itwdf_ * io; + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + rtws[p + j + s2] = re - ro; + itws[p + j + s2] = ie - io; + if (j !== l2) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + FFTM.prototype.guessLen13b = function guessLen13b(n2, m) { + var N2 = Math.max(m, n2) | 1; + var odd = N2 & 1; + var i2 = 0; + for (N2 = N2 / 2 | 0; N2; N2 = N2 >>> 1) { + i2++; + } + return 1 << i2 + 1 + odd; + }; + FFTM.prototype.conjugate = function conjugate(rws, iws, N2) { + if (N2 <= 1) + return; + for (var i2 = 0; i2 < N2 / 2; i2++) { + var t2 = rws[i2]; + rws[i2] = rws[N2 - i2 - 1]; + rws[N2 - i2 - 1] = t2; + t2 = iws[i2]; + iws[i2] = -iws[N2 - i2 - 1]; + iws[N2 - i2 - 1] = -t2; + } + }; + FFTM.prototype.normalize13b = function normalize13b(ws, N2) { + var carry = 0; + for (var i2 = 0; i2 < N2 / 2; i2++) { + var w = Math.round(ws[2 * i2 + 1] / N2) * 8192 + Math.round(ws[2 * i2] / N2) + carry; + ws[i2] = w & 67108863; + if (w < 67108864) { + carry = 0; + } else { + carry = w / 67108864 | 0; + } + } + return ws; + }; + FFTM.prototype.convert13b = function convert13b(ws, len, rws, N2) { + var carry = 0; + for (var i2 = 0; i2 < len; i2++) { + carry = carry + (ws[i2] | 0); + rws[2 * i2] = carry & 8191; + carry = carry >>> 13; + rws[2 * i2 + 1] = carry & 8191; + carry = carry >>> 13; + } + for (i2 = 2 * len; i2 < N2; ++i2) { + rws[i2] = 0; + } + assert2(carry === 0); + assert2((carry & ~8191) === 0); + }; + FFTM.prototype.stub = function stub(N2) { + var ph = new Array(N2); + for (var i2 = 0; i2 < N2; i2++) { + ph[i2] = 0; + } + return ph; + }; + FFTM.prototype.mulp = function mulp(x, y, out) { + var N2 = 2 * this.guessLen13b(x.length, y.length); + var rbt = this.makeRBT(N2); + var _ = this.stub(N2); + var rws = new Array(N2); + var rwst = new Array(N2); + var iwst = new Array(N2); + var nrws = new Array(N2); + var nrwst = new Array(N2); + var niwst = new Array(N2); + var rmws = out.words; + rmws.length = N2; + this.convert13b(x.words, x.length, rws, N2); + this.convert13b(y.words, y.length, nrws, N2); + this.transform(rws, _, rwst, iwst, N2, rbt); + this.transform(nrws, _, nrwst, niwst, N2, rbt); + for (var i2 = 0; i2 < N2; i2++) { + var rx = rwst[i2] * nrwst[i2] - iwst[i2] * niwst[i2]; + iwst[i2] = rwst[i2] * niwst[i2] + iwst[i2] * nrwst[i2]; + rwst[i2] = rx; + } + this.conjugate(rwst, iwst, N2); + this.transform(rwst, iwst, rmws, _, N2, rbt); + this.conjugate(rmws, _, N2); + this.normalize13b(rmws, N2); + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out._strip(); + }; + BN3.prototype.mul = function mul3(num) { + var out = new BN3(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + BN3.prototype.mulf = function mulf(num) { + var out = new BN3(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + BN3.prototype.imul = function imul(num) { + return this.clone().mulTo(num, this); + }; + BN3.prototype.imuln = function imuln(num) { + var isNegNum = num < 0; + if (isNegNum) + num = -num; + assert2(typeof num === "number"); + assert2(num < 67108864); + var carry = 0; + for (var i2 = 0; i2 < this.length; i2++) { + var w = (this.words[i2] | 0) * num; + var lo = (w & 67108863) + (carry & 67108863); + carry >>= 26; + carry += w / 67108864 | 0; + carry += lo >>> 26; + this.words[i2] = lo & 67108863; + } + if (carry !== 0) { + this.words[i2] = carry; + this.length++; + } + return isNegNum ? this.ineg() : this; + }; + BN3.prototype.muln = function muln(num) { + return this.clone().imuln(num); + }; + BN3.prototype.sqr = function sqr() { + return this.mul(this); + }; + BN3.prototype.isqr = function isqr() { + return this.imul(this.clone()); + }; + BN3.prototype.pow = function pow(num) { + var w = toBitArray(num); + if (w.length === 0) + return new BN3(1); + var res = this; + for (var i2 = 0; i2 < w.length; i2++, res = res.sqr()) { + if (w[i2] !== 0) + break; + } + if (++i2 < w.length) { + for (var q = res.sqr(); i2 < w.length; i2++, q = q.sqr()) { + if (w[i2] === 0) + continue; + res = res.mul(q); + } + } + return res; + }; + BN3.prototype.iushln = function iushln(bits) { + assert2(typeof bits === "number" && bits >= 0); + var r3 = bits % 26; + var s2 = (bits - r3) / 26; + var carryMask = 67108863 >>> 26 - r3 << 26 - r3; + var i2; + if (r3 !== 0) { + var carry = 0; + for (i2 = 0; i2 < this.length; i2++) { + var newCarry = this.words[i2] & carryMask; + var c = (this.words[i2] | 0) - newCarry << r3; + this.words[i2] = c | carry; + carry = newCarry >>> 26 - r3; + } + if (carry) { + this.words[i2] = carry; + this.length++; + } + } + if (s2 !== 0) { + for (i2 = this.length - 1; i2 >= 0; i2--) { + this.words[i2 + s2] = this.words[i2]; + } + for (i2 = 0; i2 < s2; i2++) { + this.words[i2] = 0; + } + this.length += s2; + } + return this._strip(); + }; + BN3.prototype.ishln = function ishln(bits) { + assert2(this.negative === 0); + return this.iushln(bits); + }; + BN3.prototype.iushrn = function iushrn(bits, hint, extended) { + assert2(typeof bits === "number" && bits >= 0); + var h; + if (hint) { + h = (hint - hint % 26) / 26; + } else { + h = 0; + } + var r3 = bits % 26; + var s2 = Math.min((bits - r3) / 26, this.length); + var mask = 67108863 ^ 67108863 >>> r3 << r3; + var maskedWords = extended; + h -= s2; + h = Math.max(0, h); + if (maskedWords) { + for (var i2 = 0; i2 < s2; i2++) { + maskedWords.words[i2] = this.words[i2]; + } + maskedWords.length = s2; + } + if (s2 === 0) { + } else if (this.length > s2) { + this.length -= s2; + for (i2 = 0; i2 < this.length; i2++) { + this.words[i2] = this.words[i2 + s2]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + var carry = 0; + for (i2 = this.length - 1; i2 >= 0 && (carry !== 0 || i2 >= h); i2--) { + var word = this.words[i2] | 0; + this.words[i2] = carry << 26 - r3 | word >>> r3; + carry = word & mask; + } + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + return this._strip(); + }; + BN3.prototype.ishrn = function ishrn(bits, hint, extended) { + assert2(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + BN3.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); + }; + BN3.prototype.ushln = function ushln(bits) { + return this.clone().iushln(bits); + }; + BN3.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); + }; + BN3.prototype.ushrn = function ushrn(bits) { + return this.clone().iushrn(bits); + }; + BN3.prototype.testn = function testn(bit) { + assert2(typeof bit === "number" && bit >= 0); + var r3 = bit % 26; + var s2 = (bit - r3) / 26; + var q = 1 << r3; + if (this.length <= s2) + return false; + var w = this.words[s2]; + return !!(w & q); + }; + BN3.prototype.imaskn = function imaskn(bits) { + assert2(typeof bits === "number" && bits >= 0); + var r3 = bits % 26; + var s2 = (bits - r3) / 26; + assert2(this.negative === 0, "imaskn works only with positive numbers"); + if (this.length <= s2) { + return this; + } + if (r3 !== 0) { + s2++; + } + this.length = Math.min(s2, this.length); + if (r3 !== 0) { + var mask = 67108863 ^ 67108863 >>> r3 << r3; + this.words[this.length - 1] &= mask; + } + return this._strip(); + }; + BN3.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); + }; + BN3.prototype.iaddn = function iaddn(num) { + assert2(typeof num === "number"); + assert2(num < 67108864); + if (num < 0) + return this.isubn(-num); + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) <= num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + return this._iaddn(num); + }; + BN3.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + for (var i2 = 0; i2 < this.length && this.words[i2] >= 67108864; i2++) { + this.words[i2] -= 67108864; + if (i2 === this.length - 1) { + this.words[i2 + 1] = 1; + } else { + this.words[i2 + 1]++; + } + } + this.length = Math.max(this.length, i2 + 1); + return this; + }; + BN3.prototype.isubn = function isubn(num) { + assert2(typeof num === "number"); + assert2(num < 67108864); + if (num < 0) + return this.iaddn(-num); + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + this.words[0] -= num; + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + for (var i2 = 0; i2 < this.length && this.words[i2] < 0; i2++) { + this.words[i2] += 67108864; + this.words[i2 + 1] -= 1; + } + } + return this._strip(); + }; + BN3.prototype.addn = function addn(num) { + return this.clone().iaddn(num); + }; + BN3.prototype.subn = function subn(num) { + return this.clone().isubn(num); + }; + BN3.prototype.iabs = function iabs() { + this.negative = 0; + return this; + }; + BN3.prototype.abs = function abs() { + return this.clone().iabs(); + }; + BN3.prototype._ishlnsubmul = function _ishlnsubmul(num, mul3, shift) { + var len = num.length + shift; + var i2; + this._expand(len); + var w; + var carry = 0; + for (i2 = 0; i2 < num.length; i2++) { + w = (this.words[i2 + shift] | 0) + carry; + var right = (num.words[i2] | 0) * mul3; + w -= right & 67108863; + carry = (w >> 26) - (right / 67108864 | 0); + this.words[i2 + shift] = w & 67108863; + } + for (; i2 < this.length - shift; i2++) { + w = (this.words[i2 + shift] | 0) + carry; + carry = w >> 26; + this.words[i2 + shift] = w & 67108863; + } + if (carry === 0) + return this._strip(); + assert2(carry === -1); + carry = 0; + for (i2 = 0; i2 < this.length; i2++) { + w = -(this.words[i2] | 0) + carry; + carry = w >> 26; + this.words[i2] = w & 67108863; + } + this.negative = 1; + return this._strip(); + }; + BN3.prototype._wordDiv = function _wordDiv(num, mode) { + var shift = this.length - num.length; + var a2 = this.clone(); + var b = num; + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a2.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + var m = a2.length - b.length; + var q; + if (mode !== "mod") { + q = new BN3(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i2 = 0; i2 < q.length; i2++) { + q.words[i2] = 0; + } + } + var diff = a2.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a2 = diff; + if (q) { + q.words[m] = 1; + } + } + for (var j = m - 1; j >= 0; j--) { + var qj = (a2.words[b.length + j] | 0) * 67108864 + (a2.words[b.length + j - 1] | 0); + qj = Math.min(qj / bhi | 0, 67108863); + a2._ishlnsubmul(b, qj, j); + while (a2.negative !== 0) { + qj--; + a2.negative = 0; + a2._ishlnsubmul(b, 1, j); + if (!a2.isZero()) { + a2.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q._strip(); + } + a2._strip(); + if (mode !== "div" && shift !== 0) { + a2.iushrn(shift); + } + return { + div: q || null, + mod: a2 + }; + }; + BN3.prototype.divmod = function divmod(num, mode, positive) { + assert2(!num.isZero()); + if (this.isZero()) { + return { + div: new BN3(0), + mod: new BN3(0) + }; + } + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + if (mode !== "mod") { + div = res.div.neg(); + } + if (mode !== "div") { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + return { + div, + mod + }; + } + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + if (mode !== "mod") { + div = res.div.neg(); + } + return { + div, + mod: res.mod + }; + } + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + if (mode !== "div") { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + return { + div: res.div, + mod + }; + } + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN3(0), + mod: this + }; + } + if (num.length === 1) { + if (mode === "div") { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + if (mode === "mod") { + return { + div: null, + mod: new BN3(this.modrn(num.words[0])) + }; + } + return { + div: this.divn(num.words[0]), + mod: new BN3(this.modrn(num.words[0])) + }; + } + return this._wordDiv(num, mode); + }; + BN3.prototype.div = function div(num) { + return this.divmod(num, "div", false).div; + }; + BN3.prototype.mod = function mod(num) { + return this.divmod(num, "mod", false).mod; + }; + BN3.prototype.umod = function umod(num) { + return this.divmod(num, "mod", true).mod; + }; + BN3.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + if (dm.mod.isZero()) + return dm.div; + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + var half = num.ushrn(1); + var r22 = num.andln(1); + var cmp = mod.cmp(half); + if (cmp < 0 || r22 === 1 && cmp === 0) + return dm.div; + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + BN3.prototype.modrn = function modrn(num) { + var isNegNum = num < 0; + if (isNegNum) + num = -num; + assert2(num <= 67108863); + var p = (1 << 26) % num; + var acc = 0; + for (var i2 = this.length - 1; i2 >= 0; i2--) { + acc = (p * acc + (this.words[i2] | 0)) % num; + } + return isNegNum ? -acc : acc; + }; + BN3.prototype.modn = function modn(num) { + return this.modrn(num); + }; + BN3.prototype.idivn = function idivn(num) { + var isNegNum = num < 0; + if (isNegNum) + num = -num; + assert2(num <= 67108863); + var carry = 0; + for (var i2 = this.length - 1; i2 >= 0; i2--) { + var w = (this.words[i2] | 0) + carry * 67108864; + this.words[i2] = w / num | 0; + carry = w % num; + } + this._strip(); + return isNegNum ? this.ineg() : this; + }; + BN3.prototype.divn = function divn(num) { + return this.clone().idivn(num); + }; + BN3.prototype.egcd = function egcd(p) { + assert2(p.negative === 0); + assert2(!p.isZero()); + var x = this; + var y = p.clone(); + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + var A2 = new BN3(1); + var B = new BN3(0); + var C = new BN3(0); + var D3 = new BN3(1); + var g = 0; + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + var yp = y.clone(); + var xp = x.clone(); + while (!x.isZero()) { + for (var i2 = 0, im = 1; (x.words[0] & im) === 0 && i2 < 26; ++i2, im <<= 1) + ; + if (i2 > 0) { + x.iushrn(i2); + while (i2-- > 0) { + if (A2.isOdd() || B.isOdd()) { + A2.iadd(yp); + B.isub(xp); + } + A2.iushrn(1); + B.iushrn(1); + } + } + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) + ; + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D3.isOdd()) { + C.iadd(yp); + D3.isub(xp); + } + C.iushrn(1); + D3.iushrn(1); + } + } + if (x.cmp(y) >= 0) { + x.isub(y); + A2.isub(C); + B.isub(D3); + } else { + y.isub(x); + C.isub(A2); + D3.isub(B); + } + } + return { + a: C, + b: D3, + gcd: y.iushln(g) + }; + }; + BN3.prototype._invmp = function _invmp(p) { + assert2(p.negative === 0); + assert2(!p.isZero()); + var a2 = this; + var b = p.clone(); + if (a2.negative !== 0) { + a2 = a2.umod(p); + } else { + a2 = a2.clone(); + } + var x1 = new BN3(1); + var x2 = new BN3(0); + var delta = b.clone(); + while (a2.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i2 = 0, im = 1; (a2.words[0] & im) === 0 && i2 < 26; ++i2, im <<= 1) + ; + if (i2 > 0) { + a2.iushrn(i2); + while (i2-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + x1.iushrn(1); + } + } + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) + ; + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + x2.iushrn(1); + } + } + if (a2.cmp(b) >= 0) { + a2.isub(b); + x1.isub(x2); + } else { + b.isub(a2); + x2.isub(x1); + } + } + var res; + if (a2.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + if (res.cmpn(0) < 0) { + res.iadd(p); + } + return res; + }; + BN3.prototype.gcd = function gcd(num) { + if (this.isZero()) + return num.abs(); + if (num.isZero()) + return this.abs(); + var a2 = this.clone(); + var b = num.clone(); + a2.negative = 0; + b.negative = 0; + for (var shift = 0; a2.isEven() && b.isEven(); shift++) { + a2.iushrn(1); + b.iushrn(1); + } + do { + while (a2.isEven()) { + a2.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + var r3 = a2.cmp(b); + if (r3 < 0) { + var t2 = a2; + a2 = b; + b = t2; + } else if (r3 === 0 || b.cmpn(1) === 0) { + break; + } + a2.isub(b); + } while (true); + return b.iushln(shift); + }; + BN3.prototype.invm = function invm(num) { + return this.egcd(num).a.umod(num); + }; + BN3.prototype.isEven = function isEven() { + return (this.words[0] & 1) === 0; + }; + BN3.prototype.isOdd = function isOdd() { + return (this.words[0] & 1) === 1; + }; + BN3.prototype.andln = function andln(num) { + return this.words[0] & num; + }; + BN3.prototype.bincn = function bincn(bit) { + assert2(typeof bit === "number"); + var r3 = bit % 26; + var s2 = (bit - r3) / 26; + var q = 1 << r3; + if (this.length <= s2) { + this._expand(s2 + 1); + this.words[s2] |= q; + return this; + } + var carry = q; + for (var i2 = s2; carry !== 0 && i2 < this.length; i2++) { + var w = this.words[i2] | 0; + w += carry; + carry = w >>> 26; + w &= 67108863; + this.words[i2] = w; + } + if (carry !== 0) { + this.words[i2] = carry; + this.length++; + } + return this; + }; + BN3.prototype.isZero = function isZero() { + return this.length === 1 && this.words[0] === 0; + }; + BN3.prototype.cmpn = function cmpn(num) { + var negative = num < 0; + if (this.negative !== 0 && !negative) + return -1; + if (this.negative === 0 && negative) + return 1; + this._strip(); + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + assert2(num <= 67108863, "Number is too big"); + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) + return -res | 0; + return res; + }; + BN3.prototype.cmp = function cmp(num) { + if (this.negative !== 0 && num.negative === 0) + return -1; + if (this.negative === 0 && num.negative !== 0) + return 1; + var res = this.ucmp(num); + if (this.negative !== 0) + return -res | 0; + return res; + }; + BN3.prototype.ucmp = function ucmp(num) { + if (this.length > num.length) + return 1; + if (this.length < num.length) + return -1; + var res = 0; + for (var i2 = this.length - 1; i2 >= 0; i2--) { + var a2 = this.words[i2] | 0; + var b = num.words[i2] | 0; + if (a2 === b) + continue; + if (a2 < b) { + res = -1; + } else if (a2 > b) { + res = 1; + } + break; + } + return res; + }; + BN3.prototype.gtn = function gtn(num) { + return this.cmpn(num) === 1; + }; + BN3.prototype.gt = function gt(num) { + return this.cmp(num) === 1; + }; + BN3.prototype.gten = function gten(num) { + return this.cmpn(num) >= 0; + }; + BN3.prototype.gte = function gte(num) { + return this.cmp(num) >= 0; + }; + BN3.prototype.ltn = function ltn(num) { + return this.cmpn(num) === -1; + }; + BN3.prototype.lt = function lt(num) { + return this.cmp(num) === -1; + }; + BN3.prototype.lten = function lten(num) { + return this.cmpn(num) <= 0; + }; + BN3.prototype.lte = function lte(num) { + return this.cmp(num) <= 0; + }; + BN3.prototype.eqn = function eqn(num) { + return this.cmpn(num) === 0; + }; + BN3.prototype.eq = function eq4(num) { + return this.cmp(num) === 0; + }; + BN3.red = function red(num) { + return new Red(num); + }; + BN3.prototype.toRed = function toRed(ctx) { + assert2(!this.red, "Already a number in reduction context"); + assert2(this.negative === 0, "red works only with positives"); + return ctx.convertTo(this)._forceRed(ctx); + }; + BN3.prototype.fromRed = function fromRed() { + assert2(this.red, "fromRed works only with numbers in reduction context"); + return this.red.convertFrom(this); + }; + BN3.prototype._forceRed = function _forceRed(ctx) { + this.red = ctx; + return this; + }; + BN3.prototype.forceRed = function forceRed(ctx) { + assert2(!this.red, "Already a number in reduction context"); + return this._forceRed(ctx); + }; + BN3.prototype.redAdd = function redAdd(num) { + assert2(this.red, "redAdd works only with red numbers"); + return this.red.add(this, num); + }; + BN3.prototype.redIAdd = function redIAdd(num) { + assert2(this.red, "redIAdd works only with red numbers"); + return this.red.iadd(this, num); + }; + BN3.prototype.redSub = function redSub(num) { + assert2(this.red, "redSub works only with red numbers"); + return this.red.sub(this, num); + }; + BN3.prototype.redISub = function redISub(num) { + assert2(this.red, "redISub works only with red numbers"); + return this.red.isub(this, num); + }; + BN3.prototype.redShl = function redShl(num) { + assert2(this.red, "redShl works only with red numbers"); + return this.red.shl(this, num); + }; + BN3.prototype.redMul = function redMul(num) { + assert2(this.red, "redMul works only with red numbers"); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + BN3.prototype.redIMul = function redIMul(num) { + assert2(this.red, "redMul works only with red numbers"); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + BN3.prototype.redSqr = function redSqr() { + assert2(this.red, "redSqr works only with red numbers"); + this.red._verify1(this); + return this.red.sqr(this); + }; + BN3.prototype.redISqr = function redISqr() { + assert2(this.red, "redISqr works only with red numbers"); + this.red._verify1(this); + return this.red.isqr(this); + }; + BN3.prototype.redSqrt = function redSqrt() { + assert2(this.red, "redSqrt works only with red numbers"); + this.red._verify1(this); + return this.red.sqrt(this); + }; + BN3.prototype.redInvm = function redInvm() { + assert2(this.red, "redInvm works only with red numbers"); + this.red._verify1(this); + return this.red.invm(this); + }; + BN3.prototype.redNeg = function redNeg() { + assert2(this.red, "redNeg works only with red numbers"); + this.red._verify1(this); + return this.red.neg(this); + }; + BN3.prototype.redPow = function redPow(num) { + assert2(this.red && !num.red, "redPow(normalNum)"); + this.red._verify1(this); + return this.red.pow(this, num); + }; + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + function MPrime(name, p) { + this.name = name; + this.p = new BN3(p, 16); + this.n = this.p.bitLength(); + this.k = new BN3(1).iushln(this.n).isub(this.p); + this.tmp = this._tmp(); + } + MPrime.prototype._tmp = function _tmp() { + var tmp = new BN3(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + MPrime.prototype.ireduce = function ireduce(num) { + var r3 = num; + var rlen; + do { + this.split(r3, this.tmp); + r3 = this.imulK(r3); + r3 = r3.iadd(this.tmp); + rlen = r3.bitLength(); + } while (rlen > this.n); + var cmp = rlen < this.n ? -1 : r3.ucmp(this.p); + if (cmp === 0) { + r3.words[0] = 0; + r3.length = 1; + } else if (cmp > 0) { + r3.isub(this.p); + } else { + if (r3.strip !== void 0) { + r3.strip(); + } else { + r3._strip(); + } + } + return r3; + }; + MPrime.prototype.split = function split(input, out) { + input.iushrn(this.n, 0, out); + }; + MPrime.prototype.imulK = function imulK(num) { + return num.imul(this.k); + }; + function K256() { + MPrime.call( + this, + "k256", + "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" + ); + } + inherits(K256, MPrime); + K256.prototype.split = function split(input, output) { + var mask = 4194303; + var outLen = Math.min(input.length, 9); + for (var i2 = 0; i2 < outLen; i2++) { + output.words[i2] = input.words[i2]; + } + output.length = outLen; + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + for (i2 = 10; i2 < input.length; i2++) { + var next = input.words[i2] | 0; + input.words[i2 - 10] = (next & mask) << 4 | prev >>> 22; + prev = next; + } + prev >>>= 22; + input.words[i2 - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + K256.prototype.imulK = function imulK(num) { + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + var lo = 0; + for (var i2 = 0; i2 < num.length; i2++) { + var w = num.words[i2] | 0; + lo += w * 977; + num.words[i2] = lo & 67108863; + lo = w * 64 + (lo / 67108864 | 0); + } + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + function P224() { + MPrime.call( + this, + "p224", + "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" + ); + } + inherits(P224, MPrime); + function P192() { + MPrime.call( + this, + "p192", + "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" + ); + } + inherits(P192, MPrime); + function P25519() { + MPrime.call( + this, + "25519", + "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" + ); + } + inherits(P25519, MPrime); + P25519.prototype.imulK = function imulK(num) { + var carry = 0; + for (var i2 = 0; i2 < num.length; i2++) { + var hi = (num.words[i2] | 0) * 19 + carry; + var lo = hi & 67108863; + hi >>>= 26; + num.words[i2] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + BN3._prime = function prime(name) { + if (primes[name]) + return primes[name]; + var prime2; + if (name === "k256") { + prime2 = new K256(); + } else if (name === "p224") { + prime2 = new P224(); + } else if (name === "p192") { + prime2 = new P192(); + } else if (name === "p25519") { + prime2 = new P25519(); + } else { + throw new Error("Unknown prime " + name); + } + primes[name] = prime2; + return prime2; + }; + function Red(m) { + if (typeof m === "string") { + var prime = BN3._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert2(m.gtn(1), "modulus must be greater than 1"); + this.m = m; + this.prime = null; + } + } + Red.prototype._verify1 = function _verify1(a2) { + assert2(a2.negative === 0, "red works only with positives"); + assert2(a2.red, "red works only with red numbers"); + }; + Red.prototype._verify2 = function _verify2(a2, b) { + assert2((a2.negative | b.negative) === 0, "red works only with positives"); + assert2( + a2.red && a2.red === b.red, + "red works only with red numbers" + ); + }; + Red.prototype.imod = function imod(a2) { + if (this.prime) + return this.prime.ireduce(a2)._forceRed(this); + move(a2, a2.umod(this.m)._forceRed(this)); + return a2; + }; + Red.prototype.neg = function neg3(a2) { + if (a2.isZero()) { + return a2.clone(); + } + return this.m.sub(a2)._forceRed(this); + }; + Red.prototype.add = function add5(a2, b) { + this._verify2(a2, b); + var res = a2.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + Red.prototype.iadd = function iadd(a2, b) { + this._verify2(a2, b); + var res = a2.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + Red.prototype.sub = function sub(a2, b) { + this._verify2(a2, b); + var res = a2.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + Red.prototype.isub = function isub(a2, b) { + this._verify2(a2, b); + var res = a2.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + Red.prototype.shl = function shl(a2, num) { + this._verify1(a2); + return this.imod(a2.ushln(num)); + }; + Red.prototype.imul = function imul(a2, b) { + this._verify2(a2, b); + return this.imod(a2.imul(b)); + }; + Red.prototype.mul = function mul3(a2, b) { + this._verify2(a2, b); + return this.imod(a2.mul(b)); + }; + Red.prototype.isqr = function isqr(a2) { + return this.imul(a2, a2.clone()); + }; + Red.prototype.sqr = function sqr(a2) { + return this.mul(a2, a2); + }; + Red.prototype.sqrt = function sqrt(a2) { + if (a2.isZero()) + return a2.clone(); + var mod3 = this.m.andln(3); + assert2(mod3 % 2 === 1); + if (mod3 === 3) { + var pow = this.m.add(new BN3(1)).iushrn(2); + return this.pow(a2, pow); + } + var q = this.m.subn(1); + var s2 = 0; + while (!q.isZero() && q.andln(1) === 0) { + s2++; + q.iushrn(1); + } + assert2(!q.isZero()); + var one = new BN3(1).toRed(this); + var nOne = one.redNeg(); + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN3(2 * z * z).toRed(this); + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + var c = this.pow(z, q); + var r3 = this.pow(a2, q.addn(1).iushrn(1)); + var t2 = this.pow(a2, q); + var m = s2; + while (t2.cmp(one) !== 0) { + var tmp = t2; + for (var i2 = 0; tmp.cmp(one) !== 0; i2++) { + tmp = tmp.redSqr(); + } + assert2(i2 < m); + var b = this.pow(c, new BN3(1).iushln(m - i2 - 1)); + r3 = r3.redMul(b); + c = b.redSqr(); + t2 = t2.redMul(c); + m = i2; + } + return r3; + }; + Red.prototype.invm = function invm(a2) { + var inv = a2._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + Red.prototype.pow = function pow(a2, num) { + if (num.isZero()) + return new BN3(1).toRed(this); + if (num.cmpn(1) === 0) + return a2.clone(); + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN3(1).toRed(this); + wnd[1] = a2; + for (var i2 = 2; i2 < wnd.length; i2++) { + wnd[i2] = this.mul(wnd[i2 - 1], a2); + } + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + for (i2 = num.length - 1; i2 >= 0; i2--) { + var word = num.words[i2]; + for (var j = start - 1; j >= 0; j--) { + var bit = word >> j & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i2 !== 0 || j !== 0)) + continue; + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + return res; + }; + Red.prototype.convertTo = function convertTo(num) { + var r3 = num.umod(this.m); + return r3 === num ? r3.clone() : r3; + }; + Red.prototype.convertFrom = function convertFrom(num) { + var res = num.clone(); + res.red = null; + return res; + }; + BN3.mont = function mont(num) { + return new Mont(num); + }; + function Mont(m) { + Red.call(this, m); + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - this.shift % 26; + } + this.r = new BN3(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + Mont.prototype.convertTo = function convertTo(num) { + return this.imod(num.ushln(this.shift)); + }; + Mont.prototype.convertFrom = function convertFrom(num) { + var r3 = this.imod(num.mul(this.rinv)); + r3.red = null; + return r3; + }; + Mont.prototype.imul = function imul(a2, b) { + if (a2.isZero() || b.isZero()) { + a2.words[0] = 0; + a2.length = 1; + return a2; + } + var t2 = a2.imul(b); + var c = t2.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t2.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + return res._forceRed(this); + }; + Mont.prototype.mul = function mul3(a2, b) { + if (a2.isZero() || b.isZero()) + return new BN3(0)._forceRed(this); + var t2 = a2.mul(b); + var c = t2.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t2.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + return res._forceRed(this); + }; + Mont.prototype.invm = function invm(a2) { + var res = this.imod(a2._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; + })(typeof module2 === "undefined" || module2, exports); + } +}); + +// node_modules/@ethersproject/logger/lib.esm/_version.js +var version2; +var init_version = __esm({ + "node_modules/@ethersproject/logger/lib.esm/_version.js"() { + init_shim(); + version2 = "logger/5.7.0"; + } +}); + +// node_modules/@ethersproject/logger/lib.esm/index.js +var lib_exports = {}; +__export(lib_exports, { + ErrorCode: () => ErrorCode, + LogLevel: () => LogLevel2, + Logger: () => Logger +}); +function _checkNormalize() { + try { + const missing = []; + ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => { + try { + if ("test".normalize(form) !== "test") { + throw new Error("bad normalize"); + } + ; + } catch (error) { + missing.push(form); + } + }); + if (missing.length) { + throw new Error("missing " + missing.join(", ")); + } + if (String.fromCharCode(233).normalize("NFD") !== String.fromCharCode(101, 769)) { + throw new Error("broken implementation"); + } + } catch (error) { + return error.message; + } + return null; +} +var _permanentCensorErrors, _censorErrors, LogLevels, _logLevel, _globalLogger, _normalizeError, LogLevel2, ErrorCode, HEX, Logger; +var init_lib = __esm({ + "node_modules/@ethersproject/logger/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_version(); + _permanentCensorErrors = false; + _censorErrors = false; + LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 }; + _logLevel = LogLevels["default"]; + _globalLogger = null; + _normalizeError = _checkNormalize(); + (function(LogLevel3) { + LogLevel3["DEBUG"] = "DEBUG"; + LogLevel3["INFO"] = "INFO"; + LogLevel3["WARNING"] = "WARNING"; + LogLevel3["ERROR"] = "ERROR"; + LogLevel3["OFF"] = "OFF"; + })(LogLevel2 || (LogLevel2 = {})); + (function(ErrorCode2) { + ErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; + ErrorCode2["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; + ErrorCode2["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; + ErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR"; + ErrorCode2["SERVER_ERROR"] = "SERVER_ERROR"; + ErrorCode2["TIMEOUT"] = "TIMEOUT"; + ErrorCode2["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; + ErrorCode2["NUMERIC_FAULT"] = "NUMERIC_FAULT"; + ErrorCode2["MISSING_NEW"] = "MISSING_NEW"; + ErrorCode2["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; + ErrorCode2["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; + ErrorCode2["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; + ErrorCode2["CALL_EXCEPTION"] = "CALL_EXCEPTION"; + ErrorCode2["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; + ErrorCode2["NONCE_EXPIRED"] = "NONCE_EXPIRED"; + ErrorCode2["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; + ErrorCode2["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT"; + ErrorCode2["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; + ErrorCode2["ACTION_REJECTED"] = "ACTION_REJECTED"; + })(ErrorCode || (ErrorCode = {})); + HEX = "0123456789abcdef"; + Logger = class { + constructor(version28) { + Object.defineProperty(this, "version", { + enumerable: true, + value: version28, + writable: false + }); + } + _log(logLevel, args) { + const level = logLevel.toLowerCase(); + if (LogLevels[level] == null) { + this.throwArgumentError("invalid log level name", "logLevel", logLevel); + } + if (_logLevel > LogLevels[level]) { + return; + } + console.log.apply(console, args); + } + debug(...args) { + this._log(Logger.levels.DEBUG, args); + } + info(...args) { + this._log(Logger.levels.INFO, args); + } + warn(...args) { + this._log(Logger.levels.WARNING, args); + } + makeError(message, code9, params) { + if (_censorErrors) { + return this.makeError("censored error", code9, {}); + } + if (!code9) { + code9 = Logger.errors.UNKNOWN_ERROR; + } + if (!params) { + params = {}; + } + const messageDetails = []; + Object.keys(params).forEach((key2) => { + const value = params[key2]; + try { + if (value instanceof Uint8Array) { + let hex = ""; + for (let i2 = 0; i2 < value.length; i2++) { + hex += HEX[value[i2] >> 4]; + hex += HEX[value[i2] & 15]; + } + messageDetails.push(key2 + "=Uint8Array(0x" + hex + ")"); + } else { + messageDetails.push(key2 + "=" + JSON.stringify(value)); + } + } catch (error2) { + messageDetails.push(key2 + "=" + JSON.stringify(params[key2].toString())); + } + }); + messageDetails.push(`code=${code9}`); + messageDetails.push(`version=${this.version}`); + const reason = message; + let url = ""; + switch (code9) { + case ErrorCode.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode.CALL_EXCEPTION: + case ErrorCode.INSUFFICIENT_FUNDS: + case ErrorCode.MISSING_NEW: + case ErrorCode.NONCE_EXPIRED: + case ErrorCode.REPLACEMENT_UNDERPRICED: + case ErrorCode.TRANSACTION_REPLACED: + case ErrorCode.UNPREDICTABLE_GAS_LIMIT: + url = code9; + break; + } + if (url) { + message += " [ See: https://links.ethers.org/v5-errors-" + url + " ]"; + } + if (messageDetails.length) { + message += " (" + messageDetails.join(", ") + ")"; + } + const error = new Error(message); + error.reason = reason; + error.code = code9; + Object.keys(params).forEach(function(key2) { + error[key2] = params[key2]; + }); + return error; + } + throwError(message, code9, params) { + throw this.makeError(message, code9, params); + } + throwArgumentError(message, name, value) { + return this.throwError(message, Logger.errors.INVALID_ARGUMENT, { + argument: name, + value + }); + } + assert(condition, message, code9, params) { + if (!!condition) { + return; + } + this.throwError(message, code9, params); + } + assertArgument(condition, message, name, value) { + if (!!condition) { + return; + } + this.throwArgumentError(message, name, value); + } + checkNormalize(message) { + if (message == null) { + message = "platform missing String.prototype.normalize"; + } + if (_normalizeError) { + this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "String.prototype.normalize", + form: _normalizeError + }); + } + } + checkSafeUint53(value, message) { + if (typeof value !== "number") { + return; + } + if (message == null) { + message = "value not safe"; + } + if (value < 0 || value >= 9007199254740991) { + this.throwError(message, Logger.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "out-of-safe-range", + value + }); + } + if (value % 1) { + this.throwError(message, Logger.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "non-integer", + value + }); + } + } + checkArgumentCount(count, expectedCount, message) { + if (message) { + message = ": " + message; + } else { + message = ""; + } + if (count < expectedCount) { + this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, { + count, + expectedCount + }); + } + if (count > expectedCount) { + this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, { + count, + expectedCount + }); + } + } + checkNew(target, kind) { + if (target === Object || target == null) { + this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name }); + } + } + checkAbstract(target, kind) { + if (target === kind) { + this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); + } else if (target === Object || target == null) { + this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name }); + } + } + static globalLogger() { + if (!_globalLogger) { + _globalLogger = new Logger(version2); + } + return _globalLogger; + } + static setCensorship(censorship, permanent) { + if (!censorship && permanent) { + this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + if (_permanentCensorErrors) { + if (!censorship) { + return; + } + this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + _censorErrors = !!censorship; + _permanentCensorErrors = !!permanent; + } + static setLogLevel(logLevel) { + const level = LogLevels[logLevel.toLowerCase()]; + if (level == null) { + Logger.globalLogger().warn("invalid log level - " + logLevel); + return; + } + _logLevel = level; + } + static from(version28) { + return new Logger(version28); + } + }; + Logger.errors = ErrorCode; + Logger.levels = LogLevel2; + } +}); + +// node_modules/@ethersproject/bytes/lib.esm/_version.js +var version3; +var init_version2 = __esm({ + "node_modules/@ethersproject/bytes/lib.esm/_version.js"() { + init_shim(); + version3 = "bytes/5.7.0"; + } +}); + +// node_modules/@ethersproject/bytes/lib.esm/index.js +var lib_exports2 = {}; +__export(lib_exports2, { + arrayify: () => arrayify, + concat: () => concat, + hexConcat: () => hexConcat, + hexDataLength: () => hexDataLength, + hexDataSlice: () => hexDataSlice, + hexStripZeros: () => hexStripZeros, + hexValue: () => hexValue, + hexZeroPad: () => hexZeroPad, + hexlify: () => hexlify, + isBytes: () => isBytes, + isBytesLike: () => isBytesLike, + isHexString: () => isHexString, + joinSignature: () => joinSignature, + splitSignature: () => splitSignature, + stripZeros: () => stripZeros, + zeroPad: () => zeroPad +}); +function isHexable(value) { + return !!value.toHexString; +} +function addSlice(array) { + if (array.slice) { + return array; + } + array.slice = function() { + const args = Array.prototype.slice.call(arguments); + return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args))); + }; + return array; +} +function isBytesLike(value) { + return isHexString(value) && !(value.length % 2) || isBytes(value); +} +function isInteger(value) { + return typeof value === "number" && value == value && value % 1 === 0; +} +function isBytes(value) { + if (value == null) { + return false; + } + if (value.constructor === Uint8Array) { + return true; + } + if (typeof value === "string") { + return false; + } + if (!isInteger(value.length) || value.length < 0) { + return false; + } + for (let i2 = 0; i2 < value.length; i2++) { + const v = value[i2]; + if (!isInteger(v) || v < 0 || v >= 256) { + return false; + } + } + return true; +} +function arrayify(value, options) { + if (!options) { + options = {}; + } + if (typeof value === "number") { + logger.checkSafeUint53(value, "invalid arrayify value"); + const result = []; + while (value) { + result.unshift(value & 255); + value = parseInt(String(value / 256)); + } + if (result.length === 0) { + result.push(0); + } + return addSlice(new Uint8Array(result)); + } + if (options.allowMissingPrefix && typeof value === "string" && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if (isHexable(value)) { + value = value.toHexString(); + } + if (isHexString(value)) { + let hex = value.substring(2); + if (hex.length % 2) { + if (options.hexPad === "left") { + hex = "0" + hex; + } else if (options.hexPad === "right") { + hex += "0"; + } else { + logger.throwArgumentError("hex data is odd-length", "value", value); + } + } + const result = []; + for (let i2 = 0; i2 < hex.length; i2 += 2) { + result.push(parseInt(hex.substring(i2, i2 + 2), 16)); + } + return addSlice(new Uint8Array(result)); + } + if (isBytes(value)) { + return addSlice(new Uint8Array(value)); + } + return logger.throwArgumentError("invalid arrayify value", "value", value); +} +function concat(items) { + const objects = items.map((item) => arrayify(item)); + const length = objects.reduce((accum, item) => accum + item.length, 0); + const result = new Uint8Array(length); + objects.reduce((offset, object) => { + result.set(object, offset); + return offset + object.length; + }, 0); + return addSlice(result); +} +function stripZeros(value) { + let result = arrayify(value); + if (result.length === 0) { + return result; + } + let start = 0; + while (start < result.length && result[start] === 0) { + start++; + } + if (start) { + result = result.slice(start); + } + return result; +} +function zeroPad(value, length) { + value = arrayify(value); + if (value.length > length) { + logger.throwArgumentError("value out of range", "value", arguments[0]); + } + const result = new Uint8Array(length); + result.set(value, length - value.length); + return addSlice(result); +} +function isHexString(value, length) { + if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + if (length && value.length !== 2 + 2 * length) { + return false; + } + return true; +} +function hexlify(value, options) { + if (!options) { + options = {}; + } + if (typeof value === "number") { + logger.checkSafeUint53(value, "invalid hexlify value"); + let hex = ""; + while (value) { + hex = HexCharacters[value & 15] + hex; + value = Math.floor(value / 16); + } + if (hex.length) { + if (hex.length % 2) { + hex = "0" + hex; + } + return "0x" + hex; + } + return "0x00"; + } + if (typeof value === "bigint") { + value = value.toString(16); + if (value.length % 2) { + return "0x0" + value; + } + return "0x" + value; + } + if (options.allowMissingPrefix && typeof value === "string" && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if (isHexable(value)) { + return value.toHexString(); + } + if (isHexString(value)) { + if (value.length % 2) { + if (options.hexPad === "left") { + value = "0x0" + value.substring(2); + } else if (options.hexPad === "right") { + value += "0"; + } else { + logger.throwArgumentError("hex data is odd-length", "value", value); + } + } + return value.toLowerCase(); + } + if (isBytes(value)) { + let result = "0x"; + for (let i2 = 0; i2 < value.length; i2++) { + let v = value[i2]; + result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15]; + } + return result; + } + return logger.throwArgumentError("invalid hexlify value", "value", value); +} +function hexDataLength(data) { + if (typeof data !== "string") { + data = hexlify(data); + } else if (!isHexString(data) || data.length % 2) { + return null; + } + return (data.length - 2) / 2; +} +function hexDataSlice(data, offset, endOffset) { + if (typeof data !== "string") { + data = hexlify(data); + } else if (!isHexString(data) || data.length % 2) { + logger.throwArgumentError("invalid hexData", "value", data); + } + offset = 2 + 2 * offset; + if (endOffset != null) { + return "0x" + data.substring(offset, 2 + 2 * endOffset); + } + return "0x" + data.substring(offset); +} +function hexConcat(items) { + let result = "0x"; + items.forEach((item) => { + result += hexlify(item).substring(2); + }); + return result; +} +function hexValue(value) { + const trimmed = hexStripZeros(hexlify(value, { hexPad: "left" })); + if (trimmed === "0x") { + return "0x0"; + } + return trimmed; +} +function hexStripZeros(value) { + if (typeof value !== "string") { + value = hexlify(value); + } + if (!isHexString(value)) { + logger.throwArgumentError("invalid hex string", "value", value); + } + value = value.substring(2); + let offset = 0; + while (offset < value.length && value[offset] === "0") { + offset++; + } + return "0x" + value.substring(offset); +} +function hexZeroPad(value, length) { + if (typeof value !== "string") { + value = hexlify(value); + } else if (!isHexString(value)) { + logger.throwArgumentError("invalid hex string", "value", value); + } + if (value.length > 2 * length + 2) { + logger.throwArgumentError("value out of range", "value", arguments[1]); + } + while (value.length < 2 * length + 2) { + value = "0x0" + value.substring(2); + } + return value; +} +function splitSignature(signature2) { + const result = { + r: "0x", + s: "0x", + _vs: "0x", + recoveryParam: 0, + v: 0, + yParityAndS: "0x", + compact: "0x" + }; + if (isBytesLike(signature2)) { + let bytes = arrayify(signature2); + if (bytes.length === 64) { + result.v = 27 + (bytes[32] >> 7); + bytes[32] &= 127; + result.r = hexlify(bytes.slice(0, 32)); + result.s = hexlify(bytes.slice(32, 64)); + } else if (bytes.length === 65) { + result.r = hexlify(bytes.slice(0, 32)); + result.s = hexlify(bytes.slice(32, 64)); + result.v = bytes[64]; + } else { + logger.throwArgumentError("invalid signature string", "signature", signature2); + } + if (result.v < 27) { + if (result.v === 0 || result.v === 1) { + result.v += 27; + } else { + logger.throwArgumentError("signature invalid v byte", "signature", signature2); + } + } + result.recoveryParam = 1 - result.v % 2; + if (result.recoveryParam) { + bytes[32] |= 128; + } + result._vs = hexlify(bytes.slice(32, 64)); + } else { + result.r = signature2.r; + result.s = signature2.s; + result.v = signature2.v; + result.recoveryParam = signature2.recoveryParam; + result._vs = signature2._vs; + if (result._vs != null) { + const vs2 = zeroPad(arrayify(result._vs), 32); + result._vs = hexlify(vs2); + const recoveryParam = vs2[0] >= 128 ? 1 : 0; + if (result.recoveryParam == null) { + result.recoveryParam = recoveryParam; + } else if (result.recoveryParam !== recoveryParam) { + logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature2); + } + vs2[0] &= 127; + const s2 = hexlify(vs2); + if (result.s == null) { + result.s = s2; + } else if (result.s !== s2) { + logger.throwArgumentError("signature v mismatch _vs", "signature", signature2); + } + } + if (result.recoveryParam == null) { + if (result.v == null) { + logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature2); + } else if (result.v === 0 || result.v === 1) { + result.recoveryParam = result.v; + } else { + result.recoveryParam = 1 - result.v % 2; + } + } else { + if (result.v == null) { + result.v = 27 + result.recoveryParam; + } else { + const recId = result.v === 0 || result.v === 1 ? result.v : 1 - result.v % 2; + if (result.recoveryParam !== recId) { + logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature2); + } + } + } + if (result.r == null || !isHexString(result.r)) { + logger.throwArgumentError("signature missing or invalid r", "signature", signature2); + } else { + result.r = hexZeroPad(result.r, 32); + } + if (result.s == null || !isHexString(result.s)) { + logger.throwArgumentError("signature missing or invalid s", "signature", signature2); + } else { + result.s = hexZeroPad(result.s, 32); + } + const vs = arrayify(result.s); + if (vs[0] >= 128) { + logger.throwArgumentError("signature s out of range", "signature", signature2); + } + if (result.recoveryParam) { + vs[0] |= 128; + } + const _vs = hexlify(vs); + if (result._vs) { + if (!isHexString(result._vs)) { + logger.throwArgumentError("signature invalid _vs", "signature", signature2); + } + result._vs = hexZeroPad(result._vs, 32); + } + if (result._vs == null) { + result._vs = _vs; + } else if (result._vs !== _vs) { + logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature2); + } + } + result.yParityAndS = result._vs; + result.compact = result.r + result.yParityAndS.substring(2); + return result; +} +function joinSignature(signature2) { + signature2 = splitSignature(signature2); + return hexlify(concat([ + signature2.r, + signature2.s, + signature2.recoveryParam ? "0x1c" : "0x1b" + ])); +} +var logger, HexCharacters; +var init_lib2 = __esm({ + "node_modules/@ethersproject/bytes/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib(); + init_version2(); + logger = new Logger(version3); + HexCharacters = "0123456789abcdef"; + } +}); + +// node_modules/@ethersproject/bignumber/lib.esm/_version.js +var version4; +var init_version3 = __esm({ + "node_modules/@ethersproject/bignumber/lib.esm/_version.js"() { + init_shim(); + version4 = "bignumber/5.7.0"; + } +}); + +// node_modules/@ethersproject/bignumber/lib.esm/bignumber.js +function isBigNumberish(value) { + return value != null && (BigNumber.isBigNumber(value) || typeof value === "number" && value % 1 === 0 || typeof value === "string" && !!value.match(/^-?[0-9]+$/) || isHexString(value) || typeof value === "bigint" || isBytes(value)); +} +function toHex(value) { + if (typeof value !== "string") { + return toHex(value.toString(16)); + } + if (value[0] === "-") { + value = value.substring(1); + if (value[0] === "-") { + logger2.throwArgumentError("invalid hex", "value", value); + } + value = toHex(value); + if (value === "0x00") { + return value; + } + return "-" + value; + } + if (value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if (value === "0x") { + return "0x00"; + } + if (value.length % 2) { + value = "0x0" + value.substring(2); + } + while (value.length > 4 && value.substring(0, 4) === "0x00") { + value = "0x" + value.substring(4); + } + return value; +} +function toBigNumber(value) { + return BigNumber.from(toHex(value)); +} +function toBN(value) { + const hex = BigNumber.from(value).toHexString(); + if (hex[0] === "-") { + return new BN("-" + hex.substring(3), 16); + } + return new BN(hex.substring(2), 16); +} +function throwFault(fault, operation, value) { + const params = { fault, operation }; + if (value != null) { + params.value = value; + } + return logger2.throwError(fault, Logger.errors.NUMERIC_FAULT, params); +} +function _base36To16(value) { + return new BN(value, 36).toString(16); +} +function _base16To36(value) { + return new BN(value, 16).toString(36); +} +var import_bn, BN, logger2, _constructorGuard, MAX_SAFE, _warnedToStringRadix, BigNumber; +var init_bignumber = __esm({ + "node_modules/@ethersproject/bignumber/lib.esm/bignumber.js"() { + "use strict"; + init_shim(); + import_bn = __toESM(require_bn()); + init_lib2(); + init_lib(); + init_version3(); + BN = import_bn.default.BN; + logger2 = new Logger(version4); + _constructorGuard = {}; + MAX_SAFE = 9007199254740991; + _warnedToStringRadix = false; + BigNumber = class { + constructor(constructorGuard, hex) { + if (constructorGuard !== _constructorGuard) { + logger2.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new (BigNumber)" + }); + } + this._hex = hex; + this._isBigNumber = true; + Object.freeze(this); + } + fromTwos(value) { + return toBigNumber(toBN(this).fromTwos(value)); + } + toTwos(value) { + return toBigNumber(toBN(this).toTwos(value)); + } + abs() { + if (this._hex[0] === "-") { + return BigNumber.from(this._hex.substring(1)); + } + return this; + } + add(other) { + return toBigNumber(toBN(this).add(toBN(other))); + } + sub(other) { + return toBigNumber(toBN(this).sub(toBN(other))); + } + div(other) { + const o2 = BigNumber.from(other); + if (o2.isZero()) { + throwFault("division-by-zero", "div"); + } + return toBigNumber(toBN(this).div(toBN(other))); + } + mul(other) { + return toBigNumber(toBN(this).mul(toBN(other))); + } + mod(other) { + const value = toBN(other); + if (value.isNeg()) { + throwFault("division-by-zero", "mod"); + } + return toBigNumber(toBN(this).umod(value)); + } + pow(other) { + const value = toBN(other); + if (value.isNeg()) { + throwFault("negative-power", "pow"); + } + return toBigNumber(toBN(this).pow(value)); + } + and(other) { + const value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("unbound-bitwise-result", "and"); + } + return toBigNumber(toBN(this).and(value)); + } + or(other) { + const value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("unbound-bitwise-result", "or"); + } + return toBigNumber(toBN(this).or(value)); + } + xor(other) { + const value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("unbound-bitwise-result", "xor"); + } + return toBigNumber(toBN(this).xor(value)); + } + mask(value) { + if (this.isNegative() || value < 0) { + throwFault("negative-width", "mask"); + } + return toBigNumber(toBN(this).maskn(value)); + } + shl(value) { + if (this.isNegative() || value < 0) { + throwFault("negative-width", "shl"); + } + return toBigNumber(toBN(this).shln(value)); + } + shr(value) { + if (this.isNegative() || value < 0) { + throwFault("negative-width", "shr"); + } + return toBigNumber(toBN(this).shrn(value)); + } + eq(other) { + return toBN(this).eq(toBN(other)); + } + lt(other) { + return toBN(this).lt(toBN(other)); + } + lte(other) { + return toBN(this).lte(toBN(other)); + } + gt(other) { + return toBN(this).gt(toBN(other)); + } + gte(other) { + return toBN(this).gte(toBN(other)); + } + isNegative() { + return this._hex[0] === "-"; + } + isZero() { + return toBN(this).isZero(); + } + toNumber() { + try { + return toBN(this).toNumber(); + } catch (error) { + throwFault("overflow", "toNumber", this.toString()); + } + return null; + } + toBigInt() { + try { + return BigInt(this.toString()); + } catch (e2) { + } + return logger2.throwError("this platform does not support BigInt", Logger.errors.UNSUPPORTED_OPERATION, { + value: this.toString() + }); + } + toString() { + if (arguments.length > 0) { + if (arguments[0] === 10) { + if (!_warnedToStringRadix) { + _warnedToStringRadix = true; + logger2.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); + } + } else if (arguments[0] === 16) { + logger2.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger.errors.UNEXPECTED_ARGUMENT, {}); + } else { + logger2.throwError("BigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {}); + } + } + return toBN(this).toString(10); + } + toHexString() { + return this._hex; + } + toJSON(key2) { + return { type: "BigNumber", hex: this.toHexString() }; + } + static from(value) { + if (value instanceof BigNumber) { + return value; + } + if (typeof value === "string") { + if (value.match(/^-?0x[0-9a-f]+$/i)) { + return new BigNumber(_constructorGuard, toHex(value)); + } + if (value.match(/^-?[0-9]+$/)) { + return new BigNumber(_constructorGuard, toHex(new BN(value))); + } + return logger2.throwArgumentError("invalid BigNumber string", "value", value); + } + if (typeof value === "number") { + if (value % 1) { + throwFault("underflow", "BigNumber.from", value); + } + if (value >= MAX_SAFE || value <= -MAX_SAFE) { + throwFault("overflow", "BigNumber.from", value); + } + return BigNumber.from(String(value)); + } + const anyValue = value; + if (typeof anyValue === "bigint") { + return BigNumber.from(anyValue.toString()); + } + if (isBytes(anyValue)) { + return BigNumber.from(hexlify(anyValue)); + } + if (anyValue) { + if (anyValue.toHexString) { + const hex = anyValue.toHexString(); + if (typeof hex === "string") { + return BigNumber.from(hex); + } + } else { + let hex = anyValue._hex; + if (hex == null && anyValue.type === "BigNumber") { + hex = anyValue.hex; + } + if (typeof hex === "string") { + if (isHexString(hex) || hex[0] === "-" && isHexString(hex.substring(1))) { + return BigNumber.from(hex); + } + } + } + } + return logger2.throwArgumentError("invalid BigNumber value", "value", value); + } + static isBigNumber(value) { + return !!(value && value._isBigNumber); + } + }; + } +}); + +// node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js +function throwFault2(message, fault, operation, value) { + const params = { fault, operation }; + if (value !== void 0) { + params.value = value; + } + return logger3.throwError(message, Logger.errors.NUMERIC_FAULT, params); +} +function getMultiplier(decimals) { + if (typeof decimals !== "number") { + try { + decimals = BigNumber.from(decimals).toNumber(); + } catch (e2) { + } + } + if (typeof decimals === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) { + return "1" + zeros.substring(0, decimals); + } + return logger3.throwArgumentError("invalid decimal size", "decimals", decimals); +} +function formatFixed(value, decimals) { + if (decimals == null) { + decimals = 0; + } + const multiplier = getMultiplier(decimals); + value = BigNumber.from(value); + const negative = value.lt(Zero); + if (negative) { + value = value.mul(NegativeOne); + } + let fraction = value.mod(multiplier).toString(); + while (fraction.length < multiplier.length - 1) { + fraction = "0" + fraction; + } + fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1]; + const whole = value.div(multiplier).toString(); + if (multiplier.length === 1) { + value = whole; + } else { + value = whole + "." + fraction; + } + if (negative) { + value = "-" + value; + } + return value; +} +function parseFixed(value, decimals) { + if (decimals == null) { + decimals = 0; + } + const multiplier = getMultiplier(decimals); + if (typeof value !== "string" || !value.match(/^-?[0-9.]+$/)) { + logger3.throwArgumentError("invalid decimal value", "value", value); + } + const negative = value.substring(0, 1) === "-"; + if (negative) { + value = value.substring(1); + } + if (value === ".") { + logger3.throwArgumentError("missing value", "value", value); + } + const comps = value.split("."); + if (comps.length > 2) { + logger3.throwArgumentError("too many decimal points", "value", value); + } + let whole = comps[0], fraction = comps[1]; + if (!whole) { + whole = "0"; + } + if (!fraction) { + fraction = "0"; + } + while (fraction[fraction.length - 1] === "0") { + fraction = fraction.substring(0, fraction.length - 1); + } + if (fraction.length > multiplier.length - 1) { + throwFault2("fractional component exceeds decimals", "underflow", "parseFixed"); + } + if (fraction === "") { + fraction = "0"; + } + while (fraction.length < multiplier.length - 1) { + fraction += "0"; + } + const wholeValue = BigNumber.from(whole); + const fractionValue = BigNumber.from(fraction); + let wei = wholeValue.mul(multiplier).add(fractionValue); + if (negative) { + wei = wei.mul(NegativeOne); + } + return wei; +} +var logger3, _constructorGuard2, Zero, NegativeOne, zeros, FixedFormat, FixedNumber, ONE, BUMP; +var init_fixednumber = __esm({ + "node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_lib(); + init_version3(); + init_bignumber(); + logger3 = new Logger(version4); + _constructorGuard2 = {}; + Zero = BigNumber.from(0); + NegativeOne = BigNumber.from(-1); + zeros = "0"; + while (zeros.length < 256) { + zeros += zeros; + } + FixedFormat = class { + constructor(constructorGuard, signed2, width, decimals) { + if (constructorGuard !== _constructorGuard2) { + logger3.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new FixedFormat" + }); + } + this.signed = signed2; + this.width = width; + this.decimals = decimals; + this.name = (signed2 ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); + this._multiplier = getMultiplier(decimals); + Object.freeze(this); + } + static from(value) { + if (value instanceof FixedFormat) { + return value; + } + if (typeof value === "number") { + value = `fixed128x${value}`; + } + let signed2 = true; + let width = 128; + let decimals = 18; + if (typeof value === "string") { + if (value === "fixed") { + } else if (value === "ufixed") { + signed2 = false; + } else { + const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); + if (!match) { + logger3.throwArgumentError("invalid fixed format", "format", value); + } + signed2 = match[1] !== "u"; + width = parseInt(match[2]); + decimals = parseInt(match[3]); + } + } else if (value) { + const check = (key2, type, defaultValue) => { + if (value[key2] == null) { + return defaultValue; + } + if (typeof value[key2] !== type) { + logger3.throwArgumentError("invalid fixed format (" + key2 + " not " + type + ")", "format." + key2, value[key2]); + } + return value[key2]; + }; + signed2 = check("signed", "boolean", signed2); + width = check("width", "number", width); + decimals = check("decimals", "number", decimals); + } + if (width % 8) { + logger3.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width); + } + if (decimals > 80) { + logger3.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); + } + return new FixedFormat(_constructorGuard2, signed2, width, decimals); + } + }; + FixedNumber = class { + constructor(constructorGuard, hex, value, format) { + if (constructorGuard !== _constructorGuard2) { + logger3.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new FixedFormat" + }); + } + this.format = format; + this._hex = hex; + this._value = value; + this._isFixedNumber = true; + Object.freeze(this); + } + _checkFormat(other) { + if (this.format.name !== other.format.name) { + logger3.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other); + } + } + addUnsafe(other) { + this._checkFormat(other); + const a2 = parseFixed(this._value, this.format.decimals); + const b = parseFixed(other._value, other.format.decimals); + return FixedNumber.fromValue(a2.add(b), this.format.decimals, this.format); + } + subUnsafe(other) { + this._checkFormat(other); + const a2 = parseFixed(this._value, this.format.decimals); + const b = parseFixed(other._value, other.format.decimals); + return FixedNumber.fromValue(a2.sub(b), this.format.decimals, this.format); + } + mulUnsafe(other) { + this._checkFormat(other); + const a2 = parseFixed(this._value, this.format.decimals); + const b = parseFixed(other._value, other.format.decimals); + return FixedNumber.fromValue(a2.mul(b).div(this.format._multiplier), this.format.decimals, this.format); + } + divUnsafe(other) { + this._checkFormat(other); + const a2 = parseFixed(this._value, this.format.decimals); + const b = parseFixed(other._value, other.format.decimals); + return FixedNumber.fromValue(a2.mul(this.format._multiplier).div(b), this.format.decimals, this.format); + } + floor() { + const comps = this.toString().split("."); + if (comps.length === 1) { + comps.push("0"); + } + let result = FixedNumber.from(comps[0], this.format); + const hasFraction = !comps[1].match(/^(0*)$/); + if (this.isNegative() && hasFraction) { + result = result.subUnsafe(ONE.toFormat(result.format)); + } + return result; + } + ceiling() { + const comps = this.toString().split("."); + if (comps.length === 1) { + comps.push("0"); + } + let result = FixedNumber.from(comps[0], this.format); + const hasFraction = !comps[1].match(/^(0*)$/); + if (!this.isNegative() && hasFraction) { + result = result.addUnsafe(ONE.toFormat(result.format)); + } + return result; + } + // @TODO: Support other rounding algorithms + round(decimals) { + if (decimals == null) { + decimals = 0; + } + const comps = this.toString().split("."); + if (comps.length === 1) { + comps.push("0"); + } + if (decimals < 0 || decimals > 80 || decimals % 1) { + logger3.throwArgumentError("invalid decimal count", "decimals", decimals); + } + if (comps[1].length <= decimals) { + return this; + } + const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format); + const bump = BUMP.toFormat(this.format); + return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor); + } + isZero() { + return this._value === "0.0" || this._value === "0"; + } + isNegative() { + return this._value[0] === "-"; + } + toString() { + return this._value; + } + toHexString(width) { + if (width == null) { + return this._hex; + } + if (width % 8) { + logger3.throwArgumentError("invalid byte width", "width", width); + } + const hex = BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); + return hexZeroPad(hex, width / 8); + } + toUnsafeFloat() { + return parseFloat(this.toString()); + } + toFormat(format) { + return FixedNumber.fromString(this._value, format); + } + static fromValue(value, decimals, format) { + if (format == null && decimals != null && !isBigNumberish(decimals)) { + format = decimals; + decimals = null; + } + if (decimals == null) { + decimals = 0; + } + if (format == null) { + format = "fixed"; + } + return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format)); + } + static fromString(value, format) { + if (format == null) { + format = "fixed"; + } + const fixedFormat = FixedFormat.from(format); + const numeric = parseFixed(value, fixedFormat.decimals); + if (!fixedFormat.signed && numeric.lt(Zero)) { + throwFault2("unsigned value cannot be negative", "overflow", "value", value); + } + let hex = null; + if (fixedFormat.signed) { + hex = numeric.toTwos(fixedFormat.width).toHexString(); + } else { + hex = numeric.toHexString(); + hex = hexZeroPad(hex, fixedFormat.width / 8); + } + const decimal = formatFixed(numeric, fixedFormat.decimals); + return new FixedNumber(_constructorGuard2, hex, decimal, fixedFormat); + } + static fromBytes(value, format) { + if (format == null) { + format = "fixed"; + } + const fixedFormat = FixedFormat.from(format); + if (arrayify(value).length > fixedFormat.width / 8) { + throw new Error("overflow"); + } + let numeric = BigNumber.from(value); + if (fixedFormat.signed) { + numeric = numeric.fromTwos(fixedFormat.width); + } + const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); + const decimal = formatFixed(numeric, fixedFormat.decimals); + return new FixedNumber(_constructorGuard2, hex, decimal, fixedFormat); + } + static from(value, format) { + if (typeof value === "string") { + return FixedNumber.fromString(value, format); + } + if (isBytes(value)) { + return FixedNumber.fromBytes(value, format); + } + try { + return FixedNumber.fromValue(value, 0, format); + } catch (error) { + if (error.code !== Logger.errors.INVALID_ARGUMENT) { + throw error; + } + } + return logger3.throwArgumentError("invalid FixedNumber value", "value", value); + } + static isFixedNumber(value) { + return !!(value && value._isFixedNumber); + } + }; + ONE = FixedNumber.from(1); + BUMP = FixedNumber.from("0.5"); + } +}); + +// node_modules/@ethersproject/bignumber/lib.esm/index.js +var init_lib3 = __esm({ + "node_modules/@ethersproject/bignumber/lib.esm/index.js"() { + init_shim(); + init_bignumber(); + init_fixednumber(); + init_bignumber(); + } +}); + +// node_modules/@ethersproject/properties/lib.esm/_version.js +var version5; +var init_version4 = __esm({ + "node_modules/@ethersproject/properties/lib.esm/_version.js"() { + init_shim(); + version5 = "properties/5.7.0"; + } +}); + +// node_modules/@ethersproject/properties/lib.esm/index.js +var lib_exports3 = {}; +__export(lib_exports3, { + Description: () => Description, + checkProperties: () => checkProperties, + deepCopy: () => deepCopy, + defineReadOnly: () => defineReadOnly, + getStatic: () => getStatic, + resolveProperties: () => resolveProperties, + shallowCopy: () => shallowCopy +}); +function defineReadOnly(object, name, value) { + Object.defineProperty(object, name, { + enumerable: true, + value, + writable: false + }); +} +function getStatic(ctor, key2) { + for (let i2 = 0; i2 < 32; i2++) { + if (ctor[key2]) { + return ctor[key2]; + } + if (!ctor.prototype || typeof ctor.prototype !== "object") { + break; + } + ctor = Object.getPrototypeOf(ctor.prototype).constructor; + } + return null; +} +function resolveProperties(object) { + return __awaiter(this, void 0, void 0, function* () { + const promises = Object.keys(object).map((key2) => { + const value = object[key2]; + return Promise.resolve(value).then((v) => ({ key: key2, value: v })); + }); + const results = yield Promise.all(promises); + return results.reduce((accum, result) => { + accum[result.key] = result.value; + return accum; + }, {}); + }); +} +function checkProperties(object, properties) { + if (!object || typeof object !== "object") { + logger4.throwArgumentError("invalid object", "object", object); + } + Object.keys(object).forEach((key2) => { + if (!properties[key2]) { + logger4.throwArgumentError("invalid object key - " + key2, "transaction:" + key2, object); + } + }); +} +function shallowCopy(object) { + const result = {}; + for (const key2 in object) { + result[key2] = object[key2]; + } + return result; +} +function _isFrozen(object) { + if (object === void 0 || object === null || opaque[typeof object]) { + return true; + } + if (Array.isArray(object) || typeof object === "object") { + if (!Object.isFrozen(object)) { + return false; + } + const keys = Object.keys(object); + for (let i2 = 0; i2 < keys.length; i2++) { + let value = null; + try { + value = object[keys[i2]]; + } catch (error) { + continue; + } + if (!_isFrozen(value)) { + return false; + } + } + return true; + } + return logger4.throwArgumentError(`Cannot deepCopy ${typeof object}`, "object", object); +} +function _deepCopy(object) { + if (_isFrozen(object)) { + return object; + } + if (Array.isArray(object)) { + return Object.freeze(object.map((item) => deepCopy(item))); + } + if (typeof object === "object") { + const result = {}; + for (const key2 in object) { + const value = object[key2]; + if (value === void 0) { + continue; + } + defineReadOnly(result, key2, deepCopy(value)); + } + return result; + } + return logger4.throwArgumentError(`Cannot deepCopy ${typeof object}`, "object", object); +} +function deepCopy(object) { + return _deepCopy(object); +} +var __awaiter, logger4, opaque, Description; +var init_lib4 = __esm({ + "node_modules/@ethersproject/properties/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib(); + init_version4(); + __awaiter = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + logger4 = new Logger(version5); + opaque = { bigint: true, boolean: true, "function": true, number: true, string: true }; + Description = class { + constructor(info) { + for (const key2 in info) { + this[key2] = deepCopy(info[key2]); + } + } + }; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/_version.js +var version6; +var init_version5 = __esm({ + "node_modules/@ethersproject/abi/lib.esm/_version.js"() { + init_shim(); + version6 = "abi/5.7.0"; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/fragments.js +function checkModifier(type, name) { + if (type === "bytes" || type === "string") { + if (ModifiersBytes[name]) { + return true; + } + } else if (type === "address") { + if (name === "payable") { + return true; + } + } else if (type.indexOf("[") >= 0 || type === "tuple") { + if (ModifiersNest[name]) { + return true; + } + } + if (ModifiersBytes[name] || name === "payable") { + logger5.throwArgumentError("invalid modifier", "name", name); + } + return false; +} +function parseParamType(param, allowIndexed) { + let originalParam = param; + function throwError(i2) { + logger5.throwArgumentError(`unexpected character at position ${i2}`, "param", param); + } + param = param.replace(/\s/g, " "); + function newNode(parent2) { + let node2 = { type: "", name: "", parent: parent2, state: { allowType: true } }; + if (allowIndexed) { + node2.indexed = false; + } + return node2; + } + let parent = { type: "", name: "", state: { allowType: true } }; + let node = parent; + for (let i2 = 0; i2 < param.length; i2++) { + let c = param[i2]; + switch (c) { + case "(": + if (node.state.allowType && node.type === "") { + node.type = "tuple"; + } else if (!node.state.allowParams) { + throwError(i2); + } + node.state.allowType = false; + node.type = verifyType(node.type); + node.components = [newNode(node)]; + node = node.components[0]; + break; + case ")": + delete node.state; + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(i2); + } + node.indexed = true; + node.name = ""; + } + if (checkModifier(node.type, node.name)) { + node.name = ""; + } + node.type = verifyType(node.type); + let child = node; + node = node.parent; + if (!node) { + throwError(i2); + } + delete child.parent; + node.state.allowParams = false; + node.state.allowName = true; + node.state.allowArray = true; + break; + case ",": + delete node.state; + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(i2); + } + node.indexed = true; + node.name = ""; + } + if (checkModifier(node.type, node.name)) { + node.name = ""; + } + node.type = verifyType(node.type); + let sibling = newNode(node.parent); + node.parent.components.push(sibling); + delete node.parent; + node = sibling; + break; + case " ": + if (node.state.allowType) { + if (node.type !== "") { + node.type = verifyType(node.type); + delete node.state.allowType; + node.state.allowName = true; + node.state.allowParams = true; + } + } + if (node.state.allowName) { + if (node.name !== "") { + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(i2); + } + if (node.indexed) { + throwError(i2); + } + node.indexed = true; + node.name = ""; + } else if (checkModifier(node.type, node.name)) { + node.name = ""; + } else { + node.state.allowName = false; + } + } + } + break; + case "[": + if (!node.state.allowArray) { + throwError(i2); + } + node.type += c; + node.state.allowArray = false; + node.state.allowName = false; + node.state.readArray = true; + break; + case "]": + if (!node.state.readArray) { + throwError(i2); + } + node.type += c; + node.state.readArray = false; + node.state.allowArray = true; + node.state.allowName = true; + break; + default: + if (node.state.allowType) { + node.type += c; + node.state.allowParams = true; + node.state.allowArray = true; + } else if (node.state.allowName) { + node.name += c; + delete node.state.allowArray; + } else if (node.state.readArray) { + node.type += c; + } else { + throwError(i2); + } + } + } + if (node.parent) { + logger5.throwArgumentError("unexpected eof", "param", param); + } + delete parent.state; + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(originalParam.length - 7); + } + if (node.indexed) { + throwError(originalParam.length - 7); + } + node.indexed = true; + node.name = ""; + } else if (checkModifier(node.type, node.name)) { + node.name = ""; + } + parent.type = verifyType(parent.type); + return parent; +} +function populate(object, params) { + for (let key2 in params) { + defineReadOnly(object, key2, params[key2]); + } +} +function parseParams(value, allowIndex) { + return splitNesting(value).map((param) => ParamType.fromString(param, allowIndex)); +} +function parseGas(value, params) { + params.gas = null; + let comps = value.split("@"); + if (comps.length !== 1) { + if (comps.length > 2) { + logger5.throwArgumentError("invalid human-readable ABI signature", "value", value); + } + if (!comps[1].match(/^[0-9]+$/)) { + logger5.throwArgumentError("invalid human-readable ABI signature gas", "value", value); + } + params.gas = BigNumber.from(comps[1]); + return comps[0]; + } + return value; +} +function parseModifiers(value, params) { + params.constant = false; + params.payable = false; + params.stateMutability = "nonpayable"; + value.split(" ").forEach((modifier) => { + switch (modifier.trim()) { + case "constant": + params.constant = true; + break; + case "payable": + params.payable = true; + params.stateMutability = "payable"; + break; + case "nonpayable": + params.payable = false; + params.stateMutability = "nonpayable"; + break; + case "pure": + params.constant = true; + params.stateMutability = "pure"; + break; + case "view": + params.constant = true; + params.stateMutability = "view"; + break; + case "external": + case "public": + case "": + break; + default: + console.log("unknown modifier: " + modifier); + } + }); +} +function verifyState(value) { + let result = { + constant: false, + payable: true, + stateMutability: "payable" + }; + if (value.stateMutability != null) { + result.stateMutability = value.stateMutability; + result.constant = result.stateMutability === "view" || result.stateMutability === "pure"; + if (value.constant != null) { + if (!!value.constant !== result.constant) { + logger5.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value); + } + } + result.payable = result.stateMutability === "payable"; + if (value.payable != null) { + if (!!value.payable !== result.payable) { + logger5.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value); + } + } + } else if (value.payable != null) { + result.payable = !!value.payable; + if (value.constant == null && !result.payable && value.type !== "constructor") { + logger5.throwArgumentError("unable to determine stateMutability", "value", value); + } + result.constant = !!value.constant; + if (result.constant) { + result.stateMutability = "view"; + } else { + result.stateMutability = result.payable ? "payable" : "nonpayable"; + } + if (result.payable && result.constant) { + logger5.throwArgumentError("cannot have constant payable function", "value", value); + } + } else if (value.constant != null) { + result.constant = !!value.constant; + result.payable = !result.constant; + result.stateMutability = result.constant ? "view" : "payable"; + } else if (value.type !== "constructor") { + logger5.throwArgumentError("unable to determine stateMutability", "value", value); + } + return result; +} +function checkForbidden(fragment) { + const sig = fragment.format(); + if (sig === "Error(string)" || sig === "Panic(uint256)") { + logger5.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment); + } + return fragment; +} +function verifyType(type) { + if (type.match(/^uint($|[^1-9])/)) { + type = "uint256" + type.substring(4); + } else if (type.match(/^int($|[^1-9])/)) { + type = "int256" + type.substring(3); + } + return type; +} +function verifyIdentifier(value) { + if (!value || !value.match(regexIdentifier)) { + logger5.throwArgumentError(`invalid identifier "${value}"`, "value", value); + } + return value; +} +function splitNesting(value) { + value = value.trim(); + let result = []; + let accum = ""; + let depth = 0; + for (let offset = 0; offset < value.length; offset++) { + let c = value[offset]; + if (c === "," && depth === 0) { + result.push(accum); + accum = ""; + } else { + accum += c; + if (c === "(") { + depth++; + } else if (c === ")") { + depth--; + if (depth === -1) { + logger5.throwArgumentError("unbalanced parenthesis", "value", value); + } + } + } + } + if (accum) { + result.push(accum); + } + return result; +} +var logger5, _constructorGuard3, ModifiersBytes, ModifiersNest, FormatTypes, paramTypeArray, ParamType, Fragment, EventFragment, ConstructorFragment, FunctionFragment, ErrorFragment, regexIdentifier, regexParen; +var init_fragments = __esm({ + "node_modules/@ethersproject/abi/lib.esm/fragments.js"() { + "use strict"; + init_shim(); + init_lib3(); + init_lib4(); + init_lib(); + init_version5(); + logger5 = new Logger(version6); + _constructorGuard3 = {}; + ModifiersBytes = { calldata: true, memory: true, storage: true }; + ModifiersNest = { calldata: true, memory: true }; + FormatTypes = Object.freeze({ + // Bare formatting, as is needed for computing a sighash of an event or function + sighash: "sighash", + // Human-Readable with Minimal spacing and without names (compact human-readable) + minimal: "minimal", + // Human-Readable with nice spacing, including all names + full: "full", + // JSON-format a la Solidity + json: "json" + }); + paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/); + ParamType = class { + constructor(constructorGuard, params) { + if (constructorGuard !== _constructorGuard3) { + logger5.throwError("use fromString", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new ParamType()" + }); + } + populate(this, params); + let match = this.type.match(paramTypeArray); + if (match) { + populate(this, { + arrayLength: parseInt(match[2] || "-1"), + arrayChildren: ParamType.fromObject({ + type: match[1], + components: this.components + }), + baseType: "array" + }); + } else { + populate(this, { + arrayLength: null, + arrayChildren: null, + baseType: this.components != null ? "tuple" : this.type + }); + } + this._isParamType = true; + Object.freeze(this); + } + // Format the parameter fragment + // - sighash: "(uint256,address)" + // - minimal: "tuple(uint256,address) indexed" + // - full: "tuple(uint256 foo, address bar) indexed baz" + format(format) { + if (!format) { + format = FormatTypes.sighash; + } + if (!FormatTypes[format]) { + logger5.throwArgumentError("invalid format type", "format", format); + } + if (format === FormatTypes.json) { + let result2 = { + type: this.baseType === "tuple" ? "tuple" : this.type, + name: this.name || void 0 + }; + if (typeof this.indexed === "boolean") { + result2.indexed = this.indexed; + } + if (this.components) { + result2.components = this.components.map((comp) => JSON.parse(comp.format(format))); + } + return JSON.stringify(result2); + } + let result = ""; + if (this.baseType === "array") { + result += this.arrayChildren.format(format); + result += "[" + (this.arrayLength < 0 ? "" : String(this.arrayLength)) + "]"; + } else { + if (this.baseType === "tuple") { + if (format !== FormatTypes.sighash) { + result += this.type; + } + result += "(" + this.components.map((comp) => comp.format(format)).join(format === FormatTypes.full ? ", " : ",") + ")"; + } else { + result += this.type; + } + } + if (format !== FormatTypes.sighash) { + if (this.indexed === true) { + result += " indexed"; + } + if (format === FormatTypes.full && this.name) { + result += " " + this.name; + } + } + return result; + } + static from(value, allowIndexed) { + if (typeof value === "string") { + return ParamType.fromString(value, allowIndexed); + } + return ParamType.fromObject(value); + } + static fromObject(value) { + if (ParamType.isParamType(value)) { + return value; + } + return new ParamType(_constructorGuard3, { + name: value.name || null, + type: verifyType(value.type), + indexed: value.indexed == null ? null : !!value.indexed, + components: value.components ? value.components.map(ParamType.fromObject) : null + }); + } + static fromString(value, allowIndexed) { + function ParamTypify(node) { + return ParamType.fromObject({ + name: node.name, + type: node.type, + indexed: node.indexed, + components: node.components + }); + } + return ParamTypify(parseParamType(value, !!allowIndexed)); + } + static isParamType(value) { + return !!(value != null && value._isParamType); + } + }; + Fragment = class { + constructor(constructorGuard, params) { + if (constructorGuard !== _constructorGuard3) { + logger5.throwError("use a static from method", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new Fragment()" + }); + } + populate(this, params); + this._isFragment = true; + Object.freeze(this); + } + static from(value) { + if (Fragment.isFragment(value)) { + return value; + } + if (typeof value === "string") { + return Fragment.fromString(value); + } + return Fragment.fromObject(value); + } + static fromObject(value) { + if (Fragment.isFragment(value)) { + return value; + } + switch (value.type) { + case "function": + return FunctionFragment.fromObject(value); + case "event": + return EventFragment.fromObject(value); + case "constructor": + return ConstructorFragment.fromObject(value); + case "error": + return ErrorFragment.fromObject(value); + case "fallback": + case "receive": + return null; + } + return logger5.throwArgumentError("invalid fragment object", "value", value); + } + static fromString(value) { + value = value.replace(/\s/g, " "); + value = value.replace(/\(/g, " (").replace(/\)/g, ") ").replace(/\s+/g, " "); + value = value.trim(); + if (value.split(" ")[0] === "event") { + return EventFragment.fromString(value.substring(5).trim()); + } else if (value.split(" ")[0] === "function") { + return FunctionFragment.fromString(value.substring(8).trim()); + } else if (value.split("(")[0].trim() === "constructor") { + return ConstructorFragment.fromString(value.trim()); + } else if (value.split(" ")[0] === "error") { + return ErrorFragment.fromString(value.substring(5).trim()); + } + return logger5.throwArgumentError("unsupported fragment", "value", value); + } + static isFragment(value) { + return !!(value && value._isFragment); + } + }; + EventFragment = class extends Fragment { + format(format) { + if (!format) { + format = FormatTypes.sighash; + } + if (!FormatTypes[format]) { + logger5.throwArgumentError("invalid format type", "format", format); + } + if (format === FormatTypes.json) { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))) + }); + } + let result = ""; + if (format !== FormatTypes.sighash) { + result += "event "; + } + result += this.name + "(" + this.inputs.map((input) => input.format(format)).join(format === FormatTypes.full ? ", " : ",") + ") "; + if (format !== FormatTypes.sighash) { + if (this.anonymous) { + result += "anonymous "; + } + } + return result.trim(); + } + static from(value) { + if (typeof value === "string") { + return EventFragment.fromString(value); + } + return EventFragment.fromObject(value); + } + static fromObject(value) { + if (EventFragment.isEventFragment(value)) { + return value; + } + if (value.type !== "event") { + logger5.throwArgumentError("invalid event object", "value", value); + } + const params = { + name: verifyIdentifier(value.name), + anonymous: value.anonymous, + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [], + type: "event" + }; + return new EventFragment(_constructorGuard3, params); + } + static fromString(value) { + let match = value.match(regexParen); + if (!match) { + logger5.throwArgumentError("invalid event string", "value", value); + } + let anonymous = false; + match[3].split(" ").forEach((modifier) => { + switch (modifier.trim()) { + case "anonymous": + anonymous = true; + break; + case "": + break; + default: + logger5.warn("unknown modifier: " + modifier); + } + }); + return EventFragment.fromObject({ + name: match[1].trim(), + anonymous, + inputs: parseParams(match[2], true), + type: "event" + }); + } + static isEventFragment(value) { + return value && value._isFragment && value.type === "event"; + } + }; + ConstructorFragment = class extends Fragment { + format(format) { + if (!format) { + format = FormatTypes.sighash; + } + if (!FormatTypes[format]) { + logger5.throwArgumentError("invalid format type", "format", format); + } + if (format === FormatTypes.json) { + return JSON.stringify({ + type: "constructor", + stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0, + payable: this.payable, + gas: this.gas ? this.gas.toNumber() : void 0, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))) + }); + } + if (format === FormatTypes.sighash) { + logger5.throwError("cannot format a constructor for sighash", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "format(sighash)" + }); + } + let result = "constructor(" + this.inputs.map((input) => input.format(format)).join(format === FormatTypes.full ? ", " : ",") + ") "; + if (this.stateMutability && this.stateMutability !== "nonpayable") { + result += this.stateMutability + " "; + } + return result.trim(); + } + static from(value) { + if (typeof value === "string") { + return ConstructorFragment.fromString(value); + } + return ConstructorFragment.fromObject(value); + } + static fromObject(value) { + if (ConstructorFragment.isConstructorFragment(value)) { + return value; + } + if (value.type !== "constructor") { + logger5.throwArgumentError("invalid constructor object", "value", value); + } + let state = verifyState(value); + if (state.constant) { + logger5.throwArgumentError("constructor cannot be constant", "value", value); + } + const params = { + name: null, + type: value.type, + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [], + payable: state.payable, + stateMutability: state.stateMutability, + gas: value.gas ? BigNumber.from(value.gas) : null + }; + return new ConstructorFragment(_constructorGuard3, params); + } + static fromString(value) { + let params = { type: "constructor" }; + value = parseGas(value, params); + let parens = value.match(regexParen); + if (!parens || parens[1].trim() !== "constructor") { + logger5.throwArgumentError("invalid constructor string", "value", value); + } + params.inputs = parseParams(parens[2].trim(), false); + parseModifiers(parens[3].trim(), params); + return ConstructorFragment.fromObject(params); + } + static isConstructorFragment(value) { + return value && value._isFragment && value.type === "constructor"; + } + }; + FunctionFragment = class extends ConstructorFragment { + format(format) { + if (!format) { + format = FormatTypes.sighash; + } + if (!FormatTypes[format]) { + logger5.throwArgumentError("invalid format type", "format", format); + } + if (format === FormatTypes.json) { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0, + payable: this.payable, + gas: this.gas ? this.gas.toNumber() : void 0, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + outputs: this.outputs.map((output) => JSON.parse(output.format(format))) + }); + } + let result = ""; + if (format !== FormatTypes.sighash) { + result += "function "; + } + result += this.name + "(" + this.inputs.map((input) => input.format(format)).join(format === FormatTypes.full ? ", " : ",") + ") "; + if (format !== FormatTypes.sighash) { + if (this.stateMutability) { + if (this.stateMutability !== "nonpayable") { + result += this.stateMutability + " "; + } + } else if (this.constant) { + result += "view "; + } + if (this.outputs && this.outputs.length) { + result += "returns (" + this.outputs.map((output) => output.format(format)).join(", ") + ") "; + } + if (this.gas != null) { + result += "@" + this.gas.toString() + " "; + } + } + return result.trim(); + } + static from(value) { + if (typeof value === "string") { + return FunctionFragment.fromString(value); + } + return FunctionFragment.fromObject(value); + } + static fromObject(value) { + if (FunctionFragment.isFunctionFragment(value)) { + return value; + } + if (value.type !== "function") { + logger5.throwArgumentError("invalid function object", "value", value); + } + let state = verifyState(value); + const params = { + type: value.type, + name: verifyIdentifier(value.name), + constant: state.constant, + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [], + outputs: value.outputs ? value.outputs.map(ParamType.fromObject) : [], + payable: state.payable, + stateMutability: state.stateMutability, + gas: value.gas ? BigNumber.from(value.gas) : null + }; + return new FunctionFragment(_constructorGuard3, params); + } + static fromString(value) { + let params = { type: "function" }; + value = parseGas(value, params); + let comps = value.split(" returns "); + if (comps.length > 2) { + logger5.throwArgumentError("invalid function string", "value", value); + } + let parens = comps[0].match(regexParen); + if (!parens) { + logger5.throwArgumentError("invalid function signature", "value", value); + } + params.name = parens[1].trim(); + if (params.name) { + verifyIdentifier(params.name); + } + params.inputs = parseParams(parens[2], false); + parseModifiers(parens[3].trim(), params); + if (comps.length > 1) { + let returns = comps[1].match(regexParen); + if (returns[1].trim() != "" || returns[3].trim() != "") { + logger5.throwArgumentError("unexpected tokens", "value", value); + } + params.outputs = parseParams(returns[2], false); + } else { + params.outputs = []; + } + return FunctionFragment.fromObject(params); + } + static isFunctionFragment(value) { + return value && value._isFragment && value.type === "function"; + } + }; + ErrorFragment = class extends Fragment { + format(format) { + if (!format) { + format = FormatTypes.sighash; + } + if (!FormatTypes[format]) { + logger5.throwArgumentError("invalid format type", "format", format); + } + if (format === FormatTypes.json) { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))) + }); + } + let result = ""; + if (format !== FormatTypes.sighash) { + result += "error "; + } + result += this.name + "(" + this.inputs.map((input) => input.format(format)).join(format === FormatTypes.full ? ", " : ",") + ") "; + return result.trim(); + } + static from(value) { + if (typeof value === "string") { + return ErrorFragment.fromString(value); + } + return ErrorFragment.fromObject(value); + } + static fromObject(value) { + if (ErrorFragment.isErrorFragment(value)) { + return value; + } + if (value.type !== "error") { + logger5.throwArgumentError("invalid error object", "value", value); + } + const params = { + type: value.type, + name: verifyIdentifier(value.name), + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [] + }; + return checkForbidden(new ErrorFragment(_constructorGuard3, params)); + } + static fromString(value) { + let params = { type: "error" }; + let parens = value.match(regexParen); + if (!parens) { + logger5.throwArgumentError("invalid error signature", "value", value); + } + params.name = parens[1].trim(); + if (params.name) { + verifyIdentifier(params.name); + } + params.inputs = parseParams(parens[2], false); + return checkForbidden(ErrorFragment.fromObject(params)); + } + static isErrorFragment(value) { + return value && value._isFragment && value.type === "error"; + } + }; + regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$"); + regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"); + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js +function checkResultErrors(result) { + const errors = []; + const checkErrors = function(path, object) { + if (!Array.isArray(object)) { + return; + } + for (let key2 in object) { + const childPath = path.slice(); + childPath.push(key2); + try { + checkErrors(childPath, object[key2]); + } catch (error) { + errors.push({ path: childPath, error }); + } + } + }; + checkErrors([], result); + return errors; +} +var logger6, Coder, Writer, Reader; +var init_abstract_coder = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_lib3(); + init_lib4(); + init_lib(); + init_version5(); + logger6 = new Logger(version6); + Coder = class { + constructor(name, type, localName, dynamic) { + this.name = name; + this.type = type; + this.localName = localName; + this.dynamic = dynamic; + } + _throwError(message, value) { + logger6.throwArgumentError(message, this.localName, value); + } + }; + Writer = class { + constructor(wordSize) { + defineReadOnly(this, "wordSize", wordSize || 32); + this._data = []; + this._dataLength = 0; + this._padding = new Uint8Array(wordSize); + } + get data() { + return hexConcat(this._data); + } + get length() { + return this._dataLength; + } + _writeData(data) { + this._data.push(data); + this._dataLength += data.length; + return data.length; + } + appendWriter(writer) { + return this._writeData(concat(writer._data)); + } + // Arrayish items; padded on the right to wordSize + writeBytes(value) { + let bytes = arrayify(value); + const paddingOffset = bytes.length % this.wordSize; + if (paddingOffset) { + bytes = concat([bytes, this._padding.slice(paddingOffset)]); + } + return this._writeData(bytes); + } + _getValue(value) { + let bytes = arrayify(BigNumber.from(value)); + if (bytes.length > this.wordSize) { + logger6.throwError("value out-of-bounds", Logger.errors.BUFFER_OVERRUN, { + length: this.wordSize, + offset: bytes.length + }); + } + if (bytes.length % this.wordSize) { + bytes = concat([this._padding.slice(bytes.length % this.wordSize), bytes]); + } + return bytes; + } + // BigNumberish items; padded on the left to wordSize + writeValue(value) { + return this._writeData(this._getValue(value)); + } + writeUpdatableValue() { + const offset = this._data.length; + this._data.push(this._padding); + this._dataLength += this.wordSize; + return (value) => { + this._data[offset] = this._getValue(value); + }; + } + }; + Reader = class { + constructor(data, wordSize, coerceFunc, allowLoose) { + defineReadOnly(this, "_data", arrayify(data)); + defineReadOnly(this, "wordSize", wordSize || 32); + defineReadOnly(this, "_coerceFunc", coerceFunc); + defineReadOnly(this, "allowLoose", allowLoose); + this._offset = 0; + } + get data() { + return hexlify(this._data); + } + get consumed() { + return this._offset; + } + // The default Coerce function + static coerce(name, value) { + let match = name.match("^u?int([0-9]+)$"); + if (match && parseInt(match[1]) <= 48) { + value = value.toNumber(); + } + return value; + } + coerce(name, value) { + if (this._coerceFunc) { + return this._coerceFunc(name, value); + } + return Reader.coerce(name, value); + } + _peekBytes(offset, length, loose) { + let alignedLength = Math.ceil(length / this.wordSize) * this.wordSize; + if (this._offset + alignedLength > this._data.length) { + if (this.allowLoose && loose && this._offset + length <= this._data.length) { + alignedLength = length; + } else { + logger6.throwError("data out-of-bounds", Logger.errors.BUFFER_OVERRUN, { + length: this._data.length, + offset: this._offset + alignedLength + }); + } + } + return this._data.slice(this._offset, this._offset + alignedLength); + } + subReader(offset) { + return new Reader(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); + } + readBytes(length, loose) { + let bytes = this._peekBytes(0, length, !!loose); + this._offset += bytes.length; + return bytes.slice(0, length); + } + readValue() { + return BigNumber.from(this.readBytes(this.wordSize)); + } + }; + } +}); + +// node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js +var require_sha3 = __commonJS({ + "node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js"(exports, module2) { + init_shim(); + (function() { + "use strict"; + var INPUT_ERROR = "input is invalid type"; + var FINALIZE_ERROR = "finalize already called"; + var WINDOW = typeof window === "object"; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === "object"; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === "object" && process.versions && process.versions.node; + if (NODE_JS) { + root = global; + } else if (WEB_WORKER) { + root = self; + } + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && typeof module2 === "object" && module2.exports; + var AMD = typeof define === "function" && define.amd; + var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined"; + var HEX_CHARS = "0123456789abcdef".split(""); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [ + 1, + 0, + 32898, + 0, + 32906, + 2147483648, + 2147516416, + 2147483648, + 32907, + 0, + 2147483649, + 0, + 2147516545, + 2147483648, + 32777, + 2147483648, + 138, + 0, + 136, + 0, + 2147516425, + 0, + 2147483658, + 0, + 2147516555, + 0, + 139, + 2147483648, + 32905, + 2147483648, + 32771, + 2147483648, + 32770, + 2147483648, + 128, + 2147483648, + 32778, + 0, + 2147483658, + 2147483648, + 2147516545, + 2147483648, + 32896, + 2147483648, + 2147483649, + 0, + 2147516424, + 2147483648 + ]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ["hex", "buffer", "arrayBuffer", "array", "digest"]; + var CSHAKE_BYTEPAD = { + "128": 168, + "256": 136 + }; + if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { + Array.isArray = function(obj) { + return Object.prototype.toString.call(obj) === "[object Array]"; + }; + } + if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { + ArrayBuffer.isView = function(obj) { + return typeof obj === "object" && obj.buffer && obj.buffer.constructor === ArrayBuffer; + }; + } + var createOutputMethod = function(bits2, padding2, outputType) { + return function(message) { + return new Keccak(bits2, padding2, bits2).update(message)[outputType](); + }; + }; + var createShakeOutputMethod = function(bits2, padding2, outputType) { + return function(message, outputBits) { + return new Keccak(bits2, padding2, outputBits).update(message)[outputType](); + }; + }; + var createCshakeOutputMethod = function(bits2, padding2, outputType) { + return function(message, outputBits, n2, s2) { + return methods["cshake" + bits2].update(message, outputBits, n2, s2)[outputType](); + }; + }; + var createKmacOutputMethod = function(bits2, padding2, outputType) { + return function(key2, message, outputBits, s2) { + return methods["kmac" + bits2].update(key2, message, outputBits, s2)[outputType](); + }; + }; + var createOutputMethods = function(method, createMethod2, bits2, padding2) { + for (var i3 = 0; i3 < OUTPUT_TYPES.length; ++i3) { + var type = OUTPUT_TYPES[i3]; + method[type] = createMethod2(bits2, padding2, type); + } + return method; + }; + var createMethod = function(bits2, padding2) { + var method = createOutputMethod(bits2, padding2, "hex"); + method.create = function() { + return new Keccak(bits2, padding2, bits2); + }; + method.update = function(message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits2, padding2); + }; + var createShakeMethod = function(bits2, padding2) { + var method = createShakeOutputMethod(bits2, padding2, "hex"); + method.create = function(outputBits) { + return new Keccak(bits2, padding2, outputBits); + }; + method.update = function(message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits2, padding2); + }; + var createCshakeMethod = function(bits2, padding2) { + var w = CSHAKE_BYTEPAD[bits2]; + var method = createCshakeOutputMethod(bits2, padding2, "hex"); + method.create = function(outputBits, n2, s2) { + if (!n2 && !s2) { + return methods["shake" + bits2].create(outputBits); + } else { + return new Keccak(bits2, padding2, outputBits).bytepad([n2, s2], w); + } + }; + method.update = function(message, outputBits, n2, s2) { + return method.create(outputBits, n2, s2).update(message); + }; + return createOutputMethods(method, createCshakeOutputMethod, bits2, padding2); + }; + var createKmacMethod = function(bits2, padding2) { + var w = CSHAKE_BYTEPAD[bits2]; + var method = createKmacOutputMethod(bits2, padding2, "hex"); + method.create = function(key2, outputBits, s2) { + return new Kmac(bits2, padding2, outputBits).bytepad(["KMAC", s2], w).bytepad([key2], w); + }; + method.update = function(key2, message, outputBits, s2) { + return method.create(key2, outputBits, s2).update(message); + }; + return createOutputMethods(method, createKmacOutputMethod, bits2, padding2); + }; + var algorithms = [ + { name: "keccak", padding: KECCAK_PADDING, bits: BITS, createMethod }, + { name: "sha3", padding: PADDING, bits: BITS, createMethod }, + { name: "shake", padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, + { name: "cshake", padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, + { name: "kmac", padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } + ]; + var methods = {}, methodNames = []; + for (var i2 = 0; i2 < algorithms.length; ++i2) { + var algorithm = algorithms[i2]; + var bits = algorithm.bits; + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + "_" + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + if (algorithm.name !== "sha3") { + var newMethodName = algorithm.name + bits[j]; + methodNames.push(newMethodName); + methods[newMethodName] = methods[methodName]; + } + } + } + function Keccak(bits2, padding2, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding2; + this.outputBits = outputBits; + this.reset = true; + this.finalized = false; + this.block = 0; + this.start = 0; + this.blockCount = 1600 - (bits2 << 1) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + for (var i3 = 0; i3 < 50; ++i3) { + this.s[i3] = 0; + } + } + Keccak.prototype.update = function(message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); + } + var notString, type = typeof message; + if (type !== "string") { + if (type === "object") { + if (message === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } else if (!Array.isArray(message)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var blocks = this.blocks, byteCount = this.byteCount, length = message.length, blockCount = this.blockCount, index = 0, s2 = this.s, i3, code9; + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i3 = 1; i3 < blockCount + 1; ++i3) { + blocks[i3] = 0; + } + } + if (notString) { + for (i3 = this.start; index < length && i3 < byteCount; ++index) { + blocks[i3 >> 2] |= message[index] << SHIFT[i3++ & 3]; + } + } else { + for (i3 = this.start; index < length && i3 < byteCount; ++index) { + code9 = message.charCodeAt(index); + if (code9 < 128) { + blocks[i3 >> 2] |= code9 << SHIFT[i3++ & 3]; + } else if (code9 < 2048) { + blocks[i3 >> 2] |= (192 | code9 >> 6) << SHIFT[i3++ & 3]; + blocks[i3 >> 2] |= (128 | code9 & 63) << SHIFT[i3++ & 3]; + } else if (code9 < 55296 || code9 >= 57344) { + blocks[i3 >> 2] |= (224 | code9 >> 12) << SHIFT[i3++ & 3]; + blocks[i3 >> 2] |= (128 | code9 >> 6 & 63) << SHIFT[i3++ & 3]; + blocks[i3 >> 2] |= (128 | code9 & 63) << SHIFT[i3++ & 3]; + } else { + code9 = 65536 + ((code9 & 1023) << 10 | message.charCodeAt(++index) & 1023); + blocks[i3 >> 2] |= (240 | code9 >> 18) << SHIFT[i3++ & 3]; + blocks[i3 >> 2] |= (128 | code9 >> 12 & 63) << SHIFT[i3++ & 3]; + blocks[i3 >> 2] |= (128 | code9 >> 6 & 63) << SHIFT[i3++ & 3]; + blocks[i3 >> 2] |= (128 | code9 & 63) << SHIFT[i3++ & 3]; + } + } + } + this.lastByteIndex = i3; + if (i3 >= byteCount) { + this.start = i3 - byteCount; + this.block = blocks[blockCount]; + for (i3 = 0; i3 < blockCount; ++i3) { + s2[i3] ^= blocks[i3]; + } + f(s2); + this.reset = true; + } else { + this.start = i3; + } + } + return this; + }; + Keccak.prototype.encode = function(x, right) { + var o2 = x & 255, n2 = 1; + var bytes = [o2]; + x = x >> 8; + o2 = x & 255; + while (o2 > 0) { + bytes.unshift(o2); + x = x >> 8; + o2 = x & 255; + ++n2; + } + if (right) { + bytes.push(n2); + } else { + bytes.unshift(n2); + } + this.update(bytes); + return bytes.length; + }; + Keccak.prototype.encodeString = function(str) { + var notString, type = typeof str; + if (type !== "string") { + if (type === "object") { + if (str === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { + str = new Uint8Array(str); + } else if (!Array.isArray(str)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var bytes = 0, length = str.length; + if (notString) { + bytes = length; + } else { + for (var i3 = 0; i3 < str.length; ++i3) { + var code9 = str.charCodeAt(i3); + if (code9 < 128) { + bytes += 1; + } else if (code9 < 2048) { + bytes += 2; + } else if (code9 < 55296 || code9 >= 57344) { + bytes += 3; + } else { + code9 = 65536 + ((code9 & 1023) << 10 | str.charCodeAt(++i3) & 1023); + bytes += 4; + } + } + } + bytes += this.encode(bytes * 8); + this.update(str); + return bytes; + }; + Keccak.prototype.bytepad = function(strs, w) { + var bytes = this.encode(w); + for (var i3 = 0; i3 < strs.length; ++i3) { + bytes += this.encodeString(strs[i3]); + } + var paddingBytes = w - bytes % w; + var zeros2 = []; + zeros2.length = paddingBytes; + this.update(zeros2); + return this; + }; + Keccak.prototype.finalize = function() { + if (this.finalized) { + return; + } + this.finalized = true; + var blocks = this.blocks, i3 = this.lastByteIndex, blockCount = this.blockCount, s2 = this.s; + blocks[i3 >> 2] |= this.padding[i3 & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i3 = 1; i3 < blockCount + 1; ++i3) { + blocks[i3] = 0; + } + } + blocks[blockCount - 1] |= 2147483648; + for (i3 = 0; i3 < blockCount; ++i3) { + s2[i3] ^= blocks[i3]; + } + f(s2); + }; + Keccak.prototype.toString = Keccak.prototype.hex = function() { + this.finalize(); + var blockCount = this.blockCount, s2 = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i3 = 0, j2 = 0; + var hex = "", block; + while (j2 < outputBlocks) { + for (i3 = 0; i3 < blockCount && j2 < outputBlocks; ++i3, ++j2) { + block = s2[i3]; + hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15] + HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15] + HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15] + HEX_CHARS[block >> 28 & 15] + HEX_CHARS[block >> 24 & 15]; + } + if (j2 % blockCount === 0) { + f(s2); + i3 = 0; + } + } + if (extraBytes) { + block = s2[i3]; + hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15]; + if (extraBytes > 1) { + hex += HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15]; + } + } + return hex; + }; + Keccak.prototype.arrayBuffer = function() { + this.finalize(); + var blockCount = this.blockCount, s2 = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i3 = 0, j2 = 0; + var bytes = this.outputBits >> 3; + var buffer; + if (extraBytes) { + buffer = new ArrayBuffer(outputBlocks + 1 << 2); + } else { + buffer = new ArrayBuffer(bytes); + } + var array = new Uint32Array(buffer); + while (j2 < outputBlocks) { + for (i3 = 0; i3 < blockCount && j2 < outputBlocks; ++i3, ++j2) { + array[j2] = s2[i3]; + } + if (j2 % blockCount === 0) { + f(s2); + } + } + if (extraBytes) { + array[i3] = s2[i3]; + buffer = buffer.slice(0, bytes); + } + return buffer; + }; + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; + Keccak.prototype.digest = Keccak.prototype.array = function() { + this.finalize(); + var blockCount = this.blockCount, s2 = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i3 = 0, j2 = 0; + var array = [], offset, block; + while (j2 < outputBlocks) { + for (i3 = 0; i3 < blockCount && j2 < outputBlocks; ++i3, ++j2) { + offset = j2 << 2; + block = s2[i3]; + array[offset] = block & 255; + array[offset + 1] = block >> 8 & 255; + array[offset + 2] = block >> 16 & 255; + array[offset + 3] = block >> 24 & 255; + } + if (j2 % blockCount === 0) { + f(s2); + } + } + if (extraBytes) { + offset = j2 << 2; + block = s2[i3]; + array[offset] = block & 255; + if (extraBytes > 1) { + array[offset + 1] = block >> 8 & 255; + } + if (extraBytes > 2) { + array[offset + 2] = block >> 16 & 255; + } + } + return array; + }; + function Kmac(bits2, padding2, outputBits) { + Keccak.call(this, bits2, padding2, outputBits); + } + Kmac.prototype = new Keccak(); + Kmac.prototype.finalize = function() { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + var f = function(s2) { + var h, l2, n2, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + for (n2 = 0; n2 < 48; n2 += 2) { + c0 = s2[0] ^ s2[10] ^ s2[20] ^ s2[30] ^ s2[40]; + c1 = s2[1] ^ s2[11] ^ s2[21] ^ s2[31] ^ s2[41]; + c2 = s2[2] ^ s2[12] ^ s2[22] ^ s2[32] ^ s2[42]; + c3 = s2[3] ^ s2[13] ^ s2[23] ^ s2[33] ^ s2[43]; + c4 = s2[4] ^ s2[14] ^ s2[24] ^ s2[34] ^ s2[44]; + c5 = s2[5] ^ s2[15] ^ s2[25] ^ s2[35] ^ s2[45]; + c6 = s2[6] ^ s2[16] ^ s2[26] ^ s2[36] ^ s2[46]; + c7 = s2[7] ^ s2[17] ^ s2[27] ^ s2[37] ^ s2[47]; + c8 = s2[8] ^ s2[18] ^ s2[28] ^ s2[38] ^ s2[48]; + c9 = s2[9] ^ s2[19] ^ s2[29] ^ s2[39] ^ s2[49]; + h = c8 ^ (c2 << 1 | c3 >>> 31); + l2 = c9 ^ (c3 << 1 | c2 >>> 31); + s2[0] ^= h; + s2[1] ^= l2; + s2[10] ^= h; + s2[11] ^= l2; + s2[20] ^= h; + s2[21] ^= l2; + s2[30] ^= h; + s2[31] ^= l2; + s2[40] ^= h; + s2[41] ^= l2; + h = c0 ^ (c4 << 1 | c5 >>> 31); + l2 = c1 ^ (c5 << 1 | c4 >>> 31); + s2[2] ^= h; + s2[3] ^= l2; + s2[12] ^= h; + s2[13] ^= l2; + s2[22] ^= h; + s2[23] ^= l2; + s2[32] ^= h; + s2[33] ^= l2; + s2[42] ^= h; + s2[43] ^= l2; + h = c2 ^ (c6 << 1 | c7 >>> 31); + l2 = c3 ^ (c7 << 1 | c6 >>> 31); + s2[4] ^= h; + s2[5] ^= l2; + s2[14] ^= h; + s2[15] ^= l2; + s2[24] ^= h; + s2[25] ^= l2; + s2[34] ^= h; + s2[35] ^= l2; + s2[44] ^= h; + s2[45] ^= l2; + h = c4 ^ (c8 << 1 | c9 >>> 31); + l2 = c5 ^ (c9 << 1 | c8 >>> 31); + s2[6] ^= h; + s2[7] ^= l2; + s2[16] ^= h; + s2[17] ^= l2; + s2[26] ^= h; + s2[27] ^= l2; + s2[36] ^= h; + s2[37] ^= l2; + s2[46] ^= h; + s2[47] ^= l2; + h = c6 ^ (c0 << 1 | c1 >>> 31); + l2 = c7 ^ (c1 << 1 | c0 >>> 31); + s2[8] ^= h; + s2[9] ^= l2; + s2[18] ^= h; + s2[19] ^= l2; + s2[28] ^= h; + s2[29] ^= l2; + s2[38] ^= h; + s2[39] ^= l2; + s2[48] ^= h; + s2[49] ^= l2; + b0 = s2[0]; + b1 = s2[1]; + b32 = s2[11] << 4 | s2[10] >>> 28; + b33 = s2[10] << 4 | s2[11] >>> 28; + b14 = s2[20] << 3 | s2[21] >>> 29; + b15 = s2[21] << 3 | s2[20] >>> 29; + b46 = s2[31] << 9 | s2[30] >>> 23; + b47 = s2[30] << 9 | s2[31] >>> 23; + b28 = s2[40] << 18 | s2[41] >>> 14; + b29 = s2[41] << 18 | s2[40] >>> 14; + b20 = s2[2] << 1 | s2[3] >>> 31; + b21 = s2[3] << 1 | s2[2] >>> 31; + b2 = s2[13] << 12 | s2[12] >>> 20; + b3 = s2[12] << 12 | s2[13] >>> 20; + b34 = s2[22] << 10 | s2[23] >>> 22; + b35 = s2[23] << 10 | s2[22] >>> 22; + b16 = s2[33] << 13 | s2[32] >>> 19; + b17 = s2[32] << 13 | s2[33] >>> 19; + b48 = s2[42] << 2 | s2[43] >>> 30; + b49 = s2[43] << 2 | s2[42] >>> 30; + b40 = s2[5] << 30 | s2[4] >>> 2; + b41 = s2[4] << 30 | s2[5] >>> 2; + b22 = s2[14] << 6 | s2[15] >>> 26; + b23 = s2[15] << 6 | s2[14] >>> 26; + b4 = s2[25] << 11 | s2[24] >>> 21; + b5 = s2[24] << 11 | s2[25] >>> 21; + b36 = s2[34] << 15 | s2[35] >>> 17; + b37 = s2[35] << 15 | s2[34] >>> 17; + b18 = s2[45] << 29 | s2[44] >>> 3; + b19 = s2[44] << 29 | s2[45] >>> 3; + b10 = s2[6] << 28 | s2[7] >>> 4; + b11 = s2[7] << 28 | s2[6] >>> 4; + b42 = s2[17] << 23 | s2[16] >>> 9; + b43 = s2[16] << 23 | s2[17] >>> 9; + b24 = s2[26] << 25 | s2[27] >>> 7; + b25 = s2[27] << 25 | s2[26] >>> 7; + b6 = s2[36] << 21 | s2[37] >>> 11; + b7 = s2[37] << 21 | s2[36] >>> 11; + b38 = s2[47] << 24 | s2[46] >>> 8; + b39 = s2[46] << 24 | s2[47] >>> 8; + b30 = s2[8] << 27 | s2[9] >>> 5; + b31 = s2[9] << 27 | s2[8] >>> 5; + b12 = s2[18] << 20 | s2[19] >>> 12; + b13 = s2[19] << 20 | s2[18] >>> 12; + b44 = s2[29] << 7 | s2[28] >>> 25; + b45 = s2[28] << 7 | s2[29] >>> 25; + b26 = s2[38] << 8 | s2[39] >>> 24; + b27 = s2[39] << 8 | s2[38] >>> 24; + b8 = s2[48] << 14 | s2[49] >>> 18; + b9 = s2[49] << 14 | s2[48] >>> 18; + s2[0] = b0 ^ ~b2 & b4; + s2[1] = b1 ^ ~b3 & b5; + s2[10] = b10 ^ ~b12 & b14; + s2[11] = b11 ^ ~b13 & b15; + s2[20] = b20 ^ ~b22 & b24; + s2[21] = b21 ^ ~b23 & b25; + s2[30] = b30 ^ ~b32 & b34; + s2[31] = b31 ^ ~b33 & b35; + s2[40] = b40 ^ ~b42 & b44; + s2[41] = b41 ^ ~b43 & b45; + s2[2] = b2 ^ ~b4 & b6; + s2[3] = b3 ^ ~b5 & b7; + s2[12] = b12 ^ ~b14 & b16; + s2[13] = b13 ^ ~b15 & b17; + s2[22] = b22 ^ ~b24 & b26; + s2[23] = b23 ^ ~b25 & b27; + s2[32] = b32 ^ ~b34 & b36; + s2[33] = b33 ^ ~b35 & b37; + s2[42] = b42 ^ ~b44 & b46; + s2[43] = b43 ^ ~b45 & b47; + s2[4] = b4 ^ ~b6 & b8; + s2[5] = b5 ^ ~b7 & b9; + s2[14] = b14 ^ ~b16 & b18; + s2[15] = b15 ^ ~b17 & b19; + s2[24] = b24 ^ ~b26 & b28; + s2[25] = b25 ^ ~b27 & b29; + s2[34] = b34 ^ ~b36 & b38; + s2[35] = b35 ^ ~b37 & b39; + s2[44] = b44 ^ ~b46 & b48; + s2[45] = b45 ^ ~b47 & b49; + s2[6] = b6 ^ ~b8 & b0; + s2[7] = b7 ^ ~b9 & b1; + s2[16] = b16 ^ ~b18 & b10; + s2[17] = b17 ^ ~b19 & b11; + s2[26] = b26 ^ ~b28 & b20; + s2[27] = b27 ^ ~b29 & b21; + s2[36] = b36 ^ ~b38 & b30; + s2[37] = b37 ^ ~b39 & b31; + s2[46] = b46 ^ ~b48 & b40; + s2[47] = b47 ^ ~b49 & b41; + s2[8] = b8 ^ ~b0 & b2; + s2[9] = b9 ^ ~b1 & b3; + s2[18] = b18 ^ ~b10 & b12; + s2[19] = b19 ^ ~b11 & b13; + s2[28] = b28 ^ ~b20 & b22; + s2[29] = b29 ^ ~b21 & b23; + s2[38] = b38 ^ ~b30 & b32; + s2[39] = b39 ^ ~b31 & b33; + s2[48] = b48 ^ ~b40 & b42; + s2[49] = b49 ^ ~b41 & b43; + s2[0] ^= RC[n2]; + s2[1] ^= RC[n2 + 1]; + } + }; + if (COMMON_JS) { + module2.exports = methods; + } else { + for (i2 = 0; i2 < methodNames.length; ++i2) { + root[methodNames[i2]] = methods[methodNames[i2]]; + } + if (AMD) { + define(function() { + return methods; + }); + } + } + })(); + } +}); + +// node_modules/@ethersproject/keccak256/lib.esm/index.js +var lib_exports4 = {}; +__export(lib_exports4, { + keccak256: () => keccak256 +}); +function keccak256(data) { + return "0x" + import_js_sha3.default.keccak_256(arrayify(data)); +} +var import_js_sha3; +var init_lib5 = __esm({ + "node_modules/@ethersproject/keccak256/lib.esm/index.js"() { + "use strict"; + init_shim(); + import_js_sha3 = __toESM(require_sha3()); + init_lib2(); + } +}); + +// node_modules/@ethersproject/rlp/lib.esm/_version.js +var version7; +var init_version6 = __esm({ + "node_modules/@ethersproject/rlp/lib.esm/_version.js"() { + init_shim(); + version7 = "rlp/5.7.0"; + } +}); + +// node_modules/@ethersproject/rlp/lib.esm/index.js +var lib_exports5 = {}; +__export(lib_exports5, { + decode: () => decode, + encode: () => encode +}); +function arrayifyInteger(value) { + const result = []; + while (value) { + result.unshift(value & 255); + value >>= 8; + } + return result; +} +function unarrayifyInteger(data, offset, length) { + let result = 0; + for (let i2 = 0; i2 < length; i2++) { + result = result * 256 + data[offset + i2]; + } + return result; +} +function _encode(object) { + if (Array.isArray(object)) { + let payload = []; + object.forEach(function(child) { + payload = payload.concat(_encode(child)); + }); + if (payload.length <= 55) { + payload.unshift(192 + payload.length); + return payload; + } + const length2 = arrayifyInteger(payload.length); + length2.unshift(247 + length2.length); + return length2.concat(payload); + } + if (!isBytesLike(object)) { + logger7.throwArgumentError("RLP object must be BytesLike", "object", object); + } + const data = Array.prototype.slice.call(arrayify(object)); + if (data.length === 1 && data[0] <= 127) { + return data; + } else if (data.length <= 55) { + data.unshift(128 + data.length); + return data; + } + const length = arrayifyInteger(data.length); + length.unshift(183 + length.length); + return length.concat(data); +} +function encode(object) { + return hexlify(_encode(object)); +} +function _decodeChildren(data, offset, childOffset, length) { + const result = []; + while (childOffset < offset + 1 + length) { + const decoded = _decode(data, childOffset); + result.push(decoded.result); + childOffset += decoded.consumed; + if (childOffset > offset + 1 + length) { + logger7.throwError("child data too short", Logger.errors.BUFFER_OVERRUN, {}); + } + } + return { consumed: 1 + length, result }; +} +function _decode(data, offset) { + if (data.length === 0) { + logger7.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); + } + if (data[offset] >= 248) { + const lengthLength = data[offset] - 247; + if (offset + 1 + lengthLength > data.length) { + logger7.throwError("data short segment too short", Logger.errors.BUFFER_OVERRUN, {}); + } + const length = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length > data.length) { + logger7.throwError("data long segment too short", Logger.errors.BUFFER_OVERRUN, {}); + } + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); + } else if (data[offset] >= 192) { + const length = data[offset] - 192; + if (offset + 1 + length > data.length) { + logger7.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); + } + return _decodeChildren(data, offset, offset + 1, length); + } else if (data[offset] >= 184) { + const lengthLength = data[offset] - 183; + if (offset + 1 + lengthLength > data.length) { + logger7.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); + } + const length = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length > data.length) { + logger7.throwError("data array too short", Logger.errors.BUFFER_OVERRUN, {}); + } + const result = hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); + return { consumed: 1 + lengthLength + length, result }; + } else if (data[offset] >= 128) { + const length = data[offset] - 128; + if (offset + 1 + length > data.length) { + logger7.throwError("data too short", Logger.errors.BUFFER_OVERRUN, {}); + } + const result = hexlify(data.slice(offset + 1, offset + 1 + length)); + return { consumed: 1 + length, result }; + } + return { consumed: 1, result: hexlify(data[offset]) }; +} +function decode(data) { + const bytes = arrayify(data); + const decoded = _decode(bytes, 0); + if (decoded.consumed !== bytes.length) { + logger7.throwArgumentError("invalid rlp data", "data", data); + } + return decoded.result; +} +var logger7; +var init_lib6 = __esm({ + "node_modules/@ethersproject/rlp/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_lib(); + init_version6(); + logger7 = new Logger(version7); + } +}); + +// node_modules/@ethersproject/address/lib.esm/_version.js +var version8; +var init_version7 = __esm({ + "node_modules/@ethersproject/address/lib.esm/_version.js"() { + init_shim(); + version8 = "address/5.7.0"; + } +}); + +// node_modules/@ethersproject/address/lib.esm/index.js +var lib_exports6 = {}; +__export(lib_exports6, { + getAddress: () => getAddress, + getContractAddress: () => getContractAddress, + getCreate2Address: () => getCreate2Address, + getIcapAddress: () => getIcapAddress, + isAddress: () => isAddress +}); +function getChecksumAddress(address) { + if (!isHexString(address, 20)) { + logger8.throwArgumentError("invalid address", "address", address); + } + address = address.toLowerCase(); + const chars = address.substring(2).split(""); + const expanded = new Uint8Array(40); + for (let i2 = 0; i2 < 40; i2++) { + expanded[i2] = chars[i2].charCodeAt(0); + } + const hashed = arrayify(keccak256(expanded)); + for (let i2 = 0; i2 < 40; i2 += 2) { + if (hashed[i2 >> 1] >> 4 >= 8) { + chars[i2] = chars[i2].toUpperCase(); + } + if ((hashed[i2 >> 1] & 15) >= 8) { + chars[i2 + 1] = chars[i2 + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); +} +function log10(x) { + if (Math.log10) { + return Math.log10(x); + } + return Math.log(x) / Math.LN10; +} +function ibanChecksum(address) { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; + let expanded = address.split("").map((c) => { + return ibanLookup[c]; + }).join(""); + while (expanded.length >= safeDigits) { + let block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } + let checksum = String(98 - parseInt(expanded, 10) % 97); + while (checksum.length < 2) { + checksum = "0" + checksum; + } + return checksum; +} +function getAddress(address) { + let result = null; + if (typeof address !== "string") { + logger8.throwArgumentError("invalid address", "address", address); + } + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + if (address.substring(0, 2) !== "0x") { + address = "0x" + address; + } + result = getChecksumAddress(address); + if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) { + logger8.throwArgumentError("bad address checksum", "address", address); + } + } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + if (address.substring(2, 4) !== ibanChecksum(address)) { + logger8.throwArgumentError("bad icap checksum", "address", address); + } + result = _base36To16(address.substring(4)); + while (result.length < 40) { + result = "0" + result; + } + result = getChecksumAddress("0x" + result); + } else { + logger8.throwArgumentError("invalid address", "address", address); + } + return result; +} +function isAddress(address) { + try { + getAddress(address); + return true; + } catch (error) { + } + return false; +} +function getIcapAddress(address) { + let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; +} +function getContractAddress(transaction) { + let from = null; + try { + from = getAddress(transaction.from); + } catch (error) { + logger8.throwArgumentError("missing from address", "transaction", transaction); + } + const nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString())); + return getAddress(hexDataSlice(keccak256(encode([from, nonce])), 12)); +} +function getCreate2Address(from, salt, initCodeHash) { + if (hexDataLength(salt) !== 32) { + logger8.throwArgumentError("salt must be 32 bytes", "salt", salt); + } + if (hexDataLength(initCodeHash) !== 32) { + logger8.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); + } + return getAddress(hexDataSlice(keccak256(concat(["0xff", getAddress(from), salt, initCodeHash])), 12)); +} +var logger8, MAX_SAFE_INTEGER, ibanLookup, safeDigits; +var init_lib7 = __esm({ + "node_modules/@ethersproject/address/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_lib3(); + init_lib5(); + init_lib6(); + init_lib(); + init_version7(); + logger8 = new Logger(version8); + MAX_SAFE_INTEGER = 9007199254740991; + ibanLookup = {}; + for (let i2 = 0; i2 < 10; i2++) { + ibanLookup[String(i2)] = String(i2); + } + for (let i2 = 0; i2 < 26; i2++) { + ibanLookup[String.fromCharCode(65 + i2)] = String(10 + i2); + } + safeDigits = Math.floor(log10(MAX_SAFE_INTEGER)); + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/address.js +var AddressCoder; +var init_address = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/address.js"() { + "use strict"; + init_shim(); + init_lib7(); + init_lib2(); + init_abstract_coder(); + AddressCoder = class extends Coder { + constructor(localName) { + super("address", "address", localName, false); + } + defaultValue() { + return "0x0000000000000000000000000000000000000000"; + } + encode(writer, value) { + try { + value = getAddress(value); + } catch (error) { + this._throwError(error.message, value); + } + return writer.writeValue(value); + } + decode(reader) { + return getAddress(hexZeroPad(reader.readValue().toHexString(), 20)); + } + }; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js +var AnonymousCoder; +var init_anonymous = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js"() { + "use strict"; + init_shim(); + init_abstract_coder(); + AnonymousCoder = class extends Coder { + constructor(coder) { + super(coder.name, coder.type, void 0, coder.dynamic); + this.coder = coder; + } + defaultValue() { + return this.coder.defaultValue(); + } + encode(writer, value) { + return this.coder.encode(writer, value); + } + decode(reader) { + return this.coder.decode(reader); + } + }; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/array.js +function pack(writer, coders, values) { + let arrayValues = null; + if (Array.isArray(values)) { + arrayValues = values; + } else if (values && typeof values === "object") { + let unique = {}; + arrayValues = coders.map((coder) => { + const name = coder.localName; + if (!name) { + logger9.throwError("cannot encode object for signature with missing names", Logger.errors.INVALID_ARGUMENT, { + argument: "values", + coder, + value: values + }); + } + if (unique[name]) { + logger9.throwError("cannot encode object for signature with duplicate names", Logger.errors.INVALID_ARGUMENT, { + argument: "values", + coder, + value: values + }); + } + unique[name] = true; + return values[name]; + }); + } else { + logger9.throwArgumentError("invalid tuple value", "tuple", values); + } + if (coders.length !== arrayValues.length) { + logger9.throwArgumentError("types/value length mismatch", "tuple", values); + } + let staticWriter = new Writer(writer.wordSize); + let dynamicWriter = new Writer(writer.wordSize); + let updateFuncs = []; + coders.forEach((coder, index) => { + let value = arrayValues[index]; + if (coder.dynamic) { + let dynamicOffset = dynamicWriter.length; + coder.encode(dynamicWriter, value); + let updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push((baseOffset) => { + updateFunc(baseOffset + dynamicOffset); + }); + } else { + coder.encode(staticWriter, value); + } + }); + updateFuncs.forEach((func) => { + func(staticWriter.length); + }); + let length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; +} +function unpack(reader, coders) { + let values = []; + let baseReader = reader.subReader(0); + coders.forEach((coder) => { + let value = null; + if (coder.dynamic) { + let offset = reader.readValue(); + let offsetReader = baseReader.subReader(offset.toNumber()); + try { + value = coder.decode(offsetReader); + } catch (error) { + if (error.code === Logger.errors.BUFFER_OVERRUN) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } else { + try { + value = coder.decode(reader); + } catch (error) { + if (error.code === Logger.errors.BUFFER_OVERRUN) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value != void 0) { + values.push(value); + } + }); + const uniqueNames = coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, {}); + coders.forEach((coder, index) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } + if (name === "length") { + name = "_length"; + } + if (values[name] != null) { + return; + } + const value = values[index]; + if (value instanceof Error) { + Object.defineProperty(values, name, { + enumerable: true, + get: () => { + throw value; + } + }); + } else { + values[name] = value; + } + }); + for (let i2 = 0; i2 < values.length; i2++) { + const value = values[i2]; + if (value instanceof Error) { + Object.defineProperty(values, i2, { + enumerable: true, + get: () => { + throw value; + } + }); + } + } + return Object.freeze(values); +} +var logger9, ArrayCoder; +var init_array = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/array.js"() { + "use strict"; + init_shim(); + init_lib(); + init_version5(); + init_abstract_coder(); + init_anonymous(); + logger9 = new Logger(version6); + ArrayCoder = class extends Coder { + constructor(coder, length, localName) { + const type = coder.type + "[" + (length >= 0 ? length : "") + "]"; + const dynamic = length === -1 || coder.dynamic; + super("array", type, localName, dynamic); + this.coder = coder; + this.length = length; + } + defaultValue() { + const defaultChild = this.coder.defaultValue(); + const result = []; + for (let i2 = 0; i2 < this.length; i2++) { + result.push(defaultChild); + } + return result; + } + encode(writer, value) { + if (!Array.isArray(value)) { + this._throwError("expected array value", value); + } + let count = this.length; + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + logger9.checkArgumentCount(value.length, count, "coder array" + (this.localName ? " " + this.localName : "")); + let coders = []; + for (let i2 = 0; i2 < value.length; i2++) { + coders.push(this.coder); + } + return pack(writer, coders, value); + } + decode(reader) { + let count = this.length; + if (count === -1) { + count = reader.readValue().toNumber(); + if (count * 32 > reader._data.length) { + logger9.throwError("insufficient data length", Logger.errors.BUFFER_OVERRUN, { + length: reader._data.length, + count + }); + } + } + let coders = []; + for (let i2 = 0; i2 < count; i2++) { + coders.push(new AnonymousCoder(this.coder)); + } + return reader.coerce(this.name, unpack(reader, coders)); + } + }; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/boolean.js +var BooleanCoder; +var init_boolean = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/boolean.js"() { + "use strict"; + init_shim(); + init_abstract_coder(); + BooleanCoder = class extends Coder { + constructor(localName) { + super("bool", "bool", localName, false); + } + defaultValue() { + return false; + } + encode(writer, value) { + return writer.writeValue(value ? 1 : 0); + } + decode(reader) { + return reader.coerce(this.type, !reader.readValue().isZero()); + } + }; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/bytes.js +var DynamicBytesCoder, BytesCoder; +var init_bytes = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/bytes.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_abstract_coder(); + DynamicBytesCoder = class extends Coder { + constructor(type, localName) { + super(type, type, localName, true); + } + defaultValue() { + return "0x"; + } + encode(writer, value) { + value = arrayify(value); + let length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + decode(reader) { + return reader.readBytes(reader.readValue().toNumber(), true); + } + }; + BytesCoder = class extends DynamicBytesCoder { + constructor(localName) { + super("bytes", localName); + } + decode(reader) { + return reader.coerce(this.name, hexlify(super.decode(reader))); + } + }; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js +var FixedBytesCoder; +var init_fixed_bytes = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_abstract_coder(); + FixedBytesCoder = class extends Coder { + constructor(size, localName) { + let name = "bytes" + String(size); + super(name, name, localName, false); + this.size = size; + } + defaultValue() { + return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2); + } + encode(writer, value) { + let data = arrayify(value); + if (data.length !== this.size) { + this._throwError("incorrect data length", value); + } + return writer.writeBytes(data); + } + decode(reader) { + return reader.coerce(this.name, hexlify(reader.readBytes(this.size))); + } + }; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/null.js +var NullCoder; +var init_null = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/null.js"() { + "use strict"; + init_shim(); + init_abstract_coder(); + NullCoder = class extends Coder { + constructor(localName) { + super("null", "", localName, false); + } + defaultValue() { + return null; + } + encode(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes([]); + } + decode(reader) { + reader.readBytes(0); + return reader.coerce(this.name, null); + } + }; + } +}); + +// node_modules/@ethersproject/constants/lib.esm/addresses.js +var AddressZero; +var init_addresses = __esm({ + "node_modules/@ethersproject/constants/lib.esm/addresses.js"() { + init_shim(); + AddressZero = "0x0000000000000000000000000000000000000000"; + } +}); + +// node_modules/@ethersproject/constants/lib.esm/bignumbers.js +var NegativeOne2, Zero2, One, Two, WeiPerEther, MaxUint256, MinInt256, MaxInt256; +var init_bignumbers = __esm({ + "node_modules/@ethersproject/constants/lib.esm/bignumbers.js"() { + init_shim(); + init_lib3(); + NegativeOne2 = /* @__PURE__ */ BigNumber.from(-1); + Zero2 = /* @__PURE__ */ BigNumber.from(0); + One = /* @__PURE__ */ BigNumber.from(1); + Two = /* @__PURE__ */ BigNumber.from(2); + WeiPerEther = /* @__PURE__ */ BigNumber.from("1000000000000000000"); + MaxUint256 = /* @__PURE__ */ BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + MinInt256 = /* @__PURE__ */ BigNumber.from("-0x8000000000000000000000000000000000000000000000000000000000000000"); + MaxInt256 = /* @__PURE__ */ BigNumber.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + } +}); + +// node_modules/@ethersproject/constants/lib.esm/hashes.js +var HashZero; +var init_hashes = __esm({ + "node_modules/@ethersproject/constants/lib.esm/hashes.js"() { + init_shim(); + HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000"; + } +}); + +// node_modules/@ethersproject/constants/lib.esm/strings.js +var EtherSymbol; +var init_strings = __esm({ + "node_modules/@ethersproject/constants/lib.esm/strings.js"() { + init_shim(); + EtherSymbol = "\u039E"; + } +}); + +// node_modules/@ethersproject/constants/lib.esm/index.js +var lib_exports7 = {}; +__export(lib_exports7, { + AddressZero: () => AddressZero, + EtherSymbol: () => EtherSymbol, + HashZero: () => HashZero, + MaxInt256: () => MaxInt256, + MaxUint256: () => MaxUint256, + MinInt256: () => MinInt256, + NegativeOne: () => NegativeOne2, + One: () => One, + Two: () => Two, + WeiPerEther: () => WeiPerEther, + Zero: () => Zero2 +}); +var init_lib8 = __esm({ + "node_modules/@ethersproject/constants/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_addresses(); + init_bignumbers(); + init_hashes(); + init_strings(); + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/number.js +var NumberCoder; +var init_number = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/number.js"() { + "use strict"; + init_shim(); + init_lib3(); + init_lib8(); + init_abstract_coder(); + NumberCoder = class extends Coder { + constructor(size, signed2, localName) { + const name = (signed2 ? "int" : "uint") + size * 8; + super(name, name, localName, false); + this.size = size; + this.signed = signed2; + } + defaultValue() { + return 0; + } + encode(writer, value) { + let v = BigNumber.from(value); + let maxUintValue = MaxUint256.mask(writer.wordSize * 8); + if (this.signed) { + let bounds = maxUintValue.mask(this.size * 8 - 1); + if (v.gt(bounds) || v.lt(bounds.add(One).mul(NegativeOne2))) { + this._throwError("value out-of-bounds", value); + } + } else if (v.lt(Zero2) || v.gt(maxUintValue.mask(this.size * 8))) { + this._throwError("value out-of-bounds", value); + } + v = v.toTwos(this.size * 8).mask(this.size * 8); + if (this.signed) { + v = v.fromTwos(this.size * 8).toTwos(8 * writer.wordSize); + } + return writer.writeValue(v); + } + decode(reader) { + let value = reader.readValue().mask(this.size * 8); + if (this.signed) { + value = value.fromTwos(this.size * 8); + } + return reader.coerce(this.name, value); + } + }; + } +}); + +// node_modules/@ethersproject/strings/lib.esm/_version.js +var version9; +var init_version8 = __esm({ + "node_modules/@ethersproject/strings/lib.esm/_version.js"() { + init_shim(); + version9 = "strings/5.7.0"; + } +}); + +// node_modules/@ethersproject/strings/lib.esm/utf8.js +function errorFunc(reason, offset, bytes, output, badCodepoint) { + return logger10.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); +} +function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) { + let i2 = 0; + for (let o2 = offset + 1; o2 < bytes.length; o2++) { + if (bytes[o2] >> 6 !== 2) { + break; + } + i2++; + } + return i2; + } + if (reason === Utf8ErrorReason.OVERRUN) { + return bytes.length - offset - 1; + } + return 0; +} +function replaceFunc(reason, offset, bytes, output, badCodepoint) { + if (reason === Utf8ErrorReason.OVERLONG) { + output.push(badCodepoint); + return 0; + } + output.push(65533); + return ignoreFunc(reason, offset, bytes, output, badCodepoint); +} +function getUtf8CodePoints(bytes, onError) { + if (onError == null) { + onError = Utf8ErrorFuncs.error; + } + bytes = arrayify(bytes); + const result = []; + let i2 = 0; + while (i2 < bytes.length) { + const c = bytes[i2++]; + if (c >> 7 === 0) { + result.push(c); + continue; + } + let extraLength = null; + let overlongMask = null; + if ((c & 224) === 192) { + extraLength = 1; + overlongMask = 127; + } else if ((c & 240) === 224) { + extraLength = 2; + overlongMask = 2047; + } else if ((c & 248) === 240) { + extraLength = 3; + overlongMask = 65535; + } else { + if ((c & 192) === 128) { + i2 += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i2 - 1, bytes, result); + } else { + i2 += onError(Utf8ErrorReason.BAD_PREFIX, i2 - 1, bytes, result); + } + continue; + } + if (i2 - 1 + extraLength >= bytes.length) { + i2 += onError(Utf8ErrorReason.OVERRUN, i2 - 1, bytes, result); + continue; + } + let res = c & (1 << 8 - extraLength - 1) - 1; + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i2]; + if ((nextChar & 192) != 128) { + i2 += onError(Utf8ErrorReason.MISSING_CONTINUE, i2, bytes, result); + res = null; + break; + } + ; + res = res << 6 | nextChar & 63; + i2++; + } + if (res === null) { + continue; + } + if (res > 1114111) { + i2 += onError(Utf8ErrorReason.OUT_OF_RANGE, i2 - 1 - extraLength, bytes, result, res); + continue; + } + if (res >= 55296 && res <= 57343) { + i2 += onError(Utf8ErrorReason.UTF16_SURROGATE, i2 - 1 - extraLength, bytes, result, res); + continue; + } + if (res <= overlongMask) { + i2 += onError(Utf8ErrorReason.OVERLONG, i2 - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; +} +function toUtf8Bytes(str, form = UnicodeNormalizationForm.current) { + if (form != UnicodeNormalizationForm.current) { + logger10.checkNormalize(); + str = str.normalize(form); + } + let result = []; + for (let i2 = 0; i2 < str.length; i2++) { + const c = str.charCodeAt(i2); + if (c < 128) { + result.push(c); + } else if (c < 2048) { + result.push(c >> 6 | 192); + result.push(c & 63 | 128); + } else if ((c & 64512) == 55296) { + i2++; + const c2 = str.charCodeAt(i2); + if (i2 >= str.length || (c2 & 64512) !== 56320) { + throw new Error("invalid utf-8 string"); + } + const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023); + result.push(pair >> 18 | 240); + result.push(pair >> 12 & 63 | 128); + result.push(pair >> 6 & 63 | 128); + result.push(pair & 63 | 128); + } else { + result.push(c >> 12 | 224); + result.push(c >> 6 & 63 | 128); + result.push(c & 63 | 128); + } + } + return arrayify(result); +} +function escapeChar(value) { + const hex = "0000" + value.toString(16); + return "\\u" + hex.substring(hex.length - 4); +} +function _toEscapedUtf8String(bytes, onError) { + return '"' + getUtf8CodePoints(bytes, onError).map((codePoint) => { + if (codePoint < 256) { + switch (codePoint) { + case 8: + return "\\b"; + case 9: + return "\\t"; + case 10: + return "\\n"; + case 13: + return "\\r"; + case 34: + return '\\"'; + case 92: + return "\\\\"; + } + if (codePoint >= 32 && codePoint < 127) { + return String.fromCharCode(codePoint); + } + } + if (codePoint <= 65535) { + return escapeChar(codePoint); + } + codePoint -= 65536; + return escapeChar((codePoint >> 10 & 1023) + 55296) + escapeChar((codePoint & 1023) + 56320); + }).join("") + '"'; +} +function _toUtf8String(codePoints) { + return codePoints.map((codePoint) => { + if (codePoint <= 65535) { + return String.fromCharCode(codePoint); + } + codePoint -= 65536; + return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320); + }).join(""); +} +function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); +} +function toUtf8CodePoints(str, form = UnicodeNormalizationForm.current) { + return getUtf8CodePoints(toUtf8Bytes(str, form)); +} +var logger10, UnicodeNormalizationForm, Utf8ErrorReason, Utf8ErrorFuncs; +var init_utf8 = __esm({ + "node_modules/@ethersproject/strings/lib.esm/utf8.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_lib(); + init_version8(); + logger10 = new Logger(version9); + (function(UnicodeNormalizationForm2) { + UnicodeNormalizationForm2["current"] = ""; + UnicodeNormalizationForm2["NFC"] = "NFC"; + UnicodeNormalizationForm2["NFD"] = "NFD"; + UnicodeNormalizationForm2["NFKC"] = "NFKC"; + UnicodeNormalizationForm2["NFKD"] = "NFKD"; + })(UnicodeNormalizationForm || (UnicodeNormalizationForm = {})); + (function(Utf8ErrorReason2) { + Utf8ErrorReason2["UNEXPECTED_CONTINUE"] = "unexpected continuation byte"; + Utf8ErrorReason2["BAD_PREFIX"] = "bad codepoint prefix"; + Utf8ErrorReason2["OVERRUN"] = "string overrun"; + Utf8ErrorReason2["MISSING_CONTINUE"] = "missing continuation byte"; + Utf8ErrorReason2["OUT_OF_RANGE"] = "out of UTF-8 range"; + Utf8ErrorReason2["UTF16_SURROGATE"] = "UTF-16 surrogate"; + Utf8ErrorReason2["OVERLONG"] = "overlong representation"; + })(Utf8ErrorReason || (Utf8ErrorReason = {})); + Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc + }); + } +}); + +// node_modules/@ethersproject/strings/lib.esm/bytes32.js +function formatBytes32String(text) { + const bytes = toUtf8Bytes(text); + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } + return hexlify(concat([bytes, HashZero]).slice(0, 32)); +} +function parseBytes32String(bytes) { + const data = arrayify(bytes); + if (data.length !== 32) { + throw new Error("invalid bytes32 - not 32 bytes long"); + } + if (data[31] !== 0) { + throw new Error("invalid bytes32 string - no null terminator"); + } + let length = 31; + while (data[length - 1] === 0) { + length--; + } + return toUtf8String(data.slice(0, length)); +} +var init_bytes32 = __esm({ + "node_modules/@ethersproject/strings/lib.esm/bytes32.js"() { + "use strict"; + init_shim(); + init_lib8(); + init_lib2(); + init_utf8(); + } +}); + +// node_modules/@ethersproject/strings/lib.esm/idna.js +function bytes2(data) { + if (data.length % 4 !== 0) { + throw new Error("bad data"); + } + let result = []; + for (let i2 = 0; i2 < data.length; i2 += 4) { + result.push(parseInt(data.substring(i2, i2 + 4), 16)); + } + return result; +} +function createTable(data, func) { + if (!func) { + func = function(value) { + return [parseInt(value, 16)]; + }; + } + let lo = 0; + let result = {}; + data.split(",").forEach((pair) => { + let comps = pair.split(":"); + lo += parseInt(comps[0], 16); + result[lo] = func(comps[1]); + }); + return result; +} +function createRangeTable(data) { + let hi = 0; + return data.split(",").map((v) => { + let comps = v.split("-"); + if (comps.length === 1) { + comps[1] = "0"; + } else if (comps[1] === "") { + comps[1] = "1"; + } + let lo = hi + parseInt(comps[0], 16); + hi = parseInt(comps[1], 16); + return { l: lo, h: hi }; + }); +} +function matchMap(value, ranges) { + let lo = 0; + for (let i2 = 0; i2 < ranges.length; i2++) { + let range = ranges[i2]; + lo += range.l; + if (value >= lo && value <= lo + range.h && (value - lo) % (range.d || 1) === 0) { + if (range.e && range.e.indexOf(value - lo) !== -1) { + continue; + } + return range; + } + } + return null; +} +function flatten(values) { + return values.reduce((accum, value) => { + value.forEach((value2) => { + accum.push(value2); + }); + return accum; + }, []); +} +function _nameprepTableA1(codepoint) { + return !!matchMap(codepoint, Table_A_1_ranges); +} +function _nameprepTableB2(codepoint) { + let range = matchMap(codepoint, Table_B_2_ranges); + if (range) { + return [codepoint + range.s]; + } + let codes = Table_B_2_lut_abs[codepoint]; + if (codes) { + return codes; + } + let shift = Table_B_2_lut_rel[codepoint]; + if (shift) { + return [codepoint + shift[0]]; + } + let complex = Table_B_2_complex[codepoint]; + if (complex) { + return complex; + } + return null; +} +function _nameprepTableC(codepoint) { + return !!matchMap(codepoint, Table_C_ranges); +} +function nameprep(value) { + if (value.match(/^[a-z0-9-]*$/i) && value.length <= 59) { + return value.toLowerCase(); + } + let codes = toUtf8CodePoints(value); + codes = flatten(codes.map((code9) => { + if (Table_B_1_flags.indexOf(code9) >= 0) { + return []; + } + if (code9 >= 65024 && code9 <= 65039) { + return []; + } + let codesTableB2 = _nameprepTableB2(code9); + if (codesTableB2) { + return codesTableB2; + } + return [code9]; + })); + codes = toUtf8CodePoints(_toUtf8String(codes), UnicodeNormalizationForm.NFKC); + codes.forEach((code9) => { + if (_nameprepTableC(code9)) { + throw new Error("STRINGPREP_CONTAINS_PROHIBITED"); + } + }); + codes.forEach((code9) => { + if (_nameprepTableA1(code9)) { + throw new Error("STRINGPREP_CONTAINS_UNASSIGNED"); + } + }); + let name = _toUtf8String(codes); + if (name.substring(0, 1) === "-" || name.substring(2, 4) === "--" || name.substring(name.length - 1) === "-") { + throw new Error("invalid hyphen"); + } + return name; +} +var Table_A_1_ranges, Table_B_1_flags, Table_B_2_ranges, Table_B_2_lut_abs, Table_B_2_lut_rel, Table_B_2_complex, Table_C_ranges; +var init_idna = __esm({ + "node_modules/@ethersproject/strings/lib.esm/idna.js"() { + "use strict"; + init_shim(); + init_utf8(); + Table_A_1_ranges = createRangeTable("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"); + Table_B_1_flags = "ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((v) => parseInt(v, 16)); + Table_B_2_ranges = [ + { h: 25, s: 32, l: 65 }, + { h: 30, s: 32, e: [23], l: 127 }, + { h: 54, s: 1, e: [48], l: 64, d: 2 }, + { h: 14, s: 1, l: 57, d: 2 }, + { h: 44, s: 1, l: 17, d: 2 }, + { h: 10, s: 1, e: [2, 6, 8], l: 61, d: 2 }, + { h: 16, s: 1, l: 68, d: 2 }, + { h: 84, s: 1, e: [18, 24, 66], l: 19, d: 2 }, + { h: 26, s: 32, e: [17], l: 435 }, + { h: 22, s: 1, l: 71, d: 2 }, + { h: 15, s: 80, l: 40 }, + { h: 31, s: 32, l: 16 }, + { h: 32, s: 1, l: 80, d: 2 }, + { h: 52, s: 1, l: 42, d: 2 }, + { h: 12, s: 1, l: 55, d: 2 }, + { h: 40, s: 1, e: [38], l: 15, d: 2 }, + { h: 14, s: 1, l: 48, d: 2 }, + { h: 37, s: 48, l: 49 }, + { h: 148, s: 1, l: 6351, d: 2 }, + { h: 88, s: 1, l: 160, d: 2 }, + { h: 15, s: 16, l: 704 }, + { h: 25, s: 26, l: 854 }, + { h: 25, s: 32, l: 55915 }, + { h: 37, s: 40, l: 1247 }, + { h: 25, s: -119711, l: 53248 }, + { h: 25, s: -119763, l: 52 }, + { h: 25, s: -119815, l: 52 }, + { h: 25, s: -119867, e: [1, 4, 5, 7, 8, 11, 12, 17], l: 52 }, + { h: 25, s: -119919, l: 52 }, + { h: 24, s: -119971, e: [2, 7, 8, 17], l: 52 }, + { h: 24, s: -120023, e: [2, 7, 13, 15, 16, 17], l: 52 }, + { h: 25, s: -120075, l: 52 }, + { h: 25, s: -120127, l: 52 }, + { h: 25, s: -120179, l: 52 }, + { h: 25, s: -120231, l: 52 }, + { h: 25, s: -120283, l: 52 }, + { h: 25, s: -120335, l: 52 }, + { h: 24, s: -119543, e: [17], l: 56 }, + { h: 24, s: -119601, e: [17], l: 58 }, + { h: 24, s: -119659, e: [17], l: 58 }, + { h: 24, s: -119717, e: [17], l: 58 }, + { h: 24, s: -119775, e: [17], l: 58 } + ]; + Table_B_2_lut_abs = createTable("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"); + Table_B_2_lut_rel = createTable("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"); + Table_B_2_complex = createTable("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D", bytes2); + Table_C_ranges = createRangeTable("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001"); + } +}); + +// node_modules/@ethersproject/strings/lib.esm/index.js +var lib_exports8 = {}; +__export(lib_exports8, { + UnicodeNormalizationForm: () => UnicodeNormalizationForm, + Utf8ErrorFuncs: () => Utf8ErrorFuncs, + Utf8ErrorReason: () => Utf8ErrorReason, + _toEscapedUtf8String: () => _toEscapedUtf8String, + formatBytes32String: () => formatBytes32String, + nameprep: () => nameprep, + parseBytes32String: () => parseBytes32String, + toUtf8Bytes: () => toUtf8Bytes, + toUtf8CodePoints: () => toUtf8CodePoints, + toUtf8String: () => toUtf8String +}); +var init_lib9 = __esm({ + "node_modules/@ethersproject/strings/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_bytes32(); + init_idna(); + init_utf8(); + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/string.js +var StringCoder; +var init_string = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/string.js"() { + "use strict"; + init_shim(); + init_lib9(); + init_bytes(); + StringCoder = class extends DynamicBytesCoder { + constructor(localName) { + super("string", localName); + } + defaultValue() { + return ""; + } + encode(writer, value) { + return super.encode(writer, toUtf8Bytes(value)); + } + decode(reader) { + return toUtf8String(super.decode(reader)); + } + }; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/coders/tuple.js +var TupleCoder; +var init_tuple = __esm({ + "node_modules/@ethersproject/abi/lib.esm/coders/tuple.js"() { + "use strict"; + init_shim(); + init_abstract_coder(); + init_array(); + TupleCoder = class extends Coder { + constructor(coders, localName) { + let dynamic = false; + const types = []; + coders.forEach((coder) => { + if (coder.dynamic) { + dynamic = true; + } + types.push(coder.type); + }); + const type = "tuple(" + types.join(",") + ")"; + super("tuple", type, localName, dynamic); + this.coders = coders; + } + defaultValue() { + const values = []; + this.coders.forEach((coder) => { + values.push(coder.defaultValue()); + }); + const uniqueNames = this.coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, {}); + this.coders.forEach((coder, index) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } + if (name === "length") { + name = "_length"; + } + if (values[name] != null) { + return; + } + values[name] = values[index]; + }); + return Object.freeze(values); + } + encode(writer, value) { + return pack(writer, this.coders, value); + } + decode(reader) { + return reader.coerce(this.name, unpack(reader, this.coders)); + } + }; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/abi-coder.js +var logger11, paramTypeBytes, paramTypeNumber, AbiCoder, defaultAbiCoder; +var init_abi_coder = __esm({ + "node_modules/@ethersproject/abi/lib.esm/abi-coder.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_lib4(); + init_lib(); + init_version5(); + init_abstract_coder(); + init_address(); + init_array(); + init_boolean(); + init_bytes(); + init_fixed_bytes(); + init_null(); + init_number(); + init_string(); + init_tuple(); + init_fragments(); + logger11 = new Logger(version6); + paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); + paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); + AbiCoder = class { + constructor(coerceFunc) { + defineReadOnly(this, "coerceFunc", coerceFunc || null); + } + _getCoder(param) { + switch (param.baseType) { + case "address": + return new AddressCoder(param.name); + case "bool": + return new BooleanCoder(param.name); + case "string": + return new StringCoder(param.name); + case "bytes": + return new BytesCoder(param.name); + case "array": + return new ArrayCoder(this._getCoder(param.arrayChildren), param.arrayLength, param.name); + case "tuple": + return new TupleCoder((param.components || []).map((component) => { + return this._getCoder(component); + }), param.name); + case "": + return new NullCoder(param.name); + } + let match = param.type.match(paramTypeNumber); + if (match) { + let size = parseInt(match[2] || "256"); + if (size === 0 || size > 256 || size % 8 !== 0) { + logger11.throwArgumentError("invalid " + match[1] + " bit length", "param", param); + } + return new NumberCoder(size / 8, match[1] === "int", param.name); + } + match = param.type.match(paramTypeBytes); + if (match) { + let size = parseInt(match[1]); + if (size === 0 || size > 32) { + logger11.throwArgumentError("invalid bytes length", "param", param); + } + return new FixedBytesCoder(size, param.name); + } + return logger11.throwArgumentError("invalid type", "type", param.type); + } + _getWordSize() { + return 32; + } + _getReader(data, allowLoose) { + return new Reader(data, this._getWordSize(), this.coerceFunc, allowLoose); + } + _getWriter() { + return new Writer(this._getWordSize()); + } + getDefaultValue(types) { + const coders = types.map((type) => this._getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.defaultValue(); + } + encode(types, values) { + if (types.length !== values.length) { + logger11.throwError("types/values length mismatch", Logger.errors.INVALID_ARGUMENT, { + count: { types: types.length, values: values.length }, + value: { types, values } + }); + } + const coders = types.map((type) => this._getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + const writer = this._getWriter(); + coder.encode(writer, values); + return writer.data; + } + decode(types, data, loose) { + const coders = types.map((type) => this._getCoder(ParamType.from(type))); + const coder = new TupleCoder(coders, "_"); + return coder.decode(this._getReader(arrayify(data), loose)); + } + }; + defaultAbiCoder = new AbiCoder(); + } +}); + +// node_modules/@ethersproject/hash/lib.esm/id.js +function id(text) { + return keccak256(toUtf8Bytes(text)); +} +var init_id = __esm({ + "node_modules/@ethersproject/hash/lib.esm/id.js"() { + init_shim(); + init_lib5(); + init_lib9(); + } +}); + +// node_modules/@ethersproject/hash/lib.esm/_version.js +var version10; +var init_version9 = __esm({ + "node_modules/@ethersproject/hash/lib.esm/_version.js"() { + init_shim(); + version10 = "hash/5.7.0"; + } +}); + +// node_modules/@ethersproject/base64/lib.esm/base64.js +function decode2(textData) { + textData = atob(textData); + const data = []; + for (let i2 = 0; i2 < textData.length; i2++) { + data.push(textData.charCodeAt(i2)); + } + return arrayify(data); +} +function encode2(data) { + data = arrayify(data); + let textData = ""; + for (let i2 = 0; i2 < data.length; i2++) { + textData += String.fromCharCode(data[i2]); + } + return btoa(textData); +} +var init_base64 = __esm({ + "node_modules/@ethersproject/base64/lib.esm/base64.js"() { + "use strict"; + init_shim(); + init_lib2(); + } +}); + +// node_modules/@ethersproject/base64/lib.esm/index.js +var lib_exports9 = {}; +__export(lib_exports9, { + decode: () => decode2, + encode: () => encode2 +}); +var init_lib10 = __esm({ + "node_modules/@ethersproject/base64/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_base64(); + } +}); + +// node_modules/@ethersproject/hash/lib.esm/ens-normalize/decoder.js +function flat(array, depth) { + if (depth == null) { + depth = 1; + } + const result = []; + const forEach = result.forEach; + const flatDeep = function(arr, depth2) { + forEach.call(arr, function(val) { + if (depth2 > 0 && Array.isArray(val)) { + flatDeep(val, depth2 - 1); + } else { + result.push(val); + } + }); + }; + flatDeep(array, depth); + return result; +} +function fromEntries(array) { + const result = {}; + for (let i2 = 0; i2 < array.length; i2++) { + const value = array[i2]; + result[value[0]] = value[1]; + } + return result; +} +function decode_arithmetic(bytes) { + let pos = 0; + function u16() { + return bytes[pos++] << 8 | bytes[pos++]; + } + let symbol_count = u16(); + let total = 1; + let acc = [0, 1]; + for (let i2 = 1; i2 < symbol_count; i2++) { + acc.push(total += u16()); + } + let skip = u16(); + let pos_payload = pos; + pos += skip; + let read_width = 0; + let read_buffer = 0; + function read_bit() { + if (read_width == 0) { + read_buffer = read_buffer << 8 | bytes[pos++]; + read_width = 8; + } + return read_buffer >> --read_width & 1; + } + const N2 = 31; + const FULL = Math.pow(2, N2); + const HALF = FULL >>> 1; + const QRTR = HALF >> 1; + const MASK = FULL - 1; + let register = 0; + for (let i2 = 0; i2 < N2; i2++) + register = register << 1 | read_bit(); + let symbols = []; + let low = 0; + let range = FULL; + while (true) { + let value = Math.floor(((register - low + 1) * total - 1) / range); + let start = 0; + let end = symbol_count; + while (end - start > 1) { + let mid = start + end >>> 1; + if (value < acc[mid]) { + end = mid; + } else { + start = mid; + } + } + if (start == 0) + break; + symbols.push(start); + let a2 = low + Math.floor(range * acc[start] / total); + let b = low + Math.floor(range * acc[start + 1] / total) - 1; + while (((a2 ^ b) & HALF) == 0) { + register = register << 1 & MASK | read_bit(); + a2 = a2 << 1 & MASK; + b = b << 1 & MASK | 1; + } + while (a2 & ~b & QRTR) { + register = register & HALF | register << 1 & MASK >>> 1 | read_bit(); + a2 = a2 << 1 ^ HALF; + b = (b ^ HALF) << 1 | HALF | 1; + } + low = a2; + range = 1 + b - a2; + } + let offset = symbol_count - 4; + return symbols.map((x) => { + switch (x - offset) { + case 3: + return offset + 65792 + (bytes[pos_payload++] << 16 | bytes[pos_payload++] << 8 | bytes[pos_payload++]); + case 2: + return offset + 256 + (bytes[pos_payload++] << 8 | bytes[pos_payload++]); + case 1: + return offset + bytes[pos_payload++]; + default: + return x - 1; + } + }); +} +function read_payload(v) { + let pos = 0; + return () => v[pos++]; +} +function read_compressed_payload(bytes) { + return read_payload(decode_arithmetic(bytes)); +} +function signed(i2) { + return i2 & 1 ? ~i2 >> 1 : i2 >> 1; +} +function read_counts(n2, next) { + let v = Array(n2); + for (let i2 = 0; i2 < n2; i2++) + v[i2] = 1 + next(); + return v; +} +function read_ascending(n2, next) { + let v = Array(n2); + for (let i2 = 0, x = -1; i2 < n2; i2++) + v[i2] = x += 1 + next(); + return v; +} +function read_deltas(n2, next) { + let v = Array(n2); + for (let i2 = 0, x = 0; i2 < n2; i2++) + v[i2] = x += signed(next()); + return v; +} +function read_member_array(next, lookup) { + let v = read_ascending(next(), next); + let n2 = next(); + let vX = read_ascending(n2, next); + let vN = read_counts(n2, next); + for (let i2 = 0; i2 < n2; i2++) { + for (let j = 0; j < vN[i2]; j++) { + v.push(vX[i2] + j); + } + } + return lookup ? v.map((x) => lookup[x]) : v; +} +function read_mapped_map(next) { + let ret = []; + while (true) { + let w = next(); + if (w == 0) + break; + ret.push(read_linear_table(w, next)); + } + while (true) { + let w = next() - 1; + if (w < 0) + break; + ret.push(read_replacement_table(w, next)); + } + return fromEntries(flat(ret)); +} +function read_zero_terminated_array(next) { + let v = []; + while (true) { + let i2 = next(); + if (i2 == 0) + break; + v.push(i2); + } + return v; +} +function read_transposed(n2, w, next) { + let m = Array(n2).fill(void 0).map(() => []); + for (let i2 = 0; i2 < w; i2++) { + read_deltas(n2, next).forEach((x, j) => m[j].push(x)); + } + return m; +} +function read_linear_table(w, next) { + let dx = 1 + next(); + let dy = next(); + let vN = read_zero_terminated_array(next); + let m = read_transposed(vN.length, 1 + w, next); + return flat(m.map((v, i2) => { + const x = v[0], ys = v.slice(1); + return Array(vN[i2]).fill(void 0).map((_, j) => { + let j_dy = j * dy; + return [x + j * dx, ys.map((y) => y + j_dy)]; + }); + })); +} +function read_replacement_table(w, next) { + let n2 = 1 + next(); + let m = read_transposed(n2, 1 + w, next); + return m.map((v) => [v[0], v.slice(1)]); +} +function read_emoji_trie(next) { + let sorted = read_member_array(next).sort((a2, b) => a2 - b); + return read(); + function read() { + let branches = []; + while (true) { + let keys = read_member_array(next, sorted); + if (keys.length == 0) + break; + branches.push({ set: new Set(keys), node: read() }); + } + branches.sort((a2, b) => b.set.size - a2.set.size); + let temp = next(); + let valid = temp % 3; + temp = temp / 3 | 0; + let fe0f = !!(temp & 1); + temp >>= 1; + let save = temp == 1; + let check = temp == 2; + return { branches, valid, fe0f, save, check }; + } +} +var init_decoder = __esm({ + "node_modules/@ethersproject/hash/lib.esm/ens-normalize/decoder.js"() { + init_shim(); + } +}); + +// node_modules/@ethersproject/hash/lib.esm/ens-normalize/include.js +function getData() { + return read_compressed_payload(decode2("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")); +} +var init_include = __esm({ + "node_modules/@ethersproject/hash/lib.esm/ens-normalize/include.js"() { + init_shim(); + init_lib10(); + init_decoder(); + } +}); + +// node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js +function explode_cp(name) { + return toUtf8CodePoints(name); +} +function filter_fe0f(cps) { + return cps.filter((cp) => cp != 65039); +} +function ens_normalize_post_check(name) { + for (let label of name.split(".")) { + let cps = explode_cp(label); + try { + for (let i2 = cps.lastIndexOf(UNDERSCORE) - 1; i2 >= 0; i2--) { + if (cps[i2] !== UNDERSCORE) { + throw new Error(`underscore only allowed at start`); + } + } + if (cps.length >= 4 && cps.every((cp) => cp < 128) && cps[2] === HYPHEN && cps[3] === HYPHEN) { + throw new Error(`invalid label extension`); + } + } catch (err) { + throw new Error(`Invalid label "${label}": ${err.message}`); + } + } + return name; +} +function ens_normalize(name) { + return ens_normalize_post_check(normalize(name, filter_fe0f)); +} +function normalize(name, emoji_filter) { + let input = explode_cp(name).reverse(); + let output = []; + while (input.length) { + let emoji = consume_emoji_reversed(input); + if (emoji) { + output.push(...emoji_filter(emoji)); + continue; + } + let cp = input.pop(); + if (VALID.has(cp)) { + output.push(cp); + continue; + } + if (IGNORED.has(cp)) { + continue; + } + let cps = MAPPED[cp]; + if (cps) { + output.push(...cps); + continue; + } + throw new Error(`Disallowed codepoint: 0x${cp.toString(16).toUpperCase()}`); + } + return ens_normalize_post_check(nfc(String.fromCodePoint(...output))); +} +function nfc(s2) { + return s2.normalize("NFC"); +} +function consume_emoji_reversed(cps, eaten) { + var _a; + let node = EMOJI_ROOT; + let emoji; + let saved; + let stack = []; + let pos = cps.length; + if (eaten) + eaten.length = 0; + while (pos) { + let cp = cps[--pos]; + node = (_a = node.branches.find((x) => x.set.has(cp))) === null || _a === void 0 ? void 0 : _a.node; + if (!node) + break; + if (node.save) { + saved = cp; + } else if (node.check) { + if (cp === saved) + break; + } + stack.push(cp); + if (node.fe0f) { + stack.push(65039); + if (pos > 0 && cps[pos - 1] == 65039) + pos--; + } + if (node.valid) { + emoji = stack.slice(); + if (node.valid == 2) + emoji.splice(1, 1); + if (eaten) + eaten.push(...cps.slice(pos).reverse()); + cps.length = pos; + } + } + return emoji; +} +var r, VALID, IGNORED, MAPPED, EMOJI_ROOT, HYPHEN, UNDERSCORE; +var init_lib11 = __esm({ + "node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js"() { + init_shim(); + init_lib9(); + init_include(); + init_decoder(); + r = getData(); + VALID = new Set(read_member_array(r)); + IGNORED = new Set(read_member_array(r)); + MAPPED = read_mapped_map(r); + EMOJI_ROOT = read_emoji_trie(r); + HYPHEN = 45; + UNDERSCORE = 95; + } +}); + +// node_modules/@ethersproject/hash/lib.esm/namehash.js +function checkComponent(comp) { + if (comp.length === 0) { + throw new Error("invalid ENS name; empty component"); + } + return comp; +} +function ensNameSplit(name) { + const bytes = toUtf8Bytes(ens_normalize(name)); + const comps = []; + if (name.length === 0) { + return comps; + } + let last = 0; + for (let i2 = 0; i2 < bytes.length; i2++) { + const d = bytes[i2]; + if (d === 46) { + comps.push(checkComponent(bytes.slice(last, i2))); + last = i2 + 1; + } + } + if (last >= bytes.length) { + throw new Error("invalid ENS name; empty component"); + } + comps.push(checkComponent(bytes.slice(last))); + return comps; +} +function ensNormalize(name) { + return ensNameSplit(name).map((comp) => toUtf8String(comp)).join("."); +} +function isValidName(name) { + try { + return ensNameSplit(name).length !== 0; + } catch (error) { + } + return false; +} +function namehash(name) { + if (typeof name !== "string") { + logger12.throwArgumentError("invalid ENS name; not a string", "name", name); + } + let result = Zeros; + const comps = ensNameSplit(name); + while (comps.length) { + result = keccak256(concat([result, keccak256(comps.pop())])); + } + return hexlify(result); +} +function dnsEncode(name) { + return hexlify(concat(ensNameSplit(name).map((comp) => { + if (comp.length > 63) { + throw new Error("invalid DNS encoded entry; length exceeds 63 bytes"); + } + const bytes = new Uint8Array(comp.length + 1); + bytes.set(comp, 1); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; +} +var logger12, Zeros; +var init_namehash = __esm({ + "node_modules/@ethersproject/hash/lib.esm/namehash.js"() { + init_shim(); + init_lib2(); + init_lib9(); + init_lib5(); + init_lib(); + init_version9(); + init_lib11(); + logger12 = new Logger(version10); + Zeros = new Uint8Array(32); + Zeros.fill(0); + } +}); + +// node_modules/@ethersproject/hash/lib.esm/message.js +function hashMessage(message) { + if (typeof message === "string") { + message = toUtf8Bytes(message); + } + return keccak256(concat([ + toUtf8Bytes(messagePrefix), + toUtf8Bytes(String(message.length)), + message + ])); +} +var messagePrefix; +var init_message = __esm({ + "node_modules/@ethersproject/hash/lib.esm/message.js"() { + init_shim(); + init_lib2(); + init_lib5(); + init_lib9(); + messagePrefix = "Ethereum Signed Message:\n"; + } +}); + +// node_modules/@ethersproject/hash/lib.esm/typed-data.js +function hexPadRight(value) { + const bytes = arrayify(value); + const padOffset = bytes.length % 32; + if (padOffset) { + return hexConcat([bytes, padding.slice(padOffset)]); + } + return hexlify(bytes); +} +function checkString(key2) { + return function(value) { + if (typeof value !== "string") { + logger13.throwArgumentError(`invalid domain value for ${JSON.stringify(key2)}`, `domain.${key2}`, value); + } + return value; + }; +} +function getBaseEncoder(type) { + { + const match = type.match(/^(u?)int(\d*)$/); + if (match) { + const signed2 = match[1] === ""; + const width = parseInt(match[2] || "256"); + if (width % 8 !== 0 || width > 256 || match[2] && match[2] !== String(width)) { + logger13.throwArgumentError("invalid numeric width", "type", type); + } + const boundsUpper = MaxUint2562.mask(signed2 ? width - 1 : width); + const boundsLower = signed2 ? boundsUpper.add(One2).mul(NegativeOne3) : Zero3; + return function(value) { + const v = BigNumber.from(value); + if (v.lt(boundsLower) || v.gt(boundsUpper)) { + logger13.throwArgumentError(`value out-of-bounds for ${type}`, "value", value); + } + return hexZeroPad(v.toTwos(256).toHexString(), 32); + }; + } + } + { + const match = type.match(/^bytes(\d+)$/); + if (match) { + const width = parseInt(match[1]); + if (width === 0 || width > 32 || match[1] !== String(width)) { + logger13.throwArgumentError("invalid bytes width", "type", type); + } + return function(value) { + const bytes = arrayify(value); + if (bytes.length !== width) { + logger13.throwArgumentError(`invalid length for ${type}`, "value", value); + } + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": + return function(value) { + return hexZeroPad(getAddress(value), 32); + }; + case "bool": + return function(value) { + return !value ? hexFalse : hexTrue; + }; + case "bytes": + return function(value) { + return keccak256(value); + }; + case "string": + return function(value) { + return id(value); + }; + } + return null; +} +function encodeType(name, fields) { + return `${name}(${fields.map(({ name: name2, type }) => type + " " + name2).join(",")})`; +} +var __awaiter2, logger13, padding, NegativeOne3, Zero3, One2, MaxUint2562, hexTrue, hexFalse, domainFieldTypes, domainFieldNames, domainChecks, TypedDataEncoder; +var init_typed_data = __esm({ + "node_modules/@ethersproject/hash/lib.esm/typed-data.js"() { + init_shim(); + init_lib7(); + init_lib3(); + init_lib2(); + init_lib5(); + init_lib4(); + init_lib(); + init_version9(); + init_id(); + __awaiter2 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + logger13 = new Logger(version10); + padding = new Uint8Array(32); + padding.fill(0); + NegativeOne3 = BigNumber.from(-1); + Zero3 = BigNumber.from(0); + One2 = BigNumber.from(1); + MaxUint2562 = BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + hexTrue = hexZeroPad(One2.toHexString(), 32); + hexFalse = hexZeroPad(Zero3.toHexString(), 32); + domainFieldTypes = { + name: "string", + version: "string", + chainId: "uint256", + verifyingContract: "address", + salt: "bytes32" + }; + domainFieldNames = [ + "name", + "version", + "chainId", + "verifyingContract", + "salt" + ]; + domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function(value) { + try { + return BigNumber.from(value).toString(); + } catch (error) { + } + return logger13.throwArgumentError(`invalid domain value for "chainId"`, "domain.chainId", value); + }, + verifyingContract: function(value) { + try { + return getAddress(value).toLowerCase(); + } catch (error) { + } + return logger13.throwArgumentError(`invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + }, + salt: function(value) { + try { + const bytes = arrayify(value); + if (bytes.length !== 32) { + throw new Error("bad length"); + } + return hexlify(bytes); + } catch (error) { + } + return logger13.throwArgumentError(`invalid domain value "salt"`, "domain.salt", value); + } + }; + TypedDataEncoder = class { + constructor(types) { + defineReadOnly(this, "types", Object.freeze(deepCopy(types))); + defineReadOnly(this, "_encoderCache", {}); + defineReadOnly(this, "_types", {}); + const links = {}; + const parents = {}; + const subtypes = {}; + Object.keys(types).forEach((type) => { + links[type] = {}; + parents[type] = []; + subtypes[type] = {}; + }); + for (const name in types) { + const uniqueNames = {}; + types[name].forEach((field) => { + if (uniqueNames[field.name]) { + logger13.throwArgumentError(`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); + } + uniqueNames[field.name] = true; + const baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]; + if (baseType === name) { + logger13.throwArgumentError(`circular type reference to ${JSON.stringify(baseType)}`, "types", types); + } + const encoder = getBaseEncoder(baseType); + if (encoder) { + return; + } + if (!parents[baseType]) { + logger13.throwArgumentError(`unknown type ${JSON.stringify(baseType)}`, "types", types); + } + parents[baseType].push(name); + links[name][baseType] = true; + }); + } + const primaryTypes = Object.keys(parents).filter((n2) => parents[n2].length === 0); + if (primaryTypes.length === 0) { + logger13.throwArgumentError("missing primary type", "types", types); + } else if (primaryTypes.length > 1) { + logger13.throwArgumentError(`ambiguous primary types or unused types: ${primaryTypes.map((t2) => JSON.stringify(t2)).join(", ")}`, "types", types); + } + defineReadOnly(this, "primaryType", primaryTypes[0]); + function checkCircular(type, found) { + if (found[type]) { + logger13.throwArgumentError(`circular type reference to ${JSON.stringify(type)}`, "types", types); + } + found[type] = true; + Object.keys(links[type]).forEach((child) => { + if (!parents[child]) { + return; + } + checkCircular(child, found); + Object.keys(found).forEach((subtype) => { + subtypes[subtype][child] = true; + }); + }); + delete found[type]; + } + checkCircular(this.primaryType, {}); + for (const name in subtypes) { + const st = Object.keys(subtypes[name]); + st.sort(); + this._types[name] = encodeType(name, types[name]) + st.map((t2) => encodeType(t2, types[t2])).join(""); + } + } + getEncoder(type) { + let encoder = this._encoderCache[type]; + if (!encoder) { + encoder = this._encoderCache[type] = this._getEncoder(type); + } + return encoder; + } + _getEncoder(type) { + { + const encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + const subtype = match[1]; + const subEncoder = this.getEncoder(subtype); + const length = parseInt(match[3]); + return (value) => { + if (length >= 0 && value.length !== length) { + logger13.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + let result = value.map(subEncoder); + if (this._types[subtype]) { + result = result.map(keccak256); + } + return keccak256(hexConcat(result)); + }; + } + const fields = this.types[type]; + if (fields) { + const encodedType = id(this._types[type]); + return (value) => { + const values = fields.map(({ name, type: type2 }) => { + const result = this.getEncoder(type2)(value[name]); + if (this._types[type2]) { + return keccak256(result); + } + return result; + }); + values.unshift(encodedType); + return hexConcat(values); + }; + } + return logger13.throwArgumentError(`unknown type: ${type}`, "type", type); + } + encodeType(name) { + const result = this._types[name]; + if (!result) { + logger13.throwArgumentError(`unknown type: ${JSON.stringify(name)}`, "name", name); + } + return result; + } + encodeData(type, value) { + return this.getEncoder(type)(value); + } + hashStruct(name, value) { + return keccak256(this.encodeData(name, value)); + } + encode(value) { + return this.encodeData(this.primaryType, value); + } + hash(value) { + return this.hashStruct(this.primaryType, value); + } + _visit(type, value, callback) { + { + const encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + const subtype = match[1]; + const length = parseInt(match[3]); + if (length >= 0 && value.length !== length) { + logger13.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + return value.map((v) => this._visit(subtype, v, callback)); + } + const fields = this.types[type]; + if (fields) { + return fields.reduce((accum, { name, type: type2 }) => { + accum[name] = this._visit(type2, value[name], callback); + return accum; + }, {}); + } + return logger13.throwArgumentError(`unknown type: ${type}`, "type", type); + } + visit(value, callback) { + return this._visit(this.primaryType, value, callback); + } + static from(types) { + return new TypedDataEncoder(types); + } + static getPrimaryType(types) { + return TypedDataEncoder.from(types).primaryType; + } + static hashStruct(name, types, value) { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + static hashDomain(domain) { + const domainFields = []; + for (const name in domain) { + const type = domainFieldTypes[name]; + if (!type) { + logger13.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); + } + domainFields.push({ name, type }); + } + domainFields.sort((a2, b) => { + return domainFieldNames.indexOf(a2.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + } + static encode(domain, types, value) { + return hexConcat([ + "0x1901", + TypedDataEncoder.hashDomain(domain), + TypedDataEncoder.from(types).hash(value) + ]); + } + static hash(domain, types, value) { + return keccak256(TypedDataEncoder.encode(domain, types, value)); + } + // Replaces all address types with ENS names with their looked up address + static resolveNames(domain, types, value, resolveName2) { + return __awaiter2(this, void 0, void 0, function* () { + domain = shallowCopy(domain); + const ensCache = {}; + if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + const encoder = TypedDataEncoder.from(types); + encoder.visit(value, (type, value2) => { + if (type === "address" && !isHexString(value2, 20)) { + ensCache[value2] = "0x"; + } + return value2; + }); + for (const name in ensCache) { + ensCache[name] = yield resolveName2(name); + } + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + value = encoder.visit(value, (type, value2) => { + if (type === "address" && ensCache[value2]) { + return ensCache[value2]; + } + return value2; + }); + return { domain, value }; + }); + } + static getPayload(domain, types, value) { + TypedDataEncoder.hashDomain(domain); + const domainValues = {}; + const domainTypes = []; + domainFieldNames.forEach((name) => { + const value2 = domain[name]; + if (value2 == null) { + return; + } + domainValues[name] = domainChecks[name](value2); + domainTypes.push({ name, type: domainFieldTypes[name] }); + }); + const encoder = TypedDataEncoder.from(types); + const typesWithDomain = shallowCopy(types); + if (typesWithDomain.EIP712Domain) { + logger13.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); + } else { + typesWithDomain.EIP712Domain = domainTypes; + } + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, (type, value2) => { + if (type.match(/^bytes(\d*)/)) { + return hexlify(arrayify(value2)); + } + if (type.match(/^u?int/)) { + return BigNumber.from(value2).toString(); + } + switch (type) { + case "address": + return value2.toLowerCase(); + case "bool": + return !!value2; + case "string": + if (typeof value2 !== "string") { + logger13.throwArgumentError(`invalid string`, "value", value2); + } + return value2; + } + return logger13.throwArgumentError("unsupported type", "type", type); + }) + }; + } + }; + } +}); + +// node_modules/@ethersproject/hash/lib.esm/index.js +var lib_exports10 = {}; +__export(lib_exports10, { + _TypedDataEncoder: () => TypedDataEncoder, + dnsEncode: () => dnsEncode, + ensNormalize: () => ensNormalize, + hashMessage: () => hashMessage, + id: () => id, + isValidName: () => isValidName, + messagePrefix: () => messagePrefix, + namehash: () => namehash +}); +var init_lib12 = __esm({ + "node_modules/@ethersproject/hash/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_id(); + init_namehash(); + init_message(); + init_namehash(); + init_typed_data(); + } +}); + +// node_modules/@ethersproject/abi/lib.esm/interface.js +function wrapAccessError(property, error) { + const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`); + wrap.error = error; + return wrap; +} +var logger14, LogDescription, TransactionDescription, ErrorDescription, Indexed, BuiltinErrors, Interface; +var init_interface = __esm({ + "node_modules/@ethersproject/abi/lib.esm/interface.js"() { + "use strict"; + init_shim(); + init_lib7(); + init_lib3(); + init_lib2(); + init_lib12(); + init_lib5(); + init_lib4(); + init_abi_coder(); + init_abstract_coder(); + init_fragments(); + init_lib(); + init_version5(); + logger14 = new Logger(version6); + LogDescription = class extends Description { + }; + TransactionDescription = class extends Description { + }; + ErrorDescription = class extends Description { + }; + Indexed = class extends Description { + static isIndexed(value) { + return !!(value && value._isIndexed); + } + }; + BuiltinErrors = { + "0x08c379a0": { signature: "Error(string)", name: "Error", inputs: ["string"], reason: true }, + "0x4e487b71": { signature: "Panic(uint256)", name: "Panic", inputs: ["uint256"] } + }; + Interface = class { + constructor(fragments) { + let abi = []; + if (typeof fragments === "string") { + abi = JSON.parse(fragments); + } else { + abi = fragments; + } + defineReadOnly(this, "fragments", abi.map((fragment) => { + return Fragment.from(fragment); + }).filter((fragment) => fragment != null)); + defineReadOnly(this, "_abiCoder", getStatic(new.target, "getAbiCoder")()); + defineReadOnly(this, "functions", {}); + defineReadOnly(this, "errors", {}); + defineReadOnly(this, "events", {}); + defineReadOnly(this, "structs", {}); + this.fragments.forEach((fragment) => { + let bucket = null; + switch (fragment.type) { + case "constructor": + if (this.deploy) { + logger14.warn("duplicate definition - constructor"); + return; + } + defineReadOnly(this, "deploy", fragment); + return; + case "function": + bucket = this.functions; + break; + case "event": + bucket = this.events; + break; + case "error": + bucket = this.errors; + break; + default: + return; + } + let signature2 = fragment.format(); + if (bucket[signature2]) { + logger14.warn("duplicate definition - " + signature2); + return; + } + bucket[signature2] = fragment; + }); + if (!this.deploy) { + defineReadOnly(this, "deploy", ConstructorFragment.from({ + payable: false, + type: "constructor" + })); + } + defineReadOnly(this, "_isInterface", true); + } + format(format) { + if (!format) { + format = FormatTypes.full; + } + if (format === FormatTypes.sighash) { + logger14.throwArgumentError("interface does not support formatting sighash", "format", format); + } + const abi = this.fragments.map((fragment) => fragment.format(format)); + if (format === FormatTypes.json) { + return JSON.stringify(abi.map((j) => JSON.parse(j))); + } + return abi; + } + // Sub-classes can override these to handle other blockchains + static getAbiCoder() { + return defaultAbiCoder; + } + static getAddress(address) { + return getAddress(address); + } + static getSighash(fragment) { + return hexDataSlice(id(fragment.format()), 0, 4); + } + static getEventTopic(eventFragment) { + return id(eventFragment.format()); + } + // Find a function definition by any means necessary (unless it is ambiguous) + getFunction(nameOrSignatureOrSighash) { + if (isHexString(nameOrSignatureOrSighash)) { + for (const name in this.functions) { + if (nameOrSignatureOrSighash === this.getSighash(name)) { + return this.functions[name]; + } + } + logger14.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); + } + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + const name = nameOrSignatureOrSighash.trim(); + const matching = Object.keys(this.functions).filter((f) => f.split( + "(" + /* fix:) */ + )[0] === name); + if (matching.length === 0) { + logger14.throwArgumentError("no matching function", "name", name); + } else if (matching.length > 1) { + logger14.throwArgumentError("multiple matching functions", "name", name); + } + return this.functions[matching[0]]; + } + const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()]; + if (!result) { + logger14.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); + } + return result; + } + // Find an event definition by any means necessary (unless it is ambiguous) + getEvent(nameOrSignatureOrTopic) { + if (isHexString(nameOrSignatureOrTopic)) { + const topichash = nameOrSignatureOrTopic.toLowerCase(); + for (const name in this.events) { + if (topichash === this.getEventTopic(name)) { + return this.events[name]; + } + } + logger14.throwArgumentError("no matching event", "topichash", topichash); + } + if (nameOrSignatureOrTopic.indexOf("(") === -1) { + const name = nameOrSignatureOrTopic.trim(); + const matching = Object.keys(this.events).filter((f) => f.split( + "(" + /* fix:) */ + )[0] === name); + if (matching.length === 0) { + logger14.throwArgumentError("no matching event", "name", name); + } else if (matching.length > 1) { + logger14.throwArgumentError("multiple matching events", "name", name); + } + return this.events[matching[0]]; + } + const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()]; + if (!result) { + logger14.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); + } + return result; + } + // Find a function definition by any means necessary (unless it is ambiguous) + getError(nameOrSignatureOrSighash) { + if (isHexString(nameOrSignatureOrSighash)) { + const getSighash = getStatic(this.constructor, "getSighash"); + for (const name in this.errors) { + const error = this.errors[name]; + if (nameOrSignatureOrSighash === getSighash(error)) { + return this.errors[name]; + } + } + logger14.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); + } + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + const name = nameOrSignatureOrSighash.trim(); + const matching = Object.keys(this.errors).filter((f) => f.split( + "(" + /* fix:) */ + )[0] === name); + if (matching.length === 0) { + logger14.throwArgumentError("no matching error", "name", name); + } else if (matching.length > 1) { + logger14.throwArgumentError("multiple matching errors", "name", name); + } + return this.errors[matching[0]]; + } + const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()]; + if (!result) { + logger14.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); + } + return result; + } + // Get the sighash (the bytes4 selector) used by Solidity to identify a function + getSighash(fragment) { + if (typeof fragment === "string") { + try { + fragment = this.getFunction(fragment); + } catch (error) { + try { + fragment = this.getError(fragment); + } catch (_) { + throw error; + } + } + } + return getStatic(this.constructor, "getSighash")(fragment); + } + // Get the topic (the bytes32 hash) used by Solidity to identify an event + getEventTopic(eventFragment) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + return getStatic(this.constructor, "getEventTopic")(eventFragment); + } + _decodeParams(params, data) { + return this._abiCoder.decode(params, data); + } + _encodeParams(params, values) { + return this._abiCoder.encode(params, values); + } + encodeDeploy(values) { + return this._encodeParams(this.deploy.inputs, values || []); + } + decodeErrorResult(fragment, data) { + if (typeof fragment === "string") { + fragment = this.getError(fragment); + } + const bytes = arrayify(data); + if (hexlify(bytes.slice(0, 4)) !== this.getSighash(fragment)) { + logger14.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify(bytes)); + } + return this._decodeParams(fragment.inputs, bytes.slice(4)); + } + encodeErrorResult(fragment, values) { + if (typeof fragment === "string") { + fragment = this.getError(fragment); + } + return hexlify(concat([ + this.getSighash(fragment), + this._encodeParams(fragment.inputs, values || []) + ])); + } + // Decode the data for a function call (e.g. tx.data) + decodeFunctionData(functionFragment, data) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + const bytes = arrayify(data); + if (hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { + logger14.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify(bytes)); + } + return this._decodeParams(functionFragment.inputs, bytes.slice(4)); + } + // Encode the data for a function call (e.g. tx.data) + encodeFunctionData(functionFragment, values) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + return hexlify(concat([ + this.getSighash(functionFragment), + this._encodeParams(functionFragment.inputs, values || []) + ])); + } + // Decode the result from a function call (e.g. from eth_call) + decodeFunctionResult(functionFragment, data) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + let bytes = arrayify(data); + let reason = null; + let message = ""; + let errorArgs = null; + let errorName = null; + let errorSignature = null; + switch (bytes.length % this._abiCoder._getWordSize()) { + case 0: + try { + return this._abiCoder.decode(functionFragment.outputs, bytes); + } catch (error) { + } + break; + case 4: { + const selector = hexlify(bytes.slice(0, 4)); + const builtin = BuiltinErrors[selector]; + if (builtin) { + errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4)); + errorName = builtin.name; + errorSignature = builtin.signature; + if (builtin.reason) { + reason = errorArgs[0]; + } + if (errorName === "Error") { + message = `; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(errorArgs[0])}`; + } else if (errorName === "Panic") { + message = `; VM Exception while processing transaction: reverted with panic code ${errorArgs[0]}`; + } + } else { + try { + const error = this.getError(selector); + errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4)); + errorName = error.name; + errorSignature = error.format(); + } catch (error) { + } + } + break; + } + } + return logger14.throwError("call revert exception" + message, Logger.errors.CALL_EXCEPTION, { + method: functionFragment.format(), + data: hexlify(data), + errorArgs, + errorName, + errorSignature, + reason + }); + } + // Encode the result for a function call (e.g. for eth_call) + encodeFunctionResult(functionFragment, values) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + return hexlify(this._abiCoder.encode(functionFragment.outputs, values || [])); + } + // Create the filter for the event with search criteria (e.g. for eth_filterLog) + encodeFilterTopics(eventFragment, values) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + if (values.length > eventFragment.inputs.length) { + logger14.throwError("too many arguments for " + eventFragment.format(), Logger.errors.UNEXPECTED_ARGUMENT, { + argument: "values", + value: values + }); + } + let topics = []; + if (!eventFragment.anonymous) { + topics.push(this.getEventTopic(eventFragment)); + } + const encodeTopic = (param, value) => { + if (param.type === "string") { + return id(value); + } else if (param.type === "bytes") { + return keccak256(hexlify(value)); + } + if (param.type === "bool" && typeof value === "boolean") { + value = value ? "0x01" : "0x00"; + } + if (param.type.match(/^u?int/)) { + value = BigNumber.from(value).toHexString(); + } + if (param.type === "address") { + this._abiCoder.encode(["address"], [value]); + } + return hexZeroPad(hexlify(value), 32); + }; + values.forEach((value, index) => { + let param = eventFragment.inputs[index]; + if (!param.indexed) { + if (value != null) { + logger14.throwArgumentError("cannot filter non-indexed parameters; must be null", "contract." + param.name, value); + } + return; + } + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + logger14.throwArgumentError("filtering with tuples or arrays not supported", "contract." + param.name, value); + } else if (Array.isArray(value)) { + topics.push(value.map((value2) => encodeTopic(param, value2))); + } else { + topics.push(encodeTopic(param, value)); + } + }); + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + } + encodeEventLog(eventFragment, values) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + const topics = []; + const dataTypes = []; + const dataValues = []; + if (!eventFragment.anonymous) { + topics.push(this.getEventTopic(eventFragment)); + } + if (values.length !== eventFragment.inputs.length) { + logger14.throwArgumentError("event arguments/values mismatch", "values", values); + } + eventFragment.inputs.forEach((param, index) => { + const value = values[index]; + if (param.indexed) { + if (param.type === "string") { + topics.push(id(value)); + } else if (param.type === "bytes") { + topics.push(keccak256(value)); + } else if (param.baseType === "tuple" || param.baseType === "array") { + throw new Error("not implemented"); + } else { + topics.push(this._abiCoder.encode([param.type], [value])); + } + } else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this._abiCoder.encode(dataTypes, dataValues), + topics + }; + } + // Decode a filter for the event and the search criteria + decodeEventLog(eventFragment, data, topics) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + if (topics != null && !eventFragment.anonymous) { + let topicHash = this.getEventTopic(eventFragment); + if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) { + logger14.throwError("fragment/topic mismatch", Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] }); + } + topics = topics.slice(1); + } + let indexed = []; + let nonIndexed = []; + let dynamic = []; + eventFragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { + indexed.push(ParamType.fromObject({ type: "bytes32", name: param.name })); + dynamic.push(true); + } else { + indexed.push(param); + dynamic.push(false); + } + } else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + let resultIndexed = topics != null ? this._abiCoder.decode(indexed, concat(topics)) : null; + let resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true); + let result = []; + let nonIndexedIndex = 0, indexedIndex = 0; + eventFragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (resultIndexed == null) { + result[index] = new Indexed({ _isIndexed: true, hash: null }); + } else if (dynamic[index]) { + result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] }); + } else { + try { + result[index] = resultIndexed[indexedIndex++]; + } catch (error) { + result[index] = error; + } + } + } else { + try { + result[index] = resultNonIndexed[nonIndexedIndex++]; + } catch (error) { + result[index] = error; + } + } + if (param.name && result[param.name] == null) { + const value = result[index]; + if (value instanceof Error) { + Object.defineProperty(result, param.name, { + enumerable: true, + get: () => { + throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value); + } + }); + } else { + result[param.name] = value; + } + } + }); + for (let i2 = 0; i2 < result.length; i2++) { + const value = result[i2]; + if (value instanceof Error) { + Object.defineProperty(result, i2, { + enumerable: true, + get: () => { + throw wrapAccessError(`index ${i2}`, value); + } + }); + } + } + return Object.freeze(result); + } + // Given a transaction, find the matching function fragment (if any) and + // determine all its properties and call parameters + parseTransaction(tx) { + let fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase()); + if (!fragment) { + return null; + } + return new TransactionDescription({ + args: this._abiCoder.decode(fragment.inputs, "0x" + tx.data.substring(10)), + functionFragment: fragment, + name: fragment.name, + signature: fragment.format(), + sighash: this.getSighash(fragment), + value: BigNumber.from(tx.value || "0") + }); + } + // @TODO + //parseCallResult(data: BytesLike): ?? + // Given an event log, find the matching event fragment (if any) and + // determine all its properties and values + parseLog(log3) { + let fragment = this.getEvent(log3.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + return new LogDescription({ + eventFragment: fragment, + name: fragment.name, + signature: fragment.format(), + topic: this.getEventTopic(fragment), + args: this.decodeEventLog(fragment, log3.data, log3.topics) + }); + } + parseError(data) { + const hexData = hexlify(data); + let fragment = this.getError(hexData.substring(0, 10).toLowerCase()); + if (!fragment) { + return null; + } + return new ErrorDescription({ + args: this._abiCoder.decode(fragment.inputs, "0x" + hexData.substring(10)), + errorFragment: fragment, + name: fragment.name, + signature: fragment.format(), + sighash: this.getSighash(fragment) + }); + } + /* + static from(value: Array | string | Interface) { + if (Interface.isInterface(value)) { + return value; + } + if (typeof(value) === "string") { + return new Interface(JSON.parse(value)); + } + return new Interface(value); + } + */ + static isInterface(value) { + return !!(value && value._isInterface); + } + }; + } +}); + +// node_modules/@ethersproject/abi/lib.esm/index.js +var lib_exports11 = {}; +__export(lib_exports11, { + AbiCoder: () => AbiCoder, + ConstructorFragment: () => ConstructorFragment, + ErrorFragment: () => ErrorFragment, + EventFragment: () => EventFragment, + FormatTypes: () => FormatTypes, + Fragment: () => Fragment, + FunctionFragment: () => FunctionFragment, + Indexed: () => Indexed, + Interface: () => Interface, + LogDescription: () => LogDescription, + ParamType: () => ParamType, + TransactionDescription: () => TransactionDescription, + checkResultErrors: () => checkResultErrors, + defaultAbiCoder: () => defaultAbiCoder +}); +var init_lib13 = __esm({ + "node_modules/@ethersproject/abi/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_fragments(); + init_abi_coder(); + init_interface(); + } +}); + +// node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +var version11; +var init_version10 = __esm({ + "node_modules/@ethersproject/abstract-provider/lib.esm/_version.js"() { + init_shim(); + version11 = "abstract-provider/5.7.0"; + } +}); + +// node_modules/@ethersproject/abstract-provider/lib.esm/index.js +var __awaiter3, logger15, ForkEvent, Provider; +var init_lib14 = __esm({ + "node_modules/@ethersproject/abstract-provider/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib3(); + init_lib4(); + init_lib(); + init_version10(); + __awaiter3 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + logger15 = new Logger(version11); + ForkEvent = class extends Description { + static isForkEvent(value) { + return !!(value && value._isForkEvent); + } + }; + Provider = class { + constructor() { + logger15.checkAbstract(new.target, Provider); + defineReadOnly(this, "_isProvider", true); + } + getFeeData() { + return __awaiter3(this, void 0, void 0, function* () { + const { block, gasPrice } = yield resolveProperties({ + block: this.getBlock("latest"), + gasPrice: this.getGasPrice().catch((error) => { + return null; + }) + }); + let lastBaseFeePerGas = null, maxFeePerGas = null, maxPriorityFeePerGas = null; + if (block && block.baseFeePerGas) { + lastBaseFeePerGas = block.baseFeePerGas; + maxPriorityFeePerGas = BigNumber.from("1500000000"); + maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); + } + return { lastBaseFeePerGas, maxFeePerGas, maxPriorityFeePerGas, gasPrice }; + }); + } + // Alias for "on" + addListener(eventName, listener) { + return this.on(eventName, listener); + } + // Alias for "off" + removeListener(eventName, listener) { + return this.off(eventName, listener); + } + static isProvider(value) { + return !!(value && value._isProvider); + } + }; + } +}); + +// node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +var version12; +var init_version11 = __esm({ + "node_modules/@ethersproject/abstract-signer/lib.esm/_version.js"() { + init_shim(); + version12 = "abstract-signer/5.7.0"; + } +}); + +// node_modules/@ethersproject/abstract-signer/lib.esm/index.js +var __awaiter4, logger16, allowedTransactionKeys, forwardErrors, Signer, VoidSigner; +var init_lib15 = __esm({ + "node_modules/@ethersproject/abstract-signer/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib4(); + init_lib(); + init_version11(); + __awaiter4 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + logger16 = new Logger(version12); + allowedTransactionKeys = [ + "accessList", + "ccipReadEnabled", + "chainId", + "customData", + "data", + "from", + "gasLimit", + "gasPrice", + "maxFeePerGas", + "maxPriorityFeePerGas", + "nonce", + "to", + "type", + "value" + ]; + forwardErrors = [ + Logger.errors.INSUFFICIENT_FUNDS, + Logger.errors.NONCE_EXPIRED, + Logger.errors.REPLACEMENT_UNDERPRICED + ]; + Signer = class { + /////////////////// + // Sub-classes MUST call super + constructor() { + logger16.checkAbstract(new.target, Signer); + defineReadOnly(this, "_isSigner", true); + } + /////////////////// + // Sub-classes MAY override these + getBalance(blockTag) { + return __awaiter4(this, void 0, void 0, function* () { + this._checkProvider("getBalance"); + return yield this.provider.getBalance(this.getAddress(), blockTag); + }); + } + getTransactionCount(blockTag) { + return __awaiter4(this, void 0, void 0, function* () { + this._checkProvider("getTransactionCount"); + return yield this.provider.getTransactionCount(this.getAddress(), blockTag); + }); + } + // Populates "from" if unspecified, and estimates the gas for the transaction + estimateGas(transaction) { + return __awaiter4(this, void 0, void 0, function* () { + this._checkProvider("estimateGas"); + const tx = yield resolveProperties(this.checkTransaction(transaction)); + return yield this.provider.estimateGas(tx); + }); + } + // Populates "from" if unspecified, and calls with the transaction + call(transaction, blockTag) { + return __awaiter4(this, void 0, void 0, function* () { + this._checkProvider("call"); + const tx = yield resolveProperties(this.checkTransaction(transaction)); + return yield this.provider.call(tx, blockTag); + }); + } + // Populates all fields in a transaction, signs it and sends it to the network + sendTransaction(transaction) { + return __awaiter4(this, void 0, void 0, function* () { + this._checkProvider("sendTransaction"); + const tx = yield this.populateTransaction(transaction); + const signedTx = yield this.signTransaction(tx); + return yield this.provider.sendTransaction(signedTx); + }); + } + getChainId() { + return __awaiter4(this, void 0, void 0, function* () { + this._checkProvider("getChainId"); + const network = yield this.provider.getNetwork(); + return network.chainId; + }); + } + getGasPrice() { + return __awaiter4(this, void 0, void 0, function* () { + this._checkProvider("getGasPrice"); + return yield this.provider.getGasPrice(); + }); + } + getFeeData() { + return __awaiter4(this, void 0, void 0, function* () { + this._checkProvider("getFeeData"); + return yield this.provider.getFeeData(); + }); + } + resolveName(name) { + return __awaiter4(this, void 0, void 0, function* () { + this._checkProvider("resolveName"); + return yield this.provider.resolveName(name); + }); + } + // Checks a transaction does not contain invalid keys and if + // no "from" is provided, populates it. + // - does NOT require a provider + // - adds "from" is not present + // - returns a COPY (safe to mutate the result) + // By default called from: (overriding these prevents it) + // - call + // - estimateGas + // - populateTransaction (and therefor sendTransaction) + checkTransaction(transaction) { + for (const key2 in transaction) { + if (allowedTransactionKeys.indexOf(key2) === -1) { + logger16.throwArgumentError("invalid transaction key: " + key2, "transaction", transaction); + } + } + const tx = shallowCopy(transaction); + if (tx.from == null) { + tx.from = this.getAddress(); + } else { + tx.from = Promise.all([ + Promise.resolve(tx.from), + this.getAddress() + ]).then((result) => { + if (result[0].toLowerCase() !== result[1].toLowerCase()) { + logger16.throwArgumentError("from address mismatch", "transaction", transaction); + } + return result[0]; + }); + } + return tx; + } + // Populates ALL keys for a transaction and checks that "from" matches + // this Signer. Should be used by sendTransaction but NOT by signTransaction. + // By default called from: (overriding these prevents it) + // - sendTransaction + // + // Notes: + // - We allow gasPrice for EIP-1559 as long as it matches maxFeePerGas + populateTransaction(transaction) { + return __awaiter4(this, void 0, void 0, function* () { + const tx = yield resolveProperties(this.checkTransaction(transaction)); + if (tx.to != null) { + tx.to = Promise.resolve(tx.to).then((to) => __awaiter4(this, void 0, void 0, function* () { + if (to == null) { + return null; + } + const address = yield this.resolveName(to); + if (address == null) { + logger16.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + return address; + })); + tx.to.catch((error) => { + }); + } + const hasEip1559 = tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null; + if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) { + logger16.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction); + } else if ((tx.type === 0 || tx.type === 1) && hasEip1559) { + logger16.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "transaction", transaction); + } + if ((tx.type === 2 || tx.type == null) && (tx.maxFeePerGas != null && tx.maxPriorityFeePerGas != null)) { + tx.type = 2; + } else if (tx.type === 0 || tx.type === 1) { + if (tx.gasPrice == null) { + tx.gasPrice = this.getGasPrice(); + } + } else { + const feeData = yield this.getFeeData(); + if (tx.type == null) { + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + tx.type = 2; + if (tx.gasPrice != null) { + const gasPrice = tx.gasPrice; + delete tx.gasPrice; + tx.maxFeePerGas = gasPrice; + tx.maxPriorityFeePerGas = gasPrice; + } else { + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } else if (feeData.gasPrice != null) { + if (hasEip1559) { + logger16.throwError("network does not support EIP-1559", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "populateTransaction" + }); + } + if (tx.gasPrice == null) { + tx.gasPrice = feeData.gasPrice; + } + tx.type = 0; + } else { + logger16.throwError("failed to get consistent fee data", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "signer.getFeeData" + }); + } + } else if (tx.type === 2) { + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + if (tx.nonce == null) { + tx.nonce = this.getTransactionCount("pending"); + } + if (tx.gasLimit == null) { + tx.gasLimit = this.estimateGas(tx).catch((error) => { + if (forwardErrors.indexOf(error.code) >= 0) { + throw error; + } + return logger16.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + tx + }); + }); + } + if (tx.chainId == null) { + tx.chainId = this.getChainId(); + } else { + tx.chainId = Promise.all([ + Promise.resolve(tx.chainId), + this.getChainId() + ]).then((results) => { + if (results[1] !== 0 && results[0] !== results[1]) { + logger16.throwArgumentError("chainId address mismatch", "transaction", transaction); + } + return results[0]; + }); + } + return yield resolveProperties(tx); + }); + } + /////////////////// + // Sub-classes SHOULD leave these alone + _checkProvider(operation) { + if (!this.provider) { + logger16.throwError("missing provider", Logger.errors.UNSUPPORTED_OPERATION, { + operation: operation || "_checkProvider" + }); + } + } + static isSigner(value) { + return !!(value && value._isSigner); + } + }; + VoidSigner = class extends Signer { + constructor(address, provider) { + super(); + defineReadOnly(this, "address", address); + defineReadOnly(this, "provider", provider || null); + } + getAddress() { + return Promise.resolve(this.address); + } + _fail(message, operation) { + return Promise.resolve().then(() => { + logger16.throwError(message, Logger.errors.UNSUPPORTED_OPERATION, { operation }); + }); + } + signMessage(message) { + return this._fail("VoidSigner cannot sign messages", "signMessage"); + } + signTransaction(transaction) { + return this._fail("VoidSigner cannot sign transactions", "signTransaction"); + } + _signTypedData(domain, types, value) { + return this._fail("VoidSigner cannot sign typed data", "signTypedData"); + } + connect(provider) { + return new VoidSigner(this.address, provider); + } + }; + } +}); + +// node_modules/@ethersproject/signing-key/node_modules/bn.js/lib/bn.js +var require_bn2 = __commonJS({ + "node_modules/@ethersproject/signing-key/node_modules/bn.js/lib/bn.js"(exports, module2) { + init_shim(); + (function(module3, exports2) { + "use strict"; + function assert2(val, msg) { + if (!val) + throw new Error(msg || "Assertion failed"); + } + function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + function BN3(number, base2, endian) { + if (BN3.isBN(number)) { + return number; + } + this.negative = 0; + this.words = null; + this.length = 0; + this.red = null; + if (number !== null) { + if (base2 === "le" || base2 === "be") { + endian = base2; + base2 = 10; + } + this._init(number || 0, base2 || 10, endian || "be"); + } + } + if (typeof module3 === "object") { + module3.exports = BN3; + } else { + exports2.BN = BN3; + } + BN3.BN = BN3; + BN3.wordSize = 26; + var Buffer4; + try { + if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") { + Buffer4 = window.Buffer; + } else { + Buffer4 = __require("buffer").Buffer; + } + } catch (e2) { + } + BN3.isBN = function isBN(num) { + if (num instanceof BN3) { + return true; + } + return num !== null && typeof num === "object" && num.constructor.wordSize === BN3.wordSize && Array.isArray(num.words); + }; + BN3.max = function max(left, right) { + if (left.cmp(right) > 0) + return left; + return right; + }; + BN3.min = function min(left, right) { + if (left.cmp(right) < 0) + return left; + return right; + }; + BN3.prototype._init = function init2(number, base2, endian) { + if (typeof number === "number") { + return this._initNumber(number, base2, endian); + } + if (typeof number === "object") { + return this._initArray(number, base2, endian); + } + if (base2 === "hex") { + base2 = 16; + } + assert2(base2 === (base2 | 0) && base2 >= 2 && base2 <= 36); + number = number.toString().replace(/\s+/g, ""); + var start = 0; + if (number[0] === "-") { + start++; + this.negative = 1; + } + if (start < number.length) { + if (base2 === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base2, start); + if (endian === "le") { + this._initArray(this.toArray(), base2, endian); + } + } + } + }; + BN3.prototype._initNumber = function _initNumber(number, base2, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 67108864) { + this.words = [number & 67108863]; + this.length = 1; + } else if (number < 4503599627370496) { + this.words = [ + number & 67108863, + number / 67108864 & 67108863 + ]; + this.length = 2; + } else { + assert2(number < 9007199254740992); + this.words = [ + number & 67108863, + number / 67108864 & 67108863, + 1 + ]; + this.length = 3; + } + if (endian !== "le") + return; + this._initArray(this.toArray(), base2, endian); + }; + BN3.prototype._initArray = function _initArray(number, base2, endian) { + assert2(typeof number.length === "number"); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i2 = 0; i2 < this.length; i2++) { + this.words[i2] = 0; + } + var j, w; + var off = 0; + if (endian === "be") { + for (i2 = number.length - 1, j = 0; i2 >= 0; i2 -= 3) { + w = number[i2] | number[i2 - 1] << 8 | number[i2 - 2] << 16; + this.words[j] |= w << off & 67108863; + this.words[j + 1] = w >>> 26 - off & 67108863; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === "le") { + for (i2 = 0, j = 0; i2 < number.length; i2 += 3) { + w = number[i2] | number[i2 + 1] << 8 | number[i2 + 2] << 16; + this.words[j] |= w << off & 67108863; + this.words[j + 1] = w >>> 26 - off & 67108863; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this._strip(); + }; + function parseHex4Bits(string, index) { + var c = string.charCodeAt(index); + if (c >= 48 && c <= 57) { + return c - 48; + } else if (c >= 65 && c <= 70) { + return c - 55; + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + assert2(false, "Invalid character in " + string); + } + } + function parseHexByte(string, lowerBound, index) { + var r3 = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r3 |= parseHex4Bits(string, index - 1) << 4; + } + return r3; + } + BN3.prototype._parseHex = function _parseHex(number, start, endian) { + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i2 = 0; i2 < this.length; i2++) { + this.words[i2] = 0; + } + var off = 0; + var j = 0; + var w; + if (endian === "be") { + for (i2 = number.length - 1; i2 >= start; i2 -= 2) { + w = parseHexByte(number, start, i2) << off; + this.words[j] |= w & 67108863; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i2 = parseLength % 2 === 0 ? start + 1 : start; i2 < number.length; i2 += 2) { + w = parseHexByte(number, start, i2) << off; + this.words[j] |= w & 67108863; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + this._strip(); + }; + function parseBase(str, start, end, mul3) { + var r3 = 0; + var b = 0; + var len = Math.min(str.length, end); + for (var i2 = start; i2 < len; i2++) { + var c = str.charCodeAt(i2) - 48; + r3 *= mul3; + if (c >= 49) { + b = c - 49 + 10; + } else if (c >= 17) { + b = c - 17 + 10; + } else { + b = c; + } + assert2(c >= 0 && b < mul3, "Invalid character"); + r3 += b; + } + return r3; + } + BN3.prototype._parseBase = function _parseBase(number, base2, start) { + this.words = [0]; + this.length = 1; + for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base2) { + limbLen++; + } + limbLen--; + limbPow = limbPow / base2 | 0; + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + var word = 0; + for (var i2 = start; i2 < end; i2 += limbLen) { + word = parseBase(number, i2, i2 + limbLen, base2); + this.imuln(limbPow); + if (this.words[0] + word < 67108864) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i2, number.length, base2); + for (i2 = 0; i2 < mod; i2++) { + pow *= base2; + } + this.imuln(pow); + if (this.words[0] + word < 67108864) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + this._strip(); + }; + BN3.prototype.copy = function copy(dest) { + dest.words = new Array(this.length); + for (var i2 = 0; i2 < this.length; i2++) { + dest.words[i2] = this.words[i2]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + function move(dest, src) { + dest.words = src.words; + dest.length = src.length; + dest.negative = src.negative; + dest.red = src.red; + } + BN3.prototype._move = function _move(dest) { + move(dest, this); + }; + BN3.prototype.clone = function clone() { + var r3 = new BN3(null); + this.copy(r3); + return r3; + }; + BN3.prototype._expand = function _expand(size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + BN3.prototype._strip = function strip() { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + BN3.prototype._normSign = function _normSign() { + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + if (typeof Symbol !== "undefined" && typeof Symbol.for === "function") { + try { + BN3.prototype[Symbol.for("nodejs.util.inspect.custom")] = inspect4; + } catch (e2) { + BN3.prototype.inspect = inspect4; + } + } else { + BN3.prototype.inspect = inspect4; + } + function inspect4() { + return (this.red ? ""; + } + var zeros2 = [ + "", + "0", + "00", + "000", + "0000", + "00000", + "000000", + "0000000", + "00000000", + "000000000", + "0000000000", + "00000000000", + "000000000000", + "0000000000000", + "00000000000000", + "000000000000000", + "0000000000000000", + "00000000000000000", + "000000000000000000", + "0000000000000000000", + "00000000000000000000", + "000000000000000000000", + "0000000000000000000000", + "00000000000000000000000", + "000000000000000000000000", + "0000000000000000000000000" + ]; + var groupSizes = [ + 0, + 0, + 25, + 16, + 12, + 11, + 10, + 9, + 8, + 8, + 7, + 7, + 7, + 7, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5 + ]; + var groupBases = [ + 0, + 0, + 33554432, + 43046721, + 16777216, + 48828125, + 60466176, + 40353607, + 16777216, + 43046721, + 1e7, + 19487171, + 35831808, + 62748517, + 7529536, + 11390625, + 16777216, + 24137569, + 34012224, + 47045881, + 64e6, + 4084101, + 5153632, + 6436343, + 7962624, + 9765625, + 11881376, + 14348907, + 17210368, + 20511149, + 243e5, + 28629151, + 33554432, + 39135393, + 45435424, + 52521875, + 60466176 + ]; + BN3.prototype.toString = function toString2(base2, padding2) { + base2 = base2 || 10; + padding2 = padding2 | 0 || 1; + var out; + if (base2 === 16 || base2 === "hex") { + out = ""; + var off = 0; + var carry = 0; + for (var i2 = 0; i2 < this.length; i2++) { + var w = this.words[i2]; + var word = ((w << off | carry) & 16777215).toString(16); + carry = w >>> 24 - off & 16777215; + off += 2; + if (off >= 26) { + off -= 26; + i2--; + } + if (carry !== 0 || i2 !== this.length - 1) { + out = zeros2[6 - word.length] + word + out; + } else { + out = word + out; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding2 !== 0) { + out = "0" + out; + } + if (this.negative !== 0) { + out = "-" + out; + } + return out; + } + if (base2 === (base2 | 0) && base2 >= 2 && base2 <= 36) { + var groupSize = groupSizes[base2]; + var groupBase = groupBases[base2]; + out = ""; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r3 = c.modrn(groupBase).toString(base2); + c = c.idivn(groupBase); + if (!c.isZero()) { + out = zeros2[groupSize - r3.length] + r3 + out; + } else { + out = r3 + out; + } + } + if (this.isZero()) { + out = "0" + out; + } + while (out.length % padding2 !== 0) { + out = "0" + out; + } + if (this.negative !== 0) { + out = "-" + out; + } + return out; + } + assert2(false, "Base should be between 2 and 36"); + }; + BN3.prototype.toNumber = function toNumber() { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 67108864; + } else if (this.length === 3 && this.words[2] === 1) { + ret += 4503599627370496 + this.words[1] * 67108864; + } else if (this.length > 2) { + assert2(false, "Number can only safely store up to 53 bits"); + } + return this.negative !== 0 ? -ret : ret; + }; + BN3.prototype.toJSON = function toJSON2() { + return this.toString(16, 2); + }; + if (Buffer4) { + BN3.prototype.toBuffer = function toBuffer(endian, length) { + return this.toArrayLike(Buffer4, endian, length); + }; + } + BN3.prototype.toArray = function toArray(endian, length) { + return this.toArrayLike(Array, endian, length); + }; + var allocate = function allocate2(ArrayType, size) { + if (ArrayType.allocUnsafe) { + return ArrayType.allocUnsafe(size); + } + return new ArrayType(size); + }; + BN3.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) { + this._strip(); + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert2(byteLength <= reqLength, "byte array longer than desired length"); + assert2(reqLength > 0, "Requested array length <= 0"); + var res = allocate(ArrayType, reqLength); + var postfix = endian === "le" ? "LE" : "BE"; + this["_toArrayLike" + postfix](res, byteLength); + return res; + }; + BN3.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) { + var position = 0; + var carry = 0; + for (var i2 = 0, shift = 0; i2 < this.length; i2++) { + var word = this.words[i2] << shift | carry; + res[position++] = word & 255; + if (position < res.length) { + res[position++] = word >> 8 & 255; + } + if (position < res.length) { + res[position++] = word >> 16 & 255; + } + if (shift === 6) { + if (position < res.length) { + res[position++] = word >> 24 & 255; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + if (position < res.length) { + res[position++] = carry; + while (position < res.length) { + res[position++] = 0; + } + } + }; + BN3.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) { + var position = res.length - 1; + var carry = 0; + for (var i2 = 0, shift = 0; i2 < this.length; i2++) { + var word = this.words[i2] << shift | carry; + res[position--] = word & 255; + if (position >= 0) { + res[position--] = word >> 8 & 255; + } + if (position >= 0) { + res[position--] = word >> 16 & 255; + } + if (shift === 6) { + if (position >= 0) { + res[position--] = word >> 24 & 255; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + if (position >= 0) { + res[position--] = carry; + while (position >= 0) { + res[position--] = 0; + } + } + }; + if (Math.clz32) { + BN3.prototype._countBits = function _countBits(w) { + return 32 - Math.clz32(w); + }; + } else { + BN3.prototype._countBits = function _countBits(w) { + var t2 = w; + var r3 = 0; + if (t2 >= 4096) { + r3 += 13; + t2 >>>= 13; + } + if (t2 >= 64) { + r3 += 7; + t2 >>>= 7; + } + if (t2 >= 8) { + r3 += 4; + t2 >>>= 4; + } + if (t2 >= 2) { + r3 += 2; + t2 >>>= 2; + } + return r3 + t2; + }; + } + BN3.prototype._zeroBits = function _zeroBits(w) { + if (w === 0) + return 26; + var t2 = w; + var r3 = 0; + if ((t2 & 8191) === 0) { + r3 += 13; + t2 >>>= 13; + } + if ((t2 & 127) === 0) { + r3 += 7; + t2 >>>= 7; + } + if ((t2 & 15) === 0) { + r3 += 4; + t2 >>>= 4; + } + if ((t2 & 3) === 0) { + r3 += 2; + t2 >>>= 2; + } + if ((t2 & 1) === 0) { + r3++; + } + return r3; + }; + BN3.prototype.bitLength = function bitLength() { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + function toBitArray(num) { + var w = new Array(num.bitLength()); + for (var bit = 0; bit < w.length; bit++) { + var off = bit / 26 | 0; + var wbit = bit % 26; + w[bit] = num.words[off] >>> wbit & 1; + } + return w; + } + BN3.prototype.zeroBits = function zeroBits() { + if (this.isZero()) + return 0; + var r3 = 0; + for (var i2 = 0; i2 < this.length; i2++) { + var b = this._zeroBits(this.words[i2]); + r3 += b; + if (b !== 26) + break; + } + return r3; + }; + BN3.prototype.byteLength = function byteLength() { + return Math.ceil(this.bitLength() / 8); + }; + BN3.prototype.toTwos = function toTwos(width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + BN3.prototype.fromTwos = function fromTwos(width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + BN3.prototype.isNeg = function isNeg() { + return this.negative !== 0; + }; + BN3.prototype.neg = function neg3() { + return this.clone().ineg(); + }; + BN3.prototype.ineg = function ineg() { + if (!this.isZero()) { + this.negative ^= 1; + } + return this; + }; + BN3.prototype.iuor = function iuor(num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + for (var i2 = 0; i2 < num.length; i2++) { + this.words[i2] = this.words[i2] | num.words[i2]; + } + return this._strip(); + }; + BN3.prototype.ior = function ior(num) { + assert2((this.negative | num.negative) === 0); + return this.iuor(num); + }; + BN3.prototype.or = function or(num) { + if (this.length > num.length) + return this.clone().ior(num); + return num.clone().ior(this); + }; + BN3.prototype.uor = function uor(num) { + if (this.length > num.length) + return this.clone().iuor(num); + return num.clone().iuor(this); + }; + BN3.prototype.iuand = function iuand(num) { + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + for (var i2 = 0; i2 < b.length; i2++) { + this.words[i2] = this.words[i2] & num.words[i2]; + } + this.length = b.length; + return this._strip(); + }; + BN3.prototype.iand = function iand(num) { + assert2((this.negative | num.negative) === 0); + return this.iuand(num); + }; + BN3.prototype.and = function and(num) { + if (this.length > num.length) + return this.clone().iand(num); + return num.clone().iand(this); + }; + BN3.prototype.uand = function uand(num) { + if (this.length > num.length) + return this.clone().iuand(num); + return num.clone().iuand(this); + }; + BN3.prototype.iuxor = function iuxor(num) { + var a2; + var b; + if (this.length > num.length) { + a2 = this; + b = num; + } else { + a2 = num; + b = this; + } + for (var i2 = 0; i2 < b.length; i2++) { + this.words[i2] = a2.words[i2] ^ b.words[i2]; + } + if (this !== a2) { + for (; i2 < a2.length; i2++) { + this.words[i2] = a2.words[i2]; + } + } + this.length = a2.length; + return this._strip(); + }; + BN3.prototype.ixor = function ixor(num) { + assert2((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + BN3.prototype.xor = function xor(num) { + if (this.length > num.length) + return this.clone().ixor(num); + return num.clone().ixor(this); + }; + BN3.prototype.uxor = function uxor(num) { + if (this.length > num.length) + return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + BN3.prototype.inotn = function inotn(width) { + assert2(typeof width === "number" && width >= 0); + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + this._expand(bytesNeeded); + if (bitsLeft > 0) { + bytesNeeded--; + } + for (var i2 = 0; i2 < bytesNeeded; i2++) { + this.words[i2] = ~this.words[i2] & 67108863; + } + if (bitsLeft > 0) { + this.words[i2] = ~this.words[i2] & 67108863 >> 26 - bitsLeft; + } + return this._strip(); + }; + BN3.prototype.notn = function notn(width) { + return this.clone().inotn(width); + }; + BN3.prototype.setn = function setn(bit, val) { + assert2(typeof bit === "number" && bit >= 0); + var off = bit / 26 | 0; + var wbit = bit % 26; + this._expand(off + 1); + if (val) { + this.words[off] = this.words[off] | 1 << wbit; + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + return this._strip(); + }; + BN3.prototype.iadd = function iadd(num) { + var r3; + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r3 = this.isub(num); + this.negative ^= 1; + return this._normSign(); + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r3 = this.isub(num); + num.negative = 1; + return r3._normSign(); + } + var a2, b; + if (this.length > num.length) { + a2 = this; + b = num; + } else { + a2 = num; + b = this; + } + var carry = 0; + for (var i2 = 0; i2 < b.length; i2++) { + r3 = (a2.words[i2] | 0) + (b.words[i2] | 0) + carry; + this.words[i2] = r3 & 67108863; + carry = r3 >>> 26; + } + for (; carry !== 0 && i2 < a2.length; i2++) { + r3 = (a2.words[i2] | 0) + carry; + this.words[i2] = r3 & 67108863; + carry = r3 >>> 26; + } + this.length = a2.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + } else if (a2 !== this) { + for (; i2 < a2.length; i2++) { + this.words[i2] = a2.words[i2]; + } + } + return this; + }; + BN3.prototype.add = function add5(num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + if (this.length > num.length) + return this.clone().iadd(num); + return num.clone().iadd(this); + }; + BN3.prototype.isub = function isub(num) { + if (num.negative !== 0) { + num.negative = 0; + var r3 = this.iadd(num); + num.negative = 1; + return r3._normSign(); + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + var cmp = this.cmp(num); + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + var a2, b; + if (cmp > 0) { + a2 = this; + b = num; + } else { + a2 = num; + b = this; + } + var carry = 0; + for (var i2 = 0; i2 < b.length; i2++) { + r3 = (a2.words[i2] | 0) - (b.words[i2] | 0) + carry; + carry = r3 >> 26; + this.words[i2] = r3 & 67108863; + } + for (; carry !== 0 && i2 < a2.length; i2++) { + r3 = (a2.words[i2] | 0) + carry; + carry = r3 >> 26; + this.words[i2] = r3 & 67108863; + } + if (carry === 0 && i2 < a2.length && a2 !== this) { + for (; i2 < a2.length; i2++) { + this.words[i2] = a2.words[i2]; + } + } + this.length = Math.max(this.length, i2); + if (a2 !== this) { + this.negative = 1; + } + return this._strip(); + }; + BN3.prototype.sub = function sub(num) { + return this.clone().isub(num); + }; + function smallMulTo(self2, num, out) { + out.negative = num.negative ^ self2.negative; + var len = self2.length + num.length | 0; + out.length = len; + len = len - 1 | 0; + var a2 = self2.words[0] | 0; + var b = num.words[0] | 0; + var r3 = a2 * b; + var lo = r3 & 67108863; + var carry = r3 / 67108864 | 0; + out.words[0] = lo; + for (var k = 1; k < len; k++) { + var ncarry = carry >>> 26; + var rword = carry & 67108863; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) { + var i2 = k - j | 0; + a2 = self2.words[i2] | 0; + b = num.words[j] | 0; + r3 = a2 * b + rword; + ncarry += r3 / 67108864 | 0; + rword = r3 & 67108863; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + return out._strip(); + } + var comb10MulTo = function comb10MulTo2(self2, num, out) { + var a2 = self2.words; + var b = num.words; + var o2 = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a2[0] | 0; + var al0 = a0 & 8191; + var ah0 = a0 >>> 13; + var a1 = a2[1] | 0; + var al1 = a1 & 8191; + var ah1 = a1 >>> 13; + var a22 = a2[2] | 0; + var al2 = a22 & 8191; + var ah2 = a22 >>> 13; + var a3 = a2[3] | 0; + var al3 = a3 & 8191; + var ah3 = a3 >>> 13; + var a4 = a2[4] | 0; + var al4 = a4 & 8191; + var ah4 = a4 >>> 13; + var a5 = a2[5] | 0; + var al5 = a5 & 8191; + var ah5 = a5 >>> 13; + var a6 = a2[6] | 0; + var al6 = a6 & 8191; + var ah6 = a6 >>> 13; + var a7 = a2[7] | 0; + var al7 = a7 & 8191; + var ah7 = a7 >>> 13; + var a8 = a2[8] | 0; + var al8 = a8 & 8191; + var ah8 = a8 >>> 13; + var a9 = a2[9] | 0; + var al9 = a9 & 8191; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 8191; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 8191; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 8191; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 8191; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 8191; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 8191; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 8191; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 8191; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 8191; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 8191; + var bh9 = b9 >>> 13; + out.negative = self2.negative ^ num.negative; + out.length = 19; + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = mid + Math.imul(ah0, bl0) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0; + w0 &= 67108863; + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = mid + Math.imul(ah1, bl0) | 0; + hi = Math.imul(ah1, bh0); + lo = lo + Math.imul(al0, bl1) | 0; + mid = mid + Math.imul(al0, bh1) | 0; + mid = mid + Math.imul(ah0, bl1) | 0; + hi = hi + Math.imul(ah0, bh1) | 0; + var w1 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0; + w1 &= 67108863; + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = mid + Math.imul(ah2, bl0) | 0; + hi = Math.imul(ah2, bh0); + lo = lo + Math.imul(al1, bl1) | 0; + mid = mid + Math.imul(al1, bh1) | 0; + mid = mid + Math.imul(ah1, bl1) | 0; + hi = hi + Math.imul(ah1, bh1) | 0; + lo = lo + Math.imul(al0, bl2) | 0; + mid = mid + Math.imul(al0, bh2) | 0; + mid = mid + Math.imul(ah0, bl2) | 0; + hi = hi + Math.imul(ah0, bh2) | 0; + var w2 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0; + w2 &= 67108863; + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = mid + Math.imul(ah3, bl0) | 0; + hi = Math.imul(ah3, bh0); + lo = lo + Math.imul(al2, bl1) | 0; + mid = mid + Math.imul(al2, bh1) | 0; + mid = mid + Math.imul(ah2, bl1) | 0; + hi = hi + Math.imul(ah2, bh1) | 0; + lo = lo + Math.imul(al1, bl2) | 0; + mid = mid + Math.imul(al1, bh2) | 0; + mid = mid + Math.imul(ah1, bl2) | 0; + hi = hi + Math.imul(ah1, bh2) | 0; + lo = lo + Math.imul(al0, bl3) | 0; + mid = mid + Math.imul(al0, bh3) | 0; + mid = mid + Math.imul(ah0, bl3) | 0; + hi = hi + Math.imul(ah0, bh3) | 0; + var w3 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0; + w3 &= 67108863; + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = mid + Math.imul(ah4, bl0) | 0; + hi = Math.imul(ah4, bh0); + lo = lo + Math.imul(al3, bl1) | 0; + mid = mid + Math.imul(al3, bh1) | 0; + mid = mid + Math.imul(ah3, bl1) | 0; + hi = hi + Math.imul(ah3, bh1) | 0; + lo = lo + Math.imul(al2, bl2) | 0; + mid = mid + Math.imul(al2, bh2) | 0; + mid = mid + Math.imul(ah2, bl2) | 0; + hi = hi + Math.imul(ah2, bh2) | 0; + lo = lo + Math.imul(al1, bl3) | 0; + mid = mid + Math.imul(al1, bh3) | 0; + mid = mid + Math.imul(ah1, bl3) | 0; + hi = hi + Math.imul(ah1, bh3) | 0; + lo = lo + Math.imul(al0, bl4) | 0; + mid = mid + Math.imul(al0, bh4) | 0; + mid = mid + Math.imul(ah0, bl4) | 0; + hi = hi + Math.imul(ah0, bh4) | 0; + var w4 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0; + w4 &= 67108863; + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = mid + Math.imul(ah5, bl0) | 0; + hi = Math.imul(ah5, bh0); + lo = lo + Math.imul(al4, bl1) | 0; + mid = mid + Math.imul(al4, bh1) | 0; + mid = mid + Math.imul(ah4, bl1) | 0; + hi = hi + Math.imul(ah4, bh1) | 0; + lo = lo + Math.imul(al3, bl2) | 0; + mid = mid + Math.imul(al3, bh2) | 0; + mid = mid + Math.imul(ah3, bl2) | 0; + hi = hi + Math.imul(ah3, bh2) | 0; + lo = lo + Math.imul(al2, bl3) | 0; + mid = mid + Math.imul(al2, bh3) | 0; + mid = mid + Math.imul(ah2, bl3) | 0; + hi = hi + Math.imul(ah2, bh3) | 0; + lo = lo + Math.imul(al1, bl4) | 0; + mid = mid + Math.imul(al1, bh4) | 0; + mid = mid + Math.imul(ah1, bl4) | 0; + hi = hi + Math.imul(ah1, bh4) | 0; + lo = lo + Math.imul(al0, bl5) | 0; + mid = mid + Math.imul(al0, bh5) | 0; + mid = mid + Math.imul(ah0, bl5) | 0; + hi = hi + Math.imul(ah0, bh5) | 0; + var w5 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0; + w5 &= 67108863; + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = mid + Math.imul(ah6, bl0) | 0; + hi = Math.imul(ah6, bh0); + lo = lo + Math.imul(al5, bl1) | 0; + mid = mid + Math.imul(al5, bh1) | 0; + mid = mid + Math.imul(ah5, bl1) | 0; + hi = hi + Math.imul(ah5, bh1) | 0; + lo = lo + Math.imul(al4, bl2) | 0; + mid = mid + Math.imul(al4, bh2) | 0; + mid = mid + Math.imul(ah4, bl2) | 0; + hi = hi + Math.imul(ah4, bh2) | 0; + lo = lo + Math.imul(al3, bl3) | 0; + mid = mid + Math.imul(al3, bh3) | 0; + mid = mid + Math.imul(ah3, bl3) | 0; + hi = hi + Math.imul(ah3, bh3) | 0; + lo = lo + Math.imul(al2, bl4) | 0; + mid = mid + Math.imul(al2, bh4) | 0; + mid = mid + Math.imul(ah2, bl4) | 0; + hi = hi + Math.imul(ah2, bh4) | 0; + lo = lo + Math.imul(al1, bl5) | 0; + mid = mid + Math.imul(al1, bh5) | 0; + mid = mid + Math.imul(ah1, bl5) | 0; + hi = hi + Math.imul(ah1, bh5) | 0; + lo = lo + Math.imul(al0, bl6) | 0; + mid = mid + Math.imul(al0, bh6) | 0; + mid = mid + Math.imul(ah0, bl6) | 0; + hi = hi + Math.imul(ah0, bh6) | 0; + var w6 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0; + w6 &= 67108863; + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = mid + Math.imul(ah7, bl0) | 0; + hi = Math.imul(ah7, bh0); + lo = lo + Math.imul(al6, bl1) | 0; + mid = mid + Math.imul(al6, bh1) | 0; + mid = mid + Math.imul(ah6, bl1) | 0; + hi = hi + Math.imul(ah6, bh1) | 0; + lo = lo + Math.imul(al5, bl2) | 0; + mid = mid + Math.imul(al5, bh2) | 0; + mid = mid + Math.imul(ah5, bl2) | 0; + hi = hi + Math.imul(ah5, bh2) | 0; + lo = lo + Math.imul(al4, bl3) | 0; + mid = mid + Math.imul(al4, bh3) | 0; + mid = mid + Math.imul(ah4, bl3) | 0; + hi = hi + Math.imul(ah4, bh3) | 0; + lo = lo + Math.imul(al3, bl4) | 0; + mid = mid + Math.imul(al3, bh4) | 0; + mid = mid + Math.imul(ah3, bl4) | 0; + hi = hi + Math.imul(ah3, bh4) | 0; + lo = lo + Math.imul(al2, bl5) | 0; + mid = mid + Math.imul(al2, bh5) | 0; + mid = mid + Math.imul(ah2, bl5) | 0; + hi = hi + Math.imul(ah2, bh5) | 0; + lo = lo + Math.imul(al1, bl6) | 0; + mid = mid + Math.imul(al1, bh6) | 0; + mid = mid + Math.imul(ah1, bl6) | 0; + hi = hi + Math.imul(ah1, bh6) | 0; + lo = lo + Math.imul(al0, bl7) | 0; + mid = mid + Math.imul(al0, bh7) | 0; + mid = mid + Math.imul(ah0, bl7) | 0; + hi = hi + Math.imul(ah0, bh7) | 0; + var w7 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0; + w7 &= 67108863; + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = mid + Math.imul(ah8, bl0) | 0; + hi = Math.imul(ah8, bh0); + lo = lo + Math.imul(al7, bl1) | 0; + mid = mid + Math.imul(al7, bh1) | 0; + mid = mid + Math.imul(ah7, bl1) | 0; + hi = hi + Math.imul(ah7, bh1) | 0; + lo = lo + Math.imul(al6, bl2) | 0; + mid = mid + Math.imul(al6, bh2) | 0; + mid = mid + Math.imul(ah6, bl2) | 0; + hi = hi + Math.imul(ah6, bh2) | 0; + lo = lo + Math.imul(al5, bl3) | 0; + mid = mid + Math.imul(al5, bh3) | 0; + mid = mid + Math.imul(ah5, bl3) | 0; + hi = hi + Math.imul(ah5, bh3) | 0; + lo = lo + Math.imul(al4, bl4) | 0; + mid = mid + Math.imul(al4, bh4) | 0; + mid = mid + Math.imul(ah4, bl4) | 0; + hi = hi + Math.imul(ah4, bh4) | 0; + lo = lo + Math.imul(al3, bl5) | 0; + mid = mid + Math.imul(al3, bh5) | 0; + mid = mid + Math.imul(ah3, bl5) | 0; + hi = hi + Math.imul(ah3, bh5) | 0; + lo = lo + Math.imul(al2, bl6) | 0; + mid = mid + Math.imul(al2, bh6) | 0; + mid = mid + Math.imul(ah2, bl6) | 0; + hi = hi + Math.imul(ah2, bh6) | 0; + lo = lo + Math.imul(al1, bl7) | 0; + mid = mid + Math.imul(al1, bh7) | 0; + mid = mid + Math.imul(ah1, bl7) | 0; + hi = hi + Math.imul(ah1, bh7) | 0; + lo = lo + Math.imul(al0, bl8) | 0; + mid = mid + Math.imul(al0, bh8) | 0; + mid = mid + Math.imul(ah0, bl8) | 0; + hi = hi + Math.imul(ah0, bh8) | 0; + var w8 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0; + w8 &= 67108863; + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = mid + Math.imul(ah9, bl0) | 0; + hi = Math.imul(ah9, bh0); + lo = lo + Math.imul(al8, bl1) | 0; + mid = mid + Math.imul(al8, bh1) | 0; + mid = mid + Math.imul(ah8, bl1) | 0; + hi = hi + Math.imul(ah8, bh1) | 0; + lo = lo + Math.imul(al7, bl2) | 0; + mid = mid + Math.imul(al7, bh2) | 0; + mid = mid + Math.imul(ah7, bl2) | 0; + hi = hi + Math.imul(ah7, bh2) | 0; + lo = lo + Math.imul(al6, bl3) | 0; + mid = mid + Math.imul(al6, bh3) | 0; + mid = mid + Math.imul(ah6, bl3) | 0; + hi = hi + Math.imul(ah6, bh3) | 0; + lo = lo + Math.imul(al5, bl4) | 0; + mid = mid + Math.imul(al5, bh4) | 0; + mid = mid + Math.imul(ah5, bl4) | 0; + hi = hi + Math.imul(ah5, bh4) | 0; + lo = lo + Math.imul(al4, bl5) | 0; + mid = mid + Math.imul(al4, bh5) | 0; + mid = mid + Math.imul(ah4, bl5) | 0; + hi = hi + Math.imul(ah4, bh5) | 0; + lo = lo + Math.imul(al3, bl6) | 0; + mid = mid + Math.imul(al3, bh6) | 0; + mid = mid + Math.imul(ah3, bl6) | 0; + hi = hi + Math.imul(ah3, bh6) | 0; + lo = lo + Math.imul(al2, bl7) | 0; + mid = mid + Math.imul(al2, bh7) | 0; + mid = mid + Math.imul(ah2, bl7) | 0; + hi = hi + Math.imul(ah2, bh7) | 0; + lo = lo + Math.imul(al1, bl8) | 0; + mid = mid + Math.imul(al1, bh8) | 0; + mid = mid + Math.imul(ah1, bl8) | 0; + hi = hi + Math.imul(ah1, bh8) | 0; + lo = lo + Math.imul(al0, bl9) | 0; + mid = mid + Math.imul(al0, bh9) | 0; + mid = mid + Math.imul(ah0, bl9) | 0; + hi = hi + Math.imul(ah0, bh9) | 0; + var w9 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0; + w9 &= 67108863; + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = mid + Math.imul(ah9, bl1) | 0; + hi = Math.imul(ah9, bh1); + lo = lo + Math.imul(al8, bl2) | 0; + mid = mid + Math.imul(al8, bh2) | 0; + mid = mid + Math.imul(ah8, bl2) | 0; + hi = hi + Math.imul(ah8, bh2) | 0; + lo = lo + Math.imul(al7, bl3) | 0; + mid = mid + Math.imul(al7, bh3) | 0; + mid = mid + Math.imul(ah7, bl3) | 0; + hi = hi + Math.imul(ah7, bh3) | 0; + lo = lo + Math.imul(al6, bl4) | 0; + mid = mid + Math.imul(al6, bh4) | 0; + mid = mid + Math.imul(ah6, bl4) | 0; + hi = hi + Math.imul(ah6, bh4) | 0; + lo = lo + Math.imul(al5, bl5) | 0; + mid = mid + Math.imul(al5, bh5) | 0; + mid = mid + Math.imul(ah5, bl5) | 0; + hi = hi + Math.imul(ah5, bh5) | 0; + lo = lo + Math.imul(al4, bl6) | 0; + mid = mid + Math.imul(al4, bh6) | 0; + mid = mid + Math.imul(ah4, bl6) | 0; + hi = hi + Math.imul(ah4, bh6) | 0; + lo = lo + Math.imul(al3, bl7) | 0; + mid = mid + Math.imul(al3, bh7) | 0; + mid = mid + Math.imul(ah3, bl7) | 0; + hi = hi + Math.imul(ah3, bh7) | 0; + lo = lo + Math.imul(al2, bl8) | 0; + mid = mid + Math.imul(al2, bh8) | 0; + mid = mid + Math.imul(ah2, bl8) | 0; + hi = hi + Math.imul(ah2, bh8) | 0; + lo = lo + Math.imul(al1, bl9) | 0; + mid = mid + Math.imul(al1, bh9) | 0; + mid = mid + Math.imul(ah1, bl9) | 0; + hi = hi + Math.imul(ah1, bh9) | 0; + var w10 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0; + w10 &= 67108863; + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = mid + Math.imul(ah9, bl2) | 0; + hi = Math.imul(ah9, bh2); + lo = lo + Math.imul(al8, bl3) | 0; + mid = mid + Math.imul(al8, bh3) | 0; + mid = mid + Math.imul(ah8, bl3) | 0; + hi = hi + Math.imul(ah8, bh3) | 0; + lo = lo + Math.imul(al7, bl4) | 0; + mid = mid + Math.imul(al7, bh4) | 0; + mid = mid + Math.imul(ah7, bl4) | 0; + hi = hi + Math.imul(ah7, bh4) | 0; + lo = lo + Math.imul(al6, bl5) | 0; + mid = mid + Math.imul(al6, bh5) | 0; + mid = mid + Math.imul(ah6, bl5) | 0; + hi = hi + Math.imul(ah6, bh5) | 0; + lo = lo + Math.imul(al5, bl6) | 0; + mid = mid + Math.imul(al5, bh6) | 0; + mid = mid + Math.imul(ah5, bl6) | 0; + hi = hi + Math.imul(ah5, bh6) | 0; + lo = lo + Math.imul(al4, bl7) | 0; + mid = mid + Math.imul(al4, bh7) | 0; + mid = mid + Math.imul(ah4, bl7) | 0; + hi = hi + Math.imul(ah4, bh7) | 0; + lo = lo + Math.imul(al3, bl8) | 0; + mid = mid + Math.imul(al3, bh8) | 0; + mid = mid + Math.imul(ah3, bl8) | 0; + hi = hi + Math.imul(ah3, bh8) | 0; + lo = lo + Math.imul(al2, bl9) | 0; + mid = mid + Math.imul(al2, bh9) | 0; + mid = mid + Math.imul(ah2, bl9) | 0; + hi = hi + Math.imul(ah2, bh9) | 0; + var w11 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0; + w11 &= 67108863; + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = mid + Math.imul(ah9, bl3) | 0; + hi = Math.imul(ah9, bh3); + lo = lo + Math.imul(al8, bl4) | 0; + mid = mid + Math.imul(al8, bh4) | 0; + mid = mid + Math.imul(ah8, bl4) | 0; + hi = hi + Math.imul(ah8, bh4) | 0; + lo = lo + Math.imul(al7, bl5) | 0; + mid = mid + Math.imul(al7, bh5) | 0; + mid = mid + Math.imul(ah7, bl5) | 0; + hi = hi + Math.imul(ah7, bh5) | 0; + lo = lo + Math.imul(al6, bl6) | 0; + mid = mid + Math.imul(al6, bh6) | 0; + mid = mid + Math.imul(ah6, bl6) | 0; + hi = hi + Math.imul(ah6, bh6) | 0; + lo = lo + Math.imul(al5, bl7) | 0; + mid = mid + Math.imul(al5, bh7) | 0; + mid = mid + Math.imul(ah5, bl7) | 0; + hi = hi + Math.imul(ah5, bh7) | 0; + lo = lo + Math.imul(al4, bl8) | 0; + mid = mid + Math.imul(al4, bh8) | 0; + mid = mid + Math.imul(ah4, bl8) | 0; + hi = hi + Math.imul(ah4, bh8) | 0; + lo = lo + Math.imul(al3, bl9) | 0; + mid = mid + Math.imul(al3, bh9) | 0; + mid = mid + Math.imul(ah3, bl9) | 0; + hi = hi + Math.imul(ah3, bh9) | 0; + var w12 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0; + w12 &= 67108863; + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = mid + Math.imul(ah9, bl4) | 0; + hi = Math.imul(ah9, bh4); + lo = lo + Math.imul(al8, bl5) | 0; + mid = mid + Math.imul(al8, bh5) | 0; + mid = mid + Math.imul(ah8, bl5) | 0; + hi = hi + Math.imul(ah8, bh5) | 0; + lo = lo + Math.imul(al7, bl6) | 0; + mid = mid + Math.imul(al7, bh6) | 0; + mid = mid + Math.imul(ah7, bl6) | 0; + hi = hi + Math.imul(ah7, bh6) | 0; + lo = lo + Math.imul(al6, bl7) | 0; + mid = mid + Math.imul(al6, bh7) | 0; + mid = mid + Math.imul(ah6, bl7) | 0; + hi = hi + Math.imul(ah6, bh7) | 0; + lo = lo + Math.imul(al5, bl8) | 0; + mid = mid + Math.imul(al5, bh8) | 0; + mid = mid + Math.imul(ah5, bl8) | 0; + hi = hi + Math.imul(ah5, bh8) | 0; + lo = lo + Math.imul(al4, bl9) | 0; + mid = mid + Math.imul(al4, bh9) | 0; + mid = mid + Math.imul(ah4, bl9) | 0; + hi = hi + Math.imul(ah4, bh9) | 0; + var w13 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0; + w13 &= 67108863; + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = mid + Math.imul(ah9, bl5) | 0; + hi = Math.imul(ah9, bh5); + lo = lo + Math.imul(al8, bl6) | 0; + mid = mid + Math.imul(al8, bh6) | 0; + mid = mid + Math.imul(ah8, bl6) | 0; + hi = hi + Math.imul(ah8, bh6) | 0; + lo = lo + Math.imul(al7, bl7) | 0; + mid = mid + Math.imul(al7, bh7) | 0; + mid = mid + Math.imul(ah7, bl7) | 0; + hi = hi + Math.imul(ah7, bh7) | 0; + lo = lo + Math.imul(al6, bl8) | 0; + mid = mid + Math.imul(al6, bh8) | 0; + mid = mid + Math.imul(ah6, bl8) | 0; + hi = hi + Math.imul(ah6, bh8) | 0; + lo = lo + Math.imul(al5, bl9) | 0; + mid = mid + Math.imul(al5, bh9) | 0; + mid = mid + Math.imul(ah5, bl9) | 0; + hi = hi + Math.imul(ah5, bh9) | 0; + var w14 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0; + w14 &= 67108863; + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = mid + Math.imul(ah9, bl6) | 0; + hi = Math.imul(ah9, bh6); + lo = lo + Math.imul(al8, bl7) | 0; + mid = mid + Math.imul(al8, bh7) | 0; + mid = mid + Math.imul(ah8, bl7) | 0; + hi = hi + Math.imul(ah8, bh7) | 0; + lo = lo + Math.imul(al7, bl8) | 0; + mid = mid + Math.imul(al7, bh8) | 0; + mid = mid + Math.imul(ah7, bl8) | 0; + hi = hi + Math.imul(ah7, bh8) | 0; + lo = lo + Math.imul(al6, bl9) | 0; + mid = mid + Math.imul(al6, bh9) | 0; + mid = mid + Math.imul(ah6, bl9) | 0; + hi = hi + Math.imul(ah6, bh9) | 0; + var w15 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0; + w15 &= 67108863; + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = mid + Math.imul(ah9, bl7) | 0; + hi = Math.imul(ah9, bh7); + lo = lo + Math.imul(al8, bl8) | 0; + mid = mid + Math.imul(al8, bh8) | 0; + mid = mid + Math.imul(ah8, bl8) | 0; + hi = hi + Math.imul(ah8, bh8) | 0; + lo = lo + Math.imul(al7, bl9) | 0; + mid = mid + Math.imul(al7, bh9) | 0; + mid = mid + Math.imul(ah7, bl9) | 0; + hi = hi + Math.imul(ah7, bh9) | 0; + var w16 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0; + w16 &= 67108863; + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = mid + Math.imul(ah9, bl8) | 0; + hi = Math.imul(ah9, bh8); + lo = lo + Math.imul(al8, bl9) | 0; + mid = mid + Math.imul(al8, bh9) | 0; + mid = mid + Math.imul(ah8, bl9) | 0; + hi = hi + Math.imul(ah8, bh9) | 0; + var w17 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0; + w17 &= 67108863; + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = mid + Math.imul(ah9, bl9) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (c + lo | 0) + ((mid & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0; + w18 &= 67108863; + o2[0] = w0; + o2[1] = w1; + o2[2] = w2; + o2[3] = w3; + o2[4] = w4; + o2[5] = w5; + o2[6] = w6; + o2[7] = w7; + o2[8] = w8; + o2[9] = w9; + o2[10] = w10; + o2[11] = w11; + o2[12] = w12; + o2[13] = w13; + o2[14] = w14; + o2[15] = w15; + o2[16] = w16; + o2[17] = w17; + o2[18] = w18; + if (c !== 0) { + o2[19] = c; + out.length++; + } + return out; + }; + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + function bigMulTo(self2, num, out) { + out.negative = num.negative ^ self2.negative; + out.length = self2.length + num.length; + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 67108863; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) { + var i2 = k - j; + var a2 = self2.words[i2] | 0; + var b = num.words[j] | 0; + var r3 = a2 * b; + var lo = r3 & 67108863; + ncarry = ncarry + (r3 / 67108864 | 0) | 0; + lo = lo + rword | 0; + rword = lo & 67108863; + ncarry = ncarry + (lo >>> 26) | 0; + hncarry += ncarry >>> 26; + ncarry &= 67108863; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + return out._strip(); + } + function jumboMulTo(self2, num, out) { + return bigMulTo(self2, num, out); + } + BN3.prototype.mulTo = function mulTo(num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + return res; + }; + function FFTM(x, y) { + this.x = x; + this.y = y; + } + FFTM.prototype.makeRBT = function makeRBT(N2) { + var t2 = new Array(N2); + var l2 = BN3.prototype._countBits(N2) - 1; + for (var i2 = 0; i2 < N2; i2++) { + t2[i2] = this.revBin(i2, l2, N2); + } + return t2; + }; + FFTM.prototype.revBin = function revBin(x, l2, N2) { + if (x === 0 || x === N2 - 1) + return x; + var rb = 0; + for (var i2 = 0; i2 < l2; i2++) { + rb |= (x & 1) << l2 - i2 - 1; + x >>= 1; + } + return rb; + }; + FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N2) { + for (var i2 = 0; i2 < N2; i2++) { + rtws[i2] = rws[rbt[i2]]; + itws[i2] = iws[rbt[i2]]; + } + }; + FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N2, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N2); + for (var s2 = 1; s2 < N2; s2 <<= 1) { + var l2 = s2 << 1; + var rtwdf = Math.cos(2 * Math.PI / l2); + var itwdf = Math.sin(2 * Math.PI / l2); + for (var p = 0; p < N2; p += l2) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + for (var j = 0; j < s2; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + var ro = rtws[p + j + s2]; + var io = itws[p + j + s2]; + var rx = rtwdf_ * ro - itwdf_ * io; + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + rtws[p + j + s2] = re - ro; + itws[p + j + s2] = ie - io; + if (j !== l2) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + FFTM.prototype.guessLen13b = function guessLen13b(n2, m) { + var N2 = Math.max(m, n2) | 1; + var odd = N2 & 1; + var i2 = 0; + for (N2 = N2 / 2 | 0; N2; N2 = N2 >>> 1) { + i2++; + } + return 1 << i2 + 1 + odd; + }; + FFTM.prototype.conjugate = function conjugate(rws, iws, N2) { + if (N2 <= 1) + return; + for (var i2 = 0; i2 < N2 / 2; i2++) { + var t2 = rws[i2]; + rws[i2] = rws[N2 - i2 - 1]; + rws[N2 - i2 - 1] = t2; + t2 = iws[i2]; + iws[i2] = -iws[N2 - i2 - 1]; + iws[N2 - i2 - 1] = -t2; + } + }; + FFTM.prototype.normalize13b = function normalize13b(ws, N2) { + var carry = 0; + for (var i2 = 0; i2 < N2 / 2; i2++) { + var w = Math.round(ws[2 * i2 + 1] / N2) * 8192 + Math.round(ws[2 * i2] / N2) + carry; + ws[i2] = w & 67108863; + if (w < 67108864) { + carry = 0; + } else { + carry = w / 67108864 | 0; + } + } + return ws; + }; + FFTM.prototype.convert13b = function convert13b(ws, len, rws, N2) { + var carry = 0; + for (var i2 = 0; i2 < len; i2++) { + carry = carry + (ws[i2] | 0); + rws[2 * i2] = carry & 8191; + carry = carry >>> 13; + rws[2 * i2 + 1] = carry & 8191; + carry = carry >>> 13; + } + for (i2 = 2 * len; i2 < N2; ++i2) { + rws[i2] = 0; + } + assert2(carry === 0); + assert2((carry & ~8191) === 0); + }; + FFTM.prototype.stub = function stub(N2) { + var ph = new Array(N2); + for (var i2 = 0; i2 < N2; i2++) { + ph[i2] = 0; + } + return ph; + }; + FFTM.prototype.mulp = function mulp(x, y, out) { + var N2 = 2 * this.guessLen13b(x.length, y.length); + var rbt = this.makeRBT(N2); + var _ = this.stub(N2); + var rws = new Array(N2); + var rwst = new Array(N2); + var iwst = new Array(N2); + var nrws = new Array(N2); + var nrwst = new Array(N2); + var niwst = new Array(N2); + var rmws = out.words; + rmws.length = N2; + this.convert13b(x.words, x.length, rws, N2); + this.convert13b(y.words, y.length, nrws, N2); + this.transform(rws, _, rwst, iwst, N2, rbt); + this.transform(nrws, _, nrwst, niwst, N2, rbt); + for (var i2 = 0; i2 < N2; i2++) { + var rx = rwst[i2] * nrwst[i2] - iwst[i2] * niwst[i2]; + iwst[i2] = rwst[i2] * niwst[i2] + iwst[i2] * nrwst[i2]; + rwst[i2] = rx; + } + this.conjugate(rwst, iwst, N2); + this.transform(rwst, iwst, rmws, _, N2, rbt); + this.conjugate(rmws, _, N2); + this.normalize13b(rmws, N2); + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out._strip(); + }; + BN3.prototype.mul = function mul3(num) { + var out = new BN3(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + BN3.prototype.mulf = function mulf(num) { + var out = new BN3(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + BN3.prototype.imul = function imul(num) { + return this.clone().mulTo(num, this); + }; + BN3.prototype.imuln = function imuln(num) { + var isNegNum = num < 0; + if (isNegNum) + num = -num; + assert2(typeof num === "number"); + assert2(num < 67108864); + var carry = 0; + for (var i2 = 0; i2 < this.length; i2++) { + var w = (this.words[i2] | 0) * num; + var lo = (w & 67108863) + (carry & 67108863); + carry >>= 26; + carry += w / 67108864 | 0; + carry += lo >>> 26; + this.words[i2] = lo & 67108863; + } + if (carry !== 0) { + this.words[i2] = carry; + this.length++; + } + return isNegNum ? this.ineg() : this; + }; + BN3.prototype.muln = function muln(num) { + return this.clone().imuln(num); + }; + BN3.prototype.sqr = function sqr() { + return this.mul(this); + }; + BN3.prototype.isqr = function isqr() { + return this.imul(this.clone()); + }; + BN3.prototype.pow = function pow(num) { + var w = toBitArray(num); + if (w.length === 0) + return new BN3(1); + var res = this; + for (var i2 = 0; i2 < w.length; i2++, res = res.sqr()) { + if (w[i2] !== 0) + break; + } + if (++i2 < w.length) { + for (var q = res.sqr(); i2 < w.length; i2++, q = q.sqr()) { + if (w[i2] === 0) + continue; + res = res.mul(q); + } + } + return res; + }; + BN3.prototype.iushln = function iushln(bits) { + assert2(typeof bits === "number" && bits >= 0); + var r3 = bits % 26; + var s2 = (bits - r3) / 26; + var carryMask = 67108863 >>> 26 - r3 << 26 - r3; + var i2; + if (r3 !== 0) { + var carry = 0; + for (i2 = 0; i2 < this.length; i2++) { + var newCarry = this.words[i2] & carryMask; + var c = (this.words[i2] | 0) - newCarry << r3; + this.words[i2] = c | carry; + carry = newCarry >>> 26 - r3; + } + if (carry) { + this.words[i2] = carry; + this.length++; + } + } + if (s2 !== 0) { + for (i2 = this.length - 1; i2 >= 0; i2--) { + this.words[i2 + s2] = this.words[i2]; + } + for (i2 = 0; i2 < s2; i2++) { + this.words[i2] = 0; + } + this.length += s2; + } + return this._strip(); + }; + BN3.prototype.ishln = function ishln(bits) { + assert2(this.negative === 0); + return this.iushln(bits); + }; + BN3.prototype.iushrn = function iushrn(bits, hint, extended) { + assert2(typeof bits === "number" && bits >= 0); + var h; + if (hint) { + h = (hint - hint % 26) / 26; + } else { + h = 0; + } + var r3 = bits % 26; + var s2 = Math.min((bits - r3) / 26, this.length); + var mask = 67108863 ^ 67108863 >>> r3 << r3; + var maskedWords = extended; + h -= s2; + h = Math.max(0, h); + if (maskedWords) { + for (var i2 = 0; i2 < s2; i2++) { + maskedWords.words[i2] = this.words[i2]; + } + maskedWords.length = s2; + } + if (s2 === 0) { + } else if (this.length > s2) { + this.length -= s2; + for (i2 = 0; i2 < this.length; i2++) { + this.words[i2] = this.words[i2 + s2]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + var carry = 0; + for (i2 = this.length - 1; i2 >= 0 && (carry !== 0 || i2 >= h); i2--) { + var word = this.words[i2] | 0; + this.words[i2] = carry << 26 - r3 | word >>> r3; + carry = word & mask; + } + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + return this._strip(); + }; + BN3.prototype.ishrn = function ishrn(bits, hint, extended) { + assert2(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + BN3.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); + }; + BN3.prototype.ushln = function ushln(bits) { + return this.clone().iushln(bits); + }; + BN3.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); + }; + BN3.prototype.ushrn = function ushrn(bits) { + return this.clone().iushrn(bits); + }; + BN3.prototype.testn = function testn(bit) { + assert2(typeof bit === "number" && bit >= 0); + var r3 = bit % 26; + var s2 = (bit - r3) / 26; + var q = 1 << r3; + if (this.length <= s2) + return false; + var w = this.words[s2]; + return !!(w & q); + }; + BN3.prototype.imaskn = function imaskn(bits) { + assert2(typeof bits === "number" && bits >= 0); + var r3 = bits % 26; + var s2 = (bits - r3) / 26; + assert2(this.negative === 0, "imaskn works only with positive numbers"); + if (this.length <= s2) { + return this; + } + if (r3 !== 0) { + s2++; + } + this.length = Math.min(s2, this.length); + if (r3 !== 0) { + var mask = 67108863 ^ 67108863 >>> r3 << r3; + this.words[this.length - 1] &= mask; + } + return this._strip(); + }; + BN3.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); + }; + BN3.prototype.iaddn = function iaddn(num) { + assert2(typeof num === "number"); + assert2(num < 67108864); + if (num < 0) + return this.isubn(-num); + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) <= num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + return this._iaddn(num); + }; + BN3.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + for (var i2 = 0; i2 < this.length && this.words[i2] >= 67108864; i2++) { + this.words[i2] -= 67108864; + if (i2 === this.length - 1) { + this.words[i2 + 1] = 1; + } else { + this.words[i2 + 1]++; + } + } + this.length = Math.max(this.length, i2 + 1); + return this; + }; + BN3.prototype.isubn = function isubn(num) { + assert2(typeof num === "number"); + assert2(num < 67108864); + if (num < 0) + return this.iaddn(-num); + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + this.words[0] -= num; + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + for (var i2 = 0; i2 < this.length && this.words[i2] < 0; i2++) { + this.words[i2] += 67108864; + this.words[i2 + 1] -= 1; + } + } + return this._strip(); + }; + BN3.prototype.addn = function addn(num) { + return this.clone().iaddn(num); + }; + BN3.prototype.subn = function subn(num) { + return this.clone().isubn(num); + }; + BN3.prototype.iabs = function iabs() { + this.negative = 0; + return this; + }; + BN3.prototype.abs = function abs() { + return this.clone().iabs(); + }; + BN3.prototype._ishlnsubmul = function _ishlnsubmul(num, mul3, shift) { + var len = num.length + shift; + var i2; + this._expand(len); + var w; + var carry = 0; + for (i2 = 0; i2 < num.length; i2++) { + w = (this.words[i2 + shift] | 0) + carry; + var right = (num.words[i2] | 0) * mul3; + w -= right & 67108863; + carry = (w >> 26) - (right / 67108864 | 0); + this.words[i2 + shift] = w & 67108863; + } + for (; i2 < this.length - shift; i2++) { + w = (this.words[i2 + shift] | 0) + carry; + carry = w >> 26; + this.words[i2 + shift] = w & 67108863; + } + if (carry === 0) + return this._strip(); + assert2(carry === -1); + carry = 0; + for (i2 = 0; i2 < this.length; i2++) { + w = -(this.words[i2] | 0) + carry; + carry = w >> 26; + this.words[i2] = w & 67108863; + } + this.negative = 1; + return this._strip(); + }; + BN3.prototype._wordDiv = function _wordDiv(num, mode) { + var shift = this.length - num.length; + var a2 = this.clone(); + var b = num; + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a2.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + var m = a2.length - b.length; + var q; + if (mode !== "mod") { + q = new BN3(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i2 = 0; i2 < q.length; i2++) { + q.words[i2] = 0; + } + } + var diff = a2.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a2 = diff; + if (q) { + q.words[m] = 1; + } + } + for (var j = m - 1; j >= 0; j--) { + var qj = (a2.words[b.length + j] | 0) * 67108864 + (a2.words[b.length + j - 1] | 0); + qj = Math.min(qj / bhi | 0, 67108863); + a2._ishlnsubmul(b, qj, j); + while (a2.negative !== 0) { + qj--; + a2.negative = 0; + a2._ishlnsubmul(b, 1, j); + if (!a2.isZero()) { + a2.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q._strip(); + } + a2._strip(); + if (mode !== "div" && shift !== 0) { + a2.iushrn(shift); + } + return { + div: q || null, + mod: a2 + }; + }; + BN3.prototype.divmod = function divmod(num, mode, positive) { + assert2(!num.isZero()); + if (this.isZero()) { + return { + div: new BN3(0), + mod: new BN3(0) + }; + } + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + if (mode !== "mod") { + div = res.div.neg(); + } + if (mode !== "div") { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + return { + div, + mod + }; + } + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + if (mode !== "mod") { + div = res.div.neg(); + } + return { + div, + mod: res.mod + }; + } + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + if (mode !== "div") { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + return { + div: res.div, + mod + }; + } + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN3(0), + mod: this + }; + } + if (num.length === 1) { + if (mode === "div") { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + if (mode === "mod") { + return { + div: null, + mod: new BN3(this.modrn(num.words[0])) + }; + } + return { + div: this.divn(num.words[0]), + mod: new BN3(this.modrn(num.words[0])) + }; + } + return this._wordDiv(num, mode); + }; + BN3.prototype.div = function div(num) { + return this.divmod(num, "div", false).div; + }; + BN3.prototype.mod = function mod(num) { + return this.divmod(num, "mod", false).mod; + }; + BN3.prototype.umod = function umod(num) { + return this.divmod(num, "mod", true).mod; + }; + BN3.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + if (dm.mod.isZero()) + return dm.div; + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + var half = num.ushrn(1); + var r22 = num.andln(1); + var cmp = mod.cmp(half); + if (cmp < 0 || r22 === 1 && cmp === 0) + return dm.div; + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + BN3.prototype.modrn = function modrn(num) { + var isNegNum = num < 0; + if (isNegNum) + num = -num; + assert2(num <= 67108863); + var p = (1 << 26) % num; + var acc = 0; + for (var i2 = this.length - 1; i2 >= 0; i2--) { + acc = (p * acc + (this.words[i2] | 0)) % num; + } + return isNegNum ? -acc : acc; + }; + BN3.prototype.modn = function modn(num) { + return this.modrn(num); + }; + BN3.prototype.idivn = function idivn(num) { + var isNegNum = num < 0; + if (isNegNum) + num = -num; + assert2(num <= 67108863); + var carry = 0; + for (var i2 = this.length - 1; i2 >= 0; i2--) { + var w = (this.words[i2] | 0) + carry * 67108864; + this.words[i2] = w / num | 0; + carry = w % num; + } + this._strip(); + return isNegNum ? this.ineg() : this; + }; + BN3.prototype.divn = function divn(num) { + return this.clone().idivn(num); + }; + BN3.prototype.egcd = function egcd(p) { + assert2(p.negative === 0); + assert2(!p.isZero()); + var x = this; + var y = p.clone(); + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + var A2 = new BN3(1); + var B = new BN3(0); + var C = new BN3(0); + var D3 = new BN3(1); + var g = 0; + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + var yp = y.clone(); + var xp = x.clone(); + while (!x.isZero()) { + for (var i2 = 0, im = 1; (x.words[0] & im) === 0 && i2 < 26; ++i2, im <<= 1) + ; + if (i2 > 0) { + x.iushrn(i2); + while (i2-- > 0) { + if (A2.isOdd() || B.isOdd()) { + A2.iadd(yp); + B.isub(xp); + } + A2.iushrn(1); + B.iushrn(1); + } + } + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) + ; + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D3.isOdd()) { + C.iadd(yp); + D3.isub(xp); + } + C.iushrn(1); + D3.iushrn(1); + } + } + if (x.cmp(y) >= 0) { + x.isub(y); + A2.isub(C); + B.isub(D3); + } else { + y.isub(x); + C.isub(A2); + D3.isub(B); + } + } + return { + a: C, + b: D3, + gcd: y.iushln(g) + }; + }; + BN3.prototype._invmp = function _invmp(p) { + assert2(p.negative === 0); + assert2(!p.isZero()); + var a2 = this; + var b = p.clone(); + if (a2.negative !== 0) { + a2 = a2.umod(p); + } else { + a2 = a2.clone(); + } + var x1 = new BN3(1); + var x2 = new BN3(0); + var delta = b.clone(); + while (a2.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i2 = 0, im = 1; (a2.words[0] & im) === 0 && i2 < 26; ++i2, im <<= 1) + ; + if (i2 > 0) { + a2.iushrn(i2); + while (i2-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + x1.iushrn(1); + } + } + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) + ; + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + x2.iushrn(1); + } + } + if (a2.cmp(b) >= 0) { + a2.isub(b); + x1.isub(x2); + } else { + b.isub(a2); + x2.isub(x1); + } + } + var res; + if (a2.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + if (res.cmpn(0) < 0) { + res.iadd(p); + } + return res; + }; + BN3.prototype.gcd = function gcd(num) { + if (this.isZero()) + return num.abs(); + if (num.isZero()) + return this.abs(); + var a2 = this.clone(); + var b = num.clone(); + a2.negative = 0; + b.negative = 0; + for (var shift = 0; a2.isEven() && b.isEven(); shift++) { + a2.iushrn(1); + b.iushrn(1); + } + do { + while (a2.isEven()) { + a2.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + var r3 = a2.cmp(b); + if (r3 < 0) { + var t2 = a2; + a2 = b; + b = t2; + } else if (r3 === 0 || b.cmpn(1) === 0) { + break; + } + a2.isub(b); + } while (true); + return b.iushln(shift); + }; + BN3.prototype.invm = function invm(num) { + return this.egcd(num).a.umod(num); + }; + BN3.prototype.isEven = function isEven() { + return (this.words[0] & 1) === 0; + }; + BN3.prototype.isOdd = function isOdd() { + return (this.words[0] & 1) === 1; + }; + BN3.prototype.andln = function andln(num) { + return this.words[0] & num; + }; + BN3.prototype.bincn = function bincn(bit) { + assert2(typeof bit === "number"); + var r3 = bit % 26; + var s2 = (bit - r3) / 26; + var q = 1 << r3; + if (this.length <= s2) { + this._expand(s2 + 1); + this.words[s2] |= q; + return this; + } + var carry = q; + for (var i2 = s2; carry !== 0 && i2 < this.length; i2++) { + var w = this.words[i2] | 0; + w += carry; + carry = w >>> 26; + w &= 67108863; + this.words[i2] = w; + } + if (carry !== 0) { + this.words[i2] = carry; + this.length++; + } + return this; + }; + BN3.prototype.isZero = function isZero() { + return this.length === 1 && this.words[0] === 0; + }; + BN3.prototype.cmpn = function cmpn(num) { + var negative = num < 0; + if (this.negative !== 0 && !negative) + return -1; + if (this.negative === 0 && negative) + return 1; + this._strip(); + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + assert2(num <= 67108863, "Number is too big"); + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) + return -res | 0; + return res; + }; + BN3.prototype.cmp = function cmp(num) { + if (this.negative !== 0 && num.negative === 0) + return -1; + if (this.negative === 0 && num.negative !== 0) + return 1; + var res = this.ucmp(num); + if (this.negative !== 0) + return -res | 0; + return res; + }; + BN3.prototype.ucmp = function ucmp(num) { + if (this.length > num.length) + return 1; + if (this.length < num.length) + return -1; + var res = 0; + for (var i2 = this.length - 1; i2 >= 0; i2--) { + var a2 = this.words[i2] | 0; + var b = num.words[i2] | 0; + if (a2 === b) + continue; + if (a2 < b) { + res = -1; + } else if (a2 > b) { + res = 1; + } + break; + } + return res; + }; + BN3.prototype.gtn = function gtn(num) { + return this.cmpn(num) === 1; + }; + BN3.prototype.gt = function gt(num) { + return this.cmp(num) === 1; + }; + BN3.prototype.gten = function gten(num) { + return this.cmpn(num) >= 0; + }; + BN3.prototype.gte = function gte(num) { + return this.cmp(num) >= 0; + }; + BN3.prototype.ltn = function ltn(num) { + return this.cmpn(num) === -1; + }; + BN3.prototype.lt = function lt(num) { + return this.cmp(num) === -1; + }; + BN3.prototype.lten = function lten(num) { + return this.cmpn(num) <= 0; + }; + BN3.prototype.lte = function lte(num) { + return this.cmp(num) <= 0; + }; + BN3.prototype.eqn = function eqn(num) { + return this.cmpn(num) === 0; + }; + BN3.prototype.eq = function eq4(num) { + return this.cmp(num) === 0; + }; + BN3.red = function red(num) { + return new Red(num); + }; + BN3.prototype.toRed = function toRed(ctx) { + assert2(!this.red, "Already a number in reduction context"); + assert2(this.negative === 0, "red works only with positives"); + return ctx.convertTo(this)._forceRed(ctx); + }; + BN3.prototype.fromRed = function fromRed() { + assert2(this.red, "fromRed works only with numbers in reduction context"); + return this.red.convertFrom(this); + }; + BN3.prototype._forceRed = function _forceRed(ctx) { + this.red = ctx; + return this; + }; + BN3.prototype.forceRed = function forceRed(ctx) { + assert2(!this.red, "Already a number in reduction context"); + return this._forceRed(ctx); + }; + BN3.prototype.redAdd = function redAdd(num) { + assert2(this.red, "redAdd works only with red numbers"); + return this.red.add(this, num); + }; + BN3.prototype.redIAdd = function redIAdd(num) { + assert2(this.red, "redIAdd works only with red numbers"); + return this.red.iadd(this, num); + }; + BN3.prototype.redSub = function redSub(num) { + assert2(this.red, "redSub works only with red numbers"); + return this.red.sub(this, num); + }; + BN3.prototype.redISub = function redISub(num) { + assert2(this.red, "redISub works only with red numbers"); + return this.red.isub(this, num); + }; + BN3.prototype.redShl = function redShl(num) { + assert2(this.red, "redShl works only with red numbers"); + return this.red.shl(this, num); + }; + BN3.prototype.redMul = function redMul(num) { + assert2(this.red, "redMul works only with red numbers"); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + BN3.prototype.redIMul = function redIMul(num) { + assert2(this.red, "redMul works only with red numbers"); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + BN3.prototype.redSqr = function redSqr() { + assert2(this.red, "redSqr works only with red numbers"); + this.red._verify1(this); + return this.red.sqr(this); + }; + BN3.prototype.redISqr = function redISqr() { + assert2(this.red, "redISqr works only with red numbers"); + this.red._verify1(this); + return this.red.isqr(this); + }; + BN3.prototype.redSqrt = function redSqrt() { + assert2(this.red, "redSqrt works only with red numbers"); + this.red._verify1(this); + return this.red.sqrt(this); + }; + BN3.prototype.redInvm = function redInvm() { + assert2(this.red, "redInvm works only with red numbers"); + this.red._verify1(this); + return this.red.invm(this); + }; + BN3.prototype.redNeg = function redNeg() { + assert2(this.red, "redNeg works only with red numbers"); + this.red._verify1(this); + return this.red.neg(this); + }; + BN3.prototype.redPow = function redPow(num) { + assert2(this.red && !num.red, "redPow(normalNum)"); + this.red._verify1(this); + return this.red.pow(this, num); + }; + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + function MPrime(name, p) { + this.name = name; + this.p = new BN3(p, 16); + this.n = this.p.bitLength(); + this.k = new BN3(1).iushln(this.n).isub(this.p); + this.tmp = this._tmp(); + } + MPrime.prototype._tmp = function _tmp() { + var tmp = new BN3(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + MPrime.prototype.ireduce = function ireduce(num) { + var r3 = num; + var rlen; + do { + this.split(r3, this.tmp); + r3 = this.imulK(r3); + r3 = r3.iadd(this.tmp); + rlen = r3.bitLength(); + } while (rlen > this.n); + var cmp = rlen < this.n ? -1 : r3.ucmp(this.p); + if (cmp === 0) { + r3.words[0] = 0; + r3.length = 1; + } else if (cmp > 0) { + r3.isub(this.p); + } else { + if (r3.strip !== void 0) { + r3.strip(); + } else { + r3._strip(); + } + } + return r3; + }; + MPrime.prototype.split = function split(input, out) { + input.iushrn(this.n, 0, out); + }; + MPrime.prototype.imulK = function imulK(num) { + return num.imul(this.k); + }; + function K256() { + MPrime.call( + this, + "k256", + "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" + ); + } + inherits(K256, MPrime); + K256.prototype.split = function split(input, output) { + var mask = 4194303; + var outLen = Math.min(input.length, 9); + for (var i2 = 0; i2 < outLen; i2++) { + output.words[i2] = input.words[i2]; + } + output.length = outLen; + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + for (i2 = 10; i2 < input.length; i2++) { + var next = input.words[i2] | 0; + input.words[i2 - 10] = (next & mask) << 4 | prev >>> 22; + prev = next; + } + prev >>>= 22; + input.words[i2 - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + K256.prototype.imulK = function imulK(num) { + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + var lo = 0; + for (var i2 = 0; i2 < num.length; i2++) { + var w = num.words[i2] | 0; + lo += w * 977; + num.words[i2] = lo & 67108863; + lo = w * 64 + (lo / 67108864 | 0); + } + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + function P224() { + MPrime.call( + this, + "p224", + "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" + ); + } + inherits(P224, MPrime); + function P192() { + MPrime.call( + this, + "p192", + "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" + ); + } + inherits(P192, MPrime); + function P25519() { + MPrime.call( + this, + "25519", + "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" + ); + } + inherits(P25519, MPrime); + P25519.prototype.imulK = function imulK(num) { + var carry = 0; + for (var i2 = 0; i2 < num.length; i2++) { + var hi = (num.words[i2] | 0) * 19 + carry; + var lo = hi & 67108863; + hi >>>= 26; + num.words[i2] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + BN3._prime = function prime(name) { + if (primes[name]) + return primes[name]; + var prime2; + if (name === "k256") { + prime2 = new K256(); + } else if (name === "p224") { + prime2 = new P224(); + } else if (name === "p192") { + prime2 = new P192(); + } else if (name === "p25519") { + prime2 = new P25519(); + } else { + throw new Error("Unknown prime " + name); + } + primes[name] = prime2; + return prime2; + }; + function Red(m) { + if (typeof m === "string") { + var prime = BN3._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert2(m.gtn(1), "modulus must be greater than 1"); + this.m = m; + this.prime = null; + } + } + Red.prototype._verify1 = function _verify1(a2) { + assert2(a2.negative === 0, "red works only with positives"); + assert2(a2.red, "red works only with red numbers"); + }; + Red.prototype._verify2 = function _verify2(a2, b) { + assert2((a2.negative | b.negative) === 0, "red works only with positives"); + assert2( + a2.red && a2.red === b.red, + "red works only with red numbers" + ); + }; + Red.prototype.imod = function imod(a2) { + if (this.prime) + return this.prime.ireduce(a2)._forceRed(this); + move(a2, a2.umod(this.m)._forceRed(this)); + return a2; + }; + Red.prototype.neg = function neg3(a2) { + if (a2.isZero()) { + return a2.clone(); + } + return this.m.sub(a2)._forceRed(this); + }; + Red.prototype.add = function add5(a2, b) { + this._verify2(a2, b); + var res = a2.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + Red.prototype.iadd = function iadd(a2, b) { + this._verify2(a2, b); + var res = a2.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + Red.prototype.sub = function sub(a2, b) { + this._verify2(a2, b); + var res = a2.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + Red.prototype.isub = function isub(a2, b) { + this._verify2(a2, b); + var res = a2.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + Red.prototype.shl = function shl(a2, num) { + this._verify1(a2); + return this.imod(a2.ushln(num)); + }; + Red.prototype.imul = function imul(a2, b) { + this._verify2(a2, b); + return this.imod(a2.imul(b)); + }; + Red.prototype.mul = function mul3(a2, b) { + this._verify2(a2, b); + return this.imod(a2.mul(b)); + }; + Red.prototype.isqr = function isqr(a2) { + return this.imul(a2, a2.clone()); + }; + Red.prototype.sqr = function sqr(a2) { + return this.mul(a2, a2); + }; + Red.prototype.sqrt = function sqrt(a2) { + if (a2.isZero()) + return a2.clone(); + var mod3 = this.m.andln(3); + assert2(mod3 % 2 === 1); + if (mod3 === 3) { + var pow = this.m.add(new BN3(1)).iushrn(2); + return this.pow(a2, pow); + } + var q = this.m.subn(1); + var s2 = 0; + while (!q.isZero() && q.andln(1) === 0) { + s2++; + q.iushrn(1); + } + assert2(!q.isZero()); + var one = new BN3(1).toRed(this); + var nOne = one.redNeg(); + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN3(2 * z * z).toRed(this); + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + var c = this.pow(z, q); + var r3 = this.pow(a2, q.addn(1).iushrn(1)); + var t2 = this.pow(a2, q); + var m = s2; + while (t2.cmp(one) !== 0) { + var tmp = t2; + for (var i2 = 0; tmp.cmp(one) !== 0; i2++) { + tmp = tmp.redSqr(); + } + assert2(i2 < m); + var b = this.pow(c, new BN3(1).iushln(m - i2 - 1)); + r3 = r3.redMul(b); + c = b.redSqr(); + t2 = t2.redMul(c); + m = i2; + } + return r3; + }; + Red.prototype.invm = function invm(a2) { + var inv = a2._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + Red.prototype.pow = function pow(a2, num) { + if (num.isZero()) + return new BN3(1).toRed(this); + if (num.cmpn(1) === 0) + return a2.clone(); + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN3(1).toRed(this); + wnd[1] = a2; + for (var i2 = 2; i2 < wnd.length; i2++) { + wnd[i2] = this.mul(wnd[i2 - 1], a2); + } + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + for (i2 = num.length - 1; i2 >= 0; i2--) { + var word = num.words[i2]; + for (var j = start - 1; j >= 0; j--) { + var bit = word >> j & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i2 !== 0 || j !== 0)) + continue; + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + return res; + }; + Red.prototype.convertTo = function convertTo(num) { + var r3 = num.umod(this.m); + return r3 === num ? r3.clone() : r3; + }; + Red.prototype.convertFrom = function convertFrom(num) { + var res = num.clone(); + res.red = null; + return res; + }; + BN3.mont = function mont(num) { + return new Mont(num); + }; + function Mont(m) { + Red.call(this, m); + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - this.shift % 26; + } + this.r = new BN3(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + Mont.prototype.convertTo = function convertTo(num) { + return this.imod(num.ushln(this.shift)); + }; + Mont.prototype.convertFrom = function convertFrom(num) { + var r3 = this.imod(num.mul(this.rinv)); + r3.red = null; + return r3; + }; + Mont.prototype.imul = function imul(a2, b) { + if (a2.isZero() || b.isZero()) { + a2.words[0] = 0; + a2.length = 1; + return a2; + } + var t2 = a2.imul(b); + var c = t2.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t2.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + return res._forceRed(this); + }; + Mont.prototype.mul = function mul3(a2, b) { + if (a2.isZero() || b.isZero()) + return new BN3(0)._forceRed(this); + var t2 = a2.mul(b); + var c = t2.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t2.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + return res._forceRed(this); + }; + Mont.prototype.invm = function invm(a2) { + var res = this.imod(a2._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; + })(typeof module2 === "undefined" || module2, exports); + } +}); + +// node_modules/minimalistic-assert/index.js +var require_minimalistic_assert = __commonJS({ + "node_modules/minimalistic-assert/index.js"(exports, module2) { + init_shim(); + module2.exports = assert2; + function assert2(val, msg) { + if (!val) + throw new Error(msg || "Assertion failed"); + } + assert2.equal = function assertEqual2(l2, r3, msg) { + if (l2 != r3) + throw new Error(msg || "Assertion failed: " + l2 + " != " + r3); + }; + } +}); + +// node_modules/inherits/inherits_browser.js +var require_inherits_browser = __commonJS({ + "node_modules/inherits/inherits_browser.js"(exports, module2) { + init_shim(); + if (typeof Object.create === "function") { + module2.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + } + }; + } else { + module2.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + }; + } + } +}); + +// node_modules/inherits/inherits.js +var require_inherits = __commonJS({ + "node_modules/inherits/inherits.js"(exports, module2) { + init_shim(); + try { + util = __require("util"); + if (typeof util.inherits !== "function") + throw ""; + module2.exports = util.inherits; + } catch (e2) { + module2.exports = require_inherits_browser(); + } + var util; + } +}); + +// node_modules/hash.js/lib/hash/utils.js +var require_utils = __commonJS({ + "node_modules/hash.js/lib/hash/utils.js"(exports) { + "use strict"; + init_shim(); + var assert2 = require_minimalistic_assert(); + var inherits = require_inherits(); + exports.inherits = inherits; + function isSurrogatePair(msg, i2) { + if ((msg.charCodeAt(i2) & 64512) !== 55296) { + return false; + } + if (i2 < 0 || i2 + 1 >= msg.length) { + return false; + } + return (msg.charCodeAt(i2 + 1) & 64512) === 56320; + } + function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === "string") { + if (!enc) { + var p = 0; + for (var i2 = 0; i2 < msg.length; i2++) { + var c = msg.charCodeAt(i2); + if (c < 128) { + res[p++] = c; + } else if (c < 2048) { + res[p++] = c >> 6 | 192; + res[p++] = c & 63 | 128; + } else if (isSurrogatePair(msg, i2)) { + c = 65536 + ((c & 1023) << 10) + (msg.charCodeAt(++i2) & 1023); + res[p++] = c >> 18 | 240; + res[p++] = c >> 12 & 63 | 128; + res[p++] = c >> 6 & 63 | 128; + res[p++] = c & 63 | 128; + } else { + res[p++] = c >> 12 | 224; + res[p++] = c >> 6 & 63 | 128; + res[p++] = c & 63 | 128; + } + } + } else if (enc === "hex") { + msg = msg.replace(/[^a-z0-9]+/ig, ""); + if (msg.length % 2 !== 0) + msg = "0" + msg; + for (i2 = 0; i2 < msg.length; i2 += 2) + res.push(parseInt(msg[i2] + msg[i2 + 1], 16)); + } + } else { + for (i2 = 0; i2 < msg.length; i2++) + res[i2] = msg[i2] | 0; + } + return res; + } + exports.toArray = toArray; + function toHex2(msg) { + var res = ""; + for (var i2 = 0; i2 < msg.length; i2++) + res += zero2(msg[i2].toString(16)); + return res; + } + exports.toHex = toHex2; + function htonl(w) { + var res = w >>> 24 | w >>> 8 & 65280 | w << 8 & 16711680 | (w & 255) << 24; + return res >>> 0; + } + exports.htonl = htonl; + function toHex32(msg, endian) { + var res = ""; + for (var i2 = 0; i2 < msg.length; i2++) { + var w = msg[i2]; + if (endian === "little") + w = htonl(w); + res += zero8(w.toString(16)); + } + return res; + } + exports.toHex32 = toHex32; + function zero2(word) { + if (word.length === 1) + return "0" + word; + else + return word; + } + exports.zero2 = zero2; + function zero8(word) { + if (word.length === 7) + return "0" + word; + else if (word.length === 6) + return "00" + word; + else if (word.length === 5) + return "000" + word; + else if (word.length === 4) + return "0000" + word; + else if (word.length === 3) + return "00000" + word; + else if (word.length === 2) + return "000000" + word; + else if (word.length === 1) + return "0000000" + word; + else + return word; + } + exports.zero8 = zero8; + function join32(msg, start, end, endian) { + var len = end - start; + assert2(len % 4 === 0); + var res = new Array(len / 4); + for (var i2 = 0, k = start; i2 < res.length; i2++, k += 4) { + var w; + if (endian === "big") + w = msg[k] << 24 | msg[k + 1] << 16 | msg[k + 2] << 8 | msg[k + 3]; + else + w = msg[k + 3] << 24 | msg[k + 2] << 16 | msg[k + 1] << 8 | msg[k]; + res[i2] = w >>> 0; + } + return res; + } + exports.join32 = join32; + function split32(msg, endian) { + var res = new Array(msg.length * 4); + for (var i2 = 0, k = 0; i2 < msg.length; i2++, k += 4) { + var m = msg[i2]; + if (endian === "big") { + res[k] = m >>> 24; + res[k + 1] = m >>> 16 & 255; + res[k + 2] = m >>> 8 & 255; + res[k + 3] = m & 255; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = m >>> 16 & 255; + res[k + 1] = m >>> 8 & 255; + res[k] = m & 255; + } + } + return res; + } + exports.split32 = split32; + function rotr32(w, b) { + return w >>> b | w << 32 - b; + } + exports.rotr32 = rotr32; + function rotl32(w, b) { + return w << b | w >>> 32 - b; + } + exports.rotl32 = rotl32; + function sum32(a2, b) { + return a2 + b >>> 0; + } + exports.sum32 = sum32; + function sum32_3(a2, b, c) { + return a2 + b + c >>> 0; + } + exports.sum32_3 = sum32_3; + function sum32_4(a2, b, c, d) { + return a2 + b + c + d >>> 0; + } + exports.sum32_4 = sum32_4; + function sum32_5(a2, b, c, d, e2) { + return a2 + b + c + d + e2 >>> 0; + } + exports.sum32_5 = sum32_5; + function sum64(buf, pos, ah, al) { + var bh = buf[pos]; + var bl = buf[pos + 1]; + var lo = al + bl >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + buf[pos] = hi >>> 0; + buf[pos + 1] = lo; + } + exports.sum64 = sum64; + function sum64_hi(ah, al, bh, bl) { + var lo = al + bl >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + return hi >>> 0; + } + exports.sum64_hi = sum64_hi; + function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; + } + exports.sum64_lo = sum64_lo; + function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { + var carry = 0; + var lo = al; + lo = lo + bl >>> 0; + carry += lo < al ? 1 : 0; + lo = lo + cl >>> 0; + carry += lo < cl ? 1 : 0; + lo = lo + dl >>> 0; + carry += lo < dl ? 1 : 0; + var hi = ah + bh + ch + dh + carry; + return hi >>> 0; + } + exports.sum64_4_hi = sum64_4_hi; + function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { + var lo = al + bl + cl + dl; + return lo >>> 0; + } + exports.sum64_4_lo = sum64_4_lo; + function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var carry = 0; + var lo = al; + lo = lo + bl >>> 0; + carry += lo < al ? 1 : 0; + lo = lo + cl >>> 0; + carry += lo < cl ? 1 : 0; + lo = lo + dl >>> 0; + carry += lo < dl ? 1 : 0; + lo = lo + el >>> 0; + carry += lo < el ? 1 : 0; + var hi = ah + bh + ch + dh + eh + carry; + return hi >>> 0; + } + exports.sum64_5_hi = sum64_5_hi; + function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var lo = al + bl + cl + dl + el; + return lo >>> 0; + } + exports.sum64_5_lo = sum64_5_lo; + function rotr64_hi(ah, al, num) { + var r3 = al << 32 - num | ah >>> num; + return r3 >>> 0; + } + exports.rotr64_hi = rotr64_hi; + function rotr64_lo(ah, al, num) { + var r3 = ah << 32 - num | al >>> num; + return r3 >>> 0; + } + exports.rotr64_lo = rotr64_lo; + function shr64_hi(ah, al, num) { + return ah >>> num; + } + exports.shr64_hi = shr64_hi; + function shr64_lo(ah, al, num) { + var r3 = ah << 32 - num | al >>> num; + return r3 >>> 0; + } + exports.shr64_lo = shr64_lo; + } +}); + +// node_modules/hash.js/lib/hash/common.js +var require_common = __commonJS({ + "node_modules/hash.js/lib/hash/common.js"(exports) { + "use strict"; + init_shim(); + var utils = require_utils(); + var assert2 = require_minimalistic_assert(); + function BlockHash() { + this.pending = null; + this.pendingTotal = 0; + this.blockSize = this.constructor.blockSize; + this.outSize = this.constructor.outSize; + this.hmacStrength = this.constructor.hmacStrength; + this.padLength = this.constructor.padLength / 8; + this.endian = "big"; + this._delta8 = this.blockSize / 8; + this._delta32 = this.blockSize / 32; + } + exports.BlockHash = BlockHash; + BlockHash.prototype.update = function update2(msg, enc) { + msg = utils.toArray(msg, enc); + if (!this.pending) + this.pending = msg; + else + this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; + if (this.pending.length >= this._delta8) { + msg = this.pending; + var r3 = msg.length % this._delta8; + this.pending = msg.slice(msg.length - r3, msg.length); + if (this.pending.length === 0) + this.pending = null; + msg = utils.join32(msg, 0, msg.length - r3, this.endian); + for (var i2 = 0; i2 < msg.length; i2 += this._delta32) + this._update(msg, i2, i2 + this._delta32); + } + return this; + }; + BlockHash.prototype.digest = function digest(enc) { + this.update(this._pad()); + assert2(this.pending === null); + return this._digest(enc); + }; + BlockHash.prototype._pad = function pad() { + var len = this.pendingTotal; + var bytes = this._delta8; + var k = bytes - (len + this.padLength) % bytes; + var res = new Array(k + this.padLength); + res[0] = 128; + for (var i2 = 1; i2 < k; i2++) + res[i2] = 0; + len <<= 3; + if (this.endian === "big") { + for (var t2 = 8; t2 < this.padLength; t2++) + res[i2++] = 0; + res[i2++] = 0; + res[i2++] = 0; + res[i2++] = 0; + res[i2++] = 0; + res[i2++] = len >>> 24 & 255; + res[i2++] = len >>> 16 & 255; + res[i2++] = len >>> 8 & 255; + res[i2++] = len & 255; + } else { + res[i2++] = len & 255; + res[i2++] = len >>> 8 & 255; + res[i2++] = len >>> 16 & 255; + res[i2++] = len >>> 24 & 255; + res[i2++] = 0; + res[i2++] = 0; + res[i2++] = 0; + res[i2++] = 0; + for (t2 = 8; t2 < this.padLength; t2++) + res[i2++] = 0; + } + return res; + }; + } +}); + +// node_modules/hash.js/lib/hash/sha/common.js +var require_common2 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/common.js"(exports) { + "use strict"; + init_shim(); + var utils = require_utils(); + var rotr32 = utils.rotr32; + function ft_1(s2, x, y, z) { + if (s2 === 0) + return ch32(x, y, z); + if (s2 === 1 || s2 === 3) + return p32(x, y, z); + if (s2 === 2) + return maj32(x, y, z); + } + exports.ft_1 = ft_1; + function ch32(x, y, z) { + return x & y ^ ~x & z; + } + exports.ch32 = ch32; + function maj32(x, y, z) { + return x & y ^ x & z ^ y & z; + } + exports.maj32 = maj32; + function p32(x, y, z) { + return x ^ y ^ z; + } + exports.p32 = p32; + function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); + } + exports.s0_256 = s0_256; + function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); + } + exports.s1_256 = s1_256; + function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3; + } + exports.g0_256 = g0_256; + function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10; + } + exports.g1_256 = g1_256; + } +}); + +// node_modules/hash.js/lib/hash/sha/1.js +var require__ = __commonJS({ + "node_modules/hash.js/lib/hash/sha/1.js"(exports, module2) { + "use strict"; + init_shim(); + var utils = require_utils(); + var common = require_common(); + var shaCommon = require_common2(); + var rotl32 = utils.rotl32; + var sum32 = utils.sum32; + var sum32_5 = utils.sum32_5; + var ft_1 = shaCommon.ft_1; + var BlockHash = common.BlockHash; + var sha1_K = [ + 1518500249, + 1859775393, + 2400959708, + 3395469782 + ]; + function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); + BlockHash.call(this); + this.h = [ + 1732584193, + 4023233417, + 2562383102, + 271733878, + 3285377520 + ]; + this.W = new Array(80); + } + utils.inherits(SHA1, BlockHash); + module2.exports = SHA1; + SHA1.blockSize = 512; + SHA1.outSize = 160; + SHA1.hmacStrength = 80; + SHA1.padLength = 64; + SHA1.prototype._update = function _update(msg, start) { + var W = this.W; + for (var i2 = 0; i2 < 16; i2++) + W[i2] = msg[start + i2]; + for (; i2 < W.length; i2++) + W[i2] = rotl32(W[i2 - 3] ^ W[i2 - 8] ^ W[i2 - 14] ^ W[i2 - 16], 1); + var a2 = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e2 = this.h[4]; + for (i2 = 0; i2 < W.length; i2++) { + var s2 = ~~(i2 / 20); + var t2 = sum32_5(rotl32(a2, 5), ft_1(s2, b, c, d), e2, W[i2], sha1_K[s2]); + e2 = d; + d = c; + c = rotl32(b, 30); + b = a2; + a2 = t2; + } + this.h[0] = sum32(this.h[0], a2); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e2); + }; + SHA1.prototype._digest = function digest(enc) { + if (enc === "hex") + return utils.toHex32(this.h, "big"); + else + return utils.split32(this.h, "big"); + }; + } +}); + +// node_modules/hash.js/lib/hash/sha/256.js +var require__2 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/256.js"(exports, module2) { + "use strict"; + init_shim(); + var utils = require_utils(); + var common = require_common(); + var shaCommon = require_common2(); + var assert2 = require_minimalistic_assert(); + var sum32 = utils.sum32; + var sum32_4 = utils.sum32_4; + var sum32_5 = utils.sum32_5; + var ch32 = shaCommon.ch32; + var maj32 = shaCommon.maj32; + var s0_256 = shaCommon.s0_256; + var s1_256 = shaCommon.s1_256; + var g0_256 = shaCommon.g0_256; + var g1_256 = shaCommon.g1_256; + var BlockHash = common.BlockHash; + var sha256_K = [ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]; + function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); + BlockHash.call(this); + this.h = [ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 + ]; + this.k = sha256_K; + this.W = new Array(64); + } + utils.inherits(SHA256, BlockHash); + module2.exports = SHA256; + SHA256.blockSize = 512; + SHA256.outSize = 256; + SHA256.hmacStrength = 192; + SHA256.padLength = 64; + SHA256.prototype._update = function _update(msg, start) { + var W = this.W; + for (var i2 = 0; i2 < 16; i2++) + W[i2] = msg[start + i2]; + for (; i2 < W.length; i2++) + W[i2] = sum32_4(g1_256(W[i2 - 2]), W[i2 - 7], g0_256(W[i2 - 15]), W[i2 - 16]); + var a2 = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e2 = this.h[4]; + var f = this.h[5]; + var g = this.h[6]; + var h = this.h[7]; + assert2(this.k.length === W.length); + for (i2 = 0; i2 < W.length; i2++) { + var T1 = sum32_5(h, s1_256(e2), ch32(e2, f, g), this.k[i2], W[i2]); + var T2 = sum32(s0_256(a2), maj32(a2, b, c)); + h = g; + g = f; + f = e2; + e2 = sum32(d, T1); + d = c; + c = b; + b = a2; + a2 = sum32(T1, T2); + } + this.h[0] = sum32(this.h[0], a2); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e2); + this.h[5] = sum32(this.h[5], f); + this.h[6] = sum32(this.h[6], g); + this.h[7] = sum32(this.h[7], h); + }; + SHA256.prototype._digest = function digest(enc) { + if (enc === "hex") + return utils.toHex32(this.h, "big"); + else + return utils.split32(this.h, "big"); + }; + } +}); + +// node_modules/hash.js/lib/hash/sha/224.js +var require__3 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/224.js"(exports, module2) { + "use strict"; + init_shim(); + var utils = require_utils(); + var SHA256 = require__2(); + function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); + SHA256.call(this); + this.h = [ + 3238371032, + 914150663, + 812702999, + 4144912697, + 4290775857, + 1750603025, + 1694076839, + 3204075428 + ]; + } + utils.inherits(SHA224, SHA256); + module2.exports = SHA224; + SHA224.blockSize = 512; + SHA224.outSize = 224; + SHA224.hmacStrength = 192; + SHA224.padLength = 64; + SHA224.prototype._digest = function digest(enc) { + if (enc === "hex") + return utils.toHex32(this.h.slice(0, 7), "big"); + else + return utils.split32(this.h.slice(0, 7), "big"); + }; + } +}); + +// node_modules/hash.js/lib/hash/sha/512.js +var require__4 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/512.js"(exports, module2) { + "use strict"; + init_shim(); + var utils = require_utils(); + var common = require_common(); + var assert2 = require_minimalistic_assert(); + var rotr64_hi = utils.rotr64_hi; + var rotr64_lo = utils.rotr64_lo; + var shr64_hi = utils.shr64_hi; + var shr64_lo = utils.shr64_lo; + var sum64 = utils.sum64; + var sum64_hi = utils.sum64_hi; + var sum64_lo = utils.sum64_lo; + var sum64_4_hi = utils.sum64_4_hi; + var sum64_4_lo = utils.sum64_4_lo; + var sum64_5_hi = utils.sum64_5_hi; + var sum64_5_lo = utils.sum64_5_lo; + var BlockHash = common.BlockHash; + var sha512_K = [ + 1116352408, + 3609767458, + 1899447441, + 602891725, + 3049323471, + 3964484399, + 3921009573, + 2173295548, + 961987163, + 4081628472, + 1508970993, + 3053834265, + 2453635748, + 2937671579, + 2870763221, + 3664609560, + 3624381080, + 2734883394, + 310598401, + 1164996542, + 607225278, + 1323610764, + 1426881987, + 3590304994, + 1925078388, + 4068182383, + 2162078206, + 991336113, + 2614888103, + 633803317, + 3248222580, + 3479774868, + 3835390401, + 2666613458, + 4022224774, + 944711139, + 264347078, + 2341262773, + 604807628, + 2007800933, + 770255983, + 1495990901, + 1249150122, + 1856431235, + 1555081692, + 3175218132, + 1996064986, + 2198950837, + 2554220882, + 3999719339, + 2821834349, + 766784016, + 2952996808, + 2566594879, + 3210313671, + 3203337956, + 3336571891, + 1034457026, + 3584528711, + 2466948901, + 113926993, + 3758326383, + 338241895, + 168717936, + 666307205, + 1188179964, + 773529912, + 1546045734, + 1294757372, + 1522805485, + 1396182291, + 2643833823, + 1695183700, + 2343527390, + 1986661051, + 1014477480, + 2177026350, + 1206759142, + 2456956037, + 344077627, + 2730485921, + 1290863460, + 2820302411, + 3158454273, + 3259730800, + 3505952657, + 3345764771, + 106217008, + 3516065817, + 3606008344, + 3600352804, + 1432725776, + 4094571909, + 1467031594, + 275423344, + 851169720, + 430227734, + 3100823752, + 506948616, + 1363258195, + 659060556, + 3750685593, + 883997877, + 3785050280, + 958139571, + 3318307427, + 1322822218, + 3812723403, + 1537002063, + 2003034995, + 1747873779, + 3602036899, + 1955562222, + 1575990012, + 2024104815, + 1125592928, + 2227730452, + 2716904306, + 2361852424, + 442776044, + 2428436474, + 593698344, + 2756734187, + 3733110249, + 3204031479, + 2999351573, + 3329325298, + 3815920427, + 3391569614, + 3928383900, + 3515267271, + 566280711, + 3940187606, + 3454069534, + 4118630271, + 4000239992, + 116418474, + 1914138554, + 174292421, + 2731055270, + 289380356, + 3203993006, + 460393269, + 320620315, + 685471733, + 587496836, + 852142971, + 1086792851, + 1017036298, + 365543100, + 1126000580, + 2618297676, + 1288033470, + 3409855158, + 1501505948, + 4234509866, + 1607167915, + 987167468, + 1816402316, + 1246189591 + ]; + function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); + BlockHash.call(this); + this.h = [ + 1779033703, + 4089235720, + 3144134277, + 2227873595, + 1013904242, + 4271175723, + 2773480762, + 1595750129, + 1359893119, + 2917565137, + 2600822924, + 725511199, + 528734635, + 4215389547, + 1541459225, + 327033209 + ]; + this.k = sha512_K; + this.W = new Array(160); + } + utils.inherits(SHA512, BlockHash); + module2.exports = SHA512; + SHA512.blockSize = 1024; + SHA512.outSize = 512; + SHA512.hmacStrength = 192; + SHA512.padLength = 128; + SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { + var W = this.W; + for (var i2 = 0; i2 < 32; i2++) + W[i2] = msg[start + i2]; + for (; i2 < W.length; i2 += 2) { + var c0_hi = g1_512_hi(W[i2 - 4], W[i2 - 3]); + var c0_lo = g1_512_lo(W[i2 - 4], W[i2 - 3]); + var c1_hi = W[i2 - 14]; + var c1_lo = W[i2 - 13]; + var c2_hi = g0_512_hi(W[i2 - 30], W[i2 - 29]); + var c2_lo = g0_512_lo(W[i2 - 30], W[i2 - 29]); + var c3_hi = W[i2 - 32]; + var c3_lo = W[i2 - 31]; + W[i2] = sum64_4_hi( + c0_hi, + c0_lo, + c1_hi, + c1_lo, + c2_hi, + c2_lo, + c3_hi, + c3_lo + ); + W[i2 + 1] = sum64_4_lo( + c0_hi, + c0_lo, + c1_hi, + c1_lo, + c2_hi, + c2_lo, + c3_hi, + c3_lo + ); + } + }; + SHA512.prototype._update = function _update(msg, start) { + this._prepareBlock(msg, start); + var W = this.W; + var ah = this.h[0]; + var al = this.h[1]; + var bh = this.h[2]; + var bl = this.h[3]; + var ch = this.h[4]; + var cl = this.h[5]; + var dh = this.h[6]; + var dl = this.h[7]; + var eh = this.h[8]; + var el = this.h[9]; + var fh = this.h[10]; + var fl = this.h[11]; + var gh = this.h[12]; + var gl = this.h[13]; + var hh = this.h[14]; + var hl = this.h[15]; + assert2(this.k.length === W.length); + for (var i2 = 0; i2 < W.length; i2 += 2) { + var c0_hi = hh; + var c0_lo = hl; + var c1_hi = s1_512_hi(eh, el); + var c1_lo = s1_512_lo(eh, el); + var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); + var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); + var c3_hi = this.k[i2]; + var c3_lo = this.k[i2 + 1]; + var c4_hi = W[i2]; + var c4_lo = W[i2 + 1]; + var T1_hi = sum64_5_hi( + c0_hi, + c0_lo, + c1_hi, + c1_lo, + c2_hi, + c2_lo, + c3_hi, + c3_lo, + c4_hi, + c4_lo + ); + var T1_lo = sum64_5_lo( + c0_hi, + c0_lo, + c1_hi, + c1_lo, + c2_hi, + c2_lo, + c3_hi, + c3_lo, + c4_hi, + c4_lo + ); + c0_hi = s0_512_hi(ah, al); + c0_lo = s0_512_lo(ah, al); + c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); + c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); + var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); + var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); + hh = gh; + hl = gl; + gh = fh; + gl = fl; + fh = eh; + fl = el; + eh = sum64_hi(dh, dl, T1_hi, T1_lo); + el = sum64_lo(dl, dl, T1_hi, T1_lo); + dh = ch; + dl = cl; + ch = bh; + cl = bl; + bh = ah; + bl = al; + ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); + al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); + } + sum64(this.h, 0, ah, al); + sum64(this.h, 2, bh, bl); + sum64(this.h, 4, ch, cl); + sum64(this.h, 6, dh, dl); + sum64(this.h, 8, eh, el); + sum64(this.h, 10, fh, fl); + sum64(this.h, 12, gh, gl); + sum64(this.h, 14, hh, hl); + }; + SHA512.prototype._digest = function digest(enc) { + if (enc === "hex") + return utils.toHex32(this.h, "big"); + else + return utils.split32(this.h, "big"); + }; + function ch64_hi(xh, xl, yh, yl, zh) { + var r3 = xh & yh ^ ~xh & zh; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r3 = xl & yl ^ ~xl & zl; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function maj64_hi(xh, xl, yh, yl, zh) { + var r3 = xh & yh ^ xh & zh ^ yh & zh; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r3 = xl & yl ^ xl & zl ^ yl & zl; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); + var c2_hi = rotr64_hi(xl, xh, 7); + var r3 = c0_hi ^ c1_hi ^ c2_hi; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); + var c2_lo = rotr64_lo(xl, xh, 7); + var r3 = c0_lo ^ c1_lo ^ c2_lo; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function s1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 14); + var c1_hi = rotr64_hi(xh, xl, 18); + var c2_hi = rotr64_hi(xl, xh, 9); + var r3 = c0_hi ^ c1_hi ^ c2_hi; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function s1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 14); + var c1_lo = rotr64_lo(xh, xl, 18); + var c2_lo = rotr64_lo(xl, xh, 9); + var r3 = c0_lo ^ c1_lo ^ c2_lo; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function g0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 1); + var c1_hi = rotr64_hi(xh, xl, 8); + var c2_hi = shr64_hi(xh, xl, 7); + var r3 = c0_hi ^ c1_hi ^ c2_hi; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function g0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 1); + var c1_lo = rotr64_lo(xh, xl, 8); + var c2_lo = shr64_lo(xh, xl, 7); + var r3 = c0_lo ^ c1_lo ^ c2_lo; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); + var c2_hi = shr64_hi(xh, xl, 6); + var r3 = c0_hi ^ c1_hi ^ c2_hi; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); + var c2_lo = shr64_lo(xh, xl, 6); + var r3 = c0_lo ^ c1_lo ^ c2_lo; + if (r3 < 0) + r3 += 4294967296; + return r3; + } + } +}); + +// node_modules/hash.js/lib/hash/sha/384.js +var require__5 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/384.js"(exports, module2) { + "use strict"; + init_shim(); + var utils = require_utils(); + var SHA512 = require__4(); + function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); + SHA512.call(this); + this.h = [ + 3418070365, + 3238371032, + 1654270250, + 914150663, + 2438529370, + 812702999, + 355462360, + 4144912697, + 1731405415, + 4290775857, + 2394180231, + 1750603025, + 3675008525, + 1694076839, + 1203062813, + 3204075428 + ]; + } + utils.inherits(SHA384, SHA512); + module2.exports = SHA384; + SHA384.blockSize = 1024; + SHA384.outSize = 384; + SHA384.hmacStrength = 192; + SHA384.padLength = 128; + SHA384.prototype._digest = function digest(enc) { + if (enc === "hex") + return utils.toHex32(this.h.slice(0, 12), "big"); + else + return utils.split32(this.h.slice(0, 12), "big"); + }; + } +}); + +// node_modules/hash.js/lib/hash/sha.js +var require_sha = __commonJS({ + "node_modules/hash.js/lib/hash/sha.js"(exports) { + "use strict"; + init_shim(); + exports.sha1 = require__(); + exports.sha224 = require__3(); + exports.sha256 = require__2(); + exports.sha384 = require__5(); + exports.sha512 = require__4(); + } +}); + +// node_modules/hash.js/lib/hash/ripemd.js +var require_ripemd = __commonJS({ + "node_modules/hash.js/lib/hash/ripemd.js"(exports) { + "use strict"; + init_shim(); + var utils = require_utils(); + var common = require_common(); + var rotl32 = utils.rotl32; + var sum32 = utils.sum32; + var sum32_3 = utils.sum32_3; + var sum32_4 = utils.sum32_4; + var BlockHash = common.BlockHash; + function RIPEMD160() { + if (!(this instanceof RIPEMD160)) + return new RIPEMD160(); + BlockHash.call(this); + this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]; + this.endian = "little"; + } + utils.inherits(RIPEMD160, BlockHash); + exports.ripemd160 = RIPEMD160; + RIPEMD160.blockSize = 512; + RIPEMD160.outSize = 160; + RIPEMD160.hmacStrength = 192; + RIPEMD160.padLength = 64; + RIPEMD160.prototype._update = function update2(msg, start) { + var A2 = this.h[0]; + var B = this.h[1]; + var C = this.h[2]; + var D3 = this.h[3]; + var E = this.h[4]; + var Ah = A2; + var Bh = B; + var Ch2 = C; + var Dh = D3; + var Eh = E; + for (var j = 0; j < 80; j++) { + var T = sum32( + rotl32( + sum32_4(A2, f(j, B, C, D3), msg[r3[j] + start], K2(j)), + s2[j] + ), + E + ); + A2 = E; + E = D3; + D3 = rotl32(C, 10); + C = B; + B = T; + T = sum32( + rotl32( + sum32_4(Ah, f(79 - j, Bh, Ch2, Dh), msg[rh[j] + start], Kh(j)), + sh[j] + ), + Eh + ); + Ah = Eh; + Eh = Dh; + Dh = rotl32(Ch2, 10); + Ch2 = Bh; + Bh = T; + } + T = sum32_3(this.h[1], C, Dh); + this.h[1] = sum32_3(this.h[2], D3, Eh); + this.h[2] = sum32_3(this.h[3], E, Ah); + this.h[3] = sum32_3(this.h[4], A2, Bh); + this.h[4] = sum32_3(this.h[0], B, Ch2); + this.h[0] = T; + }; + RIPEMD160.prototype._digest = function digest(enc) { + if (enc === "hex") + return utils.toHex32(this.h, "little"); + else + return utils.split32(this.h, "little"); + }; + function f(j, x, y, z) { + if (j <= 15) + return x ^ y ^ z; + else if (j <= 31) + return x & y | ~x & z; + else if (j <= 47) + return (x | ~y) ^ z; + else if (j <= 63) + return x & z | y & ~z; + else + return x ^ (y | ~z); + } + function K2(j) { + if (j <= 15) + return 0; + else if (j <= 31) + return 1518500249; + else if (j <= 47) + return 1859775393; + else if (j <= 63) + return 2400959708; + else + return 2840853838; + } + function Kh(j) { + if (j <= 15) + return 1352829926; + else if (j <= 31) + return 1548603684; + else if (j <= 47) + return 1836072691; + else if (j <= 63) + return 2053994217; + else + return 0; + } + var r3 = [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 7, + 4, + 13, + 1, + 10, + 6, + 15, + 3, + 12, + 0, + 9, + 5, + 2, + 14, + 11, + 8, + 3, + 10, + 14, + 4, + 9, + 15, + 8, + 1, + 2, + 7, + 0, + 6, + 13, + 11, + 5, + 12, + 1, + 9, + 11, + 10, + 0, + 8, + 12, + 4, + 13, + 3, + 7, + 15, + 14, + 5, + 6, + 2, + 4, + 0, + 5, + 9, + 7, + 12, + 2, + 10, + 14, + 1, + 3, + 8, + 11, + 6, + 15, + 13 + ]; + var rh = [ + 5, + 14, + 7, + 0, + 9, + 2, + 11, + 4, + 13, + 6, + 15, + 8, + 1, + 10, + 3, + 12, + 6, + 11, + 3, + 7, + 0, + 13, + 5, + 10, + 14, + 15, + 8, + 12, + 4, + 9, + 1, + 2, + 15, + 5, + 1, + 3, + 7, + 14, + 6, + 9, + 11, + 8, + 12, + 2, + 10, + 0, + 4, + 13, + 8, + 6, + 4, + 1, + 3, + 11, + 15, + 0, + 5, + 12, + 2, + 13, + 9, + 7, + 10, + 14, + 12, + 15, + 10, + 4, + 1, + 5, + 8, + 7, + 6, + 2, + 13, + 14, + 0, + 3, + 9, + 11 + ]; + var s2 = [ + 11, + 14, + 15, + 12, + 5, + 8, + 7, + 9, + 11, + 13, + 14, + 15, + 6, + 7, + 9, + 8, + 7, + 6, + 8, + 13, + 11, + 9, + 7, + 15, + 7, + 12, + 15, + 9, + 11, + 7, + 13, + 12, + 11, + 13, + 6, + 7, + 14, + 9, + 13, + 15, + 14, + 8, + 13, + 6, + 5, + 12, + 7, + 5, + 11, + 12, + 14, + 15, + 14, + 15, + 9, + 8, + 9, + 14, + 5, + 6, + 8, + 6, + 5, + 12, + 9, + 15, + 5, + 11, + 6, + 8, + 13, + 12, + 5, + 12, + 13, + 14, + 11, + 8, + 5, + 6 + ]; + var sh = [ + 8, + 9, + 9, + 11, + 13, + 15, + 15, + 5, + 7, + 7, + 8, + 11, + 14, + 14, + 12, + 6, + 9, + 13, + 15, + 7, + 12, + 8, + 9, + 11, + 7, + 7, + 12, + 7, + 6, + 15, + 13, + 11, + 9, + 7, + 15, + 11, + 8, + 6, + 6, + 14, + 12, + 13, + 5, + 14, + 13, + 13, + 7, + 5, + 15, + 5, + 8, + 11, + 14, + 14, + 6, + 14, + 6, + 9, + 12, + 9, + 12, + 5, + 15, + 8, + 8, + 5, + 12, + 9, + 12, + 5, + 14, + 6, + 8, + 13, + 6, + 5, + 15, + 13, + 11, + 11 + ]; + } +}); + +// node_modules/hash.js/lib/hash/hmac.js +var require_hmac = __commonJS({ + "node_modules/hash.js/lib/hash/hmac.js"(exports, module2) { + "use strict"; + init_shim(); + var utils = require_utils(); + var assert2 = require_minimalistic_assert(); + function Hmac(hash3, key2, enc) { + if (!(this instanceof Hmac)) + return new Hmac(hash3, key2, enc); + this.Hash = hash3; + this.blockSize = hash3.blockSize / 8; + this.outSize = hash3.outSize / 8; + this.inner = null; + this.outer = null; + this._init(utils.toArray(key2, enc)); + } + module2.exports = Hmac; + Hmac.prototype._init = function init2(key2) { + if (key2.length > this.blockSize) + key2 = new this.Hash().update(key2).digest(); + assert2(key2.length <= this.blockSize); + for (var i2 = key2.length; i2 < this.blockSize; i2++) + key2.push(0); + for (i2 = 0; i2 < key2.length; i2++) + key2[i2] ^= 54; + this.inner = new this.Hash().update(key2); + for (i2 = 0; i2 < key2.length; i2++) + key2[i2] ^= 106; + this.outer = new this.Hash().update(key2); + }; + Hmac.prototype.update = function update2(msg, enc) { + this.inner.update(msg, enc); + return this; + }; + Hmac.prototype.digest = function digest(enc) { + this.outer.update(this.inner.digest()); + return this.outer.digest(enc); + }; + } +}); + +// node_modules/hash.js/lib/hash.js +var require_hash = __commonJS({ + "node_modules/hash.js/lib/hash.js"(exports) { + init_shim(); + var hash3 = exports; + hash3.utils = require_utils(); + hash3.common = require_common(); + hash3.sha = require_sha(); + hash3.ripemd = require_ripemd(); + hash3.hmac = require_hmac(); + hash3.sha1 = hash3.sha.sha1; + hash3.sha256 = hash3.sha.sha256; + hash3.sha224 = hash3.sha.sha224; + hash3.sha384 = hash3.sha.sha384; + hash3.sha512 = hash3.sha.sha512; + hash3.ripemd160 = hash3.ripemd.ripemd160; + } +}); + +// node_modules/@ethersproject/signing-key/lib.esm/elliptic.js +function createCommonjsModule(fn, basedir, module2) { + return module2 = { + path: basedir, + exports: {}, + require: function(path, base2) { + return commonjsRequire(path, base2 === void 0 || base2 === null ? module2.path : base2); + } + }, fn(module2, module2.exports), module2.exports; +} +function commonjsRequire() { + throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); +} +function assert(val, msg) { + if (!val) + throw new Error(msg || "Assertion failed"); +} +function BaseCurve(type, conf) { + this.type = type; + this.p = new import_bn2.default(conf.p, 16); + this.red = conf.prime ? import_bn2.default.red(conf.prime) : import_bn2.default.mont(this.p); + this.zero = new import_bn2.default(0).toRed(this.red); + this.one = new import_bn2.default(1).toRed(this.red); + this.two = new import_bn2.default(2).toRed(this.red); + this.n = conf.n && new import_bn2.default(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + this._wnafT1 = new Array(4); + this._wnafT2 = new Array(4); + this._wnafT3 = new Array(4); + this._wnafT4 = new Array(4); + this._bitLength = this.n ? this.n.bitLength() : 0; + var adjustCount = this.n && this.p.div(this.n); + if (!adjustCount || adjustCount.cmpn(100) > 0) { + this.redN = null; + } else { + this._maxwellTrick = true; + this.redN = this.n.toRed(this.red); + } +} +function BasePoint(curve, type) { + this.curve = curve; + this.type = type; + this.precomputed = null; +} +function ShortCurve(conf) { + base.call(this, "short", conf); + this.a = new import_bn2.default(conf.a, 16).toRed(this.red); + this.b = new import_bn2.default(conf.b, 16).toRed(this.red); + this.tinv = this.two.redInvm(); + this.zeroA = this.a.fromRed().cmpn(0) === 0; + this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); +} +function Point(curve, x, y, isRed) { + base.BasePoint.call(this, curve, "affine"); + if (x === null && y === null) { + this.x = null; + this.y = null; + this.inf = true; + } else { + this.x = new import_bn2.default(x, 16); + this.y = new import_bn2.default(y, 16); + if (isRed) { + this.x.forceRed(this.curve.red); + this.y.forceRed(this.curve.red); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + this.inf = false; + } +} +function JPoint(curve, x, y, z) { + base.BasePoint.call(this, curve, "jacobian"); + if (x === null && y === null && z === null) { + this.x = this.curve.one; + this.y = this.curve.one; + this.z = new import_bn2.default(0); + } else { + this.x = new import_bn2.default(x, 16); + this.y = new import_bn2.default(y, 16); + this.z = new import_bn2.default(z, 16); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; +} +function HmacDRBG(options) { + if (!(this instanceof HmacDRBG)) + return new HmacDRBG(options); + this.hash = options.hash; + this.predResist = !!options.predResist; + this.outLen = this.hash.outSize; + this.minEntropy = options.minEntropy || this.hash.hmacStrength; + this._reseed = null; + this.reseedInterval = null; + this.K = null; + this.V = null; + var entropy = utils_1.toArray(options.entropy, options.entropyEnc || "hex"); + var nonce = utils_1.toArray(options.nonce, options.nonceEnc || "hex"); + var pers = utils_1.toArray(options.pers, options.persEnc || "hex"); + minimalisticAssert( + entropy.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ); + this._init(entropy, nonce, pers); +} +function KeyPair(ec2, options) { + this.ec = ec2; + this.priv = null; + this.pub = null; + if (options.priv) + this._importPrivate(options.priv, options.privEnc); + if (options.pub) + this._importPublic(options.pub, options.pubEnc); +} +function Signature(options, enc) { + if (options instanceof Signature) + return options; + if (this._importDER(options, enc)) + return; + assert$4(options.r && options.s, "Signature without r or s"); + this.r = new import_bn2.default(options.r, 16); + this.s = new import_bn2.default(options.s, 16); + if (options.recoveryParam === void 0) + this.recoveryParam = null; + else + this.recoveryParam = options.recoveryParam; +} +function Position() { + this.place = 0; +} +function getLength(buf, p) { + var initial = buf[p.place++]; + if (!(initial & 128)) { + return initial; + } + var octetLen = initial & 15; + if (octetLen === 0 || octetLen > 4) { + return false; + } + var val = 0; + for (var i2 = 0, off = p.place; i2 < octetLen; i2++, off++) { + val <<= 8; + val |= buf[off]; + val >>>= 0; + } + if (val <= 127) { + return false; + } + p.place = off; + return val; +} +function rmPadding(buf) { + var i2 = 0; + var len = buf.length - 1; + while (!buf[i2] && !(buf[i2 + 1] & 128) && i2 < len) { + i2++; + } + if (i2 === 0) { + return buf; + } + return buf.slice(i2); +} +function constructLength(arr, len) { + if (len < 128) { + arr.push(len); + return; + } + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 128); + while (--octets) { + arr.push(len >>> (octets << 3) & 255); + } + arr.push(len); +} +function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + if (typeof options === "string") { + assert$5( + Object.prototype.hasOwnProperty.call(curves_1, options), + "Unknown curve " + options + ); + options = curves_1[options]; + } + if (options instanceof curves_1.PresetCurve) + options = { curve: options }; + this.curve = options.curve.curve; + this.n = this.curve.n; + this.nh = this.n.ushrn(1); + this.g = this.curve.g; + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + this.hash = options.hash || options.curve.hash; +} +var import_bn2, import_hash2, minimalisticAssert, utils_1, utils_1$1, getNAF, getJSF, assert$1, base, inherits_browser, assert$2, short_1, curve_1, curves_1, hmacDrbg, assert$3, key, assert$4, signature, rand, assert$5, ec, elliptic_1, EC$1; +var init_elliptic = __esm({ + "node_modules/@ethersproject/signing-key/lib.esm/elliptic.js"() { + init_shim(); + import_bn2 = __toESM(require_bn2()); + import_hash2 = __toESM(require_hash()); + minimalisticAssert = assert; + assert.equal = function assertEqual(l2, r3, msg) { + if (l2 != r3) + throw new Error(msg || "Assertion failed: " + l2 + " != " + r3); + }; + utils_1 = createCommonjsModule(function(module2, exports) { + "use strict"; + var utils = exports; + function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg !== "string") { + for (var i2 = 0; i2 < msg.length; i2++) + res[i2] = msg[i2] | 0; + return res; + } + if (enc === "hex") { + msg = msg.replace(/[^a-z0-9]+/ig, ""); + if (msg.length % 2 !== 0) + msg = "0" + msg; + for (var i2 = 0; i2 < msg.length; i2 += 2) + res.push(parseInt(msg[i2] + msg[i2 + 1], 16)); + } else { + for (var i2 = 0; i2 < msg.length; i2++) { + var c = msg.charCodeAt(i2); + var hi = c >> 8; + var lo = c & 255; + if (hi) + res.push(hi, lo); + else + res.push(lo); + } + } + return res; + } + utils.toArray = toArray; + function zero2(word) { + if (word.length === 1) + return "0" + word; + else + return word; + } + utils.zero2 = zero2; + function toHex2(msg) { + var res = ""; + for (var i2 = 0; i2 < msg.length; i2++) + res += zero2(msg[i2].toString(16)); + return res; + } + utils.toHex = toHex2; + utils.encode = function encode6(arr, enc) { + if (enc === "hex") + return toHex2(arr); + else + return arr; + }; + }); + utils_1$1 = createCommonjsModule(function(module2, exports) { + "use strict"; + var utils = exports; + utils.assert = minimalisticAssert; + utils.toArray = utils_1.toArray; + utils.zero2 = utils_1.zero2; + utils.toHex = utils_1.toHex; + utils.encode = utils_1.encode; + function getNAF2(num, w, bits) { + var naf = new Array(Math.max(num.bitLength(), bits) + 1); + naf.fill(0); + var ws = 1 << w + 1; + var k = num.clone(); + for (var i2 = 0; i2 < naf.length; i2++) { + var z; + var mod = k.andln(ws - 1); + if (k.isOdd()) { + if (mod > (ws >> 1) - 1) + z = (ws >> 1) - mod; + else + z = mod; + k.isubn(z); + } else { + z = 0; + } + naf[i2] = z; + k.iushrn(1); + } + return naf; + } + utils.getNAF = getNAF2; + function getJSF2(k1, k2) { + var jsf = [ + [], + [] + ]; + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + var m8; + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + var m14 = k1.andln(3) + d1 & 3; + var m24 = k2.andln(3) + d2 & 3; + if (m14 === 3) + m14 = -1; + if (m24 === 3) + m24 = -1; + var u1; + if ((m14 & 1) === 0) { + u1 = 0; + } else { + m8 = k1.andln(7) + d1 & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) + u1 = -m14; + else + u1 = m14; + } + jsf[0].push(u1); + var u2; + if ((m24 & 1) === 0) { + u2 = 0; + } else { + m8 = k2.andln(7) + d2 & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) + u2 = -m24; + else + u2 = m24; + } + jsf[1].push(u2); + if (2 * d1 === u1 + 1) + d1 = 1 - d1; + if (2 * d2 === u2 + 1) + d2 = 1 - d2; + k1.iushrn(1); + k2.iushrn(1); + } + return jsf; + } + utils.getJSF = getJSF2; + function cachedProperty(obj, name, computer) { + var key2 = "_" + name; + obj.prototype[name] = function cachedProperty2() { + return this[key2] !== void 0 ? this[key2] : this[key2] = computer.call(this); + }; + } + utils.cachedProperty = cachedProperty; + function parseBytes(bytes) { + return typeof bytes === "string" ? utils.toArray(bytes, "hex") : bytes; + } + utils.parseBytes = parseBytes; + function intFromLE(bytes) { + return new import_bn2.default(bytes, "hex", "le"); + } + utils.intFromLE = intFromLE; + }); + getNAF = utils_1$1.getNAF; + getJSF = utils_1$1.getJSF; + assert$1 = utils_1$1.assert; + base = BaseCurve; + BaseCurve.prototype.point = function point() { + throw new Error("Not implemented"); + }; + BaseCurve.prototype.validate = function validate() { + throw new Error("Not implemented"); + }; + BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { + assert$1(p.precomputed); + var doubles = p._getDoubles(); + var naf = getNAF(k, 1, this._bitLength); + var I2 = (1 << doubles.step + 1) - (doubles.step % 2 === 0 ? 2 : 1); + I2 /= 3; + var repr = []; + var j; + var nafW; + for (j = 0; j < naf.length; j += doubles.step) { + nafW = 0; + for (var l2 = j + doubles.step - 1; l2 >= j; l2--) + nafW = (nafW << 1) + naf[l2]; + repr.push(nafW); + } + var a2 = this.jpoint(null, null, null); + var b = this.jpoint(null, null, null); + for (var i2 = I2; i2 > 0; i2--) { + for (j = 0; j < repr.length; j++) { + nafW = repr[j]; + if (nafW === i2) + b = b.mixedAdd(doubles.points[j]); + else if (nafW === -i2) + b = b.mixedAdd(doubles.points[j].neg()); + } + a2 = a2.add(b); + } + return a2.toP(); + }; + BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { + var w = 4; + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + var naf = getNAF(k, w, this._bitLength); + var acc = this.jpoint(null, null, null); + for (var i2 = naf.length - 1; i2 >= 0; i2--) { + for (var l2 = 0; i2 >= 0 && naf[i2] === 0; i2--) + l2++; + if (i2 >= 0) + l2++; + acc = acc.dblp(l2); + if (i2 < 0) + break; + var z = naf[i2]; + assert$1(z !== 0); + if (p.type === "affine") { + if (z > 0) + acc = acc.mixedAdd(wnd[z - 1 >> 1]); + else + acc = acc.mixedAdd(wnd[-z - 1 >> 1].neg()); + } else { + if (z > 0) + acc = acc.add(wnd[z - 1 >> 1]); + else + acc = acc.add(wnd[-z - 1 >> 1].neg()); + } + } + return p.type === "affine" ? acc.toP() : acc; + }; + BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, points, coeffs, len, jacobianResult) { + var wndWidth = this._wnafT1; + var wnd = this._wnafT2; + var naf = this._wnafT3; + var max = 0; + var i2; + var j; + var p; + for (i2 = 0; i2 < len; i2++) { + p = points[i2]; + var nafPoints = p._getNAFPoints(defW); + wndWidth[i2] = nafPoints.wnd; + wnd[i2] = nafPoints.points; + } + for (i2 = len - 1; i2 >= 1; i2 -= 2) { + var a2 = i2 - 1; + var b = i2; + if (wndWidth[a2] !== 1 || wndWidth[b] !== 1) { + naf[a2] = getNAF(coeffs[a2], wndWidth[a2], this._bitLength); + naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength); + max = Math.max(naf[a2].length, max); + max = Math.max(naf[b].length, max); + continue; + } + var comb = [ + points[a2], + /* 1 */ + null, + /* 3 */ + null, + /* 5 */ + points[b] + /* 7 */ + ]; + if (points[a2].y.cmp(points[b].y) === 0) { + comb[1] = points[a2].add(points[b]); + comb[2] = points[a2].toJ().mixedAdd(points[b].neg()); + } else if (points[a2].y.cmp(points[b].y.redNeg()) === 0) { + comb[1] = points[a2].toJ().mixedAdd(points[b]); + comb[2] = points[a2].add(points[b].neg()); + } else { + comb[1] = points[a2].toJ().mixedAdd(points[b]); + comb[2] = points[a2].toJ().mixedAdd(points[b].neg()); + } + var index = [ + -3, + /* -1 -1 */ + -1, + /* -1 0 */ + -5, + /* -1 1 */ + -7, + /* 0 -1 */ + 0, + /* 0 0 */ + 7, + /* 0 1 */ + 5, + /* 1 -1 */ + 1, + /* 1 0 */ + 3 + /* 1 1 */ + ]; + var jsf = getJSF(coeffs[a2], coeffs[b]); + max = Math.max(jsf[0].length, max); + naf[a2] = new Array(max); + naf[b] = new Array(max); + for (j = 0; j < max; j++) { + var ja = jsf[0][j] | 0; + var jb = jsf[1][j] | 0; + naf[a2][j] = index[(ja + 1) * 3 + (jb + 1)]; + naf[b][j] = 0; + wnd[a2] = comb; + } + } + var acc = this.jpoint(null, null, null); + var tmp = this._wnafT4; + for (i2 = max; i2 >= 0; i2--) { + var k = 0; + while (i2 >= 0) { + var zero = true; + for (j = 0; j < len; j++) { + tmp[j] = naf[j][i2] | 0; + if (tmp[j] !== 0) + zero = false; + } + if (!zero) + break; + k++; + i2--; + } + if (i2 >= 0) + k++; + acc = acc.dblp(k); + if (i2 < 0) + break; + for (j = 0; j < len; j++) { + var z = tmp[j]; + p; + if (z === 0) + continue; + else if (z > 0) + p = wnd[j][z - 1 >> 1]; + else if (z < 0) + p = wnd[j][-z - 1 >> 1].neg(); + if (p.type === "affine") + acc = acc.mixedAdd(p); + else + acc = acc.add(p); + } + } + for (i2 = 0; i2 < len; i2++) + wnd[i2] = null; + if (jacobianResult) + return acc; + else + return acc.toP(); + }; + BaseCurve.BasePoint = BasePoint; + BasePoint.prototype.eq = function eq() { + throw new Error("Not implemented"); + }; + BasePoint.prototype.validate = function validate2() { + return this.curve.validate(this); + }; + BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + bytes = utils_1$1.toArray(bytes, enc); + var len = this.p.byteLength(); + if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) { + if (bytes[0] === 6) + assert$1(bytes[bytes.length - 1] % 2 === 0); + else if (bytes[0] === 7) + assert$1(bytes[bytes.length - 1] % 2 === 1); + var res = this.point( + bytes.slice(1, 1 + len), + bytes.slice(1 + len, 1 + 2 * len) + ); + return res; + } else if ((bytes[0] === 2 || bytes[0] === 3) && bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 3); + } + throw new Error("Unknown point format"); + }; + BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { + return this.encode(enc, true); + }; + BasePoint.prototype._encode = function _encode2(compact) { + var len = this.curve.p.byteLength(); + var x = this.getX().toArray("be", len); + if (compact) + return [this.getY().isEven() ? 2 : 3].concat(x); + return [4].concat(x, this.getY().toArray("be", len)); + }; + BasePoint.prototype.encode = function encode3(enc, compact) { + return utils_1$1.encode(this._encode(compact), enc); + }; + BasePoint.prototype.precompute = function precompute(power) { + if (this.precomputed) + return this; + var precomputed = { + doubles: null, + naf: null, + beta: null + }; + precomputed.naf = this._getNAFPoints(8); + precomputed.doubles = this._getDoubles(4, power); + precomputed.beta = this._getBeta(); + this.precomputed = precomputed; + return this; + }; + BasePoint.prototype._hasDoubles = function _hasDoubles(k) { + if (!this.precomputed) + return false; + var doubles = this.precomputed.doubles; + if (!doubles) + return false; + return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); + }; + BasePoint.prototype._getDoubles = function _getDoubles(step, power) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + var doubles = [this]; + var acc = this; + for (var i2 = 0; i2 < power; i2 += step) { + for (var j = 0; j < step; j++) + acc = acc.dbl(); + doubles.push(acc); + } + return { + step, + points: doubles + }; + }; + BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + var res = [this]; + var max = (1 << wnd) - 1; + var dbl3 = max === 1 ? null : this.dbl(); + for (var i2 = 1; i2 < max; i2++) + res[i2] = res[i2 - 1].add(dbl3); + return { + wnd, + points: res + }; + }; + BasePoint.prototype._getBeta = function _getBeta() { + return null; + }; + BasePoint.prototype.dblp = function dblp(k) { + var r3 = this; + for (var i2 = 0; i2 < k; i2++) + r3 = r3.dbl(); + return r3; + }; + inherits_browser = createCommonjsModule(function(module2) { + if (typeof Object.create === "function") { + module2.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + } + }; + } else { + module2.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + }; + } + }); + assert$2 = utils_1$1.assert; + inherits_browser(ShortCurve, base); + short_1 = ShortCurve; + ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + var beta; + var lambda; + if (conf.beta) { + beta = new import_bn2.default(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new import_bn2.default(conf.lambda, 16); + } else { + var lambdas = this._getEndoRoots(this.n); + if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { + lambda = lambdas[0]; + } else { + lambda = lambdas[1]; + assert$2(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new import_bn2.default(vec.a, 16), + b: new import_bn2.default(vec.b, 16) + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + return { + beta, + lambda, + basis + }; + }; + ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + var red = num === this.p ? this.red : import_bn2.default.mont(num); + var tinv = new import_bn2.default(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + var s2 = new import_bn2.default(3).toRed(red).redNeg().redSqrt().redMul(tinv); + var l1 = ntinv.redAdd(s2).fromRed(); + var l2 = ntinv.redSub(s2).fromRed(); + return [l1, l2]; + }; + ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { + var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); + var u = lambda; + var v = this.n.clone(); + var x1 = new import_bn2.default(1); + var y1 = new import_bn2.default(0); + var x2 = new import_bn2.default(0); + var y2 = new import_bn2.default(1); + var a0; + var b0; + var a1; + var b1; + var a2; + var b2; + var prevR; + var i2 = 0; + var r3; + var x; + while (u.cmpn(0) !== 0) { + var q = v.div(u); + r3 = v.sub(q.mul(u)); + x = x2.sub(q.mul(x1)); + var y = y2.sub(q.mul(y1)); + if (!a1 && r3.cmp(aprxSqrt) < 0) { + a0 = prevR.neg(); + b0 = x1; + a1 = r3.neg(); + b1 = x; + } else if (a1 && ++i2 === 2) { + break; + } + prevR = r3; + v = u; + u = r3; + x2 = x1; + x1 = x; + y2 = y1; + y1 = y; + } + a2 = r3.neg(); + b2 = x; + var len1 = a1.sqr().add(b1.sqr()); + var len2 = a2.sqr().add(b2.sqr()); + if (len2.cmp(len1) >= 0) { + a2 = a0; + b2 = b0; + } + if (a1.negative) { + a1 = a1.neg(); + b1 = b1.neg(); + } + if (a2.negative) { + a2 = a2.neg(); + b2 = b2.neg(); + } + return [ + { a: a1, b: b1 }, + { a: a2, b: b2 } + ]; + }; + ShortCurve.prototype._endoSplit = function _endoSplit(k) { + var basis = this.endo.basis; + var v1 = basis[0]; + var v2 = basis[1]; + var c1 = v2.b.mul(k).divRound(this.n); + var c2 = v1.b.neg().mul(k).divRound(this.n); + var p1 = c1.mul(v1.a); + var p2 = c2.mul(v2.a); + var q1 = c1.mul(v1.b); + var q2 = c2.mul(v2.b); + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1, k2 }; + }; + ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new import_bn2.default(x, 16); + if (!x.red) + x = x.toRed(this.red); + var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error("invalid point"); + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + return this.point(x, y); + }; + ShortCurve.prototype.validate = function validate3(point3) { + if (point3.inf) + return true; + var x = point3.x; + var y = point3.y; + var ax = this.a.redMul(x); + var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); + return y.redSqr().redISub(rhs).cmpn(0) === 0; + }; + ShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs, jacobianResult) { + var npoints = this._endoWnafT1; + var ncoeffs = this._endoWnafT2; + for (var i2 = 0; i2 < points.length; i2++) { + var split = this._endoSplit(coeffs[i2]); + var p = points[i2]; + var beta = p._getBeta(); + if (split.k1.negative) { + split.k1.ineg(); + p = p.neg(true); + } + if (split.k2.negative) { + split.k2.ineg(); + beta = beta.neg(true); + } + npoints[i2 * 2] = p; + npoints[i2 * 2 + 1] = beta; + ncoeffs[i2 * 2] = split.k1; + ncoeffs[i2 * 2 + 1] = split.k2; + } + var res = this._wnafMulAdd(1, npoints, ncoeffs, i2 * 2, jacobianResult); + for (var j = 0; j < i2 * 2; j++) { + npoints[j] = null; + ncoeffs[j] = null; + } + return res; + }; + inherits_browser(Point, base.BasePoint); + ShortCurve.prototype.point = function point2(x, y, isRed) { + return new Point(this, x, y, isRed); + }; + ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { + return Point.fromJSON(this, obj, red); + }; + Point.prototype._getBeta = function _getBeta2() { + if (!this.curve.endo) + return; + var pre = this.precomputed; + if (pre && pre.beta) + return pre.beta; + var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + if (pre) { + var curve = this.curve; + var endoMul = function(p) { + return curve.point(p.x.redMul(curve.endo.beta), p.y); + }; + pre.beta = beta; + beta.precomputed = { + beta: null, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(endoMul) + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(endoMul) + } + }; + } + return beta; + }; + Point.prototype.toJSON = function toJSON() { + if (!this.precomputed) + return [this.x, this.y]; + return [this.x, this.y, this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1) + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1) + } + }]; + }; + Point.fromJSON = function fromJSON(curve, obj, red) { + if (typeof obj === "string") + obj = JSON.parse(obj); + var res = curve.point(obj[0], obj[1], red); + if (!obj[2]) + return res; + function obj2point(obj2) { + return curve.point(obj2[0], obj2[1], red); + } + var pre = obj[2]; + res.precomputed = { + beta: null, + doubles: pre.doubles && { + step: pre.doubles.step, + points: [res].concat(pre.doubles.points.map(obj2point)) + }, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: [res].concat(pre.naf.points.map(obj2point)) + } + }; + return res; + }; + Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ""; + return ""; + }; + Point.prototype.isInfinity = function isInfinity() { + return this.inf; + }; + Point.prototype.add = function add(p) { + if (this.inf) + return p; + if (p.inf) + return this; + if (this.eq(p)) + return this.dbl(); + if (this.neg().eq(p)) + return this.curve.point(null, null); + if (this.x.cmp(p.x) === 0) + return this.curve.point(null, null); + var c = this.y.redSub(p.y); + if (c.cmpn(0) !== 0) + c = c.redMul(this.x.redSub(p.x).redInvm()); + var nx = c.redSqr().redISub(this.x).redISub(p.x); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); + }; + Point.prototype.dbl = function dbl() { + if (this.inf) + return this; + var ys1 = this.y.redAdd(this.y); + if (ys1.cmpn(0) === 0) + return this.curve.point(null, null); + var a2 = this.curve.a; + var x2 = this.x.redSqr(); + var dyinv = ys1.redInvm(); + var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a2).redMul(dyinv); + var nx = c.redSqr().redISub(this.x.redAdd(this.x)); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); + }; + Point.prototype.getX = function getX() { + return this.x.fromRed(); + }; + Point.prototype.getY = function getY() { + return this.y.fromRed(); + }; + Point.prototype.mul = function mul(k) { + k = new import_bn2.default(k, 16); + if (this.isInfinity()) + return this; + else if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else if (this.curve.endo) + return this.curve._endoWnafMulAdd([this], [k]); + else + return this.curve._wnafMul(this, k); + }; + Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { + var points = [this, p2]; + var coeffs = [k1, k2]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2); + }; + Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) { + var points = [this, p2]; + var coeffs = [k1, k2]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs, true); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2, true); + }; + Point.prototype.eq = function eq2(p) { + return this === p || this.inf === p.inf && (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); + }; + Point.prototype.neg = function neg(_precompute) { + if (this.inf) + return this; + var res = this.curve.point(this.x, this.y.redNeg()); + if (_precompute && this.precomputed) { + var pre = this.precomputed; + var negate = function(p) { + return p.neg(); + }; + res.precomputed = { + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(negate) + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(negate) + } + }; + } + return res; + }; + Point.prototype.toJ = function toJ() { + if (this.inf) + return this.curve.jpoint(null, null, null); + var res = this.curve.jpoint(this.x, this.y, this.curve.one); + return res; + }; + inherits_browser(JPoint, base.BasePoint); + ShortCurve.prototype.jpoint = function jpoint(x, y, z) { + return new JPoint(this, x, y, z); + }; + JPoint.prototype.toP = function toP() { + if (this.isInfinity()) + return this.curve.point(null, null); + var zinv = this.z.redInvm(); + var zinv2 = zinv.redSqr(); + var ax = this.x.redMul(zinv2); + var ay = this.y.redMul(zinv2).redMul(zinv); + return this.curve.point(ax, ay); + }; + JPoint.prototype.neg = function neg2() { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); + }; + JPoint.prototype.add = function add2(p) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + var pz2 = p.z.redSqr(); + var z2 = this.z.redSqr(); + var u1 = this.x.redMul(pz2); + var u2 = p.x.redMul(z2); + var s1 = this.y.redMul(pz2.redMul(p.z)); + var s2 = p.y.redMul(z2.redMul(this.z)); + var h = u1.redSub(u2); + var r3 = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r3.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + var nx = r3.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r3.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(p.z).redMul(h); + return this.curve.jpoint(nx, ny, nz); + }; + JPoint.prototype.mixedAdd = function mixedAdd(p) { + if (this.isInfinity()) + return p.toJ(); + if (p.isInfinity()) + return this; + var z2 = this.z.redSqr(); + var u1 = this.x; + var u2 = p.x.redMul(z2); + var s1 = this.y; + var s2 = p.y.redMul(z2).redMul(this.z); + var h = u1.redSub(u2); + var r3 = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r3.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + var nx = r3.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r3.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(h); + return this.curve.jpoint(nx, ny, nz); + }; + JPoint.prototype.dblp = function dblp2(pow) { + if (pow === 0) + return this; + if (this.isInfinity()) + return this; + if (!pow) + return this.dbl(); + var i2; + if (this.curve.zeroA || this.curve.threeA) { + var r3 = this; + for (i2 = 0; i2 < pow; i2++) + r3 = r3.dbl(); + return r3; + } + var a2 = this.curve.a; + var tinv = this.curve.tinv; + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + var jyd = jy.redAdd(jy); + for (i2 = 0; i2 < pow; i2++) { + var jx2 = jx.redSqr(); + var jyd2 = jyd.redSqr(); + var jyd4 = jyd2.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a2.redMul(jz4)); + var t1 = jx.redMul(jyd2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var dny = c.redMul(t2); + dny = dny.redIAdd(dny).redISub(jyd4); + var nz = jyd.redMul(jz); + if (i2 + 1 < pow) + jz4 = jz4.redMul(jyd4); + jx = nx; + jz = nz; + jyd = dny; + } + return this.curve.jpoint(jx, jyd.redMul(tinv), jz); + }; + JPoint.prototype.dbl = function dbl2() { + if (this.isInfinity()) + return this; + if (this.curve.zeroA) + return this._zeroDbl(); + else if (this.curve.threeA) + return this._threeDbl(); + else + return this._dbl(); + }; + JPoint.prototype._zeroDbl = function _zeroDbl() { + var nx; + var ny; + var nz; + if (this.zOne) { + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var yyyy = yy.redSqr(); + var s2 = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s2 = s2.redIAdd(s2); + var m = xx.redAdd(xx).redIAdd(xx); + var t2 = m.redSqr().redISub(s2).redISub(s2); + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + nx = t2; + ny = m.redMul(s2.redISub(t2)).redISub(yyyy8); + nz = this.y.redAdd(this.y); + } else { + var a2 = this.x.redSqr(); + var b = this.y.redSqr(); + var c = b.redSqr(); + var d = this.x.redAdd(b).redSqr().redISub(a2).redISub(c); + d = d.redIAdd(d); + var e2 = a2.redAdd(a2).redIAdd(a2); + var f = e2.redSqr(); + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + nx = f.redISub(d).redISub(d); + ny = e2.redMul(d.redISub(nx)).redISub(c8); + nz = this.y.redMul(this.z); + nz = nz.redIAdd(nz); + } + return this.curve.jpoint(nx, ny, nz); + }; + JPoint.prototype._threeDbl = function _threeDbl() { + var nx; + var ny; + var nz; + if (this.zOne) { + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var yyyy = yy.redSqr(); + var s2 = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s2 = s2.redIAdd(s2); + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + var t2 = m.redSqr().redISub(s2).redISub(s2); + nx = t2; + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + ny = m.redMul(s2.redISub(t2)).redISub(yyyy8); + nz = this.y.redAdd(this.y); + } else { + var delta = this.z.redSqr(); + var gamma = this.y.redSqr(); + var beta = this.x.redMul(gamma); + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + nx = alpha.redSqr().redISub(beta8); + nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + var ggamma8 = gamma.redSqr(); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); + } + return this.curve.jpoint(nx, ny, nz); + }; + JPoint.prototype._dbl = function _dbl() { + var a2 = this.curve.a; + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + var jx2 = jx.redSqr(); + var jy2 = jy.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a2.redMul(jz4)); + var jxd4 = jx.redAdd(jx); + jxd4 = jxd4.redIAdd(jxd4); + var t1 = jxd4.redMul(jy2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var jyd8 = jy2.redSqr(); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + var ny = c.redMul(t2).redISub(jyd8); + var nz = jy.redAdd(jy).redMul(jz); + return this.curve.jpoint(nx, ny, nz); + }; + JPoint.prototype.trpl = function trpl() { + if (!this.curve.zeroA) + return this.dbl().add(this); + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var zz = this.z.redSqr(); + var yyyy = yy.redSqr(); + var m = xx.redAdd(xx).redIAdd(xx); + var mm = m.redSqr(); + var e2 = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + e2 = e2.redIAdd(e2); + e2 = e2.redAdd(e2).redIAdd(e2); + e2 = e2.redISub(mm); + var ee = e2.redSqr(); + var t2 = yyyy.redIAdd(yyyy); + t2 = t2.redIAdd(t2); + t2 = t2.redIAdd(t2); + t2 = t2.redIAdd(t2); + var u = m.redIAdd(e2).redSqr().redISub(mm).redISub(ee).redISub(t2); + var yyu4 = yy.redMul(u); + yyu4 = yyu4.redIAdd(yyu4); + yyu4 = yyu4.redIAdd(yyu4); + var nx = this.x.redMul(ee).redISub(yyu4); + nx = nx.redIAdd(nx); + nx = nx.redIAdd(nx); + var ny = this.y.redMul(u.redMul(t2.redISub(u)).redISub(e2.redMul(ee))); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + var nz = this.z.redAdd(e2).redSqr().redISub(zz).redISub(ee); + return this.curve.jpoint(nx, ny, nz); + }; + JPoint.prototype.mul = function mul2(k, kbase) { + k = new import_bn2.default(k, kbase); + return this.curve._wnafMul(this, k); + }; + JPoint.prototype.eq = function eq3(p) { + if (p.type === "affine") + return this.eq(p.toJ()); + if (this === p) + return true; + var z2 = this.z.redSqr(); + var pz2 = p.z.redSqr(); + if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) + return false; + var z3 = z2.redMul(this.z); + var pz3 = pz2.redMul(p.z); + return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; + }; + JPoint.prototype.eqXToP = function eqXToP(x) { + var zs = this.z.redSqr(); + var rx = x.toRed(this.curve.red).redMul(zs); + if (this.x.cmp(rx) === 0) + return true; + var xc = x.clone(); + var t2 = this.curve.redN.redMul(zs); + for (; ; ) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) + return false; + rx.redIAdd(t2); + if (this.x.cmp(rx) === 0) + return true; + } + }; + JPoint.prototype.inspect = function inspect2() { + if (this.isInfinity()) + return ""; + return ""; + }; + JPoint.prototype.isInfinity = function isInfinity2() { + return this.z.cmpn(0) === 0; + }; + curve_1 = createCommonjsModule(function(module2, exports) { + "use strict"; + var curve = exports; + curve.base = base; + curve.short = short_1; + curve.mont = /*RicMoo:ethers:require(./mont)*/ + null; + curve.edwards = /*RicMoo:ethers:require(./edwards)*/ + null; + }); + curves_1 = createCommonjsModule(function(module2, exports) { + "use strict"; + var curves = exports; + var assert2 = utils_1$1.assert; + function PresetCurve(options) { + if (options.type === "short") + this.curve = new curve_1.short(options); + else if (options.type === "edwards") + this.curve = new curve_1.edwards(options); + else + this.curve = new curve_1.mont(options); + this.g = this.curve.g; + this.n = this.curve.n; + this.hash = options.hash; + assert2(this.g.validate(), "Invalid curve"); + assert2(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); + } + curves.PresetCurve = PresetCurve; + function defineCurve(name, options) { + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + get: function() { + var curve = new PresetCurve(options); + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + value: curve + }); + return curve; + } + }); + } + defineCurve("p192", { + type: "short", + prime: "p192", + p: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff", + a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc", + b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1", + n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", + hash: import_hash2.default.sha256, + gRed: false, + g: [ + "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", + "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811" + ] + }); + defineCurve("p224", { + type: "short", + prime: "p224", + p: "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001", + a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe", + b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4", + n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", + hash: import_hash2.default.sha256, + gRed: false, + g: [ + "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", + "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34" + ] + }); + defineCurve("p256", { + type: "short", + prime: null, + p: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff", + a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc", + b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b", + n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", + hash: import_hash2.default.sha256, + gRed: false, + g: [ + "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", + "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5" + ] + }); + defineCurve("p384", { + type: "short", + prime: null, + p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff", + a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc", + b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef", + n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", + hash: import_hash2.default.sha384, + gRed: false, + g: [ + "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", + "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f" + ] + }); + defineCurve("p521", { + type: "short", + prime: null, + p: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff", + a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", + b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00", + n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", + hash: import_hash2.default.sha512, + gRed: false, + g: [ + "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", + "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650" + ] + }); + defineCurve("curve25519", { + type: "mont", + prime: "p25519", + p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", + a: "76d06", + b: "1", + n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", + hash: import_hash2.default.sha256, + gRed: false, + g: [ + "9" + ] + }); + defineCurve("ed25519", { + type: "edwards", + prime: "p25519", + p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", + a: "-1", + c: "1", + // -121665 * (121666^(-1)) (mod P) + d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3", + n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", + hash: import_hash2.default.sha256, + gRed: false, + g: [ + "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", + // 4/5 + "6666666666666666666666666666666666666666666666666666666666666658" + ] + }); + var pre; + try { + pre = /*RicMoo:ethers:require(./precomputed/secp256k1)*/ + null.crash(); + } catch (e2) { + pre = void 0; + } + defineCurve("secp256k1", { + type: "short", + prime: "k256", + p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f", + a: "0", + b: "7", + n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", + h: "1", + hash: import_hash2.default.sha256, + // Precomputed endomorphism + beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", + lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", + basis: [ + { + a: "3086d221a7d46bcde86c90e49284eb15", + b: "-e4437ed6010e88286f547fa90abfe4c3" + }, + { + a: "114ca50f7a8e2f3f657c1108d9d44cfd8", + b: "3086d221a7d46bcde86c90e49284eb15" + } + ], + gRed: false, + g: [ + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", + "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", + pre + ] + }); + }); + hmacDrbg = HmacDRBG; + HmacDRBG.prototype._init = function init(entropy, nonce, pers) { + var seed = entropy.concat(nonce).concat(pers); + this.K = new Array(this.outLen / 8); + this.V = new Array(this.outLen / 8); + for (var i2 = 0; i2 < this.V.length; i2++) { + this.K[i2] = 0; + this.V[i2] = 1; + } + this._update(seed); + this._reseed = 1; + this.reseedInterval = 281474976710656; + }; + HmacDRBG.prototype._hmac = function hmac() { + return new import_hash2.default.hmac(this.hash, this.K); + }; + HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac().update(this.V).update([0]); + if (seed) + kmac = kmac.update(seed); + this.K = kmac.digest(); + this.V = this._hmac().update(this.V).digest(); + if (!seed) + return; + this.K = this._hmac().update(this.V).update([1]).update(seed).digest(); + this.V = this._hmac().update(this.V).digest(); + }; + HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add5, addEnc) { + if (typeof entropyEnc !== "string") { + addEnc = add5; + add5 = entropyEnc; + entropyEnc = null; + } + entropy = utils_1.toArray(entropy, entropyEnc); + add5 = utils_1.toArray(add5, addEnc); + minimalisticAssert( + entropy.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ); + this._update(entropy.concat(add5 || [])); + this._reseed = 1; + }; + HmacDRBG.prototype.generate = function generate(len, enc, add5, addEnc) { + if (this._reseed > this.reseedInterval) + throw new Error("Reseed is required"); + if (typeof enc !== "string") { + addEnc = add5; + add5 = enc; + enc = null; + } + if (add5) { + add5 = utils_1.toArray(add5, addEnc || "hex"); + this._update(add5); + } + var temp = []; + while (temp.length < len) { + this.V = this._hmac().update(this.V).digest(); + temp = temp.concat(this.V); + } + var res = temp.slice(0, len); + this._update(add5); + this._reseed++; + return utils_1.encode(res, enc); + }; + assert$3 = utils_1$1.assert; + key = KeyPair; + KeyPair.fromPublic = function fromPublic(ec2, pub, enc) { + if (pub instanceof KeyPair) + return pub; + return new KeyPair(ec2, { + pub, + pubEnc: enc + }); + }; + KeyPair.fromPrivate = function fromPrivate(ec2, priv, enc) { + if (priv instanceof KeyPair) + return priv; + return new KeyPair(ec2, { + priv, + privEnc: enc + }); + }; + KeyPair.prototype.validate = function validate4() { + var pub = this.getPublic(); + if (pub.isInfinity()) + return { result: false, reason: "Invalid public key" }; + if (!pub.validate()) + return { result: false, reason: "Public key is not a point" }; + if (!pub.mul(this.ec.curve.n).isInfinity()) + return { result: false, reason: "Public key * N != O" }; + return { result: true, reason: null }; + }; + KeyPair.prototype.getPublic = function getPublic(compact, enc) { + if (typeof compact === "string") { + enc = compact; + compact = null; + } + if (!this.pub) + this.pub = this.ec.g.mul(this.priv); + if (!enc) + return this.pub; + return this.pub.encode(enc, compact); + }; + KeyPair.prototype.getPrivate = function getPrivate(enc) { + if (enc === "hex") + return this.priv.toString(16, 2); + else + return this.priv; + }; + KeyPair.prototype._importPrivate = function _importPrivate(key2, enc) { + this.priv = new import_bn2.default(key2, enc || 16); + this.priv = this.priv.umod(this.ec.curve.n); + }; + KeyPair.prototype._importPublic = function _importPublic(key2, enc) { + if (key2.x || key2.y) { + if (this.ec.curve.type === "mont") { + assert$3(key2.x, "Need x coordinate"); + } else if (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") { + assert$3(key2.x && key2.y, "Need both x and y coordinate"); + } + this.pub = this.ec.curve.point(key2.x, key2.y); + return; + } + this.pub = this.ec.curve.decodePoint(key2, enc); + }; + KeyPair.prototype.derive = function derive(pub) { + if (!pub.validate()) { + assert$3(pub.validate(), "public point not validated"); + } + return pub.mul(this.priv).getX(); + }; + KeyPair.prototype.sign = function sign(msg, enc, options) { + return this.ec.sign(msg, this, enc, options); + }; + KeyPair.prototype.verify = function verify(msg, signature2) { + return this.ec.verify(msg, signature2, this); + }; + KeyPair.prototype.inspect = function inspect3() { + return ""; + }; + assert$4 = utils_1$1.assert; + signature = Signature; + Signature.prototype._importDER = function _importDER(data, enc) { + data = utils_1$1.toArray(data, enc); + var p = new Position(); + if (data[p.place++] !== 48) { + return false; + } + var len = getLength(data, p); + if (len === false) { + return false; + } + if (len + p.place !== data.length) { + return false; + } + if (data[p.place++] !== 2) { + return false; + } + var rlen = getLength(data, p); + if (rlen === false) { + return false; + } + var r3 = data.slice(p.place, rlen + p.place); + p.place += rlen; + if (data[p.place++] !== 2) { + return false; + } + var slen = getLength(data, p); + if (slen === false) { + return false; + } + if (data.length !== slen + p.place) { + return false; + } + var s2 = data.slice(p.place, slen + p.place); + if (r3[0] === 0) { + if (r3[1] & 128) { + r3 = r3.slice(1); + } else { + return false; + } + } + if (s2[0] === 0) { + if (s2[1] & 128) { + s2 = s2.slice(1); + } else { + return false; + } + } + this.r = new import_bn2.default(r3); + this.s = new import_bn2.default(s2); + this.recoveryParam = null; + return true; + }; + Signature.prototype.toDER = function toDER(enc) { + var r3 = this.r.toArray(); + var s2 = this.s.toArray(); + if (r3[0] & 128) + r3 = [0].concat(r3); + if (s2[0] & 128) + s2 = [0].concat(s2); + r3 = rmPadding(r3); + s2 = rmPadding(s2); + while (!s2[0] && !(s2[1] & 128)) { + s2 = s2.slice(1); + } + var arr = [2]; + constructLength(arr, r3.length); + arr = arr.concat(r3); + arr.push(2); + constructLength(arr, s2.length); + var backHalf = arr.concat(s2); + var res = [48]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils_1$1.encode(res, enc); + }; + rand = /*RicMoo:ethers:require(brorand)*/ + function() { + throw new Error("unsupported"); + }; + assert$5 = utils_1$1.assert; + ec = EC; + EC.prototype.keyPair = function keyPair(options) { + return new key(this, options); + }; + EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { + return key.fromPrivate(this, priv, enc); + }; + EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { + return key.fromPublic(this, pub, enc); + }; + EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + var drbg = new hmacDrbg({ + hash: this.hash, + pers: options.pers, + persEnc: options.persEnc || "utf8", + entropy: options.entropy || rand(this.hash.hmacStrength), + entropyEnc: options.entropy && options.entropyEnc || "utf8", + nonce: this.n.toArray() + }); + var bytes = this.n.byteLength(); + var ns2 = this.n.sub(new import_bn2.default(2)); + for (; ; ) { + var priv = new import_bn2.default(drbg.generate(bytes)); + if (priv.cmp(ns2) > 0) + continue; + priv.iaddn(1); + return this.keyFromPrivate(priv); + } + }; + EC.prototype._truncateToN = function _truncateToN(msg, truncOnly) { + var delta = msg.byteLength() * 8 - this.n.bitLength(); + if (delta > 0) + msg = msg.ushrn(delta); + if (!truncOnly && msg.cmp(this.n) >= 0) + return msg.sub(this.n); + else + return msg; + }; + EC.prototype.sign = function sign2(msg, key2, enc, options) { + if (typeof enc === "object") { + options = enc; + enc = null; + } + if (!options) + options = {}; + key2 = this.keyFromPrivate(key2, enc); + msg = this._truncateToN(new import_bn2.default(msg, 16)); + var bytes = this.n.byteLength(); + var bkey = key2.getPrivate().toArray("be", bytes); + var nonce = msg.toArray("be", bytes); + var drbg = new hmacDrbg({ + hash: this.hash, + entropy: bkey, + nonce, + pers: options.pers, + persEnc: options.persEnc || "utf8" + }); + var ns1 = this.n.sub(new import_bn2.default(1)); + for (var iter = 0; ; iter++) { + var k = options.k ? options.k(iter) : new import_bn2.default(drbg.generate(this.n.byteLength())); + k = this._truncateToN(k, true); + if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) + continue; + var kp = this.g.mul(k); + if (kp.isInfinity()) + continue; + var kpX = kp.getX(); + var r3 = kpX.umod(this.n); + if (r3.cmpn(0) === 0) + continue; + var s2 = k.invm(this.n).mul(r3.mul(key2.getPrivate()).iadd(msg)); + s2 = s2.umod(this.n); + if (s2.cmpn(0) === 0) + continue; + var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | (kpX.cmp(r3) !== 0 ? 2 : 0); + if (options.canonical && s2.cmp(this.nh) > 0) { + s2 = this.n.sub(s2); + recoveryParam ^= 1; + } + return new signature({ r: r3, s: s2, recoveryParam }); + } + }; + EC.prototype.verify = function verify2(msg, signature$1, key2, enc) { + msg = this._truncateToN(new import_bn2.default(msg, 16)); + key2 = this.keyFromPublic(key2, enc); + signature$1 = new signature(signature$1, "hex"); + var r3 = signature$1.r; + var s2 = signature$1.s; + if (r3.cmpn(1) < 0 || r3.cmp(this.n) >= 0) + return false; + if (s2.cmpn(1) < 0 || s2.cmp(this.n) >= 0) + return false; + var sinv = s2.invm(this.n); + var u1 = sinv.mul(msg).umod(this.n); + var u2 = sinv.mul(r3).umod(this.n); + var p; + if (!this.curve._maxwellTrick) { + p = this.g.mulAdd(u1, key2.getPublic(), u2); + if (p.isInfinity()) + return false; + return p.getX().umod(this.n).cmp(r3) === 0; + } + p = this.g.jmulAdd(u1, key2.getPublic(), u2); + if (p.isInfinity()) + return false; + return p.eqXToP(r3); + }; + EC.prototype.recoverPubKey = function(msg, signature$1, j, enc) { + assert$5((3 & j) === j, "The recovery param is more than two bits"); + signature$1 = new signature(signature$1, enc); + var n2 = this.n; + var e2 = new import_bn2.default(msg); + var r3 = signature$1.r; + var s2 = signature$1.s; + var isYOdd = j & 1; + var isSecondKey = j >> 1; + if (r3.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) + throw new Error("Unable to find sencond key candinate"); + if (isSecondKey) + r3 = this.curve.pointFromX(r3.add(this.curve.n), isYOdd); + else + r3 = this.curve.pointFromX(r3, isYOdd); + var rInv = signature$1.r.invm(n2); + var s1 = n2.sub(e2).mul(rInv).umod(n2); + var s22 = s2.mul(rInv).umod(n2); + return this.g.mulAdd(s1, r3, s22); + }; + EC.prototype.getKeyRecoveryParam = function(e2, signature$1, Q, enc) { + signature$1 = new signature(signature$1, enc); + if (signature$1.recoveryParam !== null) + return signature$1.recoveryParam; + for (var i2 = 0; i2 < 4; i2++) { + var Qprime; + try { + Qprime = this.recoverPubKey(e2, signature$1, i2); + } catch (e3) { + continue; + } + if (Qprime.eq(Q)) + return i2; + } + throw new Error("Unable to find valid recovery factor"); + }; + elliptic_1 = createCommonjsModule(function(module2, exports) { + "use strict"; + var elliptic = exports; + elliptic.version = /*RicMoo:ethers*/ + { version: "6.5.4" }.version; + elliptic.utils = utils_1$1; + elliptic.rand = /*RicMoo:ethers:require(brorand)*/ + function() { + throw new Error("unsupported"); + }; + elliptic.curve = curve_1; + elliptic.curves = curves_1; + elliptic.ec = ec; + elliptic.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/ + null; + }); + EC$1 = elliptic_1.ec; + } +}); + +// node_modules/@ethersproject/signing-key/lib.esm/_version.js +var version13; +var init_version12 = __esm({ + "node_modules/@ethersproject/signing-key/lib.esm/_version.js"() { + init_shim(); + version13 = "signing-key/5.7.0"; + } +}); + +// node_modules/@ethersproject/signing-key/lib.esm/index.js +var lib_exports12 = {}; +__export(lib_exports12, { + SigningKey: () => SigningKey, + computePublicKey: () => computePublicKey, + recoverPublicKey: () => recoverPublicKey +}); +function getCurve() { + if (!_curve) { + _curve = new EC$1("secp256k1"); + } + return _curve; +} +function recoverPublicKey(digest, signature2) { + const sig = splitSignature(signature2); + const rs = { r: arrayify(sig.r), s: arrayify(sig.s) }; + return "0x" + getCurve().recoverPubKey(arrayify(digest), rs, sig.recoveryParam).encode("hex", false); +} +function computePublicKey(key2, compressed) { + const bytes = arrayify(key2); + if (bytes.length === 32) { + const signingKey = new SigningKey(bytes); + if (compressed) { + return "0x" + getCurve().keyFromPrivate(bytes).getPublic(true, "hex"); + } + return signingKey.publicKey; + } else if (bytes.length === 33) { + if (compressed) { + return hexlify(bytes); + } + return "0x" + getCurve().keyFromPublic(bytes).getPublic(false, "hex"); + } else if (bytes.length === 65) { + if (!compressed) { + return hexlify(bytes); + } + return "0x" + getCurve().keyFromPublic(bytes).getPublic(true, "hex"); + } + return logger17.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); +} +var logger17, _curve, SigningKey; +var init_lib16 = __esm({ + "node_modules/@ethersproject/signing-key/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_elliptic(); + init_lib2(); + init_lib4(); + init_lib(); + init_version12(); + logger17 = new Logger(version13); + _curve = null; + SigningKey = class { + constructor(privateKey) { + defineReadOnly(this, "curve", "secp256k1"); + defineReadOnly(this, "privateKey", hexlify(privateKey)); + if (hexDataLength(this.privateKey) !== 32) { + logger17.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + } + const keyPair2 = getCurve().keyFromPrivate(arrayify(this.privateKey)); + defineReadOnly(this, "publicKey", "0x" + keyPair2.getPublic(false, "hex")); + defineReadOnly(this, "compressedPublicKey", "0x" + keyPair2.getPublic(true, "hex")); + defineReadOnly(this, "_isSigningKey", true); + } + _addPoint(other) { + const p0 = getCurve().keyFromPublic(arrayify(this.publicKey)); + const p1 = getCurve().keyFromPublic(arrayify(other)); + return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex"); + } + signDigest(digest) { + const keyPair2 = getCurve().keyFromPrivate(arrayify(this.privateKey)); + const digestBytes = arrayify(digest); + if (digestBytes.length !== 32) { + logger17.throwArgumentError("bad digest length", "digest", digest); + } + const signature2 = keyPair2.sign(digestBytes, { canonical: true }); + return splitSignature({ + recoveryParam: signature2.recoveryParam, + r: hexZeroPad("0x" + signature2.r.toString(16), 32), + s: hexZeroPad("0x" + signature2.s.toString(16), 32) + }); + } + computeSharedSecret(otherKey) { + const keyPair2 = getCurve().keyFromPrivate(arrayify(this.privateKey)); + const otherKeyPair = getCurve().keyFromPublic(arrayify(computePublicKey(otherKey))); + return hexZeroPad("0x" + keyPair2.derive(otherKeyPair.getPublic()).toString(16), 32); + } + static isSigningKey(value) { + return !!(value && value._isSigningKey); + } + }; + } +}); + +// node_modules/@ethersproject/transactions/lib.esm/_version.js +var version14; +var init_version13 = __esm({ + "node_modules/@ethersproject/transactions/lib.esm/_version.js"() { + init_shim(); + version14 = "transactions/5.7.0"; + } +}); + +// node_modules/@ethersproject/transactions/lib.esm/index.js +var lib_exports13 = {}; +__export(lib_exports13, { + TransactionTypes: () => TransactionTypes, + accessListify: () => accessListify, + computeAddress: () => computeAddress, + parse: () => parse, + recoverAddress: () => recoverAddress, + serialize: () => serialize +}); +function handleAddress(value) { + if (value === "0x") { + return null; + } + return getAddress(value); +} +function handleNumber(value) { + if (value === "0x") { + return Zero2; + } + return BigNumber.from(value); +} +function computeAddress(key2) { + const publicKey = computePublicKey(key2); + return getAddress(hexDataSlice(keccak256(hexDataSlice(publicKey, 1)), 12)); +} +function recoverAddress(digest, signature2) { + return computeAddress(recoverPublicKey(arrayify(digest), signature2)); +} +function formatNumber(value, name) { + const result = stripZeros(BigNumber.from(value).toHexString()); + if (result.length > 32) { + logger18.throwArgumentError("invalid length for " + name, "transaction:" + name, value); + } + return result; +} +function accessSetify(addr, storageKeys) { + return { + address: getAddress(addr), + storageKeys: (storageKeys || []).map((storageKey, index) => { + if (hexDataLength(storageKey) !== 32) { + logger18.throwArgumentError("invalid access list storageKey", `accessList[${addr}:${index}]`, storageKey); + } + return storageKey.toLowerCase(); + }) + }; +} +function accessListify(value) { + if (Array.isArray(value)) { + return value.map((set, index) => { + if (Array.isArray(set)) { + if (set.length > 2) { + logger18.throwArgumentError("access list expected to be [ address, storageKeys[] ]", `value[${index}]`, set); + } + return accessSetify(set[0], set[1]); + } + return accessSetify(set.address, set.storageKeys); + }); + } + const result = Object.keys(value).map((addr) => { + const storageKeys = value[addr].reduce((accum, storageKey) => { + accum[storageKey] = true; + return accum; + }, {}); + return accessSetify(addr, Object.keys(storageKeys).sort()); + }); + result.sort((a2, b) => a2.address.localeCompare(b.address)); + return result; +} +function formatAccessList(value) { + return accessListify(value).map((set) => [set.address, set.storageKeys]); +} +function _serializeEip1559(transaction, signature2) { + if (transaction.gasPrice != null) { + const gasPrice = BigNumber.from(transaction.gasPrice); + const maxFeePerGas = BigNumber.from(transaction.maxFeePerGas || 0); + if (!gasPrice.eq(maxFeePerGas)) { + logger18.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { + gasPrice, + maxFeePerGas + }); + } + } + const fields = [ + formatNumber(transaction.chainId || 0, "chainId"), + formatNumber(transaction.nonce || 0, "nonce"), + formatNumber(transaction.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(transaction.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(transaction.gasLimit || 0, "gasLimit"), + transaction.to != null ? getAddress(transaction.to) : "0x", + formatNumber(transaction.value || 0, "value"), + transaction.data || "0x", + formatAccessList(transaction.accessList || []) + ]; + if (signature2) { + const sig = splitSignature(signature2); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push(stripZeros(sig.r)); + fields.push(stripZeros(sig.s)); + } + return hexConcat(["0x02", encode(fields)]); +} +function _serializeEip2930(transaction, signature2) { + const fields = [ + formatNumber(transaction.chainId || 0, "chainId"), + formatNumber(transaction.nonce || 0, "nonce"), + formatNumber(transaction.gasPrice || 0, "gasPrice"), + formatNumber(transaction.gasLimit || 0, "gasLimit"), + transaction.to != null ? getAddress(transaction.to) : "0x", + formatNumber(transaction.value || 0, "value"), + transaction.data || "0x", + formatAccessList(transaction.accessList || []) + ]; + if (signature2) { + const sig = splitSignature(signature2); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push(stripZeros(sig.r)); + fields.push(stripZeros(sig.s)); + } + return hexConcat(["0x01", encode(fields)]); +} +function _serialize(transaction, signature2) { + checkProperties(transaction, allowedTransactionKeys2); + const raw = []; + transactionFields.forEach(function(fieldInfo) { + let value = transaction[fieldInfo.name] || []; + const options = {}; + if (fieldInfo.numeric) { + options.hexPad = "left"; + } + value = arrayify(hexlify(value, options)); + if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) { + logger18.throwArgumentError("invalid length for " + fieldInfo.name, "transaction:" + fieldInfo.name, value); + } + if (fieldInfo.maxLength) { + value = stripZeros(value); + if (value.length > fieldInfo.maxLength) { + logger18.throwArgumentError("invalid length for " + fieldInfo.name, "transaction:" + fieldInfo.name, value); + } + } + raw.push(hexlify(value)); + }); + let chainId = 0; + if (transaction.chainId != null) { + chainId = transaction.chainId; + if (typeof chainId !== "number") { + logger18.throwArgumentError("invalid transaction.chainId", "transaction", transaction); + } + } else if (signature2 && !isBytesLike(signature2) && signature2.v > 28) { + chainId = Math.floor((signature2.v - 35) / 2); + } + if (chainId !== 0) { + raw.push(hexlify(chainId)); + raw.push("0x"); + raw.push("0x"); + } + if (!signature2) { + return encode(raw); + } + const sig = splitSignature(signature2); + let v = 27 + sig.recoveryParam; + if (chainId !== 0) { + raw.pop(); + raw.pop(); + raw.pop(); + v += chainId * 2 + 8; + if (sig.v > 28 && sig.v !== v) { + logger18.throwArgumentError("transaction.chainId/signature.v mismatch", "signature", signature2); + } + } else if (sig.v !== v) { + logger18.throwArgumentError("transaction.chainId/signature.v mismatch", "signature", signature2); + } + raw.push(hexlify(v)); + raw.push(stripZeros(arrayify(sig.r))); + raw.push(stripZeros(arrayify(sig.s))); + return encode(raw); +} +function serialize(transaction, signature2) { + if (transaction.type == null || transaction.type === 0) { + if (transaction.accessList != null) { + logger18.throwArgumentError("untyped transactions do not support accessList; include type: 1", "transaction", transaction); + } + return _serialize(transaction, signature2); + } + switch (transaction.type) { + case 1: + return _serializeEip2930(transaction, signature2); + case 2: + return _serializeEip1559(transaction, signature2); + default: + break; + } + return logger18.throwError(`unsupported transaction type: ${transaction.type}`, Logger.errors.UNSUPPORTED_OPERATION, { + operation: "serializeTransaction", + transactionType: transaction.type + }); +} +function _parseEipSignature(tx, fields, serialize3) { + try { + const recid = handleNumber(fields[0]).toNumber(); + if (recid !== 0 && recid !== 1) { + throw new Error("bad recid"); + } + tx.v = recid; + } catch (error) { + logger18.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]); + } + tx.r = hexZeroPad(fields[1], 32); + tx.s = hexZeroPad(fields[2], 32); + try { + const digest = keccak256(serialize3(tx)); + tx.from = recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v }); + } catch (error) { + } +} +function _parseEip1559(payload) { + const transaction = decode(payload.slice(1)); + if (transaction.length !== 9 && transaction.length !== 12) { + logger18.throwArgumentError("invalid component count for transaction type: 2", "payload", hexlify(payload)); + } + const maxPriorityFeePerGas = handleNumber(transaction[2]); + const maxFeePerGas = handleNumber(transaction[3]); + const tx = { + type: 2, + chainId: handleNumber(transaction[0]).toNumber(), + nonce: handleNumber(transaction[1]).toNumber(), + maxPriorityFeePerGas, + maxFeePerGas, + gasPrice: null, + gasLimit: handleNumber(transaction[4]), + to: handleAddress(transaction[5]), + value: handleNumber(transaction[6]), + data: transaction[7], + accessList: accessListify(transaction[8]) + }; + if (transaction.length === 9) { + return tx; + } + tx.hash = keccak256(payload); + _parseEipSignature(tx, transaction.slice(9), _serializeEip1559); + return tx; +} +function _parseEip2930(payload) { + const transaction = decode(payload.slice(1)); + if (transaction.length !== 8 && transaction.length !== 11) { + logger18.throwArgumentError("invalid component count for transaction type: 1", "payload", hexlify(payload)); + } + const tx = { + type: 1, + chainId: handleNumber(transaction[0]).toNumber(), + nonce: handleNumber(transaction[1]).toNumber(), + gasPrice: handleNumber(transaction[2]), + gasLimit: handleNumber(transaction[3]), + to: handleAddress(transaction[4]), + value: handleNumber(transaction[5]), + data: transaction[6], + accessList: accessListify(transaction[7]) + }; + if (transaction.length === 8) { + return tx; + } + tx.hash = keccak256(payload); + _parseEipSignature(tx, transaction.slice(8), _serializeEip2930); + return tx; +} +function _parse(rawTransaction) { + const transaction = decode(rawTransaction); + if (transaction.length !== 9 && transaction.length !== 6) { + logger18.throwArgumentError("invalid raw transaction", "rawTransaction", rawTransaction); + } + const tx = { + nonce: handleNumber(transaction[0]).toNumber(), + gasPrice: handleNumber(transaction[1]), + gasLimit: handleNumber(transaction[2]), + to: handleAddress(transaction[3]), + value: handleNumber(transaction[4]), + data: transaction[5], + chainId: 0 + }; + if (transaction.length === 6) { + return tx; + } + try { + tx.v = BigNumber.from(transaction[6]).toNumber(); + } catch (error) { + return tx; + } + tx.r = hexZeroPad(transaction[7], 32); + tx.s = hexZeroPad(transaction[8], 32); + if (BigNumber.from(tx.r).isZero() && BigNumber.from(tx.s).isZero()) { + tx.chainId = tx.v; + tx.v = 0; + } else { + tx.chainId = Math.floor((tx.v - 35) / 2); + if (tx.chainId < 0) { + tx.chainId = 0; + } + let recoveryParam = tx.v - 27; + const raw = transaction.slice(0, 6); + if (tx.chainId !== 0) { + raw.push(hexlify(tx.chainId)); + raw.push("0x"); + raw.push("0x"); + recoveryParam -= tx.chainId * 2 + 8; + } + const digest = keccak256(encode(raw)); + try { + tx.from = recoverAddress(digest, { r: hexlify(tx.r), s: hexlify(tx.s), recoveryParam }); + } catch (error) { + } + tx.hash = keccak256(rawTransaction); + } + tx.type = null; + return tx; +} +function parse(rawTransaction) { + const payload = arrayify(rawTransaction); + if (payload[0] > 127) { + return _parse(payload); + } + switch (payload[0]) { + case 1: + return _parseEip2930(payload); + case 2: + return _parseEip1559(payload); + default: + break; + } + return logger18.throwError(`unsupported transaction type: ${payload[0]}`, Logger.errors.UNSUPPORTED_OPERATION, { + operation: "parseTransaction", + transactionType: payload[0] + }); +} +var logger18, TransactionTypes, transactionFields, allowedTransactionKeys2; +var init_lib17 = __esm({ + "node_modules/@ethersproject/transactions/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib7(); + init_lib3(); + init_lib2(); + init_lib8(); + init_lib5(); + init_lib4(); + init_lib6(); + init_lib16(); + init_lib(); + init_version13(); + logger18 = new Logger(version14); + (function(TransactionTypes2) { + TransactionTypes2[TransactionTypes2["legacy"] = 0] = "legacy"; + TransactionTypes2[TransactionTypes2["eip2930"] = 1] = "eip2930"; + TransactionTypes2[TransactionTypes2["eip1559"] = 2] = "eip1559"; + })(TransactionTypes || (TransactionTypes = {})); + transactionFields = [ + { name: "nonce", maxLength: 32, numeric: true }, + { name: "gasPrice", maxLength: 32, numeric: true }, + { name: "gasLimit", maxLength: 32, numeric: true }, + { name: "to", length: 20 }, + { name: "value", maxLength: 32, numeric: true }, + { name: "data" } + ]; + allowedTransactionKeys2 = { + chainId: true, + data: true, + gasLimit: true, + gasPrice: true, + nonce: true, + to: true, + type: true, + value: true + }; + } +}); + +// node_modules/@ethersproject/basex/lib.esm/index.js +var lib_exports14 = {}; +__export(lib_exports14, { + Base32: () => Base32, + Base58: () => Base58, + BaseX: () => BaseX +}); +var BaseX, Base32, Base58; +var init_lib18 = __esm({ + "node_modules/@ethersproject/basex/lib.esm/index.js"() { + init_shim(); + init_lib2(); + init_lib4(); + BaseX = class { + constructor(alphabet) { + defineReadOnly(this, "alphabet", alphabet); + defineReadOnly(this, "base", alphabet.length); + defineReadOnly(this, "_alphabetMap", {}); + defineReadOnly(this, "_leader", alphabet.charAt(0)); + for (let i2 = 0; i2 < alphabet.length; i2++) { + this._alphabetMap[alphabet.charAt(i2)] = i2; + } + } + encode(value) { + let source = arrayify(value); + if (source.length === 0) { + return ""; + } + let digits = [0]; + for (let i2 = 0; i2 < source.length; ++i2) { + let carry = source[i2]; + for (let j = 0; j < digits.length; ++j) { + carry += digits[j] << 8; + digits[j] = carry % this.base; + carry = carry / this.base | 0; + } + while (carry > 0) { + digits.push(carry % this.base); + carry = carry / this.base | 0; + } + } + let string = ""; + for (let k = 0; source[k] === 0 && k < source.length - 1; ++k) { + string += this._leader; + } + for (let q = digits.length - 1; q >= 0; --q) { + string += this.alphabet[digits[q]]; + } + return string; + } + decode(value) { + if (typeof value !== "string") { + throw new TypeError("Expected String"); + } + let bytes = []; + if (value.length === 0) { + return new Uint8Array(bytes); + } + bytes.push(0); + for (let i2 = 0; i2 < value.length; i2++) { + let byte = this._alphabetMap[value[i2]]; + if (byte === void 0) { + throw new Error("Non-base" + this.base + " character"); + } + let carry = byte; + for (let j = 0; j < bytes.length; ++j) { + carry += bytes[j] * this.base; + bytes[j] = carry & 255; + carry >>= 8; + } + while (carry > 0) { + bytes.push(carry & 255); + carry >>= 8; + } + } + for (let k = 0; value[k] === this._leader && k < value.length - 1; ++k) { + bytes.push(0); + } + return arrayify(new Uint8Array(bytes.reverse())); + } + }; + Base32 = new BaseX("abcdefghijklmnopqrstuvwxyz234567"); + Base58 = new BaseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"); + } +}); + +// node_modules/@ethersproject/sha2/lib.esm/types.js +var SupportedAlgorithm; +var init_types = __esm({ + "node_modules/@ethersproject/sha2/lib.esm/types.js"() { + init_shim(); + (function(SupportedAlgorithm2) { + SupportedAlgorithm2["sha256"] = "sha256"; + SupportedAlgorithm2["sha512"] = "sha512"; + })(SupportedAlgorithm || (SupportedAlgorithm = {})); + } +}); + +// node_modules/@ethersproject/sha2/lib.esm/_version.js +var version16; +var init_version14 = __esm({ + "node_modules/@ethersproject/sha2/lib.esm/_version.js"() { + init_shim(); + version16 = "sha2/5.7.0"; + } +}); + +// node_modules/@ethersproject/sha2/lib.esm/sha2.js +function ripemd160(data) { + return "0x" + import_hash3.default.ripemd160().update(arrayify(data)).digest("hex"); +} +function sha256(data) { + return "0x" + import_hash3.default.sha256().update(arrayify(data)).digest("hex"); +} +function sha512(data) { + return "0x" + import_hash3.default.sha512().update(arrayify(data)).digest("hex"); +} +function computeHmac(algorithm, key2, data) { + if (!SupportedAlgorithm[algorithm]) { + logger20.throwError("unsupported algorithm " + algorithm, Logger.errors.UNSUPPORTED_OPERATION, { + operation: "hmac", + algorithm + }); + } + return "0x" + import_hash3.default.hmac(import_hash3.default[algorithm], arrayify(key2)).update(arrayify(data)).digest("hex"); +} +var import_hash3, logger20; +var init_sha2 = __esm({ + "node_modules/@ethersproject/sha2/lib.esm/sha2.js"() { + "use strict"; + init_shim(); + import_hash3 = __toESM(require_hash()); + init_lib2(); + init_types(); + init_lib(); + init_version14(); + logger20 = new Logger(version16); + } +}); + +// node_modules/@ethersproject/sha2/lib.esm/index.js +var lib_exports15 = {}; +__export(lib_exports15, { + SupportedAlgorithm: () => SupportedAlgorithm, + computeHmac: () => computeHmac, + ripemd160: () => ripemd160, + sha256: () => sha256, + sha512: () => sha512 +}); +var init_lib19 = __esm({ + "node_modules/@ethersproject/sha2/lib.esm/index.js"() { + init_shim(); + init_sha2(); + init_types(); + } +}); + +// node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js +function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) { + password = arrayify(password); + salt = arrayify(salt); + let hLen; + let l2 = 1; + const DK = new Uint8Array(keylen); + const block1 = new Uint8Array(salt.length + 4); + block1.set(salt); + let r3; + let T; + for (let i2 = 1; i2 <= l2; i2++) { + block1[salt.length] = i2 >> 24 & 255; + block1[salt.length + 1] = i2 >> 16 & 255; + block1[salt.length + 2] = i2 >> 8 & 255; + block1[salt.length + 3] = i2 & 255; + let U = arrayify(computeHmac(hashAlgorithm, password, block1)); + if (!hLen) { + hLen = U.length; + T = new Uint8Array(hLen); + l2 = Math.ceil(keylen / hLen); + r3 = keylen - (l2 - 1) * hLen; + } + T.set(U); + for (let j = 1; j < iterations; j++) { + U = arrayify(computeHmac(hashAlgorithm, password, U)); + for (let k = 0; k < hLen; k++) + T[k] ^= U[k]; + } + const destPos = (i2 - 1) * hLen; + const len = i2 === l2 ? r3 : hLen; + DK.set(arrayify(T).slice(0, len), destPos); + } + return hexlify(DK); +} +var init_pbkdf2 = __esm({ + "node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_lib19(); + } +}); + +// node_modules/@ethersproject/pbkdf2/lib.esm/index.js +var init_lib20 = __esm({ + "node_modules/@ethersproject/pbkdf2/lib.esm/index.js"() { + init_shim(); + init_pbkdf2(); + } +}); + +// node_modules/@ethersproject/wordlists/lib.esm/_version.js +var version17; +var init_version15 = __esm({ + "node_modules/@ethersproject/wordlists/lib.esm/_version.js"() { + init_shim(); + version17 = "wordlists/5.7.0"; + } +}); + +// node_modules/@ethersproject/wordlists/lib.esm/wordlist.js +var exportWordlist, logger21, Wordlist; +var init_wordlist = __esm({ + "node_modules/@ethersproject/wordlists/lib.esm/wordlist.js"() { + "use strict"; + init_shim(); + init_lib12(); + init_lib4(); + init_lib(); + init_version15(); + exportWordlist = false; + logger21 = new Logger(version17); + Wordlist = class { + constructor(locale) { + logger21.checkAbstract(new.target, Wordlist); + defineReadOnly(this, "locale", locale); + } + // Subclasses may override this + split(mnemonic) { + return mnemonic.toLowerCase().split(/ +/g); + } + // Subclasses may override this + join(words2) { + return words2.join(" "); + } + static check(wordlist2) { + const words2 = []; + for (let i2 = 0; i2 < 2048; i2++) { + const word = wordlist2.getWord(i2); + if (i2 !== wordlist2.getWordIndex(word)) { + return "0x"; + } + words2.push(word); + } + return id(words2.join("\n") + "\n"); + } + static register(lang, name) { + if (!name) { + name = lang.locale; + } + if (exportWordlist) { + try { + const anyGlobal2 = window; + if (anyGlobal2._ethers && anyGlobal2._ethers.wordlists) { + if (!anyGlobal2._ethers.wordlists[name]) { + defineReadOnly(anyGlobal2._ethers.wordlists, name, lang); + } + } + } catch (error) { + } + } + } + }; + } +}); + +// node_modules/@ethersproject/wordlists/lib.esm/lang-en.js +function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + if (Wordlist.check(lang) !== "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60") { + wordlist = null; + throw new Error("BIP39 Wordlist for en (English) FAILED"); + } +} +var words, wordlist, LangEn, langEn; +var init_lang_en = __esm({ + "node_modules/@ethersproject/wordlists/lib.esm/lang-en.js"() { + "use strict"; + init_shim(); + init_wordlist(); + words = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; + wordlist = null; + LangEn = class extends Wordlist { + constructor() { + super("en"); + } + getWord(index) { + loadWords(this); + return wordlist[index]; + } + getWordIndex(word) { + loadWords(this); + return wordlist.indexOf(word); + } + }; + langEn = new LangEn(); + Wordlist.register(langEn); + } +}); + +// node_modules/@ethersproject/wordlists/lib.esm/wordlists.js +var wordlists; +var init_wordlists = __esm({ + "node_modules/@ethersproject/wordlists/lib.esm/wordlists.js"() { + "use strict"; + init_shim(); + init_lang_en(); + wordlists = { + en: langEn + }; + } +}); + +// node_modules/@ethersproject/wordlists/lib.esm/index.js +var init_lib21 = __esm({ + "node_modules/@ethersproject/wordlists/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_wordlist(); + init_wordlists(); + } +}); + +// node_modules/@ethersproject/hdnode/lib.esm/_version.js +var version18; +var init_version16 = __esm({ + "node_modules/@ethersproject/hdnode/lib.esm/_version.js"() { + init_shim(); + version18 = "hdnode/5.7.0"; + } +}); + +// node_modules/@ethersproject/hdnode/lib.esm/index.js +var lib_exports16 = {}; +__export(lib_exports16, { + HDNode: () => HDNode, + defaultPath: () => defaultPath, + entropyToMnemonic: () => entropyToMnemonic, + getAccountPath: () => getAccountPath, + isValidMnemonic: () => isValidMnemonic, + mnemonicToEntropy: () => mnemonicToEntropy, + mnemonicToSeed: () => mnemonicToSeed +}); +function getUpperMask(bits) { + return (1 << bits) - 1 << 8 - bits; +} +function getLowerMask(bits) { + return (1 << bits) - 1; +} +function bytes32(value) { + return hexZeroPad(hexlify(value), 32); +} +function base58check(data) { + return Base58.encode(concat([data, hexDataSlice(sha256(sha256(data)), 0, 4)])); +} +function getWordlist(wordlist2) { + if (wordlist2 == null) { + return wordlists["en"]; + } + if (typeof wordlist2 === "string") { + const words2 = wordlists[wordlist2]; + if (words2 == null) { + logger22.throwArgumentError("unknown locale", "wordlist", wordlist2); + } + return words2; + } + return wordlist2; +} +function mnemonicToSeed(mnemonic, password) { + if (!password) { + password = ""; + } + const salt = toUtf8Bytes("mnemonic" + password, UnicodeNormalizationForm.NFKD); + return pbkdf2(toUtf8Bytes(mnemonic, UnicodeNormalizationForm.NFKD), salt, 2048, 64, "sha512"); +} +function mnemonicToEntropy(mnemonic, wordlist2) { + wordlist2 = getWordlist(wordlist2); + logger22.checkNormalize(); + const words2 = wordlist2.split(mnemonic); + if (words2.length % 3 !== 0) { + throw new Error("invalid mnemonic"); + } + const entropy = arrayify(new Uint8Array(Math.ceil(11 * words2.length / 8))); + let offset = 0; + for (let i2 = 0; i2 < words2.length; i2++) { + let index = wordlist2.getWordIndex(words2[i2].normalize("NFKD")); + if (index === -1) { + throw new Error("invalid mnemonic"); + } + for (let bit = 0; bit < 11; bit++) { + if (index & 1 << 10 - bit) { + entropy[offset >> 3] |= 1 << 7 - offset % 8; + } + offset++; + } + } + const entropyBits = 32 * words2.length / 3; + const checksumBits = words2.length / 3; + const checksumMask = getUpperMask(checksumBits); + const checksum = arrayify(sha256(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + if (checksum !== (entropy[entropy.length - 1] & checksumMask)) { + throw new Error("invalid checksum"); + } + return hexlify(entropy.slice(0, entropyBits / 8)); +} +function entropyToMnemonic(entropy, wordlist2) { + wordlist2 = getWordlist(wordlist2); + entropy = arrayify(entropy); + if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) { + throw new Error("invalid entropy"); + } + const indices = [0]; + let remainingBits = 11; + for (let i2 = 0; i2 < entropy.length; i2++) { + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i2]; + remainingBits -= 8; + } else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i2] >> 8 - remainingBits; + indices.push(entropy[i2] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } + const checksumBits = entropy.length / 4; + const checksum = arrayify(sha256(entropy))[0] & getUpperMask(checksumBits); + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= checksum >> 8 - checksumBits; + return wordlist2.join(indices.map((index) => wordlist2.getWord(index))); +} +function isValidMnemonic(mnemonic, wordlist2) { + try { + mnemonicToEntropy(mnemonic, wordlist2); + return true; + } catch (error) { + } + return false; +} +function getAccountPath(index) { + if (typeof index !== "number" || index < 0 || index >= HardenedBit || index % 1) { + logger22.throwArgumentError("invalid account index", "index", index); + } + return `m/44'/60'/${index}'/0/0`; +} +var logger22, N, MasterSecret, HardenedBit, _constructorGuard4, defaultPath, HDNode; +var init_lib22 = __esm({ + "node_modules/@ethersproject/hdnode/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib18(); + init_lib2(); + init_lib3(); + init_lib9(); + init_lib20(); + init_lib4(); + init_lib16(); + init_lib19(); + init_lib17(); + init_lib21(); + init_lib(); + init_version16(); + logger22 = new Logger(version18); + N = BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); + MasterSecret = toUtf8Bytes("Bitcoin seed"); + HardenedBit = 2147483648; + _constructorGuard4 = {}; + defaultPath = "m/44'/60'/0'/0/0"; + HDNode = class { + /** + * This constructor should not be called directly. + * + * Please use: + * - fromMnemonic + * - fromSeed + */ + constructor(constructorGuard, privateKey, publicKey, parentFingerprint, chainCode, index, depth, mnemonicOrPath) { + if (constructorGuard !== _constructorGuard4) { + throw new Error("HDNode constructor cannot be called directly"); + } + if (privateKey) { + const signingKey = new SigningKey(privateKey); + defineReadOnly(this, "privateKey", signingKey.privateKey); + defineReadOnly(this, "publicKey", signingKey.compressedPublicKey); + } else { + defineReadOnly(this, "privateKey", null); + defineReadOnly(this, "publicKey", hexlify(publicKey)); + } + defineReadOnly(this, "parentFingerprint", parentFingerprint); + defineReadOnly(this, "fingerprint", hexDataSlice(ripemd160(sha256(this.publicKey)), 0, 4)); + defineReadOnly(this, "address", computeAddress(this.publicKey)); + defineReadOnly(this, "chainCode", chainCode); + defineReadOnly(this, "index", index); + defineReadOnly(this, "depth", depth); + if (mnemonicOrPath == null) { + defineReadOnly(this, "mnemonic", null); + defineReadOnly(this, "path", null); + } else if (typeof mnemonicOrPath === "string") { + defineReadOnly(this, "mnemonic", null); + defineReadOnly(this, "path", mnemonicOrPath); + } else { + defineReadOnly(this, "mnemonic", mnemonicOrPath); + defineReadOnly(this, "path", mnemonicOrPath.path); + } + } + get extendedKey() { + if (this.depth >= 256) { + throw new Error("Depth too large!"); + } + return base58check(concat([ + this.privateKey != null ? "0x0488ADE4" : "0x0488B21E", + hexlify(this.depth), + this.parentFingerprint, + hexZeroPad(hexlify(this.index), 4), + this.chainCode, + this.privateKey != null ? concat(["0x00", this.privateKey]) : this.publicKey + ])); + } + neuter() { + return new HDNode(_constructorGuard4, null, this.publicKey, this.parentFingerprint, this.chainCode, this.index, this.depth, this.path); + } + _derive(index) { + if (index > 4294967295) { + throw new Error("invalid index - " + String(index)); + } + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + } + const data = new Uint8Array(37); + if (index & HardenedBit) { + if (!this.privateKey) { + throw new Error("cannot derive child of neutered node"); + } + data.set(arrayify(this.privateKey), 1); + if (path) { + path += "'"; + } + } else { + data.set(arrayify(this.publicKey)); + } + for (let i2 = 24; i2 >= 0; i2 -= 8) { + data[33 + (i2 >> 3)] = index >> 24 - i2 & 255; + } + const I2 = arrayify(computeHmac(SupportedAlgorithm.sha512, this.chainCode, data)); + const IL = I2.slice(0, 32); + const IR = I2.slice(32); + let ki = null; + let Ki = null; + if (this.privateKey) { + ki = bytes32(BigNumber.from(IL).add(this.privateKey).mod(N)); + } else { + const ek = new SigningKey(hexlify(IL)); + Ki = ek._addPoint(this.publicKey); + } + let mnemonicOrPath = path; + const srcMnemonic = this.mnemonic; + if (srcMnemonic) { + mnemonicOrPath = Object.freeze({ + phrase: srcMnemonic.phrase, + path, + locale: srcMnemonic.locale || "en" + }); + } + return new HDNode(_constructorGuard4, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath); + } + derivePath(path) { + const components = path.split("/"); + if (components.length === 0 || components[0] === "m" && this.depth !== 0) { + throw new Error("invalid path - " + path); + } + if (components[0] === "m") { + components.shift(); + } + let result = this; + for (let i2 = 0; i2 < components.length; i2++) { + const component = components[i2]; + if (component.match(/^[0-9]+'$/)) { + const index = parseInt(component.substring(0, component.length - 1)); + if (index >= HardenedBit) { + throw new Error("invalid path index - " + component); + } + result = result._derive(HardenedBit + index); + } else if (component.match(/^[0-9]+$/)) { + const index = parseInt(component); + if (index >= HardenedBit) { + throw new Error("invalid path index - " + component); + } + result = result._derive(index); + } else { + throw new Error("invalid path component - " + component); + } + } + return result; + } + static _fromSeed(seed, mnemonic) { + const seedArray = arrayify(seed); + if (seedArray.length < 16 || seedArray.length > 64) { + throw new Error("invalid seed"); + } + const I2 = arrayify(computeHmac(SupportedAlgorithm.sha512, MasterSecret, seedArray)); + return new HDNode(_constructorGuard4, bytes32(I2.slice(0, 32)), null, "0x00000000", bytes32(I2.slice(32)), 0, 0, mnemonic); + } + static fromMnemonic(mnemonic, password, wordlist2) { + wordlist2 = getWordlist(wordlist2); + mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist2), wordlist2); + return HDNode._fromSeed(mnemonicToSeed(mnemonic, password), { + phrase: mnemonic, + path: "m", + locale: wordlist2.locale + }); + } + static fromSeed(seed) { + return HDNode._fromSeed(seed, null); + } + static fromExtendedKey(extendedKey) { + const bytes = Base58.decode(extendedKey); + if (bytes.length !== 82 || base58check(bytes.slice(0, 78)) !== extendedKey) { + logger22.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); + } + const depth = bytes[4]; + const parentFingerprint = hexlify(bytes.slice(5, 9)); + const index = parseInt(hexlify(bytes.slice(9, 13)).substring(2), 16); + const chainCode = hexlify(bytes.slice(13, 45)); + const key2 = bytes.slice(45, 78); + switch (hexlify(bytes.slice(0, 4))) { + case "0x0488b21e": + case "0x043587cf": + return new HDNode(_constructorGuard4, null, hexlify(key2), parentFingerprint, chainCode, index, depth, null); + case "0x0488ade4": + case "0x04358394 ": + if (key2[0] !== 0) { + break; + } + return new HDNode(_constructorGuard4, hexlify(key2.slice(1)), null, parentFingerprint, chainCode, index, depth, null); + } + return logger22.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); + } + }; + } +}); + +// node_modules/@ethersproject/random/lib.esm/_version.js +var version19; +var init_version17 = __esm({ + "node_modules/@ethersproject/random/lib.esm/_version.js"() { + init_shim(); + version19 = "random/5.7.0"; + } +}); + +// node_modules/@ethersproject/random/lib.esm/random.js +function getGlobal() { + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw new Error("unable to locate global object"); +} +function randomBytes(length) { + if (length <= 0 || length > 1024 || length % 1 || length != length) { + logger23.throwArgumentError("invalid length", "length", length); + } + const result = new Uint8Array(length); + crypto2.getRandomValues(result); + return arrayify(result); +} +var logger23, anyGlobal, crypto2; +var init_random = __esm({ + "node_modules/@ethersproject/random/lib.esm/random.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_lib(); + init_version17(); + logger23 = new Logger(version19); + anyGlobal = getGlobal(); + crypto2 = anyGlobal.crypto || anyGlobal.msCrypto; + if (!crypto2 || !crypto2.getRandomValues) { + logger23.warn("WARNING: Missing strong random number source"); + crypto2 = { + getRandomValues: function(buffer) { + return logger23.throwError("no secure random source avaialble", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "crypto.getRandomValues" + }); + } + }; + } + } +}); + +// node_modules/@ethersproject/random/lib.esm/shuffle.js +function shuffled(array) { + array = array.slice(); + for (let i2 = array.length - 1; i2 > 0; i2--) { + const j = Math.floor(Math.random() * (i2 + 1)); + const tmp = array[i2]; + array[i2] = array[j]; + array[j] = tmp; + } + return array; +} +var init_shuffle = __esm({ + "node_modules/@ethersproject/random/lib.esm/shuffle.js"() { + "use strict"; + init_shim(); + } +}); + +// node_modules/@ethersproject/random/lib.esm/index.js +var lib_exports17 = {}; +__export(lib_exports17, { + randomBytes: () => randomBytes, + shuffled: () => shuffled +}); +var init_lib23 = __esm({ + "node_modules/@ethersproject/random/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_random(); + init_shuffle(); + } +}); + +// node_modules/aes-js/index.js +var require_aes_js = __commonJS({ + "node_modules/aes-js/index.js"(exports, module2) { + "use strict"; + init_shim(); + (function(root) { + function checkInt(value) { + return parseInt(value) === value; + } + function checkInts(arrayish) { + if (!checkInt(arrayish.length)) { + return false; + } + for (var i2 = 0; i2 < arrayish.length; i2++) { + if (!checkInt(arrayish[i2]) || arrayish[i2] < 0 || arrayish[i2] > 255) { + return false; + } + } + return true; + } + function coerceArray(arg, copy) { + if (arg.buffer && ArrayBuffer.isView(arg) && arg.name === "Uint8Array") { + if (copy) { + if (arg.slice) { + arg = arg.slice(); + } else { + arg = Array.prototype.slice.call(arg); + } + } + return arg; + } + if (Array.isArray(arg)) { + if (!checkInts(arg)) { + throw new Error("Array contains invalid value: " + arg); + } + return new Uint8Array(arg); + } + if (checkInt(arg.length) && checkInts(arg)) { + return new Uint8Array(arg); + } + throw new Error("unsupported array-like object"); + } + function createArray(length) { + return new Uint8Array(length); + } + function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) { + if (sourceStart != null || sourceEnd != null) { + if (sourceArray.slice) { + sourceArray = sourceArray.slice(sourceStart, sourceEnd); + } else { + sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd); + } + } + targetArray.set(sourceArray, targetStart); + } + var convertUtf8 = function() { + function toBytes(text) { + var result = [], i2 = 0; + text = encodeURI(text); + while (i2 < text.length) { + var c = text.charCodeAt(i2++); + if (c === 37) { + result.push(parseInt(text.substr(i2, 2), 16)); + i2 += 2; + } else { + result.push(c); + } + } + return coerceArray(result); + } + function fromBytes(bytes) { + var result = [], i2 = 0; + while (i2 < bytes.length) { + var c = bytes[i2]; + if (c < 128) { + result.push(String.fromCharCode(c)); + i2++; + } else if (c > 191 && c < 224) { + result.push(String.fromCharCode((c & 31) << 6 | bytes[i2 + 1] & 63)); + i2 += 2; + } else { + result.push(String.fromCharCode((c & 15) << 12 | (bytes[i2 + 1] & 63) << 6 | bytes[i2 + 2] & 63)); + i2 += 3; + } + } + return result.join(""); + } + return { + toBytes, + fromBytes + }; + }(); + var convertHex = function() { + function toBytes(text) { + var result = []; + for (var i2 = 0; i2 < text.length; i2 += 2) { + result.push(parseInt(text.substr(i2, 2), 16)); + } + return result; + } + var Hex = "0123456789abcdef"; + function fromBytes(bytes) { + var result = []; + for (var i2 = 0; i2 < bytes.length; i2++) { + var v = bytes[i2]; + result.push(Hex[(v & 240) >> 4] + Hex[v & 15]); + } + return result.join(""); + } + return { + toBytes, + fromBytes + }; + }(); + var numberOfRounds = { 16: 10, 24: 12, 32: 14 }; + var rcon = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145]; + var S2 = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22]; + var Si = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125]; + var T1 = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986]; + var T2 = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766]; + var T3 = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126]; + var T4 = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436]; + var T5 = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890]; + var T6 = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935]; + var T7 = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600]; + var T8 = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480]; + var U1 = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795]; + var U2 = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855]; + var U3 = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150]; + var U4 = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925]; + function convertToInt32(bytes) { + var result = []; + for (var i2 = 0; i2 < bytes.length; i2 += 4) { + result.push( + bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3] + ); + } + return result; + } + var AES = function(key2) { + if (!(this instanceof AES)) { + throw Error("AES must be instanitated with `new`"); + } + Object.defineProperty(this, "key", { + value: coerceArray(key2, true) + }); + this._prepare(); + }; + AES.prototype._prepare = function() { + var rounds = numberOfRounds[this.key.length]; + if (rounds == null) { + throw new Error("invalid key size (must be 16, 24 or 32 bytes)"); + } + this._Ke = []; + this._Kd = []; + for (var i2 = 0; i2 <= rounds; i2++) { + this._Ke.push([0, 0, 0, 0]); + this._Kd.push([0, 0, 0, 0]); + } + var roundKeyCount = (rounds + 1) * 4; + var KC = this.key.length / 4; + var tk = convertToInt32(this.key); + var index; + for (var i2 = 0; i2 < KC; i2++) { + index = i2 >> 2; + this._Ke[index][i2 % 4] = tk[i2]; + this._Kd[rounds - index][i2 % 4] = tk[i2]; + } + var rconpointer = 0; + var t2 = KC, tt; + while (t2 < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= S2[tt >> 16 & 255] << 24 ^ S2[tt >> 8 & 255] << 16 ^ S2[tt & 255] << 8 ^ S2[tt >> 24 & 255] ^ rcon[rconpointer] << 24; + rconpointer += 1; + if (KC != 8) { + for (var i2 = 1; i2 < KC; i2++) { + tk[i2] ^= tk[i2 - 1]; + } + } else { + for (var i2 = 1; i2 < KC / 2; i2++) { + tk[i2] ^= tk[i2 - 1]; + } + tt = tk[KC / 2 - 1]; + tk[KC / 2] ^= S2[tt & 255] ^ S2[tt >> 8 & 255] << 8 ^ S2[tt >> 16 & 255] << 16 ^ S2[tt >> 24 & 255] << 24; + for (var i2 = KC / 2 + 1; i2 < KC; i2++) { + tk[i2] ^= tk[i2 - 1]; + } + } + var i2 = 0, r3, c; + while (i2 < KC && t2 < roundKeyCount) { + r3 = t2 >> 2; + c = t2 % 4; + this._Ke[r3][c] = tk[i2]; + this._Kd[rounds - r3][c] = tk[i2++]; + t2++; + } + } + for (var r3 = 1; r3 < rounds; r3++) { + for (var c = 0; c < 4; c++) { + tt = this._Kd[r3][c]; + this._Kd[r3][c] = U1[tt >> 24 & 255] ^ U2[tt >> 16 & 255] ^ U3[tt >> 8 & 255] ^ U4[tt & 255]; + } + } + }; + AES.prototype.encrypt = function(plaintext) { + if (plaintext.length != 16) { + throw new Error("invalid plaintext size (must be 16 bytes)"); + } + var rounds = this._Ke.length - 1; + var a2 = [0, 0, 0, 0]; + var t2 = convertToInt32(plaintext); + for (var i2 = 0; i2 < 4; i2++) { + t2[i2] ^= this._Ke[0][i2]; + } + for (var r3 = 1; r3 < rounds; r3++) { + for (var i2 = 0; i2 < 4; i2++) { + a2[i2] = T1[t2[i2] >> 24 & 255] ^ T2[t2[(i2 + 1) % 4] >> 16 & 255] ^ T3[t2[(i2 + 2) % 4] >> 8 & 255] ^ T4[t2[(i2 + 3) % 4] & 255] ^ this._Ke[r3][i2]; + } + t2 = a2.slice(); + } + var result = createArray(16), tt; + for (var i2 = 0; i2 < 4; i2++) { + tt = this._Ke[rounds][i2]; + result[4 * i2] = (S2[t2[i2] >> 24 & 255] ^ tt >> 24) & 255; + result[4 * i2 + 1] = (S2[t2[(i2 + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255; + result[4 * i2 + 2] = (S2[t2[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; + result[4 * i2 + 3] = (S2[t2[(i2 + 3) % 4] & 255] ^ tt) & 255; + } + return result; + }; + AES.prototype.decrypt = function(ciphertext) { + if (ciphertext.length != 16) { + throw new Error("invalid ciphertext size (must be 16 bytes)"); + } + var rounds = this._Kd.length - 1; + var a2 = [0, 0, 0, 0]; + var t2 = convertToInt32(ciphertext); + for (var i2 = 0; i2 < 4; i2++) { + t2[i2] ^= this._Kd[0][i2]; + } + for (var r3 = 1; r3 < rounds; r3++) { + for (var i2 = 0; i2 < 4; i2++) { + a2[i2] = T5[t2[i2] >> 24 & 255] ^ T6[t2[(i2 + 3) % 4] >> 16 & 255] ^ T7[t2[(i2 + 2) % 4] >> 8 & 255] ^ T8[t2[(i2 + 1) % 4] & 255] ^ this._Kd[r3][i2]; + } + t2 = a2.slice(); + } + var result = createArray(16), tt; + for (var i2 = 0; i2 < 4; i2++) { + tt = this._Kd[rounds][i2]; + result[4 * i2] = (Si[t2[i2] >> 24 & 255] ^ tt >> 24) & 255; + result[4 * i2 + 1] = (Si[t2[(i2 + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255; + result[4 * i2 + 2] = (Si[t2[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; + result[4 * i2 + 3] = (Si[t2[(i2 + 1) % 4] & 255] ^ tt) & 255; + } + return result; + }; + var ModeOfOperationECB = function(key2) { + if (!(this instanceof ModeOfOperationECB)) { + throw Error("AES must be instanitated with `new`"); + } + this.description = "Electronic Code Block"; + this.name = "ecb"; + this._aes = new AES(key2); + }; + ModeOfOperationECB.prototype.encrypt = function(plaintext) { + plaintext = coerceArray(plaintext); + if (plaintext.length % 16 !== 0) { + throw new Error("invalid plaintext size (must be multiple of 16 bytes)"); + } + var ciphertext = createArray(plaintext.length); + var block = createArray(16); + for (var i2 = 0; i2 < plaintext.length; i2 += 16) { + copyArray(plaintext, block, 0, i2, i2 + 16); + block = this._aes.encrypt(block); + copyArray(block, ciphertext, i2); + } + return ciphertext; + }; + ModeOfOperationECB.prototype.decrypt = function(ciphertext) { + ciphertext = coerceArray(ciphertext); + if (ciphertext.length % 16 !== 0) { + throw new Error("invalid ciphertext size (must be multiple of 16 bytes)"); + } + var plaintext = createArray(ciphertext.length); + var block = createArray(16); + for (var i2 = 0; i2 < ciphertext.length; i2 += 16) { + copyArray(ciphertext, block, 0, i2, i2 + 16); + block = this._aes.decrypt(block); + copyArray(block, plaintext, i2); + } + return plaintext; + }; + var ModeOfOperationCBC = function(key2, iv2) { + if (!(this instanceof ModeOfOperationCBC)) { + throw Error("AES must be instanitated with `new`"); + } + this.description = "Cipher Block Chaining"; + this.name = "cbc"; + if (!iv2) { + iv2 = createArray(16); + } else if (iv2.length != 16) { + throw new Error("invalid initialation vector size (must be 16 bytes)"); + } + this._lastCipherblock = coerceArray(iv2, true); + this._aes = new AES(key2); + }; + ModeOfOperationCBC.prototype.encrypt = function(plaintext) { + plaintext = coerceArray(plaintext); + if (plaintext.length % 16 !== 0) { + throw new Error("invalid plaintext size (must be multiple of 16 bytes)"); + } + var ciphertext = createArray(plaintext.length); + var block = createArray(16); + for (var i2 = 0; i2 < plaintext.length; i2 += 16) { + copyArray(plaintext, block, 0, i2, i2 + 16); + for (var j = 0; j < 16; j++) { + block[j] ^= this._lastCipherblock[j]; + } + this._lastCipherblock = this._aes.encrypt(block); + copyArray(this._lastCipherblock, ciphertext, i2); + } + return ciphertext; + }; + ModeOfOperationCBC.prototype.decrypt = function(ciphertext) { + ciphertext = coerceArray(ciphertext); + if (ciphertext.length % 16 !== 0) { + throw new Error("invalid ciphertext size (must be multiple of 16 bytes)"); + } + var plaintext = createArray(ciphertext.length); + var block = createArray(16); + for (var i2 = 0; i2 < ciphertext.length; i2 += 16) { + copyArray(ciphertext, block, 0, i2, i2 + 16); + block = this._aes.decrypt(block); + for (var j = 0; j < 16; j++) { + plaintext[i2 + j] = block[j] ^ this._lastCipherblock[j]; + } + copyArray(ciphertext, this._lastCipherblock, 0, i2, i2 + 16); + } + return plaintext; + }; + var ModeOfOperationCFB = function(key2, iv2, segmentSize) { + if (!(this instanceof ModeOfOperationCFB)) { + throw Error("AES must be instanitated with `new`"); + } + this.description = "Cipher Feedback"; + this.name = "cfb"; + if (!iv2) { + iv2 = createArray(16); + } else if (iv2.length != 16) { + throw new Error("invalid initialation vector size (must be 16 size)"); + } + if (!segmentSize) { + segmentSize = 1; + } + this.segmentSize = segmentSize; + this._shiftRegister = coerceArray(iv2, true); + this._aes = new AES(key2); + }; + ModeOfOperationCFB.prototype.encrypt = function(plaintext) { + if (plaintext.length % this.segmentSize != 0) { + throw new Error("invalid plaintext size (must be segmentSize bytes)"); + } + var encrypted = coerceArray(plaintext, true); + var xorSegment; + for (var i2 = 0; i2 < encrypted.length; i2 += this.segmentSize) { + xorSegment = this._aes.encrypt(this._shiftRegister); + for (var j = 0; j < this.segmentSize; j++) { + encrypted[i2 + j] ^= xorSegment[j]; + } + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize); + } + return encrypted; + }; + ModeOfOperationCFB.prototype.decrypt = function(ciphertext) { + if (ciphertext.length % this.segmentSize != 0) { + throw new Error("invalid ciphertext size (must be segmentSize bytes)"); + } + var plaintext = coerceArray(ciphertext, true); + var xorSegment; + for (var i2 = 0; i2 < plaintext.length; i2 += this.segmentSize) { + xorSegment = this._aes.encrypt(this._shiftRegister); + for (var j = 0; j < this.segmentSize; j++) { + plaintext[i2 + j] ^= xorSegment[j]; + } + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize); + } + return plaintext; + }; + var ModeOfOperationOFB = function(key2, iv2) { + if (!(this instanceof ModeOfOperationOFB)) { + throw Error("AES must be instanitated with `new`"); + } + this.description = "Output Feedback"; + this.name = "ofb"; + if (!iv2) { + iv2 = createArray(16); + } else if (iv2.length != 16) { + throw new Error("invalid initialation vector size (must be 16 bytes)"); + } + this._lastPrecipher = coerceArray(iv2, true); + this._lastPrecipherIndex = 16; + this._aes = new AES(key2); + }; + ModeOfOperationOFB.prototype.encrypt = function(plaintext) { + var encrypted = coerceArray(plaintext, true); + for (var i2 = 0; i2 < encrypted.length; i2++) { + if (this._lastPrecipherIndex === 16) { + this._lastPrecipher = this._aes.encrypt(this._lastPrecipher); + this._lastPrecipherIndex = 0; + } + encrypted[i2] ^= this._lastPrecipher[this._lastPrecipherIndex++]; + } + return encrypted; + }; + ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt; + var Counter = function(initialValue) { + if (!(this instanceof Counter)) { + throw Error("Counter must be instanitated with `new`"); + } + if (initialValue !== 0 && !initialValue) { + initialValue = 1; + } + if (typeof initialValue === "number") { + this._counter = createArray(16); + this.setValue(initialValue); + } else { + this.setBytes(initialValue); + } + }; + Counter.prototype.setValue = function(value) { + if (typeof value !== "number" || parseInt(value) != value) { + throw new Error("invalid counter value (must be an integer)"); + } + for (var index = 15; index >= 0; --index) { + this._counter[index] = value % 256; + value = value >> 8; + } + }; + Counter.prototype.setBytes = function(bytes) { + bytes = coerceArray(bytes, true); + if (bytes.length != 16) { + throw new Error("invalid counter bytes size (must be 16 bytes)"); + } + this._counter = bytes; + }; + Counter.prototype.increment = function() { + for (var i2 = 15; i2 >= 0; i2--) { + if (this._counter[i2] === 255) { + this._counter[i2] = 0; + } else { + this._counter[i2]++; + break; + } + } + }; + var ModeOfOperationCTR = function(key2, counter) { + if (!(this instanceof ModeOfOperationCTR)) { + throw Error("AES must be instanitated with `new`"); + } + this.description = "Counter"; + this.name = "ctr"; + if (!(counter instanceof Counter)) { + counter = new Counter(counter); + } + this._counter = counter; + this._remainingCounter = null; + this._remainingCounterIndex = 16; + this._aes = new AES(key2); + }; + ModeOfOperationCTR.prototype.encrypt = function(plaintext) { + var encrypted = coerceArray(plaintext, true); + for (var i2 = 0; i2 < encrypted.length; i2++) { + if (this._remainingCounterIndex === 16) { + this._remainingCounter = this._aes.encrypt(this._counter._counter); + this._remainingCounterIndex = 0; + this._counter.increment(); + } + encrypted[i2] ^= this._remainingCounter[this._remainingCounterIndex++]; + } + return encrypted; + }; + ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt; + function pkcs7pad(data) { + data = coerceArray(data, true); + var padder = 16 - data.length % 16; + var result = createArray(data.length + padder); + copyArray(data, result); + for (var i2 = data.length; i2 < result.length; i2++) { + result[i2] = padder; + } + return result; + } + function pkcs7strip(data) { + data = coerceArray(data, true); + if (data.length < 16) { + throw new Error("PKCS#7 invalid length"); + } + var padder = data[data.length - 1]; + if (padder > 16) { + throw new Error("PKCS#7 padding byte out of range"); + } + var length = data.length - padder; + for (var i2 = 0; i2 < padder; i2++) { + if (data[length + i2] !== padder) { + throw new Error("PKCS#7 invalid padding byte"); + } + } + var result = createArray(length); + copyArray(data, result, 0, 0, length); + return result; + } + var aesjs = { + AES, + Counter, + ModeOfOperation: { + ecb: ModeOfOperationECB, + cbc: ModeOfOperationCBC, + cfb: ModeOfOperationCFB, + ofb: ModeOfOperationOFB, + ctr: ModeOfOperationCTR + }, + utils: { + hex: convertHex, + utf8: convertUtf8 + }, + padding: { + pkcs7: { + pad: pkcs7pad, + strip: pkcs7strip + } + }, + _arrayTest: { + coerceArray, + createArray, + copyArray + } + }; + if (typeof exports !== "undefined") { + module2.exports = aesjs; + } else if (typeof define === "function" && define.amd) { + define(aesjs); + } else { + if (root.aesjs) { + aesjs._aesjs = root.aesjs; + } + root.aesjs = aesjs; + } + })(exports); + } +}); + +// node_modules/@ethersproject/json-wallets/lib.esm/_version.js +var version20; +var init_version18 = __esm({ + "node_modules/@ethersproject/json-wallets/lib.esm/_version.js"() { + init_shim(); + version20 = "json-wallets/5.7.0"; + } +}); + +// node_modules/@ethersproject/json-wallets/lib.esm/utils.js +function looseArrayify(hexString) { + if (typeof hexString === "string" && hexString.substring(0, 2) !== "0x") { + hexString = "0x" + hexString; + } + return arrayify(hexString); +} +function zpad(value, length) { + value = String(value); + while (value.length < length) { + value = "0" + value; + } + return value; +} +function getPassword(password) { + if (typeof password === "string") { + return toUtf8Bytes(password, UnicodeNormalizationForm.NFKC); + } + return arrayify(password); +} +function searchPath(object, path) { + let currentChild = object; + const comps = path.toLowerCase().split("/"); + for (let i2 = 0; i2 < comps.length; i2++) { + let matchingChild = null; + for (const key2 in currentChild) { + if (key2.toLowerCase() === comps[i2]) { + matchingChild = currentChild[key2]; + break; + } + } + if (matchingChild === null) { + return null; + } + currentChild = matchingChild; + } + return currentChild; +} +function uuidV4(randomBytes2) { + const bytes = arrayify(randomBytes2); + bytes[6] = bytes[6] & 15 | 64; + bytes[8] = bytes[8] & 63 | 128; + const value = hexlify(bytes); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34) + ].join("-"); +} +var init_utils = __esm({ + "node_modules/@ethersproject/json-wallets/lib.esm/utils.js"() { + "use strict"; + init_shim(); + init_lib2(); + init_lib9(); + } +}); + +// node_modules/@ethersproject/json-wallets/lib.esm/crowdsale.js +function decrypt(json, password) { + const data = JSON.parse(json); + password = getPassword(password); + const ethaddr = getAddress(searchPath(data, "ethaddr")); + const encseed = looseArrayify(searchPath(data, "encseed")); + if (!encseed || encseed.length % 16 !== 0) { + logger24.throwArgumentError("invalid encseed", "json", json); + } + const key2 = arrayify(pbkdf2(password, password, 2e3, 32, "sha256")).slice(0, 16); + const iv2 = encseed.slice(0, 16); + const encryptedSeed = encseed.slice(16); + const aesCbc = new import_aes_js.default.ModeOfOperation.cbc(key2, iv2); + const seed = import_aes_js.default.padding.pkcs7.strip(arrayify(aesCbc.decrypt(encryptedSeed))); + let seedHex = ""; + for (let i2 = 0; i2 < seed.length; i2++) { + seedHex += String.fromCharCode(seed[i2]); + } + const seedHexBytes = toUtf8Bytes(seedHex); + const privateKey = keccak256(seedHexBytes); + return new CrowdsaleAccount({ + _isCrowdsaleAccount: true, + address: ethaddr, + privateKey + }); +} +var import_aes_js, logger24, CrowdsaleAccount; +var init_crowdsale = __esm({ + "node_modules/@ethersproject/json-wallets/lib.esm/crowdsale.js"() { + "use strict"; + init_shim(); + import_aes_js = __toESM(require_aes_js()); + init_lib7(); + init_lib2(); + init_lib5(); + init_lib20(); + init_lib9(); + init_lib4(); + init_lib(); + init_version18(); + init_utils(); + logger24 = new Logger(version20); + CrowdsaleAccount = class extends Description { + isCrowdsaleAccount(value) { + return !!(value && value._isCrowdsaleAccount); + } + }; + } +}); + +// node_modules/@ethersproject/json-wallets/lib.esm/inspect.js +function isCrowdsaleWallet(json) { + let data = null; + try { + data = JSON.parse(json); + } catch (error) { + return false; + } + return data.encseed && data.ethaddr; +} +function isKeystoreWallet(json) { + let data = null; + try { + data = JSON.parse(json); + } catch (error) { + return false; + } + if (!data.version || parseInt(data.version) !== data.version || parseInt(data.version) !== 3) { + return false; + } + return true; +} +function getJsonWalletAddress(json) { + if (isCrowdsaleWallet(json)) { + try { + return getAddress(JSON.parse(json).ethaddr); + } catch (error) { + return null; + } + } + if (isKeystoreWallet(json)) { + try { + return getAddress(JSON.parse(json).address); + } catch (error) { + return null; + } + } + return null; +} +var init_inspect = __esm({ + "node_modules/@ethersproject/json-wallets/lib.esm/inspect.js"() { + "use strict"; + init_shim(); + init_lib7(); + } +}); + +// node_modules/scrypt-js/scrypt.js +var require_scrypt = __commonJS({ + "node_modules/scrypt-js/scrypt.js"(exports, module2) { + "use strict"; + init_shim(); + (function(root) { + const MAX_VALUE = 2147483647; + function SHA256(m) { + const K2 = new Uint32Array([ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]); + let h0 = 1779033703, h1 = 3144134277, h2 = 1013904242, h3 = 2773480762; + let h4 = 1359893119, h5 = 2600822924, h6 = 528734635, h7 = 1541459225; + const w = new Uint32Array(64); + function blocks(p2) { + let off = 0, len = p2.length; + while (len >= 64) { + let a2 = h0, b = h1, c = h2, d = h3, e2 = h4, f = h5, g = h6, h = h7, u, i3, j, t1, t2; + for (i3 = 0; i3 < 16; i3++) { + j = off + i3 * 4; + w[i3] = (p2[j] & 255) << 24 | (p2[j + 1] & 255) << 16 | (p2[j + 2] & 255) << 8 | p2[j + 3] & 255; + } + for (i3 = 16; i3 < 64; i3++) { + u = w[i3 - 2]; + t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10; + u = w[i3 - 15]; + t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3; + w[i3] = (t1 + w[i3 - 7] | 0) + (t2 + w[i3 - 16] | 0) | 0; + } + for (i3 = 0; i3 < 64; i3++) { + t1 = (((e2 >>> 6 | e2 << 32 - 6) ^ (e2 >>> 11 | e2 << 32 - 11) ^ (e2 >>> 25 | e2 << 32 - 25)) + (e2 & f ^ ~e2 & g) | 0) + (h + (K2[i3] + w[i3] | 0) | 0) | 0; + t2 = ((a2 >>> 2 | a2 << 32 - 2) ^ (a2 >>> 13 | a2 << 32 - 13) ^ (a2 >>> 22 | a2 << 32 - 22)) + (a2 & b ^ a2 & c ^ b & c) | 0; + h = g; + g = f; + f = e2; + e2 = d + t1 | 0; + d = c; + c = b; + b = a2; + a2 = t1 + t2 | 0; + } + h0 = h0 + a2 | 0; + h1 = h1 + b | 0; + h2 = h2 + c | 0; + h3 = h3 + d | 0; + h4 = h4 + e2 | 0; + h5 = h5 + f | 0; + h6 = h6 + g | 0; + h7 = h7 + h | 0; + off += 64; + len -= 64; + } + } + blocks(m); + let i2, bytesLeft = m.length % 64, bitLenHi = m.length / 536870912 | 0, bitLenLo = m.length << 3, numZeros = bytesLeft < 56 ? 56 : 120, p = m.slice(m.length - bytesLeft, m.length); + p.push(128); + for (i2 = bytesLeft + 1; i2 < numZeros; i2++) { + p.push(0); + } + p.push(bitLenHi >>> 24 & 255); + p.push(bitLenHi >>> 16 & 255); + p.push(bitLenHi >>> 8 & 255); + p.push(bitLenHi >>> 0 & 255); + p.push(bitLenLo >>> 24 & 255); + p.push(bitLenLo >>> 16 & 255); + p.push(bitLenLo >>> 8 & 255); + p.push(bitLenLo >>> 0 & 255); + blocks(p); + return [ + h0 >>> 24 & 255, + h0 >>> 16 & 255, + h0 >>> 8 & 255, + h0 >>> 0 & 255, + h1 >>> 24 & 255, + h1 >>> 16 & 255, + h1 >>> 8 & 255, + h1 >>> 0 & 255, + h2 >>> 24 & 255, + h2 >>> 16 & 255, + h2 >>> 8 & 255, + h2 >>> 0 & 255, + h3 >>> 24 & 255, + h3 >>> 16 & 255, + h3 >>> 8 & 255, + h3 >>> 0 & 255, + h4 >>> 24 & 255, + h4 >>> 16 & 255, + h4 >>> 8 & 255, + h4 >>> 0 & 255, + h5 >>> 24 & 255, + h5 >>> 16 & 255, + h5 >>> 8 & 255, + h5 >>> 0 & 255, + h6 >>> 24 & 255, + h6 >>> 16 & 255, + h6 >>> 8 & 255, + h6 >>> 0 & 255, + h7 >>> 24 & 255, + h7 >>> 16 & 255, + h7 >>> 8 & 255, + h7 >>> 0 & 255 + ]; + } + function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) { + password = password.length <= 64 ? password : SHA256(password); + const innerLen = 64 + salt.length + 4; + const inner = new Array(innerLen); + const outerKey = new Array(64); + let i2; + let dk = []; + for (i2 = 0; i2 < 64; i2++) { + inner[i2] = 54; + } + for (i2 = 0; i2 < password.length; i2++) { + inner[i2] ^= password[i2]; + } + for (i2 = 0; i2 < salt.length; i2++) { + inner[64 + i2] = salt[i2]; + } + for (i2 = innerLen - 4; i2 < innerLen; i2++) { + inner[i2] = 0; + } + for (i2 = 0; i2 < 64; i2++) + outerKey[i2] = 92; + for (i2 = 0; i2 < password.length; i2++) + outerKey[i2] ^= password[i2]; + function incrementCounter() { + for (let i3 = innerLen - 1; i3 >= innerLen - 4; i3--) { + inner[i3]++; + if (inner[i3] <= 255) + return; + inner[i3] = 0; + } + } + while (dkLen >= 32) { + incrementCounter(); + dk = dk.concat(SHA256(outerKey.concat(SHA256(inner)))); + dkLen -= 32; + } + if (dkLen > 0) { + incrementCounter(); + dk = dk.concat(SHA256(outerKey.concat(SHA256(inner))).slice(0, dkLen)); + } + return dk; + } + function blockmix_salsa8(BY, Yi, r3, x, _X) { + let i2; + arraycopy(BY, (2 * r3 - 1) * 16, _X, 0, 16); + for (i2 = 0; i2 < 2 * r3; i2++) { + blockxor(BY, i2 * 16, _X, 16); + salsa20_8(_X, x); + arraycopy(_X, 0, BY, Yi + i2 * 16, 16); + } + for (i2 = 0; i2 < r3; i2++) { + arraycopy(BY, Yi + i2 * 2 * 16, BY, i2 * 16, 16); + } + for (i2 = 0; i2 < r3; i2++) { + arraycopy(BY, Yi + (i2 * 2 + 1) * 16, BY, (i2 + r3) * 16, 16); + } + } + function R2(a2, b) { + return a2 << b | a2 >>> 32 - b; + } + function salsa20_8(B, x) { + arraycopy(B, 0, x, 0, 16); + for (let i2 = 8; i2 > 0; i2 -= 2) { + x[4] ^= R2(x[0] + x[12], 7); + x[8] ^= R2(x[4] + x[0], 9); + x[12] ^= R2(x[8] + x[4], 13); + x[0] ^= R2(x[12] + x[8], 18); + x[9] ^= R2(x[5] + x[1], 7); + x[13] ^= R2(x[9] + x[5], 9); + x[1] ^= R2(x[13] + x[9], 13); + x[5] ^= R2(x[1] + x[13], 18); + x[14] ^= R2(x[10] + x[6], 7); + x[2] ^= R2(x[14] + x[10], 9); + x[6] ^= R2(x[2] + x[14], 13); + x[10] ^= R2(x[6] + x[2], 18); + x[3] ^= R2(x[15] + x[11], 7); + x[7] ^= R2(x[3] + x[15], 9); + x[11] ^= R2(x[7] + x[3], 13); + x[15] ^= R2(x[11] + x[7], 18); + x[1] ^= R2(x[0] + x[3], 7); + x[2] ^= R2(x[1] + x[0], 9); + x[3] ^= R2(x[2] + x[1], 13); + x[0] ^= R2(x[3] + x[2], 18); + x[6] ^= R2(x[5] + x[4], 7); + x[7] ^= R2(x[6] + x[5], 9); + x[4] ^= R2(x[7] + x[6], 13); + x[5] ^= R2(x[4] + x[7], 18); + x[11] ^= R2(x[10] + x[9], 7); + x[8] ^= R2(x[11] + x[10], 9); + x[9] ^= R2(x[8] + x[11], 13); + x[10] ^= R2(x[9] + x[8], 18); + x[12] ^= R2(x[15] + x[14], 7); + x[13] ^= R2(x[12] + x[15], 9); + x[14] ^= R2(x[13] + x[12], 13); + x[15] ^= R2(x[14] + x[13], 18); + } + for (let i2 = 0; i2 < 16; ++i2) { + B[i2] += x[i2]; + } + } + function blockxor(S2, Si, D3, len) { + for (let i2 = 0; i2 < len; i2++) { + D3[i2] ^= S2[Si + i2]; + } + } + function arraycopy(src, srcPos, dest, destPos, length) { + while (length--) { + dest[destPos++] = src[srcPos++]; + } + } + function checkBufferish(o2) { + if (!o2 || typeof o2.length !== "number") { + return false; + } + for (let i2 = 0; i2 < o2.length; i2++) { + const v = o2[i2]; + if (typeof v !== "number" || v % 1 || v < 0 || v >= 256) { + return false; + } + } + return true; + } + function ensureInteger(value, name) { + if (typeof value !== "number" || value % 1) { + throw new Error("invalid " + name); + } + return value; + } + function _scrypt(password, salt, N2, r3, p, dkLen, callback) { + N2 = ensureInteger(N2, "N"); + r3 = ensureInteger(r3, "r"); + p = ensureInteger(p, "p"); + dkLen = ensureInteger(dkLen, "dkLen"); + if (N2 === 0 || (N2 & N2 - 1) !== 0) { + throw new Error("N must be power of 2"); + } + if (N2 > MAX_VALUE / 128 / r3) { + throw new Error("N too large"); + } + if (r3 > MAX_VALUE / 128 / p) { + throw new Error("r too large"); + } + if (!checkBufferish(password)) { + throw new Error("password must be an array or buffer"); + } + password = Array.prototype.slice.call(password); + if (!checkBufferish(salt)) { + throw new Error("salt must be an array or buffer"); + } + salt = Array.prototype.slice.call(salt); + let b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r3); + const B = new Uint32Array(p * 32 * r3); + for (let i2 = 0; i2 < B.length; i2++) { + const j = i2 * 4; + B[i2] = (b[j + 3] & 255) << 24 | (b[j + 2] & 255) << 16 | (b[j + 1] & 255) << 8 | (b[j + 0] & 255) << 0; + } + const XY = new Uint32Array(64 * r3); + const V = new Uint32Array(32 * r3 * N2); + const Yi = 32 * r3; + const x = new Uint32Array(16); + const _X = new Uint32Array(16); + const totalOps = p * N2 * 2; + let currentOp = 0; + let lastPercent10 = null; + let stop = false; + let state = 0; + let i0 = 0, i1; + let Bi; + const limit = callback ? parseInt(1e3 / r3) : 4294967295; + const nextTick = typeof setImmediate !== "undefined" ? setImmediate : setTimeout; + const incrementalSMix = function() { + if (stop) { + return callback(new Error("cancelled"), currentOp / totalOps); + } + let steps; + switch (state) { + case 0: + Bi = i0 * 32 * r3; + arraycopy(B, Bi, XY, 0, Yi); + state = 1; + i1 = 0; + case 1: + steps = N2 - i1; + if (steps > limit) { + steps = limit; + } + for (let i2 = 0; i2 < steps; i2++) { + arraycopy(XY, 0, V, (i1 + i2) * Yi, Yi); + blockmix_salsa8(XY, Yi, r3, x, _X); + } + i1 += steps; + currentOp += steps; + if (callback) { + const percent10 = parseInt(1e3 * currentOp / totalOps); + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + if (stop) { + break; + } + lastPercent10 = percent10; + } + } + if (i1 < N2) { + break; + } + i1 = 0; + state = 2; + case 2: + steps = N2 - i1; + if (steps > limit) { + steps = limit; + } + for (let i2 = 0; i2 < steps; i2++) { + const offset = (2 * r3 - 1) * 16; + const j = XY[offset] & N2 - 1; + blockxor(V, j * Yi, XY, Yi); + blockmix_salsa8(XY, Yi, r3, x, _X); + } + i1 += steps; + currentOp += steps; + if (callback) { + const percent10 = parseInt(1e3 * currentOp / totalOps); + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + if (stop) { + break; + } + lastPercent10 = percent10; + } + } + if (i1 < N2) { + break; + } + arraycopy(XY, 0, B, Bi, Yi); + i0++; + if (i0 < p) { + state = 0; + break; + } + b = []; + for (let i2 = 0; i2 < B.length; i2++) { + b.push(B[i2] >> 0 & 255); + b.push(B[i2] >> 8 & 255); + b.push(B[i2] >> 16 & 255); + b.push(B[i2] >> 24 & 255); + } + const derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen); + if (callback) { + callback(null, 1, derivedKey); + } + return derivedKey; + } + if (callback) { + nextTick(incrementalSMix); + } + }; + if (!callback) { + while (true) { + const derivedKey = incrementalSMix(); + if (derivedKey != void 0) { + return derivedKey; + } + } + } + incrementalSMix(); + } + const lib = { + scrypt: function(password, salt, N2, r3, p, dkLen, progressCallback) { + return new Promise(function(resolve, reject) { + let lastProgress = 0; + if (progressCallback) { + progressCallback(0); + } + _scrypt(password, salt, N2, r3, p, dkLen, function(error, progress, key2) { + if (error) { + reject(error); + } else if (key2) { + if (progressCallback && lastProgress !== 1) { + progressCallback(1); + } + resolve(new Uint8Array(key2)); + } else if (progressCallback && progress !== lastProgress) { + lastProgress = progress; + return progressCallback(progress); + } + }); + }); + }, + syncScrypt: function(password, salt, N2, r3, p, dkLen) { + return new Uint8Array(_scrypt(password, salt, N2, r3, p, dkLen)); + } + }; + if (typeof exports !== "undefined") { + module2.exports = lib; + } else if (typeof define === "function" && define.amd) { + define(lib); + } else if (root) { + if (root.scrypt) { + root._scrypt = root.scrypt; + } + root.scrypt = lib; + } + })(exports); + } +}); + +// node_modules/@ethersproject/json-wallets/lib.esm/keystore.js +function hasMnemonic(value) { + return value != null && value.mnemonic && value.mnemonic.phrase; +} +function _decrypt(data, key2, ciphertext) { + const cipher = searchPath(data, "crypto/cipher"); + if (cipher === "aes-128-ctr") { + const iv2 = looseArrayify(searchPath(data, "crypto/cipherparams/iv")); + const counter = new import_aes_js2.default.Counter(iv2); + const aesCtr = new import_aes_js2.default.ModeOfOperation.ctr(key2, counter); + return arrayify(aesCtr.decrypt(ciphertext)); + } + return null; +} +function _getAccount(data, key2) { + const ciphertext = looseArrayify(searchPath(data, "crypto/ciphertext")); + const computedMAC = hexlify(keccak256(concat([key2.slice(16, 32), ciphertext]))).substring(2); + if (computedMAC !== searchPath(data, "crypto/mac").toLowerCase()) { + throw new Error("invalid password"); + } + const privateKey = _decrypt(data, key2.slice(0, 16), ciphertext); + if (!privateKey) { + logger25.throwError("unsupported cipher", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "decrypt" + }); + } + const mnemonicKey = key2.slice(32, 64); + const address = computeAddress(privateKey); + if (data.address) { + let check = data.address.toLowerCase(); + if (check.substring(0, 2) !== "0x") { + check = "0x" + check; + } + if (getAddress(check) !== address) { + throw new Error("address mismatch"); + } + } + const account = { + _isKeystoreAccount: true, + address, + privateKey: hexlify(privateKey) + }; + if (searchPath(data, "x-ethers/version") === "0.1") { + const mnemonicCiphertext = looseArrayify(searchPath(data, "x-ethers/mnemonicCiphertext")); + const mnemonicIv = looseArrayify(searchPath(data, "x-ethers/mnemonicCounter")); + const mnemonicCounter = new import_aes_js2.default.Counter(mnemonicIv); + const mnemonicAesCtr = new import_aes_js2.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + const path = searchPath(data, "x-ethers/path") || defaultPath; + const locale = searchPath(data, "x-ethers/locale") || "en"; + const entropy = arrayify(mnemonicAesCtr.decrypt(mnemonicCiphertext)); + try { + const mnemonic = entropyToMnemonic(entropy, locale); + const node = HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path); + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + account.mnemonic = node.mnemonic; + } catch (error) { + if (error.code !== Logger.errors.INVALID_ARGUMENT || error.argument !== "wordlist") { + throw error; + } + } + } + return new KeystoreAccount(account); +} +function pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc) { + return arrayify(pbkdf2(passwordBytes, salt, count, dkLen, prfFunc)); +} +function pbkdf22(passwordBytes, salt, count, dkLen, prfFunc) { + return Promise.resolve(pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc)); +} +function _computeKdfKey(data, password, pbkdf2Func, scryptFunc, progressCallback) { + const passwordBytes = getPassword(password); + const kdf = searchPath(data, "crypto/kdf"); + if (kdf && typeof kdf === "string") { + const throwError = function(name, value) { + return logger25.throwArgumentError("invalid key-derivation function parameters", name, value); + }; + if (kdf.toLowerCase() === "scrypt") { + const salt = looseArrayify(searchPath(data, "crypto/kdfparams/salt")); + const N2 = parseInt(searchPath(data, "crypto/kdfparams/n")); + const r3 = parseInt(searchPath(data, "crypto/kdfparams/r")); + const p = parseInt(searchPath(data, "crypto/kdfparams/p")); + if (!N2 || !r3 || !p) { + throwError("kdf", kdf); + } + if ((N2 & N2 - 1) !== 0) { + throwError("N", N2); + } + const dkLen = parseInt(searchPath(data, "crypto/kdfparams/dklen")); + if (dkLen !== 32) { + throwError("dklen", dkLen); + } + return scryptFunc(passwordBytes, salt, N2, r3, p, 64, progressCallback); + } else if (kdf.toLowerCase() === "pbkdf2") { + const salt = looseArrayify(searchPath(data, "crypto/kdfparams/salt")); + let prfFunc = null; + const prf = searchPath(data, "crypto/kdfparams/prf"); + if (prf === "hmac-sha256") { + prfFunc = "sha256"; + } else if (prf === "hmac-sha512") { + prfFunc = "sha512"; + } else { + throwError("prf", prf); + } + const count = parseInt(searchPath(data, "crypto/kdfparams/c")); + const dkLen = parseInt(searchPath(data, "crypto/kdfparams/dklen")); + if (dkLen !== 32) { + throwError("dklen", dkLen); + } + return pbkdf2Func(passwordBytes, salt, count, dkLen, prfFunc); + } + } + return logger25.throwArgumentError("unsupported key-derivation function", "kdf", kdf); +} +function decryptSync(json, password) { + const data = JSON.parse(json); + const key2 = _computeKdfKey(data, password, pbkdf2Sync, import_scrypt_js.default.syncScrypt); + return _getAccount(data, key2); +} +function decrypt2(json, password, progressCallback) { + return __awaiter6(this, void 0, void 0, function* () { + const data = JSON.parse(json); + const key2 = yield _computeKdfKey(data, password, pbkdf22, import_scrypt_js.default.scrypt, progressCallback); + return _getAccount(data, key2); + }); +} +function encrypt(account, password, options, progressCallback) { + try { + if (getAddress(account.address) !== computeAddress(account.privateKey)) { + throw new Error("address/privateKey mismatch"); + } + if (hasMnemonic(account)) { + const mnemonic = account.mnemonic; + const node = HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path || defaultPath); + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + } + } catch (e2) { + return Promise.reject(e2); + } + if (typeof options === "function" && !progressCallback) { + progressCallback = options; + options = {}; + } + if (!options) { + options = {}; + } + const privateKey = arrayify(account.privateKey); + const passwordBytes = getPassword(password); + let entropy = null; + let path = null; + let locale = null; + if (hasMnemonic(account)) { + const srcMnemonic = account.mnemonic; + entropy = arrayify(mnemonicToEntropy(srcMnemonic.phrase, srcMnemonic.locale || "en")); + path = srcMnemonic.path || defaultPath; + locale = srcMnemonic.locale || "en"; + } + let client = options.client; + if (!client) { + client = "ethers.js"; + } + let salt = null; + if (options.salt) { + salt = arrayify(options.salt); + } else { + salt = randomBytes(32); + ; + } + let iv2 = null; + if (options.iv) { + iv2 = arrayify(options.iv); + if (iv2.length !== 16) { + throw new Error("invalid iv"); + } + } else { + iv2 = randomBytes(16); + } + let uuidRandom = null; + if (options.uuid) { + uuidRandom = arrayify(options.uuid); + if (uuidRandom.length !== 16) { + throw new Error("invalid uuid"); + } + } else { + uuidRandom = randomBytes(16); + } + let N2 = 1 << 17, r3 = 8, p = 1; + if (options.scrypt) { + if (options.scrypt.N) { + N2 = options.scrypt.N; + } + if (options.scrypt.r) { + r3 = options.scrypt.r; + } + if (options.scrypt.p) { + p = options.scrypt.p; + } + } + return import_scrypt_js.default.scrypt(passwordBytes, salt, N2, r3, p, 64, progressCallback).then((key2) => { + key2 = arrayify(key2); + const derivedKey = key2.slice(0, 16); + const macPrefix = key2.slice(16, 32); + const mnemonicKey = key2.slice(32, 64); + const counter = new import_aes_js2.default.Counter(iv2); + const aesCtr = new import_aes_js2.default.ModeOfOperation.ctr(derivedKey, counter); + const ciphertext = arrayify(aesCtr.encrypt(privateKey)); + const mac = keccak256(concat([macPrefix, ciphertext])); + const data = { + address: account.address.substring(2).toLowerCase(), + id: uuidV4(uuidRandom), + version: 3, + crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: hexlify(iv2).substring(2) + }, + ciphertext: hexlify(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: hexlify(salt).substring(2), + n: N2, + dklen: 32, + p, + r: r3 + }, + mac: mac.substring(2) + } + }; + if (entropy) { + const mnemonicIv = randomBytes(16); + const mnemonicCounter = new import_aes_js2.default.Counter(mnemonicIv); + const mnemonicAesCtr = new import_aes_js2.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + const mnemonicCiphertext = arrayify(mnemonicAesCtr.encrypt(entropy)); + const now2 = /* @__PURE__ */ new Date(); + const timestamp = now2.getUTCFullYear() + "-" + zpad(now2.getUTCMonth() + 1, 2) + "-" + zpad(now2.getUTCDate(), 2) + "T" + zpad(now2.getUTCHours(), 2) + "-" + zpad(now2.getUTCMinutes(), 2) + "-" + zpad(now2.getUTCSeconds(), 2) + ".0Z"; + data["x-ethers"] = { + client, + gethFilename: "UTC--" + timestamp + "--" + data.address, + mnemonicCounter: hexlify(mnemonicIv).substring(2), + mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2), + path, + locale, + version: "0.1" + }; + } + return JSON.stringify(data); + }); +} +var import_aes_js2, import_scrypt_js, __awaiter6, logger25, KeystoreAccount; +var init_keystore = __esm({ + "node_modules/@ethersproject/json-wallets/lib.esm/keystore.js"() { + "use strict"; + init_shim(); + import_aes_js2 = __toESM(require_aes_js()); + import_scrypt_js = __toESM(require_scrypt()); + init_lib7(); + init_lib2(); + init_lib22(); + init_lib5(); + init_lib20(); + init_lib23(); + init_lib4(); + init_lib17(); + init_utils(); + init_lib(); + init_version18(); + __awaiter6 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + logger25 = new Logger(version20); + KeystoreAccount = class extends Description { + isKeystoreAccount(value) { + return !!(value && value._isKeystoreAccount); + } + }; + } +}); + +// node_modules/@ethersproject/json-wallets/lib.esm/index.js +var lib_exports18 = {}; +__export(lib_exports18, { + decryptCrowdsale: () => decrypt, + decryptJsonWallet: () => decryptJsonWallet, + decryptJsonWalletSync: () => decryptJsonWalletSync, + decryptKeystore: () => decrypt2, + decryptKeystoreSync: () => decryptSync, + encryptKeystore: () => encrypt, + getJsonWalletAddress: () => getJsonWalletAddress, + isCrowdsaleWallet: () => isCrowdsaleWallet, + isKeystoreWallet: () => isKeystoreWallet +}); +function decryptJsonWallet(json, password, progressCallback) { + if (isCrowdsaleWallet(json)) { + if (progressCallback) { + progressCallback(0); + } + const account = decrypt(json, password); + if (progressCallback) { + progressCallback(1); + } + return Promise.resolve(account); + } + if (isKeystoreWallet(json)) { + return decrypt2(json, password, progressCallback); + } + return Promise.reject(new Error("invalid JSON wallet")); +} +function decryptJsonWalletSync(json, password) { + if (isCrowdsaleWallet(json)) { + return decrypt(json, password); + } + if (isKeystoreWallet(json)) { + return decryptSync(json, password); + } + throw new Error("invalid JSON wallet"); +} +var init_lib24 = __esm({ + "node_modules/@ethersproject/json-wallets/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_crowdsale(); + init_inspect(); + init_keystore(); + } +}); + +// node_modules/@ethersproject/wallet/lib.esm/_version.js +var version21; +var init_version19 = __esm({ + "node_modules/@ethersproject/wallet/lib.esm/_version.js"() { + init_shim(); + version21 = "wallet/5.7.0"; + } +}); + +// node_modules/@ethersproject/wallet/lib.esm/index.js +var lib_exports19 = {}; +__export(lib_exports19, { + Wallet: () => Wallet, + verifyMessage: () => verifyMessage, + verifyTypedData: () => verifyTypedData +}); +function isAccount(value) { + return value != null && isHexString(value.privateKey, 32) && value.address != null; +} +function hasMnemonic2(value) { + const mnemonic = value.mnemonic; + return mnemonic && mnemonic.phrase; +} +function verifyMessage(message, signature2) { + return recoverAddress(hashMessage(message), signature2); +} +function verifyTypedData(domain, types, value, signature2) { + return recoverAddress(TypedDataEncoder.hash(domain, types, value), signature2); +} +var __awaiter7, logger26, Wallet; +var init_lib25 = __esm({ + "node_modules/@ethersproject/wallet/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib7(); + init_lib14(); + init_lib15(); + init_lib2(); + init_lib12(); + init_lib22(); + init_lib5(); + init_lib4(); + init_lib23(); + init_lib16(); + init_lib24(); + init_lib17(); + init_lib(); + init_version19(); + __awaiter7 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + logger26 = new Logger(version21); + Wallet = class extends Signer { + constructor(privateKey, provider) { + super(); + if (isAccount(privateKey)) { + const signingKey = new SigningKey(privateKey.privateKey); + defineReadOnly(this, "_signingKey", () => signingKey); + defineReadOnly(this, "address", computeAddress(this.publicKey)); + if (this.address !== getAddress(privateKey.address)) { + logger26.throwArgumentError("privateKey/address mismatch", "privateKey", "[REDACTED]"); + } + if (hasMnemonic2(privateKey)) { + const srcMnemonic = privateKey.mnemonic; + defineReadOnly(this, "_mnemonic", () => ({ + phrase: srcMnemonic.phrase, + path: srcMnemonic.path || defaultPath, + locale: srcMnemonic.locale || "en" + })); + const mnemonic = this.mnemonic; + const node = HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path); + if (computeAddress(node.privateKey) !== this.address) { + logger26.throwArgumentError("mnemonic/address mismatch", "privateKey", "[REDACTED]"); + } + } else { + defineReadOnly(this, "_mnemonic", () => null); + } + } else { + if (SigningKey.isSigningKey(privateKey)) { + if (privateKey.curve !== "secp256k1") { + logger26.throwArgumentError("unsupported curve; must be secp256k1", "privateKey", "[REDACTED]"); + } + defineReadOnly(this, "_signingKey", () => privateKey); + } else { + if (typeof privateKey === "string") { + if (privateKey.match(/^[0-9a-f]*$/i) && privateKey.length === 64) { + privateKey = "0x" + privateKey; + } + } + const signingKey = new SigningKey(privateKey); + defineReadOnly(this, "_signingKey", () => signingKey); + } + defineReadOnly(this, "_mnemonic", () => null); + defineReadOnly(this, "address", computeAddress(this.publicKey)); + } + if (provider && !Provider.isProvider(provider)) { + logger26.throwArgumentError("invalid provider", "provider", provider); + } + defineReadOnly(this, "provider", provider || null); + } + get mnemonic() { + return this._mnemonic(); + } + get privateKey() { + return this._signingKey().privateKey; + } + get publicKey() { + return this._signingKey().publicKey; + } + getAddress() { + return Promise.resolve(this.address); + } + connect(provider) { + return new Wallet(this, provider); + } + signTransaction(transaction) { + return resolveProperties(transaction).then((tx) => { + if (tx.from != null) { + if (getAddress(tx.from) !== this.address) { + logger26.throwArgumentError("transaction from address mismatch", "transaction.from", transaction.from); + } + delete tx.from; + } + const signature2 = this._signingKey().signDigest(keccak256(serialize(tx))); + return serialize(tx, signature2); + }); + } + signMessage(message) { + return __awaiter7(this, void 0, void 0, function* () { + return joinSignature(this._signingKey().signDigest(hashMessage(message))); + }); + } + _signTypedData(domain, types, value) { + return __awaiter7(this, void 0, void 0, function* () { + const populated = yield TypedDataEncoder.resolveNames(domain, types, value, (name) => { + if (this.provider == null) { + logger26.throwError("cannot resolve ENS names without a provider", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName", + value: name + }); + } + return this.provider.resolveName(name); + }); + return joinSignature(this._signingKey().signDigest(TypedDataEncoder.hash(populated.domain, types, populated.value))); + }); + } + encrypt(password, options, progressCallback) { + if (typeof options === "function" && !progressCallback) { + progressCallback = options; + options = {}; + } + if (progressCallback && typeof progressCallback !== "function") { + throw new Error("invalid callback"); + } + if (!options) { + options = {}; + } + return encrypt(this, password, options, progressCallback); + } + /** + * Static methods to create Wallet instances. + */ + static createRandom(options) { + let entropy = randomBytes(16); + if (!options) { + options = {}; + } + if (options.extraEntropy) { + entropy = arrayify(hexDataSlice(keccak256(concat([entropy, options.extraEntropy])), 0, 16)); + } + const mnemonic = entropyToMnemonic(entropy, options.locale); + return Wallet.fromMnemonic(mnemonic, options.path, options.locale); + } + static fromEncryptedJson(json, password, progressCallback) { + return decryptJsonWallet(json, password, progressCallback).then((account) => { + return new Wallet(account); + }); + } + static fromEncryptedJsonSync(json, password) { + return new Wallet(decryptJsonWalletSync(json, password)); + } + static fromMnemonic(mnemonic, path, wordlist2) { + if (!path) { + path = defaultPath; + } + return new Wallet(HDNode.fromMnemonic(mnemonic, null, wordlist2).derivePath(path)); + } + }; + } +}); + +// node_modules/@ethersproject/web/lib.esm/_version.js +var version23; +var init_version20 = __esm({ + "node_modules/@ethersproject/web/lib.esm/_version.js"() { + init_shim(); + version23 = "web/5.7.1"; + } +}); + +// node_modules/@ethersproject/web/lib.esm/geturl.js +function getUrl(href, options) { + return __awaiter8(this, void 0, void 0, function* () { + if (options == null) { + options = {}; + } + const request = { + method: options.method || "GET", + headers: options.headers || {}, + body: options.body || void 0 + }; + if (options.skipFetchSetup !== true) { + request.mode = "cors"; + request.cache = "no-cache"; + request.credentials = "same-origin"; + request.redirect = "follow"; + request.referrer = "client"; + } + ; + if (options.fetchOptions != null) { + const opts = options.fetchOptions; + if (opts.mode) { + request.mode = opts.mode; + } + if (opts.cache) { + request.cache = opts.cache; + } + if (opts.credentials) { + request.credentials = opts.credentials; + } + if (opts.redirect) { + request.redirect = opts.redirect; + } + if (opts.referrer) { + request.referrer = opts.referrer; + } + } + const response = yield fetch(href, request); + const body = yield response.arrayBuffer(); + const headers = {}; + if (response.headers.forEach) { + response.headers.forEach((value, key2) => { + headers[key2.toLowerCase()] = value; + }); + } else { + response.headers.keys().forEach((key2) => { + headers[key2.toLowerCase()] = response.headers.get(key2); + }); + } + return { + headers, + statusCode: response.status, + statusMessage: response.statusText, + body: arrayify(new Uint8Array(body)) + }; + }); +} +var __awaiter8; +var init_geturl = __esm({ + "node_modules/@ethersproject/web/lib.esm/geturl.js"() { + "use strict"; + init_shim(); + init_lib2(); + __awaiter8 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + } +}); + +// node_modules/@ethersproject/web/lib.esm/index.js +var lib_exports20 = {}; +__export(lib_exports20, { + _fetchData: () => _fetchData, + fetchJson: () => fetchJson, + poll: () => poll +}); +function staller(duration) { + return new Promise((resolve) => { + setTimeout(resolve, duration); + }); +} +function bodyify(value, type) { + if (value == null) { + return null; + } + if (typeof value === "string") { + return value; + } + if (isBytesLike(value)) { + if (type && (type.split("/")[0] === "text" || type.split(";")[0].trim() === "application/json")) { + try { + return toUtf8String(value); + } catch (error) { + } + ; + } + return hexlify(value); + } + return value; +} +function unpercent(value) { + return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code9) => { + return String.fromCharCode(parseInt(code9, 16)); + })); +} +function _fetchData(connection, body, processFunc) { + const attemptLimit = typeof connection === "object" && connection.throttleLimit != null ? connection.throttleLimit : 12; + logger28.assertArgument(attemptLimit > 0 && attemptLimit % 1 === 0, "invalid connection throttle limit", "connection.throttleLimit", attemptLimit); + const throttleCallback = typeof connection === "object" ? connection.throttleCallback : null; + const throttleSlotInterval = typeof connection === "object" && typeof connection.throttleSlotInterval === "number" ? connection.throttleSlotInterval : 100; + logger28.assertArgument(throttleSlotInterval > 0 && throttleSlotInterval % 1 === 0, "invalid connection throttle slot interval", "connection.throttleSlotInterval", throttleSlotInterval); + const errorPassThrough = typeof connection === "object" ? !!connection.errorPassThrough : false; + const headers = {}; + let url = null; + const options = { + method: "GET" + }; + let allow304 = false; + let timeout = 2 * 60 * 1e3; + if (typeof connection === "string") { + url = connection; + } else if (typeof connection === "object") { + if (connection == null || connection.url == null) { + logger28.throwArgumentError("missing URL", "connection.url", connection); + } + url = connection.url; + if (typeof connection.timeout === "number" && connection.timeout > 0) { + timeout = connection.timeout; + } + if (connection.headers) { + for (const key2 in connection.headers) { + headers[key2.toLowerCase()] = { key: key2, value: String(connection.headers[key2]) }; + if (["if-none-match", "if-modified-since"].indexOf(key2.toLowerCase()) >= 0) { + allow304 = true; + } + } + } + options.allowGzip = !!connection.allowGzip; + if (connection.user != null && connection.password != null) { + if (url.substring(0, 6) !== "https:" && connection.allowInsecureAuthentication !== true) { + logger28.throwError("basic authentication requires a secure https url", Logger.errors.INVALID_ARGUMENT, { argument: "url", url, user: connection.user, password: "[REDACTED]" }); + } + const authorization = connection.user + ":" + connection.password; + headers["authorization"] = { + key: "Authorization", + value: "Basic " + encode2(toUtf8Bytes(authorization)) + }; + } + if (connection.skipFetchSetup != null) { + options.skipFetchSetup = !!connection.skipFetchSetup; + } + if (connection.fetchOptions != null) { + options.fetchOptions = shallowCopy(connection.fetchOptions); + } + } + const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); + const dataMatch = url ? url.match(reData) : null; + if (dataMatch) { + try { + const response = { + statusCode: 200, + statusMessage: "OK", + headers: { "content-type": dataMatch[1] || "text/plain" }, + body: dataMatch[2] ? decode2(dataMatch[3]) : unpercent(dataMatch[3]) + }; + let result = response.body; + if (processFunc) { + result = processFunc(response.body, response); + } + return Promise.resolve(result); + } catch (error) { + logger28.throwError("processing response error", Logger.errors.SERVER_ERROR, { + body: bodyify(dataMatch[1], dataMatch[2]), + error, + requestBody: null, + requestMethod: "GET", + url + }); + } + } + if (body) { + options.method = "POST"; + options.body = body; + if (headers["content-type"] == null) { + headers["content-type"] = { key: "Content-Type", value: "application/octet-stream" }; + } + if (headers["content-length"] == null) { + headers["content-length"] = { key: "Content-Length", value: String(body.length) }; + } + } + const flatHeaders = {}; + Object.keys(headers).forEach((key2) => { + const header = headers[key2]; + flatHeaders[header.key] = header.value; + }); + options.headers = flatHeaders; + const runningTimeout = function() { + let timer2 = null; + const promise = new Promise(function(resolve, reject) { + if (timeout) { + timer2 = setTimeout(() => { + if (timer2 == null) { + return; + } + timer2 = null; + reject(logger28.makeError("timeout", Logger.errors.TIMEOUT, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + timeout, + url + })); + }, timeout); + } + }); + const cancel = function() { + if (timer2 == null) { + return; + } + clearTimeout(timer2); + timer2 = null; + }; + return { promise, cancel }; + }(); + const runningFetch = function() { + return __awaiter9(this, void 0, void 0, function* () { + for (let attempt = 0; attempt < attemptLimit; attempt++) { + let response = null; + try { + response = yield getUrl(url, options); + if (attempt < attemptLimit) { + if (response.statusCode === 301 || response.statusCode === 302) { + const location = response.headers.location || ""; + if (options.method === "GET" && location.match(/^https:/)) { + url = response.headers.location; + continue; + } + } else if (response.statusCode === 429) { + let tryAgain = true; + if (throttleCallback) { + tryAgain = yield throttleCallback(attempt, url); + } + if (tryAgain) { + let stall3 = 0; + const retryAfter = response.headers["retry-after"]; + if (typeof retryAfter === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + stall3 = parseInt(retryAfter) * 1e3; + } else { + stall3 = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + } + yield staller(stall3); + continue; + } + } + } + } catch (error) { + response = error.response; + if (response == null) { + runningTimeout.cancel(); + logger28.throwError("missing response", Logger.errors.SERVER_ERROR, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + serverError: error, + url + }); + } + } + let body2 = response.body; + if (allow304 && response.statusCode === 304) { + body2 = null; + } else if (!errorPassThrough && (response.statusCode < 200 || response.statusCode >= 300)) { + runningTimeout.cancel(); + logger28.throwError("bad response", Logger.errors.SERVER_ERROR, { + status: response.statusCode, + headers: response.headers, + body: bodyify(body2, response.headers ? response.headers["content-type"] : null), + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + }); + } + if (processFunc) { + try { + const result = yield processFunc(body2, response); + runningTimeout.cancel(); + return result; + } catch (error) { + if (error.throttleRetry && attempt < attemptLimit) { + let tryAgain = true; + if (throttleCallback) { + tryAgain = yield throttleCallback(attempt, url); + } + if (tryAgain) { + const timeout2 = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + yield staller(timeout2); + continue; + } + } + runningTimeout.cancel(); + logger28.throwError("processing response error", Logger.errors.SERVER_ERROR, { + body: bodyify(body2, response.headers ? response.headers["content-type"] : null), + error, + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + }); + } + } + runningTimeout.cancel(); + return body2; + } + return logger28.throwError("failed response", Logger.errors.SERVER_ERROR, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + }); + }); + }(); + return Promise.race([runningTimeout.promise, runningFetch]); +} +function fetchJson(connection, json, processFunc) { + let processJsonFunc = (value, response) => { + let result = null; + if (value != null) { + try { + result = JSON.parse(toUtf8String(value)); + } catch (error) { + logger28.throwError("invalid JSON", Logger.errors.SERVER_ERROR, { + body: value, + error + }); + } + } + if (processFunc) { + result = processFunc(result, response); + } + return result; + }; + let body = null; + if (json != null) { + body = toUtf8Bytes(json); + const updated = typeof connection === "string" ? { url: connection } : shallowCopy(connection); + if (updated.headers) { + const hasContentType = Object.keys(updated.headers).filter((k) => k.toLowerCase() === "content-type").length !== 0; + if (!hasContentType) { + updated.headers = shallowCopy(updated.headers); + updated.headers["content-type"] = "application/json"; + } + } else { + updated.headers = { "content-type": "application/json" }; + } + connection = updated; + } + return _fetchData(connection, body, processJsonFunc); +} +function poll(func, options) { + if (!options) { + options = {}; + } + options = shallowCopy(options); + if (options.floor == null) { + options.floor = 0; + } + if (options.ceiling == null) { + options.ceiling = 1e4; + } + if (options.interval == null) { + options.interval = 250; + } + return new Promise(function(resolve, reject) { + let timer2 = null; + let done = false; + const cancel = () => { + if (done) { + return false; + } + done = true; + if (timer2) { + clearTimeout(timer2); + } + return true; + }; + if (options.timeout) { + timer2 = setTimeout(() => { + if (cancel()) { + reject(new Error("timeout")); + } + }, options.timeout); + } + const retryLimit = options.retryLimit; + let attempt = 0; + function check() { + return func().then(function(result) { + if (result !== void 0) { + if (cancel()) { + resolve(result); + } + } else if (options.oncePoll) { + options.oncePoll.once("poll", check); + } else if (options.onceBlock) { + options.onceBlock.once("block", check); + } else if (!done) { + attempt++; + if (attempt > retryLimit) { + if (cancel()) { + reject(new Error("retry limit reached")); + } + return; + } + let timeout = options.interval * parseInt(String(Math.random() * Math.pow(2, attempt))); + if (timeout < options.floor) { + timeout = options.floor; + } + if (timeout > options.ceiling) { + timeout = options.ceiling; + } + setTimeout(check, timeout); + } + return null; + }, function(error) { + if (cancel()) { + reject(error); + } + }); + } + check(); + }); +} +var __awaiter9, logger28; +var init_lib26 = __esm({ + "node_modules/@ethersproject/web/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib10(); + init_lib2(); + init_lib4(); + init_lib9(); + init_lib(); + init_version20(); + init_geturl(); + __awaiter9 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + logger28 = new Logger(version23); + } +}); + +// node_modules/@ethersproject/solidity/lib.esm/_version.js +var version25; +var init_version21 = __esm({ + "node_modules/@ethersproject/solidity/lib.esm/_version.js"() { + init_shim(); + version25 = "solidity/5.7.0"; + } +}); + +// node_modules/@ethersproject/solidity/lib.esm/index.js +var lib_exports22 = {}; +__export(lib_exports22, { + keccak256: () => keccak2562, + pack: () => pack2, + sha256: () => sha2562 +}); +function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return zeroPad(value, 32); + } + return arrayify(value); + case "string": + return toUtf8Bytes(value); + case "bytes": + return arrayify(value); + case "bool": + value = value ? "0x01" : "0x00"; + if (isArray) { + return zeroPad(value, 32); + } + return arrayify(value); + } + let match = type.match(regexNumber); + if (match) { + let size = parseInt(match[2] || "256"); + if (match[2] && String(size) !== match[2] || size % 8 !== 0 || size === 0 || size > 256) { + logger44.throwArgumentError("invalid number type", "type", type); + } + if (isArray) { + size = 256; + } + value = BigNumber.from(value).toTwos(size); + return zeroPad(value, size / 8); + } + match = type.match(regexBytes); + if (match) { + const size = parseInt(match[1]); + if (String(size) !== match[1] || size === 0 || size > 32) { + logger44.throwArgumentError("invalid bytes type", "type", type); + } + if (arrayify(value).byteLength !== size) { + logger44.throwArgumentError(`invalid value for ${type}`, "value", value); + } + if (isArray) { + return arrayify((value + Zeros2).substring(0, 66)); + } + return value; + } + match = type.match(regexArray); + if (match && Array.isArray(value)) { + const baseType = match[1]; + const count = parseInt(match[2] || String(value.length)); + if (count != value.length) { + logger44.throwArgumentError(`invalid array length for ${type}`, "value", value); + } + const result = []; + value.forEach(function(value2) { + result.push(_pack(baseType, value2, true)); + }); + return concat(result); + } + return logger44.throwArgumentError("invalid type", "type", type); +} +function pack2(types, values) { + if (types.length != values.length) { + logger44.throwArgumentError("wrong number of values; expected ${ types.length }", "values", values); + } + const tight = []; + types.forEach(function(type, index) { + tight.push(_pack(type, values[index])); + }); + return hexlify(concat(tight)); +} +function keccak2562(types, values) { + return keccak256(pack2(types, values)); +} +function sha2562(types, values) { + return sha256(pack2(types, values)); +} +var regexBytes, regexNumber, regexArray, Zeros2, logger44; +var init_lib27 = __esm({ + "node_modules/@ethersproject/solidity/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib3(); + init_lib2(); + init_lib5(); + init_lib19(); + init_lib9(); + init_lib(); + init_version21(); + regexBytes = new RegExp("^bytes([0-9]+)$"); + regexNumber = new RegExp("^(u?int)([0-9]*)$"); + regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); + Zeros2 = "0000000000000000000000000000000000000000000000000000000000000000"; + logger44 = new Logger(version25); + } +}); + +// node_modules/@ethersproject/units/lib.esm/_version.js +var version26; +var init_version22 = __esm({ + "node_modules/@ethersproject/units/lib.esm/_version.js"() { + init_shim(); + version26 = "units/5.7.0"; + } +}); + +// node_modules/@ethersproject/units/lib.esm/index.js +var lib_exports23 = {}; +__export(lib_exports23, { + commify: () => commify, + formatEther: () => formatEther, + formatUnits: () => formatUnits, + parseEther: () => parseEther, + parseUnits: () => parseUnits +}); +function commify(value) { + const comps = String(value).split("."); + if (comps.length > 2 || !comps[0].match(/^-?[0-9]*$/) || comps[1] && !comps[1].match(/^[0-9]*$/) || value === "." || value === "-.") { + logger45.throwArgumentError("invalid value", "value", value); + } + let whole = comps[0]; + let negative = ""; + if (whole.substring(0, 1) === "-") { + negative = "-"; + whole = whole.substring(1); + } + while (whole.substring(0, 1) === "0") { + whole = whole.substring(1); + } + if (whole === "") { + whole = "0"; + } + let suffix = ""; + if (comps.length === 2) { + suffix = "." + (comps[1] || "0"); + } + while (suffix.length > 2 && suffix[suffix.length - 1] === "0") { + suffix = suffix.substring(0, suffix.length - 1); + } + const formatted = []; + while (whole.length) { + if (whole.length <= 3) { + formatted.unshift(whole); + break; + } else { + const index = whole.length - 3; + formatted.unshift(whole.substring(index)); + whole = whole.substring(0, index); + } + } + return negative + formatted.join(",") + suffix; +} +function formatUnits(value, unitName) { + if (typeof unitName === "string") { + const index = names.indexOf(unitName); + if (index !== -1) { + unitName = 3 * index; + } + } + return formatFixed(value, unitName != null ? unitName : 18); +} +function parseUnits(value, unitName) { + if (typeof value !== "string") { + logger45.throwArgumentError("value must be a string", "value", value); + } + if (typeof unitName === "string") { + const index = names.indexOf(unitName); + if (index !== -1) { + unitName = 3 * index; + } + } + return parseFixed(value, unitName != null ? unitName : 18); +} +function formatEther(wei) { + return formatUnits(wei, 18); +} +function parseEther(ether) { + return parseUnits(ether, 18); +} +var logger45, names; +var init_lib28 = __esm({ + "node_modules/@ethersproject/units/lib.esm/index.js"() { + "use strict"; + init_shim(); + init_lib3(); + init_lib(); + init_version22(); + logger45 = new Logger(version26); + names = [ + "wei", + "kwei", + "mwei", + "gwei", + "szabo", + "finney", + "ether" + ]; + } +}); + +// node_modules/ethers/lib/utils.js +var require_utils2 = __commonJS({ + "node_modules/ethers/lib/utils.js"(exports) { + "use strict"; + init_shim(); + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o2, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o2, m, k, k2) { + if (k2 === void 0) + k2 = k; + o2[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o2, v) { + Object.defineProperty(o2, "default", { enumerable: true, value: v }); + } : function(o2, v) { + o2["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.formatBytes32String = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports._toEscapedUtf8String = exports.nameprep = exports.hexDataSlice = exports.hexDataLength = exports.hexZeroPad = exports.hexValue = exports.hexStripZeros = exports.hexConcat = exports.isHexString = exports.hexlify = exports.base64 = exports.base58 = exports.TransactionDescription = exports.LogDescription = exports.Interface = exports.SigningKey = exports.HDNode = exports.defaultPath = exports.isBytesLike = exports.isBytes = exports.zeroPad = exports.stripZeros = exports.concat = exports.arrayify = exports.shallowCopy = exports.resolveProperties = exports.getStatic = exports.defineReadOnly = exports.deepCopy = exports.checkProperties = exports.poll = exports.fetchJson = exports._fetchData = exports.RLP = exports.Logger = exports.checkResultErrors = exports.FormatTypes = exports.ParamType = exports.FunctionFragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.Fragment = exports.defaultAbiCoder = exports.AbiCoder = void 0; + exports.Indexed = exports.Utf8ErrorReason = exports.UnicodeNormalizationForm = exports.SupportedAlgorithm = exports.mnemonicToSeed = exports.isValidMnemonic = exports.entropyToMnemonic = exports.mnemonicToEntropy = exports.getAccountPath = exports.verifyTypedData = exports.verifyMessage = exports.recoverPublicKey = exports.computePublicKey = exports.recoverAddress = exports.computeAddress = exports.getJsonWalletAddress = exports.TransactionTypes = exports.serializeTransaction = exports.parseTransaction = exports.accessListify = exports.joinSignature = exports.splitSignature = exports.soliditySha256 = exports.solidityKeccak256 = exports.solidityPack = exports.shuffled = exports.randomBytes = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.computeHmac = exports.commify = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.isAddress = exports.getCreate2Address = exports.getContractAddress = exports.getIcapAddress = exports.getAddress = exports._TypedDataEncoder = exports.id = exports.isValidName = exports.namehash = exports.hashMessage = exports.dnsEncode = exports.parseBytes32String = void 0; + var abi_1 = (init_lib13(), __toCommonJS(lib_exports11)); + Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function() { + return abi_1.AbiCoder; + } }); + Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: function() { + return abi_1.checkResultErrors; + } }); + Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function() { + return abi_1.ConstructorFragment; + } }); + Object.defineProperty(exports, "defaultAbiCoder", { enumerable: true, get: function() { + return abi_1.defaultAbiCoder; + } }); + Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function() { + return abi_1.ErrorFragment; + } }); + Object.defineProperty(exports, "EventFragment", { enumerable: true, get: function() { + return abi_1.EventFragment; + } }); + Object.defineProperty(exports, "FormatTypes", { enumerable: true, get: function() { + return abi_1.FormatTypes; + } }); + Object.defineProperty(exports, "Fragment", { enumerable: true, get: function() { + return abi_1.Fragment; + } }); + Object.defineProperty(exports, "FunctionFragment", { enumerable: true, get: function() { + return abi_1.FunctionFragment; + } }); + Object.defineProperty(exports, "Indexed", { enumerable: true, get: function() { + return abi_1.Indexed; + } }); + Object.defineProperty(exports, "Interface", { enumerable: true, get: function() { + return abi_1.Interface; + } }); + Object.defineProperty(exports, "LogDescription", { enumerable: true, get: function() { + return abi_1.LogDescription; + } }); + Object.defineProperty(exports, "ParamType", { enumerable: true, get: function() { + return abi_1.ParamType; + } }); + Object.defineProperty(exports, "TransactionDescription", { enumerable: true, get: function() { + return abi_1.TransactionDescription; + } }); + var address_1 = (init_lib7(), __toCommonJS(lib_exports6)); + Object.defineProperty(exports, "getAddress", { enumerable: true, get: function() { + return address_1.getAddress; + } }); + Object.defineProperty(exports, "getCreate2Address", { enumerable: true, get: function() { + return address_1.getCreate2Address; + } }); + Object.defineProperty(exports, "getContractAddress", { enumerable: true, get: function() { + return address_1.getContractAddress; + } }); + Object.defineProperty(exports, "getIcapAddress", { enumerable: true, get: function() { + return address_1.getIcapAddress; + } }); + Object.defineProperty(exports, "isAddress", { enumerable: true, get: function() { + return address_1.isAddress; + } }); + var base64 = __importStar((init_lib10(), __toCommonJS(lib_exports9))); + exports.base64 = base64; + var basex_1 = (init_lib18(), __toCommonJS(lib_exports14)); + Object.defineProperty(exports, "base58", { enumerable: true, get: function() { + return basex_1.Base58; + } }); + var bytes_1 = (init_lib2(), __toCommonJS(lib_exports2)); + Object.defineProperty(exports, "arrayify", { enumerable: true, get: function() { + return bytes_1.arrayify; + } }); + Object.defineProperty(exports, "concat", { enumerable: true, get: function() { + return bytes_1.concat; + } }); + Object.defineProperty(exports, "hexConcat", { enumerable: true, get: function() { + return bytes_1.hexConcat; + } }); + Object.defineProperty(exports, "hexDataSlice", { enumerable: true, get: function() { + return bytes_1.hexDataSlice; + } }); + Object.defineProperty(exports, "hexDataLength", { enumerable: true, get: function() { + return bytes_1.hexDataLength; + } }); + Object.defineProperty(exports, "hexlify", { enumerable: true, get: function() { + return bytes_1.hexlify; + } }); + Object.defineProperty(exports, "hexStripZeros", { enumerable: true, get: function() { + return bytes_1.hexStripZeros; + } }); + Object.defineProperty(exports, "hexValue", { enumerable: true, get: function() { + return bytes_1.hexValue; + } }); + Object.defineProperty(exports, "hexZeroPad", { enumerable: true, get: function() { + return bytes_1.hexZeroPad; + } }); + Object.defineProperty(exports, "isBytes", { enumerable: true, get: function() { + return bytes_1.isBytes; + } }); + Object.defineProperty(exports, "isBytesLike", { enumerable: true, get: function() { + return bytes_1.isBytesLike; + } }); + Object.defineProperty(exports, "isHexString", { enumerable: true, get: function() { + return bytes_1.isHexString; + } }); + Object.defineProperty(exports, "joinSignature", { enumerable: true, get: function() { + return bytes_1.joinSignature; + } }); + Object.defineProperty(exports, "zeroPad", { enumerable: true, get: function() { + return bytes_1.zeroPad; + } }); + Object.defineProperty(exports, "splitSignature", { enumerable: true, get: function() { + return bytes_1.splitSignature; + } }); + Object.defineProperty(exports, "stripZeros", { enumerable: true, get: function() { + return bytes_1.stripZeros; + } }); + var hash_1 = (init_lib12(), __toCommonJS(lib_exports10)); + Object.defineProperty(exports, "_TypedDataEncoder", { enumerable: true, get: function() { + return hash_1._TypedDataEncoder; + } }); + Object.defineProperty(exports, "dnsEncode", { enumerable: true, get: function() { + return hash_1.dnsEncode; + } }); + Object.defineProperty(exports, "hashMessage", { enumerable: true, get: function() { + return hash_1.hashMessage; + } }); + Object.defineProperty(exports, "id", { enumerable: true, get: function() { + return hash_1.id; + } }); + Object.defineProperty(exports, "isValidName", { enumerable: true, get: function() { + return hash_1.isValidName; + } }); + Object.defineProperty(exports, "namehash", { enumerable: true, get: function() { + return hash_1.namehash; + } }); + var hdnode_1 = (init_lib22(), __toCommonJS(lib_exports16)); + Object.defineProperty(exports, "defaultPath", { enumerable: true, get: function() { + return hdnode_1.defaultPath; + } }); + Object.defineProperty(exports, "entropyToMnemonic", { enumerable: true, get: function() { + return hdnode_1.entropyToMnemonic; + } }); + Object.defineProperty(exports, "getAccountPath", { enumerable: true, get: function() { + return hdnode_1.getAccountPath; + } }); + Object.defineProperty(exports, "HDNode", { enumerable: true, get: function() { + return hdnode_1.HDNode; + } }); + Object.defineProperty(exports, "isValidMnemonic", { enumerable: true, get: function() { + return hdnode_1.isValidMnemonic; + } }); + Object.defineProperty(exports, "mnemonicToEntropy", { enumerable: true, get: function() { + return hdnode_1.mnemonicToEntropy; + } }); + Object.defineProperty(exports, "mnemonicToSeed", { enumerable: true, get: function() { + return hdnode_1.mnemonicToSeed; + } }); + var json_wallets_1 = (init_lib24(), __toCommonJS(lib_exports18)); + Object.defineProperty(exports, "getJsonWalletAddress", { enumerable: true, get: function() { + return json_wallets_1.getJsonWalletAddress; + } }); + var keccak256_1 = (init_lib5(), __toCommonJS(lib_exports4)); + Object.defineProperty(exports, "keccak256", { enumerable: true, get: function() { + return keccak256_1.keccak256; + } }); + var logger_1 = (init_lib(), __toCommonJS(lib_exports)); + Object.defineProperty(exports, "Logger", { enumerable: true, get: function() { + return logger_1.Logger; + } }); + var sha2_1 = (init_lib19(), __toCommonJS(lib_exports15)); + Object.defineProperty(exports, "computeHmac", { enumerable: true, get: function() { + return sha2_1.computeHmac; + } }); + Object.defineProperty(exports, "ripemd160", { enumerable: true, get: function() { + return sha2_1.ripemd160; + } }); + Object.defineProperty(exports, "sha256", { enumerable: true, get: function() { + return sha2_1.sha256; + } }); + Object.defineProperty(exports, "sha512", { enumerable: true, get: function() { + return sha2_1.sha512; + } }); + var solidity_1 = (init_lib27(), __toCommonJS(lib_exports22)); + Object.defineProperty(exports, "solidityKeccak256", { enumerable: true, get: function() { + return solidity_1.keccak256; + } }); + Object.defineProperty(exports, "solidityPack", { enumerable: true, get: function() { + return solidity_1.pack; + } }); + Object.defineProperty(exports, "soliditySha256", { enumerable: true, get: function() { + return solidity_1.sha256; + } }); + var random_1 = (init_lib23(), __toCommonJS(lib_exports17)); + Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function() { + return random_1.randomBytes; + } }); + Object.defineProperty(exports, "shuffled", { enumerable: true, get: function() { + return random_1.shuffled; + } }); + var properties_1 = (init_lib4(), __toCommonJS(lib_exports3)); + Object.defineProperty(exports, "checkProperties", { enumerable: true, get: function() { + return properties_1.checkProperties; + } }); + Object.defineProperty(exports, "deepCopy", { enumerable: true, get: function() { + return properties_1.deepCopy; + } }); + Object.defineProperty(exports, "defineReadOnly", { enumerable: true, get: function() { + return properties_1.defineReadOnly; + } }); + Object.defineProperty(exports, "getStatic", { enumerable: true, get: function() { + return properties_1.getStatic; + } }); + Object.defineProperty(exports, "resolveProperties", { enumerable: true, get: function() { + return properties_1.resolveProperties; + } }); + Object.defineProperty(exports, "shallowCopy", { enumerable: true, get: function() { + return properties_1.shallowCopy; + } }); + var RLP = __importStar((init_lib6(), __toCommonJS(lib_exports5))); + exports.RLP = RLP; + var signing_key_1 = (init_lib16(), __toCommonJS(lib_exports12)); + Object.defineProperty(exports, "computePublicKey", { enumerable: true, get: function() { + return signing_key_1.computePublicKey; + } }); + Object.defineProperty(exports, "recoverPublicKey", { enumerable: true, get: function() { + return signing_key_1.recoverPublicKey; + } }); + Object.defineProperty(exports, "SigningKey", { enumerable: true, get: function() { + return signing_key_1.SigningKey; + } }); + var strings_1 = (init_lib9(), __toCommonJS(lib_exports8)); + Object.defineProperty(exports, "formatBytes32String", { enumerable: true, get: function() { + return strings_1.formatBytes32String; + } }); + Object.defineProperty(exports, "nameprep", { enumerable: true, get: function() { + return strings_1.nameprep; + } }); + Object.defineProperty(exports, "parseBytes32String", { enumerable: true, get: function() { + return strings_1.parseBytes32String; + } }); + Object.defineProperty(exports, "_toEscapedUtf8String", { enumerable: true, get: function() { + return strings_1._toEscapedUtf8String; + } }); + Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function() { + return strings_1.toUtf8Bytes; + } }); + Object.defineProperty(exports, "toUtf8CodePoints", { enumerable: true, get: function() { + return strings_1.toUtf8CodePoints; + } }); + Object.defineProperty(exports, "toUtf8String", { enumerable: true, get: function() { + return strings_1.toUtf8String; + } }); + Object.defineProperty(exports, "Utf8ErrorFuncs", { enumerable: true, get: function() { + return strings_1.Utf8ErrorFuncs; + } }); + var transactions_1 = (init_lib17(), __toCommonJS(lib_exports13)); + Object.defineProperty(exports, "accessListify", { enumerable: true, get: function() { + return transactions_1.accessListify; + } }); + Object.defineProperty(exports, "computeAddress", { enumerable: true, get: function() { + return transactions_1.computeAddress; + } }); + Object.defineProperty(exports, "parseTransaction", { enumerable: true, get: function() { + return transactions_1.parse; + } }); + Object.defineProperty(exports, "recoverAddress", { enumerable: true, get: function() { + return transactions_1.recoverAddress; + } }); + Object.defineProperty(exports, "serializeTransaction", { enumerable: true, get: function() { + return transactions_1.serialize; + } }); + Object.defineProperty(exports, "TransactionTypes", { enumerable: true, get: function() { + return transactions_1.TransactionTypes; + } }); + var units_1 = (init_lib28(), __toCommonJS(lib_exports23)); + Object.defineProperty(exports, "commify", { enumerable: true, get: function() { + return units_1.commify; + } }); + Object.defineProperty(exports, "formatEther", { enumerable: true, get: function() { + return units_1.formatEther; + } }); + Object.defineProperty(exports, "parseEther", { enumerable: true, get: function() { + return units_1.parseEther; + } }); + Object.defineProperty(exports, "formatUnits", { enumerable: true, get: function() { + return units_1.formatUnits; + } }); + Object.defineProperty(exports, "parseUnits", { enumerable: true, get: function() { + return units_1.parseUnits; + } }); + var wallet_1 = (init_lib25(), __toCommonJS(lib_exports19)); + Object.defineProperty(exports, "verifyMessage", { enumerable: true, get: function() { + return wallet_1.verifyMessage; + } }); + Object.defineProperty(exports, "verifyTypedData", { enumerable: true, get: function() { + return wallet_1.verifyTypedData; + } }); + var web_1 = (init_lib26(), __toCommonJS(lib_exports20)); + Object.defineProperty(exports, "_fetchData", { enumerable: true, get: function() { + return web_1._fetchData; + } }); + Object.defineProperty(exports, "fetchJson", { enumerable: true, get: function() { + return web_1.fetchJson; + } }); + Object.defineProperty(exports, "poll", { enumerable: true, get: function() { + return web_1.poll; + } }); + var sha2_2 = (init_lib19(), __toCommonJS(lib_exports15)); + Object.defineProperty(exports, "SupportedAlgorithm", { enumerable: true, get: function() { + return sha2_2.SupportedAlgorithm; + } }); + var strings_2 = (init_lib9(), __toCommonJS(lib_exports8)); + Object.defineProperty(exports, "UnicodeNormalizationForm", { enumerable: true, get: function() { + return strings_2.UnicodeNormalizationForm; + } }); + Object.defineProperty(exports, "Utf8ErrorReason", { enumerable: true, get: function() { + return strings_2.Utf8ErrorReason; + } }); + } +}); + +// node_modules/@lit-protocol/accs-schemas/esm/schemas/LPACC_ATOM.json +var require_LPACC_ATOM = __commonJS({ + "node_modules/@lit-protocol/accs-schemas/esm/schemas/LPACC_ATOM.json"(exports, module2) { + module2.exports = { + $id: "https://github.com/LIT-Protocol/accs-schemas/blob/main/src/generated/LPACC_EVM_ATOM.ts", + title: "LPACC_EVM_ATOM", + description: "", + type: "object", + properties: { + conditionType: { + type: "string" + }, + path: { + type: "string" + }, + chain: { + enum: ["cosmos", "kyve", "evmosCosmos", "evmosCosmosTestnet", "cheqdMainnet", "cheqdTestnet", "juno"] + }, + method: { + type: "string" + }, + parameters: { + type: "array", + items: { + type: "string" + } + }, + returnValueTest: { + type: "object", + properties: { + key: { + type: "string" + }, + comparator: { + enum: ["contains", "=", ">", ">=", "<", "<="] + }, + value: { + type: "string" + } + }, + required: ["key", "comparator", "value"], + additionalProperties: false + } + }, + required: ["path", "chain", "returnValueTest"], + additionalProperties: false + }; + } +}); + +// node_modules/@lit-protocol/accs-schemas/esm/schemas/LPACC_EVM_BASIC.json +var require_LPACC_EVM_BASIC = __commonJS({ + "node_modules/@lit-protocol/accs-schemas/esm/schemas/LPACC_EVM_BASIC.json"(exports, module2) { + module2.exports = { + $id: "https://github.com/LIT-Protocol/accs-schemas/blob/main/src/generated/LPACC_EVM_BASIC.json", + title: "LPACC_EVM_BASIC", + description: "", + type: "object", + properties: { + conditionType: { + type: "string" + }, + contractAddress: { + type: "string" + }, + chain: { + enum: [ + "ethereum", + "polygon", + "fantom", + "xdai", + "bsc", + "arbitrum", + "arbitrumSepolia", + "avalanche", + "fuji", + "harmony", + "mumbai", + "goerli", + "cronos", + "optimism", + "celo", + "aurora", + "eluvio", + "alfajores", + "xdc", + "evmos", + "evmosTestnet", + "bscTestnet", + "baseGoerli", + "baseSepolia", + "moonbeam", + "moonriver", + "moonbaseAlpha", + "filecoin", + "hyperspace", + "sepolia", + "scrollAlphaTestnet", + "scroll", + "zksync", + "base", + "lukso", + "luksoTestnet", + "zora", + "zoraGoerli", + "zksyncTestnet", + "lineaGoerli", + "lineaSepolia", + "chronicleTestnet", + "yellowstone", + "lit", + "chiado", + "zkEvm", + "mantleTestnet", + "mantle", + "klaytn", + "publicGoodsNetwork", + "optimismGoerli", + "waevEclipseTestnet", + "waevEclipseDevnet", + "verifyTestnet", + "fuse", + "campNetwork", + "vanar", + "lisk", + "chilizMainnet", + "chilizTestnet", + "skaleTestnet", + "skale", + "skaleCalypso", + "fhenixHelium", + "hederaTestnet", + "bitTorrentTestnet", + "storyIlaid", + "campTestnet", + "hushedNorthstar" + ] + }, + standardContractType: { + enum: [ + "", + "ERC20", + "ERC721", + "ERC721MetadataName", + "ERC1155", + "CASK", + "Creaton", + "POAP", + "timestamp", + "MolochDAOv2.1", + "ProofOfHumanity", + "SIWE", + "PKPPermissions", + "LitAction" + ] + }, + method: { + type: "string" + }, + parameters: { + type: "array", + items: { + type: "string" + } + }, + returnValueTest: { + type: "object", + properties: { + comparator: { + enum: ["contains", "=", ">", ">=", "<", "<="] + }, + value: { + type: "string" + } + }, + required: ["comparator", "value"], + additionalProperties: false + } + }, + required: [ + "contractAddress", + "chain", + "standardContractType", + "method", + "parameters", + "returnValueTest" + ], + additionalProperties: false + }; + } +}); + +// node_modules/@lit-protocol/accs-schemas/esm/schemas/LPACC_EVM_CONTRACT.json +var require_LPACC_EVM_CONTRACT = __commonJS({ + "node_modules/@lit-protocol/accs-schemas/esm/schemas/LPACC_EVM_CONTRACT.json"(exports, module2) { + module2.exports = { + $id: "https://github.com/LIT-Protocol/accs-schemas/blob/main/src/generated/LPACC_EVM_CONTRACT.json", + title: "LPACC_EVM_CONTRACT", + description: "", + type: "object", + properties: { + conditionType: { + type: "string" + }, + contractAddress: { + type: "string" + }, + chain: { + enum: [ + "ethereum", + "polygon", + "fantom", + "xdai", + "bsc", + "arbitrum", + "arbitrumSepolia", + "avalanche", + "fuji", + "harmony", + "mumbai", + "goerli", + "cronos", + "optimism", + "celo", + "aurora", + "eluvio", + "alfajores", + "xdc", + "evmos", + "evmosTestnet", + "bscTestnet", + "baseGoerli", + "baseSepolia", + "moonbeam", + "moonriver", + "moonbaseAlpha", + "filecoin", + "hyperspace", + "sepolia", + "scrollAlphaTestnet", + "scroll", + "zksync", + "base", + "lukso", + "luksoTestnet", + "zora", + "zoraGoerli", + "zksyncTestnet", + "lineaGoerli", + "lineaSepolia", + "chronicleTestnet", + "yellowstone", + "lit", + "chiado", + "zkEvm", + "mantleTestnet", + "mantle", + "klaytn", + "publicGoodsNetwork", + "optimismGoerli", + "waevEclipseTestnet", + "waevEclipseDevnet", + "verifyTestnet", + "fuse", + "campNetwork", + "vanar", + "lisk", + "chilizMainnet", + "chilizTestnet", + "skaleTestnet", + "skale", + "skaleCalypso", + "fhenixHelium", + "hederaTestnet", + "bitTorrentTestnet", + "storyIlaid", + "campTestnet", + "hushedNorthstar" + ] + }, + functionName: { + type: "string" + }, + functionParams: { + type: "array", + items: { + type: "string" + } + }, + functionAbi: { + type: "object", + properties: { + name: { + type: "string" + }, + type: { + type: "string" + }, + stateMutability: { + type: "string" + }, + constant: { + type: "boolean" + }, + inputs: { + type: "array", + items: { + type: "object", + properties: { + name: { + type: "string" + }, + type: { + type: "string" + }, + internalType: { + type: "string" + } + }, + required: ["name", "type"], + additionalProperties: false + } + }, + outputs: { + type: "array", + items: { + type: "object", + properties: { + name: { + type: "string" + }, + type: { + type: "string" + }, + internalType: { + type: "string" + } + }, + required: ["name", "type"], + additionalProperties: false + } + } + }, + required: ["name", "stateMutability", "inputs", "outputs"], + additionalProperties: false + }, + returnValueTest: { + type: "object", + properties: { + key: { + type: "string" + }, + comparator: { + enum: ["contains", "=", ">", ">=", "<", "<="] + }, + value: { + type: "string" + } + }, + required: ["key", "comparator", "value"], + additionalProperties: false + } + }, + required: [ + "contractAddress", + "chain", + "functionName", + "functionParams", + "functionAbi", + "returnValueTest" + ], + additionalProperties: false + }; + } +}); + +// node_modules/@lit-protocol/accs-schemas/esm/schemas/LPACC_SOL.json +var require_LPACC_SOL = __commonJS({ + "node_modules/@lit-protocol/accs-schemas/esm/schemas/LPACC_SOL.json"(exports, module2) { + module2.exports = { + $id: "https://github.com/LIT-Protocol/accs-schemas/blob/main/src/generated/LPACC_SOL.json", + title: "LPACC_SOL", + description: "", + type: "object", + properties: { + conditionType: { + type: "string" + }, + method: { + type: "string" + }, + params: { + type: "array", + items: { + type: "string" + } + }, + pdaParams: { + type: "array", + items: { + type: "string" + } + }, + pdaInterface: { + type: "object", + properties: { + offset: { + type: "number" + }, + fields: { + type: "object" + } + }, + required: ["offset", "fields"], + additionalProperties: false + }, + pdaKey: { + type: "string" + }, + chain: { + enum: ["solana", "solanaDevnet", "solanaTestnet"] + }, + returnValueTest: { + type: "object", + properties: { + key: { + type: "string" + }, + comparator: { + enum: ["contains", "=", ">", ">=", "<", "<="] + }, + value: { + type: "string" + } + }, + required: ["comparator", "value", "key"], + additionalProperties: false + } + }, + required: [ + "method", + "params", + "chain", + "pdaInterface", + "pdaKey", + "returnValueTest" + ], + additionalProperties: false + }; + } +}); + +// local-tests/setup/networkContext.json +var require_networkContext = __commonJS({ + "local-tests/setup/networkContext.json"(exports, module2) { + module2.exports = { + Allowlist: { + address: "0x67d269191c92Caf3cD7723F116c85e6E9bf55933", + abi: [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "ItemAllowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "ItemNotAllowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "addAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "allowAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "allowedItems", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "isAllowed", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "removeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bool", + name: "_allowAll", + type: "bool" + } + ], + name: "setAllowAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "setAllowed", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "setNotAllowed", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ], + name: "Allowlist" + }, + LITToken: { + address: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", + abi: [ + { + inputs: [ + { + internalType: "uint256", + name: "cap", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "InvalidShortString", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "str", + type: "string" + } + ], + name: "StringTooLong", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "delegator", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "fromDelegate", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "toDelegate", + type: "address" + } + ], + name: "DelegateChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "delegate", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "previousBalance", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newBalance", + type: "uint256" + } + ], + name: "DelegateVotesChanged", + type: "event" + }, + { + anonymous: false, + inputs: [], + name: "EIP712DomainChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Paused", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "previousAdminRole", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "newAdminRole", + type: "bytes32" + } + ], + name: "RoleAdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleGranted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleRevoked", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Unpaused", + type: "event" + }, + { + inputs: [], + name: "ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "CLOCK_MODE", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "MINTER_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PAUSER_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "cap", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint32", + name: "pos", + type: "uint32" + } + ], + name: "checkpoints", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "fromBlock", + type: "uint32" + }, + { + internalType: "uint224", + name: "votes", + type: "uint224" + } + ], + internalType: "struct ERC20Votes.Checkpoint", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "clock", + outputs: [ + { + internalType: "uint48", + name: "", + type: "uint48" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "delegatee", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "delegatee", + type: "address" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiry", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "delegateBySig", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "delegates", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1" + }, + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "version", + type: "string" + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256" + }, + { + internalType: "address", + name: "verifyingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "timepoint", + type: "uint256" + } + ], + name: "getPastTotalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "timepoint", + type: "uint256" + } + ], + name: "getPastVotes", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + } + ], + name: "getRoleAdmin", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "getVotes", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "grantRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasRole", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_recipient", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "numCheckpoints", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "renounceRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "revokeRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ], + name: "LITToken" + }, + Multisender: { + address: "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154", + abi: [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "_recipients", + type: "address[]" + } + ], + name: "sendEth", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "_recipients", + type: "address[]" + }, + { + internalType: "address", + name: "tokenContract", + type: "address" + } + ], + name: "sendTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "tokenContract", + type: "address" + } + ], + name: "withdrawTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ], + name: "Multisender" + }, + PKPHelper: { + address: "0x21dF544947ba3E8b3c32561399E88B52Dc8b2823", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_resolver", + type: "address" + }, + { + internalType: "enum ContractResolver.Env", + name: "_env", + type: "uint8" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "ContractResolverAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "previousAdminRole", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "newAdminRole", + type: "bytes32" + } + ], + name: "RoleAdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleGranted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleRevoked", + type: "event" + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + }, + { + components: [ + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + } + ], + internalType: "struct IPubkeyRouter.Signature[]", + name: "signatures", + type: "tuple[]" + } + ], + internalType: "struct LibPKPNFTStorage.ClaimMaterial", + name: "claimMaterial", + type: "tuple" + }, + { + components: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes[]", + name: "permittedIpfsCIDs", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedIpfsCIDScopes", + type: "uint256[][]" + }, + { + internalType: "address[]", + name: "permittedAddresses", + type: "address[]" + }, + { + internalType: "uint256[][]", + name: "permittedAddressScopes", + type: "uint256[][]" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypes", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIds", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeys", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopes", + type: "uint256[][]" + }, + { + internalType: "bool", + name: "addPkpEthAddressAsPermittedAddress", + type: "bool" + }, + { + internalType: "bool", + name: "sendPkpToItself", + type: "bool" + } + ], + internalType: "struct PKPHelper.AuthMethodData", + name: "authMethodData", + type: "tuple" + } + ], + name: "claimAndMintNextAndAddAuthMethods", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + }, + { + components: [ + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + } + ], + internalType: "struct IPubkeyRouter.Signature[]", + name: "signatures", + type: "tuple[]" + } + ], + internalType: "struct LibPKPNFTStorage.ClaimMaterial", + name: "claimMaterial", + type: "tuple" + }, + { + components: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes[]", + name: "permittedIpfsCIDs", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedIpfsCIDScopes", + type: "uint256[][]" + }, + { + internalType: "address[]", + name: "permittedAddresses", + type: "address[]" + }, + { + internalType: "uint256[][]", + name: "permittedAddressScopes", + type: "uint256[][]" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypes", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIds", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeys", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopes", + type: "uint256[][]" + }, + { + internalType: "bool", + name: "addPkpEthAddressAsPermittedAddress", + type: "bool" + }, + { + internalType: "bool", + name: "sendPkpToItself", + type: "bool" + } + ], + internalType: "struct PKPHelper.AuthMethodData", + name: "authMethodData", + type: "tuple" + } + ], + name: "claimAndMintNextAndAddAuthMethodsWithTypes", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "contractResolver", + outputs: [ + { + internalType: "contract ContractResolver", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "env", + outputs: [ + { + internalType: "enum ContractResolver.Env", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getDomainWalletRegistry", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPKPNftMetdataAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpNftAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpPermissionsAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + } + ], + name: "getRoleAdmin", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "grantRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasRole", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypes", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIds", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeys", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopes", + type: "uint256[][]" + }, + { + internalType: "bool", + name: "addPkpEthAddressAsPermittedAddress", + type: "bool" + }, + { + internalType: "bool", + name: "sendPkpToItself", + type: "bool" + } + ], + name: "mintNextAndAddAuthMethods", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes[]", + name: "permittedIpfsCIDs", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedIpfsCIDScopes", + type: "uint256[][]" + }, + { + internalType: "address[]", + name: "permittedAddresses", + type: "address[]" + }, + { + internalType: "uint256[][]", + name: "permittedAddressScopes", + type: "uint256[][]" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypes", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIds", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeys", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopes", + type: "uint256[][]" + }, + { + internalType: "bool", + name: "addPkpEthAddressAsPermittedAddress", + type: "bool" + }, + { + internalType: "bool", + name: "sendPkpToItself", + type: "bool" + } + ], + name: "mintNextAndAddAuthMethodsWithTypes", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypes", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIds", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeys", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopes", + type: "uint256[][]" + }, + { + internalType: "string[]", + name: "nftMetadata", + type: "string[]" + }, + { + internalType: "bool", + name: "addPkpEthAddressAsPermittedAddress", + type: "bool" + }, + { + internalType: "bool", + name: "sendPkpToItself", + type: "bool" + } + ], + name: "mintNextAndAddDomainWalletMetadata", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + name: "onERC721Received", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "removePkpMetadata", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "renounceRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "revokeRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "string[]", + name: "nftMetadata", + type: "string[]" + } + ], + name: "setPkpMetadata", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ], + name: "PKPHelper" + }, + PKPNFT: { + address: "0xf5059a5D33d5853360D16C683c16e67980206f36", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "ContractResolverAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "newFreeMintSigner", + type: "address" + } + ], + name: "FreeMintSignerSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8" + } + ], + name: "Initialized", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newMintCost", + type: "uint256" + } + ], + name: "MintCostSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "pubkey", + type: "bytes" + } + ], + name: "PKPMinted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Withdrew", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + }, + { + components: [ + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + } + ], + internalType: "struct IPubkeyRouter.Signature[]", + name: "signatures", + type: "tuple[]" + } + ], + name: "claimAndMint", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "exists", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "freeMintSigner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getEthAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getNextDerivedKeyId", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpNftMetadataAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpPermissionsAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPubkey", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getRouterAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getStakingAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "mintCost", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes", + name: "ipfsCID", + type: "bytes" + } + ], + name: "mintGrantAndBurnNext", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + } + ], + name: "mintNext", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "hash", + type: "bytes32" + } + ], + name: "prefixed", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "redeemedFreeMintIds", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newFreeMintSigner", + type: "address" + } + ], + name: "setFreeMintSigner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMintCost", + type: "uint256" + } + ], + name: "setMintCost", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "tokenByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "tokenOfOwnerByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "tokenURI", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ], + name: "PKPNFT" + }, + PKPNFTMetadata: { + address: "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_resolver", + type: "address" + }, + { + internalType: "enum ContractResolver.Env", + name: "_env", + type: "uint8" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [ + { + internalType: "bytes", + name: "buffer", + type: "bytes" + } + ], + name: "bytesToHex", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "contractResolver", + outputs: [ + { + internalType: "contract ContractResolver", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "env", + outputs: [ + { + internalType: "enum ContractResolver.Env", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "removeProfileForPkp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "removeUrlForPKP", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "string", + name: "imgUrl", + type: "string" + } + ], + name: "setProfileForPKP", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "string", + name: "url", + type: "string" + } + ], + name: "setUrlForPKP", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "pubKey", + type: "bytes" + }, + { + internalType: "address", + name: "ethAddress", + type: "address" + } + ], + name: "tokenURI", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + } + ], + name: "PKPNFTMetadata" + }, + PKPPermissions: { + address: "0x4C4a2f8c81640e47606d3fd77B353E87Ba015584", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "ContractResolverAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + indexed: false, + internalType: "bytes", + name: "userPubkey", + type: "bytes" + } + ], + name: "PermittedAuthMethodAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "PermittedAuthMethodRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + indexed: false, + internalType: "uint256", + name: "scopeId", + type: "uint256" + } + ], + name: "PermittedAuthMethodScopeAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + indexed: false, + internalType: "uint256", + name: "scopeId", + type: "uint256" + } + ], + name: "PermittedAuthMethodScopeRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: true, + internalType: "uint256", + name: "group", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes32", + name: "root", + type: "bytes32" + } + ], + name: "RootHashUpdated", + type: "event" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "ipfsCID", + type: "bytes" + }, + { + internalType: "uint256[]", + name: "scopes", + type: "uint256[]" + } + ], + name: "addPermittedAction", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "user", + type: "address" + }, + { + internalType: "uint256[]", + name: "scopes", + type: "uint256[]" + } + ], + name: "addPermittedAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + components: [ + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "bytes", + name: "userPubkey", + type: "bytes" + } + ], + internalType: "struct LibPKPPermissionsStorage.AuthMethod", + name: "authMethod", + type: "tuple" + }, + { + internalType: "uint256[]", + name: "scopes", + type: "uint256[]" + } + ], + name: "addPermittedAuthMethod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "uint256", + name: "scopeId", + type: "uint256" + } + ], + name: "addPermittedAuthMethodScope", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypesToAdd", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIdsToAdd", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeysToAdd", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopesToAdd", + type: "uint256[][]" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypesToRemove", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIdsToRemove", + type: "bytes[]" + } + ], + name: "batchAddRemoveAuthMethods", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "getAuthMethodId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getEthAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPermittedActions", + outputs: [ + { + internalType: "bytes[]", + name: "", + type: "bytes[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPermittedAddresses", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "uint256", + name: "maxScopeId", + type: "uint256" + } + ], + name: "getPermittedAuthMethodScopes", + outputs: [ + { + internalType: "bool[]", + name: "", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPermittedAuthMethods", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "bytes", + name: "userPubkey", + type: "bytes" + } + ], + internalType: "struct LibPKPPermissionsStorage.AuthMethod[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpNftAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPubkey", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getRouterAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "getTokenIdsForAuthMethod", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "getUserPubkeyForAuthMethod", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "ipfsCID", + type: "bytes" + } + ], + name: "isPermittedAction", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "user", + type: "address" + } + ], + name: "isPermittedAddress", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "isPermittedAuthMethod", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "uint256", + name: "scopeId", + type: "uint256" + } + ], + name: "isPermittedAuthMethodScopePresent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "ipfsCID", + type: "bytes" + } + ], + name: "removePermittedAction", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "user", + type: "address" + } + ], + name: "removePermittedAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "removePermittedAuthMethod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "uint256", + name: "scopeId", + type: "uint256" + } + ], + name: "removePermittedAuthMethodScope", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "group", + type: "uint256" + }, + { + internalType: "bytes32", + name: "root", + type: "bytes32" + } + ], + name: "setRootHash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "group", + type: "uint256" + }, + { + internalType: "bytes32[]", + name: "proof", + type: "bytes32[]" + }, + { + internalType: "bytes32", + name: "leaf", + type: "bytes32" + } + ], + name: "verifyState", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "group", + type: "uint256" + }, + { + internalType: "bytes32[]", + name: "proof", + type: "bytes32[]" + }, + { + internalType: "bool[]", + name: "proofFlags", + type: "bool[]" + }, + { + internalType: "bytes32[]", + name: "leaves", + type: "bytes32[]" + } + ], + name: "verifyStates", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + } + ], + name: "PKPPermissions" + }, + PubkeyRouter: { + address: "0x1291Be112d480055DaFd8a610b7d1e203891C274", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "ContractResolverAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + indexed: false, + internalType: "address", + name: "stakingContract", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + name: "PubkeyRoutingDataSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "stakingContract", + type: "address" + }, + { + components: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + } + ], + indexed: false, + internalType: "struct IPubkeyRouter.RootKey", + name: "rootKey", + type: "tuple" + } + ], + name: "RootKeySet", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "stakingContract", + type: "address" + } + ], + name: "adminResetRootKeys", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + } + ], + internalType: "struct IPubkeyRouter.Signature[]", + name: "signatures", + type: "tuple[]" + }, + { + internalType: "bytes", + name: "signedMessage", + type: "bytes" + }, + { + internalType: "address", + name: "stakingContractAddress", + type: "address" + } + ], + name: "checkNodeSignatures", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + } + ], + name: "deriveEthAddressFromPubkey", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "ethAddress", + type: "address" + } + ], + name: "ethAddressToPkpId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + name: "getDerivedPubkey", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getEthAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpNftAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPubkey", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakingContract", + type: "address" + } + ], + name: "getRootKeys", + outputs: [ + { + components: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + } + ], + internalType: "struct IPubkeyRouter.RootKey[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getRoutingData", + outputs: [ + { + components: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + internalType: "struct LibPubkeyRouterStorage.PubkeyRoutingData", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "isRouted", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "pubkeys", + outputs: [ + { + components: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + internalType: "struct LibPubkeyRouterStorage.PubkeyRoutingData", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "address", + name: "stakingContractAddress", + type: "address" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + name: "setRoutingData", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "address", + name: "stakingContract", + type: "address" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + name: "setRoutingDataAsAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakingContractAddress", + type: "address" + }, + { + components: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + } + ], + internalType: "struct IPubkeyRouter.RootKey[]", + name: "newRootKeys", + type: "tuple[]" + } + ], + name: "voteForRootKeys", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ], + name: "PubkeyRouter" + }, + RateLimitNFT: { + address: "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newAdditionalRequestsPerKilosecondCost", + type: "uint256" + } + ], + name: "AdditionalRequestsPerKilosecondCostSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "newFreeMintSigner", + type: "address" + } + ], + name: "FreeMintSignerSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newFreeRequestsPerRateLimitWindow", + type: "uint256" + } + ], + name: "FreeRequestsPerRateLimitWindowSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8" + } + ], + name: "Initialized", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newRLIHolderRateLimitWindowSeconds", + type: "uint256" + } + ], + name: "RLIHolderRateLimitWindowSecondsSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newRateLimitWindowSeconds", + type: "uint256" + } + ], + name: "RateLimitWindowSecondsSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Withdrew", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + }, + { + internalType: "uint256", + name: "requestsPerKilosecond", + type: "uint256" + }, + { + internalType: "bytes32", + name: "msgHash", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "sVal", + type: "bytes32" + } + ], + name: "freeMint", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + } + ], + name: "mint", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newAdditionalRequestsPerKilosecondCost", + type: "uint256" + } + ], + name: "setAdditionalRequestsPerKilosecondCost", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newFreeMintSigner", + type: "address" + } + ], + name: "setFreeMintSigner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newFreeRequestsPerRateLimitWindow", + type: "uint256" + } + ], + name: "setFreeRequestsPerRateLimitWindow", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMaxExpirationSeconds", + type: "uint256" + } + ], + name: "setMaxExpirationSeconds", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMaxRequestsPerKilosecond", + type: "uint256" + } + ], + name: "setMaxRequestsPerKilosecond", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newRLIHolderRateLimitWindowSeconds", + type: "uint256" + } + ], + name: "setRLIHolderRateLimitWindowSeconds", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newRateLimitWindowSeconds", + type: "uint256" + } + ], + name: "setRateLimitWindowSeconds", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "tokenByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "tokenOfOwnerByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "tokenURI", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "RLIHolderRateLimitWindowSeconds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "additionalRequestsPerKilosecondCost", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "requestsPerKilosecond", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + } + ], + name: "calculateCost", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "payingAmount", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + } + ], + name: "calculateRequestsPerKilosecond", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "capacity", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "requestsPerKilosecond", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + } + ], + internalType: "struct LibRateLimitNFTStorage.RateLimit", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "requestedRequestsPerKilosecond", + type: "uint256" + } + ], + name: "checkBelowMaxRequestsPerKilosecond", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentSoldRequestsPerKilosecond", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "defaultRateLimitWindowSeconds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + }, + { + internalType: "uint256", + name: "requestsPerKilosecond", + type: "uint256" + }, + { + internalType: "bytes32", + name: "msgHash", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "sVal", + type: "bytes32" + } + ], + name: "freeMintSigTest", + outputs: [], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "freeMintSigner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "freeRequestsPerRateLimitWindow", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "isExpired", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maxExpirationSeconds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maxRequestsPerKilosecond", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "hash", + type: "bytes32" + } + ], + name: "prefixed", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "msgHash", + type: "bytes32" + } + ], + name: "redeemedFreeMints", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "tokenIdCounter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "tokenSVG", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + } + ], + name: "totalSoldRequestsPerKilosecondByExpirationTime", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } + ], + name: "RateLimitNFT" + }, + Staking: { + address: "0xc5a5C42992dECbae36851359345FE25997F5C42d", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "ActiveValidatorsCannotLeave", + type: "error" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + inputs: [], + name: "CannotKickBelowCurrentValidatorThreshold", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "stakingAddress", + type: "address" + } + ], + name: "CannotRejoinUntilNextEpochBecauseKicked", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + name: "CannotReuseCommsKeys", + type: "error" + }, + { + inputs: [], + name: "CannotStakeZero", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "CannotVoteTwice", + type: "error" + }, + { + inputs: [], + name: "CannotWithdrawZero", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "nodeAddress", + type: "address" + } + ], + name: "CouldNotMapNodeAddressToStakerAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInActiveOrUnlockedOrPausedState", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInActiveOrUnlockedState", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInNextValidatorSetLockedState", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInReadyForNextEpochState", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "MustBeValidatorInNextEpochToKick", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "currentTimestamp", + type: "uint256" + }, + { + internalType: "uint256", + name: "epochEndTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "timeout", + type: "uint256" + } + ], + name: "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "currentTimestamp", + type: "uint256" + }, + { + internalType: "uint256", + name: "epochEndTime", + type: "uint256" + } + ], + name: "NotEnoughTimeElapsedSinceLastEpoch", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "validatorCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "minimumValidatorCount", + type: "uint256" + } + ], + name: "NotEnoughValidatorsInNextEpoch", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "currentReadyValidatorCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "nextReadyValidatorCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "minimumValidatorCountToBeReady", + type: "uint256" + } + ], + name: "NotEnoughValidatorsReadyForNextEpoch", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "currentEpochNumber", + type: "uint256" + }, + { + internalType: "uint256", + name: "receivedEpochNumber", + type: "uint256" + } + ], + name: "SignaledReadyForWrongEpochNumber", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "StakerNotPermitted", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "yourBalance", + type: "uint256" + }, + { + internalType: "uint256", + name: "requestedWithdrawlAmount", + type: "uint256" + } + ], + name: "TryingToWithdrawMoreThanStaked", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "validator", + type: "address" + }, + { + internalType: "address[]", + name: "validatorsInNextEpoch", + type: "address[]" + } + ], + name: "ValidatorIsNotInNextEpoch", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "reason", + type: "uint256" + }, + { + components: [ + { + internalType: "uint256", + name: "tolerance", + type: "uint256" + }, + { + internalType: "uint256", + name: "intervalSecs", + type: "uint256" + }, + { + internalType: "uint256", + name: "kickPenaltyPercent", + type: "uint256" + } + ], + indexed: false, + internalType: "struct LibStakingStorage.ComplaintConfig", + name: "config", + type: "tuple" + } + ], + name: "ComplaintConfigSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newTokenRewardPerTokenPerEpoch", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256[]", + name: "newKeyTypes", + type: "uint256[]" + }, + { + indexed: false, + internalType: "uint256", + name: "newMinimumValidatorCount", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newMaxConcurrentRequests", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newMaxTripleCount", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newMinTripleCount", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newPeerCheckingIntervalSecs", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newMaxTripleConcurrency", + type: "uint256" + }, + { + indexed: false, + internalType: "bool", + name: "newRpcHealthcheckEnabled", + type: "bool" + } + ], + name: "ConfigSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newEpochEndTime", + type: "uint256" + } + ], + name: "EpochEndTimeSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newEpochLength", + type: "uint256" + } + ], + name: "EpochLengthSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newEpochTimeout", + type: "uint256" + } + ], + name: "EpochTimeoutSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "reason", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newKickPenaltyPercent", + type: "uint256" + } + ], + name: "KickPenaltyPercentSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "epochNumber", + type: "uint256" + } + ], + name: "ReadyForNextEpoch", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "token", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Recovered", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "RequestToJoin", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "RequestToLeave", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverContractAddress", + type: "address" + } + ], + name: "ResolverContractAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newDuration", + type: "uint256" + } + ], + name: "RewardsDurationUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newStakingTokenAddress", + type: "address" + } + ], + name: "StakingTokenSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "enum LibStakingStorage.States", + name: "newState", + type: "uint8" + } + ], + name: "StateChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amountBurned", + type: "uint256" + } + ], + name: "ValidatorKickedFromNextEpoch", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "ValidatorRejoinedNextEpoch", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "reporter", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "validatorStakerAddress", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "reason", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "VotedToKickValidatorInNextEpoch", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "validatorStakerAddress", + type: "address" + } + ], + name: "adminKickValidatorInNextEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "adminRejoinValidator", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "adminResetEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "validatorStakerAddress", + type: "address" + }, + { + internalType: "uint256", + name: "amountToPenalize", + type: "uint256" + } + ], + name: "adminSlashValidator", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "advanceEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "exit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "getReward", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "validatorStakerAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reason", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "kickValidatorInNextEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "lockValidatorsForNextEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + name: "requestToJoin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "requestToLeave", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "requestToLeaveAsNode", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "reason", + type: "uint256" + }, + { + components: [ + { + internalType: "uint256", + name: "tolerance", + type: "uint256" + }, + { + internalType: "uint256", + name: "intervalSecs", + type: "uint256" + }, + { + internalType: "uint256", + name: "kickPenaltyPercent", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.ComplaintConfig", + name: "config", + type: "tuple" + } + ], + name: "setComplaintConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "tokenRewardPerTokenPerEpoch", + type: "uint256" + }, + { + internalType: "uint256", + name: "DEPRECATED_complaintTolerance", + type: "uint256" + }, + { + internalType: "uint256", + name: "DEPRECATED_complaintIntervalSecs", + type: "uint256" + }, + { + internalType: "uint256[]", + name: "keyTypes", + type: "uint256[]" + }, + { + internalType: "uint256", + name: "minimumValidatorCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "maxConcurrentRequests", + type: "uint256" + }, + { + internalType: "uint256", + name: "maxTripleCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "minTripleCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "peerCheckingIntervalSecs", + type: "uint256" + }, + { + internalType: "uint256", + name: "maxTripleConcurrency", + type: "uint256" + }, + { + internalType: "bool", + name: "rpcHealthcheckEnabled", + type: "bool" + } + ], + internalType: "struct LibStakingStorage.Config", + name: "newConfig", + type: "tuple" + } + ], + name: "setConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newEpochEndTime", + type: "uint256" + } + ], + name: "setEpochEndTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newEpochLength", + type: "uint256" + } + ], + name: "setEpochLength", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "newState", + type: "uint8" + } + ], + name: "setEpochState", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newEpochTimeout", + type: "uint256" + } + ], + name: "setEpochTimeout", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + name: "setIpPortNodeAddressAndCommunicationPubKeys", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "reason", + type: "uint256" + }, + { + internalType: "uint256", + name: "newKickPenaltyPercent", + type: "uint256" + } + ], + name: "setKickPenaltyPercent", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "epochNumber", + type: "uint256" + } + ], + name: "signalReadyForNextEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "stake", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + name: "stakeAndJoin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "index", + type: "uint256" + }, + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + indexed: false, + internalType: "struct LibStakingStorage.Version", + name: "version", + type: "tuple" + } + ], + name: "VersionRequirementsUpdated", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Version", + name: "version", + type: "tuple" + } + ], + name: "checkVersion", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getMaxVersion", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Version", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getMaxVersionString", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getMinVersion", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Version", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getMinVersionString", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Version", + name: "version", + type: "tuple" + } + ], + name: "setMaxVersion", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Version", + name: "version", + type: "tuple" + } + ], + name: "setMinVersion", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "reason", + type: "uint256" + } + ], + name: "complaintConfig", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "tolerance", + type: "uint256" + }, + { + internalType: "uint256", + name: "intervalSecs", + type: "uint256" + }, + { + internalType: "uint256", + name: "kickPenaltyPercent", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.ComplaintConfig", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "config", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "tokenRewardPerTokenPerEpoch", + type: "uint256" + }, + { + internalType: "uint256", + name: "DEPRECATED_complaintTolerance", + type: "uint256" + }, + { + internalType: "uint256", + name: "DEPRECATED_complaintIntervalSecs", + type: "uint256" + }, + { + internalType: "uint256[]", + name: "keyTypes", + type: "uint256[]" + }, + { + internalType: "uint256", + name: "minimumValidatorCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "maxConcurrentRequests", + type: "uint256" + }, + { + internalType: "uint256", + name: "maxTripleCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "minTripleCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "peerCheckingIntervalSecs", + type: "uint256" + }, + { + internalType: "uint256", + name: "maxTripleConcurrency", + type: "uint256" + }, + { + internalType: "bool", + name: "rpcHealthcheckEnabled", + type: "bool" + } + ], + internalType: "struct LibStakingStorage.Config", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "contractResolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "countOfCurrentValidatorsReadyForNextEpoch", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "countOfNextValidatorsReadyForNextEpoch", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentValidatorCountForConsensus", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "epoch", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "epochLength", + type: "uint256" + }, + { + internalType: "uint256", + name: "number", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "retries", + type: "uint256" + }, + { + internalType: "uint256", + name: "timeout", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Epoch", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getActiveUnkickedValidatorStructs", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Validator[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getActiveUnkickedValidatorStructsAndCounts", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + components: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Validator[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getActiveUnkickedValidators", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getKeyTypes", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getKickedValidators", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "addresses", + type: "address[]" + } + ], + name: "getNodeStakerAddressMappings", + outputs: [ + { + components: [ + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + internalType: "struct LibStakingStorage.AddressMapping[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getStakingBalancesAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getTokenAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getValidatorsInCurrentEpoch", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getValidatorsInCurrentEpochLength", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getValidatorsInNextEpoch", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "addresses", + type: "address[]" + } + ], + name: "getValidatorsStructs", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Validator[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getValidatorsStructsInCurrentEpoch", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Validator[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getValidatorsStructsInNextEpoch", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Validator[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "epochNumber", + type: "uint256" + }, + { + internalType: "address", + name: "validatorStakerAddress", + type: "address" + }, + { + internalType: "address", + name: "voterStakerAddress", + type: "address" + } + ], + name: "getVotingStatusToKickValidator", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "isActiveValidator", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "isActiveValidatorByNodeAddress", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "isReadyForNextEpoch", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "reason", + type: "uint256" + } + ], + name: "kickPenaltyPercentByReason", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextValidatorCountForConsensus", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "nodeAddress", + type: "address" + } + ], + name: "nodeAddressToStakerAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "readyForNextEpoch", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "shouldKickValidator", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "state", + outputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "validators", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Validator", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + } + ], + name: "Staking" + }, + StakingBalances: { + address: "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "ActiveValidatorsCannotLeave", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "aliasAccount", + type: "address" + }, + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "AliasNotOwnedBySender", + type: "error" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "CannotRemoveAliasOfActiveValidator", + type: "error" + }, + { + inputs: [], + name: "CannotStakeZero", + type: "error" + }, + { + inputs: [], + name: "CannotWithdrawZero", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "aliasCount", + type: "uint256" + } + ], + name: "MaxAliasCountReached", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "OnlyStakingContract", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountStaked", + type: "uint256" + }, + { + internalType: "uint256", + name: "minimumStake", + type: "uint256" + } + ], + name: "StakeMustBeGreaterThanMinimumStake", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountStaked", + type: "uint256" + }, + { + internalType: "uint256", + name: "maximumStake", + type: "uint256" + } + ], + name: "StakeMustBeLessThanMaximumStake", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "StakerNotPermitted", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "yourBalance", + type: "uint256" + }, + { + internalType: "uint256", + name: "requestedWithdrawlAmount", + type: "uint256" + } + ], + name: "TryingToWithdrawMoreThanStaked", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "AliasAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "AliasRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newMaxAliasCount", + type: "uint256" + } + ], + name: "MaxAliasCountSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newMaximumStake", + type: "uint256" + } + ], + name: "MaximumStakeSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newMinimumStake", + type: "uint256" + } + ], + name: "MinimumStakeSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "PermittedStakerAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "PermittedStakerRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bool", + name: "permittedStakersOn", + type: "bool" + } + ], + name: "PermittedStakersOnChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "ResolverContractAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "reward", + type: "uint256" + } + ], + name: "RewardPaid", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Staked", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newTokenRewardPerTokenPerEpoch", + type: "uint256" + } + ], + name: "TokenRewardPerTokenPerEpochSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "ValidatorNotRewardedBecauseAlias", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "ValidatorRewarded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "ValidatorTokensPenalized", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Withdrawn", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "addAlias", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "addPermittedStaker", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "stakers", + type: "address[]" + } + ], + name: "addPermittedStakers", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "checkStakingAmounts", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "contractResolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "getReward", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "getStakingAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getTokenAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "isPermittedStaker", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maximumStake", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "minimumStake", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "penalizeTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "permittedStakersOn", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "removeAlias", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "removePermittedStaker", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "staker", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + } + ], + name: "restakePenaltyTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "rewardOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "rewardValidator", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMaxAliasCount", + type: "uint256" + } + ], + name: "setMaxAliasCount", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMaximumStake", + type: "uint256" + } + ], + name: "setMaximumStake", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMinimumStake", + type: "uint256" + } + ], + name: "setMinimumStake", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bool", + name: "permitted", + type: "bool" + } + ], + name: "setPermittedStakersOn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "stake", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "totalStaked", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + } + ], + name: "transferPenaltyTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + } + ], + name: "withdrawPenaltyTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ], + name: "StakingBalances" + }, + ContractResolver: { + address: "0x5FbDB2315678afecb367f032d93F642f64180aa3", + abi: [ + { + inputs: [ + { + internalType: "enum ContractResolver.Env", + name: "env", + type: "uint8" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "AdminRoleRequired", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "enum ContractResolver.Env", + name: "env", + type: "uint8" + } + ], + name: "AllowedEnvAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "enum ContractResolver.Env", + name: "env", + type: "uint8" + } + ], + name: "AllowedEnvRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "previousAdminRole", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "newAdminRole", + type: "bytes32" + } + ], + name: "RoleAdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleGranted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleRevoked", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "typ", + type: "bytes32" + }, + { + indexed: false, + internalType: "enum ContractResolver.Env", + name: "env", + type: "uint8" + }, + { + indexed: false, + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "SetContract", + type: "event" + }, + { + inputs: [], + name: "ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "ALLOWLIST_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "BACKUP_RECOVERY_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "DOMAIN_WALLET_REGISTRY", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "HD_KEY_DERIVER_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "LIT_TOKEN_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "MULTI_SENDER_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PAYMENT_DELEGATION_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PKP_HELPER_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PKP_HELPER_V2_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PKP_NFT_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PKP_NFT_METADATA_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PKP_PERMISSIONS_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PUB_KEY_ROUTER_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "RATE_LIMIT_NFT_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "RELEASE_REGISTER_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "STAKING_BALANCES_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "STAKING_CONTRACT", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "addAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "enum ContractResolver.Env", + name: "env", + type: "uint8" + } + ], + name: "addAllowedEnv", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "typ", + type: "bytes32" + }, + { + internalType: "enum ContractResolver.Env", + name: "env", + type: "uint8" + } + ], + name: "getContract", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + } + ], + name: "getRoleAdmin", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "grantRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasRole", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "adminBeingRemoved", + type: "address" + } + ], + name: "removeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "enum ContractResolver.Env", + name: "env", + type: "uint8" + } + ], + name: "removeAllowedEnv", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "renounceRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "revokeRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "typ", + type: "bytes32" + }, + { + internalType: "enum ContractResolver.Env", + name: "env", + type: "uint8" + }, + { + internalType: "address", + name: "addr", + type: "address" + } + ], + name: "setContract", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + }, + { + internalType: "enum ContractResolver.Env", + name: "", + type: "uint8" + } + ], + name: "typeAddresses", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + } + ], + name: "ContractResolver" + } + }; + } +}); + +// packages/wrapped-keys-lit-actions/src/generated/common/batchGenerateEncryptedKeys.js +var require_batchGenerateEncryptedKeys = __commonJS({ + "packages/wrapped-keys-lit-actions/src/generated/common/batchGenerateEncryptedKeys.js"(exports, module2) { + "use strict"; + init_shim(); + var code9 = '"use strict";(()=>{var Wc=Object.create;var $i=Object.defineProperty;var Hc=Object.getOwnPropertyDescriptor;var $c=Object.getOwnPropertyNames;var Vc=Object.getPrototypeOf,Gc=Object.prototype.hasOwnProperty;var za=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error(\'Dynamic require of "\'+r+\'" is not supported\')});var ae=(r,t)=>()=>(r&&(t=r(r=0)),t);var $e=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Ka=(r,t)=>{for(var e in t)$i(r,e,{get:t[e],enumerable:!0})},qa=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $c(t))!Gc.call(r,o)&&o!==e&&$i(r,o,{get:()=>t[o],enumerable:!(n=Hc(t,o))||n.enumerable});return r};var D=(r,t,e)=>(e=r!=null?Wc(Vc(r)):{},qa(t||!r||!r.__esModule?$i(e,"default",{value:r,enumerable:!0}):e,r)),Fa=r=>qa($i({},"__esModule",{value:!0}),r);var Ha=$e(Vi=>{"use strict";var jd=D(V());Vi.byteLength=Yc;Vi.toByteArray=Jc;Vi.fromByteArray=th;var zr=[],Br=[],jc=typeof Uint8Array<"u"?Uint8Array:Array,es="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_n=0,Da=es.length;_n0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}function Yc(r){var t=Wa(r),e=t[0],n=t[1];return(e+n)*3/4-n}function Zc(r,t,e){return(t+e)*3/4-e}function Jc(r){var t,e=Wa(r),n=e[0],o=e[1],f=new jc(Zc(r,n,o)),h=0,x=o>0?n-4:n,b;for(b=0;b>16&255,f[h++]=t>>8&255,f[h++]=t&255;return o===2&&(t=Br[r.charCodeAt(b)]<<2|Br[r.charCodeAt(b+1)]>>4,f[h++]=t&255),o===1&&(t=Br[r.charCodeAt(b)]<<10|Br[r.charCodeAt(b+1)]<<4|Br[r.charCodeAt(b+2)]>>2,f[h++]=t>>8&255,f[h++]=t&255),f}function Xc(r){return zr[r>>18&63]+zr[r>>12&63]+zr[r>>6&63]+zr[r&63]}function Qc(r,t,e){for(var n,o=[],f=t;fx?x:h+f));return n===1?(t=r[e-1],o.push(zr[t>>2]+zr[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],o.push(zr[t>>10]+zr[t>>4&63]+zr[t<<2&63]+"=")),o.join("")}});var $a=$e(rs=>{var Zd=D(V());rs.read=function(r,t,e,n,o){var f,h,x=o*8-n-1,b=(1<>1,_=-7,M=e?o-1:0,C=e?-1:1,N=r[t+M];for(M+=C,f=N&(1<<-_)-1,N>>=-_,_+=x;_>0;f=f*256+r[t+M],M+=C,_-=8);for(h=f&(1<<-_)-1,f>>=-_,_+=n;_>0;h=h*256+r[t+M],M+=C,_-=8);if(f===0)f=1-E;else{if(f===b)return h?NaN:(N?-1:1)*(1/0);h=h+Math.pow(2,n),f=f-E}return(N?-1:1)*h*Math.pow(2,f-n)};rs.write=function(r,t,e,n,o,f){var h,x,b,E=f*8-o-1,_=(1<>1,C=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=n?0:f-1,ft=n?1:-1,W=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(x=isNaN(t)?1:0,h=_):(h=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-h))<1&&(h--,b*=2),h+M>=1?t+=C/b:t+=C*Math.pow(2,1-M),t*b>=2&&(h++,b/=2),h+M>=_?(x=0,h=_):h+M>=1?(x=(t*b-1)*Math.pow(2,o),h=h+M):(x=t*Math.pow(2,M-1)*Math.pow(2,o),h=0));o>=8;r[e+N]=x&255,N+=ft,x/=256,o-=8);for(h=h<0;r[e+N]=h&255,N+=ft,h/=256,E-=8);r[e+N-ft]|=W*128}});var An=$e(jn=>{"use strict";var Qd=D(V());var ns=Ha(),Vn=$a(),Va=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;jn.Buffer=G;jn.SlowBuffer=sh;jn.INSPECT_MAX_BYTES=50;var Gi=2147483647;jn.kMaxLength=Gi;G.TYPED_ARRAY_SUPPORT=eh();!G.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function eh(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(G.prototype,"parent",{enumerable:!0,get:function(){if(G.isBuffer(this))return this.buffer}});Object.defineProperty(G.prototype,"offset",{enumerable:!0,get:function(){if(G.isBuffer(this))return this.byteOffset}});function $r(r){if(r>Gi)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\');let t=new Uint8Array(r);return Object.setPrototypeOf(t,G.prototype),t}function G(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return as(r)}return Za(r,t,e)}G.poolSize=8192;function Za(r,t,e){if(typeof r=="string")return nh(r,t);if(ArrayBuffer.isView(r))return ih(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Kr(r,ArrayBuffer)||r&&Kr(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Kr(r,SharedArrayBuffer)||r&&Kr(r.buffer,SharedArrayBuffer)))return os(r,t,e);if(typeof r=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return G.from(n,t,e);let o=oh(r);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return G.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}G.from=function(r,t,e){return Za(r,t,e)};Object.setPrototypeOf(G.prototype,Uint8Array.prototype);Object.setPrototypeOf(G,Uint8Array);function Ja(r){if(typeof r!="number")throw new TypeError(\'"size" argument must be of type number\');if(r<0)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\')}function rh(r,t,e){return Ja(r),r<=0?$r(r):t!==void 0?typeof e=="string"?$r(r).fill(t,e):$r(r).fill(t):$r(r)}G.alloc=function(r,t,e){return rh(r,t,e)};function as(r){return Ja(r),$r(r<0?0:fs(r)|0)}G.allocUnsafe=function(r){return as(r)};G.allocUnsafeSlow=function(r){return as(r)};function nh(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!G.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=Xa(r,t)|0,n=$r(e),o=n.write(r,t);return o!==e&&(n=n.slice(0,o)),n}function is(r){let t=r.length<0?0:fs(r.length)|0,e=$r(t);for(let n=0;n=Gi)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Gi.toString(16)+" bytes");return r|0}function sh(r){return+r!=r&&(r=0),G.alloc(+r)}G.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==G.prototype};G.compare=function(t,e){if(Kr(t,Uint8Array)&&(t=G.from(t,t.offset,t.byteLength)),Kr(e,Uint8Array)&&(e=G.from(e,e.offset,e.byteLength)),!G.isBuffer(t)||!G.isBuffer(e))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(t===e)return 0;let n=t.length,o=e.length;for(let f=0,h=Math.min(n,o);fo.length?(G.isBuffer(h)||(h=G.from(h)),h.copy(o,f)):Uint8Array.prototype.set.call(o,h,f);else if(G.isBuffer(h))h.copy(o,f);else throw new TypeError(\'"list" argument must be an Array of Buffers\');f+=h.length}return o};function Xa(r,t){if(G.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Kr(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof r);let e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return ss(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return ff(r).length;default:if(o)return n?-1:ss(r).length;t=(""+t).toLowerCase(),o=!0}}G.byteLength=Xa;function ah(r,t,e){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return mh(this,t,e);case"utf8":case"utf-8":return tf(this,t,e);case"ascii":return yh(this,t,e);case"latin1":case"binary":return gh(this,t,e);case"base64":return dh(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wh(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}G.prototype._isBuffer=!0;function En(r,t,e){let n=r[t];r[t]=r[e],r[e]=n}G.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;ee&&(t+=" ... "),""};Va&&(G.prototype[Va]=G.prototype.inspect);G.prototype.compare=function(t,e,n,o,f){if(Kr(t,Uint8Array)&&(t=G.from(t,t.offset,t.byteLength)),!G.isBuffer(t))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),o===void 0&&(o=0),f===void 0&&(f=this.length),e<0||n>t.length||o<0||f>this.length)throw new RangeError("out of range index");if(o>=f&&e>=n)return 0;if(o>=f)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,f>>>=0,this===t)return 0;let h=f-o,x=n-e,b=Math.min(h,x),E=this.slice(o,f),_=t.slice(e,n);for(let M=0;M2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,cs(e)&&(e=o?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(o)return-1;e=r.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof t=="string"&&(t=G.from(t,n)),G.isBuffer(t))return t.length===0?-1:Ga(r,t,e,n,o);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Ga(r,[t],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Ga(r,t,e,n,o){let f=1,h=r.length,x=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;f=2,h/=2,x/=2,e/=2}function b(_,M){return f===1?_[M]:_.readUInt16BE(M*f)}let E;if(o){let _=-1;for(E=e;Eh&&(e=h-x),E=e;E>=0;E--){let _=!0;for(let M=0;Mo&&(n=o)):n=o;let f=t.length;n>f/2&&(n=f/2);let h;for(h=0;h>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let f=this.length-e;if((n===void 0||n>f)&&(n=f),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let h=!1;for(;;)switch(o){case"hex":return fh(this,t,e,n);case"utf8":case"utf-8":return uh(this,t,e,n);case"ascii":case"latin1":case"binary":return ch(this,t,e,n);case"base64":return hh(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lh(this,t,e,n);default:if(h)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),h=!0}};G.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dh(r,t,e){return t===0&&e===r.length?ns.fromByteArray(r):ns.fromByteArray(r.slice(t,e))}function tf(r,t,e){e=Math.min(r.length,e);let n=[],o=t;for(;o239?4:f>223?3:f>191?2:1;if(o+x<=e){let b,E,_,M;switch(x){case 1:f<128&&(h=f);break;case 2:b=r[o+1],(b&192)===128&&(M=(f&31)<<6|b&63,M>127&&(h=M));break;case 3:b=r[o+1],E=r[o+2],(b&192)===128&&(E&192)===128&&(M=(f&15)<<12|(b&63)<<6|E&63,M>2047&&(M<55296||M>57343)&&(h=M));break;case 4:b=r[o+1],E=r[o+2],_=r[o+3],(b&192)===128&&(E&192)===128&&(_&192)===128&&(M=(f&15)<<18|(b&63)<<12|(E&63)<<6|_&63,M>65535&&M<1114112&&(h=M))}}h===null?(h=65533,x=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|h&1023),n.push(h),o+=x}return ph(n)}var ja=4096;function ph(r){let t=r.length;if(t<=ja)return String.fromCharCode.apply(String,r);let e="",n=0;for(;nn)&&(e=n);let o="";for(let f=t;fn&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),ee)throw new RangeError("Trying to access beyond buffer length")}G.prototype.readUintLE=G.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||Ye(t,e,this.length);let o=this[t],f=1,h=0;for(;++h>>0,e=e>>>0,n||Ye(t,e,this.length);let o=this[t+--e],f=1;for(;e>0&&(f*=256);)o+=this[t+--e]*f;return o};G.prototype.readUint8=G.prototype.readUInt8=function(t,e){return t=t>>>0,e||Ye(t,1,this.length),this[t]};G.prototype.readUint16LE=G.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||Ye(t,2,this.length),this[t]|this[t+1]<<8};G.prototype.readUint16BE=G.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||Ye(t,2,this.length),this[t]<<8|this[t+1]};G.prototype.readUint32LE=G.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||Ye(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};G.prototype.readUint32BE=G.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||Ye(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};G.prototype.readBigUInt64LE=nn(function(t){t=t>>>0,Gn(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&di(t,this.length-8);let o=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,f=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(o)+(BigInt(f)<>>0,Gn(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&di(t,this.length-8);let o=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],f=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(o)<>>0,e=e>>>0,n||Ye(t,e,this.length);let o=this[t],f=1,h=0;for(;++h=f&&(o-=Math.pow(2,8*e)),o};G.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||Ye(t,e,this.length);let o=e,f=1,h=this[t+--o];for(;o>0&&(f*=256);)h+=this[t+--o]*f;return f*=128,h>=f&&(h-=Math.pow(2,8*e)),h};G.prototype.readInt8=function(t,e){return t=t>>>0,e||Ye(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};G.prototype.readInt16LE=function(t,e){t=t>>>0,e||Ye(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};G.prototype.readInt16BE=function(t,e){t=t>>>0,e||Ye(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};G.prototype.readInt32LE=function(t,e){return t=t>>>0,e||Ye(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};G.prototype.readInt32BE=function(t,e){return t=t>>>0,e||Ye(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};G.prototype.readBigInt64LE=nn(function(t){t=t>>>0,Gn(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&di(t,this.length-8);let o=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(o)<>>0,Gn(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&di(t,this.length-8);let o=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(o)<>>0,e||Ye(t,4,this.length),Vn.read(this,t,!0,23,4)};G.prototype.readFloatBE=function(t,e){return t=t>>>0,e||Ye(t,4,this.length),Vn.read(this,t,!1,23,4)};G.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||Ye(t,8,this.length),Vn.read(this,t,!0,52,8)};G.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||Ye(t,8,this.length),Vn.read(this,t,!1,52,8)};function pr(r,t,e,n,o,f){if(!G.isBuffer(r))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(t>o||tr.length)throw new RangeError("Index out of range")}G.prototype.writeUintLE=G.prototype.writeUIntLE=function(t,e,n,o){if(t=+t,e=e>>>0,n=n>>>0,!o){let x=Math.pow(2,8*n)-1;pr(this,t,e,n,x,0)}let f=1,h=0;for(this[e]=t&255;++h>>0,n=n>>>0,!o){let x=Math.pow(2,8*n)-1;pr(this,t,e,n,x,0)}let f=n-1,h=1;for(this[e+f]=t&255;--f>=0&&(h*=256);)this[e+f]=t/h&255;return e+n};G.prototype.writeUint8=G.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,1,255,0),this[e]=t&255,e+1};G.prototype.writeUint16LE=G.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};G.prototype.writeUint16BE=G.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};G.prototype.writeUint32LE=G.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};G.prototype.writeUint32BE=G.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function ef(r,t,e,n,o){af(t,n,o,r,e,7);let f=Number(t&BigInt(4294967295));r[e++]=f,f=f>>8,r[e++]=f,f=f>>8,r[e++]=f,f=f>>8,r[e++]=f;let h=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=h,h=h>>8,r[e++]=h,h=h>>8,r[e++]=h,h=h>>8,r[e++]=h,e}function rf(r,t,e,n,o){af(t,n,o,r,e,7);let f=Number(t&BigInt(4294967295));r[e+7]=f,f=f>>8,r[e+6]=f,f=f>>8,r[e+5]=f,f=f>>8,r[e+4]=f;let h=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=h,h=h>>8,r[e+2]=h,h=h>>8,r[e+1]=h,h=h>>8,r[e]=h,e+8}G.prototype.writeBigUInt64LE=nn(function(t,e=0){return ef(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});G.prototype.writeBigUInt64BE=nn(function(t,e=0){return rf(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});G.prototype.writeIntLE=function(t,e,n,o){if(t=+t,e=e>>>0,!o){let b=Math.pow(2,8*n-1);pr(this,t,e,n,b-1,-b)}let f=0,h=1,x=0;for(this[e]=t&255;++f>0)-x&255;return e+n};G.prototype.writeIntBE=function(t,e,n,o){if(t=+t,e=e>>>0,!o){let b=Math.pow(2,8*n-1);pr(this,t,e,n,b-1,-b)}let f=n-1,h=1,x=0;for(this[e+f]=t&255;--f>=0&&(h*=256);)t<0&&x===0&&this[e+f+1]!==0&&(x=1),this[e+f]=(t/h>>0)-x&255;return e+n};G.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};G.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};G.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};G.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};G.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};G.prototype.writeBigInt64LE=nn(function(t,e=0){return ef(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});G.prototype.writeBigInt64BE=nn(function(t,e=0){return rf(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nf(r,t,e,n,o,f){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function of(r,t,e,n,o){return t=+t,e=e>>>0,o||nf(r,t,e,4,34028234663852886e22,-34028234663852886e22),Vn.write(r,t,e,n,23,4),e+4}G.prototype.writeFloatLE=function(t,e,n){return of(this,t,e,!0,n)};G.prototype.writeFloatBE=function(t,e,n){return of(this,t,e,!1,n)};function sf(r,t,e,n,o){return t=+t,e=e>>>0,o||nf(r,t,e,8,17976931348623157e292,-17976931348623157e292),Vn.write(r,t,e,n,52,8),e+8}G.prototype.writeDoubleLE=function(t,e,n){return sf(this,t,e,!0,n)};G.prototype.writeDoubleBE=function(t,e,n){return sf(this,t,e,!1,n)};G.prototype.copy=function(t,e,n,o){if(!G.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let f;if(typeof t=="number")for(f=e;f2**32?o=Ya(String(e)):typeof e=="bigint"&&(o=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(o=Ya(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n},RangeError);function Ya(r){let t="",e=r.length,n=r[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function bh(r,t,e){Gn(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&di(t,r.length-(e+1))}function af(r,t,e,n,o,f){if(r>e||r3?t===0||t===BigInt(0)?x=`>= 0${h} and < 2${h} ** ${(f+1)*8}${h}`:x=`>= -(2${h} ** ${(f+1)*8-1}${h}) and < 2 ** ${(f+1)*8-1}${h}`:x=`>= ${t}${h} and <= ${e}${h}`,new $n.ERR_OUT_OF_RANGE("value",x,r)}bh(n,o,f)}function Gn(r,t){if(typeof r!="number")throw new $n.ERR_INVALID_ARG_TYPE(t,"number",r)}function di(r,t,e){throw Math.floor(r)!==r?(Gn(r,e),new $n.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new $n.ERR_BUFFER_OUT_OF_BOUNDS:new $n.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var xh=/[^+/0-9A-Za-z-_]/g;function vh(r){if(r=r.split("=")[0],r=r.trim().replace(xh,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function ss(r,t){t=t||1/0;let e,n=r.length,o=null,f=[];for(let h=0;h55295&&e<57344){if(!o){if(e>56319){(t-=3)>-1&&f.push(239,191,189);continue}else if(h+1===n){(t-=3)>-1&&f.push(239,191,189);continue}o=e;continue}if(e<56320){(t-=3)>-1&&f.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(t-=3)>-1&&f.push(239,191,189);if(o=null,e<128){if((t-=1)<0)break;f.push(e)}else if(e<2048){if((t-=2)<0)break;f.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;f.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;f.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return f}function kh(r){let t=[];for(let e=0;e>8,o=e%256,f.push(o),f.push(n);return f}function ff(r){return ns.toByteArray(vh(r))}function ji(r,t,e,n){let o;for(o=0;o=t.length||o>=r.length);++o)t[o+e]=r[o];return o}function Kr(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function cs(r){return r!==r}var Bh=function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let o=0;o<16;++o)t[n+o]=r[e]+r[o]}return t}();function nn(r){return typeof BigInt>"u"?_h:r}function _h(){throw new Error("BigInt not supported")}});var V=$e(()=>{"use strict";var uf=D(An());globalThis.Buffer=uf.Buffer});var np,Yi,cf=ae(()=>{"use strict";np=D(V()),Yi=class extends Error{constructor(){super(...arguments);this.name="AbortError"}}});async function hf(r){try{let t=await r(),e=typeof t=="string"?t:JSON.stringify(t);Lit.Actions.setResponse({response:e})}catch(t){if(t instanceof Yi)return;Lit.Actions.setResponse({response:`Error: ${t.message}`})}}var sp,lf=ae(()=>{"use strict";sp=D(V());cf()});var fp,df,pf=ae(()=>{"use strict";fp=D(V()),df="lit_"});async function hs({accessControlConditions:r,privateKey:t,publicKey:e}){let{ciphertext:n,dataToEncryptHash:o}=await Lit.Actions.encrypt({accessControlConditions:r,to_encrypt:new TextEncoder().encode(df+t)});return{ciphertext:n,dataToEncryptHash:o,publicKey:e}}var hp,yf=ae(()=>{"use strict";hp=D(V());pf()});function gf(){let r=ethers.Wallet.createRandom();return{privateKey:r.privateKey.toString(),publicKey:r.publicKey}}var dp,mf=ae(()=>{"use strict";dp=D(V())});async function Eh({privateKey:r,messageToSign:t}){try{let e=new ethers.Wallet(r);return{signature:await e.signMessage(t),walletAddress:e.address}}catch(e){throw e instanceof Error?new Error(`When signing message - ${e.message}`):new Error(`An unexpected error occurred: ${e}`)}}function Ah({messageToSign:r,signature:t}){try{return ethers.utils.verifyMessage(r,t)}catch(e){throw new Error(`When validating signed Ethereum message is valid: ${e.message}`)}}async function wf({privateKey:r,messageToSign:t}){let{signature:e,walletAddress:n}=await Eh({privateKey:r,messageToSign:t});if(Ah({messageToSign:t,signature:e})!==n)throw new Error("Recovered address from verifyMessage doesn\'t match the wallet address");return e}var yp,bf=ae(()=>{"use strict";yp=D(V())});function pi(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function Mh(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function on(r,...t){if(!Mh(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${r.length}`)}function xf(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");pi(r.outputLen),pi(r.blockLen)}function Vr(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Zi(r,t){on(r);let e=t.outputLen;if(r.length{mp=D(V(),1)});var bp,Mn,vf=ae(()=>{bp=D(V(),1),Mn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function ds(r){for(let t=0;tr().update(an(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Bf(r){let t=(n,o)=>r(o).update(an(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function Xi(r=32){if(Mn&&typeof Mn.getRandomValues=="function")return Mn.getRandomValues(new Uint8Array(r));if(Mn&&typeof Mn.randomBytes=="function")return Mn.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}var Bp,kf,Ji,Lr,ls,Ih,sn,kp,fn=ae(()=>{Bp=D(V(),1);vf();yi();kf=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),Ji=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Lr=(r,t)=>r<<32-t|r>>>t,ls=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Ih=r=>r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255;sn=class{clone(){return this._cloneInto()}},kp={}.toString});function Lh(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),f=BigInt(4294967295),h=Number(e>>o&f),x=Number(e&f),b=n?4:0,E=n?0:4;r.setUint32(t+b,h,n),r.setUint32(t+E,x,n)}var Mp,_f,Ef,Zn,ys=ae(()=>{Mp=D(V(),1);yi();fn();_f=(r,t,e)=>r&t^~r&e,Ef=(r,t,e)=>r&t^r&e^t&e,Zn=class extends sn{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Ji(this.buffer)}update(t){Vr(this);let{view:e,buffer:n,blockLen:o}=this;t=an(t);let f=t.length;for(let h=0;ho-h&&(this.process(n,0),h=0);for(let M=h;M_.length)throw new Error("_sha2: outputLen bigger than state");for(let M=0;M>gs&Qi)}:{h:Number(r>>gs&Qi)|0,l:Number(r&Qi)|0}}function ms(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var Lp,Qi,gs,Rh,Th,Ph,Ch,Uh,Oh,Nh,zh,Kh,ws,bs,xs,vs,Fh,Dh,Wh,Hh,$h,Vh,Gh,ge,ks=ae(()=>{Lp=D(V(),1),Qi=BigInt(4294967295),gs=BigInt(32);Rh=(r,t)=>BigInt(r>>>0)<>>0),Th=(r,t,e)=>r>>>e,Ph=(r,t,e)=>r<<32-e|t>>>e,Ch=(r,t,e)=>r>>>e|t<<32-e,Uh=(r,t,e)=>r<<32-e|t>>>e,Oh=(r,t,e)=>r<<64-e|t>>>e-32,Nh=(r,t,e)=>r>>>e-32|t<<64-e,zh=(r,t)=>t,Kh=(r,t)=>r,ws=(r,t,e)=>r<>>32-e,bs=(r,t,e)=>t<>>32-e,xs=(r,t,e)=>t<>>64-e,vs=(r,t,e)=>r<>>64-e;Fh=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Dh=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Wh=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Hh=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,$h=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Vh=(r,t,e,n,o,f)=>t+e+n+o+f+(r/2**32|0)|0,Gh={fromBig:Af,split:ms,toBig:Rh,shrSH:Th,shrSL:Ph,rotrSH:Ch,rotrSL:Uh,rotrBH:Oh,rotrBL:Nh,rotr32H:zh,rotr32L:Kh,rotlSH:ws,rotlSL:bs,rotlBH:xs,rotlBL:vs,add:qh,add3L:Fh,add3H:Dh,add4L:Wh,add4H:Hh,add5H:Vh,add5L:$h},ge=Gh});var Up,jh,Yh,un,cn,Ss,Mf,If=ae(()=>{Up=D(V(),1);ys();ks();fn();[jh,Yh]=(()=>ge.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))))(),un=new Uint32Array(80),cn=new Uint32Array(80),Ss=class extends Zn{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:f,Cl:h,Dh:x,Dl:b,Eh:E,El:_,Fh:M,Fl:C,Gh:N,Gl:ft,Hh:W,Hl:P}=this;return[t,e,n,o,f,h,x,b,E,_,M,C,N,ft,W,P]}set(t,e,n,o,f,h,x,b,E,_,M,C,N,ft,W,P){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=f|0,this.Cl=h|0,this.Dh=x|0,this.Dl=b|0,this.Eh=E|0,this.El=_|0,this.Fh=M|0,this.Fl=C|0,this.Gh=N|0,this.Gl=ft|0,this.Hh=W|0,this.Hl=P|0}process(t,e){for(let j=0;j<16;j++,e+=4)un[j]=t.getUint32(e),cn[j]=t.getUint32(e+=4);for(let j=16;j<80;j++){let rt=un[j-15]|0,xt=cn[j-15]|0,ot=ge.rotrSH(rt,xt,1)^ge.rotrSH(rt,xt,8)^ge.shrSH(rt,xt,7),pt=ge.rotrSL(rt,xt,1)^ge.rotrSL(rt,xt,8)^ge.shrSL(rt,xt,7),St=un[j-2]|0,At=cn[j-2]|0,Ee=ge.rotrSH(St,At,19)^ge.rotrBH(St,At,61)^ge.shrSH(St,At,6),ct=ge.rotrSL(St,At,19)^ge.rotrBL(St,At,61)^ge.shrSL(St,At,6),Lt=ge.add4L(pt,ct,cn[j-7],cn[j-16]),g=ge.add4H(Lt,ot,Ee,un[j-7],un[j-16]);un[j]=g|0,cn[j]=Lt|0}let{Ah:n,Al:o,Bh:f,Bl:h,Ch:x,Cl:b,Dh:E,Dl:_,Eh:M,El:C,Fh:N,Fl:ft,Gh:W,Gl:P,Hh:J,Hl:it}=this;for(let j=0;j<80;j++){let rt=ge.rotrSH(M,C,14)^ge.rotrSH(M,C,18)^ge.rotrBH(M,C,41),xt=ge.rotrSL(M,C,14)^ge.rotrSL(M,C,18)^ge.rotrBL(M,C,41),ot=M&N^~M&W,pt=C&ft^~C&P,St=ge.add5L(it,xt,pt,Yh[j],cn[j]),At=ge.add5H(St,J,rt,ot,jh[j],un[j]),Ee=St|0,ct=ge.rotrSH(n,o,28)^ge.rotrBH(n,o,34)^ge.rotrBH(n,o,39),Lt=ge.rotrSL(n,o,28)^ge.rotrBL(n,o,34)^ge.rotrBL(n,o,39),g=n&f^n&x^f&x,i=o&h^o&b^h&b;J=W|0,it=P|0,W=N|0,P=ft|0,N=M|0,ft=C|0,{h:M,l:C}=ge.add(E|0,_|0,At|0,Ee|0),E=x|0,_=b|0,x=f|0,b=h|0,f=n|0,h=o|0;let a=ge.add3L(Ee,Lt,i);n=ge.add3H(a,At,ct,g),o=a|0}({h:n,l:o}=ge.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:f,l:h}=ge.add(this.Bh|0,this.Bl|0,f|0,h|0),{h:x,l:b}=ge.add(this.Ch|0,this.Cl|0,x|0,b|0),{h:E,l:_}=ge.add(this.Dh|0,this.Dl|0,E|0,_|0),{h:M,l:C}=ge.add(this.Eh|0,this.El|0,M|0,C|0),{h:N,l:ft}=ge.add(this.Fh|0,this.Fl|0,N|0,ft|0),{h:W,l:P}=ge.add(this.Gh|0,this.Gl|0,W|0,P|0),{h:J,l:it}=ge.add(this.Hh|0,this.Hl|0,J|0,it|0),this.set(n,o,f,h,x,b,E,_,M,C,N,ft,W,P,J,it)}roundClean(){un.fill(0),cn.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Mf=Yn(()=>new Ss)});var eo={};Ka(eo,{aInRange:()=>yr,abool:()=>Rr,abytes:()=>Jn,bitGet:()=>e0,bitLen:()=>Ms,bitMask:()=>mi,bitSet:()=>r0,bytesToHex:()=>jr,bytesToNumberBE:()=>Yr,bytesToNumberLE:()=>ln,concatBytes:()=>Zr,createHmacDrbg:()=>Is,ensureBytes:()=>De,equalBytes:()=>Qh,hexToBytes:()=>Ln,hexToNumber:()=>As,inRange:()=>gi,isBytes:()=>hn,memoized:()=>Tn,notImplemented:()=>i0,numberToBytesBE:()=>dn,numberToBytesLE:()=>Rn,numberToHexUnpadded:()=>In,numberToVarBytesBE:()=>Xh,utf8ToBytes:()=>t0,validateObject:()=>qr});function hn(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Jn(r){if(!hn(r))throw new Error("Uint8Array expected")}function Rr(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}function jr(r){Jn(r);let t="";for(let e=0;e=Gr._0&&r<=Gr._9)return r-Gr._0;if(r>=Gr._A&&r<=Gr._F)return r-(Gr._A-10);if(r>=Gr._a&&r<=Gr._f)return r-(Gr._a-10)}function Ln(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,f=0;oEs;r>>=to,t+=1);return t}function e0(r,t){return r>>BigInt(t)&to}function r0(r,t,e){return r|(e?to:Es)<{n.fill(1),o.fill(0),f=0},x=(...M)=>e(o,n,...M),b=(M=_s())=>{o=x(Rf([0]),M),n=x(),M.length!==0&&(o=x(Rf([1]),M),n=x())},E=()=>{if(f++>=1e3)throw new Error("drbg: tried 1000 values");let M=0,C=[];for(;M{h(),b(M);let N;for(;!(N=C(E()));)b();return h(),N}}function qr(r,t,e={}){let n=(o,f,h)=>{let x=n0[f];if(typeof x!="function")throw new Error(`Invalid validator "${f}", expected function`);let b=r[o];if(!(h&&b===void 0)&&!x(b,r))throw new Error(`Invalid param ${String(o)}=${b} (${typeof b}), expected ${f}`)};for(let[o,f]of Object.entries(t))n(o,f,!1);for(let[o,f]of Object.entries(e))n(o,f,!0);return r}function Tn(r){let t=new WeakMap;return(e,...n)=>{let o=t.get(e);if(o!==void 0)return o;let f=r(e,...n);return t.set(e,f),f}}var Op,Es,to,Zh,Jh,Gr,Bs,mi,_s,Rf,n0,i0,Pn=ae(()=>{Op=D(V(),1);Es=BigInt(0),to=BigInt(1),Zh=BigInt(2);Jh=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));Gr={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};Bs=r=>typeof r=="bigint"&&Es<=r;mi=r=>(Zh<new Uint8Array(r),Rf=r=>Uint8Array.from(r);n0={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||hn(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};i0=()=>{throw new Error("not implemented")}});function Re(r,t){let e=r%t;return e>=Ge?e:t+e}function f0(r,t,e){if(e<=Ge||t 0");if(e===Oe)return Ge;let n=Oe;for(;t>Ge;)t&Oe&&(n=n*r%e),r=r*r%e,t>>=Oe;return n}function Ne(r,t,e){let n=r;for(;t-- >Ge;)n*=n,n%=e;return n}function ro(r,t){if(r===Ge||t<=Ge)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=Re(r,t),n=t,o=Ge,f=Oe,h=Oe,x=Ge;for(;e!==Ge;){let E=n/e,_=n%e,M=o-h*E,C=f-x*E;n=e,e=_,o=h,f=x,h=M,x=C}if(n!==Oe)throw new Error("invert: does not exist");return Re(o,t)}function u0(r){let t=(r-Oe)/Cn,e,n,o;for(e=r-Oe,n=0;e%Cn===Ge;e/=Cn,n++);for(o=Cn;o(n[o]="function",n),t);return qr(r,e)}function l0(r,t,e){if(e 0");if(e===Ge)return r.ONE;if(e===Oe)return t;let n=r.ONE,o=t;for(;e>Ge;)e&Oe&&(n=r.mul(n,o)),o=r.sqr(o),e>>=Oe;return n}function d0(r,t){let e=new Array(t.length),n=t.reduce((f,h,x)=>r.is0(h)?f:(e[x]=f,r.mul(f,h)),r.ONE),o=r.inv(n);return t.reduceRight((f,h,x)=>r.is0(h)?f:(e[x]=r.mul(f,e[x]),r.mul(f,h)),o),e}function Ts(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function pn(r,t,e=!1,n={}){if(r<=Ge)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:f}=Ts(r,t);if(f>2048)throw new Error("Field lengths over 2048 bytes are not supported");let h=c0(r),x=Object.freeze({ORDER:r,BITS:o,BYTES:f,MASK:mi(o),ZERO:Ge,ONE:Oe,create:b=>Re(b,r),isValid:b=>{if(typeof b!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof b}`);return Ge<=b&&bb===Ge,isOdd:b=>(b&Oe)===Oe,neg:b=>Re(-b,r),eql:(b,E)=>b===E,sqr:b=>Re(b*b,r),add:(b,E)=>Re(b+E,r),sub:(b,E)=>Re(b-E,r),mul:(b,E)=>Re(b*E,r),pow:(b,E)=>l0(x,b,E),div:(b,E)=>Re(b*ro(E,r),r),sqrN:b=>b*b,addN:(b,E)=>b+E,subN:(b,E)=>b-E,mulN:(b,E)=>b*E,inv:b=>ro(b,r),sqrt:n.sqrt||(b=>h(x,b)),invertBatch:b=>d0(x,b),cmov:(b,E,_)=>_?E:b,toBytes:b=>e?Rn(b,f):dn(b,f),fromBytes:b=>{if(b.length!==f)throw new Error(`Fp.fromBytes: expected ${f}, got ${b.length}`);return e?ln(b):Yr(b)}});return Object.freeze(x)}function Uf(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function Ps(r){let t=Uf(r);return t+Math.ceil(t/2)}function Of(r,t,e=!1){let n=r.length,o=Uf(t),f=Ps(t);if(n<16||n1024)throw new Error(`expected ${f}-1024 bytes of input, got ${n}`);let h=e?Yr(r):ln(r),x=Re(h,t-Oe)+Oe;return e?Rn(x,o):dn(x,o)}var zp,Ge,Oe,Cn,o0,Ls,Tf,Pf,s0,a0,Cf,h0,Xn=ae(()=>{zp=D(V(),1);Pn();Ge=BigInt(0),Oe=BigInt(1),Cn=BigInt(2),o0=BigInt(3),Ls=BigInt(4),Tf=BigInt(5),Pf=BigInt(8),s0=BigInt(9),a0=BigInt(16);Cf=(r,t)=>(Re(r,t)&Oe)===Oe,h0=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function no(r,t){let e=(f,h)=>{let x=h.negate();return f?x:h},n=f=>{if(!Number.isSafeInteger(f)||f<=0||f>t)throw new Error(`Wrong window size=${f}, should be [1..${t}]`)},o=f=>{n(f);let h=Math.ceil(t/f)+1,x=2**(f-1);return{windows:h,windowSize:x}};return{constTimeNegate:e,unsafeLadder(f,h){let x=r.ZERO,b=f;for(;h>y0;)h&Cs&&(x=x.add(b)),b=b.double(),h>>=Cs;return x},precomputeWindow(f,h){let{windows:x,windowSize:b}=o(h),E=[],_=f,M=_;for(let C=0;C>=ft,J>E&&(J-=N,x+=Cs);let it=P,j=P+Math.abs(J)-1,rt=W%2!==0,xt=J<0;J===0?M=M.add(e(rt,h[it])):_=_.add(e(xt,h[j]))}return{p:_,f:M}},wNAFCached(f,h,x){let b=Nf.get(f)||1,E=Us.get(f);return E||(E=this.precomputeWindow(f,b),b!==1&&Us.set(f,x(E))),this.wNAF(b,E,h)},setWindowSize(f,h){n(h),Nf.set(f,h),Us.delete(f)}}}function io(r,t,e,n){if(!Array.isArray(e)||!Array.isArray(n)||n.length!==e.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((_,M)=>{if(!t.isValid(_))throw new Error(`wrong scalar at index ${M}`)}),e.forEach((_,M)=>{if(!(_ instanceof r))throw new Error(`wrong point at index ${M}`)});let o=Ms(BigInt(e.length)),f=o>12?o-3:o>4?o-2:o?2:1,h=(1<=0;_-=f){x.fill(r.ZERO);for(let C=0;C>BigInt(_)&BigInt(h));x[ft]=x[ft].add(e[C])}let M=r.ZERO;for(let C=x.length-1,N=r.ZERO;C>0;C--)N=N.add(x[C]),M=M.add(N);if(E=E.add(M),_!==0)for(let C=0;C{Dp=D(V(),1);Xn();Pn();y0=BigInt(0),Cs=BigInt(1),Us=new WeakMap,Nf=new WeakMap});function w0(r){let t=wi(r);return qr(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function zf(r){let t=w0(r),{Fp:e,n,prehash:o,hash:f,randomBytes:h,nByteLength:x,h:b}=t,E=oo<{try{return{isValid:!0,value:e.sqrt(u*e.inv(c))}}catch{return{isValid:!1,value:Tr}}}),N=t.adjustScalarBytes||(u=>u),ft=t.domain||((u,c,d)=>{if(Rr("phflag",d),c.length||d)throw new Error("Contexts/pre-hash are not supported");return u});function W(u,c){yr("coordinate "+u,c,Tr,E)}function P(u){if(!(u instanceof j))throw new Error("ExtendedPoint expected")}let J=Tn((u,c)=>{let{ex:d,ey:w,ez:v}=u,p=u.is0();c==null&&(c=p?g0:e.inv(v));let s=_(d*c),y=_(w*c),R=_(v*c);if(p)return{x:Tr,y:gr};if(R!==gr)throw new Error("invZ was invalid");return{x:s,y}}),it=Tn(u=>{let{a:c,d}=t;if(u.is0())throw new Error("bad point: ZERO");let{ex:w,ey:v,ez:p,et:s}=u,y=_(w*w),R=_(v*v),U=_(p*p),H=_(U*U),tt=_(y*c),st=_(U*_(tt+R)),dt=_(H+_(d*_(y*R)));if(st!==dt)throw new Error("bad point: equation left != right (1)");let be=_(w*v),ht=_(p*s);if(be!==ht)throw new Error("bad point: equation left != right (2)");return!0});class j{constructor(c,d,w,v){this.ex=c,this.ey=d,this.ez=w,this.et=v,W("x",c),W("y",d),W("z",w),W("t",v),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(c){if(c instanceof j)throw new Error("extended point not allowed");let{x:d,y:w}=c||{};return W("x",d),W("y",w),new j(d,w,gr,_(d*w))}static normalizeZ(c){let d=e.invertBatch(c.map(w=>w.ez));return c.map((w,v)=>w.toAffine(d[v])).map(j.fromAffine)}static msm(c,d){return io(j,M,c,d)}_setWindowSize(c){ot.setWindowSize(this,c)}assertValidity(){it(this)}equals(c){P(c);let{ex:d,ey:w,ez:v}=this,{ex:p,ey:s,ez:y}=c,R=_(d*y),U=_(p*v),H=_(w*y),tt=_(s*v);return R===U&&H===tt}is0(){return this.equals(j.ZERO)}negate(){return new j(_(-this.ex),this.ey,this.ez,_(-this.et))}double(){let{a:c}=t,{ex:d,ey:w,ez:v}=this,p=_(d*d),s=_(w*w),y=_(oo*_(v*v)),R=_(c*p),U=d+w,H=_(_(U*U)-p-s),tt=R+s,st=tt-y,dt=R-s,be=_(H*st),ht=_(tt*dt),Bt=_(H*dt),Xe=_(st*tt);return new j(be,ht,Xe,Bt)}add(c){P(c);let{a:d,d:w}=t,{ex:v,ey:p,ez:s,et:y}=this,{ex:R,ey:U,ez:H,et:tt}=c;if(d===BigInt(-1)){let Zt=_((p-v)*(U+R)),Ht=_((p+v)*(U-R)),br=_(Ht-Zt);if(br===Tr)return this.double();let Dt=_(s*oo*tt),$t=_(y*oo*H),xr=$t+Dt,Vt=Ht+Zt,Gt=$t-Dt,Nr=_(xr*br),ie=_(Vt*Gt),Jt=_(xr*Gt),Mr=_(br*Vt);return new j(Nr,ie,Mr,Jt)}let st=_(v*R),dt=_(p*U),be=_(y*w*tt),ht=_(s*H),Bt=_((v+p)*(R+U)-st-dt),Xe=ht-be,qt=ht+be,Ft=_(dt-d*st),Or=_(Bt*Xe),ee=_(qt*Ft),Nt=_(Bt*Ft),kr=_(Xe*qt);return new j(Or,ee,kr,Nt)}subtract(c){return this.add(c.negate())}wNAF(c){return ot.wNAFCached(this,c,j.normalizeZ)}multiply(c){let d=c;yr("scalar",d,gr,n);let{p:w,f:v}=this.wNAF(d);return j.normalizeZ([w,v])[0]}multiplyUnsafe(c){let d=c;return yr("scalar",d,Tr,n),d===Tr?xt:this.equals(xt)||d===gr?this:this.equals(rt)?this.wNAF(d).p:ot.unsafeLadder(this,d)}isSmallOrder(){return this.multiplyUnsafe(b).is0()}isTorsionFree(){return ot.unsafeLadder(this,n).is0()}toAffine(c){return J(this,c)}clearCofactor(){let{h:c}=t;return c===gr?this:this.multiplyUnsafe(c)}static fromHex(c,d=!1){let{d:w,a:v}=t,p=e.BYTES;c=De("pointHex",c,p),Rr("zip215",d);let s=c.slice(),y=c[p-1];s[p-1]=y&-129;let R=ln(s),U=d?E:e.ORDER;yr("pointHex.y",R,Tr,U);let H=_(R*R),tt=_(H-gr),st=_(w*H-v),{isValid:dt,value:be}=C(tt,st);if(!dt)throw new Error("Point.fromHex: invalid y coordinate");let ht=(be&gr)===gr,Bt=(y&128)!==0;if(!d&&be===Tr&&Bt)throw new Error("Point.fromHex: x=0 and x_0=1");return Bt!==ht&&(be=_(-be)),j.fromAffine({x:be,y:R})}static fromPrivateKey(c){return At(c).point}toRawBytes(){let{x:c,y:d}=this.toAffine(),w=Rn(d,e.BYTES);return w[w.length-1]|=c&gr?128:0,w}toHex(){return jr(this.toRawBytes())}}j.BASE=new j(t.Gx,t.Gy,gr,_(t.Gx*t.Gy)),j.ZERO=new j(Tr,gr,gr,Tr);let{BASE:rt,ZERO:xt}=j,ot=no(j,x*8);function pt(u){return Re(u,n)}function St(u){return pt(ln(u))}function At(u){let c=x;u=De("private key",u,c);let d=De("hashed private key",f(u),2*c),w=N(d.slice(0,c)),v=d.slice(c,2*c),p=St(w),s=rt.multiply(p),y=s.toRawBytes();return{head:w,prefix:v,scalar:p,point:s,pointBytes:y}}function Ee(u){return At(u).pointBytes}function ct(u=new Uint8Array,...c){let d=Zr(...c);return St(f(ft(d,De("context",u),!!o)))}function Lt(u,c,d={}){u=De("message",u),o&&(u=o(u));let{prefix:w,scalar:v,pointBytes:p}=At(c),s=ct(d.context,w,u),y=rt.multiply(s).toRawBytes(),R=ct(d.context,y,p,u),U=pt(s+R*v);yr("signature.s",U,Tr,n);let H=Zr(y,Rn(U,e.BYTES));return De("result",H,x*2)}let g=m0;function i(u,c,d,w=g){let{context:v,zip215:p}=w,s=e.BYTES;u=De("signature",u,2*s),c=De("message",c),p!==void 0&&Rr("zip215",p),o&&(c=o(c));let y=ln(u.slice(s,2*s)),R,U,H;try{R=j.fromHex(d,p),U=j.fromHex(u.slice(0,s),p),H=rt.multiplyUnsafe(y)}catch{return!1}if(!p&&R.isSmallOrder())return!1;let tt=ct(v,U.toRawBytes(),R.toRawBytes(),c);return U.add(R.multiplyUnsafe(tt)).subtract(H).clearCofactor().equals(j.ZERO)}return rt._setWindowSize(8),{CURVE:t,getPublicKey:Ee,sign:Lt,verify:i,ExtendedPoint:j,utils:{getExtendedPublicKey:At,randomPrivateKey:()=>h(e.BYTES),precompute(u=8,c=j.BASE){return c._setWindowSize(u),c.multiply(BigInt(3)),c}}}}var Gp,Tr,gr,oo,g0,m0,Kf=ae(()=>{Gp=D(V(),1);Os();Xn();Pn();Pn();Tr=BigInt(0),gr=BigInt(1),oo=BigInt(2),g0=BigInt(8),m0={zip215:!0}});function k0(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),f=Ns,x=r*r%f*r%f,b=Ne(x,Ff,f)*x%f,E=Ne(b,b0,f)*r%f,_=Ne(E,x0,f)*E%f,M=Ne(_,t,f)*_%f,C=Ne(M,e,f)*M%f,N=Ne(C,n,f)*C%f,ft=Ne(N,o,f)*N%f,W=Ne(ft,o,f)*N%f,P=Ne(W,t,f)*_%f;return{pow_p_5_8:Ne(P,Ff,f)*r%f,b2:x}}function S0(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function B0(r,t){let e=Ns,n=Re(t*t*t,e),o=Re(n*n*t,e),f=k0(r*o).pow_p_5_8,h=Re(r*n*f,e),x=Re(t*h*h,e),b=h,E=Re(h*qf,e),_=x===r,M=x===Re(-r,e),C=x===Re(-r*qf,e);return _&&(h=b),(M||C)&&(h=E),Cf(h,e)&&(h=Re(-h,e)),{isValid:_||M,value:h}}var ry,Ns,qf,Qp,b0,Ff,ty,x0,v0,_0,E0,Un,Df=ae(()=>{ry=D(V(),1);If();fn();Kf();Xn();Ns=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),qf=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Qp=BigInt(0),b0=BigInt(1),Ff=BigInt(2),ty=BigInt(3),x0=BigInt(5),v0=BigInt(8);_0=(()=>pn(Ns,void 0,!0))(),E0=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:_0,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:v0,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Mf,randomBytes:Xi,adjustScalarBytes:S0,uvRatio:B0}))(),Un=(()=>zf(E0))()});var zs=$e(()=>{var oy=D(V())});var Hf=$e((Wf,Ks)=>{var sy=D(V());(function(r,t){"use strict";function e(g,i){if(!g)throw new Error(i||"Assertion failed")}function n(g,i){g.super_=i;var a=function(){};a.prototype=i.prototype,g.prototype=new a,g.prototype.constructor=g}function o(g,i,a){if(o.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((i==="le"||i==="be")&&(a=i,i=10),this._init(g||0,i||10,a||"be"))}typeof r=="object"?r.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var f;try{typeof window<"u"&&typeof window.Buffer<"u"?f=window.Buffer:f=zs().Buffer}catch{}o.isBN=function(i){return i instanceof o?!0:i!==null&&typeof i=="object"&&i.constructor.wordSize===o.wordSize&&Array.isArray(i.words)},o.max=function(i,a){return i.cmp(a)>0?i:a},o.min=function(i,a){return i.cmp(a)<0?i:a},o.prototype._init=function(i,a,u){if(typeof i=="number")return this._initNumber(i,a,u);if(typeof i=="object")return this._initArray(i,a,u);a==="hex"&&(a=16),e(a===(a|0)&&a>=2&&a<=36),i=i.toString().replace(/\\s+/g,"");var c=0;i[0]==="-"&&(c++,this.negative=1),c=0;c-=3)w=i[c]|i[c-1]<<8|i[c-2]<<16,this.words[d]|=w<>>26-v&67108863,v+=24,v>=26&&(v-=26,d++);else if(u==="le")for(c=0,d=0;c>>26-v&67108863,v+=24,v>=26&&(v-=26,d++);return this._strip()};function h(g,i){var a=g.charCodeAt(i);if(a>=48&&a<=57)return a-48;if(a>=65&&a<=70)return a-55;if(a>=97&&a<=102)return a-87;e(!1,"Invalid character in "+g)}function x(g,i,a){var u=h(g,a);return a-1>=i&&(u|=h(g,a-1)<<4),u}o.prototype._parseHex=function(i,a,u){this.length=Math.ceil((i.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)v=x(i,a,c)<=18?(d-=18,w+=1,this.words[w]|=v>>>26):d+=8;else{var p=i.length-a;for(c=p%2===0?a+1:a;c=18?(d-=18,w+=1,this.words[w]|=v>>>26):d+=8}this._strip()};function b(g,i,a,u){for(var c=0,d=0,w=Math.min(g.length,a),v=i;v=49?d=p-49+10:p>=17?d=p-17+10:d=p,e(p>=0&&d1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=_}catch{o.prototype.inspect=_}else o.prototype.inspect=_;function _(){return(this.red?""}var M=["","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"],C=[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],N=[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];o.prototype.toString=function(i,a){i=i||10,a=a|0||1;var u;if(i===16||i==="hex"){u="";for(var c=0,d=0,w=0;w>>24-c&16777215,c+=2,c>=26&&(c-=26,w--),d!==0||w!==this.length-1?u=M[6-p.length]+p+u:u=p+u}for(d!==0&&(u=d.toString(16)+u);u.length%a!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(i===(i|0)&&i>=2&&i<=36){var s=C[i],y=N[i];u="";var R=this.clone();for(R.negative=0;!R.isZero();){var U=R.modrn(y).toString(i);R=R.idivn(y),R.isZero()?u=U+u:u=M[s-U.length]+U+u}for(this.isZero()&&(u="0"+u);u.length%a!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var i=this.words[0];return this.length===2?i+=this.words[1]*67108864:this.length===3&&this.words[2]===1?i+=4503599627370496+this.words[1]*67108864:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-i:i},o.prototype.toJSON=function(){return this.toString(16,2)},f&&(o.prototype.toBuffer=function(i,a){return this.toArrayLike(f,i,a)}),o.prototype.toArray=function(i,a){return this.toArrayLike(Array,i,a)};var ft=function(i,a){return i.allocUnsafe?i.allocUnsafe(a):new i(a)};o.prototype.toArrayLike=function(i,a,u){this._strip();var c=this.byteLength(),d=u||Math.max(1,c);e(c<=d,"byte array longer than desired length"),e(d>0,"Requested array length <= 0");var w=ft(i,d),v=a==="le"?"LE":"BE";return this["_toArrayLike"+v](w,c),w},o.prototype._toArrayLikeLE=function(i,a){for(var u=0,c=0,d=0,w=0;d>8&255),u>16&255),w===6?(u>24&255),c=0,w=0):(c=v>>>24,w+=2)}if(u=0&&(i[u--]=v>>8&255),u>=0&&(i[u--]=v>>16&255),w===6?(u>=0&&(i[u--]=v>>24&255),c=0,w=0):(c=v>>>24,w+=2)}if(u>=0)for(i[u--]=c;u>=0;)i[u--]=0},Math.clz32?o.prototype._countBits=function(i){return 32-Math.clz32(i)}:o.prototype._countBits=function(i){var a=i,u=0;return a>=4096&&(u+=13,a>>>=13),a>=64&&(u+=7,a>>>=7),a>=8&&(u+=4,a>>>=4),a>=2&&(u+=2,a>>>=2),u+a},o.prototype._zeroBits=function(i){if(i===0)return 26;var a=i,u=0;return a&8191||(u+=13,a>>>=13),a&127||(u+=7,a>>>=7),a&15||(u+=4,a>>>=4),a&3||(u+=2,a>>>=2),a&1||u++,u},o.prototype.bitLength=function(){var i=this.words[this.length-1],a=this._countBits(i);return(this.length-1)*26+a};function W(g){for(var i=new Array(g.bitLength()),a=0;a>>c&1}return i}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var i=0,a=0;ai.length?this.clone().ior(i):i.clone().ior(this)},o.prototype.uor=function(i){return this.length>i.length?this.clone().iuor(i):i.clone().iuor(this)},o.prototype.iuand=function(i){var a;this.length>i.length?a=i:a=this;for(var u=0;ui.length?this.clone().iand(i):i.clone().iand(this)},o.prototype.uand=function(i){return this.length>i.length?this.clone().iuand(i):i.clone().iuand(this)},o.prototype.iuxor=function(i){var a,u;this.length>i.length?(a=this,u=i):(a=i,u=this);for(var c=0;ci.length?this.clone().ixor(i):i.clone().ixor(this)},o.prototype.uxor=function(i){return this.length>i.length?this.clone().iuxor(i):i.clone().iuxor(this)},o.prototype.inotn=function(i){e(typeof i=="number"&&i>=0);var a=Math.ceil(i/26)|0,u=i%26;this._expand(a),u>0&&a--;for(var c=0;c0&&(this.words[c]=~this.words[c]&67108863>>26-u),this._strip()},o.prototype.notn=function(i){return this.clone().inotn(i)},o.prototype.setn=function(i,a){e(typeof i=="number"&&i>=0);var u=i/26|0,c=i%26;return this._expand(u+1),a?this.words[u]=this.words[u]|1<i.length?(u=this,c=i):(u=i,c=this);for(var d=0,w=0;w>>26;for(;d!==0&&w>>26;if(this.length=u.length,d!==0)this.words[this.length]=d,this.length++;else if(u!==this)for(;wi.length?this.clone().iadd(i):i.clone().iadd(this)},o.prototype.isub=function(i){if(i.negative!==0){i.negative=0;var a=this.iadd(i);return i.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(i),this.negative=1,this._normSign();var u=this.cmp(i);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var c,d;u>0?(c=this,d=i):(c=i,d=this);for(var w=0,v=0;v>26,this.words[v]=a&67108863;for(;w!==0&&v>26,this.words[v]=a&67108863;if(w===0&&v>>26,R=p&67108863,U=Math.min(s,i.length-1),H=Math.max(0,s-g.length+1);H<=U;H++){var tt=s-H|0;c=g.words[tt]|0,d=i.words[H]|0,w=c*d+R,y+=w/67108864|0,R=w&67108863}a.words[s]=R|0,p=y|0}return p!==0?a.words[s]=p|0:a.length--,a._strip()}var J=function(i,a,u){var c=i.words,d=a.words,w=u.words,v=0,p,s,y,R=c[0]|0,U=R&8191,H=R>>>13,tt=c[1]|0,st=tt&8191,dt=tt>>>13,be=c[2]|0,ht=be&8191,Bt=be>>>13,Xe=c[3]|0,qt=Xe&8191,Ft=Xe>>>13,Or=c[4]|0,ee=Or&8191,Nt=Or>>>13,kr=c[5]|0,Zt=kr&8191,Ht=kr>>>13,br=c[6]|0,Dt=br&8191,$t=br>>>13,xr=c[7]|0,Vt=xr&8191,Gt=xr>>>13,Nr=c[8]|0,ie=Nr&8191,Jt=Nr>>>13,Mr=c[9]|0,re=Mr&8191,Xt=Mr>>>13,Sr=d[0]|0,Qt=Sr&8191,ne=Sr>>>13,Ir=d[1]|0,te=Ir&8191,oe=Ir>>>13,rn=d[2]|0,he=rn&8191,le=rn>>>13,hr=d[3]|0,Wt=hr&8191,jt=hr>>>13,Hr=d[4]|0,se=Hr&8191,ue=Hr>>>13,Bn=d[5]|0,Mt=Bn&8191,ce=Bn>>>13,m=d[6]|0,S=m&8191,k=m>>>13,l=d[7]|0,B=l&8191,I=l>>>13,T=d[8]|0,O=T&8191,$=T>>>13,_t=d[9]|0,X=_t&8191,yt=_t>>>13;u.negative=i.negative^a.negative,u.length=19,p=Math.imul(U,Qt),s=Math.imul(U,ne),s=s+Math.imul(H,Qt)|0,y=Math.imul(H,ne);var gt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(gt>>>26)|0,gt&=67108863,p=Math.imul(st,Qt),s=Math.imul(st,ne),s=s+Math.imul(dt,Qt)|0,y=Math.imul(dt,ne),p=p+Math.imul(U,te)|0,s=s+Math.imul(U,oe)|0,s=s+Math.imul(H,te)|0,y=y+Math.imul(H,oe)|0;var It=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(It>>>26)|0,It&=67108863,p=Math.imul(ht,Qt),s=Math.imul(ht,ne),s=s+Math.imul(Bt,Qt)|0,y=Math.imul(Bt,ne),p=p+Math.imul(st,te)|0,s=s+Math.imul(st,oe)|0,s=s+Math.imul(dt,te)|0,y=y+Math.imul(dt,oe)|0,p=p+Math.imul(U,he)|0,s=s+Math.imul(U,le)|0,s=s+Math.imul(H,he)|0,y=y+Math.imul(H,le)|0;var Rt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,p=Math.imul(qt,Qt),s=Math.imul(qt,ne),s=s+Math.imul(Ft,Qt)|0,y=Math.imul(Ft,ne),p=p+Math.imul(ht,te)|0,s=s+Math.imul(ht,oe)|0,s=s+Math.imul(Bt,te)|0,y=y+Math.imul(Bt,oe)|0,p=p+Math.imul(st,he)|0,s=s+Math.imul(st,le)|0,s=s+Math.imul(dt,he)|0,y=y+Math.imul(dt,le)|0,p=p+Math.imul(U,Wt)|0,s=s+Math.imul(U,jt)|0,s=s+Math.imul(H,Wt)|0,y=y+Math.imul(H,jt)|0;var Kt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,p=Math.imul(ee,Qt),s=Math.imul(ee,ne),s=s+Math.imul(Nt,Qt)|0,y=Math.imul(Nt,ne),p=p+Math.imul(qt,te)|0,s=s+Math.imul(qt,oe)|0,s=s+Math.imul(Ft,te)|0,y=y+Math.imul(Ft,oe)|0,p=p+Math.imul(ht,he)|0,s=s+Math.imul(ht,le)|0,s=s+Math.imul(Bt,he)|0,y=y+Math.imul(Bt,le)|0,p=p+Math.imul(st,Wt)|0,s=s+Math.imul(st,jt)|0,s=s+Math.imul(dt,Wt)|0,y=y+Math.imul(dt,jt)|0,p=p+Math.imul(U,se)|0,s=s+Math.imul(U,ue)|0,s=s+Math.imul(H,se)|0,y=y+Math.imul(H,ue)|0;var zt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(zt>>>26)|0,zt&=67108863,p=Math.imul(Zt,Qt),s=Math.imul(Zt,ne),s=s+Math.imul(Ht,Qt)|0,y=Math.imul(Ht,ne),p=p+Math.imul(ee,te)|0,s=s+Math.imul(ee,oe)|0,s=s+Math.imul(Nt,te)|0,y=y+Math.imul(Nt,oe)|0,p=p+Math.imul(qt,he)|0,s=s+Math.imul(qt,le)|0,s=s+Math.imul(Ft,he)|0,y=y+Math.imul(Ft,le)|0,p=p+Math.imul(ht,Wt)|0,s=s+Math.imul(ht,jt)|0,s=s+Math.imul(Bt,Wt)|0,y=y+Math.imul(Bt,jt)|0,p=p+Math.imul(st,se)|0,s=s+Math.imul(st,ue)|0,s=s+Math.imul(dt,se)|0,y=y+Math.imul(dt,ue)|0,p=p+Math.imul(U,Mt)|0,s=s+Math.imul(U,ce)|0,s=s+Math.imul(H,Mt)|0,y=y+Math.imul(H,ce)|0;var Tt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,p=Math.imul(Dt,Qt),s=Math.imul(Dt,ne),s=s+Math.imul($t,Qt)|0,y=Math.imul($t,ne),p=p+Math.imul(Zt,te)|0,s=s+Math.imul(Zt,oe)|0,s=s+Math.imul(Ht,te)|0,y=y+Math.imul(Ht,oe)|0,p=p+Math.imul(ee,he)|0,s=s+Math.imul(ee,le)|0,s=s+Math.imul(Nt,he)|0,y=y+Math.imul(Nt,le)|0,p=p+Math.imul(qt,Wt)|0,s=s+Math.imul(qt,jt)|0,s=s+Math.imul(Ft,Wt)|0,y=y+Math.imul(Ft,jt)|0,p=p+Math.imul(ht,se)|0,s=s+Math.imul(ht,ue)|0,s=s+Math.imul(Bt,se)|0,y=y+Math.imul(Bt,ue)|0,p=p+Math.imul(st,Mt)|0,s=s+Math.imul(st,ce)|0,s=s+Math.imul(dt,Mt)|0,y=y+Math.imul(dt,ce)|0,p=p+Math.imul(U,S)|0,s=s+Math.imul(U,k)|0,s=s+Math.imul(H,S)|0,y=y+Math.imul(H,k)|0;var Ct=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,p=Math.imul(Vt,Qt),s=Math.imul(Vt,ne),s=s+Math.imul(Gt,Qt)|0,y=Math.imul(Gt,ne),p=p+Math.imul(Dt,te)|0,s=s+Math.imul(Dt,oe)|0,s=s+Math.imul($t,te)|0,y=y+Math.imul($t,oe)|0,p=p+Math.imul(Zt,he)|0,s=s+Math.imul(Zt,le)|0,s=s+Math.imul(Ht,he)|0,y=y+Math.imul(Ht,le)|0,p=p+Math.imul(ee,Wt)|0,s=s+Math.imul(ee,jt)|0,s=s+Math.imul(Nt,Wt)|0,y=y+Math.imul(Nt,jt)|0,p=p+Math.imul(qt,se)|0,s=s+Math.imul(qt,ue)|0,s=s+Math.imul(Ft,se)|0,y=y+Math.imul(Ft,ue)|0,p=p+Math.imul(ht,Mt)|0,s=s+Math.imul(ht,ce)|0,s=s+Math.imul(Bt,Mt)|0,y=y+Math.imul(Bt,ce)|0,p=p+Math.imul(st,S)|0,s=s+Math.imul(st,k)|0,s=s+Math.imul(dt,S)|0,y=y+Math.imul(dt,k)|0,p=p+Math.imul(U,B)|0,s=s+Math.imul(U,I)|0,s=s+Math.imul(H,B)|0,y=y+Math.imul(H,I)|0;var Pt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,p=Math.imul(ie,Qt),s=Math.imul(ie,ne),s=s+Math.imul(Jt,Qt)|0,y=Math.imul(Jt,ne),p=p+Math.imul(Vt,te)|0,s=s+Math.imul(Vt,oe)|0,s=s+Math.imul(Gt,te)|0,y=y+Math.imul(Gt,oe)|0,p=p+Math.imul(Dt,he)|0,s=s+Math.imul(Dt,le)|0,s=s+Math.imul($t,he)|0,y=y+Math.imul($t,le)|0,p=p+Math.imul(Zt,Wt)|0,s=s+Math.imul(Zt,jt)|0,s=s+Math.imul(Ht,Wt)|0,y=y+Math.imul(Ht,jt)|0,p=p+Math.imul(ee,se)|0,s=s+Math.imul(ee,ue)|0,s=s+Math.imul(Nt,se)|0,y=y+Math.imul(Nt,ue)|0,p=p+Math.imul(qt,Mt)|0,s=s+Math.imul(qt,ce)|0,s=s+Math.imul(Ft,Mt)|0,y=y+Math.imul(Ft,ce)|0,p=p+Math.imul(ht,S)|0,s=s+Math.imul(ht,k)|0,s=s+Math.imul(Bt,S)|0,y=y+Math.imul(Bt,k)|0,p=p+Math.imul(st,B)|0,s=s+Math.imul(st,I)|0,s=s+Math.imul(dt,B)|0,y=y+Math.imul(dt,I)|0,p=p+Math.imul(U,O)|0,s=s+Math.imul(U,$)|0,s=s+Math.imul(H,O)|0,y=y+Math.imul(H,$)|0;var mt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(mt>>>26)|0,mt&=67108863,p=Math.imul(re,Qt),s=Math.imul(re,ne),s=s+Math.imul(Xt,Qt)|0,y=Math.imul(Xt,ne),p=p+Math.imul(ie,te)|0,s=s+Math.imul(ie,oe)|0,s=s+Math.imul(Jt,te)|0,y=y+Math.imul(Jt,oe)|0,p=p+Math.imul(Vt,he)|0,s=s+Math.imul(Vt,le)|0,s=s+Math.imul(Gt,he)|0,y=y+Math.imul(Gt,le)|0,p=p+Math.imul(Dt,Wt)|0,s=s+Math.imul(Dt,jt)|0,s=s+Math.imul($t,Wt)|0,y=y+Math.imul($t,jt)|0,p=p+Math.imul(Zt,se)|0,s=s+Math.imul(Zt,ue)|0,s=s+Math.imul(Ht,se)|0,y=y+Math.imul(Ht,ue)|0,p=p+Math.imul(ee,Mt)|0,s=s+Math.imul(ee,ce)|0,s=s+Math.imul(Nt,Mt)|0,y=y+Math.imul(Nt,ce)|0,p=p+Math.imul(qt,S)|0,s=s+Math.imul(qt,k)|0,s=s+Math.imul(Ft,S)|0,y=y+Math.imul(Ft,k)|0,p=p+Math.imul(ht,B)|0,s=s+Math.imul(ht,I)|0,s=s+Math.imul(Bt,B)|0,y=y+Math.imul(Bt,I)|0,p=p+Math.imul(st,O)|0,s=s+Math.imul(st,$)|0,s=s+Math.imul(dt,O)|0,y=y+Math.imul(dt,$)|0,p=p+Math.imul(U,X)|0,s=s+Math.imul(U,yt)|0,s=s+Math.imul(H,X)|0,y=y+Math.imul(H,yt)|0;var Et=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Et>>>26)|0,Et&=67108863,p=Math.imul(re,te),s=Math.imul(re,oe),s=s+Math.imul(Xt,te)|0,y=Math.imul(Xt,oe),p=p+Math.imul(ie,he)|0,s=s+Math.imul(ie,le)|0,s=s+Math.imul(Jt,he)|0,y=y+Math.imul(Jt,le)|0,p=p+Math.imul(Vt,Wt)|0,s=s+Math.imul(Vt,jt)|0,s=s+Math.imul(Gt,Wt)|0,y=y+Math.imul(Gt,jt)|0,p=p+Math.imul(Dt,se)|0,s=s+Math.imul(Dt,ue)|0,s=s+Math.imul($t,se)|0,y=y+Math.imul($t,ue)|0,p=p+Math.imul(Zt,Mt)|0,s=s+Math.imul(Zt,ce)|0,s=s+Math.imul(Ht,Mt)|0,y=y+Math.imul(Ht,ce)|0,p=p+Math.imul(ee,S)|0,s=s+Math.imul(ee,k)|0,s=s+Math.imul(Nt,S)|0,y=y+Math.imul(Nt,k)|0,p=p+Math.imul(qt,B)|0,s=s+Math.imul(qt,I)|0,s=s+Math.imul(Ft,B)|0,y=y+Math.imul(Ft,I)|0,p=p+Math.imul(ht,O)|0,s=s+Math.imul(ht,$)|0,s=s+Math.imul(Bt,O)|0,y=y+Math.imul(Bt,$)|0,p=p+Math.imul(st,X)|0,s=s+Math.imul(st,yt)|0,s=s+Math.imul(dt,X)|0,y=y+Math.imul(dt,yt)|0;var lt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(lt>>>26)|0,lt&=67108863,p=Math.imul(re,he),s=Math.imul(re,le),s=s+Math.imul(Xt,he)|0,y=Math.imul(Xt,le),p=p+Math.imul(ie,Wt)|0,s=s+Math.imul(ie,jt)|0,s=s+Math.imul(Jt,Wt)|0,y=y+Math.imul(Jt,jt)|0,p=p+Math.imul(Vt,se)|0,s=s+Math.imul(Vt,ue)|0,s=s+Math.imul(Gt,se)|0,y=y+Math.imul(Gt,ue)|0,p=p+Math.imul(Dt,Mt)|0,s=s+Math.imul(Dt,ce)|0,s=s+Math.imul($t,Mt)|0,y=y+Math.imul($t,ce)|0,p=p+Math.imul(Zt,S)|0,s=s+Math.imul(Zt,k)|0,s=s+Math.imul(Ht,S)|0,y=y+Math.imul(Ht,k)|0,p=p+Math.imul(ee,B)|0,s=s+Math.imul(ee,I)|0,s=s+Math.imul(Nt,B)|0,y=y+Math.imul(Nt,I)|0,p=p+Math.imul(qt,O)|0,s=s+Math.imul(qt,$)|0,s=s+Math.imul(Ft,O)|0,y=y+Math.imul(Ft,$)|0,p=p+Math.imul(ht,X)|0,s=s+Math.imul(ht,yt)|0,s=s+Math.imul(Bt,X)|0,y=y+Math.imul(Bt,yt)|0;var wt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(wt>>>26)|0,wt&=67108863,p=Math.imul(re,Wt),s=Math.imul(re,jt),s=s+Math.imul(Xt,Wt)|0,y=Math.imul(Xt,jt),p=p+Math.imul(ie,se)|0,s=s+Math.imul(ie,ue)|0,s=s+Math.imul(Jt,se)|0,y=y+Math.imul(Jt,ue)|0,p=p+Math.imul(Vt,Mt)|0,s=s+Math.imul(Vt,ce)|0,s=s+Math.imul(Gt,Mt)|0,y=y+Math.imul(Gt,ce)|0,p=p+Math.imul(Dt,S)|0,s=s+Math.imul(Dt,k)|0,s=s+Math.imul($t,S)|0,y=y+Math.imul($t,k)|0,p=p+Math.imul(Zt,B)|0,s=s+Math.imul(Zt,I)|0,s=s+Math.imul(Ht,B)|0,y=y+Math.imul(Ht,I)|0,p=p+Math.imul(ee,O)|0,s=s+Math.imul(ee,$)|0,s=s+Math.imul(Nt,O)|0,y=y+Math.imul(Nt,$)|0,p=p+Math.imul(qt,X)|0,s=s+Math.imul(qt,yt)|0,s=s+Math.imul(Ft,X)|0,y=y+Math.imul(Ft,yt)|0;var bt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(bt>>>26)|0,bt&=67108863,p=Math.imul(re,se),s=Math.imul(re,ue),s=s+Math.imul(Xt,se)|0,y=Math.imul(Xt,ue),p=p+Math.imul(ie,Mt)|0,s=s+Math.imul(ie,ce)|0,s=s+Math.imul(Jt,Mt)|0,y=y+Math.imul(Jt,ce)|0,p=p+Math.imul(Vt,S)|0,s=s+Math.imul(Vt,k)|0,s=s+Math.imul(Gt,S)|0,y=y+Math.imul(Gt,k)|0,p=p+Math.imul(Dt,B)|0,s=s+Math.imul(Dt,I)|0,s=s+Math.imul($t,B)|0,y=y+Math.imul($t,I)|0,p=p+Math.imul(Zt,O)|0,s=s+Math.imul(Zt,$)|0,s=s+Math.imul(Ht,O)|0,y=y+Math.imul(Ht,$)|0,p=p+Math.imul(ee,X)|0,s=s+Math.imul(ee,yt)|0,s=s+Math.imul(Nt,X)|0,y=y+Math.imul(Nt,yt)|0;var ut=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(ut>>>26)|0,ut&=67108863,p=Math.imul(re,Mt),s=Math.imul(re,ce),s=s+Math.imul(Xt,Mt)|0,y=Math.imul(Xt,ce),p=p+Math.imul(ie,S)|0,s=s+Math.imul(ie,k)|0,s=s+Math.imul(Jt,S)|0,y=y+Math.imul(Jt,k)|0,p=p+Math.imul(Vt,B)|0,s=s+Math.imul(Vt,I)|0,s=s+Math.imul(Gt,B)|0,y=y+Math.imul(Gt,I)|0,p=p+Math.imul(Dt,O)|0,s=s+Math.imul(Dt,$)|0,s=s+Math.imul($t,O)|0,y=y+Math.imul($t,$)|0,p=p+Math.imul(Zt,X)|0,s=s+Math.imul(Zt,yt)|0,s=s+Math.imul(Ht,X)|0,y=y+Math.imul(Ht,yt)|0;var q=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(q>>>26)|0,q&=67108863,p=Math.imul(re,S),s=Math.imul(re,k),s=s+Math.imul(Xt,S)|0,y=Math.imul(Xt,k),p=p+Math.imul(ie,B)|0,s=s+Math.imul(ie,I)|0,s=s+Math.imul(Jt,B)|0,y=y+Math.imul(Jt,I)|0,p=p+Math.imul(Vt,O)|0,s=s+Math.imul(Vt,$)|0,s=s+Math.imul(Gt,O)|0,y=y+Math.imul(Gt,$)|0,p=p+Math.imul(Dt,X)|0,s=s+Math.imul(Dt,yt)|0,s=s+Math.imul($t,X)|0,y=y+Math.imul($t,yt)|0;var F=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(F>>>26)|0,F&=67108863,p=Math.imul(re,B),s=Math.imul(re,I),s=s+Math.imul(Xt,B)|0,y=Math.imul(Xt,I),p=p+Math.imul(ie,O)|0,s=s+Math.imul(ie,$)|0,s=s+Math.imul(Jt,O)|0,y=y+Math.imul(Jt,$)|0,p=p+Math.imul(Vt,X)|0,s=s+Math.imul(Vt,yt)|0,s=s+Math.imul(Gt,X)|0,y=y+Math.imul(Gt,yt)|0;var Q=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Q>>>26)|0,Q&=67108863,p=Math.imul(re,O),s=Math.imul(re,$),s=s+Math.imul(Xt,O)|0,y=Math.imul(Xt,$),p=p+Math.imul(ie,X)|0,s=s+Math.imul(ie,yt)|0,s=s+Math.imul(Jt,X)|0,y=y+Math.imul(Jt,yt)|0;var Y=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Y>>>26)|0,Y&=67108863,p=Math.imul(re,X),s=Math.imul(re,yt),s=s+Math.imul(Xt,X)|0,y=Math.imul(Xt,yt);var Z=(v+p|0)+((s&8191)<<13)|0;return v=(y+(s>>>13)|0)+(Z>>>26)|0,Z&=67108863,w[0]=gt,w[1]=It,w[2]=Rt,w[3]=Kt,w[4]=zt,w[5]=Tt,w[6]=Ct,w[7]=Pt,w[8]=mt,w[9]=Et,w[10]=lt,w[11]=wt,w[12]=bt,w[13]=ut,w[14]=q,w[15]=F,w[16]=Q,w[17]=Y,w[18]=Z,v!==0&&(w[19]=v,u.length++),u};Math.imul||(J=P);function it(g,i,a){a.negative=i.negative^g.negative,a.length=g.length+i.length;for(var u=0,c=0,d=0;d>>26)|0,c+=w>>>26,w&=67108863}a.words[d]=v,u=w,w=c}return u!==0?a.words[d]=u:a.length--,a._strip()}function j(g,i,a){return it(g,i,a)}o.prototype.mulTo=function(i,a){var u,c=this.length+i.length;return this.length===10&&i.length===10?u=J(this,i,a):c<63?u=P(this,i,a):c<1024?u=it(this,i,a):u=j(this,i,a),u};function rt(g,i){this.x=g,this.y=i}rt.prototype.makeRBT=function(i){for(var a=new Array(i),u=o.prototype._countBits(i)-1,c=0;c>=1;return c},rt.prototype.permute=function(i,a,u,c,d,w){for(var v=0;v>>1)d++;return 1<>>13,u[2*w+1]=d&8191,d=d>>>13;for(w=2*a;w>=26,u+=d/67108864|0,u+=w>>>26,this.words[c]=w&67108863}return u!==0&&(this.words[c]=u,this.length++),a?this.ineg():this},o.prototype.muln=function(i){return this.clone().imuln(i)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(i){var a=W(i);if(a.length===0)return new o(1);for(var u=this,c=0;c=0);var a=i%26,u=(i-a)/26,c=67108863>>>26-a<<26-a,d;if(a!==0){var w=0;for(d=0;d>>26-a}w&&(this.words[d]=w,this.length++)}if(u!==0){for(d=this.length-1;d>=0;d--)this.words[d+u]=this.words[d];for(d=0;d=0);var c;a?c=(a-a%26)/26:c=0;var d=i%26,w=Math.min((i-d)/26,this.length),v=67108863^67108863>>>d<w)for(this.length-=w,s=0;s=0&&(y!==0||s>=c);s--){var R=this.words[s]|0;this.words[s]=y<<26-d|R>>>d,y=R&v}return p&&y!==0&&(p.words[p.length++]=y),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(i,a,u){return e(this.negative===0),this.iushrn(i,a,u)},o.prototype.shln=function(i){return this.clone().ishln(i)},o.prototype.ushln=function(i){return this.clone().iushln(i)},o.prototype.shrn=function(i){return this.clone().ishrn(i)},o.prototype.ushrn=function(i){return this.clone().iushrn(i)},o.prototype.testn=function(i){e(typeof i=="number"&&i>=0);var a=i%26,u=(i-a)/26,c=1<=0);var a=i%26,u=(i-a)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(a!==0&&u++,this.length=Math.min(u,this.length),a!==0){var c=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},o.prototype.isubn=function(i){if(e(typeof i=="number"),e(i<67108864),i<0)return this.iaddn(-i);if(this.negative!==0)return this.negative=0,this.iaddn(i),this.negative=1,this;if(this.words[0]-=i,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(p/67108864|0),this.words[d+u]=w&67108863}for(;d>26,this.words[d+u]=w&67108863;if(v===0)return this._strip();for(e(v===-1),v=0,d=0;d>26,this.words[d]=w&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(i,a){var u=this.length-i.length,c=this.clone(),d=i,w=d.words[d.length-1]|0,v=this._countBits(w);u=26-v,u!==0&&(d=d.ushln(u),c.iushln(u),w=d.words[d.length-1]|0);var p=c.length-d.length,s;if(a!=="mod"){s=new o(null),s.length=p+1,s.words=new Array(s.length);for(var y=0;y=0;U--){var H=(c.words[d.length+U]|0)*67108864+(c.words[d.length+U-1]|0);for(H=Math.min(H/w|0,67108863),c._ishlnsubmul(d,H,U);c.negative!==0;)H--,c.negative=0,c._ishlnsubmul(d,1,U),c.isZero()||(c.negative^=1);s&&(s.words[U]=H)}return s&&s._strip(),c._strip(),a!=="div"&&u!==0&&c.iushrn(u),{div:s||null,mod:c}},o.prototype.divmod=function(i,a,u){if(e(!i.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var c,d,w;return this.negative!==0&&i.negative===0?(w=this.neg().divmod(i,a),a!=="mod"&&(c=w.div.neg()),a!=="div"&&(d=w.mod.neg(),u&&d.negative!==0&&d.iadd(i)),{div:c,mod:d}):this.negative===0&&i.negative!==0?(w=this.divmod(i.neg(),a),a!=="mod"&&(c=w.div.neg()),{div:c,mod:w.mod}):this.negative&i.negative?(w=this.neg().divmod(i.neg(),a),a!=="div"&&(d=w.mod.neg(),u&&d.negative!==0&&d.isub(i)),{div:w.div,mod:d}):i.length>this.length||this.cmp(i)<0?{div:new o(0),mod:this}:i.length===1?a==="div"?{div:this.divn(i.words[0]),mod:null}:a==="mod"?{div:null,mod:new o(this.modrn(i.words[0]))}:{div:this.divn(i.words[0]),mod:new o(this.modrn(i.words[0]))}:this._wordDiv(i,a)},o.prototype.div=function(i){return this.divmod(i,"div",!1).div},o.prototype.mod=function(i){return this.divmod(i,"mod",!1).mod},o.prototype.umod=function(i){return this.divmod(i,"mod",!0).mod},o.prototype.divRound=function(i){var a=this.divmod(i);if(a.mod.isZero())return a.div;var u=a.div.negative!==0?a.mod.isub(i):a.mod,c=i.ushrn(1),d=i.andln(1),w=u.cmp(c);return w<0||d===1&&w===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},o.prototype.modrn=function(i){var a=i<0;a&&(i=-i),e(i<=67108863);for(var u=(1<<26)%i,c=0,d=this.length-1;d>=0;d--)c=(u*c+(this.words[d]|0))%i;return a?-c:c},o.prototype.modn=function(i){return this.modrn(i)},o.prototype.idivn=function(i){var a=i<0;a&&(i=-i),e(i<=67108863);for(var u=0,c=this.length-1;c>=0;c--){var d=(this.words[c]|0)+u*67108864;this.words[c]=d/i|0,u=d%i}return this._strip(),a?this.ineg():this},o.prototype.divn=function(i){return this.clone().idivn(i)},o.prototype.egcd=function(i){e(i.negative===0),e(!i.isZero());var a=this,u=i.clone();a.negative!==0?a=a.umod(i):a=a.clone();for(var c=new o(1),d=new o(0),w=new o(0),v=new o(1),p=0;a.isEven()&&u.isEven();)a.iushrn(1),u.iushrn(1),++p;for(var s=u.clone(),y=a.clone();!a.isZero();){for(var R=0,U=1;!(a.words[0]&U)&&R<26;++R,U<<=1);if(R>0)for(a.iushrn(R);R-- >0;)(c.isOdd()||d.isOdd())&&(c.iadd(s),d.isub(y)),c.iushrn(1),d.iushrn(1);for(var H=0,tt=1;!(u.words[0]&tt)&&H<26;++H,tt<<=1);if(H>0)for(u.iushrn(H);H-- >0;)(w.isOdd()||v.isOdd())&&(w.iadd(s),v.isub(y)),w.iushrn(1),v.iushrn(1);a.cmp(u)>=0?(a.isub(u),c.isub(w),d.isub(v)):(u.isub(a),w.isub(c),v.isub(d))}return{a:w,b:v,gcd:u.iushln(p)}},o.prototype._invmp=function(i){e(i.negative===0),e(!i.isZero());var a=this,u=i.clone();a.negative!==0?a=a.umod(i):a=a.clone();for(var c=new o(1),d=new o(0),w=u.clone();a.cmpn(1)>0&&u.cmpn(1)>0;){for(var v=0,p=1;!(a.words[0]&p)&&v<26;++v,p<<=1);if(v>0)for(a.iushrn(v);v-- >0;)c.isOdd()&&c.iadd(w),c.iushrn(1);for(var s=0,y=1;!(u.words[0]&y)&&s<26;++s,y<<=1);if(s>0)for(u.iushrn(s);s-- >0;)d.isOdd()&&d.iadd(w),d.iushrn(1);a.cmp(u)>=0?(a.isub(u),c.isub(d)):(u.isub(a),d.isub(c))}var R;return a.cmpn(1)===0?R=c:R=d,R.cmpn(0)<0&&R.iadd(i),R},o.prototype.gcd=function(i){if(this.isZero())return i.abs();if(i.isZero())return this.abs();var a=this.clone(),u=i.clone();a.negative=0,u.negative=0;for(var c=0;a.isEven()&&u.isEven();c++)a.iushrn(1),u.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;u.isEven();)u.iushrn(1);var d=a.cmp(u);if(d<0){var w=a;a=u,u=w}else if(d===0||u.cmpn(1)===0)break;a.isub(u)}while(!0);return u.iushln(c)},o.prototype.invm=function(i){return this.egcd(i).a.umod(i)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(i){return this.words[0]&i},o.prototype.bincn=function(i){e(typeof i=="number");var a=i%26,u=(i-a)/26,c=1<>>26,v&=67108863,this.words[w]=v}return d!==0&&(this.words[w]=d,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(i){var a=i<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this._strip();var u;if(this.length>1)u=1;else{a&&(i=-i),e(i<=67108863,"Number is too big");var c=this.words[0]|0;u=c===i?0:ci.length)return 1;if(this.length=0;u--){var c=this.words[u]|0,d=i.words[u]|0;if(c!==d){cd&&(a=1);break}}return a},o.prototype.gtn=function(i){return this.cmpn(i)===1},o.prototype.gt=function(i){return this.cmp(i)===1},o.prototype.gten=function(i){return this.cmpn(i)>=0},o.prototype.gte=function(i){return this.cmp(i)>=0},o.prototype.ltn=function(i){return this.cmpn(i)===-1},o.prototype.lt=function(i){return this.cmp(i)===-1},o.prototype.lten=function(i){return this.cmpn(i)<=0},o.prototype.lte=function(i){return this.cmp(i)<=0},o.prototype.eqn=function(i){return this.cmpn(i)===0},o.prototype.eq=function(i){return this.cmp(i)===0},o.red=function(i){return new ct(i)},o.prototype.toRed=function(i){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),i.convertTo(this)._forceRed(i)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(i){return this.red=i,this},o.prototype.forceRed=function(i){return e(!this.red,"Already a number in reduction context"),this._forceRed(i)},o.prototype.redAdd=function(i){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,i)},o.prototype.redIAdd=function(i){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,i)},o.prototype.redSub=function(i){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,i)},o.prototype.redISub=function(i){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,i)},o.prototype.redShl=function(i){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,i)},o.prototype.redMul=function(i){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,i),this.red.mul(this,i)},o.prototype.redIMul=function(i){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,i),this.red.imul(this,i)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(i){return e(this.red&&!i.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,i)};var xt={k256:null,p224:null,p192:null,p25519:null};function ot(g,i){this.name=g,this.p=new o(i,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ot.prototype._tmp=function(){var i=new o(null);return i.words=new Array(Math.ceil(this.n/13)),i},ot.prototype.ireduce=function(i){var a=i,u;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),u=a.bitLength();while(u>this.n);var c=u0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},ot.prototype.split=function(i,a){i.iushrn(this.n,0,a)},ot.prototype.imulK=function(i){return i.imul(this.k)};function pt(){ot.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(pt,ot),pt.prototype.split=function(i,a){for(var u=4194303,c=Math.min(i.length,9),d=0;d>>22,w=v}w>>>=22,i.words[d-10]=w,w===0&&i.length>10?i.length-=10:i.length-=9},pt.prototype.imulK=function(i){i.words[i.length]=0,i.words[i.length+1]=0,i.length+=2;for(var a=0,u=0;u>>=26,i.words[u]=d,a=c}return a!==0&&(i.words[i.length++]=a),i},o._prime=function(i){if(xt[i])return xt[i];var a;if(i==="k256")a=new pt;else if(i==="p224")a=new St;else if(i==="p192")a=new At;else if(i==="p25519")a=new Ee;else throw new Error("Unknown prime "+i);return xt[i]=a,a};function ct(g){if(typeof g=="string"){var i=o._prime(g);this.m=i.p,this.prime=i}else e(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}ct.prototype._verify1=function(i){e(i.negative===0,"red works only with positives"),e(i.red,"red works only with red numbers")},ct.prototype._verify2=function(i,a){e((i.negative|a.negative)===0,"red works only with positives"),e(i.red&&i.red===a.red,"red works only with red numbers")},ct.prototype.imod=function(i){return this.prime?this.prime.ireduce(i)._forceRed(this):(E(i,i.umod(this.m)._forceRed(this)),i)},ct.prototype.neg=function(i){return i.isZero()?i.clone():this.m.sub(i)._forceRed(this)},ct.prototype.add=function(i,a){this._verify2(i,a);var u=i.add(a);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},ct.prototype.iadd=function(i,a){this._verify2(i,a);var u=i.iadd(a);return u.cmp(this.m)>=0&&u.isub(this.m),u},ct.prototype.sub=function(i,a){this._verify2(i,a);var u=i.sub(a);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},ct.prototype.isub=function(i,a){this._verify2(i,a);var u=i.isub(a);return u.cmpn(0)<0&&u.iadd(this.m),u},ct.prototype.shl=function(i,a){return this._verify1(i),this.imod(i.ushln(a))},ct.prototype.imul=function(i,a){return this._verify2(i,a),this.imod(i.imul(a))},ct.prototype.mul=function(i,a){return this._verify2(i,a),this.imod(i.mul(a))},ct.prototype.isqr=function(i){return this.imul(i,i.clone())},ct.prototype.sqr=function(i){return this.mul(i,i)},ct.prototype.sqrt=function(i){if(i.isZero())return i.clone();var a=this.m.andln(3);if(e(a%2===1),a===3){var u=this.m.add(new o(1)).iushrn(2);return this.pow(i,u)}for(var c=this.m.subn(1),d=0;!c.isZero()&&c.andln(1)===0;)d++,c.iushrn(1);e(!c.isZero());var w=new o(1).toRed(this),v=w.redNeg(),p=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);this.pow(s,p).cmp(v)!==0;)s.redIAdd(v);for(var y=this.pow(s,c),R=this.pow(i,c.addn(1).iushrn(1)),U=this.pow(i,c),H=d;U.cmp(w)!==0;){for(var tt=U,st=0;tt.cmp(w)!==0;st++)tt=tt.redSqr();e(st=0;d--){for(var y=a.words[d],R=s-1;R>=0;R--){var U=y>>R&1;if(w!==c[0]&&(w=this.sqr(w)),U===0&&v===0){p=0;continue}v<<=1,v|=U,p++,!(p!==u&&(d!==0||R!==0))&&(w=this.mul(w,c[v]),p=0,v=0)}s=26}return w},ct.prototype.convertTo=function(i){var a=i.umod(this.m);return a===i?a.clone():a},ct.prototype.convertFrom=function(i){var a=i.clone();return a.red=null,a},o.mont=function(i){return new Lt(i)};function Lt(g){ct.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(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)}n(Lt,ct),Lt.prototype.convertTo=function(i){return this.imod(i.ushln(this.shift))},Lt.prototype.convertFrom=function(i){var a=this.imod(i.mul(this.rinv));return a.red=null,a},Lt.prototype.imul=function(i,a){if(i.isZero()||a.isZero())return i.words[0]=0,i.length=1,i;var u=i.imul(a),c=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=u.isub(c).iushrn(this.shift),w=d;return d.cmp(this.m)>=0?w=d.isub(this.m):d.cmpn(0)<0&&(w=d.iadd(this.m)),w._forceRed(this)},Lt.prototype.mul=function(i,a){if(i.isZero()||a.isZero())return new o(0)._forceRed(this);var u=i.mul(a),c=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=u.isub(c).iushrn(this.shift),w=d;return d.cmp(this.m)>=0?w=d.isub(this.m):d.cmpn(0)<0&&(w=d.iadd(this.m)),w._forceRed(this)},Lt.prototype.invm=function(i){var a=this.imod(i._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(typeof Ks>"u"||Ks,Wf)});var Gf=$e((qs,Vf)=>{var ay=D(V());var so=An(),Fr=so.Buffer;function $f(r,t){for(var e in r)t[e]=r[e]}Fr.from&&Fr.alloc&&Fr.allocUnsafe&&Fr.allocUnsafeSlow?Vf.exports=so:($f(so,qs),qs.Buffer=On);function On(r,t,e){return Fr(r,t,e)}On.prototype=Object.create(Fr.prototype);$f(Fr,On);On.from=function(r,t,e){if(typeof r=="number")throw new TypeError("Argument must not be a number");return Fr(r,t,e)};On.alloc=function(r,t,e){if(typeof r!="number")throw new TypeError("Argument must be a number");var n=Fr(r);return t!==void 0?typeof e=="string"?n.fill(t,e):n.fill(t):n.fill(0),n};On.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return Fr(r)};On.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return so.SlowBuffer(r)}});var Fs=$e((fy,jf)=>{"use strict";var uy=D(V()),ao=Gf().Buffer;function A0(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,j=new Uint8Array(it);P!==J;){for(var rt=N[P],xt=0,ot=it-1;(rt!==0||xt>>0,j[ot]=rt%h>>>0,rt=rt/h>>>0;if(rt!==0)throw new Error("Non-zero carry");W=xt,P++}for(var pt=it-W;pt!==it&&j[pt]===0;)pt++;for(var St=x.repeat(ft);pt>>0,it=new Uint8Array(J);ft>>0,it[xt]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");P=rt,ft++}for(var ot=J-P;ot!==J&&it[ot]===0;)ot++;var pt=ao.allocUnsafe(W+(J-ot));pt.fill(0,0,W);for(var St=W;ot!==J;)pt[St++]=it[ot++];return pt}function C(N){var ft=M(N);if(ft)return ft;throw new Error("Non-base"+h+" character")}return{encode:_,decodeUnsafe:M,decode:C}}jf.exports=A0});var Zf=$e((cy,Yf)=>{var hy=D(V()),M0=Fs(),I0="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Yf.exports=M0(I0)});var yy,L0,yn,gn,Ds,bi,Ws=ae(()=>{yy=D(V(),1);ys();fn();L0=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),yn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),gn=new Uint32Array(64),Ds=class extends Zn{constructor(){super(64,32,8,!1),this.A=yn[0]|0,this.B=yn[1]|0,this.C=yn[2]|0,this.D=yn[3]|0,this.E=yn[4]|0,this.F=yn[5]|0,this.G=yn[6]|0,this.H=yn[7]|0}get(){let{A:t,B:e,C:n,D:o,E:f,F:h,G:x,H:b}=this;return[t,e,n,o,f,h,x,b]}set(t,e,n,o,f,h,x,b){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=f|0,this.F=h|0,this.G=x|0,this.H=b|0}process(t,e){for(let M=0;M<16;M++,e+=4)gn[M]=t.getUint32(e,!1);for(let M=16;M<64;M++){let C=gn[M-15],N=gn[M-2],ft=Lr(C,7)^Lr(C,18)^C>>>3,W=Lr(N,17)^Lr(N,19)^N>>>10;gn[M]=W+gn[M-7]+ft+gn[M-16]|0}let{A:n,B:o,C:f,D:h,E:x,F:b,G:E,H:_}=this;for(let M=0;M<64;M++){let C=Lr(x,6)^Lr(x,11)^Lr(x,25),N=_+C+_f(x,b,E)+L0[M]+gn[M]|0,W=(Lr(n,2)^Lr(n,13)^Lr(n,22))+Ef(n,o,f)|0;_=E,E=b,b=x,x=h+N|0,h=f,f=o,o=n,n=N+W|0}n=n+this.A|0,o=o+this.B|0,f=f+this.C|0,h=h+this.D|0,x=x+this.E|0,b=b+this.F|0,E=E+this.G|0,_=_+this.H|0,this.set(n,o,f,h,x,b,E,_)}roundClean(){gn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},bi=Yn(()=>new Ds)});var Xf=$e((Jf,Hs)=>{var gy=D(V());(function(r,t){"use strict";function e(g,i){if(!g)throw new Error(i||"Assertion failed")}function n(g,i){g.super_=i;var a=function(){};a.prototype=i.prototype,g.prototype=new a,g.prototype.constructor=g}function o(g,i,a){if(o.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((i==="le"||i==="be")&&(a=i,i=10),this._init(g||0,i||10,a||"be"))}typeof r=="object"?r.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var f;try{typeof window<"u"&&typeof window.Buffer<"u"?f=window.Buffer:f=zs().Buffer}catch{}o.isBN=function(i){return i instanceof o?!0:i!==null&&typeof i=="object"&&i.constructor.wordSize===o.wordSize&&Array.isArray(i.words)},o.max=function(i,a){return i.cmp(a)>0?i:a},o.min=function(i,a){return i.cmp(a)<0?i:a},o.prototype._init=function(i,a,u){if(typeof i=="number")return this._initNumber(i,a,u);if(typeof i=="object")return this._initArray(i,a,u);a==="hex"&&(a=16),e(a===(a|0)&&a>=2&&a<=36),i=i.toString().replace(/\\s+/g,"");var c=0;i[0]==="-"&&(c++,this.negative=1),c=0;c-=3)w=i[c]|i[c-1]<<8|i[c-2]<<16,this.words[d]|=w<>>26-v&67108863,v+=24,v>=26&&(v-=26,d++);else if(u==="le")for(c=0,d=0;c>>26-v&67108863,v+=24,v>=26&&(v-=26,d++);return this._strip()};function h(g,i){var a=g.charCodeAt(i);if(a>=48&&a<=57)return a-48;if(a>=65&&a<=70)return a-55;if(a>=97&&a<=102)return a-87;e(!1,"Invalid character in "+g)}function x(g,i,a){var u=h(g,a);return a-1>=i&&(u|=h(g,a-1)<<4),u}o.prototype._parseHex=function(i,a,u){this.length=Math.ceil((i.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)v=x(i,a,c)<=18?(d-=18,w+=1,this.words[w]|=v>>>26):d+=8;else{var p=i.length-a;for(c=p%2===0?a+1:a;c=18?(d-=18,w+=1,this.words[w]|=v>>>26):d+=8}this._strip()};function b(g,i,a,u){for(var c=0,d=0,w=Math.min(g.length,a),v=i;v=49?d=p-49+10:p>=17?d=p-17+10:d=p,e(p>=0&&d1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=_}catch{o.prototype.inspect=_}else o.prototype.inspect=_;function _(){return(this.red?""}var M=["","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"],C=[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],N=[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];o.prototype.toString=function(i,a){i=i||10,a=a|0||1;var u;if(i===16||i==="hex"){u="";for(var c=0,d=0,w=0;w>>24-c&16777215,c+=2,c>=26&&(c-=26,w--),d!==0||w!==this.length-1?u=M[6-p.length]+p+u:u=p+u}for(d!==0&&(u=d.toString(16)+u);u.length%a!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(i===(i|0)&&i>=2&&i<=36){var s=C[i],y=N[i];u="";var R=this.clone();for(R.negative=0;!R.isZero();){var U=R.modrn(y).toString(i);R=R.idivn(y),R.isZero()?u=U+u:u=M[s-U.length]+U+u}for(this.isZero()&&(u="0"+u);u.length%a!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var i=this.words[0];return this.length===2?i+=this.words[1]*67108864:this.length===3&&this.words[2]===1?i+=4503599627370496+this.words[1]*67108864:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-i:i},o.prototype.toJSON=function(){return this.toString(16,2)},f&&(o.prototype.toBuffer=function(i,a){return this.toArrayLike(f,i,a)}),o.prototype.toArray=function(i,a){return this.toArrayLike(Array,i,a)};var ft=function(i,a){return i.allocUnsafe?i.allocUnsafe(a):new i(a)};o.prototype.toArrayLike=function(i,a,u){this._strip();var c=this.byteLength(),d=u||Math.max(1,c);e(c<=d,"byte array longer than desired length"),e(d>0,"Requested array length <= 0");var w=ft(i,d),v=a==="le"?"LE":"BE";return this["_toArrayLike"+v](w,c),w},o.prototype._toArrayLikeLE=function(i,a){for(var u=0,c=0,d=0,w=0;d>8&255),u>16&255),w===6?(u>24&255),c=0,w=0):(c=v>>>24,w+=2)}if(u=0&&(i[u--]=v>>8&255),u>=0&&(i[u--]=v>>16&255),w===6?(u>=0&&(i[u--]=v>>24&255),c=0,w=0):(c=v>>>24,w+=2)}if(u>=0)for(i[u--]=c;u>=0;)i[u--]=0},Math.clz32?o.prototype._countBits=function(i){return 32-Math.clz32(i)}:o.prototype._countBits=function(i){var a=i,u=0;return a>=4096&&(u+=13,a>>>=13),a>=64&&(u+=7,a>>>=7),a>=8&&(u+=4,a>>>=4),a>=2&&(u+=2,a>>>=2),u+a},o.prototype._zeroBits=function(i){if(i===0)return 26;var a=i,u=0;return a&8191||(u+=13,a>>>=13),a&127||(u+=7,a>>>=7),a&15||(u+=4,a>>>=4),a&3||(u+=2,a>>>=2),a&1||u++,u},o.prototype.bitLength=function(){var i=this.words[this.length-1],a=this._countBits(i);return(this.length-1)*26+a};function W(g){for(var i=new Array(g.bitLength()),a=0;a>>c&1}return i}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var i=0,a=0;ai.length?this.clone().ior(i):i.clone().ior(this)},o.prototype.uor=function(i){return this.length>i.length?this.clone().iuor(i):i.clone().iuor(this)},o.prototype.iuand=function(i){var a;this.length>i.length?a=i:a=this;for(var u=0;ui.length?this.clone().iand(i):i.clone().iand(this)},o.prototype.uand=function(i){return this.length>i.length?this.clone().iuand(i):i.clone().iuand(this)},o.prototype.iuxor=function(i){var a,u;this.length>i.length?(a=this,u=i):(a=i,u=this);for(var c=0;ci.length?this.clone().ixor(i):i.clone().ixor(this)},o.prototype.uxor=function(i){return this.length>i.length?this.clone().iuxor(i):i.clone().iuxor(this)},o.prototype.inotn=function(i){e(typeof i=="number"&&i>=0);var a=Math.ceil(i/26)|0,u=i%26;this._expand(a),u>0&&a--;for(var c=0;c0&&(this.words[c]=~this.words[c]&67108863>>26-u),this._strip()},o.prototype.notn=function(i){return this.clone().inotn(i)},o.prototype.setn=function(i,a){e(typeof i=="number"&&i>=0);var u=i/26|0,c=i%26;return this._expand(u+1),a?this.words[u]=this.words[u]|1<i.length?(u=this,c=i):(u=i,c=this);for(var d=0,w=0;w>>26;for(;d!==0&&w>>26;if(this.length=u.length,d!==0)this.words[this.length]=d,this.length++;else if(u!==this)for(;wi.length?this.clone().iadd(i):i.clone().iadd(this)},o.prototype.isub=function(i){if(i.negative!==0){i.negative=0;var a=this.iadd(i);return i.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(i),this.negative=1,this._normSign();var u=this.cmp(i);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var c,d;u>0?(c=this,d=i):(c=i,d=this);for(var w=0,v=0;v>26,this.words[v]=a&67108863;for(;w!==0&&v>26,this.words[v]=a&67108863;if(w===0&&v>>26,R=p&67108863,U=Math.min(s,i.length-1),H=Math.max(0,s-g.length+1);H<=U;H++){var tt=s-H|0;c=g.words[tt]|0,d=i.words[H]|0,w=c*d+R,y+=w/67108864|0,R=w&67108863}a.words[s]=R|0,p=y|0}return p!==0?a.words[s]=p|0:a.length--,a._strip()}var J=function(i,a,u){var c=i.words,d=a.words,w=u.words,v=0,p,s,y,R=c[0]|0,U=R&8191,H=R>>>13,tt=c[1]|0,st=tt&8191,dt=tt>>>13,be=c[2]|0,ht=be&8191,Bt=be>>>13,Xe=c[3]|0,qt=Xe&8191,Ft=Xe>>>13,Or=c[4]|0,ee=Or&8191,Nt=Or>>>13,kr=c[5]|0,Zt=kr&8191,Ht=kr>>>13,br=c[6]|0,Dt=br&8191,$t=br>>>13,xr=c[7]|0,Vt=xr&8191,Gt=xr>>>13,Nr=c[8]|0,ie=Nr&8191,Jt=Nr>>>13,Mr=c[9]|0,re=Mr&8191,Xt=Mr>>>13,Sr=d[0]|0,Qt=Sr&8191,ne=Sr>>>13,Ir=d[1]|0,te=Ir&8191,oe=Ir>>>13,rn=d[2]|0,he=rn&8191,le=rn>>>13,hr=d[3]|0,Wt=hr&8191,jt=hr>>>13,Hr=d[4]|0,se=Hr&8191,ue=Hr>>>13,Bn=d[5]|0,Mt=Bn&8191,ce=Bn>>>13,m=d[6]|0,S=m&8191,k=m>>>13,l=d[7]|0,B=l&8191,I=l>>>13,T=d[8]|0,O=T&8191,$=T>>>13,_t=d[9]|0,X=_t&8191,yt=_t>>>13;u.negative=i.negative^a.negative,u.length=19,p=Math.imul(U,Qt),s=Math.imul(U,ne),s=s+Math.imul(H,Qt)|0,y=Math.imul(H,ne);var gt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(gt>>>26)|0,gt&=67108863,p=Math.imul(st,Qt),s=Math.imul(st,ne),s=s+Math.imul(dt,Qt)|0,y=Math.imul(dt,ne),p=p+Math.imul(U,te)|0,s=s+Math.imul(U,oe)|0,s=s+Math.imul(H,te)|0,y=y+Math.imul(H,oe)|0;var It=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(It>>>26)|0,It&=67108863,p=Math.imul(ht,Qt),s=Math.imul(ht,ne),s=s+Math.imul(Bt,Qt)|0,y=Math.imul(Bt,ne),p=p+Math.imul(st,te)|0,s=s+Math.imul(st,oe)|0,s=s+Math.imul(dt,te)|0,y=y+Math.imul(dt,oe)|0,p=p+Math.imul(U,he)|0,s=s+Math.imul(U,le)|0,s=s+Math.imul(H,he)|0,y=y+Math.imul(H,le)|0;var Rt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,p=Math.imul(qt,Qt),s=Math.imul(qt,ne),s=s+Math.imul(Ft,Qt)|0,y=Math.imul(Ft,ne),p=p+Math.imul(ht,te)|0,s=s+Math.imul(ht,oe)|0,s=s+Math.imul(Bt,te)|0,y=y+Math.imul(Bt,oe)|0,p=p+Math.imul(st,he)|0,s=s+Math.imul(st,le)|0,s=s+Math.imul(dt,he)|0,y=y+Math.imul(dt,le)|0,p=p+Math.imul(U,Wt)|0,s=s+Math.imul(U,jt)|0,s=s+Math.imul(H,Wt)|0,y=y+Math.imul(H,jt)|0;var Kt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,p=Math.imul(ee,Qt),s=Math.imul(ee,ne),s=s+Math.imul(Nt,Qt)|0,y=Math.imul(Nt,ne),p=p+Math.imul(qt,te)|0,s=s+Math.imul(qt,oe)|0,s=s+Math.imul(Ft,te)|0,y=y+Math.imul(Ft,oe)|0,p=p+Math.imul(ht,he)|0,s=s+Math.imul(ht,le)|0,s=s+Math.imul(Bt,he)|0,y=y+Math.imul(Bt,le)|0,p=p+Math.imul(st,Wt)|0,s=s+Math.imul(st,jt)|0,s=s+Math.imul(dt,Wt)|0,y=y+Math.imul(dt,jt)|0,p=p+Math.imul(U,se)|0,s=s+Math.imul(U,ue)|0,s=s+Math.imul(H,se)|0,y=y+Math.imul(H,ue)|0;var zt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(zt>>>26)|0,zt&=67108863,p=Math.imul(Zt,Qt),s=Math.imul(Zt,ne),s=s+Math.imul(Ht,Qt)|0,y=Math.imul(Ht,ne),p=p+Math.imul(ee,te)|0,s=s+Math.imul(ee,oe)|0,s=s+Math.imul(Nt,te)|0,y=y+Math.imul(Nt,oe)|0,p=p+Math.imul(qt,he)|0,s=s+Math.imul(qt,le)|0,s=s+Math.imul(Ft,he)|0,y=y+Math.imul(Ft,le)|0,p=p+Math.imul(ht,Wt)|0,s=s+Math.imul(ht,jt)|0,s=s+Math.imul(Bt,Wt)|0,y=y+Math.imul(Bt,jt)|0,p=p+Math.imul(st,se)|0,s=s+Math.imul(st,ue)|0,s=s+Math.imul(dt,se)|0,y=y+Math.imul(dt,ue)|0,p=p+Math.imul(U,Mt)|0,s=s+Math.imul(U,ce)|0,s=s+Math.imul(H,Mt)|0,y=y+Math.imul(H,ce)|0;var Tt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,p=Math.imul(Dt,Qt),s=Math.imul(Dt,ne),s=s+Math.imul($t,Qt)|0,y=Math.imul($t,ne),p=p+Math.imul(Zt,te)|0,s=s+Math.imul(Zt,oe)|0,s=s+Math.imul(Ht,te)|0,y=y+Math.imul(Ht,oe)|0,p=p+Math.imul(ee,he)|0,s=s+Math.imul(ee,le)|0,s=s+Math.imul(Nt,he)|0,y=y+Math.imul(Nt,le)|0,p=p+Math.imul(qt,Wt)|0,s=s+Math.imul(qt,jt)|0,s=s+Math.imul(Ft,Wt)|0,y=y+Math.imul(Ft,jt)|0,p=p+Math.imul(ht,se)|0,s=s+Math.imul(ht,ue)|0,s=s+Math.imul(Bt,se)|0,y=y+Math.imul(Bt,ue)|0,p=p+Math.imul(st,Mt)|0,s=s+Math.imul(st,ce)|0,s=s+Math.imul(dt,Mt)|0,y=y+Math.imul(dt,ce)|0,p=p+Math.imul(U,S)|0,s=s+Math.imul(U,k)|0,s=s+Math.imul(H,S)|0,y=y+Math.imul(H,k)|0;var Ct=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,p=Math.imul(Vt,Qt),s=Math.imul(Vt,ne),s=s+Math.imul(Gt,Qt)|0,y=Math.imul(Gt,ne),p=p+Math.imul(Dt,te)|0,s=s+Math.imul(Dt,oe)|0,s=s+Math.imul($t,te)|0,y=y+Math.imul($t,oe)|0,p=p+Math.imul(Zt,he)|0,s=s+Math.imul(Zt,le)|0,s=s+Math.imul(Ht,he)|0,y=y+Math.imul(Ht,le)|0,p=p+Math.imul(ee,Wt)|0,s=s+Math.imul(ee,jt)|0,s=s+Math.imul(Nt,Wt)|0,y=y+Math.imul(Nt,jt)|0,p=p+Math.imul(qt,se)|0,s=s+Math.imul(qt,ue)|0,s=s+Math.imul(Ft,se)|0,y=y+Math.imul(Ft,ue)|0,p=p+Math.imul(ht,Mt)|0,s=s+Math.imul(ht,ce)|0,s=s+Math.imul(Bt,Mt)|0,y=y+Math.imul(Bt,ce)|0,p=p+Math.imul(st,S)|0,s=s+Math.imul(st,k)|0,s=s+Math.imul(dt,S)|0,y=y+Math.imul(dt,k)|0,p=p+Math.imul(U,B)|0,s=s+Math.imul(U,I)|0,s=s+Math.imul(H,B)|0,y=y+Math.imul(H,I)|0;var Pt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,p=Math.imul(ie,Qt),s=Math.imul(ie,ne),s=s+Math.imul(Jt,Qt)|0,y=Math.imul(Jt,ne),p=p+Math.imul(Vt,te)|0,s=s+Math.imul(Vt,oe)|0,s=s+Math.imul(Gt,te)|0,y=y+Math.imul(Gt,oe)|0,p=p+Math.imul(Dt,he)|0,s=s+Math.imul(Dt,le)|0,s=s+Math.imul($t,he)|0,y=y+Math.imul($t,le)|0,p=p+Math.imul(Zt,Wt)|0,s=s+Math.imul(Zt,jt)|0,s=s+Math.imul(Ht,Wt)|0,y=y+Math.imul(Ht,jt)|0,p=p+Math.imul(ee,se)|0,s=s+Math.imul(ee,ue)|0,s=s+Math.imul(Nt,se)|0,y=y+Math.imul(Nt,ue)|0,p=p+Math.imul(qt,Mt)|0,s=s+Math.imul(qt,ce)|0,s=s+Math.imul(Ft,Mt)|0,y=y+Math.imul(Ft,ce)|0,p=p+Math.imul(ht,S)|0,s=s+Math.imul(ht,k)|0,s=s+Math.imul(Bt,S)|0,y=y+Math.imul(Bt,k)|0,p=p+Math.imul(st,B)|0,s=s+Math.imul(st,I)|0,s=s+Math.imul(dt,B)|0,y=y+Math.imul(dt,I)|0,p=p+Math.imul(U,O)|0,s=s+Math.imul(U,$)|0,s=s+Math.imul(H,O)|0,y=y+Math.imul(H,$)|0;var mt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(mt>>>26)|0,mt&=67108863,p=Math.imul(re,Qt),s=Math.imul(re,ne),s=s+Math.imul(Xt,Qt)|0,y=Math.imul(Xt,ne),p=p+Math.imul(ie,te)|0,s=s+Math.imul(ie,oe)|0,s=s+Math.imul(Jt,te)|0,y=y+Math.imul(Jt,oe)|0,p=p+Math.imul(Vt,he)|0,s=s+Math.imul(Vt,le)|0,s=s+Math.imul(Gt,he)|0,y=y+Math.imul(Gt,le)|0,p=p+Math.imul(Dt,Wt)|0,s=s+Math.imul(Dt,jt)|0,s=s+Math.imul($t,Wt)|0,y=y+Math.imul($t,jt)|0,p=p+Math.imul(Zt,se)|0,s=s+Math.imul(Zt,ue)|0,s=s+Math.imul(Ht,se)|0,y=y+Math.imul(Ht,ue)|0,p=p+Math.imul(ee,Mt)|0,s=s+Math.imul(ee,ce)|0,s=s+Math.imul(Nt,Mt)|0,y=y+Math.imul(Nt,ce)|0,p=p+Math.imul(qt,S)|0,s=s+Math.imul(qt,k)|0,s=s+Math.imul(Ft,S)|0,y=y+Math.imul(Ft,k)|0,p=p+Math.imul(ht,B)|0,s=s+Math.imul(ht,I)|0,s=s+Math.imul(Bt,B)|0,y=y+Math.imul(Bt,I)|0,p=p+Math.imul(st,O)|0,s=s+Math.imul(st,$)|0,s=s+Math.imul(dt,O)|0,y=y+Math.imul(dt,$)|0,p=p+Math.imul(U,X)|0,s=s+Math.imul(U,yt)|0,s=s+Math.imul(H,X)|0,y=y+Math.imul(H,yt)|0;var Et=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Et>>>26)|0,Et&=67108863,p=Math.imul(re,te),s=Math.imul(re,oe),s=s+Math.imul(Xt,te)|0,y=Math.imul(Xt,oe),p=p+Math.imul(ie,he)|0,s=s+Math.imul(ie,le)|0,s=s+Math.imul(Jt,he)|0,y=y+Math.imul(Jt,le)|0,p=p+Math.imul(Vt,Wt)|0,s=s+Math.imul(Vt,jt)|0,s=s+Math.imul(Gt,Wt)|0,y=y+Math.imul(Gt,jt)|0,p=p+Math.imul(Dt,se)|0,s=s+Math.imul(Dt,ue)|0,s=s+Math.imul($t,se)|0,y=y+Math.imul($t,ue)|0,p=p+Math.imul(Zt,Mt)|0,s=s+Math.imul(Zt,ce)|0,s=s+Math.imul(Ht,Mt)|0,y=y+Math.imul(Ht,ce)|0,p=p+Math.imul(ee,S)|0,s=s+Math.imul(ee,k)|0,s=s+Math.imul(Nt,S)|0,y=y+Math.imul(Nt,k)|0,p=p+Math.imul(qt,B)|0,s=s+Math.imul(qt,I)|0,s=s+Math.imul(Ft,B)|0,y=y+Math.imul(Ft,I)|0,p=p+Math.imul(ht,O)|0,s=s+Math.imul(ht,$)|0,s=s+Math.imul(Bt,O)|0,y=y+Math.imul(Bt,$)|0,p=p+Math.imul(st,X)|0,s=s+Math.imul(st,yt)|0,s=s+Math.imul(dt,X)|0,y=y+Math.imul(dt,yt)|0;var lt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(lt>>>26)|0,lt&=67108863,p=Math.imul(re,he),s=Math.imul(re,le),s=s+Math.imul(Xt,he)|0,y=Math.imul(Xt,le),p=p+Math.imul(ie,Wt)|0,s=s+Math.imul(ie,jt)|0,s=s+Math.imul(Jt,Wt)|0,y=y+Math.imul(Jt,jt)|0,p=p+Math.imul(Vt,se)|0,s=s+Math.imul(Vt,ue)|0,s=s+Math.imul(Gt,se)|0,y=y+Math.imul(Gt,ue)|0,p=p+Math.imul(Dt,Mt)|0,s=s+Math.imul(Dt,ce)|0,s=s+Math.imul($t,Mt)|0,y=y+Math.imul($t,ce)|0,p=p+Math.imul(Zt,S)|0,s=s+Math.imul(Zt,k)|0,s=s+Math.imul(Ht,S)|0,y=y+Math.imul(Ht,k)|0,p=p+Math.imul(ee,B)|0,s=s+Math.imul(ee,I)|0,s=s+Math.imul(Nt,B)|0,y=y+Math.imul(Nt,I)|0,p=p+Math.imul(qt,O)|0,s=s+Math.imul(qt,$)|0,s=s+Math.imul(Ft,O)|0,y=y+Math.imul(Ft,$)|0,p=p+Math.imul(ht,X)|0,s=s+Math.imul(ht,yt)|0,s=s+Math.imul(Bt,X)|0,y=y+Math.imul(Bt,yt)|0;var wt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(wt>>>26)|0,wt&=67108863,p=Math.imul(re,Wt),s=Math.imul(re,jt),s=s+Math.imul(Xt,Wt)|0,y=Math.imul(Xt,jt),p=p+Math.imul(ie,se)|0,s=s+Math.imul(ie,ue)|0,s=s+Math.imul(Jt,se)|0,y=y+Math.imul(Jt,ue)|0,p=p+Math.imul(Vt,Mt)|0,s=s+Math.imul(Vt,ce)|0,s=s+Math.imul(Gt,Mt)|0,y=y+Math.imul(Gt,ce)|0,p=p+Math.imul(Dt,S)|0,s=s+Math.imul(Dt,k)|0,s=s+Math.imul($t,S)|0,y=y+Math.imul($t,k)|0,p=p+Math.imul(Zt,B)|0,s=s+Math.imul(Zt,I)|0,s=s+Math.imul(Ht,B)|0,y=y+Math.imul(Ht,I)|0,p=p+Math.imul(ee,O)|0,s=s+Math.imul(ee,$)|0,s=s+Math.imul(Nt,O)|0,y=y+Math.imul(Nt,$)|0,p=p+Math.imul(qt,X)|0,s=s+Math.imul(qt,yt)|0,s=s+Math.imul(Ft,X)|0,y=y+Math.imul(Ft,yt)|0;var bt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(bt>>>26)|0,bt&=67108863,p=Math.imul(re,se),s=Math.imul(re,ue),s=s+Math.imul(Xt,se)|0,y=Math.imul(Xt,ue),p=p+Math.imul(ie,Mt)|0,s=s+Math.imul(ie,ce)|0,s=s+Math.imul(Jt,Mt)|0,y=y+Math.imul(Jt,ce)|0,p=p+Math.imul(Vt,S)|0,s=s+Math.imul(Vt,k)|0,s=s+Math.imul(Gt,S)|0,y=y+Math.imul(Gt,k)|0,p=p+Math.imul(Dt,B)|0,s=s+Math.imul(Dt,I)|0,s=s+Math.imul($t,B)|0,y=y+Math.imul($t,I)|0,p=p+Math.imul(Zt,O)|0,s=s+Math.imul(Zt,$)|0,s=s+Math.imul(Ht,O)|0,y=y+Math.imul(Ht,$)|0,p=p+Math.imul(ee,X)|0,s=s+Math.imul(ee,yt)|0,s=s+Math.imul(Nt,X)|0,y=y+Math.imul(Nt,yt)|0;var ut=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(ut>>>26)|0,ut&=67108863,p=Math.imul(re,Mt),s=Math.imul(re,ce),s=s+Math.imul(Xt,Mt)|0,y=Math.imul(Xt,ce),p=p+Math.imul(ie,S)|0,s=s+Math.imul(ie,k)|0,s=s+Math.imul(Jt,S)|0,y=y+Math.imul(Jt,k)|0,p=p+Math.imul(Vt,B)|0,s=s+Math.imul(Vt,I)|0,s=s+Math.imul(Gt,B)|0,y=y+Math.imul(Gt,I)|0,p=p+Math.imul(Dt,O)|0,s=s+Math.imul(Dt,$)|0,s=s+Math.imul($t,O)|0,y=y+Math.imul($t,$)|0,p=p+Math.imul(Zt,X)|0,s=s+Math.imul(Zt,yt)|0,s=s+Math.imul(Ht,X)|0,y=y+Math.imul(Ht,yt)|0;var q=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(q>>>26)|0,q&=67108863,p=Math.imul(re,S),s=Math.imul(re,k),s=s+Math.imul(Xt,S)|0,y=Math.imul(Xt,k),p=p+Math.imul(ie,B)|0,s=s+Math.imul(ie,I)|0,s=s+Math.imul(Jt,B)|0,y=y+Math.imul(Jt,I)|0,p=p+Math.imul(Vt,O)|0,s=s+Math.imul(Vt,$)|0,s=s+Math.imul(Gt,O)|0,y=y+Math.imul(Gt,$)|0,p=p+Math.imul(Dt,X)|0,s=s+Math.imul(Dt,yt)|0,s=s+Math.imul($t,X)|0,y=y+Math.imul($t,yt)|0;var F=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(F>>>26)|0,F&=67108863,p=Math.imul(re,B),s=Math.imul(re,I),s=s+Math.imul(Xt,B)|0,y=Math.imul(Xt,I),p=p+Math.imul(ie,O)|0,s=s+Math.imul(ie,$)|0,s=s+Math.imul(Jt,O)|0,y=y+Math.imul(Jt,$)|0,p=p+Math.imul(Vt,X)|0,s=s+Math.imul(Vt,yt)|0,s=s+Math.imul(Gt,X)|0,y=y+Math.imul(Gt,yt)|0;var Q=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Q>>>26)|0,Q&=67108863,p=Math.imul(re,O),s=Math.imul(re,$),s=s+Math.imul(Xt,O)|0,y=Math.imul(Xt,$),p=p+Math.imul(ie,X)|0,s=s+Math.imul(ie,yt)|0,s=s+Math.imul(Jt,X)|0,y=y+Math.imul(Jt,yt)|0;var Y=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Y>>>26)|0,Y&=67108863,p=Math.imul(re,X),s=Math.imul(re,yt),s=s+Math.imul(Xt,X)|0,y=Math.imul(Xt,yt);var Z=(v+p|0)+((s&8191)<<13)|0;return v=(y+(s>>>13)|0)+(Z>>>26)|0,Z&=67108863,w[0]=gt,w[1]=It,w[2]=Rt,w[3]=Kt,w[4]=zt,w[5]=Tt,w[6]=Ct,w[7]=Pt,w[8]=mt,w[9]=Et,w[10]=lt,w[11]=wt,w[12]=bt,w[13]=ut,w[14]=q,w[15]=F,w[16]=Q,w[17]=Y,w[18]=Z,v!==0&&(w[19]=v,u.length++),u};Math.imul||(J=P);function it(g,i,a){a.negative=i.negative^g.negative,a.length=g.length+i.length;for(var u=0,c=0,d=0;d>>26)|0,c+=w>>>26,w&=67108863}a.words[d]=v,u=w,w=c}return u!==0?a.words[d]=u:a.length--,a._strip()}function j(g,i,a){return it(g,i,a)}o.prototype.mulTo=function(i,a){var u,c=this.length+i.length;return this.length===10&&i.length===10?u=J(this,i,a):c<63?u=P(this,i,a):c<1024?u=it(this,i,a):u=j(this,i,a),u};function rt(g,i){this.x=g,this.y=i}rt.prototype.makeRBT=function(i){for(var a=new Array(i),u=o.prototype._countBits(i)-1,c=0;c>=1;return c},rt.prototype.permute=function(i,a,u,c,d,w){for(var v=0;v>>1)d++;return 1<>>13,u[2*w+1]=d&8191,d=d>>>13;for(w=2*a;w>=26,u+=d/67108864|0,u+=w>>>26,this.words[c]=w&67108863}return u!==0&&(this.words[c]=u,this.length++),a?this.ineg():this},o.prototype.muln=function(i){return this.clone().imuln(i)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(i){var a=W(i);if(a.length===0)return new o(1);for(var u=this,c=0;c=0);var a=i%26,u=(i-a)/26,c=67108863>>>26-a<<26-a,d;if(a!==0){var w=0;for(d=0;d>>26-a}w&&(this.words[d]=w,this.length++)}if(u!==0){for(d=this.length-1;d>=0;d--)this.words[d+u]=this.words[d];for(d=0;d=0);var c;a?c=(a-a%26)/26:c=0;var d=i%26,w=Math.min((i-d)/26,this.length),v=67108863^67108863>>>d<w)for(this.length-=w,s=0;s=0&&(y!==0||s>=c);s--){var R=this.words[s]|0;this.words[s]=y<<26-d|R>>>d,y=R&v}return p&&y!==0&&(p.words[p.length++]=y),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(i,a,u){return e(this.negative===0),this.iushrn(i,a,u)},o.prototype.shln=function(i){return this.clone().ishln(i)},o.prototype.ushln=function(i){return this.clone().iushln(i)},o.prototype.shrn=function(i){return this.clone().ishrn(i)},o.prototype.ushrn=function(i){return this.clone().iushrn(i)},o.prototype.testn=function(i){e(typeof i=="number"&&i>=0);var a=i%26,u=(i-a)/26,c=1<=0);var a=i%26,u=(i-a)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(a!==0&&u++,this.length=Math.min(u,this.length),a!==0){var c=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},o.prototype.isubn=function(i){if(e(typeof i=="number"),e(i<67108864),i<0)return this.iaddn(-i);if(this.negative!==0)return this.negative=0,this.iaddn(i),this.negative=1,this;if(this.words[0]-=i,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(p/67108864|0),this.words[d+u]=w&67108863}for(;d>26,this.words[d+u]=w&67108863;if(v===0)return this._strip();for(e(v===-1),v=0,d=0;d>26,this.words[d]=w&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(i,a){var u=this.length-i.length,c=this.clone(),d=i,w=d.words[d.length-1]|0,v=this._countBits(w);u=26-v,u!==0&&(d=d.ushln(u),c.iushln(u),w=d.words[d.length-1]|0);var p=c.length-d.length,s;if(a!=="mod"){s=new o(null),s.length=p+1,s.words=new Array(s.length);for(var y=0;y=0;U--){var H=(c.words[d.length+U]|0)*67108864+(c.words[d.length+U-1]|0);for(H=Math.min(H/w|0,67108863),c._ishlnsubmul(d,H,U);c.negative!==0;)H--,c.negative=0,c._ishlnsubmul(d,1,U),c.isZero()||(c.negative^=1);s&&(s.words[U]=H)}return s&&s._strip(),c._strip(),a!=="div"&&u!==0&&c.iushrn(u),{div:s||null,mod:c}},o.prototype.divmod=function(i,a,u){if(e(!i.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var c,d,w;return this.negative!==0&&i.negative===0?(w=this.neg().divmod(i,a),a!=="mod"&&(c=w.div.neg()),a!=="div"&&(d=w.mod.neg(),u&&d.negative!==0&&d.iadd(i)),{div:c,mod:d}):this.negative===0&&i.negative!==0?(w=this.divmod(i.neg(),a),a!=="mod"&&(c=w.div.neg()),{div:c,mod:w.mod}):this.negative&i.negative?(w=this.neg().divmod(i.neg(),a),a!=="div"&&(d=w.mod.neg(),u&&d.negative!==0&&d.isub(i)),{div:w.div,mod:d}):i.length>this.length||this.cmp(i)<0?{div:new o(0),mod:this}:i.length===1?a==="div"?{div:this.divn(i.words[0]),mod:null}:a==="mod"?{div:null,mod:new o(this.modrn(i.words[0]))}:{div:this.divn(i.words[0]),mod:new o(this.modrn(i.words[0]))}:this._wordDiv(i,a)},o.prototype.div=function(i){return this.divmod(i,"div",!1).div},o.prototype.mod=function(i){return this.divmod(i,"mod",!1).mod},o.prototype.umod=function(i){return this.divmod(i,"mod",!0).mod},o.prototype.divRound=function(i){var a=this.divmod(i);if(a.mod.isZero())return a.div;var u=a.div.negative!==0?a.mod.isub(i):a.mod,c=i.ushrn(1),d=i.andln(1),w=u.cmp(c);return w<0||d===1&&w===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},o.prototype.modrn=function(i){var a=i<0;a&&(i=-i),e(i<=67108863);for(var u=(1<<26)%i,c=0,d=this.length-1;d>=0;d--)c=(u*c+(this.words[d]|0))%i;return a?-c:c},o.prototype.modn=function(i){return this.modrn(i)},o.prototype.idivn=function(i){var a=i<0;a&&(i=-i),e(i<=67108863);for(var u=0,c=this.length-1;c>=0;c--){var d=(this.words[c]|0)+u*67108864;this.words[c]=d/i|0,u=d%i}return this._strip(),a?this.ineg():this},o.prototype.divn=function(i){return this.clone().idivn(i)},o.prototype.egcd=function(i){e(i.negative===0),e(!i.isZero());var a=this,u=i.clone();a.negative!==0?a=a.umod(i):a=a.clone();for(var c=new o(1),d=new o(0),w=new o(0),v=new o(1),p=0;a.isEven()&&u.isEven();)a.iushrn(1),u.iushrn(1),++p;for(var s=u.clone(),y=a.clone();!a.isZero();){for(var R=0,U=1;!(a.words[0]&U)&&R<26;++R,U<<=1);if(R>0)for(a.iushrn(R);R-- >0;)(c.isOdd()||d.isOdd())&&(c.iadd(s),d.isub(y)),c.iushrn(1),d.iushrn(1);for(var H=0,tt=1;!(u.words[0]&tt)&&H<26;++H,tt<<=1);if(H>0)for(u.iushrn(H);H-- >0;)(w.isOdd()||v.isOdd())&&(w.iadd(s),v.isub(y)),w.iushrn(1),v.iushrn(1);a.cmp(u)>=0?(a.isub(u),c.isub(w),d.isub(v)):(u.isub(a),w.isub(c),v.isub(d))}return{a:w,b:v,gcd:u.iushln(p)}},o.prototype._invmp=function(i){e(i.negative===0),e(!i.isZero());var a=this,u=i.clone();a.negative!==0?a=a.umod(i):a=a.clone();for(var c=new o(1),d=new o(0),w=u.clone();a.cmpn(1)>0&&u.cmpn(1)>0;){for(var v=0,p=1;!(a.words[0]&p)&&v<26;++v,p<<=1);if(v>0)for(a.iushrn(v);v-- >0;)c.isOdd()&&c.iadd(w),c.iushrn(1);for(var s=0,y=1;!(u.words[0]&y)&&s<26;++s,y<<=1);if(s>0)for(u.iushrn(s);s-- >0;)d.isOdd()&&d.iadd(w),d.iushrn(1);a.cmp(u)>=0?(a.isub(u),c.isub(d)):(u.isub(a),d.isub(c))}var R;return a.cmpn(1)===0?R=c:R=d,R.cmpn(0)<0&&R.iadd(i),R},o.prototype.gcd=function(i){if(this.isZero())return i.abs();if(i.isZero())return this.abs();var a=this.clone(),u=i.clone();a.negative=0,u.negative=0;for(var c=0;a.isEven()&&u.isEven();c++)a.iushrn(1),u.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;u.isEven();)u.iushrn(1);var d=a.cmp(u);if(d<0){var w=a;a=u,u=w}else if(d===0||u.cmpn(1)===0)break;a.isub(u)}while(!0);return u.iushln(c)},o.prototype.invm=function(i){return this.egcd(i).a.umod(i)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(i){return this.words[0]&i},o.prototype.bincn=function(i){e(typeof i=="number");var a=i%26,u=(i-a)/26,c=1<>>26,v&=67108863,this.words[w]=v}return d!==0&&(this.words[w]=d,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(i){var a=i<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this._strip();var u;if(this.length>1)u=1;else{a&&(i=-i),e(i<=67108863,"Number is too big");var c=this.words[0]|0;u=c===i?0:ci.length)return 1;if(this.length=0;u--){var c=this.words[u]|0,d=i.words[u]|0;if(c!==d){cd&&(a=1);break}}return a},o.prototype.gtn=function(i){return this.cmpn(i)===1},o.prototype.gt=function(i){return this.cmp(i)===1},o.prototype.gten=function(i){return this.cmpn(i)>=0},o.prototype.gte=function(i){return this.cmp(i)>=0},o.prototype.ltn=function(i){return this.cmpn(i)===-1},o.prototype.lt=function(i){return this.cmp(i)===-1},o.prototype.lten=function(i){return this.cmpn(i)<=0},o.prototype.lte=function(i){return this.cmp(i)<=0},o.prototype.eqn=function(i){return this.cmpn(i)===0},o.prototype.eq=function(i){return this.cmp(i)===0},o.red=function(i){return new ct(i)},o.prototype.toRed=function(i){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),i.convertTo(this)._forceRed(i)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(i){return this.red=i,this},o.prototype.forceRed=function(i){return e(!this.red,"Already a number in reduction context"),this._forceRed(i)},o.prototype.redAdd=function(i){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,i)},o.prototype.redIAdd=function(i){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,i)},o.prototype.redSub=function(i){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,i)},o.prototype.redISub=function(i){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,i)},o.prototype.redShl=function(i){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,i)},o.prototype.redMul=function(i){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,i),this.red.mul(this,i)},o.prototype.redIMul=function(i){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,i),this.red.imul(this,i)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(i){return e(this.red&&!i.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,i)};var xt={k256:null,p224:null,p192:null,p25519:null};function ot(g,i){this.name=g,this.p=new o(i,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ot.prototype._tmp=function(){var i=new o(null);return i.words=new Array(Math.ceil(this.n/13)),i},ot.prototype.ireduce=function(i){var a=i,u;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),u=a.bitLength();while(u>this.n);var c=u0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},ot.prototype.split=function(i,a){i.iushrn(this.n,0,a)},ot.prototype.imulK=function(i){return i.imul(this.k)};function pt(){ot.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(pt,ot),pt.prototype.split=function(i,a){for(var u=4194303,c=Math.min(i.length,9),d=0;d>>22,w=v}w>>>=22,i.words[d-10]=w,w===0&&i.length>10?i.length-=10:i.length-=9},pt.prototype.imulK=function(i){i.words[i.length]=0,i.words[i.length+1]=0,i.length+=2;for(var a=0,u=0;u>>=26,i.words[u]=d,a=c}return a!==0&&(i.words[i.length++]=a),i},o._prime=function(i){if(xt[i])return xt[i];var a;if(i==="k256")a=new pt;else if(i==="p224")a=new St;else if(i==="p192")a=new At;else if(i==="p25519")a=new Ee;else throw new Error("Unknown prime "+i);return xt[i]=a,a};function ct(g){if(typeof g=="string"){var i=o._prime(g);this.m=i.p,this.prime=i}else e(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}ct.prototype._verify1=function(i){e(i.negative===0,"red works only with positives"),e(i.red,"red works only with red numbers")},ct.prototype._verify2=function(i,a){e((i.negative|a.negative)===0,"red works only with positives"),e(i.red&&i.red===a.red,"red works only with red numbers")},ct.prototype.imod=function(i){return this.prime?this.prime.ireduce(i)._forceRed(this):(E(i,i.umod(this.m)._forceRed(this)),i)},ct.prototype.neg=function(i){return i.isZero()?i.clone():this.m.sub(i)._forceRed(this)},ct.prototype.add=function(i,a){this._verify2(i,a);var u=i.add(a);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},ct.prototype.iadd=function(i,a){this._verify2(i,a);var u=i.iadd(a);return u.cmp(this.m)>=0&&u.isub(this.m),u},ct.prototype.sub=function(i,a){this._verify2(i,a);var u=i.sub(a);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},ct.prototype.isub=function(i,a){this._verify2(i,a);var u=i.isub(a);return u.cmpn(0)<0&&u.iadd(this.m),u},ct.prototype.shl=function(i,a){return this._verify1(i),this.imod(i.ushln(a))},ct.prototype.imul=function(i,a){return this._verify2(i,a),this.imod(i.imul(a))},ct.prototype.mul=function(i,a){return this._verify2(i,a),this.imod(i.mul(a))},ct.prototype.isqr=function(i){return this.imul(i,i.clone())},ct.prototype.sqr=function(i){return this.mul(i,i)},ct.prototype.sqrt=function(i){if(i.isZero())return i.clone();var a=this.m.andln(3);if(e(a%2===1),a===3){var u=this.m.add(new o(1)).iushrn(2);return this.pow(i,u)}for(var c=this.m.subn(1),d=0;!c.isZero()&&c.andln(1)===0;)d++,c.iushrn(1);e(!c.isZero());var w=new o(1).toRed(this),v=w.redNeg(),p=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);this.pow(s,p).cmp(v)!==0;)s.redIAdd(v);for(var y=this.pow(s,c),R=this.pow(i,c.addn(1).iushrn(1)),U=this.pow(i,c),H=d;U.cmp(w)!==0;){for(var tt=U,st=0;tt.cmp(w)!==0;st++)tt=tt.redSqr();e(st=0;d--){for(var y=a.words[d],R=s-1;R>=0;R--){var U=y>>R&1;if(w!==c[0]&&(w=this.sqr(w)),U===0&&v===0){p=0;continue}v<<=1,v|=U,p++,!(p!==u&&(d!==0||R!==0))&&(w=this.mul(w,c[v]),p=0,v=0)}s=26}return w},ct.prototype.convertTo=function(i){var a=i.umod(this.m);return a===i?a.clone():a},ct.prototype.convertFrom=function(i){var a=i.clone();return a.red=null,a},o.mont=function(i){return new Lt(i)};function Lt(g){ct.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(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)}n(Lt,ct),Lt.prototype.convertTo=function(i){return this.imod(i.ushln(this.shift))},Lt.prototype.convertFrom=function(i){var a=this.imod(i.mul(this.rinv));return a.red=null,a},Lt.prototype.imul=function(i,a){if(i.isZero()||a.isZero())return i.words[0]=0,i.length=1,i;var u=i.imul(a),c=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=u.isub(c).iushrn(this.shift),w=d;return d.cmp(this.m)>=0?w=d.isub(this.m):d.cmpn(0)<0&&(w=d.iadd(this.m)),w._forceRed(this)},Lt.prototype.mul=function(i,a){if(i.isZero()||a.isZero())return new o(0)._forceRed(this);var u=i.mul(a),c=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=u.isub(c).iushrn(this.shift),w=d;return d.cmp(this.m)>=0?w=d.isub(this.m):d.cmpn(0)<0&&(w=d.iadd(this.m)),w._forceRed(this)},Lt.prototype.invm=function(i){var a=this.imod(i._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(typeof Hs>"u"||Hs,Jf)});var tu=$e((my,Qf)=>{var wy=D(V()),R0=Fs(),T0="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Qf.exports=R0(T0)});var eu=$e(Gs=>{"use strict";var xy=D(V());function Jr(r,t,e){return t<=r&&r<=e}function lo(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function P0(r){for(var t=String(r),e=t.length,n=0,o=[];n57343)o.push(f);else if(56320<=f&&f<=57343)o.push(65533);else if(55296<=f&&f<=56319)if(n===e-1)o.push(65533);else{var h=r.charCodeAt(n+1);if(56320<=h&&h<=57343){var x=f&1023,b=h&1023;o.push(65536+(x<<10)+b),n+=1}else o.push(65533)}n+=1}return o}function C0(r){for(var t="",e=0;e>10)+55296,(n&1023)+56320))}return t}var fo=-1;function Vs(r){this.tokens=[].slice.call(r)}Vs.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():fo},prepend:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.push(t.shift());else this.tokens.push(r)}};var Qn=-1;function $s(r,t){if(r)throw TypeError("Decoder error");return t||65533}var uo="utf-8";function co(r,t){if(!(this instanceof co))return new co(r,t);if(r=r!==void 0?String(r).toLowerCase():uo,r!==uo)throw new Error("Encoding not supported. Only utf-8 is supported");t=lo(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}co.prototype={decode:function(t,e){var n;typeof t=="object"&&t instanceof ArrayBuffer?n=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):n=new Uint8Array(0),e=lo(e),this._streaming||(this._decoder=new U0({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var o=new Vs(n),f=[],h;!o.endOfStream()&&(h=this._decoder.handler(o,o.read()),h!==Qn);)h!==null&&(Array.isArray(h)?f.push.apply(f,h):f.push(h));if(!this._streaming){do{if(h=this._decoder.handler(o,o.read()),h===Qn)break;h!==null&&(Array.isArray(h)?f.push.apply(f,h):f.push(h))}while(!o.endOfStream());this._decoder=null}return f.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(f[0]===65279?(this._BOMseen=!0,f.shift()):this._BOMseen=!0),C0(f)}};function ho(r,t){if(!(this instanceof ho))return new ho(r,t);if(r=r!==void 0?String(r).toLowerCase():uo,r!==uo)throw new Error("Encoding not supported. Only utf-8 is supported");t=lo(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}ho.prototype={encode:function(t,e){t=t?String(t):"",e=lo(e),this._streaming||(this._encoder=new O0(this._options)),this._streaming=!!e.stream;for(var n=[],o=new Vs(P0(t)),f;!o.endOfStream()&&(f=this._encoder.handler(o,o.read()),f!==Qn);)Array.isArray(f)?n.push.apply(n,f):n.push(f);if(!this._streaming){for(;f=this._encoder.handler(o,o.read()),f!==Qn;)Array.isArray(f)?n.push.apply(n,f):n.push(f);this._encoder=null}return new Uint8Array(n)}};function U0(r){var t=r.fatal,e=0,n=0,o=0,f=128,h=191;this.handler=function(x,b){if(b===fo&&o!==0)return o=0,$s(t);if(b===fo)return Qn;if(o===0){if(Jr(b,0,127))return b;if(Jr(b,194,223))o=1,e=b-192;else if(Jr(b,224,239))b===224&&(f=160),b===237&&(h=159),o=2,e=b-224;else if(Jr(b,240,244))b===240&&(f=144),b===244&&(h=143),o=3,e=b-240;else return $s(t);return e=e<<6*o,null}if(!Jr(b,f,h))return e=o=n=0,f=128,h=191,x.prepend(b),$s(t);if(f=128,h=191,n+=1,e+=b-128<<6*(o-n),n!==o)return null;var E=e;return e=o=n=0,E}}function O0(r){var t=r.fatal;this.handler=function(e,n){if(n===fo)return Qn;if(Jr(n,0,127))return n;var o,f;Jr(n,128,2047)?(o=1,f=192):Jr(n,2048,65535)?(o=2,f=224):Jr(n,65536,1114111)&&(o=3,f=240);for(var h=[(n>>6*o)+f];o>0;){var x=n>>6*(o-1);h.push(128|x&63),o-=1}return h}}Gs.TextEncoder=ho;Gs.TextDecoder=co});var su=$e(Te=>{"use strict";var ky=D(V()),N0=Te&&Te.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e),Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[e]}})}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),z0=Te&&Te.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Dr=Te&&Te.__decorate||function(r,t,e,n){var o=arguments.length,f=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(r,t,e,n);else for(var x=r.length-1;x>=0;x--)(h=r[x])&&(f=(o<3?h(f):o>3?h(t,e,f):h(t,e))||f);return o>3&&f&&Object.defineProperty(t,e,f),f},K0=Te&&Te.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.hasOwnProperty.call(r,e)&&N0(t,r,e);return z0(t,r),t},ru=Te&&Te.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Te,"__esModule",{value:!0});Te.deserializeUnchecked=Te.deserialize=Te.serialize=Te.BinaryReader=Te.BinaryWriter=Te.BorshError=Te.baseDecode=Te.baseEncode=void 0;var mn=ru(Xf()),nu=ru(tu()),q0=K0(eu()),F0=typeof TextDecoder!="function"?q0.TextDecoder:TextDecoder,D0=new F0("utf-8",{fatal:!0});function W0(r){return typeof r=="string"&&(r=Buffer.from(r,"utf8")),nu.default.encode(Buffer.from(r))}Te.baseEncode=W0;function H0(r){return Buffer.from(nu.default.decode(r))}Te.baseDecode=H0;var js=1024,Qe=class extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}};Te.BorshError=Qe;var po=class{constructor(){this.buf=Buffer.alloc(js),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(js)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mn.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mn.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mn.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mn.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),t,Buffer.alloc(js)]),this.length+=t.length}writeString(t){this.maybeResize();let e=Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(let n of t)this.maybeResize(),e(n)}toArray(){return this.buf.subarray(0,this.length)}};Te.BinaryWriter=po;function Wr(r,t,e){let n=e.value;e.value=function(...o){try{return n.apply(this,o)}catch(f){if(f instanceof RangeError){let h=f.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(h)>=0)throw new Qe("Reached the end of buffer when deserializing")}throw f}}}var lr=class{constructor(t){this.buf=t,this.offset=0}readU8(){let t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){let t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){let t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){let t=this.readBuffer(8);return new mn.default(t,"le")}readU128(){let t=this.readBuffer(16);return new mn.default(t,"le")}readU256(){let t=this.readBuffer(32);return new mn.default(t,"le")}readU512(){let t=this.readBuffer(64);return new mn.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new Qe(`Expected buffer length ${t} isn\'t within bounds`);let e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){let t=this.readU32(),e=this.readBuffer(t);try{return D0.decode(e)}catch(n){throw new Qe(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){let e=this.readU32(),n=Array();for(let o=0;o{Nn(r,t,f,n[0],o)});else if(n.kind!==void 0)switch(n.kind){case"option":{e==null?o.writeU8(0):(o.writeU8(1),Nn(r,t,e,n.type,o));break}case"map":{o.writeU32(e.size),e.forEach((f,h)=>{Nn(r,t,h,n.key,o),Nn(r,t,f,n.value,o)});break}default:throw new Qe(`FieldType ${n} unrecognized`)}else ou(r,e,o)}catch(f){throw f instanceof Qe&&f.addToFieldPath(t),f}}function ou(r,t,e){if(typeof t.borshSerialize=="function"){t.borshSerialize(e);return}let n=r.get(t.constructor);if(!n)throw new Qe(`Class ${t.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([o,f])=>{Nn(r,o,t[o],f,e)});else if(n.kind==="enum"){let o=t[n.field];for(let f=0;fzn(r,t,e[0],n))}if(e.kind==="option")return n.readU8()?zn(r,t,e.type,n):void 0;if(e.kind==="map"){let o=new Map,f=n.readU32();for(let h=0;h=n.values.length)throw new Qe(`Enum index: ${o} is out of range`);let[f,h]=n.values[o],x=zn(r,f,h,e);return new t({[f]:x})}throw new Qe(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}function V0(r,t,e,n=lr){let o=new n(e),f=Ys(r,t,o);if(o.offset{"use strict";var By=D(V());Object.defineProperty(K,"__esModule",{value:!0});K.s16=K.s8=K.nu64be=K.u48be=K.u40be=K.u32be=K.u24be=K.u16be=K.nu64=K.u48=K.u40=K.u32=K.u24=K.u16=K.u8=K.offset=K.greedy=K.Constant=K.UTF8=K.CString=K.Blob=K.Boolean=K.BitField=K.BitStructure=K.VariantLayout=K.Union=K.UnionLayoutDiscriminator=K.UnionDiscriminator=K.Structure=K.Sequence=K.DoubleBE=K.Double=K.FloatBE=K.Float=K.NearInt64BE=K.NearInt64=K.NearUInt64BE=K.NearUInt64=K.IntBE=K.Int=K.UIntBE=K.UInt=K.OffsetLayout=K.GreedyCount=K.ExternalLayout=K.bindConstructorLayout=K.nameWithProperty=K.Layout=K.uint8ArrayToBuffer=K.checkUint8Array=void 0;K.constant=K.utf8=K.cstr=K.blob=K.unionLayoutDiscriminator=K.union=K.seq=K.bits=K.struct=K.f64be=K.f64=K.f32be=K.f32=K.ns64be=K.s48be=K.s40be=K.s32be=K.s24be=K.s16be=K.ns64=K.s48=K.s40=K.s32=K.s24=void 0;var Js=An();function ri(r){if(!(r instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}K.checkUint8Array=ri;function Ae(r){return ri(r),Js.Buffer.from(r.buffer,r.byteOffset,r.length)}K.uint8ArrayToBuffer=Ae;var Ie=class{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){let e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}};K.Layout=Ie;function Xs(r,t){return t.property?r+"["+t.property+"]":r}K.nameWithProperty=Xs;function j0(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Ie))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value(e,n){return t.decode(e,n)},writable:!0})}K.bindConstructorLayout=j0;var ir=class extends Ie{isCount(){throw new Error("ExternalLayout is abstract")}};K.ExternalLayout=ir;var yo=class extends ir{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){ri(t);let n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}};K.GreedyCount=yo;var xi=class extends ir{constructor(t,e=0,n){if(!(t instanceof Ie))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof mr||this.layout instanceof vr}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}};K.OffsetLayout=xi;var mr=class extends Ie{constructor(t,e){if(super(t,e),6h+o.encode(x,e,n+h),0);return this.count instanceof ir&&this.count.encode(t.length,e,n),f}};K.Sequence=Bo;var _o=class extends Ie{constructor(t,e,n){if(!(Array.isArray(t)&&t.reduce((f,h)=>f&&h instanceof Ie,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(let f of t)if(0>f.span&&f.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let o=-1;try{o=t.reduce((f,h)=>f+h.getSpan(),0)}catch{}super(o,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((o,f)=>{let h=f.getSpan(t,e);return e+=h,o+h},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e=0){ri(t);let n=this.makeDestinationObject();for(let o of this.fields)if(o.property!==void 0&&(n[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){let o=n,f=0,h=0;for(let x of this.fields){let b=x.span;if(h=0b&&(b=x.getSpan(e,n)))}f=n,n+=b}return f+h-o}fromArray(t){let e=this.makeDestinationObject();for(let n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}};K.Structure=_o;var vi=class{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}};K.UnionDiscriminator=vi;var ei=class extends vi{constructor(t,e){if(!(t instanceof ir&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}};K.UnionLayoutDiscriminator=ei;var ki=class extends Ie{constructor(t,e,n){let o;if(t instanceof mr||t instanceof vr)o=new ei(new xi(t));else if(t instanceof ir&&t.isCount())o=new ei(t);else if(t instanceof vi)o=t;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Ie))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let f=-1;e&&(f=e.span,0<=f&&(t instanceof mr||t instanceof vr)&&(f+=o.layout.span)),super(f,n),this.discriminator=o,this.usesPrefixDiscriminator=t instanceof mr||t instanceof vr,this.defaultLayout=e,this.registry={};let h=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(x){return h(x)},this.configGetSourceVariant=function(x){h=x.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;let n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;let e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(let e in this.registry){let n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n,o=this.discriminator,f=o.decode(t,e),h=this.registry[f];if(h===void 0){let x=this.defaultLayout,b=0;this.usesPrefixDiscriminator&&(b=o.layout.span),n=this.makeDestinationObject(),n[o.property]=f,n[x.property]=x.decode(t,e+b)}else n=h.decode(t,e);return n}encode(t,e,n=0){let o=this.getSourceVariant(t);if(o===void 0){let f=this.discriminator,h=this.defaultLayout,x=0;return this.usesPrefixDiscriminator&&(x=f.layout.span),f.encode(t[f.property],e,n),x+h.encode(t[h.property],e,n+x)}return o.encode(t,e,n)}addVariant(t,e,n){let o=new Eo(this,t,e,n);return this.registry[t]=o,o}getVariant(t,e=0){let n;return t instanceof Uint8Array?n=this.discriminator.decode(t,e):n=t,this.registry[n]}};K.Union=ki;var Eo=class extends Ie{constructor(t,e,n,o){if(!(t instanceof ki))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&o===void 0&&(o=n,n=null),n){if(!(n instanceof Ie))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof o!="string")throw new TypeError("variant must have a String property")}let f=t.span;0>t.span&&(f=n?n.span:0,0<=f&&t.usesPrefixDiscriminator&&(f+=t.discriminator.layout.span)),super(f,o),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let o=0;return this.layout&&(o=this.layout.getSpan(t,e+n)),n+o}decode(t,e=0){let n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let o=0;return this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+o):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let o=0;if(this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let f=o;if(this.layout&&(this.layout.encode(t[this.property],e,n+o),f+=this.layout.getSpan(e,n+o),0<=this.union.span&&f>this.union.span))throw new Error("encoded variant overruns containing union");return f}fromArray(t){if(this.layout)return this.layout.fromArray(t)}};K.VariantLayout=Eo;function ti(r){return 0>r&&(r+=4294967296),r}var Si=class extends Ie{constructor(t,e,n){if(!(t instanceof mr||t instanceof vr))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");let o=8*t.span,f=t.fields.reduce((h,x)=>h+x.bits,0);if(e+f>o)throw new Error("bits too long for span remainder ("+(o-f)+" of "+o+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==ti(t&this.valueMask))throw new TypeError(Xs("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let e=this.container._packedGetValue(),n=ti(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),Ae(t).slice(e,e+n)}encode(t,e,n){let o=this.length;if(this.length instanceof ir&&(o=t.length),!(t instanceof Uint8Array&&o===t.length))throw new TypeError(Xs("Blob.encode",this)+" requires (length "+o+") Uint8Array as src");if(n+o>e.length)throw new RangeError("encoding overruns Uint8Array");let f=Ae(t);return Ae(e).write(f.toString("hex"),n,o,"hex"),this.length instanceof ir&&this.length.encode(o,e,n),o}};K.Blob=Mo;var Io=class extends Ie{constructor(t){super(-1,t)}getSpan(t,e=0){ri(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");let h=Ae(e);return o.copy(h,n),h[n+f]=0,f+1}};K.CString=Io;var Lo=class extends Ie{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return ri(t),t.length-e}decode(t,e=0){let n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return o.copy(Ae(e),n),f}};K.UTF8=Lo;var Ro=class extends Ie{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}};K.Constant=Ro;K.greedy=(r,t)=>new yo(r,t);K.offset=(r,t,e)=>new xi(r,t,e);K.u8=r=>new mr(1,r);K.u16=r=>new mr(2,r);K.u24=r=>new mr(3,r);K.u32=r=>new mr(4,r);K.u40=r=>new mr(5,r);K.u48=r=>new mr(6,r);K.nu64=r=>new go(r);K.u16be=r=>new vr(2,r);K.u24be=r=>new vr(3,r);K.u32be=r=>new vr(4,r);K.u40be=r=>new vr(5,r);K.u48be=r=>new vr(6,r);K.nu64be=r=>new mo(r);K.s8=r=>new Xr(1,r);K.s16=r=>new Xr(2,r);K.s24=r=>new Xr(3,r);K.s32=r=>new Xr(4,r);K.s40=r=>new Xr(5,r);K.s48=r=>new Xr(6,r);K.ns64=r=>new wo(r);K.s16be=r=>new wn(2,r);K.s24be=r=>new wn(3,r);K.s32be=r=>new wn(4,r);K.s40be=r=>new wn(5,r);K.s48be=r=>new wn(6,r);K.ns64be=r=>new bo(r);K.f32=r=>new xo(r);K.f32be=r=>new vo(r);K.f64=r=>new ko(r);K.f64be=r=>new So(r);K.struct=(r,t,e)=>new _o(r,t,e);K.bits=(r,t,e)=>new Si(r,t,e);K.seq=(r,t,e)=>new Bo(r,t,e);K.union=(r,t,e)=>new ki(r,t,e);K.unionLayoutDiscriminator=(r,t)=>new ei(r,t);K.blob=(r,t)=>new Mo(r,t);K.cstr=r=>new Io(r);K.utf8=(r,t)=>new Lo(r,t);K.constant=(r,t)=>new Ro(r,t)});var au=$e(ni=>{"use strict";var Ey=D(V());Object.defineProperty(ni,"__esModule",{value:!0});var Co;function Y0(r){{let t=Buffer.from(r);t.reverse();let e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}return Co.toBigInt(r,!1)}ni.toBigIntLE=Y0;function Z0(r){{let t=r.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}return Co.toBigInt(r,!0)}ni.toBigIntBE=Z0;function J0(r,t){{let e=r.toString(16),n=Buffer.from(e.padStart(t*2,"0").slice(0,t*2),"hex");return n.reverse(),n}return Co.fromBigInt(r,Buffer.allocUnsafe(t),!1)}ni.toBufferLE=J0;function X0(r,t){{let e=r.toString(16);return Buffer.from(e.padStart(t*2,"0").slice(0,t*2),"hex")}return Co.fromBigInt(r,Buffer.allocUnsafe(t),!0)}ni.toBufferBE=X0});function Q0(r){return _i(r)&&typeof r[Symbol.iterator]=="function"}function _i(r){return typeof r=="object"&&r!=null}function Uo(r){return _i(r)&&!Array.isArray(r)}function Pr(r){return typeof r=="symbol"?r.toString():typeof r=="string"?JSON.stringify(r):`${r}`}function tl(r){let{done:t,value:e}=r.next();return t?void 0:e}function el(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});let{path:o,branch:f}=t,{type:h}=e,{refinement:x,message:b=`Expected a value of type \\`${h}\\`${x?` with refinement \\`${x}\\``:""}, but received: \\`${Pr(n)}\\``}=r;return{value:n,type:h,refinement:x,key:o[o.length-1],path:o,branch:f,...r,message:b}}function*fu(r,t,e,n){Q0(r)||(r=[r]);for(let o of r){let f=el(o,t,e,n);f&&(yield f)}}function*ea(r,t,e={}){let{path:n=[],branch:o=[r],coerce:f=!1,mask:h=!1}=e,x={path:n,branch:o,mask:h};f&&(r=t.coercer(r,x));let b="valid";for(let E of t.validator(r,x))E.explanation=e.message,b="not_valid",yield[E,void 0];for(let[E,_,M]of t.entries(r,x)){let C=ea(_,M,{path:E===void 0?n:[...n,E],branch:E===void 0?o:[...o,_],coerce:f,mask:h,message:e.message});for(let N of C)N[0]?(b=N[0].refinement!=null?"not_refined":"not_valid",yield[N[0],void 0]):f&&(_=N[1],E===void 0?r=_:r instanceof Map?r.set(E,_):r instanceof Set?r.add(_):_i(r)&&(_!==void 0||E in r)&&(r[E]=_))}if(b!=="not_valid")for(let E of t.refiner(r,x))E.explanation=e.message,b="not_refined",yield[E,void 0];b==="valid"&&(yield[void 0,r])}function uu(r,t,e){let n=Ei(r,t,{message:e});if(n[0])throw n[0]}function ii(r,t,e){let n=Ei(r,t,{coerce:!0,message:e});if(n[0])throw n[0];return n[1]}function rl(r,t,e){let n=Ei(r,t,{coerce:!0,mask:!0,message:e});if(n[0])throw n[0];return n[1]}function cu(r,t){return!Ei(r,t)[0]}function Ei(r,t,e={}){let n=ea(r,t,e),o=tl(n);return o[0]?[new ta(o[0],function*(){for(let h of n)h[0]&&(yield h[0])}),void 0]:[void 0,o[1]]}function Kn(r,t){return new _r({type:r,schema:null,validator:t})}function hu(){return Kn("any",()=>!0)}function vt(r){return new _r({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(let[e,n]of t.entries())yield[e,n,r]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Pr(t)}`}})}function Cr(){return Kn("boolean",r=>typeof r=="boolean")}function Oo(r){return Kn("instance",t=>t instanceof r||`Expected a \\`${r.name}\\` instance, but received: ${Pr(t)}`)}function ze(r){let t=Pr(r),e=typeof r;return new _r({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator(n){return n===r||`Expected the literal \\`${t}\\`, but received: ${Pr(n)}`}})}function nl(){return Kn("never",()=>!1)}function kt(r){return new _r({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function z(){return Kn("number",r=>typeof r=="number"&&!isNaN(r)||`Expected a number, but received: ${Pr(r)}`)}function Ot(r){return new _r({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function ra(r,t){return new _r({type:"record",schema:null,*entries(e){if(_i(e))for(let n in e){let o=e[n];yield[n,n,r],yield[n,o,t]}},validator(e){return Uo(e)||`Expected an object, but received: ${Pr(e)}`},coercer(e){return Uo(e)?{...e}:e}})}function at(){return Kn("string",r=>typeof r=="string"||`Expected a string, but received: ${Pr(r)}`)}function No(r){let t=nl();return new _r({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){let n=Math.max(r.length,e.length);for(let o=0;oe.type).join(" | ");return new _r({type:"union",schema:null,coercer(e,n){for(let o of r){let[f,h]=o.validate(e,{coerce:!0,mask:n.mask});if(!f)return h}return e},validator(e,n){let o=[];for(let f of r){let[...h]=ea(e,f,n),[x]=h;if(x[0])for(let[b]of h)b&&o.push(b);else return[]}return[`Expected the value to satisfy a union of \\`${t}\\`, but received: ${Pr(e)}`,...o]}})}function qn(){return Kn("unknown",()=>!0)}function oi(r,t,e){return new _r({...r,coercer:(n,o)=>cu(n,t)?r.coercer(e(n,o),o):r.coercer(n,o)})}var My,ta,_r,lu=ae(()=>{My=D(V(),1),ta=class extends TypeError{constructor(t,e){let n,{message:o,explanation:f,...h}=t,{path:x}=t,b=x.length===0?o:`At path: ${x.join(".")} -- ${o}`;super(f??b),f!=null&&(this.cause=b),Object.assign(this,h),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...e()])}};_r=class{constructor(t){let{type:e,schema:n,validator:o,refiner:f,coercer:h=b=>b,entries:x=function*(){}}=t;this.type=e,this.schema=n,this.entries=x,this.coercer=h,o?this.validator=(b,E)=>{let _=o(b,E);return fu(_,E,this,b)}:this.validator=()=>[],f?this.refiner=(b,E)=>{let _=f(b,E);return fu(_,E,this,b)}:this.refiner=()=>[]}assert(t,e){return uu(t,this,e)}create(t,e){return ii(t,this,e)}is(t){return cu(t,this)}mask(t,e){return rl(t,this,e)}validate(t,e={}){return Ei(t,this,e)}}});function Ai(){if(!zo&&(zo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!zo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return zo(il)}var Ly,zo,il,na=ae(()=>{Ly=D(V()),il=new Uint8Array(16)});var Ty,du,pu=ae(()=>{Ty=D(V()),du=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function ol(r){return typeof r=="string"&&du.test(r)}var Uy,bn,Mi=ae(()=>{Uy=D(V());pu();bn=ol});function sl(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(tr[r[t+0]]+tr[r[t+1]]+tr[r[t+2]]+tr[r[t+3]]+"-"+tr[r[t+4]]+tr[r[t+5]]+"-"+tr[r[t+6]]+tr[r[t+7]]+"-"+tr[r[t+8]]+tr[r[t+9]]+"-"+tr[r[t+10]]+tr[r[t+11]]+tr[r[t+12]]+tr[r[t+13]]+tr[r[t+14]]+tr[r[t+15]]).toLowerCase();if(!bn(e))throw TypeError("Stringified UUID is invalid");return e}var zy,tr,Ko,xn,Ii=ae(()=>{zy=D(V());Mi();tr=[];for(Ko=0;Ko<256;++Ko)tr.push((Ko+256).toString(16).substr(1));xn=sl});function al(r,t,e){var n=t&&e||0,o=t||new Array(16);r=r||{};var f=r.node||yu,h=r.clockseq!==void 0?r.clockseq:ia;if(f==null||h==null){var x=r.random||(r.rng||Ai)();f==null&&(f=yu=[x[0]|1,x[1],x[2],x[3],x[4],x[5]]),h==null&&(h=ia=(x[6]<<8|x[7])&16383)}var b=r.msecs!==void 0?r.msecs:Date.now(),E=r.nsecs!==void 0?r.nsecs:sa+1,_=b-oa+(E-sa)/1e4;if(_<0&&r.clockseq===void 0&&(h=h+1&16383),(_<0||b>oa)&&r.nsecs===void 0&&(E=0),E>=1e4)throw new Error("uuid.v1(): Can\'t create more than 10M uuids/sec");oa=b,sa=E,ia=h,b+=122192928e5;var M=((b&268435455)*1e4+E)%4294967296;o[n++]=M>>>24&255,o[n++]=M>>>16&255,o[n++]=M>>>8&255,o[n++]=M&255;var C=b/4294967296*1e4&268435455;o[n++]=C>>>8&255,o[n++]=C&255,o[n++]=C>>>24&15|16,o[n++]=C>>>16&255,o[n++]=h>>>8|128,o[n++]=h&255;for(var N=0;N<6;++N)o[n+N]=f[N];return t||xn(o)}var Dy,yu,ia,oa,sa,gu,mu=ae(()=>{Dy=D(V());na();Ii();oa=0,sa=0;gu=al});function fl(r){if(!bn(r))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(r.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(r.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(r.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(r.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}var $y,qo,aa=ae(()=>{$y=D(V());Mi();qo=fl});function ul(r){r=unescape(encodeURIComponent(r));for(var t=[],e=0;e{Yy=D(V());Ii();aa();cl="6ba7b810-9dad-11d1-80b4-00c04fd430c8",hl="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function ll(r){if(typeof r=="string"){var t=unescape(encodeURIComponent(r));r=new Uint8Array(t.length);for(var e=0;e>5]>>>o%32&255,h=parseInt(n.charAt(f>>>4&15)+n.charAt(f&15),16);t.push(h)}return t}function wu(r){return(r+64>>>9<<4)+14+1}function pl(r,t){r[t>>5]|=128<>5]|=(r[n/8]&255)<>16)+(t>>16)+(e>>16);return n<<16|e&65535}function gl(r,t){return r<>>32-t}function Do(r,t,e,n,o,f){return vn(gl(vn(vn(t,r),vn(n,f)),o),e)}function sr(r,t,e,n,o,f,h){return Do(t&e|~t&n,r,t,o,f,h)}function ar(r,t,e,n,o,f,h){return Do(t&n|e&~n,r,t,o,f,h)}function fr(r,t,e,n,o,f,h){return Do(t^e^n,r,t,o,f,h)}function ur(r,t,e,n,o,f,h){return Do(e^(t|~n),r,t,o,f,h)}var Jy,bu,xu=ae(()=>{Jy=D(V());bu=ll});var e1,ml,vu,ku=ae(()=>{e1=D(V());fa();xu();ml=Fo("v3",48,bu),vu=ml});function wl(r,t,e){r=r||{};var n=r.random||(r.rng||Ai)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){e=e||0;for(var o=0;o<16;++o)t[e+o]=n[o];return t}return xn(n)}var o1,Su,Bu=ae(()=>{o1=D(V());na();Ii();Su=wl});function bl(r,t,e,n){switch(r){case 0:return t&e^~t&n;case 1:return t^e^n;case 2:return t&e^t&n^e&n;case 3:return t^e^n}}function ua(r,t){return r<>>32-t}function xl(r){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var o=0;o>>0;j=it,it=J,J=ua(P,30)>>>0,P=W,W=ot}e[0]=e[0]+W>>>0,e[1]=e[1]+P>>>0,e[2]=e[2]+J>>>0,e[3]=e[3]+it>>>0,e[4]=e[4]+j>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var a1,_u,Eu=ae(()=>{a1=D(V());_u=xl});var h1,vl,Au,Mu=ae(()=>{h1=D(V());fa();Eu();vl=Fo("v5",80,_u),Au=vl});var d1,Iu,Lu=ae(()=>{d1=D(V()),Iu="00000000-0000-0000-0000-000000000000"});function kl(r){if(!bn(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)}var g1,Ru,Tu=ae(()=>{g1=D(V());Mi();Ru=kl});var ca={};Ka(ca,{NIL:()=>Iu,parse:()=>qo,stringify:()=>xn,v1:()=>gu,v3:()=>vu,v4:()=>Su,v5:()=>Au,validate:()=>bn,version:()=>Ru});var m1,ha=ae(()=>{m1=D(V());mu();ku();Bu();Mu();Lu();Tu();Mi();Ii();aa()});var Cu=$e((A1,Pu)=>{"use strict";var M1=D(V()),Sl=(ha(),Fa(ca)).v4,Bl=function(r,t,e,n){if(typeof r!="string")throw new TypeError(r+" must be a string");n=n||{};let o=typeof n.version=="number"?n.version:2;if(o!==1&&o!==2)throw new TypeError(o+" must be 1 or 2");let f={method:r};if(o===2&&(f.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");f.params=t}if(typeof e>"u"){let h=typeof n.generator=="function"?n.generator:function(){return Sl()};f.id=h(f,n)}else o===2&&e===null?n.notificationIdNull&&(f.id=null):f.id=e;return f};Pu.exports=Bl});var Ou=$e((I1,Uu)=>{"use strict";var L1=D(V()),_l=(ha(),Fa(ca)).v4,El=Cu(),Li=function(r,t){if(!(this instanceof Li))return new Li(r,t);t||(t={}),this.options={reviver:typeof t.reviver<"u"?t.reviver:null,replacer:typeof t.replacer<"u"?t.replacer:null,generator:typeof t.generator<"u"?t.generator:function(){return _l()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=r};Uu.exports=Li;Li.prototype.request=function(r,t,e,n){let o=this,f=null,h=Array.isArray(r)&&typeof t=="function";if(this.options.version===1&&h)throw new TypeError("JSON-RPC 1.0 does not support batching");if(h||!h&&r&&typeof r=="object"&&typeof t=="function")n=t,f=r;else{typeof e=="function"&&(n=e,e=void 0);let E=typeof n=="function";try{f=El(r,t,e,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(_){if(E)return n(_);throw _}if(!E)return f}let b;try{b=JSON.stringify(f,this.options.replacer)}catch(E){return n(E)}return this.callServer(b,function(E,_){o._parseResponse(E,_,n)}),f};Li.prototype._parseResponse=function(r,t,e){if(r){e(r);return}if(!t)return e();let n;try{n=JSON.parse(t,this.options.reviver)}catch(o){return e(o)}if(e.length===3)if(Array.isArray(n)){let o=function(h){return typeof h.error<"u"},f=function(h){return!o(h)};return e(null,n.filter(o),n.filter(f))}else return e(null,n.error,n.result);e(null,n)}});var zu=$e((R1,la)=>{"use strict";var T1=D(V()),Al=Object.prototype.hasOwnProperty,dr="~";function Ri(){}Object.create&&(Ri.prototype=Object.create(null),new Ri().__proto__||(dr=!1));function Ml(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function Nu(r,t,e,n,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var f=new Ml(e,n||r,o),h=dr?dr+t:t;return r._events[h]?r._events[h].fn?r._events[h]=[r._events[h],f]:r._events[h].push(f):(r._events[h]=f,r._eventsCount++),r}function Wo(r,t){--r._eventsCount===0?r._events=new Ri:delete r._events[t]}function cr(){this._events=new Ri,this._eventsCount=0}cr.prototype.eventNames=function(){var t=[],e,n;if(this._eventsCount===0)return t;for(n in e=this._events)Al.call(e,n)&&t.push(dr?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};cr.prototype.listeners=function(t){var e=dr?dr+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,f=n.length,h=new Array(f);o{C1=D(V(),1),Ku=D(zu(),1)});var N1,Il,Fu=ae(()=>{N1=D(V(),1),Il=D(An(),1);qu()});function Nl(r,t=24){let e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let h=0;h<10;h++)e[h]=r[h]^r[h+10]^r[h+20]^r[h+30]^r[h+40];for(let h=0;h<10;h+=2){let x=(h+8)%10,b=(h+2)%10,E=e[b],_=e[b+1],M=Du(E,_,1)^e[x],C=Wu(E,_,1)^e[x+1];for(let N=0;N<50;N+=10)r[h+N]^=M,r[h+N+1]^=C}let o=r[2],f=r[3];for(let h=0;h<24;h++){let x=$u[h],b=Du(o,f,x),E=Wu(o,f,x),_=Hu[h];o=r[_],f=r[_+1],r[_]=b,r[_+1]=E}for(let h=0;h<50;h+=10){for(let x=0;x<10;x++)e[x]=r[h+x];for(let x=0;x<10;x++)r[h+x]^=~e[(x+2)%10]&e[(x+4)%10]}r[0]^=Ul[n],r[1]^=Ol[n]}e.fill(0)}var J1,Hu,$u,Vu,Ll,Ti,Rl,Tl,Pl,Cl,Ul,Ol,Du,Wu,si,kn,F1,D1,W1,H1,$1,da,V1,G1,Gu,j1,Y1,ju=ae(()=>{J1=D(V(),1);yi();ks();fn();Hu=[],$u=[],Vu=[],Ll=BigInt(0),Ti=BigInt(1),Rl=BigInt(2),Tl=BigInt(7),Pl=BigInt(256),Cl=BigInt(113);for(let r=0,t=Ti,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],Hu.push(2*(5*n+e)),$u.push((r+1)*(r+2)/2%64);let o=Ll;for(let f=0;f<7;f++)t=(t<>Tl)*Cl)%Pl,t&Rl&&(o^=Ti<<(Ti<e>32?xs(r,t,e):ws(r,t,e),Wu=(r,t,e)=>e>32?vs(r,t,e):bs(r,t,e);si=class extends sn{constructor(t,e,n,o=!1,f=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=o,this.rounds=f,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,pi(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=kf(this.state)}keccak(){ls||ds(this.state32),Nl(this.state32,this.rounds),ls||ds(this.state32),this.posOut=0,this.pos=0}update(t){Vr(this);let{blockLen:e,state:n}=this;t=an(t);let o=t.length;for(let f=0;f=n&&this.keccak();let h=Math.min(n-this.posOut,f-o);t.set(e.subarray(this.posOut,this.posOut+h),o),this.posOut+=h,o+=h}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return pi(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Zi(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:n,outputLen:o,rounds:f,enableXOF:h}=this;return t||(t=new si(e,n,o,h,f)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=f,t.suffix=n,t.outputLen=o,t.enableXOF=h,t.destroyed=this.destroyed,t}},kn=(r,t,e)=>Yn(()=>new si(t,r,e)),F1=kn(6,144,224/8),D1=kn(6,136,256/8),W1=kn(6,104,384/8),H1=kn(6,72,512/8),$1=kn(1,144,224/8),da=kn(1,136,256/8),V1=kn(1,104,384/8),G1=kn(1,72,512/8),Gu=(r,t,e)=>Bf((n={})=>new si(t,r,n.dkLen===void 0?e:n.dkLen,!0)),j1=Gu(31,168,128/8),Y1=Gu(31,136,256/8)});var eg,Ho,pa,Yu=ae(()=>{eg=D(V(),1);yi();fn();Ho=class extends sn{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,xf(t);let n=an(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,f=new Uint8Array(o);f.set(n.length>o?t.create().update(n).digest():n);for(let h=0;hnew Ho(r,t).update(e).digest();pa.create=(r,t)=>new Ho(r,t)});function Zu(r){r.lowS!==void 0&&Rr("lowS",r.lowS),r.prehash!==void 0&&Rr("prehash",r.prehash)}function zl(r){let t=wi(r);qr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}function Fl(r){let t=zl(r),{Fp:e}=t,n=pn(t.n,t.nBitLength),o=t.toBytes||((W,P,J)=>{let it=P.toAffine();return Zr(Uint8Array.from([4]),e.toBytes(it.x),e.toBytes(it.y))}),f=t.fromBytes||(W=>{let P=W.subarray(1),J=e.fromBytes(P.subarray(0,e.BYTES)),it=e.fromBytes(P.subarray(e.BYTES,2*e.BYTES));return{x:J,y:it}});function h(W){let{a:P,b:J}=t,it=e.sqr(W),j=e.mul(it,W);return e.add(e.add(j,e.mul(W,P)),J)}if(!e.eql(e.sqr(t.Gy),h(t.Gx)))throw new Error("bad generator point: equation left != right");function x(W){return gi(W,Ze,t.n)}function b(W){let{allowedPrivateKeyLengths:P,nByteLength:J,wrapPrivateKey:it,n:j}=t;if(P&&typeof W!="bigint"){if(hn(W)&&(W=jr(W)),typeof W!="string"||!P.includes(W.length))throw new Error("Invalid key");W=W.padStart(J*2,"0")}let rt;try{rt=typeof W=="bigint"?W:Yr(De("private key",W,J))}catch{throw new Error(`private key must be ${J} bytes, hex or bigint, not ${typeof W}`)}return it&&(rt=Re(rt,j)),yr("private key",rt,Ze,j),rt}function E(W){if(!(W instanceof C))throw new Error("ProjectivePoint expected")}let _=Tn((W,P)=>{let{px:J,py:it,pz:j}=W;if(e.eql(j,e.ONE))return{x:J,y:it};let rt=W.is0();P==null&&(P=rt?e.ONE:e.inv(j));let xt=e.mul(J,P),ot=e.mul(it,P),pt=e.mul(j,P);if(rt)return{x:e.ZERO,y:e.ZERO};if(!e.eql(pt,e.ONE))throw new Error("invZ was invalid");return{x:xt,y:ot}}),M=Tn(W=>{if(W.is0()){if(t.allowInfinityPoint&&!e.is0(W.py))return;throw new Error("bad point: ZERO")}let{x:P,y:J}=W.toAffine();if(!e.isValid(P)||!e.isValid(J))throw new Error("bad point: x or y not FE");let it=e.sqr(J),j=h(P);if(!e.eql(it,j))throw new Error("bad point: equation left != right");if(!W.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class C{constructor(P,J,it){if(this.px=P,this.py=J,this.pz=it,P==null||!e.isValid(P))throw new Error("x required");if(J==null||!e.isValid(J))throw new Error("y required");if(it==null||!e.isValid(it))throw new Error("z required");Object.freeze(this)}static fromAffine(P){let{x:J,y:it}=P||{};if(!P||!e.isValid(J)||!e.isValid(it))throw new Error("invalid affine point");if(P instanceof C)throw new Error("projective point not allowed");let j=rt=>e.eql(rt,e.ZERO);return j(J)&&j(it)?C.ZERO:new C(J,it,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(P){let J=e.invertBatch(P.map(it=>it.pz));return P.map((it,j)=>it.toAffine(J[j])).map(C.fromAffine)}static fromHex(P){let J=C.fromAffine(f(De("pointHex",P)));return J.assertValidity(),J}static fromPrivateKey(P){return C.BASE.multiply(b(P))}static msm(P,J){return io(C,n,P,J)}_setWindowSize(P){ft.setWindowSize(this,P)}assertValidity(){M(this)}hasEvenY(){let{y:P}=this.toAffine();if(e.isOdd)return!e.isOdd(P);throw new Error("Field doesn\'t support isOdd")}equals(P){E(P);let{px:J,py:it,pz:j}=this,{px:rt,py:xt,pz:ot}=P,pt=e.eql(e.mul(J,ot),e.mul(rt,j)),St=e.eql(e.mul(it,ot),e.mul(xt,j));return pt&&St}negate(){return new C(this.px,e.neg(this.py),this.pz)}double(){let{a:P,b:J}=t,it=e.mul(J,Ju),{px:j,py:rt,pz:xt}=this,ot=e.ZERO,pt=e.ZERO,St=e.ZERO,At=e.mul(j,j),Ee=e.mul(rt,rt),ct=e.mul(xt,xt),Lt=e.mul(j,rt);return Lt=e.add(Lt,Lt),St=e.mul(j,xt),St=e.add(St,St),ot=e.mul(P,St),pt=e.mul(it,ct),pt=e.add(ot,pt),ot=e.sub(Ee,pt),pt=e.add(Ee,pt),pt=e.mul(ot,pt),ot=e.mul(Lt,ot),St=e.mul(it,St),ct=e.mul(P,ct),Lt=e.sub(At,ct),Lt=e.mul(P,Lt),Lt=e.add(Lt,St),St=e.add(At,At),At=e.add(St,At),At=e.add(At,ct),At=e.mul(At,Lt),pt=e.add(pt,At),ct=e.mul(rt,xt),ct=e.add(ct,ct),At=e.mul(ct,Lt),ot=e.sub(ot,At),St=e.mul(ct,Ee),St=e.add(St,St),St=e.add(St,St),new C(ot,pt,St)}add(P){E(P);let{px:J,py:it,pz:j}=this,{px:rt,py:xt,pz:ot}=P,pt=e.ZERO,St=e.ZERO,At=e.ZERO,Ee=t.a,ct=e.mul(t.b,Ju),Lt=e.mul(J,rt),g=e.mul(it,xt),i=e.mul(j,ot),a=e.add(J,it),u=e.add(rt,xt);a=e.mul(a,u),u=e.add(Lt,g),a=e.sub(a,u),u=e.add(J,j);let c=e.add(rt,ot);return u=e.mul(u,c),c=e.add(Lt,i),u=e.sub(u,c),c=e.add(it,j),pt=e.add(xt,ot),c=e.mul(c,pt),pt=e.add(g,i),c=e.sub(c,pt),At=e.mul(Ee,u),pt=e.mul(ct,i),At=e.add(pt,At),pt=e.sub(g,At),At=e.add(g,At),St=e.mul(pt,At),g=e.add(Lt,Lt),g=e.add(g,Lt),i=e.mul(Ee,i),u=e.mul(ct,u),g=e.add(g,i),i=e.sub(Lt,i),i=e.mul(Ee,i),u=e.add(u,i),Lt=e.mul(g,u),St=e.add(St,Lt),Lt=e.mul(c,u),pt=e.mul(a,pt),pt=e.sub(pt,Lt),Lt=e.mul(a,g),At=e.mul(c,At),At=e.add(At,Lt),new C(pt,St,At)}subtract(P){return this.add(P.negate())}is0(){return this.equals(C.ZERO)}wNAF(P){return ft.wNAFCached(this,P,C.normalizeZ)}multiplyUnsafe(P){yr("scalar",P,tn,t.n);let J=C.ZERO;if(P===tn)return J;if(P===Ze)return this;let{endo:it}=t;if(!it)return ft.unsafeLadder(this,P);let{k1neg:j,k1:rt,k2neg:xt,k2:ot}=it.splitScalar(P),pt=J,St=J,At=this;for(;rt>tn||ot>tn;)rt&Ze&&(pt=pt.add(At)),ot&Ze&&(St=St.add(At)),At=At.double(),rt>>=Ze,ot>>=Ze;return j&&(pt=pt.negate()),xt&&(St=St.negate()),St=new C(e.mul(St.px,it.beta),St.py,St.pz),pt.add(St)}multiply(P){let{endo:J,n:it}=t;yr("scalar",P,Ze,it);let j,rt;if(J){let{k1neg:xt,k1:ot,k2neg:pt,k2:St}=J.splitScalar(P),{p:At,f:Ee}=this.wNAF(ot),{p:ct,f:Lt}=this.wNAF(St);At=ft.constTimeNegate(xt,At),ct=ft.constTimeNegate(pt,ct),ct=new C(e.mul(ct.px,J.beta),ct.py,ct.pz),j=At.add(ct),rt=Ee.add(Lt)}else{let{p:xt,f:ot}=this.wNAF(P);j=xt,rt=ot}return C.normalizeZ([j,rt])[0]}multiplyAndAddUnsafe(P,J,it){let j=C.BASE,rt=(ot,pt)=>pt===tn||pt===Ze||!ot.equals(j)?ot.multiplyUnsafe(pt):ot.multiply(pt),xt=rt(this,J).add(rt(P,it));return xt.is0()?void 0:xt}toAffine(P){return _(this,P)}isTorsionFree(){let{h:P,isTorsionFree:J}=t;if(P===Ze)return!0;if(J)return J(C,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:P,clearCofactor:J}=t;return P===Ze?this:J?J(C,this):this.multiplyUnsafe(t.h)}toRawBytes(P=!0){return Rr("isCompressed",P),this.assertValidity(),o(C,this,P)}toHex(P=!0){return Rr("isCompressed",P),jr(this.toRawBytes(P))}}C.BASE=new C(t.Gx,t.Gy,e.ONE),C.ZERO=new C(e.ZERO,e.ONE,e.ZERO);let N=t.nBitLength,ft=no(C,t.endo?Math.ceil(N/2):N);return{CURVE:t,ProjectivePoint:C,normPrivateKeyToScalar:b,weierstrassEquation:h,isWithinCurveOrder:x}}function Dl(r){let t=wi(r);return qr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Xu(r){let t=Dl(r),{Fp:e,n}=t,o=e.BYTES+1,f=2*e.BYTES+1;function h(i){return Re(i,n)}function x(i){return ro(i,n)}let{ProjectivePoint:b,normPrivateKeyToScalar:E,weierstrassEquation:_,isWithinCurveOrder:M}=Fl({...t,toBytes(i,a,u){let c=a.toAffine(),d=e.toBytes(c.x),w=Zr;return Rr("isCompressed",u),u?w(Uint8Array.from([a.hasEvenY()?2:3]),d):w(Uint8Array.from([4]),d,e.toBytes(c.y))},fromBytes(i){let a=i.length,u=i[0],c=i.subarray(1);if(a===o&&(u===2||u===3)){let d=Yr(c);if(!gi(d,Ze,e.ORDER))throw new Error("Point is not on curve");let w=_(d),v;try{v=e.sqrt(w)}catch(y){let R=y instanceof Error?": "+y.message:"";throw new Error("Point is not on curve"+R)}let p=(v&Ze)===Ze;return(u&1)===1!==p&&(v=e.neg(v)),{x:d,y:v}}else if(a===f&&u===4){let d=e.fromBytes(c.subarray(0,e.BYTES)),w=e.fromBytes(c.subarray(e.BYTES,2*e.BYTES));return{x:d,y:w}}else throw new Error(`Point of length ${a} was invalid. Expected ${o} compressed bytes or ${f} uncompressed bytes`)}}),C=i=>jr(dn(i,t.nByteLength));function N(i){let a=n>>Ze;return i>a}function ft(i){return N(i)?h(-i):i}let W=(i,a,u)=>Yr(i.slice(a,u));class P{constructor(a,u,c){this.r=a,this.s=u,this.recovery=c,this.assertValidity()}static fromCompact(a){let u=t.nByteLength;return a=De("compactSignature",a,u*2),new P(W(a,0,u),W(a,u,2*u))}static fromDER(a){let{r:u,s:c}=Qr.toSig(De("DER",a));return new P(u,c)}assertValidity(){yr("r",this.r,Ze,n),yr("s",this.s,Ze,n)}addRecoveryBit(a){return new P(this.r,this.s,a)}recoverPublicKey(a){let{r:u,s:c,recovery:d}=this,w=ot(De("msgHash",a));if(d==null||![0,1,2,3].includes(d))throw new Error("recovery id invalid");let v=d===2||d===3?u+t.n:u;if(v>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let p=d&1?"03":"02",s=b.fromHex(p+C(v)),y=x(v),R=h(-w*y),U=h(c*y),H=b.BASE.multiplyAndAddUnsafe(s,R,U);if(!H)throw new Error("point at infinify");return H.assertValidity(),H}hasHighS(){return N(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,h(-this.s),this.recovery):this}toDERRawBytes(){return Ln(this.toDERHex())}toDERHex(){return Qr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ln(this.toCompactHex())}toCompactHex(){return C(this.r)+C(this.s)}}let J={isValidPrivateKey(i){try{return E(i),!0}catch{return!1}},normPrivateKeyToScalar:E,randomPrivateKey:()=>{let i=Ps(t.n);return Of(t.randomBytes(i),t.n)},precompute(i=8,a=b.BASE){return a._setWindowSize(i),a.multiply(BigInt(3)),a}};function it(i,a=!0){return b.fromPrivateKey(i).toRawBytes(a)}function j(i){let a=hn(i),u=typeof i=="string",c=(a||u)&&i.length;return a?c===o||c===f:u?c===2*o||c===2*f:i instanceof b}function rt(i,a,u=!0){if(j(i))throw new Error("first arg must be private key");if(!j(a))throw new Error("second arg must be public key");return b.fromHex(a).multiply(E(i)).toRawBytes(u)}let xt=t.bits2int||function(i){let a=Yr(i),u=i.length*8-t.nBitLength;return u>0?a>>BigInt(u):a},ot=t.bits2int_modN||function(i){return h(xt(i))},pt=mi(t.nBitLength);function St(i){return yr(`num < 2^${t.nBitLength}`,i,tn,pt),dn(i,t.nByteLength)}function At(i,a,u=Ee){if(["recovered","canonical"].some(st=>st in u))throw new Error("sign() legacy options not supported");let{hash:c,randomBytes:d}=t,{lowS:w,prehash:v,extraEntropy:p}=u;w==null&&(w=!0),i=De("msgHash",i),Zu(u),v&&(i=De("prehashed msgHash",c(i)));let s=ot(i),y=E(a),R=[St(y),St(s)];if(p!=null&&p!==!1){let st=p===!0?d(e.BYTES):p;R.push(De("extraEntropy",st))}let U=Zr(...R),H=s;function tt(st){let dt=xt(st);if(!M(dt))return;let be=x(dt),ht=b.BASE.multiply(dt).toAffine(),Bt=h(ht.x);if(Bt===tn)return;let Xe=h(be*h(H+Bt*y));if(Xe===tn)return;let qt=(ht.x===Bt?0:2)|Number(ht.y&Ze),Ft=Xe;return w&&N(Xe)&&(Ft=ft(Xe),qt^=1),new P(Bt,Ft,qt)}return{seed:U,k2sig:tt}}let Ee={lowS:t.lowS,prehash:!1},ct={lowS:t.lowS,prehash:!1};function Lt(i,a,u=Ee){let{seed:c,k2sig:d}=At(i,a,u),w=t;return Is(w.hash.outputLen,w.nByteLength,w.hmac)(c,d)}b.BASE._setWindowSize(8);function g(i,a,u,c=ct){let d=i;if(a=De("msgHash",a),u=De("publicKey",u),"strict"in c)throw new Error("options.strict was renamed to lowS");Zu(c);let{lowS:w,prehash:v}=c,p,s;try{if(typeof d=="string"||hn(d))try{p=P.fromDER(d)}catch(ht){if(!(ht instanceof Qr.Err))throw ht;p=P.fromCompact(d)}else if(typeof d=="object"&&typeof d.r=="bigint"&&typeof d.s=="bigint"){let{r:ht,s:Bt}=d;p=new P(ht,Bt)}else throw new Error("PARSE");s=b.fromHex(u)}catch(ht){if(ht.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(w&&p.hasHighS())return!1;v&&(a=t.hash(a));let{r:y,s:R}=p,U=ot(a),H=x(R),tt=h(U*H),st=h(y*H),dt=b.BASE.multiplyAndAddUnsafe(s,tt,st)?.toAffine();return dt?h(dt.x)===y:!1}return{CURVE:t,getPublicKey:it,getSharedSecret:rt,sign:Lt,verify:g,ProjectivePoint:b,Signature:P,utils:J}}var fg,Kl,ql,Qr,tn,Ze,og,Ju,sg,Qu=ae(()=>{fg=D(V(),1);Os();Xn();Pn();Pn();({bytesToNumberBE:Kl,hexToBytes:ql}=eo),Qr={Err:class extends Error{constructor(t=""){super(t)}},_tlv:{encode:(r,t)=>{let{Err:e}=Qr;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");let n=t.length/2,o=In(n);if(o.length/2&128)throw new e("tlv.encode: long form length too big");let f=n>127?In(o.length/2|128):"";return`${In(r)}${f}${o}${t}`},decode(r,t){let{Err:e}=Qr,n=0;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[n++]!==r)throw new e("tlv.decode: wrong tlv");let o=t[n++],f=!!(o&128),h=0;if(!f)h=o;else{let b=o&127;if(!b)throw new e("tlv.decode(long): indefinite length not supported");if(b>4)throw new e("tlv.decode(long): byte length is too big");let E=t.subarray(n,n+b);if(E.length!==b)throw new e("tlv.decode: length bytes not complete");if(E[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(let _ of E)h=h<<8|_;if(n+=b,h<128)throw new e("tlv.decode(long): not minimal encoding")}let x=t.subarray(n,n+h);if(x.length!==h)throw new e("tlv.decode: wrong value length");return{v:x,l:t.subarray(n+h)}}},_int:{encode(r){let{Err:t}=Qr;if(rpa(r,t,ps(...e)),randomBytes:Xi}}function tc(r,t){let e=n=>Xu({...r,...Wl(n)});return Object.freeze({...e(t),create:e})}var dg,ec=ae(()=>{dg=D(V(),1);Yu();fn();Qu();});function $l(r){let t=ic,e=BigInt(3),n=BigInt(6),o=BigInt(11),f=BigInt(22),h=BigInt(23),x=BigInt(44),b=BigInt(88),E=r*r*r%t,_=E*E*r%t,M=Ne(_,e,t)*_%t,C=Ne(M,e,t)*_%t,N=Ne(C,ya,t)*E%t,ft=Ne(N,o,t)*N%t,W=Ne(ft,f,t)*ft%t,P=Ne(W,x,t)*W%t,J=Ne(P,b,t)*P%t,it=Ne(J,x,t)*W%t,j=Ne(it,e,t)*_%t,rt=Ne(j,h,t)*ft%t,xt=Ne(rt,n,t)*E%t,ot=Ne(xt,ya,t);if(!ga.eql(ga.sqr(ot),r))throw new Error("Cannot find square root");return ot}var xg,ic,rc,Hl,ya,nc,ga,Pi,mg,wg,oc=ae(()=>{xg=D(V(),1);Ws();ec();Xn();ic=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),rc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Hl=BigInt(1),ya=BigInt(2),nc=(r,t)=>(r+t/ya)/t;ga=pn(ic,void 0,void 0,{sqrt:$l}),Pi=tc({a:BigInt(0),b:BigInt(7),Fp:ga,n:rc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=rc,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Hl*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),f=e,h=BigInt("0x100000000000000000000000000000000"),x=nc(f*r,t),b=nc(-n*r,t),E=Re(r-x*e-b*o,t),_=Re(-x*n-b*f,t),M=E>h,C=_>h;if(M&&(E=t-E),C&&(_=t-_),E>h||_>h)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:M,k1:E,k2neg:C,k2:_}}}},bi),mg=BigInt(0),wg=Pi.ProjectivePoint});function ac(r){try{return Un.ExtendedPoint.fromHex(r),!0}catch{return!1}}function Yl(r){return r._bn!==void 0}function kc(r,t){let e=o=>{if(o.span>=0)return o.span;if(typeof o.alloc=="function")return o.alloc(t[o.property]);if("count"in o&&"elementLayout"in o){let f=t[o.property];if(Array.isArray(f))return f.length*e(o.elementLayout)}else if("fields"in o)return kc({layout:o},t[o.property]);return 0},n=0;return r.layout.fields.forEach(o=>{n+=e(o)}),n}function Oi(r){let t=0,e=0;for(;;){let n=r.shift();if(t|=(n&127)<>=7,e==0){r.push(n);break}else n|=128,r.push(n)}}function je(r,t){if(!r)throw new Error(t||"Assertion failed")}function $o(r){if(r.length===0)throw new Error(Sc);return r.shift()}function zi(r,...t){let[e]=t;if(t.length===2?e+(t[1]??0)>r.length:e>=r.length)throw new Error(Sc);return r.splice(...t)}async function uc(r,t,e,n){let o=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},f=await r.sendTransaction(t,e,o),h;if(t.recentBlockhash!=null&&t.lastValidBlockHeight!=null)h=(await r.confirmTransaction({abortSignal:n?.abortSignal,signature:f,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},n&&n.commitment)).value;else if(t.minNonceContextSlot!=null&&t.nonceInfo!=null){let{nonceInstruction:x}=t.nonceInfo,b=x.keys[0].pubkey;h=(await r.confirmTransaction({abortSignal:n?.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:b,nonceValue:t.nonceInfo.nonce,signature:f},n&&n.commitment)).value}else n?.abortSignal!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),h=(await r.confirmTransaction(f,n&&n.commitment)).value;if(h.err)throw f!=null?new Aa({action:"send",signature:f,transactionMessage:`Status: (${JSON.stringify(h)})`}):new Error(`Transaction ${f} failed (${JSON.stringify(h)})`);return f}function sd(r){return new Promise(t=>setTimeout(t,r))}function ke(r,t){let e=r.layout.span>=0?r.layout.span:kc(r,t),n=Yt.Buffer.alloc(e),o=Object.assign({instruction:r.index},t);return r.layout.encode(o,n),n}function _c(r){return or([et({jsonrpc:ze("2.0"),id:at(),result:r}),et({jsonrpc:ze("2.0"),id:at(),error:et({code:qn(),message:at(),data:Ot(hu())})})])}function Ue(r){return oi(_c(r),ld,t=>"error"in t?t:{...t,result:ii(t.result,r)})}function Ar(r){return Ue(et({context:et({slot:z()}),value:r}))}function Xo(r){return et({context:et({slot:z()}),value:r})}var Dm,Yt,va,wr,hi,L,wc,Hi,Vl,Ig,sc,ka,bc,Gl,Me,Sa,Go,xc,jl,Ki,fc,fe,Lg,jo,Zl,vc,Ba,_a,Ea,Yo,_e,ai,Jl,Xl,Ql,td,qi,Sc,Dn,ed,Ce,Pe,rd,nd,id,od,en,Rg,Tg,ma,Fi,Pg,Cg,Ug,wa,Aa,ad,fd,cc,ud,cd,fi,Er,Je,hd,ui,Og,Ng,zg,We,Bc,Ra,Kg,ld,dd,qg,pd,yd,gd,md,wd,Wn,bd,xd,Fg,vd,kd,Dg,Wg,Hg,$g,Vg,Gg,jg,Yg,Zg,Jg,Sd,Xg,Qg,Ma,tm,em,Ta,rm,Bd,_d,nm,im,om,sm,am,Ed,fm,Ad,um,Md,cm,hm,lm,dm,hc,pm,Id,Ld,ym,gm,Ec,Pa,Ac,Mc,Ic,Lc,Rd,Td,Rc,Tc,Zo,Pc,Qo,Ca,li,Hn,mm,wm,bm,xm,vm,km,Sm,Bm,_m,Em,Am,Mm,Im,Pd,Lm,Rm,Tm,Pm,Cd,Cm,Ur,Ci,Ia,Vo,La,lc,dc,pc,yc,Di,Ud,Od,gc,ba,mc,Nd,xa,Fn,Cc,zd,Wi,Sn,Um,Jo,Ui,Om,ci,Nm,zm,Km,qm,Ua=ae(()=>{Dm=D(V()),Yt=D(An());Df();va=D(Hf()),wr=D(Zf());Ws();hi=D(su()),L=D(Qs()),wc=D(Qs()),Hi=D(au());lu();Vl=D(Ou());Fu();ju();oc();Ig=Un.utils.randomPrivateKey,sc=()=>{let r=Un.utils.randomPrivateKey(),t=ka(r),e=new Uint8Array(64);return e.set(r),e.set(t,32),{publicKey:t,secretKey:e}},ka=Un.getPublicKey;bc=(r,t)=>Un.sign(r,t.slice(0,32)),Gl=Un.verify,Me=r=>Yt.Buffer.isBuffer(r)?r:r instanceof Uint8Array?Yt.Buffer.from(r.buffer,r.byteOffset,r.byteLength):Yt.Buffer.from(r),Sa=class{constructor(t){Object.assign(this,t)}encode(){return Yt.Buffer.from((0,hi.serialize)(Go,this))}static decode(t){return(0,hi.deserialize)(Go,this,t)}static decodeUnchecked(t){return(0,hi.deserializeUnchecked)(Go,this,t)}},Go=new Map,jl=32,Ki=32;fc=1,fe=class extends Sa{constructor(t){if(super({}),this._bn=void 0,Yl(t))this._bn=t._bn;else{if(typeof t=="string"){let e=wr.default.decode(t);if(e.length!=Ki)throw new Error("Invalid public key input");this._bn=new va.default(e)}else this._bn=new va.default(t);if(this._bn.byteLength()>Ki)throw new Error("Invalid public key input")}}static unique(){let t=new fe(fc);return fc+=1,new fe(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return wr.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){let t=this._bn.toArrayLike(Yt.Buffer);if(t.length===Ki)return t;let e=Yt.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){let o=Yt.Buffer.concat([t.toBuffer(),Yt.Buffer.from(e),n.toBuffer()]),f=bi(o);return new fe(f)}static createProgramAddressSync(t,e){let n=Yt.Buffer.alloc(0);t.forEach(function(f){if(f.length>jl)throw new TypeError("Max seed length exceeded");n=Yt.Buffer.concat([n,Me(f)])}),n=Yt.Buffer.concat([n,e.toBuffer(),Yt.Buffer.from("ProgramDerivedAddress")]);let o=bi(n);if(ac(o))throw new Error("Invalid seeds, address must fall off the curve");return new fe(o)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n=255,o;for(;n!=0;){try{let f=t.concat(Yt.Buffer.from([n]));o=this.createProgramAddressSync(f,e)}catch(f){if(f instanceof TypeError)throw f;n--;continue}return[o,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){let e=new fe(t);return ac(e.toBytes())}};xc=fe;fe.default=new xc("11111111111111111111111111111111");Go.set(fe,{kind:"struct",fields:[["_bn","u256"]]});Lg=new fe("BPFLoader1111111111111111111111111111111111"),jo=1280-40-8,Zl=127,vc=64,Ba=class extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}};Object.defineProperty(Ba.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});_a=class extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}};Object.defineProperty(_a.prototype,"name",{value:"TransactionExpiredTimeoutError"});Ea=class extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}};Object.defineProperty(Ea.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});Yo=class{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){let t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(let e of this.keySegments()){if(t255+1)throw new Error("Account index overflow encountered during compilation");let n=new Map;this.keySegments().flat().forEach((f,h)=>{n.set(f.toBase58(),h)});let o=f=>{let h=n.get(f.toBase58());if(h===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return h};return t.map(f=>({programIdIndex:o(f.programId),accountKeyIndexes:f.keys.map(h=>o(h.pubkey)),data:f.data}))}},_e=(r="publicKey")=>L.blob(32,r),ai=(r="string")=>{let t=L.struct([L.u32("length"),L.u32("lengthPadding"),L.blob(L.offset(L.u32(),-8),"chars")],r),e=t.decode.bind(t),n=t.encode.bind(t),o=t;return o.decode=(f,h)=>e(f,h).chars.toString(),o.encode=(f,h,x)=>{let b={chars:Yt.Buffer.from(f,"utf8")};return n(b,h,x)},o.alloc=f=>L.u32().span+L.u32().span+Yt.Buffer.from(f,"utf8").length,o},Jl=(r="authorized")=>L.struct([_e("staker"),_e("withdrawer")],r),Xl=(r="lockup")=>L.struct([L.ns64("unixTimestamp"),L.ns64("epoch"),_e("custodian")],r),Ql=(r="voteInit")=>L.struct([_e("nodePubkey"),_e("authorizedVoter"),_e("authorizedWithdrawer"),L.u8("commission")],r),td=(r="voteAuthorizeWithSeedArgs")=>L.struct([L.u32("voteAuthorizationType"),_e("currentAuthorityDerivedKeyOwnerPubkey"),ai("currentAuthorityDerivedKeySeed"),_e("newAuthorized")],r);qi=class{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){let n=new Map,o=h=>{let x=h.toBase58(),b=n.get(x);return b===void 0&&(b={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(x,b)),b},f=o(e);f.isSigner=!0,f.isWritable=!0;for(let h of t){o(h.programId).isInvoked=!0;for(let x of h.keys){let b=o(x.pubkey);b.isSigner||=x.isSigner,b.isWritable||=x.isWritable}}return new qi(e,n)}getMessageComponents(){let t=[...this.keyMetaMap.entries()];je(t.length<=256,"Max static account keys length exceeded");let e=t.filter(([,b])=>b.isSigner&&b.isWritable),n=t.filter(([,b])=>b.isSigner&&!b.isWritable),o=t.filter(([,b])=>!b.isSigner&&b.isWritable),f=t.filter(([,b])=>!b.isSigner&&!b.isWritable),h={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:f.length};{je(e.length>0,"Expected at least one writable signer key");let[b]=e[0];je(b===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let x=[...e.map(([b])=>new fe(b)),...n.map(([b])=>new fe(b)),...o.map(([b])=>new fe(b)),...f.map(([b])=>new fe(b))];return[h,x]}extractTableLookup(t){let[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,h=>!h.isSigner&&!h.isInvoked&&h.isWritable),[o,f]=this.drainKeysFoundInLookupTable(t.state.addresses,h=>!h.isSigner&&!h.isInvoked&&!h.isWritable);if(!(e.length===0&&o.length===0))return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:o},{writable:n,readonly:f}]}drainKeysFoundInLookupTable(t,e){let n=new Array,o=new Array;for(let[f,h]of this.keyMetaMap.entries())if(e(h)){let x=new fe(f),b=t.findIndex(E=>E.equals(x));b>=0&&(je(b<256,"Max lookup table index exceeded"),n.push(b),o.push(x),this.keyMetaMap.delete(f))}return[n,o]}},Sc="Reached end of buffer unexpectedly";Dn=class{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(e=>new fe(e)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:wr.default.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Yo(this.staticAccountKeys)}static compile(t){let e=qi.compile(t.instructions,t.payerKey),[n,o]=e.getMessageComponents(),h=new Yo(o).compileInstructions(t.instructions).map(x=>({programIdIndex:x.programIdIndex,accounts:x.accountKeyIndexes,data:wr.default.encode(x.data)}));return new Dn({header:n,accountKeys:o,recentBlockhash:t.recentBlockhash,instructions:h})}isAccountSigner(t){return t=this.header.numRequiredSignatures){let n=t-e,f=this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts;return n!this.isProgramId(e))}serialize(){let t=this.accountKeys.length,e=[];Ni(e,t);let n=this.instructions.map(M=>{let{accounts:C,programIdIndex:N}=M,ft=Array.from(wr.default.decode(M.data)),W=[];Ni(W,C.length);let P=[];return Ni(P,ft.length),{programIdIndex:N,keyIndicesCount:Yt.Buffer.from(W),keyIndices:C,dataLength:Yt.Buffer.from(P),data:ft}}),o=[];Ni(o,n.length);let f=Yt.Buffer.alloc(jo);Yt.Buffer.from(o).copy(f);let h=o.length;n.forEach(M=>{let N=L.struct([L.u8("programIdIndex"),L.blob(M.keyIndicesCount.length,"keyIndicesCount"),L.seq(L.u8("keyIndex"),M.keyIndices.length,"keyIndices"),L.blob(M.dataLength.length,"dataLength"),L.seq(L.u8("userdatum"),M.data.length,"data")]).encode(M,f,h);h+=N}),f=f.slice(0,h);let x=L.struct([L.blob(1,"numRequiredSignatures"),L.blob(1,"numReadonlySignedAccounts"),L.blob(1,"numReadonlyUnsignedAccounts"),L.blob(e.length,"keyCount"),L.seq(_e("key"),t,"keys"),_e("recentBlockhash")]),b={numRequiredSignatures:Yt.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Yt.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Yt.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Yt.Buffer.from(e),keys:this.accountKeys.map(M=>Me(M.toBytes())),recentBlockhash:wr.default.decode(this.recentBlockhash)},E=Yt.Buffer.alloc(2048),_=x.encode(b,E);return f.copy(E,_),E.slice(0,_+f.length)}static from(t){let e=[...t],n=$o(e);if(n!==(n&Zl))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let o=$o(e),f=$o(e),h=Oi(e),x=[];for(let C=0;C({pubkey:t.toJSON(),isSigner:e,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}},Pe=class{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){let{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){let{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{let{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new Ce(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?e=[this.nonceInfo.nonceInstruction,...this.instructions]:e=this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");e.length<1&&console.warn("No instructions provided");let n;if(this.feePayer)n=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)n=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let W=0;W{W.keys.forEach(J=>{f.push({...J})});let P=W.programId.toString();o.includes(P)||o.push(P)}),o.forEach(W=>{f.push({pubkey:new fe(W),isSigner:!1,isWritable:!1})});let h=[];f.forEach(W=>{let P=W.pubkey.toString(),J=h.findIndex(it=>it.pubkey.toString()===P);J>-1?(h[J].isWritable=h[J].isWritable||W.isWritable,h[J].isSigner=h[J].isSigner||W.isSigner):h.push(W)}),h.sort(function(W,P){if(W.isSigner!==P.isSigner)return W.isSigner?-1:1;if(W.isWritable!==P.isWritable)return W.isWritable?-1:1;let J={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return W.pubkey.toBase58().localeCompare(P.pubkey.toBase58(),"en",J)});let x=h.findIndex(W=>W.pubkey.equals(n));if(x>-1){let[W]=h.splice(x,1);W.isSigner=!0,W.isWritable=!0,h.unshift(W)}else h.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(let W of this.signatures){let P=h.findIndex(J=>J.pubkey.equals(W.publicKey));if(P>-1)h[P].isSigner||(h[P].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${W.publicKey.toString()}`)}let b=0,E=0,_=0,M=[],C=[];h.forEach(({pubkey:W,isSigner:P,isWritable:J})=>{P?(M.push(W.toString()),b+=1,J||(E+=1)):(C.push(W.toString()),J||(_+=1))});let N=M.concat(C),ft=e.map(W=>{let{data:P,programId:J}=W;return{programIdIndex:N.indexOf(J.toString()),accounts:W.keys.map(it=>N.indexOf(it.pubkey.toString())),data:wr.default.encode(P)}});return ft.forEach(W=>{je(W.programIdIndex>=0),W.accounts.forEach(P=>je(P>=0))}),new Dn({header:{numRequiredSignatures:b,numReadonlySignedAccounts:E,numReadonlyUnsignedAccounts:_},accountKeys:N,recentBlockhash:t,instructions:ft})}_compile(){let t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((o,f)=>e[f].equals(o.publicKey))||(this.signatures=e.map(n=>({signature:null,publicKey:n}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");let e=new Set;this.signatures=t.filter(n=>{let o=n.toString();return e.has(o)?!1:(e.add(o),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...t){if(t.length===0)throw new Error("No signers");let e=new Set,n=[];for(let f of t){let h=f.publicKey.toString();e.has(h)||(e.add(h),n.push(f))}this.signatures=n.map(f=>({signature:null,publicKey:f.publicKey}));let o=this._compile();this._partialSign(o,...n)}partialSign(...t){if(t.length===0)throw new Error("No signers");let e=new Set,n=[];for(let f of t){let h=f.publicKey.toString();e.has(h)||(e.add(h),n.push(f))}let o=this._compile();this._partialSign(o,...n)}_partialSign(t,...e){let n=t.serialize();e.forEach(o=>{let f=bc(n,o.secretKey);this._addSignature(o.publicKey,Me(f))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){je(e.length===64);let n=this.signatures.findIndex(o=>t.equals(o.publicKey));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=Yt.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){let n={};for(let{signature:o,publicKey:f}of this.signatures)o===null?e&&(n.missing||=[]).push(f):Gl(o,t,f.toBytes())||(n.invalid||=[]).push(f);return n.invalid||n.missing?n:void 0}serialize(t){let{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),o=this.serializeMessage();if(n){let f=this._getMessageSignednessErrors(o,e);if(f){let h="Signature verification failed.";throw f.invalid&&(h+=`\nInvalid signature for public key${f.invalid.length===1?"":"(s)"} [\\`${f.invalid.map(x=>x.toBase58()).join("`, `")}\\`].`),f.missing&&(h+=`\nMissing signature for public key${f.missing.length===1?"":"(s)"} [\\`${f.missing.map(x=>x.toBase58()).join("`, `")}\\`].`),new Error(h)}}return this._serialize(o)}_serialize(t){let{signatures:e}=this,n=[];Ni(n,e.length);let o=n.length+e.length*64+t.length,f=Yt.Buffer.alloc(o);return je(e.length<256),Yt.Buffer.from(n).copy(f,0),e.forEach(({signature:h},x)=>{h!==null&&(je(h.length===64,"signature has invalid length"),Yt.Buffer.from(h).copy(f,n.length+x*64))}),t.copy(f,n.length+e.length*64),je(f.length<=jo,`Transaction too large: ${f.length} > ${jo}`),f}get keys(){return je(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return je(this.instructions.length===1),this.instructions[0].programId}get data(){return je(this.instructions.length===1),this.instructions[0].data}static from(t){let e=[...t],n=Oi(e),o=[];for(let f=0;f0&&(n.feePayer=t.accountKeys[0]),e.forEach((o,f)=>{let h={signature:o==wr.default.encode(ed)?null:wr.default.decode(o),publicKey:t.accountKeys[f]};n.signatures.push(h)}),t.instructions.forEach(o=>{let f=o.accounts.map(h=>{let x=t.accountKeys[h];return{pubkey:x,isSigner:n.signatures.some(b=>b.publicKey.toString()===x.toString())||t.isAccountSigner(h),isWritable:t.isAccountWritable(h)}});n.instructions.push(new Ce({keys:f,programId:t.accountKeys[o.programIdIndex],data:wr.default.decode(o.data)}))}),n._message=t,n._json=n.toJSON(),n}},rd=160,nd=64,id=rd/nd,od=1e3/id,en=new fe("SysvarC1ock11111111111111111111111111111111"),Rg=new fe("SysvarEpochSchedu1e111111111111111111111111"),Tg=new fe("Sysvar1nstructions1111111111111111111111111"),ma=new fe("SysvarRecentB1ockHashes11111111111111111111"),Fi=new fe("SysvarRent111111111111111111111111111111111"),Pg=new fe("SysvarRewards111111111111111111111111111111"),Cg=new fe("SysvarS1otHashes111111111111111111111111111"),Ug=new fe("SysvarS1otHistory11111111111111111111111111"),wa=new fe("SysvarStakeHistory1111111111111111111111111"),Aa=class extends Error{constructor({action:t,signature:e,transactionMessage:n,logs:o}){let f=o?`Logs: \n${JSON.stringify(o.slice(-10),null,2)}. `:"",h="\\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.",x;switch(t){case"send":x=`Transaction ${e} resulted in an error. \n${n}. `+f+h;break;case"simulate":x=`Simulation failed. \nMessage: ${n}. \n`+f+h;break;default:x=`Unknown action \'${(b=>b)(t)}\'`}super(x),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=e,this.transactionMessage=n,this.transactionLogs=o||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let t=this.transactionLogs;if(!(t!=null&&typeof t=="object"&&"then"in t))return t}async getLogs(t){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((e,n)=>{t.getTransaction(this.signature).then(o=>{if(o&&o.meta&&o.meta.logMessages){let f=o.meta.logMessages;this.transactionLogs=f,e(f)}else n(new Error("Log messages not found"))}).catch(n)})),await this.transactionLogs}};ad=L.nu64("lamportsPerSignature"),fd=L.struct([L.u32("version"),L.u32("state"),_e("authorizedPubkey"),_e("nonce"),L.struct([ad],"feeCalculator")]),cc=fd.span,ud=r=>{let t=r.decode.bind(r),e=r.encode.bind(r);return{decode:t,encode:e}},cd=r=>t=>{let e=(0,wc.blob)(r,t),{encode:n,decode:o}=ud(e),f=e;return f.decode=(h,x)=>{let b=o(h,x);return(0,Hi.toBigIntLE)(Yt.Buffer.from(b))},f.encode=(h,x,b)=>{let E=(0,Hi.toBufferLE)(h,r);return n(E,x,b)},f},fi=cd(8),Er=Object.freeze({Create:{index:0,layout:L.struct([L.u32("instruction"),L.ns64("lamports"),L.ns64("space"),_e("programId")])},Assign:{index:1,layout:L.struct([L.u32("instruction"),_e("programId")])},Transfer:{index:2,layout:L.struct([L.u32("instruction"),fi("lamports")])},CreateWithSeed:{index:3,layout:L.struct([L.u32("instruction"),_e("base"),ai("seed"),L.ns64("lamports"),L.ns64("space"),_e("programId")])},AdvanceNonceAccount:{index:4,layout:L.struct([L.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:L.struct([L.u32("instruction"),L.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:L.struct([L.u32("instruction"),_e("authorized")])},AuthorizeNonceAccount:{index:7,layout:L.struct([L.u32("instruction"),_e("authorized")])},Allocate:{index:8,layout:L.struct([L.u32("instruction"),L.ns64("space")])},AllocateWithSeed:{index:9,layout:L.struct([L.u32("instruction"),_e("base"),ai("seed"),L.ns64("space"),_e("programId")])},AssignWithSeed:{index:10,layout:L.struct([L.u32("instruction"),_e("base"),ai("seed"),_e("programId")])},TransferWithSeed:{index:11,layout:L.struct([L.u32("instruction"),fi("lamports"),ai("seed"),_e("programId")])},UpgradeNonceAccount:{index:12,layout:L.struct([L.u32("instruction")])}}),Je=class{constructor(){}static createAccount(t){let e=Er.Create,n=ke(e,{lamports:t.lamports,space:t.space,programId:Me(t.programId.toBuffer())});return new Ce({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:n})}static transfer(t){let e,n;if("basePubkey"in t){let o=Er.TransferWithSeed;e=ke(o,{lamports:BigInt(t.lamports),seed:t.seed,programId:Me(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}else{let o=Er.Transfer;e=ke(o,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}return new Ce({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;if("basePubkey"in t){let o=Er.AssignWithSeed;e=ke(o,{base:Me(t.basePubkey.toBuffer()),seed:t.seed,programId:Me(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{let o=Er.Assign;e=ke(o,{programId:Me(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new Ce({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){let e=Er.CreateWithSeed,n=ke(e,{base:Me(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:Me(t.programId.toBuffer())}),o=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey.equals(t.fromPubkey)||o.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new Ce({keys:o,programId:this.programId,data:n})}static createNonceAccount(t){let e=new Pe;"basePubkey"in t&&"seed"in t?e.add(Je.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:cc,programId:this.programId})):e.add(Je.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:cc,programId:this.programId}));let n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){let e=Er.InitializeNonceAccount,n=ke(e,{authorized:Me(t.authorizedPubkey.toBuffer())}),o={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:ma,isSigner:!1,isWritable:!1},{pubkey:Fi,isSigner:!1,isWritable:!1}],programId:this.programId,data:n};return new Ce(o)}static nonceAdvance(t){let e=Er.AdvanceNonceAccount,n=ke(e),o={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:ma,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n};return new Ce(o)}static nonceWithdraw(t){let e=Er.WithdrawNonceAccount,n=ke(e,{lamports:t.lamports});return new Ce({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:ma,isSigner:!1,isWritable:!1},{pubkey:Fi,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static nonceAuthorize(t){let e=Er.AuthorizeNonceAccount,n=ke(e,{authorized:Me(t.newAuthorizedPubkey.toBuffer())});return new Ce({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static allocate(t){let e,n;if("basePubkey"in t){let o=Er.AllocateWithSeed;e=ke(o,{base:Me(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:Me(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{let o=Er.Allocate;e=ke(o,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new Ce({keys:n,programId:this.programId,data:e})}};Je.programId=new fe("11111111111111111111111111111111");hd=jo-300,ui=class{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/ui.chunkSize)+1+1)}static async load(t,e,n,o,f){{let M=await t.getMinimumBalanceForRentExemption(f.length),C=await t.getAccountInfo(n.publicKey,"confirmed"),N=null;if(C!==null){if(C.executable)return console.error("Program load failed, account is already executable"),!1;C.data.length!==f.length&&(N=N||new Pe,N.add(Je.allocate({accountPubkey:n.publicKey,space:f.length}))),C.owner.equals(o)||(N=N||new Pe,N.add(Je.assign({accountPubkey:n.publicKey,programId:o}))),C.lamports0?M:1,space:f.length,programId:o}));N!==null&&await uc(t,N,[e,n],{commitment:"confirmed"})}let h=L.struct([L.u32("instruction"),L.u32("offset"),L.u32("bytesLength"),L.u32("bytesLengthPadding"),L.seq(L.u8("byte"),L.offset(L.u32(),-8),"bytes")]),x=ui.chunkSize,b=0,E=f,_=[];for(;E.length>0;){let M=E.slice(0,x),C=Yt.Buffer.alloc(x+16);h.encode({instruction:0,offset:b,bytes:M,bytesLength:0,bytesLengthPadding:0},C);let N=new Pe().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:C});_.push(uc(t,N,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await sd(1e3/4),b+=x,E=E.slice(x)}await Promise.all(_);{let M=L.struct([L.u32("instruction")]),C=Yt.Buffer.alloc(M.span);M.encode({instruction:1},C);let N=new Pe().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Fi,isSigner:!1,isWritable:!1}],programId:o,data:C}),ft="processed",W=await t.sendTransaction(N,[e,n],{preflightCommitment:ft}),{context:P,value:J}=await t.confirmTransaction({signature:W,lastValidBlockHeight:N.lastValidBlockHeight,blockhash:N.recentBlockhash},ft);if(J.err)throw new Error(`Transaction ${W} failed (${JSON.stringify(J)})`);for(;;){try{if(await t.getSlot({commitment:ft})>P.slot)break}catch{}await new Promise(it=>setTimeout(it,Math.round(od/2)))}}return!0}};ui.chunkSize=hd;Og=new fe("BPFLoader2111111111111111111111111111111111"),Ng=globalThis.fetch,zg={index:1,layout:L.struct([L.u32("typeIndex"),fi("deactivationSlot"),L.nu64("lastExtendedSlot"),L.u8("lastExtendedStartIndex"),L.u8(),L.seq(_e(),L.offset(L.u8(),-1),"authority")])},We=oi(Oo(fe),at(),r=>new fe(r)),Bc=No([at(),ze("base64")]),Ra=oi(Oo(Yt.Buffer),Bc,r=>Yt.Buffer.from(r[0],"base64")),Kg=30*1e3;ld=_c(qn());dd=et({foundation:z(),foundationTerm:z(),initial:z(),taper:z(),terminal:z()}),qg=Ue(vt(kt(et({epoch:z(),effectiveSlot:z(),amount:z(),postBalance:z(),commission:Ot(kt(z()))})))),pd=vt(et({slot:z(),prioritizationFee:z()})),yd=et({total:z(),validator:z(),foundation:z(),epoch:z()}),gd=et({epoch:z(),slotIndex:z(),slotsInEpoch:z(),absoluteSlot:z(),blockHeight:Ot(z()),transactionCount:Ot(z())}),md=et({slotsPerEpoch:z(),leaderScheduleSlotOffset:z(),warmup:Cr(),firstNormalEpoch:z(),firstNormalSlot:z()}),wd=ra(at(),vt(z())),Wn=kt(or([et({}),at()])),bd=et({err:Wn}),xd=ze("receivedSignature"),Fg=et({"solana-core":at(),"feature-set":Ot(z())}),vd=et({program:at(),programId:We,parsed:qn()}),kd=et({programId:We,accounts:vt(We),data:at()}),Dg=Ar(et({err:kt(or([et({}),at()])),logs:kt(vt(at())),accounts:Ot(kt(vt(kt(et({executable:Cr(),owner:at(),lamports:z(),data:vt(at()),rentEpoch:Ot(z())}))))),unitsConsumed:Ot(z()),returnData:Ot(kt(et({programId:at(),data:No([at(),ze("base64")])}))),innerInstructions:Ot(kt(vt(et({index:z(),instructions:vt(or([vd,kd]))}))))})),Wg=Ar(et({byIdentity:ra(at(),vt(z())),range:et({firstSlot:z(),lastSlot:z()})})),Hg=Ue(dd),$g=Ue(yd),Vg=Ue(pd),Gg=Ue(gd),jg=Ue(md),Yg=Ue(wd),Zg=Ue(z()),Jg=Ar(et({total:z(),circulating:z(),nonCirculating:z(),nonCirculatingAccounts:vt(We)})),Sd=et({amount:at(),uiAmount:kt(z()),decimals:z(),uiAmountString:Ot(at())}),Xg=Ar(vt(et({address:We,amount:at(),uiAmount:kt(z()),decimals:z(),uiAmountString:Ot(at())}))),Qg=Ar(vt(et({pubkey:We,account:et({executable:Cr(),owner:We,lamports:z(),data:Ra,rentEpoch:z()})}))),Ma=et({program:at(),parsed:qn(),space:z()}),tm=Ar(vt(et({pubkey:We,account:et({executable:Cr(),owner:We,lamports:z(),data:Ma,rentEpoch:z()})}))),em=Ar(vt(et({lamports:z(),address:We}))),Ta=et({executable:Cr(),owner:We,lamports:z(),data:Ra,rentEpoch:z()}),rm=et({pubkey:We,account:Ta}),Bd=oi(or([Oo(Yt.Buffer),Ma]),or([Bc,Ma]),r=>Array.isArray(r)?ii(r,Ra):r),_d=et({executable:Cr(),owner:We,lamports:z(),data:Bd,rentEpoch:z()}),nm=et({pubkey:We,account:_d}),im=et({state:or([ze("active"),ze("inactive"),ze("activating"),ze("deactivating")]),active:z(),inactive:z()}),om=Ue(vt(et({signature:at(),slot:z(),err:Wn,memo:kt(at()),blockTime:Ot(kt(z()))}))),sm=Ue(vt(et({signature:at(),slot:z(),err:Wn,memo:kt(at()),blockTime:Ot(kt(z()))}))),am=et({subscription:z(),result:Xo(Ta)}),Ed=et({pubkey:We,account:Ta}),fm=et({subscription:z(),result:Xo(Ed)}),Ad=et({parent:z(),slot:z(),root:z()}),um=et({subscription:z(),result:Ad}),Md=or([et({type:or([ze("firstShredReceived"),ze("completed"),ze("optimisticConfirmation"),ze("root")]),slot:z(),timestamp:z()}),et({type:ze("createdBank"),parent:z(),slot:z(),timestamp:z()}),et({type:ze("frozen"),slot:z(),timestamp:z(),stats:et({numTransactionEntries:z(),numSuccessfulTransactions:z(),numFailedTransactions:z(),maxTransactionsPerEntry:z()})}),et({type:ze("dead"),slot:z(),timestamp:z(),err:at()})]),cm=et({subscription:z(),result:Md}),hm=et({subscription:z(),result:Xo(or([bd,xd]))}),lm=et({subscription:z(),result:z()}),dm=et({pubkey:at(),gossip:kt(at()),tpu:kt(at()),rpc:kt(at()),version:kt(at())}),hc=et({votePubkey:at(),nodePubkey:at(),activatedStake:z(),epochVoteAccount:Cr(),epochCredits:vt(No([z(),z(),z()])),commission:z(),lastVote:z(),rootSlot:kt(z())}),pm=Ue(et({current:vt(hc),delinquent:vt(hc)})),Id=or([ze("processed"),ze("confirmed"),ze("finalized")]),Ld=et({slot:z(),confirmations:kt(z()),err:Wn,confirmationStatus:Ot(Id)}),ym=Ar(vt(kt(Ld))),gm=Ue(z()),Ec=et({accountKey:We,writableIndexes:vt(z()),readonlyIndexes:vt(z())}),Pa=et({signatures:vt(at()),message:et({accountKeys:vt(at()),header:et({numRequiredSignatures:z(),numReadonlySignedAccounts:z(),numReadonlyUnsignedAccounts:z()}),instructions:vt(et({accounts:vt(z()),data:at(),programIdIndex:z()})),recentBlockhash:at(),addressTableLookups:Ot(vt(Ec))})}),Ac=et({pubkey:We,signer:Cr(),writable:Cr(),source:Ot(or([ze("transaction"),ze("lookupTable")]))}),Mc=et({accountKeys:vt(Ac),signatures:vt(at())}),Ic=et({parsed:qn(),program:at(),programId:We}),Lc=et({accounts:vt(We),data:at(),programId:We}),Rd=or([Lc,Ic]),Td=or([et({parsed:qn(),program:at(),programId:at()}),et({accounts:vt(at()),data:at(),programId:at()})]),Rc=oi(Rd,Td,r=>"accounts"in r?ii(r,Lc):ii(r,Ic)),Tc=et({signatures:vt(at()),message:et({accountKeys:vt(Ac),instructions:vt(Rc),recentBlockhash:at(),addressTableLookups:Ot(kt(vt(Ec)))})}),Zo=et({accountIndex:z(),mint:at(),owner:Ot(at()),uiTokenAmount:Sd}),Pc=et({writable:vt(We),readonly:vt(We)}),Qo=et({err:Wn,fee:z(),innerInstructions:Ot(kt(vt(et({index:z(),instructions:vt(et({accounts:vt(z()),data:at(),programIdIndex:z()}))})))),preBalances:vt(z()),postBalances:vt(z()),logMessages:Ot(kt(vt(at()))),preTokenBalances:Ot(kt(vt(Zo))),postTokenBalances:Ot(kt(vt(Zo))),loadedAddresses:Ot(Pc),computeUnitsConsumed:Ot(z())}),Ca=et({err:Wn,fee:z(),innerInstructions:Ot(kt(vt(et({index:z(),instructions:vt(Rc)})))),preBalances:vt(z()),postBalances:vt(z()),logMessages:Ot(kt(vt(at()))),preTokenBalances:Ot(kt(vt(Zo))),postTokenBalances:Ot(kt(vt(Zo))),loadedAddresses:Ot(Pc),computeUnitsConsumed:Ot(z())}),li=or([ze(0),ze("legacy")]),Hn=et({pubkey:at(),lamports:z(),postBalance:kt(z()),rewardType:kt(at()),commission:Ot(kt(z()))}),mm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),transactions:vt(et({transaction:Pa,meta:kt(Qo),version:Ot(li)})),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),wm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),bm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),transactions:vt(et({transaction:Mc,meta:kt(Qo),version:Ot(li)})),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),xm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),transactions:vt(et({transaction:Tc,meta:kt(Ca),version:Ot(li)})),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),vm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),transactions:vt(et({transaction:Mc,meta:kt(Ca),version:Ot(li)})),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),km=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),Sm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),transactions:vt(et({transaction:Pa,meta:kt(Qo)})),rewards:Ot(vt(Hn)),blockTime:kt(z())}))),Bm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),signatures:vt(at()),blockTime:kt(z())}))),_m=Ue(kt(et({slot:z(),meta:kt(Qo),blockTime:Ot(kt(z())),transaction:Pa,version:Ot(li)}))),Em=Ue(kt(et({slot:z(),transaction:Tc,meta:kt(Ca),blockTime:Ot(kt(z())),version:Ot(li)}))),Am=Ar(et({blockhash:at(),feeCalculator:et({lamportsPerSignature:z()})})),Mm=Ar(et({blockhash:at(),lastValidBlockHeight:z()})),Im=Ar(Cr()),Pd=et({slot:z(),numTransactions:z(),numSlots:z(),samplePeriodSecs:z()}),Lm=Ue(vt(Pd)),Rm=Ar(kt(et({feeCalculator:et({lamportsPerSignature:z()})}))),Tm=Ue(at()),Pm=Ue(at()),Cd=et({err:Wn,logs:vt(at()),signature:at()}),Cm=et({result:Xo(Cd),subscription:z()}),Ur=class{constructor(t){this._keypair=void 0,this._keypair=t??sc()}static generate(){return new Ur(sc())}static fromSecretKey(t,e){if(t.byteLength!==64)throw new Error("bad secret key size");let n=t.slice(32,64);if(!e||!e.skipValidation){let o=t.slice(0,32),f=ka(o);for(let h=0;h<32;h++)if(n[h]!==f[h])throw new Error("provided secretKey is invalid")}return new Ur({publicKey:n,secretKey:t})}static fromSeed(t){let e=ka(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new Ur({publicKey:e,secretKey:n})}get publicKey(){return new fe(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}},Ci=Object.freeze({CreateLookupTable:{index:0,layout:L.struct([L.u32("instruction"),fi("recentSlot"),L.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:L.struct([L.u32("instruction")])},ExtendLookupTable:{index:2,layout:L.struct([L.u32("instruction"),fi(),L.seq(_e(),L.offset(L.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:L.struct([L.u32("instruction")])},CloseLookupTable:{index:4,layout:L.struct([L.u32("instruction")])}}),Ia=class{constructor(){}static createLookupTable(t){let[e,n]=fe.findProgramAddressSync([t.authority.toBuffer(),(0,Hi.toBufferLE)(BigInt(t.recentSlot),8)],this.programId),o=Ci.CreateLookupTable,f=ke(o,{recentSlot:BigInt(t.recentSlot),bumpSeed:n}),h=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Je.programId,isSigner:!1,isWritable:!1}];return[new Ce({programId:this.programId,keys:h,data:f}),e]}static freezeLookupTable(t){let e=Ci.FreezeLookupTable,n=ke(e),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Ce({programId:this.programId,keys:o,data:n})}static extendLookupTable(t){let e=Ci.ExtendLookupTable,n=ke(e,{addresses:t.addresses.map(f=>f.toBytes())}),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&o.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Je.programId,isSigner:!1,isWritable:!1}),new Ce({programId:this.programId,keys:o,data:n})}static deactivateLookupTable(t){let e=Ci.DeactivateLookupTable,n=ke(e),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Ce({programId:this.programId,keys:o,data:n})}static closeLookupTable(t){let e=Ci.CloseLookupTable,n=ke(e),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new Ce({programId:this.programId,keys:o,data:n})}};Ia.programId=new fe("AddressLookupTab1e1111111111111111111111111");Vo=Object.freeze({RequestUnits:{index:0,layout:L.struct([L.u8("instruction"),L.u32("units"),L.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:L.struct([L.u8("instruction"),L.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:L.struct([L.u8("instruction"),L.u32("units")])},SetComputeUnitPrice:{index:3,layout:L.struct([L.u8("instruction"),fi("microLamports")])}}),La=class{constructor(){}static requestUnits(t){let e=Vo.RequestUnits,n=ke(e,t);return new Ce({keys:[],programId:this.programId,data:n})}static requestHeapFrame(t){let e=Vo.RequestHeapFrame,n=ke(e,t);return new Ce({keys:[],programId:this.programId,data:n})}static setComputeUnitLimit(t){let e=Vo.SetComputeUnitLimit,n=ke(e,t);return new Ce({keys:[],programId:this.programId,data:n})}static setComputeUnitPrice(t){let e=Vo.SetComputeUnitPrice,n=ke(e,{microLamports:BigInt(t.microLamports)});return new Ce({keys:[],programId:this.programId,data:n})}};La.programId=new fe("ComputeBudget111111111111111111111111111111");lc=64,dc=32,pc=64,yc=L.struct([L.u8("numSignatures"),L.u8("padding"),L.u16("signatureOffset"),L.u16("signatureInstructionIndex"),L.u16("publicKeyOffset"),L.u16("publicKeyInstructionIndex"),L.u16("messageDataOffset"),L.u16("messageDataSize"),L.u16("messageInstructionIndex")]),Di=class{constructor(){}static createInstructionWithPublicKey(t){let{publicKey:e,message:n,signature:o,instructionIndex:f}=t;je(e.length===dc,`Public Key must be ${dc} bytes but received ${e.length} bytes`),je(o.length===pc,`Signature must be ${pc} bytes but received ${o.length} bytes`);let h=yc.span,x=h+e.length,b=x+o.length,E=1,_=Yt.Buffer.alloc(b+n.length),M=f??65535;return yc.encode({numSignatures:E,padding:0,signatureOffset:x,signatureInstructionIndex:M,publicKeyOffset:h,publicKeyInstructionIndex:M,messageDataOffset:b,messageDataSize:n.length,messageInstructionIndex:M},_),_.fill(e,h),_.fill(o,x),_.fill(n,b),new Ce({keys:[],programId:Di.programId,data:_})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:n,instructionIndex:o}=t;je(e.length===lc,`Private key must be ${lc} bytes but received ${e.length} bytes`);try{let f=Ur.fromSecretKey(e),h=f.publicKey.toBytes(),x=bc(n,f.secretKey);return this.createInstructionWithPublicKey({publicKey:h,message:n,signature:x,instructionIndex:o})}catch(f){throw new Error(`Error creating instruction; ${f}`)}}};Di.programId=new fe("Ed25519SigVerify111111111111111111111111111");Ud=(r,t)=>{let e=Pi.sign(r,t);return[e.toCompactRawBytes(),e.recovery]};Pi.utils.isValidPrivateKey;Od=Pi.getPublicKey,gc=32,ba=20,mc=64,Nd=11,xa=L.struct([L.u8("numSignatures"),L.u16("signatureOffset"),L.u8("signatureInstructionIndex"),L.u16("ethAddressOffset"),L.u8("ethAddressInstructionIndex"),L.u16("messageDataOffset"),L.u16("messageDataSize"),L.u8("messageInstructionIndex"),L.blob(20,"ethAddress"),L.blob(64,"signature"),L.u8("recoveryId")]),Fn=class{constructor(){}static publicKeyToEthAddress(t){je(t.length===mc,`Public key must be ${mc} bytes but received ${t.length} bytes`);try{return Yt.Buffer.from(da(Me(t))).slice(-ba)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(t){let{publicKey:e,message:n,signature:o,recoveryId:f,instructionIndex:h}=t;return Fn.createInstructionWithEthAddress({ethAddress:Fn.publicKeyToEthAddress(e),message:n,signature:o,recoveryId:f,instructionIndex:h})}static createInstructionWithEthAddress(t){let{ethAddress:e,message:n,signature:o,recoveryId:f,instructionIndex:h=0}=t,x;typeof e=="string"?e.startsWith("0x")?x=Yt.Buffer.from(e.substr(2),"hex"):x=Yt.Buffer.from(e,"hex"):x=e,je(x.length===ba,`Address must be ${ba} bytes but received ${x.length} bytes`);let b=1+Nd,E=b,_=b+x.length,M=_+o.length+1,C=1,N=Yt.Buffer.alloc(xa.span+n.length);return xa.encode({numSignatures:C,signatureOffset:_,signatureInstructionIndex:h,ethAddressOffset:E,ethAddressInstructionIndex:h,messageDataOffset:M,messageDataSize:n.length,messageInstructionIndex:h,signature:Me(o),ethAddress:Me(x),recoveryId:f},N),N.fill(Me(n),xa.span),new Ce({keys:[],programId:Fn.programId,data:N})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:n,instructionIndex:o}=t;je(e.length===gc,`Private key must be ${gc} bytes but received ${e.length} bytes`);try{let f=Me(e),h=Od(f,!1).slice(1),x=Yt.Buffer.from(da(Me(n))),[b,E]=Ud(x,f);return this.createInstructionWithPublicKey({publicKey:h,message:n,signature:b,recoveryId:E,instructionIndex:o})}catch(f){throw new Error(`Error creating instruction; ${f}`)}}};Fn.programId=new fe("KeccakSecp256k11111111111111111111111111111");zd=new fe("StakeConfig11111111111111111111111111111111"),Wi=class{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}};Cc=Wi;Wi.default=new Cc(0,0,fe.default);Sn=Object.freeze({Initialize:{index:0,layout:L.struct([L.u32("instruction"),Jl(),Xl()])},Authorize:{index:1,layout:L.struct([L.u32("instruction"),_e("newAuthorized"),L.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:L.struct([L.u32("instruction")])},Split:{index:3,layout:L.struct([L.u32("instruction"),L.ns64("lamports")])},Withdraw:{index:4,layout:L.struct([L.u32("instruction"),L.ns64("lamports")])},Deactivate:{index:5,layout:L.struct([L.u32("instruction")])},Merge:{index:7,layout:L.struct([L.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:L.struct([L.u32("instruction"),_e("newAuthorized"),L.u32("stakeAuthorizationType"),ai("authoritySeed"),_e("authorityOwner")])}}),Um=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),Jo=class{constructor(){}static initialize(t){let{stakePubkey:e,authorized:n,lockup:o}=t,f=o||Wi.default,h=Sn.Initialize,x=ke(h,{authorized:{staker:Me(n.staker.toBuffer()),withdrawer:Me(n.withdrawer.toBuffer())},lockup:{unixTimestamp:f.unixTimestamp,epoch:f.epoch,custodian:Me(f.custodian.toBuffer())}}),b={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Fi,isSigner:!1,isWritable:!1}],programId:this.programId,data:x};return new Ce(b)}static createAccountWithSeed(t){let e=new Pe;e.add(Je.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:n,authorized:o,lockup:f}=t;return e.add(this.initialize({stakePubkey:n,authorized:o,lockup:f}))}static createAccount(t){let e=new Pe;e.add(Je.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:n,authorized:o,lockup:f}=t;return e.add(this.initialize({stakePubkey:n,authorized:o,lockup:f}))}static delegate(t){let{stakePubkey:e,authorizedPubkey:n,votePubkey:o}=t,f=Sn.Delegate,h=ke(f);return new Pe().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:en,isSigner:!1,isWritable:!1},{pubkey:wa,isSigner:!1,isWritable:!1},{pubkey:zd,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:h})}static authorize(t){let{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:o,stakeAuthorizationType:f,custodianPubkey:h}=t,x=Sn.Authorize,b=ke(x,{newAuthorized:Me(o.toBuffer()),stakeAuthorizationType:f.index}),E=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:en,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return h&&E.push({pubkey:h,isSigner:!0,isWritable:!1}),new Pe().add({keys:E,programId:this.programId,data:b})}static authorizeWithSeed(t){let{stakePubkey:e,authorityBase:n,authoritySeed:o,authorityOwner:f,newAuthorizedPubkey:h,stakeAuthorizationType:x,custodianPubkey:b}=t,E=Sn.AuthorizeWithSeed,_=ke(E,{newAuthorized:Me(h.toBuffer()),stakeAuthorizationType:x.index,authoritySeed:o,authorityOwner:Me(f.toBuffer())}),M=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:en,isSigner:!1,isWritable:!1}];return b&&M.push({pubkey:b,isSigner:!0,isWritable:!1}),new Pe().add({keys:M,programId:this.programId,data:_})}static splitInstruction(t){let{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:o,lamports:f}=t,h=Sn.Split,x=ke(h,{lamports:f});return new Ce({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:x})}static split(t,e){let n=new Pe;return n.add(Je.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:e,space:this.space,programId:this.programId})),n.add(this.splitInstruction(t))}static splitWithSeed(t,e){let{stakePubkey:n,authorizedPubkey:o,splitStakePubkey:f,basePubkey:h,seed:x,lamports:b}=t,E=new Pe;return E.add(Je.allocate({accountPubkey:f,basePubkey:h,seed:x,space:this.space,programId:this.programId})),e&&e>0&&E.add(Je.transfer({fromPubkey:t.authorizedPubkey,toPubkey:f,lamports:e})),E.add(this.splitInstruction({stakePubkey:n,authorizedPubkey:o,splitStakePubkey:f,lamports:b}))}static merge(t){let{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:o}=t,f=Sn.Merge,h=ke(f);return new Pe().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:en,isSigner:!1,isWritable:!1},{pubkey:wa,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!0,isWritable:!1}],programId:this.programId,data:h})}static withdraw(t){let{stakePubkey:e,authorizedPubkey:n,toPubkey:o,lamports:f,custodianPubkey:h}=t,x=Sn.Withdraw,b=ke(x,{lamports:f}),E=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:en,isSigner:!1,isWritable:!1},{pubkey:wa,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return h&&E.push({pubkey:h,isSigner:!0,isWritable:!1}),new Pe().add({keys:E,programId:this.programId,data:b})}static deactivate(t){let{stakePubkey:e,authorizedPubkey:n}=t,o=Sn.Deactivate,f=ke(o);return new Pe().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:en,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:f})}};Jo.programId=new fe("Stake11111111111111111111111111111111111111");Jo.space=200;Ui=Object.freeze({InitializeAccount:{index:0,layout:L.struct([L.u32("instruction"),Ql()])},Authorize:{index:1,layout:L.struct([L.u32("instruction"),_e("newAuthorized"),L.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:L.struct([L.u32("instruction"),L.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:L.struct([L.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:L.struct([L.u32("instruction"),td()])}}),Om=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),ci=class{constructor(){}static initializeAccount(t){let{votePubkey:e,nodePubkey:n,voteInit:o}=t,f=Ui.InitializeAccount,h=ke(f,{voteInit:{nodePubkey:Me(o.nodePubkey.toBuffer()),authorizedVoter:Me(o.authorizedVoter.toBuffer()),authorizedWithdrawer:Me(o.authorizedWithdrawer.toBuffer()),commission:o.commission}}),x={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Fi,isSigner:!1,isWritable:!1},{pubkey:en,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:h};return new Ce(x)}static createAccount(t){let e=new Pe;return e.add(Je.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){let{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:o,voteAuthorizationType:f}=t,h=Ui.Authorize,x=ke(h,{newAuthorized:Me(o.toBuffer()),voteAuthorizationType:f.index}),b=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:en,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new Pe().add({keys:b,programId:this.programId,data:x})}static authorizeWithSeed(t){let{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:o,newAuthorizedPubkey:f,voteAuthorizationType:h,votePubkey:x}=t,b=Ui.AuthorizeWithSeed,E=ke(b,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Me(n.toBuffer()),currentAuthorityDerivedKeySeed:o,newAuthorized:Me(f.toBuffer()),voteAuthorizationType:h.index}}),_=[{pubkey:x,isSigner:!1,isWritable:!0},{pubkey:en,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return new Pe().add({keys:_,programId:this.programId,data:E})}static withdraw(t){let{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:o,toPubkey:f}=t,h=Ui.Withdraw,x=ke(h,{lamports:o}),b=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return new Pe().add({keys:b,programId:this.programId,data:x})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insufficient funds.");return ci.withdraw(t)}static updateValidatorIdentity(t){let{votePubkey:e,authorizedWithdrawerPubkey:n,nodePubkey:o}=t,f=Ui.UpdateValidatorIdentity,h=ke(f),x=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new Pe().add({keys:x,programId:this.programId,data:h})}};ci.programId=new fe("Vote111111111111111111111111111111111111111");ci.space=3762;Nm=new fe("Va1idator1nfo111111111111111111111111111111"),zm=et({name:at(),website:Ot(at()),details:Ot(at()),iconUrl:Ot(at()),keybaseUsername:Ot(at())}),Km=new fe("Vote111111111111111111111111111111111111111"),qm=L.struct([_e("nodePubkey"),_e("authorizedWithdrawer"),L.u8("commission"),L.nu64(),L.seq(L.struct([L.nu64("slot"),L.u32("confirmationCount")]),L.offset(L.u32(),-8),"votes"),L.u8("rootSlotValid"),L.nu64("rootSlot"),L.nu64(),L.seq(L.struct([L.nu64("epoch"),_e("authorizedVoter")]),L.offset(L.u32(),-8),"authorizedVoters"),L.struct([L.seq(L.struct([_e("authorizedPubkey"),L.nu64("epochOfLastAuthorizedSwitch"),L.nu64("targetEpoch")]),32,"buf"),L.nu64("idx"),L.u8("isEmpty")],"priorVoters"),L.nu64(),L.seq(L.struct([L.nu64("epoch"),L.nu64("credits"),L.nu64("prevCredits")]),L.offset(L.u32(),-8),"epochCredits"),L.struct([L.nu64("slot"),L.nu64("timestamp")],"lastTimestamp")])});function Uc(){let r=Ur.generate();return{privateKey:Buffer.from(r.secretKey).toString("hex"),publicKey:r.publicKey.toString()}}var $m,Oc=ae(()=>{"use strict";$m=D(V());Ua()});var Nc=$e(()=>{var jm=D(V())});var zc=$e((Ym,ts)=>{var Zm=D(V());(function(r){"use strict";var t=function(m){var S,k=new Float64Array(16);if(m)for(S=0;S>24&255,m[S+1]=k>>16&255,m[S+2]=k>>8&255,m[S+3]=k&255,m[S+4]=l>>24&255,m[S+5]=l>>16&255,m[S+6]=l>>8&255,m[S+7]=l&255}function ft(m,S,k,l,B){var I,T=0;for(I=0;I>>8)-1}function W(m,S,k,l){return ft(m,S,k,l,16)}function P(m,S,k,l){return ft(m,S,k,l,32)}function J(m,S,k,l){for(var B=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,I=k[0]&255|(k[1]&255)<<8|(k[2]&255)<<16|(k[3]&255)<<24,T=k[4]&255|(k[5]&255)<<8|(k[6]&255)<<16|(k[7]&255)<<24,O=k[8]&255|(k[9]&255)<<8|(k[10]&255)<<16|(k[11]&255)<<24,$=k[12]&255|(k[13]&255)<<8|(k[14]&255)<<16|(k[15]&255)<<24,_t=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,X=S[0]&255|(S[1]&255)<<8|(S[2]&255)<<16|(S[3]&255)<<24,yt=S[4]&255|(S[5]&255)<<8|(S[6]&255)<<16|(S[7]&255)<<24,gt=S[8]&255|(S[9]&255)<<8|(S[10]&255)<<16|(S[11]&255)<<24,It=S[12]&255|(S[13]&255)<<8|(S[14]&255)<<16|(S[15]&255)<<24,Rt=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,Kt=k[16]&255|(k[17]&255)<<8|(k[18]&255)<<16|(k[19]&255)<<24,zt=k[20]&255|(k[21]&255)<<8|(k[22]&255)<<16|(k[23]&255)<<24,Tt=k[24]&255|(k[25]&255)<<8|(k[26]&255)<<16|(k[27]&255)<<24,Ct=k[28]&255|(k[29]&255)<<8|(k[30]&255)<<16|(k[31]&255)<<24,Pt=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,mt=B,Et=I,lt=T,wt=O,bt=$,ut=_t,q=X,F=yt,Q=gt,Y=It,Z=Rt,nt=Kt,Ut=zt,de=Tt,ye=Ct,pe=Pt,A,we=0;we<20;we+=2)A=mt+Ut|0,bt^=A<<7|A>>>32-7,A=bt+mt|0,Q^=A<<9|A>>>32-9,A=Q+bt|0,Ut^=A<<13|A>>>32-13,A=Ut+Q|0,mt^=A<<18|A>>>32-18,A=ut+Et|0,Y^=A<<7|A>>>32-7,A=Y+ut|0,de^=A<<9|A>>>32-9,A=de+Y|0,Et^=A<<13|A>>>32-13,A=Et+de|0,ut^=A<<18|A>>>32-18,A=Z+q|0,ye^=A<<7|A>>>32-7,A=ye+Z|0,lt^=A<<9|A>>>32-9,A=lt+ye|0,q^=A<<13|A>>>32-13,A=q+lt|0,Z^=A<<18|A>>>32-18,A=pe+nt|0,wt^=A<<7|A>>>32-7,A=wt+pe|0,F^=A<<9|A>>>32-9,A=F+wt|0,nt^=A<<13|A>>>32-13,A=nt+F|0,pe^=A<<18|A>>>32-18,A=mt+wt|0,Et^=A<<7|A>>>32-7,A=Et+mt|0,lt^=A<<9|A>>>32-9,A=lt+Et|0,wt^=A<<13|A>>>32-13,A=wt+lt|0,mt^=A<<18|A>>>32-18,A=ut+bt|0,q^=A<<7|A>>>32-7,A=q+ut|0,F^=A<<9|A>>>32-9,A=F+q|0,bt^=A<<13|A>>>32-13,A=bt+F|0,ut^=A<<18|A>>>32-18,A=Z+Y|0,nt^=A<<7|A>>>32-7,A=nt+Z|0,Q^=A<<9|A>>>32-9,A=Q+nt|0,Y^=A<<13|A>>>32-13,A=Y+Q|0,Z^=A<<18|A>>>32-18,A=pe+ye|0,Ut^=A<<7|A>>>32-7,A=Ut+pe|0,de^=A<<9|A>>>32-9,A=de+Ut|0,ye^=A<<13|A>>>32-13,A=ye+de|0,pe^=A<<18|A>>>32-18;mt=mt+B|0,Et=Et+I|0,lt=lt+T|0,wt=wt+O|0,bt=bt+$|0,ut=ut+_t|0,q=q+X|0,F=F+yt|0,Q=Q+gt|0,Y=Y+It|0,Z=Z+Rt|0,nt=nt+Kt|0,Ut=Ut+zt|0,de=de+Tt|0,ye=ye+Ct|0,pe=pe+Pt|0,m[0]=mt>>>0&255,m[1]=mt>>>8&255,m[2]=mt>>>16&255,m[3]=mt>>>24&255,m[4]=Et>>>0&255,m[5]=Et>>>8&255,m[6]=Et>>>16&255,m[7]=Et>>>24&255,m[8]=lt>>>0&255,m[9]=lt>>>8&255,m[10]=lt>>>16&255,m[11]=lt>>>24&255,m[12]=wt>>>0&255,m[13]=wt>>>8&255,m[14]=wt>>>16&255,m[15]=wt>>>24&255,m[16]=bt>>>0&255,m[17]=bt>>>8&255,m[18]=bt>>>16&255,m[19]=bt>>>24&255,m[20]=ut>>>0&255,m[21]=ut>>>8&255,m[22]=ut>>>16&255,m[23]=ut>>>24&255,m[24]=q>>>0&255,m[25]=q>>>8&255,m[26]=q>>>16&255,m[27]=q>>>24&255,m[28]=F>>>0&255,m[29]=F>>>8&255,m[30]=F>>>16&255,m[31]=F>>>24&255,m[32]=Q>>>0&255,m[33]=Q>>>8&255,m[34]=Q>>>16&255,m[35]=Q>>>24&255,m[36]=Y>>>0&255,m[37]=Y>>>8&255,m[38]=Y>>>16&255,m[39]=Y>>>24&255,m[40]=Z>>>0&255,m[41]=Z>>>8&255,m[42]=Z>>>16&255,m[43]=Z>>>24&255,m[44]=nt>>>0&255,m[45]=nt>>>8&255,m[46]=nt>>>16&255,m[47]=nt>>>24&255,m[48]=Ut>>>0&255,m[49]=Ut>>>8&255,m[50]=Ut>>>16&255,m[51]=Ut>>>24&255,m[52]=de>>>0&255,m[53]=de>>>8&255,m[54]=de>>>16&255,m[55]=de>>>24&255,m[56]=ye>>>0&255,m[57]=ye>>>8&255,m[58]=ye>>>16&255,m[59]=ye>>>24&255,m[60]=pe>>>0&255,m[61]=pe>>>8&255,m[62]=pe>>>16&255,m[63]=pe>>>24&255}function it(m,S,k,l){for(var B=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,I=k[0]&255|(k[1]&255)<<8|(k[2]&255)<<16|(k[3]&255)<<24,T=k[4]&255|(k[5]&255)<<8|(k[6]&255)<<16|(k[7]&255)<<24,O=k[8]&255|(k[9]&255)<<8|(k[10]&255)<<16|(k[11]&255)<<24,$=k[12]&255|(k[13]&255)<<8|(k[14]&255)<<16|(k[15]&255)<<24,_t=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,X=S[0]&255|(S[1]&255)<<8|(S[2]&255)<<16|(S[3]&255)<<24,yt=S[4]&255|(S[5]&255)<<8|(S[6]&255)<<16|(S[7]&255)<<24,gt=S[8]&255|(S[9]&255)<<8|(S[10]&255)<<16|(S[11]&255)<<24,It=S[12]&255|(S[13]&255)<<8|(S[14]&255)<<16|(S[15]&255)<<24,Rt=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,Kt=k[16]&255|(k[17]&255)<<8|(k[18]&255)<<16|(k[19]&255)<<24,zt=k[20]&255|(k[21]&255)<<8|(k[22]&255)<<16|(k[23]&255)<<24,Tt=k[24]&255|(k[25]&255)<<8|(k[26]&255)<<16|(k[27]&255)<<24,Ct=k[28]&255|(k[29]&255)<<8|(k[30]&255)<<16|(k[31]&255)<<24,Pt=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,mt=B,Et=I,lt=T,wt=O,bt=$,ut=_t,q=X,F=yt,Q=gt,Y=It,Z=Rt,nt=Kt,Ut=zt,de=Tt,ye=Ct,pe=Pt,A,we=0;we<20;we+=2)A=mt+Ut|0,bt^=A<<7|A>>>32-7,A=bt+mt|0,Q^=A<<9|A>>>32-9,A=Q+bt|0,Ut^=A<<13|A>>>32-13,A=Ut+Q|0,mt^=A<<18|A>>>32-18,A=ut+Et|0,Y^=A<<7|A>>>32-7,A=Y+ut|0,de^=A<<9|A>>>32-9,A=de+Y|0,Et^=A<<13|A>>>32-13,A=Et+de|0,ut^=A<<18|A>>>32-18,A=Z+q|0,ye^=A<<7|A>>>32-7,A=ye+Z|0,lt^=A<<9|A>>>32-9,A=lt+ye|0,q^=A<<13|A>>>32-13,A=q+lt|0,Z^=A<<18|A>>>32-18,A=pe+nt|0,wt^=A<<7|A>>>32-7,A=wt+pe|0,F^=A<<9|A>>>32-9,A=F+wt|0,nt^=A<<13|A>>>32-13,A=nt+F|0,pe^=A<<18|A>>>32-18,A=mt+wt|0,Et^=A<<7|A>>>32-7,A=Et+mt|0,lt^=A<<9|A>>>32-9,A=lt+Et|0,wt^=A<<13|A>>>32-13,A=wt+lt|0,mt^=A<<18|A>>>32-18,A=ut+bt|0,q^=A<<7|A>>>32-7,A=q+ut|0,F^=A<<9|A>>>32-9,A=F+q|0,bt^=A<<13|A>>>32-13,A=bt+F|0,ut^=A<<18|A>>>32-18,A=Z+Y|0,nt^=A<<7|A>>>32-7,A=nt+Z|0,Q^=A<<9|A>>>32-9,A=Q+nt|0,Y^=A<<13|A>>>32-13,A=Y+Q|0,Z^=A<<18|A>>>32-18,A=pe+ye|0,Ut^=A<<7|A>>>32-7,A=Ut+pe|0,de^=A<<9|A>>>32-9,A=de+Ut|0,ye^=A<<13|A>>>32-13,A=ye+de|0,pe^=A<<18|A>>>32-18;m[0]=mt>>>0&255,m[1]=mt>>>8&255,m[2]=mt>>>16&255,m[3]=mt>>>24&255,m[4]=ut>>>0&255,m[5]=ut>>>8&255,m[6]=ut>>>16&255,m[7]=ut>>>24&255,m[8]=Z>>>0&255,m[9]=Z>>>8&255,m[10]=Z>>>16&255,m[11]=Z>>>24&255,m[12]=pe>>>0&255,m[13]=pe>>>8&255,m[14]=pe>>>16&255,m[15]=pe>>>24&255,m[16]=q>>>0&255,m[17]=q>>>8&255,m[18]=q>>>16&255,m[19]=q>>>24&255,m[20]=F>>>0&255,m[21]=F>>>8&255,m[22]=F>>>16&255,m[23]=F>>>24&255,m[24]=Q>>>0&255,m[25]=Q>>>8&255,m[26]=Q>>>16&255,m[27]=Q>>>24&255,m[28]=Y>>>0&255,m[29]=Y>>>8&255,m[30]=Y>>>16&255,m[31]=Y>>>24&255}function j(m,S,k,l){J(m,S,k,l)}function rt(m,S,k,l){it(m,S,k,l)}var xt=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function ot(m,S,k,l,B,I,T){var O=new Uint8Array(16),$=new Uint8Array(64),_t,X;for(X=0;X<16;X++)O[X]=0;for(X=0;X<8;X++)O[X]=I[X];for(;B>=64;){for(j($,O,T,xt),X=0;X<64;X++)m[S+X]=k[l+X]^$[X];for(_t=1,X=8;X<16;X++)_t=_t+(O[X]&255)|0,O[X]=_t&255,_t>>>=8;B-=64,S+=64,l+=64}if(B>0)for(j($,O,T,xt),X=0;X=64;){for(j(T,I,B,xt),$=0;$<64;$++)m[S+$]=T[$];for(O=1,$=8;$<16;$++)O=O+(I[$]&255)|0,I[$]=O&255,O>>>=8;k-=64,S+=64}if(k>0)for(j(T,I,B,xt),$=0;$>>13|k<<3)&8191,l=m[4]&255|(m[5]&255)<<8,this.r[2]=(k>>>10|l<<6)&7939,B=m[6]&255|(m[7]&255)<<8,this.r[3]=(l>>>7|B<<9)&8191,I=m[8]&255|(m[9]&255)<<8,this.r[4]=(B>>>4|I<<12)&255,this.r[5]=I>>>1&8190,T=m[10]&255|(m[11]&255)<<8,this.r[6]=(I>>>14|T<<2)&8191,O=m[12]&255|(m[13]&255)<<8,this.r[7]=(T>>>11|O<<5)&8065,$=m[14]&255|(m[15]&255)<<8,this.r[8]=(O>>>8|$<<8)&8191,this.r[9]=$>>>5&127,this.pad[0]=m[16]&255|(m[17]&255)<<8,this.pad[1]=m[18]&255|(m[19]&255)<<8,this.pad[2]=m[20]&255|(m[21]&255)<<8,this.pad[3]=m[22]&255|(m[23]&255)<<8,this.pad[4]=m[24]&255|(m[25]&255)<<8,this.pad[5]=m[26]&255|(m[27]&255)<<8,this.pad[6]=m[28]&255|(m[29]&255)<<8,this.pad[7]=m[30]&255|(m[31]&255)<<8};Ee.prototype.blocks=function(m,S,k){for(var l=this.fin?0:2048,B,I,T,O,$,_t,X,yt,gt,It,Rt,Kt,zt,Tt,Ct,Pt,mt,Et,lt,wt=this.h[0],bt=this.h[1],ut=this.h[2],q=this.h[3],F=this.h[4],Q=this.h[5],Y=this.h[6],Z=this.h[7],nt=this.h[8],Ut=this.h[9],de=this.r[0],ye=this.r[1],pe=this.r[2],A=this.r[3],we=this.r[4],Se=this.r[5],Be=this.r[6],me=this.r[7],xe=this.r[8],ve=this.r[9];k>=16;)B=m[S+0]&255|(m[S+1]&255)<<8,wt+=B&8191,I=m[S+2]&255|(m[S+3]&255)<<8,bt+=(B>>>13|I<<3)&8191,T=m[S+4]&255|(m[S+5]&255)<<8,ut+=(I>>>10|T<<6)&8191,O=m[S+6]&255|(m[S+7]&255)<<8,q+=(T>>>7|O<<9)&8191,$=m[S+8]&255|(m[S+9]&255)<<8,F+=(O>>>4|$<<12)&8191,Q+=$>>>1&8191,_t=m[S+10]&255|(m[S+11]&255)<<8,Y+=($>>>14|_t<<2)&8191,X=m[S+12]&255|(m[S+13]&255)<<8,Z+=(_t>>>11|X<<5)&8191,yt=m[S+14]&255|(m[S+15]&255)<<8,nt+=(X>>>8|yt<<8)&8191,Ut+=yt>>>5|l,gt=0,It=gt,It+=wt*de,It+=bt*(5*ve),It+=ut*(5*xe),It+=q*(5*me),It+=F*(5*Be),gt=It>>>13,It&=8191,It+=Q*(5*Se),It+=Y*(5*we),It+=Z*(5*A),It+=nt*(5*pe),It+=Ut*(5*ye),gt+=It>>>13,It&=8191,Rt=gt,Rt+=wt*ye,Rt+=bt*de,Rt+=ut*(5*ve),Rt+=q*(5*xe),Rt+=F*(5*me),gt=Rt>>>13,Rt&=8191,Rt+=Q*(5*Be),Rt+=Y*(5*Se),Rt+=Z*(5*we),Rt+=nt*(5*A),Rt+=Ut*(5*pe),gt+=Rt>>>13,Rt&=8191,Kt=gt,Kt+=wt*pe,Kt+=bt*ye,Kt+=ut*de,Kt+=q*(5*ve),Kt+=F*(5*xe),gt=Kt>>>13,Kt&=8191,Kt+=Q*(5*me),Kt+=Y*(5*Be),Kt+=Z*(5*Se),Kt+=nt*(5*we),Kt+=Ut*(5*A),gt+=Kt>>>13,Kt&=8191,zt=gt,zt+=wt*A,zt+=bt*pe,zt+=ut*ye,zt+=q*de,zt+=F*(5*ve),gt=zt>>>13,zt&=8191,zt+=Q*(5*xe),zt+=Y*(5*me),zt+=Z*(5*Be),zt+=nt*(5*Se),zt+=Ut*(5*we),gt+=zt>>>13,zt&=8191,Tt=gt,Tt+=wt*we,Tt+=bt*A,Tt+=ut*pe,Tt+=q*ye,Tt+=F*de,gt=Tt>>>13,Tt&=8191,Tt+=Q*(5*ve),Tt+=Y*(5*xe),Tt+=Z*(5*me),Tt+=nt*(5*Be),Tt+=Ut*(5*Se),gt+=Tt>>>13,Tt&=8191,Ct=gt,Ct+=wt*Se,Ct+=bt*we,Ct+=ut*A,Ct+=q*pe,Ct+=F*ye,gt=Ct>>>13,Ct&=8191,Ct+=Q*de,Ct+=Y*(5*ve),Ct+=Z*(5*xe),Ct+=nt*(5*me),Ct+=Ut*(5*Be),gt+=Ct>>>13,Ct&=8191,Pt=gt,Pt+=wt*Be,Pt+=bt*Se,Pt+=ut*we,Pt+=q*A,Pt+=F*pe,gt=Pt>>>13,Pt&=8191,Pt+=Q*ye,Pt+=Y*de,Pt+=Z*(5*ve),Pt+=nt*(5*xe),Pt+=Ut*(5*me),gt+=Pt>>>13,Pt&=8191,mt=gt,mt+=wt*me,mt+=bt*Be,mt+=ut*Se,mt+=q*we,mt+=F*A,gt=mt>>>13,mt&=8191,mt+=Q*pe,mt+=Y*ye,mt+=Z*de,mt+=nt*(5*ve),mt+=Ut*(5*xe),gt+=mt>>>13,mt&=8191,Et=gt,Et+=wt*xe,Et+=bt*me,Et+=ut*Be,Et+=q*Se,Et+=F*we,gt=Et>>>13,Et&=8191,Et+=Q*A,Et+=Y*pe,Et+=Z*ye,Et+=nt*de,Et+=Ut*(5*ve),gt+=Et>>>13,Et&=8191,lt=gt,lt+=wt*ve,lt+=bt*xe,lt+=ut*me,lt+=q*Be,lt+=F*Se,gt=lt>>>13,lt&=8191,lt+=Q*we,lt+=Y*A,lt+=Z*pe,lt+=nt*ye,lt+=Ut*de,gt+=lt>>>13,lt&=8191,gt=(gt<<2)+gt|0,gt=gt+It|0,It=gt&8191,gt=gt>>>13,Rt+=gt,wt=It,bt=Rt,ut=Kt,q=zt,F=Tt,Q=Ct,Y=Pt,Z=mt,nt=Et,Ut=lt,S+=16,k-=16;this.h[0]=wt,this.h[1]=bt,this.h[2]=ut,this.h[3]=q,this.h[4]=F,this.h[5]=Q,this.h[6]=Y,this.h[7]=Z,this.h[8]=nt,this.h[9]=Ut},Ee.prototype.finish=function(m,S){var k=new Uint16Array(10),l,B,I,T;if(this.leftover){for(T=this.leftover,this.buffer[T++]=1;T<16;T++)this.buffer[T]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(l=this.h[1]>>>13,this.h[1]&=8191,T=2;T<10;T++)this.h[T]+=l,l=this.h[T]>>>13,this.h[T]&=8191;for(this.h[0]+=l*5,l=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=l,l=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=l,k[0]=this.h[0]+5,l=k[0]>>>13,k[0]&=8191,T=1;T<10;T++)k[T]=this.h[T]+l,l=k[T]>>>13,k[T]&=8191;for(k[9]-=8192,B=(l^1)-1,T=0;T<10;T++)k[T]&=B;for(B=~B,T=0;T<10;T++)this.h[T]=this.h[T]&B|k[T];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,I=this.h[0]+this.pad[0],this.h[0]=I&65535,T=1;T<8;T++)I=(this.h[T]+this.pad[T]|0)+(I>>>16)|0,this.h[T]=I&65535;m[S+0]=this.h[0]>>>0&255,m[S+1]=this.h[0]>>>8&255,m[S+2]=this.h[1]>>>0&255,m[S+3]=this.h[1]>>>8&255,m[S+4]=this.h[2]>>>0&255,m[S+5]=this.h[2]>>>8&255,m[S+6]=this.h[3]>>>0&255,m[S+7]=this.h[3]>>>8&255,m[S+8]=this.h[4]>>>0&255,m[S+9]=this.h[4]>>>8&255,m[S+10]=this.h[5]>>>0&255,m[S+11]=this.h[5]>>>8&255,m[S+12]=this.h[6]>>>0&255,m[S+13]=this.h[6]>>>8&255,m[S+14]=this.h[7]>>>0&255,m[S+15]=this.h[7]>>>8&255},Ee.prototype.update=function(m,S,k){var l,B;if(this.leftover){for(B=16-this.leftover,B>k&&(B=k),l=0;l=16&&(B=k-k%16,this.blocks(m,S,B),S+=B,k-=B),k){for(l=0;l>16&1),I[k-1]&=65535;I[15]=T[15]-32767-(I[14]>>16&1),B=I[15]>>16&1,I[14]&=65535,c(T,I,1-B)}for(k=0;k<16;k++)m[2*k]=T[k]&255,m[2*k+1]=T[k]>>8}function w(m,S){var k=new Uint8Array(32),l=new Uint8Array(32);return d(k,m),d(l,S),P(k,0,l,0)}function v(m){var S=new Uint8Array(32);return d(S,m),S[0]&1}function p(m,S){var k;for(k=0;k<16;k++)m[k]=S[2*k]+(S[2*k+1]<<8);m[15]&=32767}function s(m,S,k){for(var l=0;l<16;l++)m[l]=S[l]+k[l]}function y(m,S,k){for(var l=0;l<16;l++)m[l]=S[l]-k[l]}function R(m,S,k){var l,B,I=0,T=0,O=0,$=0,_t=0,X=0,yt=0,gt=0,It=0,Rt=0,Kt=0,zt=0,Tt=0,Ct=0,Pt=0,mt=0,Et=0,lt=0,wt=0,bt=0,ut=0,q=0,F=0,Q=0,Y=0,Z=0,nt=0,Ut=0,de=0,ye=0,pe=0,A=k[0],we=k[1],Se=k[2],Be=k[3],me=k[4],xe=k[5],ve=k[6],He=k[7],Le=k[8],Ke=k[9],qe=k[10],Fe=k[11],Ve=k[12],er=k[13],rr=k[14],nr=k[15];l=S[0],I+=l*A,T+=l*we,O+=l*Se,$+=l*Be,_t+=l*me,X+=l*xe,yt+=l*ve,gt+=l*He,It+=l*Le,Rt+=l*Ke,Kt+=l*qe,zt+=l*Fe,Tt+=l*Ve,Ct+=l*er,Pt+=l*rr,mt+=l*nr,l=S[1],T+=l*A,O+=l*we,$+=l*Se,_t+=l*Be,X+=l*me,yt+=l*xe,gt+=l*ve,It+=l*He,Rt+=l*Le,Kt+=l*Ke,zt+=l*qe,Tt+=l*Fe,Ct+=l*Ve,Pt+=l*er,mt+=l*rr,Et+=l*nr,l=S[2],O+=l*A,$+=l*we,_t+=l*Se,X+=l*Be,yt+=l*me,gt+=l*xe,It+=l*ve,Rt+=l*He,Kt+=l*Le,zt+=l*Ke,Tt+=l*qe,Ct+=l*Fe,Pt+=l*Ve,mt+=l*er,Et+=l*rr,lt+=l*nr,l=S[3],$+=l*A,_t+=l*we,X+=l*Se,yt+=l*Be,gt+=l*me,It+=l*xe,Rt+=l*ve,Kt+=l*He,zt+=l*Le,Tt+=l*Ke,Ct+=l*qe,Pt+=l*Fe,mt+=l*Ve,Et+=l*er,lt+=l*rr,wt+=l*nr,l=S[4],_t+=l*A,X+=l*we,yt+=l*Se,gt+=l*Be,It+=l*me,Rt+=l*xe,Kt+=l*ve,zt+=l*He,Tt+=l*Le,Ct+=l*Ke,Pt+=l*qe,mt+=l*Fe,Et+=l*Ve,lt+=l*er,wt+=l*rr,bt+=l*nr,l=S[5],X+=l*A,yt+=l*we,gt+=l*Se,It+=l*Be,Rt+=l*me,Kt+=l*xe,zt+=l*ve,Tt+=l*He,Ct+=l*Le,Pt+=l*Ke,mt+=l*qe,Et+=l*Fe,lt+=l*Ve,wt+=l*er,bt+=l*rr,ut+=l*nr,l=S[6],yt+=l*A,gt+=l*we,It+=l*Se,Rt+=l*Be,Kt+=l*me,zt+=l*xe,Tt+=l*ve,Ct+=l*He,Pt+=l*Le,mt+=l*Ke,Et+=l*qe,lt+=l*Fe,wt+=l*Ve,bt+=l*er,ut+=l*rr,q+=l*nr,l=S[7],gt+=l*A,It+=l*we,Rt+=l*Se,Kt+=l*Be,zt+=l*me,Tt+=l*xe,Ct+=l*ve,Pt+=l*He,mt+=l*Le,Et+=l*Ke,lt+=l*qe,wt+=l*Fe,bt+=l*Ve,ut+=l*er,q+=l*rr,F+=l*nr,l=S[8],It+=l*A,Rt+=l*we,Kt+=l*Se,zt+=l*Be,Tt+=l*me,Ct+=l*xe,Pt+=l*ve,mt+=l*He,Et+=l*Le,lt+=l*Ke,wt+=l*qe,bt+=l*Fe,ut+=l*Ve,q+=l*er,F+=l*rr,Q+=l*nr,l=S[9],Rt+=l*A,Kt+=l*we,zt+=l*Se,Tt+=l*Be,Ct+=l*me,Pt+=l*xe,mt+=l*ve,Et+=l*He,lt+=l*Le,wt+=l*Ke,bt+=l*qe,ut+=l*Fe,q+=l*Ve,F+=l*er,Q+=l*rr,Y+=l*nr,l=S[10],Kt+=l*A,zt+=l*we,Tt+=l*Se,Ct+=l*Be,Pt+=l*me,mt+=l*xe,Et+=l*ve,lt+=l*He,wt+=l*Le,bt+=l*Ke,ut+=l*qe,q+=l*Fe,F+=l*Ve,Q+=l*er,Y+=l*rr,Z+=l*nr,l=S[11],zt+=l*A,Tt+=l*we,Ct+=l*Se,Pt+=l*Be,mt+=l*me,Et+=l*xe,lt+=l*ve,wt+=l*He,bt+=l*Le,ut+=l*Ke,q+=l*qe,F+=l*Fe,Q+=l*Ve,Y+=l*er,Z+=l*rr,nt+=l*nr,l=S[12],Tt+=l*A,Ct+=l*we,Pt+=l*Se,mt+=l*Be,Et+=l*me,lt+=l*xe,wt+=l*ve,bt+=l*He,ut+=l*Le,q+=l*Ke,F+=l*qe,Q+=l*Fe,Y+=l*Ve,Z+=l*er,nt+=l*rr,Ut+=l*nr,l=S[13],Ct+=l*A,Pt+=l*we,mt+=l*Se,Et+=l*Be,lt+=l*me,wt+=l*xe,bt+=l*ve,ut+=l*He,q+=l*Le,F+=l*Ke,Q+=l*qe,Y+=l*Fe,Z+=l*Ve,nt+=l*er,Ut+=l*rr,de+=l*nr,l=S[14],Pt+=l*A,mt+=l*we,Et+=l*Se,lt+=l*Be,wt+=l*me,bt+=l*xe,ut+=l*ve,q+=l*He,F+=l*Le,Q+=l*Ke,Y+=l*qe,Z+=l*Fe,nt+=l*Ve,Ut+=l*er,de+=l*rr,ye+=l*nr,l=S[15],mt+=l*A,Et+=l*we,lt+=l*Se,wt+=l*Be,bt+=l*me,ut+=l*xe,q+=l*ve,F+=l*He,Q+=l*Le,Y+=l*Ke,Z+=l*qe,nt+=l*Fe,Ut+=l*Ve,de+=l*er,ye+=l*rr,pe+=l*nr,I+=38*Et,T+=38*lt,O+=38*wt,$+=38*bt,_t+=38*ut,X+=38*q,yt+=38*F,gt+=38*Q,It+=38*Y,Rt+=38*Z,Kt+=38*nt,zt+=38*Ut,Tt+=38*de,Ct+=38*ye,Pt+=38*pe,B=1,l=I+B+65535,B=Math.floor(l/65536),I=l-B*65536,l=T+B+65535,B=Math.floor(l/65536),T=l-B*65536,l=O+B+65535,B=Math.floor(l/65536),O=l-B*65536,l=$+B+65535,B=Math.floor(l/65536),$=l-B*65536,l=_t+B+65535,B=Math.floor(l/65536),_t=l-B*65536,l=X+B+65535,B=Math.floor(l/65536),X=l-B*65536,l=yt+B+65535,B=Math.floor(l/65536),yt=l-B*65536,l=gt+B+65535,B=Math.floor(l/65536),gt=l-B*65536,l=It+B+65535,B=Math.floor(l/65536),It=l-B*65536,l=Rt+B+65535,B=Math.floor(l/65536),Rt=l-B*65536,l=Kt+B+65535,B=Math.floor(l/65536),Kt=l-B*65536,l=zt+B+65535,B=Math.floor(l/65536),zt=l-B*65536,l=Tt+B+65535,B=Math.floor(l/65536),Tt=l-B*65536,l=Ct+B+65535,B=Math.floor(l/65536),Ct=l-B*65536,l=Pt+B+65535,B=Math.floor(l/65536),Pt=l-B*65536,l=mt+B+65535,B=Math.floor(l/65536),mt=l-B*65536,I+=B-1+37*(B-1),B=1,l=I+B+65535,B=Math.floor(l/65536),I=l-B*65536,l=T+B+65535,B=Math.floor(l/65536),T=l-B*65536,l=O+B+65535,B=Math.floor(l/65536),O=l-B*65536,l=$+B+65535,B=Math.floor(l/65536),$=l-B*65536,l=_t+B+65535,B=Math.floor(l/65536),_t=l-B*65536,l=X+B+65535,B=Math.floor(l/65536),X=l-B*65536,l=yt+B+65535,B=Math.floor(l/65536),yt=l-B*65536,l=gt+B+65535,B=Math.floor(l/65536),gt=l-B*65536,l=It+B+65535,B=Math.floor(l/65536),It=l-B*65536,l=Rt+B+65535,B=Math.floor(l/65536),Rt=l-B*65536,l=Kt+B+65535,B=Math.floor(l/65536),Kt=l-B*65536,l=zt+B+65535,B=Math.floor(l/65536),zt=l-B*65536,l=Tt+B+65535,B=Math.floor(l/65536),Tt=l-B*65536,l=Ct+B+65535,B=Math.floor(l/65536),Ct=l-B*65536,l=Pt+B+65535,B=Math.floor(l/65536),Pt=l-B*65536,l=mt+B+65535,B=Math.floor(l/65536),mt=l-B*65536,I+=B-1+37*(B-1),m[0]=I,m[1]=T,m[2]=O,m[3]=$,m[4]=_t,m[5]=X,m[6]=yt,m[7]=gt,m[8]=It,m[9]=Rt,m[10]=Kt,m[11]=zt,m[12]=Tt,m[13]=Ct,m[14]=Pt,m[15]=mt}function U(m,S){R(m,S,S)}function H(m,S){var k=t(),l;for(l=0;l<16;l++)k[l]=S[l];for(l=253;l>=0;l--)U(k,k),l!==2&&l!==4&&R(k,k,S);for(l=0;l<16;l++)m[l]=k[l]}function tt(m,S){var k=t(),l;for(l=0;l<16;l++)k[l]=S[l];for(l=250;l>=0;l--)U(k,k),l!==1&&R(k,k,S);for(l=0;l<16;l++)m[l]=k[l]}function st(m,S,k){var l=new Uint8Array(32),B=new Float64Array(80),I,T,O=t(),$=t(),_t=t(),X=t(),yt=t(),gt=t();for(T=0;T<31;T++)l[T]=S[T];for(l[31]=S[31]&127|64,l[0]&=248,p(B,k),T=0;T<16;T++)$[T]=B[T],X[T]=O[T]=_t[T]=0;for(O[0]=X[0]=1,T=254;T>=0;--T)I=l[T>>>3]>>>(T&7)&1,c(O,$,I),c(_t,X,I),s(yt,O,_t),y(O,O,_t),s(_t,$,X),y($,$,X),U(X,yt),U(gt,O),R(O,_t,O),R(_t,$,yt),s(yt,O,_t),y(O,O,_t),U($,O),y(_t,X,gt),R(O,_t,x),s(O,O,X),R(_t,_t,O),R(O,X,gt),R(X,$,B),U($,yt),c(O,$,I),c(_t,X,I);for(T=0;T<16;T++)B[T+16]=O[T],B[T+32]=_t[T],B[T+48]=$[T],B[T+64]=X[T];var It=B.subarray(32),Rt=B.subarray(16);return H(It,It),R(Rt,Rt,It),d(m,Rt),0}function dt(m,S){return st(m,S,o)}function be(m,S){return e(S,32),dt(m,S)}function ht(m,S,k){var l=new Uint8Array(32);return st(l,k,S),rt(m,n,l,xt)}var Bt=g,Xe=i;function qt(m,S,k,l,B,I){var T=new Uint8Array(32);return ht(T,B,I),Bt(m,S,k,l,T)}function Ft(m,S,k,l,B,I){var T=new Uint8Array(32);return ht(T,B,I),Xe(m,S,k,l,T)}var Or=[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 ee(m,S,k,l){for(var B=new Int32Array(16),I=new Int32Array(16),T,O,$,_t,X,yt,gt,It,Rt,Kt,zt,Tt,Ct,Pt,mt,Et,lt,wt,bt,ut,q,F,Q,Y,Z,nt,Ut=m[0],de=m[1],ye=m[2],pe=m[3],A=m[4],we=m[5],Se=m[6],Be=m[7],me=S[0],xe=S[1],ve=S[2],He=S[3],Le=S[4],Ke=S[5],qe=S[6],Fe=S[7],Ve=0;l>=128;){for(bt=0;bt<16;bt++)ut=8*bt+Ve,B[bt]=k[ut+0]<<24|k[ut+1]<<16|k[ut+2]<<8|k[ut+3],I[bt]=k[ut+4]<<24|k[ut+5]<<16|k[ut+6]<<8|k[ut+7];for(bt=0;bt<80;bt++)if(T=Ut,O=de,$=ye,_t=pe,X=A,yt=we,gt=Se,It=Be,Rt=me,Kt=xe,zt=ve,Tt=He,Ct=Le,Pt=Ke,mt=qe,Et=Fe,q=Be,F=Fe,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=(A>>>14|Le<<32-14)^(A>>>18|Le<<32-18)^(Le>>>41-32|A<<32-(41-32)),F=(Le>>>14|A<<32-14)^(Le>>>18|A<<32-18)^(A>>>41-32|Le<<32-(41-32)),Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,q=A&we^~A&Se,F=Le&Ke^~Le&qe,Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,q=Or[bt*2],F=Or[bt*2+1],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,q=B[bt%16],F=I[bt%16],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,lt=Z&65535|nt<<16,wt=Q&65535|Y<<16,q=lt,F=wt,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=(Ut>>>28|me<<32-28)^(me>>>34-32|Ut<<32-(34-32))^(me>>>39-32|Ut<<32-(39-32)),F=(me>>>28|Ut<<32-28)^(Ut>>>34-32|me<<32-(34-32))^(Ut>>>39-32|me<<32-(39-32)),Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,q=Ut&de^Ut&ye^de&ye,F=me&xe^me&ve^xe&ve,Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,It=Z&65535|nt<<16,Et=Q&65535|Y<<16,q=_t,F=Tt,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=lt,F=wt,Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,_t=Z&65535|nt<<16,Tt=Q&65535|Y<<16,de=T,ye=O,pe=$,A=_t,we=X,Se=yt,Be=gt,Ut=It,xe=Rt,ve=Kt,He=zt,Le=Tt,Ke=Ct,qe=Pt,Fe=mt,me=Et,bt%16===15)for(ut=0;ut<16;ut++)q=B[ut],F=I[ut],Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=B[(ut+9)%16],F=I[(ut+9)%16],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,lt=B[(ut+1)%16],wt=I[(ut+1)%16],q=(lt>>>1|wt<<32-1)^(lt>>>8|wt<<32-8)^lt>>>7,F=(wt>>>1|lt<<32-1)^(wt>>>8|lt<<32-8)^(wt>>>7|lt<<32-7),Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,lt=B[(ut+14)%16],wt=I[(ut+14)%16],q=(lt>>>19|wt<<32-19)^(wt>>>61-32|lt<<32-(61-32))^lt>>>6,F=(wt>>>19|lt<<32-19)^(lt>>>61-32|wt<<32-(61-32))^(wt>>>6|lt<<32-6),Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,B[ut]=Z&65535|nt<<16,I[ut]=Q&65535|Y<<16;q=Ut,F=me,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=m[0],F=S[0],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[0]=Ut=Z&65535|nt<<16,S[0]=me=Q&65535|Y<<16,q=de,F=xe,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=m[1],F=S[1],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[1]=de=Z&65535|nt<<16,S[1]=xe=Q&65535|Y<<16,q=ye,F=ve,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=m[2],F=S[2],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[2]=ye=Z&65535|nt<<16,S[2]=ve=Q&65535|Y<<16,q=pe,F=He,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=m[3],F=S[3],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[3]=pe=Z&65535|nt<<16,S[3]=He=Q&65535|Y<<16,q=A,F=Le,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=m[4],F=S[4],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[4]=A=Z&65535|nt<<16,S[4]=Le=Q&65535|Y<<16,q=we,F=Ke,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=m[5],F=S[5],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[5]=we=Z&65535|nt<<16,S[5]=Ke=Q&65535|Y<<16,q=Se,F=qe,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=m[6],F=S[6],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[6]=Se=Z&65535|nt<<16,S[6]=qe=Q&65535|Y<<16,q=Be,F=Fe,Q=F&65535,Y=F>>>16,Z=q&65535,nt=q>>>16,q=m[7],F=S[7],Q+=F&65535,Y+=F>>>16,Z+=q&65535,nt+=q>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[7]=Be=Z&65535|nt<<16,S[7]=Fe=Q&65535|Y<<16,Ve+=128,l-=128}return l}function Nt(m,S,k){var l=new Int32Array(8),B=new Int32Array(8),I=new Uint8Array(256),T,O=k;for(l[0]=1779033703,l[1]=3144134277,l[2]=1013904242,l[3]=2773480762,l[4]=1359893119,l[5]=2600822924,l[6]=528734635,l[7]=1541459225,B[0]=4089235720,B[1]=2227873595,B[2]=4271175723,B[3]=1595750129,B[4]=2917565137,B[5]=725511199,B[6]=4215389547,B[7]=327033209,ee(l,B,S,k),k%=128,T=0;T=0;--B)l=k[B/8|0]>>(B&7)&1,Zt(m,S,l),kr(S,m),kr(m,m),Zt(m,S,l)}function Dt(m,S){var k=[t(),t(),t(),t()];a(k[0],_),a(k[1],M),a(k[2],h),R(k[3],_,M),br(m,k,S)}function $t(m,S,k){var l=new Uint8Array(64),B=[t(),t(),t(),t()],I;for(k||e(S,32),Nt(l,S,32),l[0]&=248,l[31]&=127,l[31]|=64,Dt(B,l),Ht(m,B),I=0;I<32;I++)S[I+32]=m[I];return 0}var xr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Vt(m,S){var k,l,B,I;for(l=63;l>=32;--l){for(k=0,B=l-32,I=l-12;B>4)*xr[B],k=S[B]>>8,S[B]&=255;for(B=0;B<32;B++)S[B]-=k*xr[B];for(l=0;l<32;l++)S[l+1]+=S[l]>>8,m[l]=S[l]&255}function Gt(m){var S=new Float64Array(64),k;for(k=0;k<64;k++)S[k]=m[k];for(k=0;k<64;k++)m[k]=0;Vt(m,S)}function Nr(m,S,k,l){var B=new Uint8Array(64),I=new Uint8Array(64),T=new Uint8Array(64),O,$,_t=new Float64Array(64),X=[t(),t(),t(),t()];Nt(B,l,32),B[0]&=248,B[31]&=127,B[31]|=64;var yt=k+64;for(O=0;O>7&&y(m[0],f,m[0]),R(m[3],m[0],m[1]),0)}function Jt(m,S,k,l){var B,I=new Uint8Array(32),T=new Uint8Array(64),O=[t(),t(),t(),t()],$=[t(),t(),t(),t()];if(k<64||ie($,l))return-1;for(B=0;B=0},r.sign.keyPair=function(){var m=new Uint8Array(Wt),S=new Uint8Array(jt);return $t(m,S),{publicKey:m,secretKey:S}},r.sign.keyPair.fromSecretKey=function(m){if(Mt(m),m.length!==jt)throw new Error("bad secret key size");for(var S=new Uint8Array(Wt),k=0;k{"use strict";tw=D(V()),Oa=D(An());Ua();Na=D(zc())});async function Fd({action:r,accessControlConditions:t}){let{network:e,generateKeyParams:n}=r,o=r.signMessageParams?.messageToSign,f=gf(),[h,x]=await Promise.all([hs({accessControlConditions:t,publicKey:f.publicKey,privateKey:f.privateKey}),o?wf({messageToSign:o,privateKey:f.privateKey}):Promise.resolve()]);return{network:e,generateEncryptedPrivateKey:{...h,memo:n.memo},...x?{signMessage:{signature:x}}:{}}}async function Dd({action:r,accessControlConditions:t}){let{network:e,generateKeyParams:n}=r,o=r.signMessageParams?.messageToSign,f=Uc(),[h,x]=await Promise.all([hs({accessControlConditions:t,publicKey:f.publicKey,privateKey:f.privateKey}),o?Kc({messageToSign:o,privateKey:f.privateKey}):Promise.resolve()]);return{network:e,generateEncryptedPrivateKey:{...h,memo:n.memo},...x?{signMessage:{signature:x}}:{}}}async function Wd({actions:r,accessControlConditions:t}){return Promise.all(r.map(async(e,n)=>{let{network:o}=e;if(o==="evm")return await Fd({action:e,accessControlConditions:t});if(o==="solana")return await Dd({action:e,accessControlConditions:t});throw new Error(`Invalid network for action[${n}]: ${o}`)}))}function Hd(r){if(!r)throw new Error("Missing required field: actions");if(!r.length)throw new Error("No actions provided (empty array?)");r.forEach((t,e)=>{if(!["evm","solana"].includes(t.network))throw new Error(`Invalid field: actions[${e}].network: ${t.network}`);if(!t.generateKeyParams)throw new Error(`Missing required field: actions[${e}].generateKeyParams`);if(!t.generateKeyParams?.memo)throw new Error(`Missing required field: actions[${e}].generateKeyParams.memo`);if(t.signMessageParams&&!t.signMessageParams?.messageToSign)throw new Error(`Missing required field: actions[${e}].signMessageParams.messageToSign`)})}async function Fc({actions:r,accessControlConditions:t}){return Hd(r),Wd({actions:r,accessControlConditions:t})}var aw,Dc=ae(()=>{"use strict";aw=D(V());yf();mf();bf();Oc();qc()});var $d=$e(()=>{var lw=D(V());lf();Dc();(async()=>hf(async()=>Fc({actions,accessControlConditions})))()});$d();})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n *)\n\n@noble/hashes/esm/utils.js:\n (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/utils.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/modular.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/curve.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/edwards.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/ed25519.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\nsafe-buffer/index.js:\n (*! safe-buffer. MIT License. Feross Aboukhadijeh *)\n\n@solana/buffer-layout/lib/Layout.js:\n (**\n * Support for translating between Uint8Array instances and JavaScript\n * native types.\n *\n * {@link module:Layout~Layout|Layout} is the basis of a class\n * hierarchy that associates property names with sequences of encoded\n * bytes.\n *\n * Layouts are supported for these scalar (numeric) types:\n * * {@link module:Layout~UInt|Unsigned integers in little-endian\n * format} with {@link module:Layout.u8|8-bit}, {@link\n * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},\n * {@link module:Layout.u32|32-bit}, {@link\n * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}\n * representation ranges;\n * * {@link module:Layout~UIntBE|Unsigned integers in big-endian\n * format} with {@link module:Layout.u16be|16-bit}, {@link\n * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},\n * {@link module:Layout.u40be|40-bit}, and {@link\n * module:Layout.u48be|48-bit} representation ranges;\n * * {@link module:Layout~Int|Signed integers in little-endian\n * format} with {@link module:Layout.s8|8-bit}, {@link\n * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},\n * {@link module:Layout.s32|32-bit}, {@link\n * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}\n * representation ranges;\n * * {@link module:Layout~IntBE|Signed integers in big-endian format}\n * with {@link module:Layout.s16be|16-bit}, {@link\n * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},\n * {@link module:Layout.s40be|40-bit}, and {@link\n * module:Layout.s48be|48-bit} representation ranges;\n * * 64-bit integral values that decode to an exact (if magnitude is\n * less than 2^53) or nearby integral Number in {@link\n * module:Layout.nu64|unsigned little-endian}, {@link\n * module:Layout.nu64be|unsigned big-endian}, {@link\n * module:Layout.ns64|signed little-endian}, and {@link\n * module:Layout.ns64be|unsigned big-endian} encodings;\n * * 32-bit floating point values with {@link\n * module:Layout.f32|little-endian} and {@link\n * module:Layout.f32be|big-endian} representations;\n * * 64-bit floating point values with {@link\n * module:Layout.f64|little-endian} and {@link\n * module:Layout.f64be|big-endian} representations;\n * * {@link module:Layout.const|Constants} that take no space in the\n * encoded expression.\n *\n * and for these aggregate types:\n * * {@link module:Layout.seq|Sequence}s of instances of a {@link\n * module:Layout~Layout|Layout}, with JavaScript representation as\n * an Array and constant or data-dependent {@link\n * module:Layout~Sequence#count|length};\n * * {@link module:Layout.struct|Structure}s that aggregate a\n * heterogeneous sequence of {@link module:Layout~Layout|Layout}\n * instances, with JavaScript representation as an Object;\n * * {@link module:Layout.union|Union}s that support multiple {@link\n * module:Layout~VariantLayout|variant layouts} over a fixed\n * (padded) or variable (not padded) span of bytes, using an\n * unsigned integer at the start of the data or a separate {@link\n * module:Layout.unionLayoutDiscriminator|layout element} to\n * determine which layout to use when interpreting the buffer\n * contents;\n * * {@link module:Layout.bits|BitStructure}s that contain a sequence\n * of individual {@link\n * module:Layout~BitStructure#addField|BitField}s packed into an 8,\n * 16, 24, or 32-bit unsigned integer starting at the least- or\n * most-significant bit;\n * * {@link module:Layout.cstr|C strings} of varying length;\n * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link\n * module:Layout~Blob#length|length} raw data.\n *\n * All {@link module:Layout~Layout|Layout} instances are immutable\n * after construction, to prevent internal state from becoming\n * inconsistent.\n *\n * @local Layout\n * @local ExternalLayout\n * @local GreedyCount\n * @local OffsetLayout\n * @local UInt\n * @local UIntBE\n * @local Int\n * @local IntBE\n * @local NearUInt64\n * @local NearUInt64BE\n * @local NearInt64\n * @local NearInt64BE\n * @local Float\n * @local FloatBE\n * @local Double\n * @local DoubleBE\n * @local Sequence\n * @local Structure\n * @local UnionDiscriminator\n * @local UnionLayoutDiscriminator\n * @local Union\n * @local VariantLayout\n * @local BitStructure\n * @local BitField\n * @local Boolean\n * @local Blob\n * @local CString\n * @local Constant\n * @local bindConstructorLayout\n * @module Layout\n * @license MIT\n * @author Peter A. Bigot\n * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}\n *)\n\n@noble/curves/esm/abstract/weierstrass.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/_shortw_utils.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/secp256k1.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n*/\n'; + module2.exports = { + code: code9 + }; + } +}); + +// packages/wrapped-keys-lit-actions/src/generated/common/exportPrivateKey.js +var require_exportPrivateKey = __commonJS({ + "packages/wrapped-keys-lit-actions/src/generated/common/exportPrivateKey.js"(exports, module2) { + "use strict"; + init_shim(); + var code9 = '"use strict";(()=>{var Sr=Object.create;var z=Object.defineProperty;var Pr=Object.getOwnPropertyDescriptor;var _r=Object.getOwnPropertyNames;var Nr=Object.getPrototypeOf,Lr=Object.prototype.hasOwnProperty;var T=(e,r)=>()=>(e&&(r=e(e=0)),r);var N=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Dr=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of _r(r))!Lr.call(e,n)&&n!==t&&z(e,n,{get:()=>r[n],enumerable:!(i=Pr(r,n))||i.enumerable});return e};var l=(e,r,t)=>(t=e!=null?Sr(Nr(e)):{},Dr(r||!e||!e.__esModule?z(t,"default",{value:e,enumerable:!0}):t,e));var v=N(D=>{"use strict";var Et=l(y());D.byteLength=Mr;D.toByteArray=$r;D.fromByteArray=Hr;var d=[],E=[],kr=typeof Uint8Array<"u"?Uint8Array:Array,O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(F=0,Z=O.length;F0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var i=t===r?0:4-t%4;return[t,i]}function Mr(e){var r=Q(e),t=r[0],i=r[1];return(t+i)*3/4-i}function br(e,r,t){return(r+t)*3/4-t}function $r(e){var r,t=Q(e),i=t[0],n=t[1],o=new kr(br(e,i,n)),u=0,h=n>0?i-4:i,f;for(f=0;f>16&255,o[u++]=r>>8&255,o[u++]=r&255;return n===2&&(r=E[e.charCodeAt(f)]<<2|E[e.charCodeAt(f+1)]>>4,o[u++]=r&255),n===1&&(r=E[e.charCodeAt(f)]<<10|E[e.charCodeAt(f+1)]<<4|E[e.charCodeAt(f+2)]>>2,o[u++]=r>>8&255,o[u++]=r&255),o}function Or(e){return d[e>>18&63]+d[e>>12&63]+d[e>>6&63]+d[e&63]}function Kr(e,r,t){for(var i,n=[],o=r;oh?h:u+o));return i===1?(r=e[t-1],n.push(d[r>>2]+d[r<<4&63]+"==")):i===2&&(r=(e[t-2]<<8)+e[t-1],n.push(d[r>>10]+d[r>>4&63]+d[r<<2&63]+"=")),n.join("")}});var rr=N(K=>{var dt=l(y());K.read=function(e,r,t,i,n){var o,u,h=n*8-i-1,f=(1<>1,s=-7,p=t?n-1:0,U=t?-1:1,B=e[r+p];for(p+=U,o=B&(1<<-s)-1,B>>=-s,s+=h;s>0;o=o*256+e[r+p],p+=U,s-=8);for(u=o&(1<<-s)-1,o>>=-s,s+=i;s>0;u=u*256+e[r+p],p+=U,s-=8);if(o===0)o=1-a;else{if(o===f)return u?NaN:(B?-1:1)*(1/0);u=u+Math.pow(2,i),o=o-a}return(B?-1:1)*u*Math.pow(2,o-i)};K.write=function(e,r,t,i,n,o){var u,h,f,a=o*8-n-1,s=(1<>1,U=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,B=i?0:o-1,$=i?1:-1,Rr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(h=isNaN(r)?1:0,u=s):(u=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-u))<1&&(u--,f*=2),u+p>=1?r+=U/f:r+=U*Math.pow(2,1-p),r*f>=2&&(u++,f/=2),u+p>=s?(h=0,u=s):u+p>=1?(h=(r*f-1)*Math.pow(2,n),u=u+p):(h=r*Math.pow(2,p-1)*Math.pow(2,n),u=0));n>=8;e[t+B]=h&255,B+=$,h/=256,n-=8);for(u=u<0;e[t+B]=u&255,B+=$,u/=256,a-=8);e[t+B-$]|=Rr*128}});var Er=N(P=>{"use strict";var It=l(y());var H=v(),R=rr(),tr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;P.Buffer=c;P.SlowBuffer=jr;P.INSPECT_MAX_BYTES=50;var k=2147483647;P.kMaxLength=k;c.TYPED_ARRAY_SUPPORT=Gr();!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Gr(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}});Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function g(e){if(e>k)throw new RangeError(\'The value "\'+e+\'" is invalid for option "size"\');let r=new Uint8Array(e);return Object.setPrototypeOf(r,c.prototype),r}function c(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return q(e)}return or(e,r,t)}c.poolSize=8192;function or(e,r,t){if(typeof e=="string")return Yr(e,r);if(ArrayBuffer.isView(e))return qr(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(m(e,ArrayBuffer)||e&&m(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(m(e,SharedArrayBuffer)||e&&m(e.buffer,SharedArrayBuffer)))return W(e,r,t);if(typeof e=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return c.from(i,r,t);let n=Xr(e);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return c.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}c.from=function(e,r,t){return or(e,r,t)};Object.setPrototypeOf(c.prototype,Uint8Array.prototype);Object.setPrototypeOf(c,Uint8Array);function ur(e){if(typeof e!="number")throw new TypeError(\'"size" argument must be of type number\');if(e<0)throw new RangeError(\'The value "\'+e+\'" is invalid for option "size"\')}function Wr(e,r,t){return ur(e),e<=0?g(e):r!==void 0?typeof t=="string"?g(e).fill(r,t):g(e).fill(r):g(e)}c.alloc=function(e,r,t){return Wr(e,r,t)};function q(e){return ur(e),g(e<0?0:X(e)|0)}c.allocUnsafe=function(e){return q(e)};c.allocUnsafeSlow=function(e){return q(e)};function Yr(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=cr(e,r)|0,i=g(t),n=i.write(e,r);return n!==t&&(i=i.slice(0,n)),i}function G(e){let r=e.length<0?0:X(e.length)|0,t=g(r);for(let i=0;i=k)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+k.toString(16)+" bytes");return e|0}function jr(e){return+e!=e&&(e=0),c.alloc(+e)}c.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==c.prototype};c.compare=function(r,t){if(m(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),m(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(r)||!c.isBuffer(t))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(r===t)return 0;let i=r.length,n=t.length;for(let o=0,u=Math.min(i,n);on.length?(c.isBuffer(u)||(u=c.from(u)),u.copy(n,o)):Uint8Array.prototype.set.call(n,u,o);else if(c.isBuffer(u))u.copy(n,o);else throw new TypeError(\'"list" argument must be an Array of Buffers\');o+=u.length}return n};function cr(e,r){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||m(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof e);let t=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return xr(e).length;default:if(n)return i?-1:Y(e).length;r=(""+r).toLowerCase(),n=!0}}c.byteLength=cr;function Vr(e,r,t){let i=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return nt(this,r,t);case"utf8":case"utf-8":return fr(this,r,t);case"ascii":return et(this,r,t);case"latin1":case"binary":return it(this,r,t);case"base64":return rt(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ot(this,r,t);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}c.prototype._isBuffer=!0;function A(e,r,t){let i=e[r];e[r]=e[t],e[t]=i}c.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tt&&(r+=" ... "),""};tr&&(c.prototype[tr]=c.prototype.inspect);c.prototype.compare=function(r,t,i,n,o){if(m(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(r))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof r);if(t===void 0&&(t=0),i===void 0&&(i=r?r.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>r.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===r)return 0;let u=o-n,h=i-t,f=Math.min(u,h),a=this.slice(n,o),s=r.slice(t,i);for(let p=0;p2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,V(t)&&(t=n?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(n)return-1;t=e.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof r=="string"&&(r=c.from(r,i)),c.isBuffer(r))return r.length===0?-1:er(e,r,t,i,n);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):er(e,[r],t,i,n);throw new TypeError("val must be string, number or Buffer")}function er(e,r,t,i,n){let o=1,u=e.length,h=r.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||r.length<2)return-1;o=2,u/=2,h/=2,t/=2}function f(s,p){return o===1?s[p]:s.readUInt16BE(p*o)}let a;if(n){let s=-1;for(a=t;au&&(t=u-h),a=t;a>=0;a--){let s=!0;for(let p=0;pn&&(i=n)):i=n;let o=r.length;i>o/2&&(i=o/2);let u;for(u=0;u>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((i===void 0||i>o)&&(i=o),r.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let u=!1;for(;;)switch(n){case"hex":return Jr(this,r,t,i);case"utf8":case"utf-8":return zr(this,r,t,i);case"ascii":case"latin1":case"binary":return Zr(this,r,t,i);case"base64":return Qr(this,r,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vr(this,r,t,i);default:if(u)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}};c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function rt(e,r,t){return r===0&&t===e.length?H.fromByteArray(e):H.fromByteArray(e.slice(r,t))}function fr(e,r,t){t=Math.min(e.length,t);let i=[],n=r;for(;n239?4:o>223?3:o>191?2:1;if(n+h<=t){let f,a,s,p;switch(h){case 1:o<128&&(u=o);break;case 2:f=e[n+1],(f&192)===128&&(p=(o&31)<<6|f&63,p>127&&(u=p));break;case 3:f=e[n+1],a=e[n+2],(f&192)===128&&(a&192)===128&&(p=(o&15)<<12|(f&63)<<6|a&63,p>2047&&(p<55296||p>57343)&&(u=p));break;case 4:f=e[n+1],a=e[n+2],s=e[n+3],(f&192)===128&&(a&192)===128&&(s&192)===128&&(p=(o&15)<<18|(f&63)<<12|(a&63)<<6|s&63,p>65535&&p<1114112&&(u=p))}}u===null?(u=65533,h=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|u&1023),i.push(u),n+=h}return tt(i)}var ir=4096;function tt(e){let r=e.length;if(r<=ir)return String.fromCharCode.apply(String,e);let t="",i=0;for(;ii)&&(t=i);let n="";for(let o=r;oi&&(r=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(r,t,i){r=r>>>0,t=t>>>0,i||w(r,t,this.length);let n=this[r],o=1,u=0;for(;++u>>0,t=t>>>0,i||w(r,t,this.length);let n=this[r+--t],o=1;for(;t>0&&(o*=256);)n+=this[r+--t]*o;return n};c.prototype.readUint8=c.prototype.readUInt8=function(r,t){return r=r>>>0,t||w(r,1,this.length),this[r]};c.prototype.readUint16LE=c.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||w(r,2,this.length),this[r]|this[r+1]<<8};c.prototype.readUint16BE=c.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||w(r,2,this.length),this[r]<<8|this[r+1]};c.prototype.readUint32LE=c.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||w(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};c.prototype.readUint32BE=c.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};c.prototype.readBigUInt64LE=I(function(r){r=r>>>0,S(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&L(r,this.length-8);let n=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,o=this[++r]+this[++r]*2**8+this[++r]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<>>0,S(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&L(r,this.length-8);let n=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],o=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+i;return(BigInt(n)<>>0,t=t>>>0,i||w(r,t,this.length);let n=this[r],o=1,u=0;for(;++u=o&&(n-=Math.pow(2,8*t)),n};c.prototype.readIntBE=function(r,t,i){r=r>>>0,t=t>>>0,i||w(r,t,this.length);let n=t,o=1,u=this[r+--n];for(;n>0&&(o*=256);)u+=this[r+--n]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*t)),u};c.prototype.readInt8=function(r,t){return r=r>>>0,t||w(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};c.prototype.readInt16LE=function(r,t){r=r>>>0,t||w(r,2,this.length);let i=this[r]|this[r+1]<<8;return i&32768?i|4294901760:i};c.prototype.readInt16BE=function(r,t){r=r>>>0,t||w(r,2,this.length);let i=this[r+1]|this[r]<<8;return i&32768?i|4294901760:i};c.prototype.readInt32LE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};c.prototype.readInt32BE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};c.prototype.readBigInt64LE=I(function(r){r=r>>>0,S(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&L(r,this.length-8);let n=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(i<<24);return(BigInt(n)<>>0,S(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&L(r,this.length-8);let n=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(n)<>>0,t||w(r,4,this.length),R.read(this,r,!0,23,4)};c.prototype.readFloatBE=function(r,t){return r=r>>>0,t||w(r,4,this.length),R.read(this,r,!1,23,4)};c.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||w(r,8,this.length),R.read(this,r,!0,52,8)};c.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||w(r,8,this.length),R.read(this,r,!1,52,8)};function x(e,r,t,i,n,o){if(!c.isBuffer(e))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(r>n||re.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(r,t,i,n){if(r=+r,t=t>>>0,i=i>>>0,!n){let h=Math.pow(2,8*i)-1;x(this,r,t,i,h,0)}let o=1,u=0;for(this[t]=r&255;++u>>0,i=i>>>0,!n){let h=Math.pow(2,8*i)-1;x(this,r,t,i,h,0)}let o=i-1,u=1;for(this[t+o]=r&255;--o>=0&&(u*=256);)this[t+o]=r/u&255;return t+i};c.prototype.writeUint8=c.prototype.writeUInt8=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,1,255,0),this[t]=r&255,t+1};c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function pr(e,r,t,i,n){wr(r,i,n,e,t,7);let o=Number(r&BigInt(4294967295));e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,t}function sr(e,r,t,i,n){wr(r,i,n,e,t,7);let o=Number(r&BigInt(4294967295));e[t+7]=o,o=o>>8,e[t+6]=o,o=o>>8,e[t+5]=o,o=o>>8,e[t+4]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=u,u=u>>8,e[t+2]=u,u=u>>8,e[t+1]=u,u=u>>8,e[t]=u,t+8}c.prototype.writeBigUInt64LE=I(function(r,t=0){return pr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});c.prototype.writeBigUInt64BE=I(function(r,t=0){return sr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});c.prototype.writeIntLE=function(r,t,i,n){if(r=+r,t=t>>>0,!n){let f=Math.pow(2,8*i-1);x(this,r,t,i,f-1,-f)}let o=0,u=1,h=0;for(this[t]=r&255;++o>0)-h&255;return t+i};c.prototype.writeIntBE=function(r,t,i,n){if(r=+r,t=t>>>0,!n){let f=Math.pow(2,8*i-1);x(this,r,t,i,f-1,-f)}let o=i-1,u=1,h=0;for(this[t+o]=r&255;--o>=0&&(u*=256);)r<0&&h===0&&this[t+o+1]!==0&&(h=1),this[t+o]=(r/u>>0)-h&255;return t+i};c.prototype.writeInt8=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};c.prototype.writeInt16LE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};c.prototype.writeInt16BE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};c.prototype.writeInt32LE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};c.prototype.writeInt32BE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};c.prototype.writeBigInt64LE=I(function(r,t=0){return pr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});c.prototype.writeBigInt64BE=I(function(r,t=0){return sr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ar(e,r,t,i,n,o){if(t+i>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function lr(e,r,t,i,n){return r=+r,t=t>>>0,n||ar(e,r,t,4,34028234663852886e22,-34028234663852886e22),R.write(e,r,t,i,23,4),t+4}c.prototype.writeFloatLE=function(r,t,i){return lr(this,r,t,!0,i)};c.prototype.writeFloatBE=function(r,t,i){return lr(this,r,t,!1,i)};function yr(e,r,t,i,n){return r=+r,t=t>>>0,n||ar(e,r,t,8,17976931348623157e292,-17976931348623157e292),R.write(e,r,t,i,52,8),t+8}c.prototype.writeDoubleLE=function(r,t,i){return yr(this,r,t,!0,i)};c.prototype.writeDoubleBE=function(r,t,i){return yr(this,r,t,!1,i)};c.prototype.copy=function(r,t,i,n){if(!c.isBuffer(r))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=r.length&&(t=r.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),r.length-t>>0,i=i===void 0?this.length:i>>>0,r||(r=0);let o;if(typeof r=="number")for(o=t;o2**32?n=nr(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=nr(n)),n+="n"),i+=` It must be ${r}. Received ${n}`,i},RangeError);function nr(e){let r="",t=e.length,i=e[0]==="-"?1:0;for(;t>=i+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return`${e.slice(0,t)}${r}`}function ut(e,r,t){S(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&L(r,e.length-(t+1))}function wr(e,r,t,i,n,o){if(e>t||e3?r===0||r===BigInt(0)?h=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`:h=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`:h=`>= ${r}${u} and <= ${t}${u}`,new C.ERR_OUT_OF_RANGE("value",h,e)}ut(i,n,o)}function S(e,r){if(typeof e!="number")throw new C.ERR_INVALID_ARG_TYPE(r,"number",e)}function L(e,r,t){throw Math.floor(e)!==e?(S(e,t),new C.ERR_OUT_OF_RANGE(t||"offset","an integer",e)):r<0?new C.ERR_BUFFER_OUT_OF_BOUNDS:new C.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${r}`,e)}var ct=/[^+/0-9A-Za-z-_]/g;function ht(e){if(e=e.split("=")[0],e=e.trim().replace(ct,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function Y(e,r){r=r||1/0;let t,i=e.length,n=null,o=[];for(let u=0;u55295&&t<57344){if(!n){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===i){(r-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(r-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function ft(e){let r=[];for(let t=0;t>8,n=t%256,o.push(n),o.push(i);return o}function xr(e){return H.toByteArray(ht(e))}function M(e,r,t,i){let n;for(n=0;n=r.length||n>=e.length);++n)r[n+t]=e[n];return n}function m(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function V(e){return e!==e}var st=function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)r[i+n]=e[t]+e[n]}return r}();function I(e){return typeof BigInt>"u"?at:e}function at(){throw new Error("BigInt not supported")}});var y=N(()=>{"use strict";var Br=l(Er());globalThis.Buffer=Br.Buffer});var Tt,_,J=T(()=>{"use strict";Tt=l(y()),_=class extends Error{constructor(){super(...arguments);this.name="AbortError"}}});async function dr(e){try{let r=await e(),t=typeof r=="string"?r:JSON.stringify(r);Lit.Actions.setResponse({response:t})}catch(r){if(r instanceof _)return;Lit.Actions.setResponse({response:`Error: ${r.message}`})}}var St,mr=T(()=>{"use strict";St=l(y());J()});var _t,b,gr=T(()=>{"use strict";_t=l(y()),b="lit_"});function Ir(e){if(!e.startsWith(b))throw new Error(`PKey was not encrypted with salt; all wrapped keys must be prefixed with \'${b}\'`);return e.slice(b.length)}var Dt,Fr=T(()=>{"use strict";Dt=l(y());gr()});async function lt({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t}){try{return await Lit.Actions.decryptToSingleNode({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t,chain:"ethereum",authSig:null})}catch(i){throw new Error(`When decrypting key to a single node - ${i.message}`)}}async function Ar({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t}){let i=await lt({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t});if(!i)throw new _;return Ir(i)}var $t,Ur=T(()=>{"use strict";$t=l(y());J();Fr()});async function Tr({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t}){return Ar({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t})}var Ht,Cr=T(()=>{"use strict";Ht=l(y());Ur()});var yt=N(()=>{var Xt=l(y());mr();Cr();(async()=>dr(async()=>Tr({accessControlConditions,ciphertext,dataToEncryptHash})))()});yt();})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n *)\n*/\n'; + module2.exports = { + code: code9 + }; + } +}); + +// packages/wrapped-keys-lit-actions/src/generated/ethereum/generateEncryptedEthereumPrivateKey.js +var require_generateEncryptedEthereumPrivateKey = __commonJS({ + "packages/wrapped-keys-lit-actions/src/generated/ethereum/generateEncryptedEthereumPrivateKey.js"(exports, module2) { + "use strict"; + init_shim(); + var code9 = '"use strict";(()=>{var _r=Object.create;var V=Object.defineProperty;var Sr=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var Lr=Object.getPrototypeOf,br=Object.prototype.hasOwnProperty;var R=(e,r)=>()=>(e&&(r=e(e=0)),r);var P=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Nr=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Pr(r))!br.call(e,n)&&n!==t&&V(e,n,{get:()=>r[n],enumerable:!(i=Sr(r,n))||i.enumerable});return e};var l=(e,r,t)=>(t=e!=null?_r(Lr(e)):{},Nr(r||!e||!e.__esModule?V(t,"default",{value:e,enumerable:!0}):t,e));var Z=P(b=>{"use strict";var xt=l(y());b.byteLength=Mr;b.toByteArray=$r;b.fromByteArray=Gr;var d=[],E=[],kr=typeof Uint8Array<"u"?Uint8Array:Array,$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(F=0,J=$.length;F0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var i=t===r?0:4-t%4;return[t,i]}function Mr(e){var r=z(e),t=r[0],i=r[1];return(t+i)*3/4-i}function Dr(e,r,t){return(r+t)*3/4-t}function $r(e){var r,t=z(e),i=t[0],n=t[1],o=new kr(Dr(e,i,n)),u=0,h=n>0?i-4:i,f;for(f=0;f>16&255,o[u++]=r>>8&255,o[u++]=r&255;return n===2&&(r=E[e.charCodeAt(f)]<<2|E[e.charCodeAt(f+1)]>>4,o[u++]=r&255),n===1&&(r=E[e.charCodeAt(f)]<<10|E[e.charCodeAt(f+1)]<<4|E[e.charCodeAt(f+2)]>>2,o[u++]=r>>8&255,o[u++]=r&255),o}function Kr(e){return d[e>>18&63]+d[e>>12&63]+d[e>>6&63]+d[e&63]}function Or(e,r,t){for(var i,n=[],o=r;oh?h:u+o));return i===1?(r=e[t-1],n.push(d[r>>2]+d[r<<4&63]+"==")):i===2&&(r=(e[t-2]<<8)+e[t-1],n.push(d[r>>10]+d[r>>4&63]+d[r<<2&63]+"=")),n.join("")}});var Q=P(K=>{var Bt=l(y());K.read=function(e,r,t,i,n){var o,u,h=n*8-i-1,f=(1<>1,s=-7,p=t?n-1:0,U=t?-1:1,B=e[r+p];for(p+=U,o=B&(1<<-s)-1,B>>=-s,s+=h;s>0;o=o*256+e[r+p],p+=U,s-=8);for(u=o&(1<<-s)-1,o>>=-s,s+=i;s>0;u=u*256+e[r+p],p+=U,s-=8);if(o===0)o=1-a;else{if(o===f)return u?NaN:(B?-1:1)*(1/0);u=u+Math.pow(2,i),o=o-a}return(B?-1:1)*u*Math.pow(2,o-i)};K.write=function(e,r,t,i,n,o){var u,h,f,a=o*8-n-1,s=(1<>1,U=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,B=i?0:o-1,D=i?1:-1,Cr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(h=isNaN(r)?1:0,u=s):(u=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-u))<1&&(u--,f*=2),u+p>=1?r+=U/f:r+=U*Math.pow(2,1-p),r*f>=2&&(u++,f/=2),u+p>=s?(h=0,u=s):u+p>=1?(h=(r*f-1)*Math.pow(2,n),u=u+p):(h=r*Math.pow(2,p-1)*Math.pow(2,n),u=0));n>=8;e[t+B]=h&255,B+=D,h/=256,n-=8);for(u=u<0;e[t+B]=u&255,B+=D,u/=256,a-=8);e[t+B-D]|=Cr*128}});var wr=P(S=>{"use strict";var gt=l(y());var O=Z(),C=Q(),v=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;S.Buffer=c;S.SlowBuffer=jr;S.INSPECT_MAX_BYTES=50;var N=2147483647;S.kMaxLength=N;c.TYPED_ARRAY_SUPPORT=Hr();!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Hr(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}});Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function g(e){if(e>N)throw new RangeError(\'The value "\'+e+\'" is invalid for option "size"\');let r=new Uint8Array(e);return Object.setPrototypeOf(r,c.prototype),r}function c(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return Y(e)}return ir(e,r,t)}c.poolSize=8192;function ir(e,r,t){if(typeof e=="string")return Yr(e,r);if(ArrayBuffer.isView(e))return qr(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(m(e,ArrayBuffer)||e&&m(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(m(e,SharedArrayBuffer)||e&&m(e.buffer,SharedArrayBuffer)))return H(e,r,t);if(typeof e=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return c.from(i,r,t);let n=Xr(e);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return c.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}c.from=function(e,r,t){return ir(e,r,t)};Object.setPrototypeOf(c.prototype,Uint8Array.prototype);Object.setPrototypeOf(c,Uint8Array);function nr(e){if(typeof e!="number")throw new TypeError(\'"size" argument must be of type number\');if(e<0)throw new RangeError(\'The value "\'+e+\'" is invalid for option "size"\')}function Wr(e,r,t){return nr(e),e<=0?g(e):r!==void 0?typeof t=="string"?g(e).fill(r,t):g(e).fill(r):g(e)}c.alloc=function(e,r,t){return Wr(e,r,t)};function Y(e){return nr(e),g(e<0?0:q(e)|0)}c.allocUnsafe=function(e){return Y(e)};c.allocUnsafeSlow=function(e){return Y(e)};function Yr(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=or(e,r)|0,i=g(t),n=i.write(e,r);return n!==t&&(i=i.slice(0,n)),i}function G(e){let r=e.length<0?0:q(e.length)|0,t=g(r);for(let i=0;i=N)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+N.toString(16)+" bytes");return e|0}function jr(e){return+e!=e&&(e=0),c.alloc(+e)}c.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==c.prototype};c.compare=function(r,t){if(m(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),m(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(r)||!c.isBuffer(t))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(r===t)return 0;let i=r.length,n=t.length;for(let o=0,u=Math.min(i,n);on.length?(c.isBuffer(u)||(u=c.from(u)),u.copy(n,o)):Uint8Array.prototype.set.call(n,u,o);else if(c.isBuffer(u))u.copy(n,o);else throw new TypeError(\'"list" argument must be an Array of Buffers\');o+=u.length}return n};function or(e,r){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||m(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof e);let t=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return yr(e).length;default:if(n)return i?-1:W(e).length;r=(""+r).toLowerCase(),n=!0}}c.byteLength=or;function Vr(e,r,t){let i=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return nt(this,r,t);case"utf8":case"utf-8":return cr(this,r,t);case"ascii":return et(this,r,t);case"latin1":case"binary":return it(this,r,t);case"base64":return rt(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ot(this,r,t);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}c.prototype._isBuffer=!0;function A(e,r,t){let i=e[r];e[r]=e[t],e[t]=i}c.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tt&&(r+=" ... "),""};v&&(c.prototype[v]=c.prototype.inspect);c.prototype.compare=function(r,t,i,n,o){if(m(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(r))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof r);if(t===void 0&&(t=0),i===void 0&&(i=r?r.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>r.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===r)return 0;let u=o-n,h=i-t,f=Math.min(u,h),a=this.slice(n,o),s=r.slice(t,i);for(let p=0;p2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,j(t)&&(t=n?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(n)return-1;t=e.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof r=="string"&&(r=c.from(r,i)),c.isBuffer(r))return r.length===0?-1:rr(e,r,t,i,n);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):rr(e,[r],t,i,n);throw new TypeError("val must be string, number or Buffer")}function rr(e,r,t,i,n){let o=1,u=e.length,h=r.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||r.length<2)return-1;o=2,u/=2,h/=2,t/=2}function f(s,p){return o===1?s[p]:s.readUInt16BE(p*o)}let a;if(n){let s=-1;for(a=t;au&&(t=u-h),a=t;a>=0;a--){let s=!0;for(let p=0;pn&&(i=n)):i=n;let o=r.length;i>o/2&&(i=o/2);let u;for(u=0;u>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((i===void 0||i>o)&&(i=o),r.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let u=!1;for(;;)switch(n){case"hex":return Jr(this,r,t,i);case"utf8":case"utf-8":return zr(this,r,t,i);case"ascii":case"latin1":case"binary":return Zr(this,r,t,i);case"base64":return Qr(this,r,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vr(this,r,t,i);default:if(u)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}};c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function rt(e,r,t){return r===0&&t===e.length?O.fromByteArray(e):O.fromByteArray(e.slice(r,t))}function cr(e,r,t){t=Math.min(e.length,t);let i=[],n=r;for(;n239?4:o>223?3:o>191?2:1;if(n+h<=t){let f,a,s,p;switch(h){case 1:o<128&&(u=o);break;case 2:f=e[n+1],(f&192)===128&&(p=(o&31)<<6|f&63,p>127&&(u=p));break;case 3:f=e[n+1],a=e[n+2],(f&192)===128&&(a&192)===128&&(p=(o&15)<<12|(f&63)<<6|a&63,p>2047&&(p<55296||p>57343)&&(u=p));break;case 4:f=e[n+1],a=e[n+2],s=e[n+3],(f&192)===128&&(a&192)===128&&(s&192)===128&&(p=(o&15)<<18|(f&63)<<12|(a&63)<<6|s&63,p>65535&&p<1114112&&(u=p))}}u===null?(u=65533,h=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|u&1023),i.push(u),n+=h}return tt(i)}var tr=4096;function tt(e){let r=e.length;if(r<=tr)return String.fromCharCode.apply(String,e);let t="",i=0;for(;ii)&&(t=i);let n="";for(let o=r;oi&&(r=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(r,t,i){r=r>>>0,t=t>>>0,i||w(r,t,this.length);let n=this[r],o=1,u=0;for(;++u>>0,t=t>>>0,i||w(r,t,this.length);let n=this[r+--t],o=1;for(;t>0&&(o*=256);)n+=this[r+--t]*o;return n};c.prototype.readUint8=c.prototype.readUInt8=function(r,t){return r=r>>>0,t||w(r,1,this.length),this[r]};c.prototype.readUint16LE=c.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||w(r,2,this.length),this[r]|this[r+1]<<8};c.prototype.readUint16BE=c.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||w(r,2,this.length),this[r]<<8|this[r+1]};c.prototype.readUint32LE=c.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||w(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};c.prototype.readUint32BE=c.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};c.prototype.readBigUInt64LE=I(function(r){r=r>>>0,_(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&L(r,this.length-8);let n=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,o=this[++r]+this[++r]*2**8+this[++r]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<>>0,_(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&L(r,this.length-8);let n=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],o=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+i;return(BigInt(n)<>>0,t=t>>>0,i||w(r,t,this.length);let n=this[r],o=1,u=0;for(;++u=o&&(n-=Math.pow(2,8*t)),n};c.prototype.readIntBE=function(r,t,i){r=r>>>0,t=t>>>0,i||w(r,t,this.length);let n=t,o=1,u=this[r+--n];for(;n>0&&(o*=256);)u+=this[r+--n]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*t)),u};c.prototype.readInt8=function(r,t){return r=r>>>0,t||w(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};c.prototype.readInt16LE=function(r,t){r=r>>>0,t||w(r,2,this.length);let i=this[r]|this[r+1]<<8;return i&32768?i|4294901760:i};c.prototype.readInt16BE=function(r,t){r=r>>>0,t||w(r,2,this.length);let i=this[r+1]|this[r]<<8;return i&32768?i|4294901760:i};c.prototype.readInt32LE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};c.prototype.readInt32BE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};c.prototype.readBigInt64LE=I(function(r){r=r>>>0,_(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&L(r,this.length-8);let n=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(i<<24);return(BigInt(n)<>>0,_(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&L(r,this.length-8);let n=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(n)<>>0,t||w(r,4,this.length),C.read(this,r,!0,23,4)};c.prototype.readFloatBE=function(r,t){return r=r>>>0,t||w(r,4,this.length),C.read(this,r,!1,23,4)};c.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||w(r,8,this.length),C.read(this,r,!0,52,8)};c.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||w(r,8,this.length),C.read(this,r,!1,52,8)};function x(e,r,t,i,n,o){if(!c.isBuffer(e))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(r>n||re.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(r,t,i,n){if(r=+r,t=t>>>0,i=i>>>0,!n){let h=Math.pow(2,8*i)-1;x(this,r,t,i,h,0)}let o=1,u=0;for(this[t]=r&255;++u>>0,i=i>>>0,!n){let h=Math.pow(2,8*i)-1;x(this,r,t,i,h,0)}let o=i-1,u=1;for(this[t+o]=r&255;--o>=0&&(u*=256);)this[t+o]=r/u&255;return t+i};c.prototype.writeUint8=c.prototype.writeUInt8=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,1,255,0),this[t]=r&255,t+1};c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function hr(e,r,t,i,n){lr(r,i,n,e,t,7);let o=Number(r&BigInt(4294967295));e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,t}function fr(e,r,t,i,n){lr(r,i,n,e,t,7);let o=Number(r&BigInt(4294967295));e[t+7]=o,o=o>>8,e[t+6]=o,o=o>>8,e[t+5]=o,o=o>>8,e[t+4]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=u,u=u>>8,e[t+2]=u,u=u>>8,e[t+1]=u,u=u>>8,e[t]=u,t+8}c.prototype.writeBigUInt64LE=I(function(r,t=0){return hr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});c.prototype.writeBigUInt64BE=I(function(r,t=0){return fr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});c.prototype.writeIntLE=function(r,t,i,n){if(r=+r,t=t>>>0,!n){let f=Math.pow(2,8*i-1);x(this,r,t,i,f-1,-f)}let o=0,u=1,h=0;for(this[t]=r&255;++o>0)-h&255;return t+i};c.prototype.writeIntBE=function(r,t,i,n){if(r=+r,t=t>>>0,!n){let f=Math.pow(2,8*i-1);x(this,r,t,i,f-1,-f)}let o=i-1,u=1,h=0;for(this[t+o]=r&255;--o>=0&&(u*=256);)r<0&&h===0&&this[t+o+1]!==0&&(h=1),this[t+o]=(r/u>>0)-h&255;return t+i};c.prototype.writeInt8=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};c.prototype.writeInt16LE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};c.prototype.writeInt16BE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};c.prototype.writeInt32LE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};c.prototype.writeInt32BE=function(r,t,i){return r=+r,t=t>>>0,i||x(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};c.prototype.writeBigInt64LE=I(function(r,t=0){return hr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});c.prototype.writeBigInt64BE=I(function(r,t=0){return fr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function pr(e,r,t,i,n,o){if(t+i>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function sr(e,r,t,i,n){return r=+r,t=t>>>0,n||pr(e,r,t,4,34028234663852886e22,-34028234663852886e22),C.write(e,r,t,i,23,4),t+4}c.prototype.writeFloatLE=function(r,t,i){return sr(this,r,t,!0,i)};c.prototype.writeFloatBE=function(r,t,i){return sr(this,r,t,!1,i)};function ar(e,r,t,i,n){return r=+r,t=t>>>0,n||pr(e,r,t,8,17976931348623157e292,-17976931348623157e292),C.write(e,r,t,i,52,8),t+8}c.prototype.writeDoubleLE=function(r,t,i){return ar(this,r,t,!0,i)};c.prototype.writeDoubleBE=function(r,t,i){return ar(this,r,t,!1,i)};c.prototype.copy=function(r,t,i,n){if(!c.isBuffer(r))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=r.length&&(t=r.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),r.length-t>>0,i=i===void 0?this.length:i>>>0,r||(r=0);let o;if(typeof r=="number")for(o=t;o2**32?n=er(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=er(n)),n+="n"),i+=` It must be ${r}. Received ${n}`,i},RangeError);function er(e){let r="",t=e.length,i=e[0]==="-"?1:0;for(;t>=i+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return`${e.slice(0,t)}${r}`}function ut(e,r,t){_(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&L(r,e.length-(t+1))}function lr(e,r,t,i,n,o){if(e>t||e3?r===0||r===BigInt(0)?h=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`:h=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`:h=`>= ${r}${u} and <= ${t}${u}`,new T.ERR_OUT_OF_RANGE("value",h,e)}ut(i,n,o)}function _(e,r){if(typeof e!="number")throw new T.ERR_INVALID_ARG_TYPE(r,"number",e)}function L(e,r,t){throw Math.floor(e)!==e?(_(e,t),new T.ERR_OUT_OF_RANGE(t||"offset","an integer",e)):r<0?new T.ERR_BUFFER_OUT_OF_BOUNDS:new T.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${r}`,e)}var ct=/[^+/0-9A-Za-z-_]/g;function ht(e){if(e=e.split("=")[0],e=e.trim().replace(ct,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function W(e,r){r=r||1/0;let t,i=e.length,n=null,o=[];for(let u=0;u55295&&t<57344){if(!n){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===i){(r-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(r-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function ft(e){let r=[];for(let t=0;t>8,n=t%256,o.push(n),o.push(i);return o}function yr(e){return O.toByteArray(ht(e))}function k(e,r,t,i){let n;for(n=0;n=r.length||n>=e.length);++n)r[n+t]=e[n];return n}function m(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function j(e){return e!==e}var st=function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)r[i+n]=e[t]+e[n]}return r}();function I(e){return typeof BigInt>"u"?at:e}function at(){throw new Error("BigInt not supported")}});var y=P(()=>{"use strict";var xr=l(wr());globalThis.Buffer=xr.Buffer});var Ut,M,Er=R(()=>{"use strict";Ut=l(y()),M=class extends Error{constructor(){super(...arguments);this.name="AbortError"}}});async function Br(e){try{let r=await e(),t=typeof r=="string"?r:JSON.stringify(r);Lit.Actions.setResponse({response:t})}catch(r){if(r instanceof M)return;Lit.Actions.setResponse({response:`Error: ${r.message}`})}}var Ct,dr=R(()=>{"use strict";Ct=l(y());Er()});var St,mr,gr=R(()=>{"use strict";St=l(y()),mr="lit_"});async function Ir({accessControlConditions:e,privateKey:r,publicKey:t}){let{ciphertext:i,dataToEncryptHash:n}=await Lit.Actions.encrypt({accessControlConditions:e,to_encrypt:new TextEncoder().encode(mr+r)});return{ciphertext:i,dataToEncryptHash:n,publicKey:t}}var bt,Fr=R(()=>{"use strict";bt=l(y());gr()});function Ar(){let e=ethers.Wallet.createRandom();return{privateKey:e.privateKey.toString(),publicKey:e.publicKey}}var kt,Ur=R(()=>{"use strict";kt=l(y())});async function Rr({accessControlConditions:e}){let{privateKey:r,publicKey:t}=Ar();return Ir({accessControlConditions:e,privateKey:r,publicKey:t})}var Kt,Tr=R(()=>{"use strict";Kt=l(y());Fr();Ur()});var lt=P(()=>{var Yt=l(y());dr();Tr();(async()=>Br(async()=>Rr({accessControlConditions})))()});lt();})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n *)\n*/\n'; + module2.exports = { + code: code9 + }; + } +}); + +// packages/wrapped-keys-lit-actions/src/generated/ethereum/signMessageWithEncryptedEthereumKey.js +var require_signMessageWithEncryptedEthereumKey = __commonJS({ + "packages/wrapped-keys-lit-actions/src/generated/ethereum/signMessageWithEncryptedEthereumKey.js"(exports, module2) { + "use strict"; + init_shim(); + var code9 = '"use strict";(()=>{var Pr=Object.create;var z=Object.defineProperty;var _r=Object.getOwnPropertyDescriptor;var Nr=Object.getOwnPropertyNames;var Lr=Object.getPrototypeOf,kr=Object.prototype.hasOwnProperty;var F=(e,r)=>()=>(e&&(r=e(e=0)),r);var _=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Dr=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Nr(r))!kr.call(e,i)&&i!==t&&z(e,i,{get:()=>r[i],enumerable:!(n=_r(r,i))||n.enumerable});return e};var l=(e,r,t)=>(t=e!=null?Pr(Lr(e)):{},Dr(r||!e||!e.__esModule?z(t,"default",{value:e,enumerable:!0}):t,e));var v=_(L=>{"use strict";var Bt=l(y());L.byteLength=br;L.toByteArray=Wr;L.fromByteArray=Gr;var E=[],x=[],$r=typeof Uint8Array<"u"?Uint8Array:Array,K="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(A=0,Z=K.length;A0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var n=t===r?0:4-t%4;return[t,n]}function br(e){var r=Q(e),t=r[0],n=r[1];return(t+n)*3/4-n}function Kr(e,r,t){return(r+t)*3/4-t}function Wr(e){var r,t=Q(e),n=t[0],i=t[1],o=new $r(Kr(e,n,i)),u=0,c=i>0?n-4:n,h;for(h=0;h>16&255,o[u++]=r>>8&255,o[u++]=r&255;return i===2&&(r=x[e.charCodeAt(h)]<<2|x[e.charCodeAt(h+1)]>>4,o[u++]=r&255),i===1&&(r=x[e.charCodeAt(h)]<<10|x[e.charCodeAt(h+1)]<<4|x[e.charCodeAt(h+2)]>>2,o[u++]=r>>8&255,o[u++]=r&255),o}function Or(e){return E[e>>18&63]+E[e>>12&63]+E[e>>6&63]+E[e&63]}function Hr(e,r,t){for(var n,i=[],o=r;oc?c:u+o));return n===1?(r=e[t-1],i.push(E[r>>2]+E[r<<4&63]+"==")):n===2&&(r=(e[t-2]<<8)+e[t-1],i.push(E[r>>10]+E[r>>4&63]+E[r<<2&63]+"=")),i.join("")}});var rr=_(W=>{var Ft=l(y());W.read=function(e,r,t,n,i){var o,u,c=i*8-n-1,h=(1<>1,a=-7,f=t?i-1:0,T=t?-1:1,d=e[r+f];for(f+=T,o=d&(1<<-a)-1,d>>=-a,a+=c;a>0;o=o*256+e[r+f],f+=T,a-=8);for(u=o&(1<<-a)-1,o>>=-a,a+=n;a>0;u=u*256+e[r+f],f+=T,a-=8);if(o===0)o=1-p;else{if(o===h)return u?NaN:(d?-1:1)*(1/0);u=u+Math.pow(2,n),o=o-p}return(d?-1:1)*u*Math.pow(2,o-n)};W.write=function(e,r,t,n,i,o){var u,c,h,p=o*8-i-1,a=(1<>1,T=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,b=n?1:-1,Mr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,u=a):(u=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-u))<1&&(u--,h*=2),u+f>=1?r+=T/h:r+=T*Math.pow(2,1-f),r*h>=2&&(u++,h/=2),u+f>=a?(c=0,u=a):u+f>=1?(c=(r*h-1)*Math.pow(2,i),u=u+f):(c=r*Math.pow(2,f-1)*Math.pow(2,i),u=0));i>=8;e[t+d]=c&255,d+=b,c/=256,i-=8);for(u=u<0;e[t+d]=u&255,d+=b,u/=256,p-=8);e[t+d-b]|=Mr*128}});var xr=_(M=>{"use strict";var Tt=l(y());var O=v(),C=rr(),tr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;M.Buffer=s;M.SlowBuffer=Jr;M.INSPECT_MAX_BYTES=50;var k=2147483647;M.kMaxLength=k;s.TYPED_ARRAY_SUPPORT=Yr();!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Yr(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function B(e){if(e>k)throw new RangeError(\'The value "\'+e+\'" is invalid for option "size"\');let r=new Uint8Array(e);return Object.setPrototypeOf(r,s.prototype),r}function s(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return q(e)}return or(e,r,t)}s.poolSize=8192;function or(e,r,t){if(typeof e=="string")return Vr(e,r);if(ArrayBuffer.isView(e))return Xr(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(m(e,ArrayBuffer)||e&&m(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(m(e,SharedArrayBuffer)||e&&m(e.buffer,SharedArrayBuffer)))return G(e,r,t);if(typeof e=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return s.from(n,r,t);let i=jr(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return s.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}s.from=function(e,r,t){return or(e,r,t)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function ur(e){if(typeof e!="number")throw new TypeError(\'"size" argument must be of type number\');if(e<0)throw new RangeError(\'The value "\'+e+\'" is invalid for option "size"\')}function qr(e,r,t){return ur(e),e<=0?B(e):r!==void 0?typeof t=="string"?B(e).fill(r,t):B(e).fill(r):B(e)}s.alloc=function(e,r,t){return qr(e,r,t)};function q(e){return ur(e),B(e<0?0:V(e)|0)}s.allocUnsafe=function(e){return q(e)};s.allocUnsafeSlow=function(e){return q(e)};function Vr(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=sr(e,r)|0,n=B(t),i=n.write(e,r);return i!==t&&(n=n.slice(0,i)),n}function H(e){let r=e.length<0?0:V(e.length)|0,t=B(r);for(let n=0;n=k)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+k.toString(16)+" bytes");return e|0}function Jr(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==s.prototype};s.compare=function(r,t){if(m(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),m(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(r)||!s.isBuffer(t))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(r===t)return 0;let n=r.length,i=t.length;for(let o=0,u=Math.min(n,i);oi.length?(s.isBuffer(u)||(u=s.from(u)),u.copy(i,o)):Uint8Array.prototype.set.call(i,u,o);else if(s.isBuffer(u))u.copy(i,o);else throw new TypeError(\'"list" argument must be an Array of Buffers\');o+=u.length}return i};function sr(e,r){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||m(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof e);let t=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return gr(e).length;default:if(i)return n?-1:Y(e).length;r=(""+r).toLowerCase(),i=!0}}s.byteLength=sr;function zr(e,r,t){let n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return ut(this,r,t);case"utf8":case"utf-8":return hr(this,r,t);case"ascii":return it(this,r,t);case"latin1":case"binary":return ot(this,r,t);case"base64":return et(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return st(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function U(e,r,t){let n=e[r];e[r]=e[t],e[t]=n}s.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tt&&(r+=" ... "),""};tr&&(s.prototype[tr]=s.prototype.inspect);s.prototype.compare=function(r,t,n,i,o){if(m(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(r))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),t<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;let u=o-i,c=n-t,h=Math.min(u,c),p=this.slice(i,o),a=r.slice(t,n);for(let f=0;f2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,j(t)&&(t=i?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(i)return-1;t=e.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof r=="string"&&(r=s.from(r,n)),s.isBuffer(r))return r.length===0?-1:er(e,r,t,n,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):er(e,[r],t,n,i);throw new TypeError("val must be string, number or Buffer")}function er(e,r,t,n,i){let o=1,u=e.length,c=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||r.length<2)return-1;o=2,u/=2,c/=2,t/=2}function h(a,f){return o===1?a[f]:a.readUInt16BE(f*o)}let p;if(i){let a=-1;for(p=t;pu&&(t=u-c),p=t;p>=0;p--){let a=!0;for(let f=0;fi&&(n=i)):n=i;let o=r.length;n>o/2&&(n=o/2);let u;for(u=0;u>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let u=!1;for(;;)switch(i){case"hex":return Zr(this,r,t,n);case"utf8":case"utf-8":return Qr(this,r,t,n);case"ascii":case"latin1":case"binary":return vr(this,r,t,n);case"base64":return rt(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tt(this,r,t,n);default:if(u)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),u=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function et(e,r,t){return r===0&&t===e.length?O.fromByteArray(e):O.fromByteArray(e.slice(r,t))}function hr(e,r,t){t=Math.min(e.length,t);let n=[],i=r;for(;i239?4:o>223?3:o>191?2:1;if(i+c<=t){let h,p,a,f;switch(c){case 1:o<128&&(u=o);break;case 2:h=e[i+1],(h&192)===128&&(f=(o&31)<<6|h&63,f>127&&(u=f));break;case 3:h=e[i+1],p=e[i+2],(h&192)===128&&(p&192)===128&&(f=(o&15)<<12|(h&63)<<6|p&63,f>2047&&(f<55296||f>57343)&&(u=f));break;case 4:h=e[i+1],p=e[i+2],a=e[i+3],(h&192)===128&&(p&192)===128&&(a&192)===128&&(f=(o&15)<<18|(h&63)<<12|(p&63)<<6|a&63,f>65535&&f<1114112&&(u=f))}}u===null?(u=65533,c=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u),i+=c}return nt(n)}var nr=4096;function nt(e){let r=e.length;if(r<=nr)return String.fromCharCode.apply(String,e);let t="",n=0;for(;nn)&&(t=n);let i="";for(let o=r;on&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),tt)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||w(r,t,this.length);let i=this[r],o=1,u=0;for(;++u>>0,t=t>>>0,n||w(r,t,this.length);let i=this[r+--t],o=1;for(;t>0&&(o*=256);)i+=this[r+--t]*o;return i};s.prototype.readUint8=s.prototype.readUInt8=function(r,t){return r=r>>>0,t||w(r,1,this.length),this[r]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||w(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||w(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||w(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};s.prototype.readBigUInt64LE=I(function(r){r=r>>>0,R(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&N(r,this.length-8);let i=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,o=this[++r]+this[++r]*2**8+this[++r]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<>>0,R(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&N(r,this.length-8);let i=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],o=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n;return(BigInt(i)<>>0,t=t>>>0,n||w(r,t,this.length);let i=this[r],o=1,u=0;for(;++u=o&&(i-=Math.pow(2,8*t)),i};s.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||w(r,t,this.length);let i=t,o=1,u=this[r+--i];for(;i>0&&(o*=256);)u+=this[r+--i]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*t)),u};s.prototype.readInt8=function(r,t){return r=r>>>0,t||w(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,t){r=r>>>0,t||w(r,2,this.length);let n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(r,t){r=r>>>0,t||w(r,2,this.length);let n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};s.prototype.readInt32BE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};s.prototype.readBigInt64LE=I(function(r){r=r>>>0,R(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&N(r,this.length-8);let i=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(n<<24);return(BigInt(i)<>>0,R(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&N(r,this.length-8);let i=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(i)<>>0,t||w(r,4,this.length),C.read(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,t){return r=r>>>0,t||w(r,4,this.length),C.read(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||w(r,8,this.length),C.read(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||w(r,8,this.length),C.read(this,r,!1,52,8)};function g(e,r,t,n,i,o){if(!s.isBuffer(e))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(r>i||re.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;g(this,r,t,n,c,0)}let o=1,u=0;for(this[t]=r&255;++u>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;g(this,r,t,n,c,0)}let o=n-1,u=1;for(this[t+o]=r&255;--o>=0&&(u*=256);)this[t+o]=r/u&255;return t+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||g(this,r,t,1,255,0),this[t]=r&255,t+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||g(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||g(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||g(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||g(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function fr(e,r,t,n,i){wr(r,n,i,e,t,7);let o=Number(r&BigInt(4294967295));e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,t}function ar(e,r,t,n,i){wr(r,n,i,e,t,7);let o=Number(r&BigInt(4294967295));e[t+7]=o,o=o>>8,e[t+6]=o,o=o>>8,e[t+5]=o,o=o>>8,e[t+4]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=u,u=u>>8,e[t+2]=u,u=u>>8,e[t+1]=u,u=u>>8,e[t]=u,t+8}s.prototype.writeBigUInt64LE=I(function(r,t=0){return fr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeBigUInt64BE=I(function(r,t=0){return ar(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let h=Math.pow(2,8*n-1);g(this,r,t,n,h-1,-h)}let o=0,u=1,c=0;for(this[t]=r&255;++o>0)-c&255;return t+n};s.prototype.writeIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let h=Math.pow(2,8*n-1);g(this,r,t,n,h-1,-h)}let o=n-1,u=1,c=0;for(this[t+o]=r&255;--o>=0&&(u*=256);)r<0&&c===0&&this[t+o+1]!==0&&(c=1),this[t+o]=(r/u>>0)-c&255;return t+n};s.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||g(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};s.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||g(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};s.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||g(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};s.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||g(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};s.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||g(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};s.prototype.writeBigInt64LE=I(function(r,t=0){return fr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});s.prototype.writeBigInt64BE=I(function(r,t=0){return ar(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function pr(e,r,t,n,i,o){if(t+n>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function lr(e,r,t,n,i){return r=+r,t=t>>>0,i||pr(e,r,t,4,34028234663852886e22,-34028234663852886e22),C.write(e,r,t,n,23,4),t+4}s.prototype.writeFloatLE=function(r,t,n){return lr(this,r,t,!0,n)};s.prototype.writeFloatBE=function(r,t,n){return lr(this,r,t,!1,n)};function yr(e,r,t,n,i){return r=+r,t=t>>>0,i||pr(e,r,t,8,17976931348623157e292,-17976931348623157e292),C.write(e,r,t,n,52,8),t+8}s.prototype.writeDoubleLE=function(r,t,n){return yr(this,r,t,!0,n)};s.prototype.writeDoubleBE=function(r,t,n){return yr(this,r,t,!1,n)};s.prototype.copy=function(r,t,n,i){if(!s.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=r.length&&(t=r.length),t||(t=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-t>>0,n=n===void 0?this.length:n>>>0,r||(r=0);let o;if(typeof r=="number")for(o=t;o2**32?i=ir(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=ir(i)),i+="n"),n+=` It must be ${r}. Received ${i}`,n},RangeError);function ir(e){let r="",t=e.length,n=e[0]==="-"?1:0;for(;t>=n+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return`${e.slice(0,t)}${r}`}function ct(e,r,t){R(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&N(r,e.length-(t+1))}function wr(e,r,t,n,i,o){if(e>t||e3?r===0||r===BigInt(0)?c=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`:c=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`:c=`>= ${r}${u} and <= ${t}${u}`,new S.ERR_OUT_OF_RANGE("value",c,e)}ct(n,i,o)}function R(e,r){if(typeof e!="number")throw new S.ERR_INVALID_ARG_TYPE(r,"number",e)}function N(e,r,t){throw Math.floor(e)!==e?(R(e,t),new S.ERR_OUT_OF_RANGE(t||"offset","an integer",e)):r<0?new S.ERR_BUFFER_OUT_OF_BOUNDS:new S.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${r}`,e)}var ht=/[^+/0-9A-Za-z-_]/g;function ft(e){if(e=e.split("=")[0],e=e.trim().replace(ht,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function Y(e,r){r=r||1/0;let t,n=e.length,i=null,o=[];for(let u=0;u55295&&t<57344){if(!i){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function at(e){let r=[];for(let t=0;t>8,i=t%256,o.push(i),o.push(n);return o}function gr(e){return O.toByteArray(ft(e))}function D(e,r,t,n){let i;for(i=0;i=r.length||i>=e.length);++i)r[i+t]=e[i];return i}function m(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function j(e){return e!==e}var lt=function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)r[n+i]=e[t]+e[i]}return r}();function I(e){return typeof BigInt>"u"?yt:e}function yt(){throw new Error("BigInt not supported")}});var y=_(()=>{"use strict";var dr=l(xr());globalThis.Buffer=dr.Buffer});var Mt,P,J=F(()=>{"use strict";Mt=l(y()),P=class extends Error{constructor(){super(...arguments);this.name="AbortError"}}});async function Er(e){try{let r=await e(),t=typeof r=="string"?r:JSON.stringify(r);Lit.Actions.setResponse({response:t})}catch(r){if(r instanceof P)return;Lit.Actions.setResponse({response:`Error: ${r.message}`})}}var Nt,mr=F(()=>{"use strict";Nt=l(y());J()});var kt,$,Br=F(()=>{"use strict";kt=l(y()),$="lit_"});function Ir(e){if(!e.startsWith($))throw new Error(`PKey was not encrypted with salt; all wrapped keys must be prefixed with \'${$}\'`);return e.slice($.length)}var bt,Fr=F(()=>{"use strict";bt=l(y());Br()});async function wt({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t}){try{return await Lit.Actions.decryptToSingleNode({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t,chain:"ethereum",authSig:null})}catch(n){throw new Error(`When decrypting key to a single node - ${n.message}`)}}async function Ar({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t}){let n=await wt({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t});if(!n)throw new P;return Ir(n)}var Ht,Ur=F(()=>{"use strict";Ht=l(y());J();Fr()});async function gt({privateKey:e,messageToSign:r}){try{let t=new ethers.Wallet(e);return{signature:await t.signMessage(r),walletAddress:t.address}}catch(t){throw t instanceof Error?new Error(`When signing message - ${t.message}`):new Error(`An unexpected error occurred: ${t}`)}}function xt({messageToSign:e,signature:r}){try{return ethers.utils.verifyMessage(e,r)}catch(t){throw new Error(`When validating signed Ethereum message is valid: ${t.message}`)}}async function Tr({privateKey:e,messageToSign:r}){let{signature:t,walletAddress:n}=await gt({privateKey:e,messageToSign:r});if(xt({messageToSign:r,signature:t})!==n)throw new Error("Recovered address from verifyMessage doesn\'t match the wallet address");return t}var Yt,Sr=F(()=>{"use strict";Yt=l(y())});async function Cr({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t,messageToSign:n}){let i=await Ar({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t});return Tr({privateKey:i,messageToSign:n})}var jt,Rr=F(()=>{"use strict";jt=l(y());Ur();Sr()});var dt=_(()=>{var vt=l(y());mr();Rr();(async()=>Er(async()=>Cr({accessControlConditions,ciphertext,dataToEncryptHash,messageToSign})))()});dt();})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n *)\n*/\n'; + module2.exports = { + code: code9 + }; + } +}); + +// packages/wrapped-keys-lit-actions/src/generated/ethereum/signTransactionWithEncryptedEthereumKey.js +var require_signTransactionWithEncryptedEthereumKey = __commonJS({ + "packages/wrapped-keys-lit-actions/src/generated/ethereum/signTransactionWithEncryptedEthereumKey.js"(exports, module2) { + "use strict"; + init_shim(); + var code9 = '"use strict";(()=>{var _r=Object.create;var z=Object.defineProperty;var br=Object.getOwnPropertyDescriptor;var Nr=Object.getOwnPropertyNames;var kr=Object.getPrototypeOf,Dr=Object.prototype.hasOwnProperty;var F=(e,r)=>()=>(e&&(r=e(e=0)),r);var _=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var $r=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Nr(r))!Dr.call(e,i)&&i!==t&&z(e,i,{get:()=>r[i],enumerable:!(n=br(r,i))||n.enumerable});return e};var l=(e,r,t)=>(t=e!=null?_r(kr(e)):{},$r(r||!e||!e.__esModule?z(t,"default",{value:e,enumerable:!0}):t,e));var v=_(N=>{"use strict";var Tt=l(y());N.byteLength=Wr;N.toByteArray=Gr;N.fromByteArray=qr;var E=[],g=[],Mr=typeof Uint8Array<"u"?Uint8Array:Array,W="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(A=0,Z=W.length;A0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var n=t===r?0:4-t%4;return[t,n]}function Wr(e){var r=Q(e),t=r[0],n=r[1];return(t+n)*3/4-n}function Kr(e,r,t){return(r+t)*3/4-t}function Gr(e){var r,t=Q(e),n=t[0],i=t[1],o=new Mr(Kr(e,n,i)),c=0,u=i>0?n-4:n,a;for(a=0;a>16&255,o[c++]=r>>8&255,o[c++]=r&255;return i===2&&(r=g[e.charCodeAt(a)]<<2|g[e.charCodeAt(a+1)]>>4,o[c++]=r&255),i===1&&(r=g[e.charCodeAt(a)]<<10|g[e.charCodeAt(a+1)]<<4|g[e.charCodeAt(a+2)]>>2,o[c++]=r>>8&255,o[c++]=r&255),o}function Or(e){return E[e>>18&63]+E[e>>12&63]+E[e>>6&63]+E[e&63]}function Hr(e,r,t){for(var n,i=[],o=r;ou?u:c+o));return n===1?(r=e[t-1],i.push(E[r>>2]+E[r<<4&63]+"==")):n===2&&(r=(e[t-2]<<8)+e[t-1],i.push(E[r>>10]+E[r>>4&63]+E[r<<2&63]+"=")),i.join("")}});var rr=_(K=>{var Ct=l(y());K.read=function(e,r,t,n,i){var o,c,u=i*8-n-1,a=(1<>1,f=-7,h=t?i-1:0,T=t?-1:1,x=e[r+h];for(h+=T,o=x&(1<<-f)-1,x>>=-f,f+=u;f>0;o=o*256+e[r+h],h+=T,f-=8);for(c=o&(1<<-f)-1,o>>=-f,f+=n;f>0;c=c*256+e[r+h],h+=T,f-=8);if(o===0)o=1-p;else{if(o===a)return c?NaN:(x?-1:1)*(1/0);c=c+Math.pow(2,n),o=o-p}return(x?-1:1)*c*Math.pow(2,o-n)};K.write=function(e,r,t,n,i,o){var c,u,a,p=o*8-i-1,f=(1<>1,T=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,M=n?1:-1,Lr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,c=f):(c=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-c))<1&&(c--,a*=2),c+h>=1?r+=T/a:r+=T*Math.pow(2,1-h),r*a>=2&&(c++,a/=2),c+h>=f?(u=0,c=f):c+h>=1?(u=(r*a-1)*Math.pow(2,i),c=c+h):(u=r*Math.pow(2,h-1)*Math.pow(2,i),c=0));i>=8;e[t+x]=u&255,x+=M,u/=256,i-=8);for(c=c<0;e[t+x]=c&255,x+=M,c/=256,p-=8);e[t+x-M]|=Lr*128}});var gr=_(P=>{"use strict";var Lt=l(y());var G=v(),C=rr(),tr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;P.Buffer=s;P.SlowBuffer=zr;P.INSPECT_MAX_BYTES=50;var k=2147483647;P.kMaxLength=k;s.TYPED_ARRAY_SUPPORT=Vr();!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Vr(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function B(e){if(e>k)throw new RangeError(\'The value "\'+e+\'" is invalid for option "size"\');let r=new Uint8Array(e);return Object.setPrototypeOf(r,s.prototype),r}function s(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return V(e)}return or(e,r,t)}s.poolSize=8192;function or(e,r,t){if(typeof e=="string")return Jr(e,r);if(ArrayBuffer.isView(e))return Xr(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(m(e,ArrayBuffer)||e&&m(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(m(e,SharedArrayBuffer)||e&&m(e.buffer,SharedArrayBuffer)))return H(e,r,t);if(typeof e=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return s.from(n,r,t);let i=jr(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return s.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}s.from=function(e,r,t){return or(e,r,t)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function cr(e){if(typeof e!="number")throw new TypeError(\'"size" argument must be of type number\');if(e<0)throw new RangeError(\'The value "\'+e+\'" is invalid for option "size"\')}function Yr(e,r,t){return cr(e),e<=0?B(e):r!==void 0?typeof t=="string"?B(e).fill(r,t):B(e).fill(r):B(e)}s.alloc=function(e,r,t){return Yr(e,r,t)};function V(e){return cr(e),B(e<0?0:Y(e)|0)}s.allocUnsafe=function(e){return V(e)};s.allocUnsafeSlow=function(e){return V(e)};function Jr(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=sr(e,r)|0,n=B(t),i=n.write(e,r);return i!==t&&(n=n.slice(0,i)),n}function O(e){let r=e.length<0?0:Y(e.length)|0,t=B(r);for(let n=0;n=k)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+k.toString(16)+" bytes");return e|0}function zr(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==s.prototype};s.compare=function(r,t){if(m(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),m(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(r)||!s.isBuffer(t))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(r===t)return 0;let n=r.length,i=t.length;for(let o=0,c=Math.min(n,i);oi.length?(s.isBuffer(c)||(c=s.from(c)),c.copy(i,o)):Uint8Array.prototype.set.call(i,c,o);else if(s.isBuffer(c))c.copy(i,o);else throw new TypeError(\'"list" argument must be an Array of Buffers\');o+=c.length}return i};function sr(e,r){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||m(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof e);let t=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return dr(e).length;default:if(i)return n?-1:q(e).length;r=(""+r).toLowerCase(),i=!0}}s.byteLength=sr;function Zr(e,r,t){let n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return st(this,r,t);case"utf8":case"utf-8":return ar(this,r,t);case"ascii":return ot(this,r,t);case"latin1":case"binary":return ct(this,r,t);case"base64":return nt(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function U(e,r,t){let n=e[r];e[r]=e[t],e[t]=n}s.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tt&&(r+=" ... "),""};tr&&(s.prototype[tr]=s.prototype.inspect);s.prototype.compare=function(r,t,n,i,o){if(m(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(r))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),t<0||n>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;let c=o-i,u=n-t,a=Math.min(c,u),p=this.slice(i,o),f=r.slice(t,n);for(let h=0;h2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,X(t)&&(t=i?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(i)return-1;t=e.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof r=="string"&&(r=s.from(r,n)),s.isBuffer(r))return r.length===0?-1:er(e,r,t,n,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):er(e,[r],t,n,i);throw new TypeError("val must be string, number or Buffer")}function er(e,r,t,n,i){let o=1,c=e.length,u=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||r.length<2)return-1;o=2,c/=2,u/=2,t/=2}function a(f,h){return o===1?f[h]:f.readUInt16BE(h*o)}let p;if(i){let f=-1;for(p=t;pc&&(t=c-u),p=t;p>=0;p--){let f=!0;for(let h=0;hi&&(n=i)):n=i;let o=r.length;n>o/2&&(n=o/2);let c;for(c=0;c>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((n===void 0||n>o)&&(n=o),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let c=!1;for(;;)switch(i){case"hex":return Qr(this,r,t,n);case"utf8":case"utf-8":return vr(this,r,t,n);case"ascii":case"latin1":case"binary":return rt(this,r,t,n);case"base64":return tt(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return et(this,r,t,n);default:if(c)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),c=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function nt(e,r,t){return r===0&&t===e.length?G.fromByteArray(e):G.fromByteArray(e.slice(r,t))}function ar(e,r,t){t=Math.min(e.length,t);let n=[],i=r;for(;i239?4:o>223?3:o>191?2:1;if(i+u<=t){let a,p,f,h;switch(u){case 1:o<128&&(c=o);break;case 2:a=e[i+1],(a&192)===128&&(h=(o&31)<<6|a&63,h>127&&(c=h));break;case 3:a=e[i+1],p=e[i+2],(a&192)===128&&(p&192)===128&&(h=(o&15)<<12|(a&63)<<6|p&63,h>2047&&(h<55296||h>57343)&&(c=h));break;case 4:a=e[i+1],p=e[i+2],f=e[i+3],(a&192)===128&&(p&192)===128&&(f&192)===128&&(h=(o&15)<<18|(a&63)<<12|(p&63)<<6|f&63,h>65535&&h<1114112&&(c=h))}}c===null?(c=65533,u=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|c&1023),n.push(c),i+=u}return it(n)}var nr=4096;function it(e){let r=e.length;if(r<=nr)return String.fromCharCode.apply(String,e);let t="",n=0;for(;nn)&&(t=n);let i="";for(let o=r;on&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),tt)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||w(r,t,this.length);let i=this[r],o=1,c=0;for(;++c>>0,t=t>>>0,n||w(r,t,this.length);let i=this[r+--t],o=1;for(;t>0&&(o*=256);)i+=this[r+--t]*o;return i};s.prototype.readUint8=s.prototype.readUInt8=function(r,t){return r=r>>>0,t||w(r,1,this.length),this[r]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||w(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||w(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||w(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};s.prototype.readBigUInt64LE=I(function(r){r=r>>>0,S(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&b(r,this.length-8);let i=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,o=this[++r]+this[++r]*2**8+this[++r]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<>>0,S(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&b(r,this.length-8);let i=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],o=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n;return(BigInt(i)<>>0,t=t>>>0,n||w(r,t,this.length);let i=this[r],o=1,c=0;for(;++c=o&&(i-=Math.pow(2,8*t)),i};s.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||w(r,t,this.length);let i=t,o=1,c=this[r+--i];for(;i>0&&(o*=256);)c+=this[r+--i]*o;return o*=128,c>=o&&(c-=Math.pow(2,8*t)),c};s.prototype.readInt8=function(r,t){return r=r>>>0,t||w(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,t){r=r>>>0,t||w(r,2,this.length);let n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(r,t){r=r>>>0,t||w(r,2,this.length);let n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};s.prototype.readInt32BE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};s.prototype.readBigInt64LE=I(function(r){r=r>>>0,S(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&b(r,this.length-8);let i=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(n<<24);return(BigInt(i)<>>0,S(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&b(r,this.length-8);let i=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(i)<>>0,t||w(r,4,this.length),C.read(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,t){return r=r>>>0,t||w(r,4,this.length),C.read(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||w(r,8,this.length),C.read(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||w(r,8,this.length),C.read(this,r,!1,52,8)};function d(e,r,t,n,i,o){if(!s.isBuffer(e))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(r>i||re.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;d(this,r,t,n,u,0)}let o=1,c=0;for(this[t]=r&255;++c>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;d(this,r,t,n,u,0)}let o=n-1,c=1;for(this[t+o]=r&255;--o>=0&&(c*=256);)this[t+o]=r/c&255;return t+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||d(this,r,t,1,255,0),this[t]=r&255,t+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||d(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||d(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||d(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||d(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function hr(e,r,t,n,i){wr(r,n,i,e,t,7);let o=Number(r&BigInt(4294967295));e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o;let c=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=c,c=c>>8,e[t++]=c,c=c>>8,e[t++]=c,c=c>>8,e[t++]=c,t}function fr(e,r,t,n,i){wr(r,n,i,e,t,7);let o=Number(r&BigInt(4294967295));e[t+7]=o,o=o>>8,e[t+6]=o,o=o>>8,e[t+5]=o,o=o>>8,e[t+4]=o;let c=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=c,c=c>>8,e[t+2]=c,c=c>>8,e[t+1]=c,c=c>>8,e[t]=c,t+8}s.prototype.writeBigUInt64LE=I(function(r,t=0){return hr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeBigUInt64BE=I(function(r,t=0){return fr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let a=Math.pow(2,8*n-1);d(this,r,t,n,a-1,-a)}let o=0,c=1,u=0;for(this[t]=r&255;++o>0)-u&255;return t+n};s.prototype.writeIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let a=Math.pow(2,8*n-1);d(this,r,t,n,a-1,-a)}let o=n-1,c=1,u=0;for(this[t+o]=r&255;--o>=0&&(c*=256);)r<0&&u===0&&this[t+o+1]!==0&&(u=1),this[t+o]=(r/c>>0)-u&255;return t+n};s.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||d(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};s.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||d(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};s.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||d(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};s.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||d(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};s.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||d(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};s.prototype.writeBigInt64LE=I(function(r,t=0){return hr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});s.prototype.writeBigInt64BE=I(function(r,t=0){return fr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function pr(e,r,t,n,i,o){if(t+n>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function lr(e,r,t,n,i){return r=+r,t=t>>>0,i||pr(e,r,t,4,34028234663852886e22,-34028234663852886e22),C.write(e,r,t,n,23,4),t+4}s.prototype.writeFloatLE=function(r,t,n){return lr(this,r,t,!0,n)};s.prototype.writeFloatBE=function(r,t,n){return lr(this,r,t,!1,n)};function yr(e,r,t,n,i){return r=+r,t=t>>>0,i||pr(e,r,t,8,17976931348623157e292,-17976931348623157e292),C.write(e,r,t,n,52,8),t+8}s.prototype.writeDoubleLE=function(r,t,n){return yr(this,r,t,!0,n)};s.prototype.writeDoubleBE=function(r,t,n){return yr(this,r,t,!1,n)};s.prototype.copy=function(r,t,n,i){if(!s.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=r.length&&(t=r.length),t||(t=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-t>>0,n=n===void 0?this.length:n>>>0,r||(r=0);let o;if(typeof r=="number")for(o=t;o2**32?i=ir(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=ir(i)),i+="n"),n+=` It must be ${r}. Received ${i}`,n},RangeError);function ir(e){let r="",t=e.length,n=e[0]==="-"?1:0;for(;t>=n+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return`${e.slice(0,t)}${r}`}function at(e,r,t){S(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&b(r,e.length-(t+1))}function wr(e,r,t,n,i,o){if(e>t||e3?r===0||r===BigInt(0)?u=`>= 0${c} and < 2${c} ** ${(o+1)*8}${c}`:u=`>= -(2${c} ** ${(o+1)*8-1}${c}) and < 2 ** ${(o+1)*8-1}${c}`:u=`>= ${r}${c} and <= ${t}${c}`,new R.ERR_OUT_OF_RANGE("value",u,e)}at(n,i,o)}function S(e,r){if(typeof e!="number")throw new R.ERR_INVALID_ARG_TYPE(r,"number",e)}function b(e,r,t){throw Math.floor(e)!==e?(S(e,t),new R.ERR_OUT_OF_RANGE(t||"offset","an integer",e)):r<0?new R.ERR_BUFFER_OUT_OF_BOUNDS:new R.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${r}`,e)}var ht=/[^+/0-9A-Za-z-_]/g;function ft(e){if(e=e.split("=")[0],e=e.trim().replace(ht,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function q(e,r){r=r||1/0;let t,n=e.length,i=null,o=[];for(let c=0;c55295&&t<57344){if(!i){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(c+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function pt(e){let r=[];for(let t=0;t>8,i=t%256,o.push(i),o.push(n);return o}function dr(e){return G.toByteArray(ft(e))}function D(e,r,t,n){let i;for(i=0;i=r.length||i>=e.length);++i)r[i+t]=e[i];return i}function m(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function X(e){return e!==e}var yt=function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)r[n+i]=e[t]+e[i]}return r}();function I(e){return typeof BigInt>"u"?wt:e}function wt(){throw new Error("BigInt not supported")}});var y=_(()=>{"use strict";var xr=l(gr());globalThis.Buffer=xr.Buffer});var kt,L,j=F(()=>{"use strict";kt=l(y()),L=class extends Error{constructor(){super(...arguments);this.name="AbortError"}}});async function Er(e){try{let r=await e(),t=typeof r=="string"?r:JSON.stringify(r);Lit.Actions.setResponse({response:t})}catch(r){if(r instanceof L)return;Lit.Actions.setResponse({response:`Error: ${r.message}`})}}var Mt,mr=F(()=>{"use strict";Mt=l(y());j()});var Kt,$,Br=F(()=>{"use strict";Kt=l(y()),$="lit_"});function Ir(e){if(!e.startsWith($))throw new Error(`PKey was not encrypted with salt; all wrapped keys must be prefixed with \'${$}\'`);return e.slice($.length)}var Ht,Fr=F(()=>{"use strict";Ht=l(y());Br()});async function dt({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t}){try{return await Lit.Actions.decryptToSingleNode({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t,chain:"ethereum",authSig:null})}catch(n){throw new Error(`When decrypting key to a single node - ${n.message}`)}}async function Ar({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t}){let n=await dt({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t});if(!n)throw new L;return Ir(n)}var Jt,Ur=F(()=>{"use strict";Jt=l(y());j();Fr()});function Tr(e){try{if(!e.toAddress)throw new Error("Missing required field: toAddress");if(!e.chain)throw new Error("Missing required field: chain");if(!e.value)throw new Error("Missing required field: value");if(!e.chainId)throw new Error("Missing required field: chainId");return{to:e.toAddress,value:ethers.utils.hexlify(ethers.utils.parseEther(e.value)),chainId:e.chainId,data:e.dataHex}}catch(r){throw new Error(`Invalid unsignedTransaction - ${r.message}`)}}async function gt({walletAddress:e,chain:r}){try{return await Lit.Actions.getLatestNonce({address:e,chain:r})}catch(t){throw new Error(`Unable to get latest nonce - ${t.message}`)}}async function xt({chain:e}){try{let r=await Lit.Actions.getRpcUrl({chain:e});return new ethers.providers.JsonRpcProvider(r)}catch(r){throw new Error(`Getting the rpc for the chain: ${e} - ${r.message}`)}}async function Et({userProvidedGasPrice:e,provider:r}){try{return e?ethers.utils.parseUnits(e,"gwei"):await r.getGasPrice()}catch(t){throw new Error(`When getting gas price - ${t.message}`)}}async function mt({provider:e,userProvidedGasLimit:r,validatedTx:t}){if(r)return r;try{return await e.estimateGas(t)}catch(n){throw new Error(`When estimating gas - ${n.message}`)}}async function Bt({validatedTx:e,wallet:r}){try{return await r.signTransaction(e)}catch(t){throw new Error(`When signing transaction - ${t.message}`)}}async function It({provider:e,signedTx:r}){try{return await e.sendTransaction(r)}catch(t){throw new Error(`When sending transaction - ${t.message}`)}}async function Rr({broadcast:e,privateKey:r,validatedTx:t,unsignedTransaction:n}){let i=new ethers.Wallet(r);t.from=i.address;let[o,c]=await Promise.all([gt({walletAddress:i.address,chain:n.chain}),xt({chain:n.chain})]);t.nonce=o,t.gasPrice=await Et({provider:c,userProvidedGasPrice:n.gasPrice}),t.gasLimit=await mt({provider:c,validatedTx:t,userProvidedGasLimit:n.gasLimit});let u=await Bt({validatedTx:t,wallet:i});return e?(await It({provider:c,signedTx:u})).hash:u}var jt,Cr=F(()=>{"use strict";jt=l(y())});async function Sr({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t,unsignedTransaction:n,broadcast:i}){let o=Tr(n),c=await Ar({accessControlConditions:e,ciphertext:r,dataToEncryptHash:t});return Rr({broadcast:i,privateKey:c,unsignedTransaction:n,validatedTx:o})}var re,Pr=F(()=>{"use strict";re=l(y());Ur();Cr()});var Ft=_(()=>{var oe=l(y());mr();Pr();(async()=>Er(async()=>Sr({accessControlConditions,ciphertext,dataToEncryptHash,unsignedTransaction,broadcast})))()});Ft();})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n *)\n*/\n'; + module2.exports = { + code: code9 + }; + } +}); + +// packages/wrapped-keys-lit-actions/src/generated/solana/generateEncryptedSolanaPrivateKey.js +var require_generateEncryptedSolanaPrivateKey = __commonJS({ + "packages/wrapped-keys-lit-actions/src/generated/solana/generateEncryptedSolanaPrivateKey.js"(exports, module2) { + "use strict"; + init_shim(); + var code9 = '"use strict";(()=>{var ff=Object.create;var Bi=Object.defineProperty;var hf=Object.getOwnPropertyDescriptor;var lf=Object.getOwnPropertyNames;var df=Object.getPrototypeOf,pf=Object.prototype.hasOwnProperty;var wt=(r,t)=>()=>(r&&(t=r(r=0)),t);var oe=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),la=(r,t)=>{for(var e in t)Bi(r,e,{get:t[e],enumerable:!0})},da=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of lf(t))!pf.call(r,o)&&o!==e&&Bi(r,o,{get:()=>t[o],enumerable:!(i=hf(t,o))||i.enumerable});return r};var P=(r,t,e)=>(e=r!=null?ff(df(r)):{},da(t||!r||!r.__esModule?Bi(e,"default",{value:r,enumerable:!0}):e,r)),pa=r=>da(Bi({},"__esModule",{value:!0}),r);var ma=oe(Ei=>{"use strict";var ad=P(O());Ei.byteLength=gf;Ei.toByteArray=wf;Ei.fromByteArray=xf;var ze=[],Me=[],yf=typeof Uint8Array<"u"?Uint8Array:Array,Po="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Gr=0,ya=Po.length;Gr0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var i=e===t?0:4-e%4;return[e,i]}function gf(r){var t=ga(r),e=t[0],i=t[1];return(e+i)*3/4-i}function mf(r,t,e){return(t+e)*3/4-e}function wf(r){var t,e=ga(r),i=e[0],o=e[1],u=new yf(mf(r,i,o)),h=0,w=o>0?i-4:i,m;for(m=0;m>16&255,u[h++]=t>>8&255,u[h++]=t&255;return o===2&&(t=Me[r.charCodeAt(m)]<<2|Me[r.charCodeAt(m+1)]>>4,u[h++]=t&255),o===1&&(t=Me[r.charCodeAt(m)]<<10|Me[r.charCodeAt(m+1)]<<4|Me[r.charCodeAt(m+2)]>>2,u[h++]=t>>8&255,u[h++]=t&255),u}function bf(r){return ze[r>>18&63]+ze[r>>12&63]+ze[r>>6&63]+ze[r&63]}function vf(r,t,e){for(var i,o=[],u=t;uw?w:h+u));return i===1?(t=r[e-1],o.push(ze[t>>2]+ze[t<<4&63]+"==")):i===2&&(t=(r[e-2]<<8)+r[e-1],o.push(ze[t>>10]+ze[t>>4&63]+ze[t<<2&63]+"=")),o.join("")}});var wa=oe(Co=>{var cd=P(O());Co.read=function(r,t,e,i,o){var u,h,w=o*8-i-1,m=(1<>1,v=-7,k=e?o-1:0,E=e?-1:1,M=r[t+k];for(k+=E,u=M&(1<<-v)-1,M>>=-v,v+=w;v>0;u=u*256+r[t+k],k+=E,v-=8);for(h=u&(1<<-v)-1,u>>=-v,v+=i;v>0;h=h*256+r[t+k],k+=E,v-=8);if(u===0)u=1-x;else{if(u===m)return h?NaN:(M?-1:1)*(1/0);h=h+Math.pow(2,i),u=u-x}return(M?-1:1)*h*Math.pow(2,u-i)};Co.write=function(r,t,e,i,o,u){var h,w,m,x=u*8-o-1,v=(1<>1,E=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=i?0:u-1,$=i?1:-1,R=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(w=isNaN(t)?1:0,h=v):(h=Math.floor(Math.log(t)/Math.LN2),t*(m=Math.pow(2,-h))<1&&(h--,m*=2),h+k>=1?t+=E/m:t+=E*Math.pow(2,1-k),t*m>=2&&(h++,m/=2),h+k>=v?(w=0,h=v):h+k>=1?(w=(t*m-1)*Math.pow(2,o),h=h+k):(w=t*Math.pow(2,k-1)*Math.pow(2,o),h=0));o>=8;r[e+M]=w&255,M+=$,w/=256,o-=8);for(h=h<0;r[e+M]=h&255,M+=$,h/=256,x-=8);r[e+M-$]|=R*128}});var mn=oe(gn=>{"use strict";var ld=P(O());var Oo=ma(),pn=wa(),ba=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;gn.Buffer=C;gn.SlowBuffer=If;gn.INSPECT_MAX_BYTES=50;var _i=2147483647;gn.kMaxLength=_i;C.TYPED_ARRAY_SUPPORT=kf();!C.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function kf(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(C.prototype,"parent",{enumerable:!0,get:function(){if(C.isBuffer(this))return this.buffer}});Object.defineProperty(C.prototype,"offset",{enumerable:!0,get:function(){if(C.isBuffer(this))return this.byteOffset}});function $e(r){if(r>_i)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\');let t=new Uint8Array(r);return Object.setPrototypeOf(t,C.prototype),t}function C(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return qo(r)}return Sa(r,t,e)}C.poolSize=8192;function Sa(r,t,e){if(typeof r=="string")return Bf(r,t);if(ArrayBuffer.isView(r))return Ef(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(qe(r,ArrayBuffer)||r&&qe(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(qe(r,SharedArrayBuffer)||r&&qe(r.buffer,SharedArrayBuffer)))return No(r,t,e);if(typeof r=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return C.from(i,t,e);let o=_f(r);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return C.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}C.from=function(r,t,e){return Sa(r,t,e)};Object.setPrototypeOf(C.prototype,Uint8Array.prototype);Object.setPrototypeOf(C,Uint8Array);function Ba(r){if(typeof r!="number")throw new TypeError(\'"size" argument must be of type number\');if(r<0)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\')}function Sf(r,t,e){return Ba(r),r<=0?$e(r):t!==void 0?typeof e=="string"?$e(r).fill(t,e):$e(r).fill(t):$e(r)}C.alloc=function(r,t,e){return Sf(r,t,e)};function qo(r){return Ba(r),$e(r<0?0:Fo(r)|0)}C.allocUnsafe=function(r){return qo(r)};C.allocUnsafeSlow=function(r){return qo(r)};function Bf(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!C.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=Ea(r,t)|0,i=$e(e),o=i.write(r,t);return o!==e&&(i=i.slice(0,o)),i}function Uo(r){let t=r.length<0?0:Fo(r.length)|0,e=$e(t);for(let i=0;i=_i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_i.toString(16)+" bytes");return r|0}function If(r){return+r!=r&&(r=0),C.alloc(+r)}C.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==C.prototype};C.compare=function(t,e){if(qe(t,Uint8Array)&&(t=C.from(t,t.offset,t.byteLength)),qe(e,Uint8Array)&&(e=C.from(e,e.offset,e.byteLength)),!C.isBuffer(t)||!C.isBuffer(e))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(t===e)return 0;let i=t.length,o=e.length;for(let u=0,h=Math.min(i,o);uo.length?(C.isBuffer(h)||(h=C.from(h)),h.copy(o,u)):Uint8Array.prototype.set.call(o,h,u);else if(C.isBuffer(h))h.copy(o,u);else throw new TypeError(\'"list" argument must be an Array of Buffers\');u+=h.length}return o};function Ea(r,t){if(C.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||qe(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof r);let e=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&e===0)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return zo(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Ca(r).length;default:if(o)return i?-1:zo(r).length;t=(""+t).toLowerCase(),o=!0}}C.byteLength=Ea;function Af(r,t,e){let i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return zf(this,t,e);case"utf8":case"utf-8":return Ia(this,t,e);case"ascii":return Uf(this,t,e);case"latin1":case"binary":return Nf(this,t,e);case"base64":return Cf(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qf(this,t,e);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}C.prototype._isBuffer=!0;function Zr(r,t,e){let i=r[t];r[t]=r[e],r[e]=i}C.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;ee&&(t+=" ... "),""};ba&&(C.prototype[ba]=C.prototype.inspect);C.prototype.compare=function(t,e,i,o,u){if(qe(t,Uint8Array)&&(t=C.from(t,t.offset,t.byteLength)),!C.isBuffer(t))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof t);if(e===void 0&&(e=0),i===void 0&&(i=t?t.length:0),o===void 0&&(o=0),u===void 0&&(u=this.length),e<0||i>t.length||o<0||u>this.length)throw new RangeError("out of range index");if(o>=u&&e>=i)return 0;if(o>=u)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,o>>>=0,u>>>=0,this===t)return 0;let h=u-o,w=i-e,m=Math.min(h,w),x=this.slice(o,u),v=t.slice(e,i);for(let k=0;k2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,Do(e)&&(e=o?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(o)return-1;e=r.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof t=="string"&&(t=C.from(t,i)),C.isBuffer(t))return t.length===0?-1:va(r,t,e,i,o);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):va(r,[t],e,i,o);throw new TypeError("val must be string, number or Buffer")}function va(r,t,e,i,o){let u=1,h=r.length,w=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||t.length<2)return-1;u=2,h/=2,w/=2,e/=2}function m(v,k){return u===1?v[k]:v.readUInt16BE(k*u)}let x;if(o){let v=-1;for(x=e;xh&&(e=h-w),x=e;x>=0;x--){let v=!0;for(let k=0;ko&&(i=o)):i=o;let u=t.length;i>u/2&&(i=u/2);let h;for(h=0;h>>0,isFinite(i)?(i=i>>>0,o===void 0&&(o="utf8")):(o=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-e;if((i===void 0||i>u)&&(i=u),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let h=!1;for(;;)switch(o){case"hex":return Mf(this,t,e,i);case"utf8":case"utf-8":return Lf(this,t,e,i);case"ascii":case"latin1":case"binary":return Rf(this,t,e,i);case"base64":return Tf(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pf(this,t,e,i);default:if(h)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),h=!0}};C.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Cf(r,t,e){return t===0&&e===r.length?Oo.fromByteArray(r):Oo.fromByteArray(r.slice(t,e))}function Ia(r,t,e){e=Math.min(r.length,e);let i=[],o=t;for(;o239?4:u>223?3:u>191?2:1;if(o+w<=e){let m,x,v,k;switch(w){case 1:u<128&&(h=u);break;case 2:m=r[o+1],(m&192)===128&&(k=(u&31)<<6|m&63,k>127&&(h=k));break;case 3:m=r[o+1],x=r[o+2],(m&192)===128&&(x&192)===128&&(k=(u&15)<<12|(m&63)<<6|x&63,k>2047&&(k<55296||k>57343)&&(h=k));break;case 4:m=r[o+1],x=r[o+2],v=r[o+3],(m&192)===128&&(x&192)===128&&(v&192)===128&&(k=(u&15)<<18|(m&63)<<12|(x&63)<<6|v&63,k>65535&&k<1114112&&(h=k))}}h===null?(h=65533,w=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|h&1023),i.push(h),o+=w}return Of(i)}var xa=4096;function Of(r){let t=r.length;if(t<=xa)return String.fromCharCode.apply(String,r);let e="",i=0;for(;ii)&&(e=i);let o="";for(let u=t;ui&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),ee)throw new RangeError("Trying to access beyond buffer length")}C.prototype.readUintLE=C.prototype.readUIntLE=function(t,e,i){t=t>>>0,e=e>>>0,i||ue(t,e,this.length);let o=this[t],u=1,h=0;for(;++h>>0,e=e>>>0,i||ue(t,e,this.length);let o=this[t+--e],u=1;for(;e>0&&(u*=256);)o+=this[t+--e]*u;return o};C.prototype.readUint8=C.prototype.readUInt8=function(t,e){return t=t>>>0,e||ue(t,1,this.length),this[t]};C.prototype.readUint16LE=C.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||ue(t,2,this.length),this[t]|this[t+1]<<8};C.prototype.readUint16BE=C.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||ue(t,2,this.length),this[t]<<8|this[t+1]};C.prototype.readUint32LE=C.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||ue(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};C.prototype.readUint32BE=C.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||ue(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};C.prototype.readBigUInt64LE=ir(function(t){t=t>>>0,yn(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Vn(t,this.length-8);let o=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,u=this[++t]+this[++t]*2**8+this[++t]*2**16+i*2**24;return BigInt(o)+(BigInt(u)<>>0,yn(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Vn(t,this.length-8);let o=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],u=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i;return(BigInt(o)<>>0,e=e>>>0,i||ue(t,e,this.length);let o=this[t],u=1,h=0;for(;++h=u&&(o-=Math.pow(2,8*e)),o};C.prototype.readIntBE=function(t,e,i){t=t>>>0,e=e>>>0,i||ue(t,e,this.length);let o=e,u=1,h=this[t+--o];for(;o>0&&(u*=256);)h+=this[t+--o]*u;return u*=128,h>=u&&(h-=Math.pow(2,8*e)),h};C.prototype.readInt8=function(t,e){return t=t>>>0,e||ue(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};C.prototype.readInt16LE=function(t,e){t=t>>>0,e||ue(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};C.prototype.readInt16BE=function(t,e){t=t>>>0,e||ue(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};C.prototype.readInt32LE=function(t,e){return t=t>>>0,e||ue(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};C.prototype.readInt32BE=function(t,e){return t=t>>>0,e||ue(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};C.prototype.readBigInt64LE=ir(function(t){t=t>>>0,yn(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Vn(t,this.length-8);let o=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(o)<>>0,yn(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Vn(t,this.length-8);let o=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(o)<>>0,e||ue(t,4,this.length),pn.read(this,t,!0,23,4)};C.prototype.readFloatBE=function(t,e){return t=t>>>0,e||ue(t,4,this.length),pn.read(this,t,!1,23,4)};C.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||ue(t,8,this.length),pn.read(this,t,!0,52,8)};C.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||ue(t,8,this.length),pn.read(this,t,!1,52,8)};function Se(r,t,e,i,o,u){if(!C.isBuffer(r))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(t>o||tr.length)throw new RangeError("Index out of range")}C.prototype.writeUintLE=C.prototype.writeUIntLE=function(t,e,i,o){if(t=+t,e=e>>>0,i=i>>>0,!o){let w=Math.pow(2,8*i)-1;Se(this,t,e,i,w,0)}let u=1,h=0;for(this[e]=t&255;++h>>0,i=i>>>0,!o){let w=Math.pow(2,8*i)-1;Se(this,t,e,i,w,0)}let u=i-1,h=1;for(this[e+u]=t&255;--u>=0&&(h*=256);)this[e+u]=t/h&255;return e+i};C.prototype.writeUint8=C.prototype.writeUInt8=function(t,e,i){return t=+t,e=e>>>0,i||Se(this,t,e,1,255,0),this[e]=t&255,e+1};C.prototype.writeUint16LE=C.prototype.writeUInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||Se(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};C.prototype.writeUint16BE=C.prototype.writeUInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||Se(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};C.prototype.writeUint32LE=C.prototype.writeUInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||Se(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};C.prototype.writeUint32BE=C.prototype.writeUInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||Se(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function Aa(r,t,e,i,o){Pa(t,i,o,r,e,7);let u=Number(t&BigInt(4294967295));r[e++]=u,u=u>>8,r[e++]=u,u=u>>8,r[e++]=u,u=u>>8,r[e++]=u;let h=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=h,h=h>>8,r[e++]=h,h=h>>8,r[e++]=h,h=h>>8,r[e++]=h,e}function Ma(r,t,e,i,o){Pa(t,i,o,r,e,7);let u=Number(t&BigInt(4294967295));r[e+7]=u,u=u>>8,r[e+6]=u,u=u>>8,r[e+5]=u,u=u>>8,r[e+4]=u;let h=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=h,h=h>>8,r[e+2]=h,h=h>>8,r[e+1]=h,h=h>>8,r[e]=h,e+8}C.prototype.writeBigUInt64LE=ir(function(t,e=0){return Aa(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});C.prototype.writeBigUInt64BE=ir(function(t,e=0){return Ma(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});C.prototype.writeIntLE=function(t,e,i,o){if(t=+t,e=e>>>0,!o){let m=Math.pow(2,8*i-1);Se(this,t,e,i,m-1,-m)}let u=0,h=1,w=0;for(this[e]=t&255;++u>0)-w&255;return e+i};C.prototype.writeIntBE=function(t,e,i,o){if(t=+t,e=e>>>0,!o){let m=Math.pow(2,8*i-1);Se(this,t,e,i,m-1,-m)}let u=i-1,h=1,w=0;for(this[e+u]=t&255;--u>=0&&(h*=256);)t<0&&w===0&&this[e+u+1]!==0&&(w=1),this[e+u]=(t/h>>0)-w&255;return e+i};C.prototype.writeInt8=function(t,e,i){return t=+t,e=e>>>0,i||Se(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};C.prototype.writeInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||Se(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};C.prototype.writeInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||Se(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};C.prototype.writeInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||Se(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};C.prototype.writeInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||Se(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};C.prototype.writeBigInt64LE=ir(function(t,e=0){return Aa(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});C.prototype.writeBigInt64BE=ir(function(t,e=0){return Ma(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function La(r,t,e,i,o,u){if(e+i>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Ra(r,t,e,i,o){return t=+t,e=e>>>0,o||La(r,t,e,4,34028234663852886e22,-34028234663852886e22),pn.write(r,t,e,i,23,4),e+4}C.prototype.writeFloatLE=function(t,e,i){return Ra(this,t,e,!0,i)};C.prototype.writeFloatBE=function(t,e,i){return Ra(this,t,e,!1,i)};function Ta(r,t,e,i,o){return t=+t,e=e>>>0,o||La(r,t,e,8,17976931348623157e292,-17976931348623157e292),pn.write(r,t,e,i,52,8),e+8}C.prototype.writeDoubleLE=function(t,e,i){return Ta(this,t,e,!0,i)};C.prototype.writeDoubleBE=function(t,e,i){return Ta(this,t,e,!1,i)};C.prototype.copy=function(t,e,i,o){if(!C.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!o&&o!==0&&(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let u;if(typeof t=="number")for(u=e;u2**32?o=ka(String(e)):typeof e=="bigint"&&(o=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(o=ka(o)),o+="n"),i+=` It must be ${t}. Received ${o}`,i},RangeError);function ka(r){let t="",e=r.length,i=r[0]==="-"?1:0;for(;e>=i+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function Ff(r,t,e){yn(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&Vn(t,r.length-(e+1))}function Pa(r,t,e,i,o,u){if(r>e||r3?t===0||t===BigInt(0)?w=`>= 0${h} and < 2${h} ** ${(u+1)*8}${h}`:w=`>= -(2${h} ** ${(u+1)*8-1}${h}) and < 2 ** ${(u+1)*8-1}${h}`:w=`>= ${t}${h} and <= ${e}${h}`,new dn.ERR_OUT_OF_RANGE("value",w,r)}Ff(i,o,u)}function yn(r,t){if(typeof r!="number")throw new dn.ERR_INVALID_ARG_TYPE(t,"number",r)}function Vn(r,t,e){throw Math.floor(r)!==r?(yn(r,e),new dn.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new dn.ERR_BUFFER_OUT_OF_BOUNDS:new dn.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var Kf=/[^+/0-9A-Za-z-_]/g;function Df(r){if(r=r.split("=")[0],r=r.trim().replace(Kf,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function zo(r,t){t=t||1/0;let e,i=r.length,o=null,u=[];for(let h=0;h55295&&e<57344){if(!o){if(e>56319){(t-=3)>-1&&u.push(239,191,189);continue}else if(h+1===i){(t-=3)>-1&&u.push(239,191,189);continue}o=e;continue}if(e<56320){(t-=3)>-1&&u.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(t-=3)>-1&&u.push(239,191,189);if(o=null,e<128){if((t-=1)<0)break;u.push(e)}else if(e<2048){if((t-=2)<0)break;u.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;u.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;u.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return u}function Wf(r){let t=[];for(let e=0;e>8,o=e%256,u.push(o),u.push(i);return u}function Ca(r){return Oo.toByteArray(Df(r))}function Ii(r,t,e,i){let o;for(o=0;o=t.length||o>=r.length);++o)t[o+e]=r[o];return o}function qe(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function Do(r){return r!==r}var $f=function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let i=e*16;for(let o=0;o<16;++o)t[i+o]=r[e]+r[o]}return t}();function ir(r){return typeof BigInt>"u"?Vf:r}function Vf(){throw new Error("BigInt not supported")}});var O=oe(()=>{"use strict";var Oa=P(mn());globalThis.Buffer=Oa.Buffer});var gd,Ai,Ua=wt(()=>{"use strict";gd=P(O()),Ai=class extends Error{constructor(){super(...arguments);this.name="AbortError"}}});async function Na(r){try{let t=await r(),e=typeof t=="string"?t:JSON.stringify(t);Lit.Actions.setResponse({response:e})}catch(t){if(t instanceof Ai)return;Lit.Actions.setResponse({response:`Error: ${t.message}`})}}var bd,za=wt(()=>{"use strict";bd=P(O());Ua()});var xd,qa,Fa=wt(()=>{"use strict";xd=P(O()),qa="lit_"});async function Ka({accessControlConditions:r,privateKey:t,publicKey:e}){let{ciphertext:i,dataToEncryptHash:o}=await Lit.Actions.encrypt({accessControlConditions:r,to_encrypt:new TextEncoder().encode(qa+t)});return{ciphertext:i,dataToEncryptHash:o,publicKey:e}}var Bd,Da=wt(()=>{"use strict";Bd=P(O());Fa()});function Gn(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function Gf(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function or(r,...t){if(!Gf(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${r.length}`)}function Wa(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Gn(r.outputLen),Gn(r.blockLen)}function Ve(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Mi(r,t){or(r);let e=t.outputLen;if(r.length{_d=P(O(),1)});var Ad,jr,Ha=wt(()=>{Ad=P(O(),1),jr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function Ho(r){for(let t=0;tr().update(ar(i)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Ga(r){let t=(i,o)=>r(o).update(ar(i)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=i=>r(i),t}function Ri(r=32){if(jr&&typeof jr.getRandomValues=="function")return jr.getRandomValues(new Uint8Array(r));if(jr&&typeof jr.randomBytes=="function")return jr.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}var Pd,$a,Li,Pe,Wo,Zf,sr,Rd,ur=wt(()=>{Pd=P(O(),1);Ha();Zn();$a=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),Li=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Pe=(r,t)=>r<<32-t|r>>>t,Wo=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Zf=r=>r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255;sr=class{clone(){return this._cloneInto()}},Rd={}.toString});function jf(r,t,e,i){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,i);let o=BigInt(32),u=BigInt(4294967295),h=Number(e>>o&u),w=Number(e&u),m=i?4:0,x=i?0:4;r.setUint32(t+m,h,i),r.setUint32(t+x,w,i)}var Nd,Za,ja,bn,Vo=wt(()=>{Nd=P(O(),1);Zn();ur();Za=(r,t,e)=>r&t^~r&e,ja=(r,t,e)=>r&t^r&e^t&e,bn=class extends sr{constructor(t,e,i,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=i,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Li(this.buffer)}update(t){Ve(this);let{view:e,buffer:i,blockLen:o}=this;t=ar(t);let u=t.length;for(let h=0;ho-h&&(this.process(i,0),h=0);for(let k=h;kv.length)throw new Error("_sha2: outputLen bigger than state");for(let k=0;k>Go&Ti)}:{h:Number(r>>Go&Ti)|0,l:Number(r&Ti)|0}}function Zo(r,t=!1){let e=new Uint32Array(r.length),i=new Uint32Array(r.length);for(let o=0;o>>0)+(i>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var qd,Ti,Go,Yf,Jf,Xf,Qf,th,eh,rh,nh,ih,jo,Yo,Jo,Xo,sh,ah,uh,ch,fh,hh,lh,Kt,Qo=wt(()=>{qd=P(O(),1),Ti=BigInt(4294967295),Go=BigInt(32);Yf=(r,t)=>BigInt(r>>>0)<>>0),Jf=(r,t,e)=>r>>>e,Xf=(r,t,e)=>r<<32-e|t>>>e,Qf=(r,t,e)=>r>>>e|t<<32-e,th=(r,t,e)=>r<<32-e|t>>>e,eh=(r,t,e)=>r<<64-e|t>>>e-32,rh=(r,t,e)=>r>>>e-32|t<<64-e,nh=(r,t)=>t,ih=(r,t)=>r,jo=(r,t,e)=>r<>>32-e,Yo=(r,t,e)=>t<>>32-e,Jo=(r,t,e)=>t<>>64-e,Xo=(r,t,e)=>r<>>64-e;sh=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),ah=(r,t,e,i)=>t+e+i+(r/2**32|0)|0,uh=(r,t,e,i)=>(r>>>0)+(t>>>0)+(e>>>0)+(i>>>0),ch=(r,t,e,i,o)=>t+e+i+o+(r/2**32|0)|0,fh=(r,t,e,i,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(i>>>0)+(o>>>0),hh=(r,t,e,i,o,u)=>t+e+i+o+u+(r/2**32|0)|0,lh={fromBig:Ya,split:Zo,toBig:Yf,shrSH:Jf,shrSL:Xf,rotrSH:Qf,rotrSL:th,rotrBH:eh,rotrBL:rh,rotr32H:nh,rotr32L:ih,rotlSH:jo,rotlSL:Yo,rotlBH:Jo,rotlBL:Xo,add:oh,add3L:sh,add3H:ah,add4L:uh,add4H:ch,add5H:hh,add5L:fh},Kt=lh});var Hd,dh,ph,cr,fr,ts,Ja,Xa=wt(()=>{Hd=P(O(),1);Vo();Qo();ur();[dh,ph]=(()=>Kt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))))(),cr=new Uint32Array(80),fr=new Uint32Array(80),ts=class extends bn{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:i,Bl:o,Ch:u,Cl:h,Dh:w,Dl:m,Eh:x,El:v,Fh:k,Fl:E,Gh:M,Gl:$,Hh:R,Hl:B}=this;return[t,e,i,o,u,h,w,m,x,v,k,E,M,$,R,B]}set(t,e,i,o,u,h,w,m,x,v,k,E,M,$,R,B){this.Ah=t|0,this.Al=e|0,this.Bh=i|0,this.Bl=o|0,this.Ch=u|0,this.Cl=h|0,this.Dh=w|0,this.Dl=m|0,this.Eh=x|0,this.El=v|0,this.Fh=k|0,this.Fl=E|0,this.Gh=M|0,this.Gl=$|0,this.Hh=R|0,this.Hl=B|0}process(t,e){for(let N=0;N<16;N++,e+=4)cr[N]=t.getUint32(e),fr[N]=t.getUint32(e+=4);for(let N=16;N<80;N++){let F=cr[N-15]|0,tt=fr[N-15]|0,D=Kt.rotrSH(F,tt,1)^Kt.rotrSH(F,tt,8)^Kt.shrSH(F,tt,7),Z=Kt.rotrSL(F,tt,1)^Kt.rotrSL(F,tt,8)^Kt.shrSL(F,tt,7),X=cr[N-2]|0,et=fr[N-2]|0,Yt=Kt.rotrSH(X,et,19)^Kt.rotrBH(X,et,61)^Kt.shrSH(X,et,6),V=Kt.rotrSL(X,et,19)^Kt.rotrBL(X,et,61)^Kt.shrSL(X,et,6),nt=Kt.add4L(Z,V,fr[N-7],fr[N-16]),y=Kt.add4H(nt,D,Yt,cr[N-7],cr[N-16]);cr[N]=y|0,fr[N]=nt|0}let{Ah:i,Al:o,Bh:u,Bl:h,Ch:w,Cl:m,Dh:x,Dl:v,Eh:k,El:E,Fh:M,Fl:$,Gh:R,Gl:B,Hh:U,Hl:K}=this;for(let N=0;N<80;N++){let F=Kt.rotrSH(k,E,14)^Kt.rotrSH(k,E,18)^Kt.rotrBH(k,E,41),tt=Kt.rotrSL(k,E,14)^Kt.rotrSL(k,E,18)^Kt.rotrBL(k,E,41),D=k&M^~k&R,Z=E&$^~E&B,X=Kt.add5L(K,tt,Z,ph[N],fr[N]),et=Kt.add5H(X,U,F,D,dh[N],cr[N]),Yt=X|0,V=Kt.rotrSH(i,o,28)^Kt.rotrBH(i,o,34)^Kt.rotrBH(i,o,39),nt=Kt.rotrSL(i,o,28)^Kt.rotrBL(i,o,34)^Kt.rotrBL(i,o,39),y=i&u^i&w^u&w,n=o&h^o&m^h&m;U=R|0,K=B|0,R=M|0,B=$|0,M=k|0,$=E|0,{h:k,l:E}=Kt.add(x|0,v|0,et|0,Yt|0),x=w|0,v=m|0,w=u|0,m=h|0,u=i|0,h=o|0;let a=Kt.add3L(Yt,nt,n);i=Kt.add3H(a,et,V,y),o=a|0}({h:i,l:o}=Kt.add(this.Ah|0,this.Al|0,i|0,o|0)),{h:u,l:h}=Kt.add(this.Bh|0,this.Bl|0,u|0,h|0),{h:w,l:m}=Kt.add(this.Ch|0,this.Cl|0,w|0,m|0),{h:x,l:v}=Kt.add(this.Dh|0,this.Dl|0,x|0,v|0),{h:k,l:E}=Kt.add(this.Eh|0,this.El|0,k|0,E|0),{h:M,l:$}=Kt.add(this.Fh|0,this.Fl|0,M|0,$|0),{h:R,l:B}=Kt.add(this.Gh|0,this.Gl|0,R|0,B|0),{h:U,l:K}=Kt.add(this.Hh|0,this.Hl|0,U|0,K|0),this.set(i,o,u,h,w,m,x,v,k,E,M,$,R,B,U,K)}roundClean(){cr.fill(0),fr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Ja=wn(()=>new ts)});var Ci={};la(Ci,{aInRange:()=>Be,abool:()=>Ce,abytes:()=>vn,bitGet:()=>vh,bitLen:()=>os,bitMask:()=>Yn,bitSet:()=>xh,bytesToHex:()=>Ze,bytesToNumberBE:()=>je,bytesToNumberLE:()=>lr,concatBytes:()=>Ye,createHmacDrbg:()=>ss,ensureBytes:()=>ne,equalBytes:()=>wh,hexToBytes:()=>Jr,hexToNumber:()=>is,inRange:()=>jn,isBytes:()=>hr,memoized:()=>Qr,notImplemented:()=>Sh,numberToBytesBE:()=>dr,numberToBytesLE:()=>Xr,numberToHexUnpadded:()=>Yr,numberToVarBytesBE:()=>mh,utf8ToBytes:()=>bh,validateObject:()=>Fe});function hr(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function vn(r){if(!hr(r))throw new Error("Uint8Array expected")}function Ce(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}function Ze(r){vn(r);let t="";for(let e=0;e=Ge._0&&r<=Ge._9)return r-Ge._0;if(r>=Ge._A&&r<=Ge._F)return r-(Ge._A-10);if(r>=Ge._a&&r<=Ge._f)return r-(Ge._a-10)}function Jr(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(e);for(let o=0,u=0;ons;r>>=Pi,t+=1);return t}function vh(r,t){return r>>BigInt(t)&Pi}function xh(r,t,e){return r|(e?Pi:ns)<{i.fill(1),o.fill(0),u=0},w=(...k)=>e(o,i,...k),m=(k=rs())=>{o=w(tu([0]),k),i=w(),k.length!==0&&(o=w(tu([1]),k),i=w())},x=()=>{if(u++>=1e3)throw new Error("drbg: tried 1000 values");let k=0,E=[];for(;k{h(),m(k);let M;for(;!(M=E(x()));)m();return h(),M}}function Fe(r,t,e={}){let i=(o,u,h)=>{let w=kh[u];if(typeof w!="function")throw new Error(`Invalid validator "${u}", expected function`);let m=r[o];if(!(h&&m===void 0)&&!w(m,r))throw new Error(`Invalid param ${String(o)}=${m} (${typeof m}), expected ${u}`)};for(let[o,u]of Object.entries(t))i(o,u,!1);for(let[o,u]of Object.entries(e))i(o,u,!0);return r}function Qr(r){let t=new WeakMap;return(e,...i)=>{let o=t.get(e);if(o!==void 0)return o;let u=r(e,...i);return t.set(e,u),u}}var $d,ns,Pi,yh,gh,Ge,es,Yn,rs,tu,kh,Sh,tn=wt(()=>{$d=P(O(),1);ns=BigInt(0),Pi=BigInt(1),yh=BigInt(2);gh=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));Ge={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};es=r=>typeof r=="bigint"&&ns<=r;Yn=r=>(yh<new Uint8Array(r),tu=r=>Uint8Array.from(r);kh={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||hr(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};Sh=()=>{throw new Error("not implemented")}});function Zt(r,t){let e=r%t;return e>=se?e:t+e}function Ih(r,t,e){if(e<=se||t 0");if(e===te)return se;let i=te;for(;t>se;)t&te&&(i=i*r%e),r=r*r%e,t>>=te;return i}function ee(r,t,e){let i=r;for(;t-- >se;)i*=i,i%=e;return i}function Oi(r,t){if(r===se||t<=se)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=Zt(r,t),i=t,o=se,u=te,h=te,w=se;for(;e!==se;){let x=i/e,v=i%e,k=o-h*x,E=u-w*x;i=e,e=v,o=h,u=w,h=k,w=E}if(i!==te)throw new Error("invert: does not exist");return Zt(o,t)}function Ah(r){let t=(r-te)/en,e,i,o;for(e=r-te,i=0;e%en===se;e/=en,i++);for(o=en;o(i[o]="function",i),t);return Fe(r,e)}function Rh(r,t,e){if(e 0");if(e===se)return r.ONE;if(e===te)return t;let i=r.ONE,o=t;for(;e>se;)e&te&&(i=r.mul(i,o)),o=r.sqr(o),e>>=te;return i}function Th(r,t){let e=new Array(t.length),i=t.reduce((u,h,w)=>r.is0(h)?u:(e[w]=u,r.mul(u,h)),r.ONE),o=r.inv(i);return t.reduceRight((u,h,w)=>r.is0(h)?u:(e[w]=r.mul(u,e[w]),r.mul(u,h)),o),e}function cs(r,t){let e=t!==void 0?t:r.toString(2).length,i=Math.ceil(e/8);return{nBitLength:e,nByteLength:i}}function pr(r,t,e=!1,i={}){if(r<=se)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:u}=cs(r,t);if(u>2048)throw new Error("Field lengths over 2048 bytes are not supported");let h=Mh(r),w=Object.freeze({ORDER:r,BITS:o,BYTES:u,MASK:Yn(o),ZERO:se,ONE:te,create:m=>Zt(m,r),isValid:m=>{if(typeof m!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof m}`);return se<=m&&mm===se,isOdd:m=>(m&te)===te,neg:m=>Zt(-m,r),eql:(m,x)=>m===x,sqr:m=>Zt(m*m,r),add:(m,x)=>Zt(m+x,r),sub:(m,x)=>Zt(m-x,r),mul:(m,x)=>Zt(m*x,r),pow:(m,x)=>Rh(w,m,x),div:(m,x)=>Zt(m*Oi(x,r),r),sqrN:m=>m*m,addN:(m,x)=>m+x,subN:(m,x)=>m-x,mulN:(m,x)=>m*x,inv:m=>Oi(m,r),sqrt:i.sqrt||(m=>h(w,m)),invertBatch:m=>Th(w,m),cmov:(m,x,v)=>v?x:m,toBytes:m=>e?Xr(m,u):dr(m,u),fromBytes:m=>{if(m.length!==u)throw new Error(`Fp.fromBytes: expected ${u}, got ${m.length}`);return e?lr(m):je(m)}});return Object.freeze(w)}function iu(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function fs(r){let t=iu(r);return t+Math.ceil(t/2)}function ou(r,t,e=!1){let i=r.length,o=iu(t),u=fs(t);if(i<16||i1024)throw new Error(`expected ${u}-1024 bytes of input, got ${i}`);let h=e?je(r):lr(r),w=Zt(h,t-te)+te;return e?Xr(w,o):dr(w,o)}var Gd,se,te,en,Bh,as,eu,ru,Eh,_h,nu,Lh,xn=wt(()=>{Gd=P(O(),1);tn();se=BigInt(0),te=BigInt(1),en=BigInt(2),Bh=BigInt(3),as=BigInt(4),eu=BigInt(5),ru=BigInt(8),Eh=BigInt(9),_h=BigInt(16);nu=(r,t)=>(Zt(r,t)&te)===te,Lh=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function Ui(r,t){let e=(u,h)=>{let w=h.negate();return u?w:h},i=u=>{if(!Number.isSafeInteger(u)||u<=0||u>t)throw new Error(`Wrong window size=${u}, should be [1..${t}]`)},o=u=>{i(u);let h=Math.ceil(t/u)+1,w=2**(u-1);return{windows:h,windowSize:w}};return{constTimeNegate:e,unsafeLadder(u,h){let w=r.ZERO,m=u;for(;h>Ch;)h&hs&&(w=w.add(m)),m=m.double(),h>>=hs;return w},precomputeWindow(u,h){let{windows:w,windowSize:m}=o(h),x=[],v=u,k=v;for(let E=0;E>=$,U>x&&(U-=M,w+=hs);let K=B,N=B+Math.abs(U)-1,F=R%2!==0,tt=U<0;U===0?k=k.add(e(F,h[K])):v=v.add(e(tt,h[N]))}return{p:v,f:k}},wNAFCached(u,h,w){let m=su.get(u)||1,x=ls.get(u);return x||(x=this.precomputeWindow(u,m),m!==1&&ls.set(u,w(x))),this.wNAF(m,x,h)},setWindowSize(u,h){i(h),su.set(u,h),ls.delete(u)}}}function Ni(r,t,e,i){if(!Array.isArray(e)||!Array.isArray(i)||i.length!==e.length)throw new Error("arrays of points and scalars must have equal length");i.forEach((v,k)=>{if(!t.isValid(v))throw new Error(`wrong scalar at index ${k}`)}),e.forEach((v,k)=>{if(!(v instanceof r))throw new Error(`wrong point at index ${k}`)});let o=os(BigInt(e.length)),u=o>12?o-3:o>4?o-2:o?2:1,h=(1<=0;v-=u){w.fill(r.ZERO);for(let E=0;E>BigInt(v)&BigInt(h));w[$]=w[$].add(e[E])}let k=r.ZERO;for(let E=w.length-1,M=r.ZERO;E>0;E--)M=M.add(w[E]),k=k.add(M);if(x=x.add(k),v!==0)for(let E=0;E{Jd=P(O(),1);xn();tn();Ch=BigInt(0),hs=BigInt(1),ls=new WeakMap,su=new WeakMap});function Nh(r){let t=Jn(r);return Fe(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function au(r){let t=Nh(r),{Fp:e,n:i,prehash:o,hash:u,randomBytes:h,nByteLength:w,h:m}=t,x=zi<{try{return{isValid:!0,value:e.sqrt(c*e.inv(f))}}catch{return{isValid:!1,value:Oe}}}),M=t.adjustScalarBytes||(c=>c),$=t.domain||((c,f,l)=>{if(Ce("phflag",l),f.length||l)throw new Error("Contexts/pre-hash are not supported");return c});function R(c,f){Be("coordinate "+c,f,Oe,x)}function B(c){if(!(c instanceof N))throw new Error("ExtendedPoint expected")}let U=Qr((c,f)=>{let{ex:l,ey:g,ez:b}=c,d=c.is0();f==null&&(f=d?Oh:e.inv(b));let s=v(l*f),p=v(g*f),_=v(b*f);if(d)return{x:Oe,y:Ee};if(_!==Ee)throw new Error("invZ was invalid");return{x:s,y:p}}),K=Qr(c=>{let{a:f,d:l}=t;if(c.is0())throw new Error("bad point: ZERO");let{ex:g,ey:b,ez:d,et:s}=c,p=v(g*g),_=v(b*b),L=v(d*d),T=v(L*L),q=v(p*f),H=v(L*v(q+_)),j=v(T+v(l*v(p*_)));if(H!==j)throw new Error("bad point: equation left != right (1)");let Wt=v(g*b),G=v(d*s);if(Wt!==G)throw new Error("bad point: equation left != right (2)");return!0});class N{constructor(f,l,g,b){this.ex=f,this.ey=l,this.ez=g,this.et=b,R("x",f),R("y",l),R("z",g),R("t",b),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(f){if(f instanceof N)throw new Error("extended point not allowed");let{x:l,y:g}=f||{};return R("x",l),R("y",g),new N(l,g,Ee,v(l*g))}static normalizeZ(f){let l=e.invertBatch(f.map(g=>g.ez));return f.map((g,b)=>g.toAffine(l[b])).map(N.fromAffine)}static msm(f,l){return Ni(N,k,f,l)}_setWindowSize(f){D.setWindowSize(this,f)}assertValidity(){K(this)}equals(f){B(f);let{ex:l,ey:g,ez:b}=this,{ex:d,ey:s,ez:p}=f,_=v(l*p),L=v(d*b),T=v(g*p),q=v(s*b);return _===L&&T===q}is0(){return this.equals(N.ZERO)}negate(){return new N(v(-this.ex),this.ey,this.ez,v(-this.et))}double(){let{a:f}=t,{ex:l,ey:g,ez:b}=this,d=v(l*l),s=v(g*g),p=v(zi*v(b*b)),_=v(f*d),L=l+g,T=v(v(L*L)-d-s),q=_+s,H=q-p,j=_-s,Wt=v(T*H),G=v(q*j),Q=v(T*j),ve=v(H*q);return new N(Wt,G,ve,Q)}add(f){B(f);let{a:l,d:g}=t,{ex:b,ey:d,ez:s,et:p}=this,{ex:_,ey:L,ez:T,et:q}=f;if(l===BigInt(-1)){let ut=v((d-b)*(L+_)),ct=v((d+b)*(L-_)),He=v(ct-ut);if(He===Oe)return this.double();let ft=v(s*zi*q),ht=v(p*zi*T),nr=ht+ft,lt=ct+ut,dt=ht-ft,_r=v(nr*He),gt=v(lt*dt),mt=v(nr*dt),Ir=v(He*lt);return new N(_r,gt,Ir,mt)}let H=v(b*_),j=v(d*L),Wt=v(p*g*q),G=v(s*T),Q=v((b+d)*(_+L)-H-j),ve=G-Wt,ot=G+Wt,st=v(j-l*H),Br=v(Q*ve),pt=v(ot*st),yt=v(Q*st),Er=v(ve*ot);return new N(Br,pt,Er,yt)}subtract(f){return this.add(f.negate())}wNAF(f){return D.wNAFCached(this,f,N.normalizeZ)}multiply(f){let l=f;Be("scalar",l,Ee,i);let{p:g,f:b}=this.wNAF(l);return N.normalizeZ([g,b])[0]}multiplyUnsafe(f){let l=f;return Be("scalar",l,Oe,i),l===Oe?tt:this.equals(tt)||l===Ee?this:this.equals(F)?this.wNAF(l).p:D.unsafeLadder(this,l)}isSmallOrder(){return this.multiplyUnsafe(m).is0()}isTorsionFree(){return D.unsafeLadder(this,i).is0()}toAffine(f){return U(this,f)}clearCofactor(){let{h:f}=t;return f===Ee?this:this.multiplyUnsafe(f)}static fromHex(f,l=!1){let{d:g,a:b}=t,d=e.BYTES;f=ne("pointHex",f,d),Ce("zip215",l);let s=f.slice(),p=f[d-1];s[d-1]=p&-129;let _=lr(s),L=l?x:e.ORDER;Be("pointHex.y",_,Oe,L);let T=v(_*_),q=v(T-Ee),H=v(g*T-b),{isValid:j,value:Wt}=E(q,H);if(!j)throw new Error("Point.fromHex: invalid y coordinate");let G=(Wt&Ee)===Ee,Q=(p&128)!==0;if(!l&&Wt===Oe&&Q)throw new Error("Point.fromHex: x=0 and x_0=1");return Q!==G&&(Wt=v(-Wt)),N.fromAffine({x:Wt,y:_})}static fromPrivateKey(f){return et(f).point}toRawBytes(){let{x:f,y:l}=this.toAffine(),g=Xr(l,e.BYTES);return g[g.length-1]|=f&Ee?128:0,g}toHex(){return Ze(this.toRawBytes())}}N.BASE=new N(t.Gx,t.Gy,Ee,v(t.Gx*t.Gy)),N.ZERO=new N(Oe,Ee,Ee,Oe);let{BASE:F,ZERO:tt}=N,D=Ui(N,w*8);function Z(c){return Zt(c,i)}function X(c){return Z(lr(c))}function et(c){let f=w;c=ne("private key",c,f);let l=ne("hashed private key",u(c),2*f),g=M(l.slice(0,f)),b=l.slice(f,2*f),d=X(g),s=F.multiply(d),p=s.toRawBytes();return{head:g,prefix:b,scalar:d,point:s,pointBytes:p}}function Yt(c){return et(c).pointBytes}function V(c=new Uint8Array,...f){let l=Ye(...f);return X(u($(l,ne("context",c),!!o)))}function nt(c,f,l={}){c=ne("message",c),o&&(c=o(c));let{prefix:g,scalar:b,pointBytes:d}=et(f),s=V(l.context,g,c),p=F.multiply(s).toRawBytes(),_=V(l.context,p,d,c),L=Z(s+_*b);Be("signature.s",L,Oe,i);let T=Ye(p,Xr(L,e.BYTES));return ne("result",T,w*2)}let y=Uh;function n(c,f,l,g=y){let{context:b,zip215:d}=g,s=e.BYTES;c=ne("signature",c,2*s),f=ne("message",f),d!==void 0&&Ce("zip215",d),o&&(f=o(f));let p=lr(c.slice(s,2*s)),_,L,T;try{_=N.fromHex(l,d),L=N.fromHex(c.slice(0,s),d),T=F.multiplyUnsafe(p)}catch{return!1}if(!d&&_.isSmallOrder())return!1;let q=V(b,L.toRawBytes(),_.toRawBytes(),f);return L.add(_.multiplyUnsafe(q)).subtract(T).clearCofactor().equals(N.ZERO)}return F._setWindowSize(8),{CURVE:t,getPublicKey:Yt,sign:nt,verify:n,ExtendedPoint:N,utils:{getExtendedPublicKey:et,randomPrivateKey:()=>h(e.BYTES),precompute(c=8,f=N.BASE){return f._setWindowSize(c),f.multiply(BigInt(3)),f}}}}var rp,Oe,Ee,zi,Oh,Uh,uu=wt(()=>{rp=P(O(),1);ds();xn();tn();tn();Oe=BigInt(0),Ee=BigInt(1),zi=BigInt(2),Oh=BigInt(8),Uh={zip215:!0}});function Kh(r){let t=BigInt(10),e=BigInt(20),i=BigInt(40),o=BigInt(80),u=ps,w=r*r%u*r%u,m=ee(w,fu,u)*w%u,x=ee(m,zh,u)*r%u,v=ee(x,qh,u)*x%u,k=ee(v,t,u)*v%u,E=ee(k,e,u)*k%u,M=ee(E,i,u)*E%u,$=ee(M,o,u)*M%u,R=ee($,o,u)*M%u,B=ee(R,t,u)*v%u;return{pow_p_5_8:ee(B,fu,u)*r%u,b2:w}}function Dh(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function Wh(r,t){let e=ps,i=Zt(t*t*t,e),o=Zt(i*i*t,e),u=Kh(r*o).pow_p_5_8,h=Zt(r*i*u,e),w=Zt(t*h*h,e),m=h,x=Zt(h*cu,e),v=w===r,k=w===Zt(-r,e),E=w===Zt(-r*cu,e);return v&&(h=m),(k||E)&&(h=x),nu(h,e)&&(h=Zt(-h,e)),{isValid:v||k,value:h}}var hp,ps,cu,up,zh,fu,cp,qh,Fh,Hh,$h,rn,hu=wt(()=>{hp=P(O(),1);Xa();ur();uu();xn();ps=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),cu=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),up=BigInt(0),zh=BigInt(1),fu=BigInt(2),cp=BigInt(3),qh=BigInt(5),Fh=BigInt(8);Hh=(()=>pr(ps,void 0,!0))(),$h=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Hh,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Fh,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Ja,randomBytes:Ri,adjustScalarBytes:Dh,uvRatio:Wh}))(),rn=(()=>au($h))()});var ys=oe(()=>{var pp=P(O())});var du=oe((lu,gs)=>{var yp=P(O());(function(r,t){"use strict";function e(y,n){if(!y)throw new Error(n||"Assertion failed")}function i(y,n){y.super_=n;var a=function(){};a.prototype=n.prototype,y.prototype=new a,y.prototype.constructor=y}function o(y,n,a){if(o.isBN(y))return y;this.negative=0,this.words=null,this.length=0,this.red=null,y!==null&&((n==="le"||n==="be")&&(a=n,n=10),this._init(y||0,n||10,a||"be"))}typeof r=="object"?r.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=ys().Buffer}catch{}o.isBN=function(n){return n instanceof o?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===o.wordSize&&Array.isArray(n.words)},o.max=function(n,a){return n.cmp(a)>0?n:a},o.min=function(n,a){return n.cmp(a)<0?n:a},o.prototype._init=function(n,a,c){if(typeof n=="number")return this._initNumber(n,a,c);if(typeof n=="object")return this._initArray(n,a,c);a==="hex"&&(a=16),e(a===(a|0)&&a>=2&&a<=36),n=n.toString().replace(/\\s+/g,"");var f=0;n[0]==="-"&&(f++,this.negative=1),f=0;f-=3)g=n[f]|n[f-1]<<8|n[f-2]<<16,this.words[l]|=g<>>26-b&67108863,b+=24,b>=26&&(b-=26,l++);else if(c==="le")for(f=0,l=0;f>>26-b&67108863,b+=24,b>=26&&(b-=26,l++);return this._strip()};function h(y,n){var a=y.charCodeAt(n);if(a>=48&&a<=57)return a-48;if(a>=65&&a<=70)return a-55;if(a>=97&&a<=102)return a-87;e(!1,"Invalid character in "+y)}function w(y,n,a){var c=h(y,a);return a-1>=n&&(c|=h(y,a-1)<<4),c}o.prototype._parseHex=function(n,a,c){this.length=Math.ceil((n.length-a)/6),this.words=new Array(this.length);for(var f=0;f=a;f-=2)b=w(n,a,f)<=18?(l-=18,g+=1,this.words[g]|=b>>>26):l+=8;else{var d=n.length-a;for(f=d%2===0?a+1:a;f=18?(l-=18,g+=1,this.words[g]|=b>>>26):l+=8}this._strip()};function m(y,n,a,c){for(var f=0,l=0,g=Math.min(y.length,a),b=n;b=49?l=d-49+10:d>=17?l=d-17+10:l=d,e(d>=0&&l1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=v}catch{o.prototype.inspect=v}else o.prototype.inspect=v;function v(){return(this.red?""}var k=["","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"],E=[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],M=[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];o.prototype.toString=function(n,a){n=n||10,a=a|0||1;var c;if(n===16||n==="hex"){c="";for(var f=0,l=0,g=0;g>>24-f&16777215,f+=2,f>=26&&(f-=26,g--),l!==0||g!==this.length-1?c=k[6-d.length]+d+c:c=d+c}for(l!==0&&(c=l.toString(16)+c);c.length%a!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}if(n===(n|0)&&n>=2&&n<=36){var s=E[n],p=M[n];c="";var _=this.clone();for(_.negative=0;!_.isZero();){var L=_.modrn(p).toString(n);_=_.idivn(p),_.isZero()?c=L+c:c=k[s-L.length]+L+c}for(this.isZero()&&(c="0"+c);c.length%a!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},o.prototype.toJSON=function(){return this.toString(16,2)},u&&(o.prototype.toBuffer=function(n,a){return this.toArrayLike(u,n,a)}),o.prototype.toArray=function(n,a){return this.toArrayLike(Array,n,a)};var $=function(n,a){return n.allocUnsafe?n.allocUnsafe(a):new n(a)};o.prototype.toArrayLike=function(n,a,c){this._strip();var f=this.byteLength(),l=c||Math.max(1,f);e(f<=l,"byte array longer than desired length"),e(l>0,"Requested array length <= 0");var g=$(n,l),b=a==="le"?"LE":"BE";return this["_toArrayLike"+b](g,f),g},o.prototype._toArrayLikeLE=function(n,a){for(var c=0,f=0,l=0,g=0;l>8&255),c>16&255),g===6?(c>24&255),f=0,g=0):(f=b>>>24,g+=2)}if(c=0&&(n[c--]=b>>8&255),c>=0&&(n[c--]=b>>16&255),g===6?(c>=0&&(n[c--]=b>>24&255),f=0,g=0):(f=b>>>24,g+=2)}if(c>=0)for(n[c--]=f;c>=0;)n[c--]=0},Math.clz32?o.prototype._countBits=function(n){return 32-Math.clz32(n)}:o.prototype._countBits=function(n){var a=n,c=0;return a>=4096&&(c+=13,a>>>=13),a>=64&&(c+=7,a>>>=7),a>=8&&(c+=4,a>>>=4),a>=2&&(c+=2,a>>>=2),c+a},o.prototype._zeroBits=function(n){if(n===0)return 26;var a=n,c=0;return a&8191||(c+=13,a>>>=13),a&127||(c+=7,a>>>=7),a&15||(c+=4,a>>>=4),a&3||(c+=2,a>>>=2),a&1||c++,c},o.prototype.bitLength=function(){var n=this.words[this.length-1],a=this._countBits(n);return(this.length-1)*26+a};function R(y){for(var n=new Array(y.bitLength()),a=0;a>>f&1}return n}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,a=0;an.length?this.clone().ior(n):n.clone().ior(this)},o.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},o.prototype.iuand=function(n){var a;this.length>n.length?a=n:a=this;for(var c=0;cn.length?this.clone().iand(n):n.clone().iand(this)},o.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},o.prototype.iuxor=function(n){var a,c;this.length>n.length?(a=this,c=n):(a=n,c=this);for(var f=0;fn.length?this.clone().ixor(n):n.clone().ixor(this)},o.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},o.prototype.inotn=function(n){e(typeof n=="number"&&n>=0);var a=Math.ceil(n/26)|0,c=n%26;this._expand(a),c>0&&a--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-c),this._strip()},o.prototype.notn=function(n){return this.clone().inotn(n)},o.prototype.setn=function(n,a){e(typeof n=="number"&&n>=0);var c=n/26|0,f=n%26;return this._expand(c+1),a?this.words[c]=this.words[c]|1<n.length?(c=this,f=n):(c=n,f=this);for(var l=0,g=0;g>>26;for(;l!==0&&g>>26;if(this.length=c.length,l!==0)this.words[this.length]=l,this.length++;else if(c!==this)for(;gn.length?this.clone().iadd(n):n.clone().iadd(this)},o.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var a=this.iadd(n);return n.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var c=this.cmp(n);if(c===0)return this.negative=0,this.length=1,this.words[0]=0,this;var f,l;c>0?(f=this,l=n):(f=n,l=this);for(var g=0,b=0;b>26,this.words[b]=a&67108863;for(;g!==0&&b>26,this.words[b]=a&67108863;if(g===0&&b>>26,_=d&67108863,L=Math.min(s,n.length-1),T=Math.max(0,s-y.length+1);T<=L;T++){var q=s-T|0;f=y.words[q]|0,l=n.words[T]|0,g=f*l+_,p+=g/67108864|0,_=g&67108863}a.words[s]=_|0,d=p|0}return d!==0?a.words[s]=d|0:a.length--,a._strip()}var U=function(n,a,c){var f=n.words,l=a.words,g=c.words,b=0,d,s,p,_=f[0]|0,L=_&8191,T=_>>>13,q=f[1]|0,H=q&8191,j=q>>>13,Wt=f[2]|0,G=Wt&8191,Q=Wt>>>13,ve=f[3]|0,ot=ve&8191,st=ve>>>13,Br=f[4]|0,pt=Br&8191,yt=Br>>>13,Er=f[5]|0,ut=Er&8191,ct=Er>>>13,He=f[6]|0,ft=He&8191,ht=He>>>13,nr=f[7]|0,lt=nr&8191,dt=nr>>>13,_r=f[8]|0,gt=_r&8191,mt=_r>>>13,Ir=f[9]|0,bt=Ir&8191,vt=Ir>>>13,Un=l[0]|0,xt=Un&8191,kt=Un>>>13,Nn=l[1]|0,St=Nn&8191,Bt=Nn>>>13,zn=l[2]|0,Et=zn&8191,_t=zn>>>13,qn=l[3]|0,It=qn&8191,At=qn>>>13,Fn=l[4]|0,Mt=Fn&8191,Lt=Fn>>>13,Kn=l[5]|0,Rt=Kn&8191,Tt=Kn>>>13,Dn=l[6]|0,Pt=Dn&8191,Ct=Dn>>>13,Wn=l[7]|0,Ot=Wn&8191,Ut=Wn>>>13,Hn=l[8]|0,Nt=Hn&8191,zt=Hn>>>13,$n=l[9]|0,qt=$n&8191,Ft=$n>>>13;c.negative=n.negative^a.negative,c.length=19,d=Math.imul(L,xt),s=Math.imul(L,kt),s=s+Math.imul(T,xt)|0,p=Math.imul(T,kt);var Ar=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Ar>>>26)|0,Ar&=67108863,d=Math.imul(H,xt),s=Math.imul(H,kt),s=s+Math.imul(j,xt)|0,p=Math.imul(j,kt),d=d+Math.imul(L,St)|0,s=s+Math.imul(L,Bt)|0,s=s+Math.imul(T,St)|0,p=p+Math.imul(T,Bt)|0;var Mr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,d=Math.imul(G,xt),s=Math.imul(G,kt),s=s+Math.imul(Q,xt)|0,p=Math.imul(Q,kt),d=d+Math.imul(H,St)|0,s=s+Math.imul(H,Bt)|0,s=s+Math.imul(j,St)|0,p=p+Math.imul(j,Bt)|0,d=d+Math.imul(L,Et)|0,s=s+Math.imul(L,_t)|0,s=s+Math.imul(T,Et)|0,p=p+Math.imul(T,_t)|0;var Lr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,d=Math.imul(ot,xt),s=Math.imul(ot,kt),s=s+Math.imul(st,xt)|0,p=Math.imul(st,kt),d=d+Math.imul(G,St)|0,s=s+Math.imul(G,Bt)|0,s=s+Math.imul(Q,St)|0,p=p+Math.imul(Q,Bt)|0,d=d+Math.imul(H,Et)|0,s=s+Math.imul(H,_t)|0,s=s+Math.imul(j,Et)|0,p=p+Math.imul(j,_t)|0,d=d+Math.imul(L,It)|0,s=s+Math.imul(L,At)|0,s=s+Math.imul(T,It)|0,p=p+Math.imul(T,At)|0;var Rr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,d=Math.imul(pt,xt),s=Math.imul(pt,kt),s=s+Math.imul(yt,xt)|0,p=Math.imul(yt,kt),d=d+Math.imul(ot,St)|0,s=s+Math.imul(ot,Bt)|0,s=s+Math.imul(st,St)|0,p=p+Math.imul(st,Bt)|0,d=d+Math.imul(G,Et)|0,s=s+Math.imul(G,_t)|0,s=s+Math.imul(Q,Et)|0,p=p+Math.imul(Q,_t)|0,d=d+Math.imul(H,It)|0,s=s+Math.imul(H,At)|0,s=s+Math.imul(j,It)|0,p=p+Math.imul(j,At)|0,d=d+Math.imul(L,Mt)|0,s=s+Math.imul(L,Lt)|0,s=s+Math.imul(T,Mt)|0,p=p+Math.imul(T,Lt)|0;var Tr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,d=Math.imul(ut,xt),s=Math.imul(ut,kt),s=s+Math.imul(ct,xt)|0,p=Math.imul(ct,kt),d=d+Math.imul(pt,St)|0,s=s+Math.imul(pt,Bt)|0,s=s+Math.imul(yt,St)|0,p=p+Math.imul(yt,Bt)|0,d=d+Math.imul(ot,Et)|0,s=s+Math.imul(ot,_t)|0,s=s+Math.imul(st,Et)|0,p=p+Math.imul(st,_t)|0,d=d+Math.imul(G,It)|0,s=s+Math.imul(G,At)|0,s=s+Math.imul(Q,It)|0,p=p+Math.imul(Q,At)|0,d=d+Math.imul(H,Mt)|0,s=s+Math.imul(H,Lt)|0,s=s+Math.imul(j,Mt)|0,p=p+Math.imul(j,Lt)|0,d=d+Math.imul(L,Rt)|0,s=s+Math.imul(L,Tt)|0,s=s+Math.imul(T,Rt)|0,p=p+Math.imul(T,Tt)|0;var Pr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Pr>>>26)|0,Pr&=67108863,d=Math.imul(ft,xt),s=Math.imul(ft,kt),s=s+Math.imul(ht,xt)|0,p=Math.imul(ht,kt),d=d+Math.imul(ut,St)|0,s=s+Math.imul(ut,Bt)|0,s=s+Math.imul(ct,St)|0,p=p+Math.imul(ct,Bt)|0,d=d+Math.imul(pt,Et)|0,s=s+Math.imul(pt,_t)|0,s=s+Math.imul(yt,Et)|0,p=p+Math.imul(yt,_t)|0,d=d+Math.imul(ot,It)|0,s=s+Math.imul(ot,At)|0,s=s+Math.imul(st,It)|0,p=p+Math.imul(st,At)|0,d=d+Math.imul(G,Mt)|0,s=s+Math.imul(G,Lt)|0,s=s+Math.imul(Q,Mt)|0,p=p+Math.imul(Q,Lt)|0,d=d+Math.imul(H,Rt)|0,s=s+Math.imul(H,Tt)|0,s=s+Math.imul(j,Rt)|0,p=p+Math.imul(j,Tt)|0,d=d+Math.imul(L,Pt)|0,s=s+Math.imul(L,Ct)|0,s=s+Math.imul(T,Pt)|0,p=p+Math.imul(T,Ct)|0;var Cr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,d=Math.imul(lt,xt),s=Math.imul(lt,kt),s=s+Math.imul(dt,xt)|0,p=Math.imul(dt,kt),d=d+Math.imul(ft,St)|0,s=s+Math.imul(ft,Bt)|0,s=s+Math.imul(ht,St)|0,p=p+Math.imul(ht,Bt)|0,d=d+Math.imul(ut,Et)|0,s=s+Math.imul(ut,_t)|0,s=s+Math.imul(ct,Et)|0,p=p+Math.imul(ct,_t)|0,d=d+Math.imul(pt,It)|0,s=s+Math.imul(pt,At)|0,s=s+Math.imul(yt,It)|0,p=p+Math.imul(yt,At)|0,d=d+Math.imul(ot,Mt)|0,s=s+Math.imul(ot,Lt)|0,s=s+Math.imul(st,Mt)|0,p=p+Math.imul(st,Lt)|0,d=d+Math.imul(G,Rt)|0,s=s+Math.imul(G,Tt)|0,s=s+Math.imul(Q,Rt)|0,p=p+Math.imul(Q,Tt)|0,d=d+Math.imul(H,Pt)|0,s=s+Math.imul(H,Ct)|0,s=s+Math.imul(j,Pt)|0,p=p+Math.imul(j,Ct)|0,d=d+Math.imul(L,Ot)|0,s=s+Math.imul(L,Ut)|0,s=s+Math.imul(T,Ot)|0,p=p+Math.imul(T,Ut)|0;var Or=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Or>>>26)|0,Or&=67108863,d=Math.imul(gt,xt),s=Math.imul(gt,kt),s=s+Math.imul(mt,xt)|0,p=Math.imul(mt,kt),d=d+Math.imul(lt,St)|0,s=s+Math.imul(lt,Bt)|0,s=s+Math.imul(dt,St)|0,p=p+Math.imul(dt,Bt)|0,d=d+Math.imul(ft,Et)|0,s=s+Math.imul(ft,_t)|0,s=s+Math.imul(ht,Et)|0,p=p+Math.imul(ht,_t)|0,d=d+Math.imul(ut,It)|0,s=s+Math.imul(ut,At)|0,s=s+Math.imul(ct,It)|0,p=p+Math.imul(ct,At)|0,d=d+Math.imul(pt,Mt)|0,s=s+Math.imul(pt,Lt)|0,s=s+Math.imul(yt,Mt)|0,p=p+Math.imul(yt,Lt)|0,d=d+Math.imul(ot,Rt)|0,s=s+Math.imul(ot,Tt)|0,s=s+Math.imul(st,Rt)|0,p=p+Math.imul(st,Tt)|0,d=d+Math.imul(G,Pt)|0,s=s+Math.imul(G,Ct)|0,s=s+Math.imul(Q,Pt)|0,p=p+Math.imul(Q,Ct)|0,d=d+Math.imul(H,Ot)|0,s=s+Math.imul(H,Ut)|0,s=s+Math.imul(j,Ot)|0,p=p+Math.imul(j,Ut)|0,d=d+Math.imul(L,Nt)|0,s=s+Math.imul(L,zt)|0,s=s+Math.imul(T,Nt)|0,p=p+Math.imul(T,zt)|0;var Ur=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,d=Math.imul(bt,xt),s=Math.imul(bt,kt),s=s+Math.imul(vt,xt)|0,p=Math.imul(vt,kt),d=d+Math.imul(gt,St)|0,s=s+Math.imul(gt,Bt)|0,s=s+Math.imul(mt,St)|0,p=p+Math.imul(mt,Bt)|0,d=d+Math.imul(lt,Et)|0,s=s+Math.imul(lt,_t)|0,s=s+Math.imul(dt,Et)|0,p=p+Math.imul(dt,_t)|0,d=d+Math.imul(ft,It)|0,s=s+Math.imul(ft,At)|0,s=s+Math.imul(ht,It)|0,p=p+Math.imul(ht,At)|0,d=d+Math.imul(ut,Mt)|0,s=s+Math.imul(ut,Lt)|0,s=s+Math.imul(ct,Mt)|0,p=p+Math.imul(ct,Lt)|0,d=d+Math.imul(pt,Rt)|0,s=s+Math.imul(pt,Tt)|0,s=s+Math.imul(yt,Rt)|0,p=p+Math.imul(yt,Tt)|0,d=d+Math.imul(ot,Pt)|0,s=s+Math.imul(ot,Ct)|0,s=s+Math.imul(st,Pt)|0,p=p+Math.imul(st,Ct)|0,d=d+Math.imul(G,Ot)|0,s=s+Math.imul(G,Ut)|0,s=s+Math.imul(Q,Ot)|0,p=p+Math.imul(Q,Ut)|0,d=d+Math.imul(H,Nt)|0,s=s+Math.imul(H,zt)|0,s=s+Math.imul(j,Nt)|0,p=p+Math.imul(j,zt)|0,d=d+Math.imul(L,qt)|0,s=s+Math.imul(L,Ft)|0,s=s+Math.imul(T,qt)|0,p=p+Math.imul(T,Ft)|0;var Nr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,d=Math.imul(bt,St),s=Math.imul(bt,Bt),s=s+Math.imul(vt,St)|0,p=Math.imul(vt,Bt),d=d+Math.imul(gt,Et)|0,s=s+Math.imul(gt,_t)|0,s=s+Math.imul(mt,Et)|0,p=p+Math.imul(mt,_t)|0,d=d+Math.imul(lt,It)|0,s=s+Math.imul(lt,At)|0,s=s+Math.imul(dt,It)|0,p=p+Math.imul(dt,At)|0,d=d+Math.imul(ft,Mt)|0,s=s+Math.imul(ft,Lt)|0,s=s+Math.imul(ht,Mt)|0,p=p+Math.imul(ht,Lt)|0,d=d+Math.imul(ut,Rt)|0,s=s+Math.imul(ut,Tt)|0,s=s+Math.imul(ct,Rt)|0,p=p+Math.imul(ct,Tt)|0,d=d+Math.imul(pt,Pt)|0,s=s+Math.imul(pt,Ct)|0,s=s+Math.imul(yt,Pt)|0,p=p+Math.imul(yt,Ct)|0,d=d+Math.imul(ot,Ot)|0,s=s+Math.imul(ot,Ut)|0,s=s+Math.imul(st,Ot)|0,p=p+Math.imul(st,Ut)|0,d=d+Math.imul(G,Nt)|0,s=s+Math.imul(G,zt)|0,s=s+Math.imul(Q,Nt)|0,p=p+Math.imul(Q,zt)|0,d=d+Math.imul(H,qt)|0,s=s+Math.imul(H,Ft)|0,s=s+Math.imul(j,qt)|0,p=p+Math.imul(j,Ft)|0;var zr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(zr>>>26)|0,zr&=67108863,d=Math.imul(bt,Et),s=Math.imul(bt,_t),s=s+Math.imul(vt,Et)|0,p=Math.imul(vt,_t),d=d+Math.imul(gt,It)|0,s=s+Math.imul(gt,At)|0,s=s+Math.imul(mt,It)|0,p=p+Math.imul(mt,At)|0,d=d+Math.imul(lt,Mt)|0,s=s+Math.imul(lt,Lt)|0,s=s+Math.imul(dt,Mt)|0,p=p+Math.imul(dt,Lt)|0,d=d+Math.imul(ft,Rt)|0,s=s+Math.imul(ft,Tt)|0,s=s+Math.imul(ht,Rt)|0,p=p+Math.imul(ht,Tt)|0,d=d+Math.imul(ut,Pt)|0,s=s+Math.imul(ut,Ct)|0,s=s+Math.imul(ct,Pt)|0,p=p+Math.imul(ct,Ct)|0,d=d+Math.imul(pt,Ot)|0,s=s+Math.imul(pt,Ut)|0,s=s+Math.imul(yt,Ot)|0,p=p+Math.imul(yt,Ut)|0,d=d+Math.imul(ot,Nt)|0,s=s+Math.imul(ot,zt)|0,s=s+Math.imul(st,Nt)|0,p=p+Math.imul(st,zt)|0,d=d+Math.imul(G,qt)|0,s=s+Math.imul(G,Ft)|0,s=s+Math.imul(Q,qt)|0,p=p+Math.imul(Q,Ft)|0;var qr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(qr>>>26)|0,qr&=67108863,d=Math.imul(bt,It),s=Math.imul(bt,At),s=s+Math.imul(vt,It)|0,p=Math.imul(vt,At),d=d+Math.imul(gt,Mt)|0,s=s+Math.imul(gt,Lt)|0,s=s+Math.imul(mt,Mt)|0,p=p+Math.imul(mt,Lt)|0,d=d+Math.imul(lt,Rt)|0,s=s+Math.imul(lt,Tt)|0,s=s+Math.imul(dt,Rt)|0,p=p+Math.imul(dt,Tt)|0,d=d+Math.imul(ft,Pt)|0,s=s+Math.imul(ft,Ct)|0,s=s+Math.imul(ht,Pt)|0,p=p+Math.imul(ht,Ct)|0,d=d+Math.imul(ut,Ot)|0,s=s+Math.imul(ut,Ut)|0,s=s+Math.imul(ct,Ot)|0,p=p+Math.imul(ct,Ut)|0,d=d+Math.imul(pt,Nt)|0,s=s+Math.imul(pt,zt)|0,s=s+Math.imul(yt,Nt)|0,p=p+Math.imul(yt,zt)|0,d=d+Math.imul(ot,qt)|0,s=s+Math.imul(ot,Ft)|0,s=s+Math.imul(st,qt)|0,p=p+Math.imul(st,Ft)|0;var Fr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,d=Math.imul(bt,Mt),s=Math.imul(bt,Lt),s=s+Math.imul(vt,Mt)|0,p=Math.imul(vt,Lt),d=d+Math.imul(gt,Rt)|0,s=s+Math.imul(gt,Tt)|0,s=s+Math.imul(mt,Rt)|0,p=p+Math.imul(mt,Tt)|0,d=d+Math.imul(lt,Pt)|0,s=s+Math.imul(lt,Ct)|0,s=s+Math.imul(dt,Pt)|0,p=p+Math.imul(dt,Ct)|0,d=d+Math.imul(ft,Ot)|0,s=s+Math.imul(ft,Ut)|0,s=s+Math.imul(ht,Ot)|0,p=p+Math.imul(ht,Ut)|0,d=d+Math.imul(ut,Nt)|0,s=s+Math.imul(ut,zt)|0,s=s+Math.imul(ct,Nt)|0,p=p+Math.imul(ct,zt)|0,d=d+Math.imul(pt,qt)|0,s=s+Math.imul(pt,Ft)|0,s=s+Math.imul(yt,qt)|0,p=p+Math.imul(yt,Ft)|0;var Kr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,d=Math.imul(bt,Rt),s=Math.imul(bt,Tt),s=s+Math.imul(vt,Rt)|0,p=Math.imul(vt,Tt),d=d+Math.imul(gt,Pt)|0,s=s+Math.imul(gt,Ct)|0,s=s+Math.imul(mt,Pt)|0,p=p+Math.imul(mt,Ct)|0,d=d+Math.imul(lt,Ot)|0,s=s+Math.imul(lt,Ut)|0,s=s+Math.imul(dt,Ot)|0,p=p+Math.imul(dt,Ut)|0,d=d+Math.imul(ft,Nt)|0,s=s+Math.imul(ft,zt)|0,s=s+Math.imul(ht,Nt)|0,p=p+Math.imul(ht,zt)|0,d=d+Math.imul(ut,qt)|0,s=s+Math.imul(ut,Ft)|0,s=s+Math.imul(ct,qt)|0,p=p+Math.imul(ct,Ft)|0;var Dr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,d=Math.imul(bt,Pt),s=Math.imul(bt,Ct),s=s+Math.imul(vt,Pt)|0,p=Math.imul(vt,Ct),d=d+Math.imul(gt,Ot)|0,s=s+Math.imul(gt,Ut)|0,s=s+Math.imul(mt,Ot)|0,p=p+Math.imul(mt,Ut)|0,d=d+Math.imul(lt,Nt)|0,s=s+Math.imul(lt,zt)|0,s=s+Math.imul(dt,Nt)|0,p=p+Math.imul(dt,zt)|0,d=d+Math.imul(ft,qt)|0,s=s+Math.imul(ft,Ft)|0,s=s+Math.imul(ht,qt)|0,p=p+Math.imul(ht,Ft)|0;var Wr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,d=Math.imul(bt,Ot),s=Math.imul(bt,Ut),s=s+Math.imul(vt,Ot)|0,p=Math.imul(vt,Ut),d=d+Math.imul(gt,Nt)|0,s=s+Math.imul(gt,zt)|0,s=s+Math.imul(mt,Nt)|0,p=p+Math.imul(mt,zt)|0,d=d+Math.imul(lt,qt)|0,s=s+Math.imul(lt,Ft)|0,s=s+Math.imul(dt,qt)|0,p=p+Math.imul(dt,Ft)|0;var Hr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,d=Math.imul(bt,Nt),s=Math.imul(bt,zt),s=s+Math.imul(vt,Nt)|0,p=Math.imul(vt,zt),d=d+Math.imul(gt,qt)|0,s=s+Math.imul(gt,Ft)|0,s=s+Math.imul(mt,qt)|0,p=p+Math.imul(mt,Ft)|0;var $r=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+($r>>>26)|0,$r&=67108863,d=Math.imul(bt,qt),s=Math.imul(bt,Ft),s=s+Math.imul(vt,qt)|0,p=Math.imul(vt,Ft);var Vr=(b+d|0)+((s&8191)<<13)|0;return b=(p+(s>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,g[0]=Ar,g[1]=Mr,g[2]=Lr,g[3]=Rr,g[4]=Tr,g[5]=Pr,g[6]=Cr,g[7]=Or,g[8]=Ur,g[9]=Nr,g[10]=zr,g[11]=qr,g[12]=Fr,g[13]=Kr,g[14]=Dr,g[15]=Wr,g[16]=Hr,g[17]=$r,g[18]=Vr,b!==0&&(g[19]=b,c.length++),c};Math.imul||(U=B);function K(y,n,a){a.negative=n.negative^y.negative,a.length=y.length+n.length;for(var c=0,f=0,l=0;l>>26)|0,f+=g>>>26,g&=67108863}a.words[l]=b,c=g,g=f}return c!==0?a.words[l]=c:a.length--,a._strip()}function N(y,n,a){return K(y,n,a)}o.prototype.mulTo=function(n,a){var c,f=this.length+n.length;return this.length===10&&n.length===10?c=U(this,n,a):f<63?c=B(this,n,a):f<1024?c=K(this,n,a):c=N(this,n,a),c};function F(y,n){this.x=y,this.y=n}F.prototype.makeRBT=function(n){for(var a=new Array(n),c=o.prototype._countBits(n)-1,f=0;f>=1;return f},F.prototype.permute=function(n,a,c,f,l,g){for(var b=0;b>>1)l++;return 1<>>13,c[2*g+1]=l&8191,l=l>>>13;for(g=2*a;g>=26,c+=l/67108864|0,c+=g>>>26,this.words[f]=g&67108863}return c!==0&&(this.words[f]=c,this.length++),a?this.ineg():this},o.prototype.muln=function(n){return this.clone().imuln(n)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(n){var a=R(n);if(a.length===0)return new o(1);for(var c=this,f=0;f=0);var a=n%26,c=(n-a)/26,f=67108863>>>26-a<<26-a,l;if(a!==0){var g=0;for(l=0;l>>26-a}g&&(this.words[l]=g,this.length++)}if(c!==0){for(l=this.length-1;l>=0;l--)this.words[l+c]=this.words[l];for(l=0;l=0);var f;a?f=(a-a%26)/26:f=0;var l=n%26,g=Math.min((n-l)/26,this.length),b=67108863^67108863>>>l<g)for(this.length-=g,s=0;s=0&&(p!==0||s>=f);s--){var _=this.words[s]|0;this.words[s]=p<<26-l|_>>>l,p=_&b}return d&&p!==0&&(d.words[d.length++]=p),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(n,a,c){return e(this.negative===0),this.iushrn(n,a,c)},o.prototype.shln=function(n){return this.clone().ishln(n)},o.prototype.ushln=function(n){return this.clone().iushln(n)},o.prototype.shrn=function(n){return this.clone().ishrn(n)},o.prototype.ushrn=function(n){return this.clone().iushrn(n)},o.prototype.testn=function(n){e(typeof n=="number"&&n>=0);var a=n%26,c=(n-a)/26,f=1<=0);var a=n%26,c=(n-a)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=c)return this;if(a!==0&&c++,this.length=Math.min(c,this.length),a!==0){var f=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},o.prototype.isubn=function(n){if(e(typeof n=="number"),e(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(d/67108864|0),this.words[l+c]=g&67108863}for(;l>26,this.words[l+c]=g&67108863;if(b===0)return this._strip();for(e(b===-1),b=0,l=0;l>26,this.words[l]=g&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(n,a){var c=this.length-n.length,f=this.clone(),l=n,g=l.words[l.length-1]|0,b=this._countBits(g);c=26-b,c!==0&&(l=l.ushln(c),f.iushln(c),g=l.words[l.length-1]|0);var d=f.length-l.length,s;if(a!=="mod"){s=new o(null),s.length=d+1,s.words=new Array(s.length);for(var p=0;p=0;L--){var T=(f.words[l.length+L]|0)*67108864+(f.words[l.length+L-1]|0);for(T=Math.min(T/g|0,67108863),f._ishlnsubmul(l,T,L);f.negative!==0;)T--,f.negative=0,f._ishlnsubmul(l,1,L),f.isZero()||(f.negative^=1);s&&(s.words[L]=T)}return s&&s._strip(),f._strip(),a!=="div"&&c!==0&&f.iushrn(c),{div:s||null,mod:f}},o.prototype.divmod=function(n,a,c){if(e(!n.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var f,l,g;return this.negative!==0&&n.negative===0?(g=this.neg().divmod(n,a),a!=="mod"&&(f=g.div.neg()),a!=="div"&&(l=g.mod.neg(),c&&l.negative!==0&&l.iadd(n)),{div:f,mod:l}):this.negative===0&&n.negative!==0?(g=this.divmod(n.neg(),a),a!=="mod"&&(f=g.div.neg()),{div:f,mod:g.mod}):this.negative&n.negative?(g=this.neg().divmod(n.neg(),a),a!=="div"&&(l=g.mod.neg(),c&&l.negative!==0&&l.isub(n)),{div:g.div,mod:l}):n.length>this.length||this.cmp(n)<0?{div:new o(0),mod:this}:n.length===1?a==="div"?{div:this.divn(n.words[0]),mod:null}:a==="mod"?{div:null,mod:new o(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new o(this.modrn(n.words[0]))}:this._wordDiv(n,a)},o.prototype.div=function(n){return this.divmod(n,"div",!1).div},o.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},o.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},o.prototype.divRound=function(n){var a=this.divmod(n);if(a.mod.isZero())return a.div;var c=a.div.negative!==0?a.mod.isub(n):a.mod,f=n.ushrn(1),l=n.andln(1),g=c.cmp(f);return g<0||l===1&&g===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},o.prototype.modrn=function(n){var a=n<0;a&&(n=-n),e(n<=67108863);for(var c=(1<<26)%n,f=0,l=this.length-1;l>=0;l--)f=(c*f+(this.words[l]|0))%n;return a?-f:f},o.prototype.modn=function(n){return this.modrn(n)},o.prototype.idivn=function(n){var a=n<0;a&&(n=-n),e(n<=67108863);for(var c=0,f=this.length-1;f>=0;f--){var l=(this.words[f]|0)+c*67108864;this.words[f]=l/n|0,c=l%n}return this._strip(),a?this.ineg():this},o.prototype.divn=function(n){return this.clone().idivn(n)},o.prototype.egcd=function(n){e(n.negative===0),e(!n.isZero());var a=this,c=n.clone();a.negative!==0?a=a.umod(n):a=a.clone();for(var f=new o(1),l=new o(0),g=new o(0),b=new o(1),d=0;a.isEven()&&c.isEven();)a.iushrn(1),c.iushrn(1),++d;for(var s=c.clone(),p=a.clone();!a.isZero();){for(var _=0,L=1;!(a.words[0]&L)&&_<26;++_,L<<=1);if(_>0)for(a.iushrn(_);_-- >0;)(f.isOdd()||l.isOdd())&&(f.iadd(s),l.isub(p)),f.iushrn(1),l.iushrn(1);for(var T=0,q=1;!(c.words[0]&q)&&T<26;++T,q<<=1);if(T>0)for(c.iushrn(T);T-- >0;)(g.isOdd()||b.isOdd())&&(g.iadd(s),b.isub(p)),g.iushrn(1),b.iushrn(1);a.cmp(c)>=0?(a.isub(c),f.isub(g),l.isub(b)):(c.isub(a),g.isub(f),b.isub(l))}return{a:g,b,gcd:c.iushln(d)}},o.prototype._invmp=function(n){e(n.negative===0),e(!n.isZero());var a=this,c=n.clone();a.negative!==0?a=a.umod(n):a=a.clone();for(var f=new o(1),l=new o(0),g=c.clone();a.cmpn(1)>0&&c.cmpn(1)>0;){for(var b=0,d=1;!(a.words[0]&d)&&b<26;++b,d<<=1);if(b>0)for(a.iushrn(b);b-- >0;)f.isOdd()&&f.iadd(g),f.iushrn(1);for(var s=0,p=1;!(c.words[0]&p)&&s<26;++s,p<<=1);if(s>0)for(c.iushrn(s);s-- >0;)l.isOdd()&&l.iadd(g),l.iushrn(1);a.cmp(c)>=0?(a.isub(c),f.isub(l)):(c.isub(a),l.isub(f))}var _;return a.cmpn(1)===0?_=f:_=l,_.cmpn(0)<0&&_.iadd(n),_},o.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var a=this.clone(),c=n.clone();a.negative=0,c.negative=0;for(var f=0;a.isEven()&&c.isEven();f++)a.iushrn(1),c.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;c.isEven();)c.iushrn(1);var l=a.cmp(c);if(l<0){var g=a;a=c,c=g}else if(l===0||c.cmpn(1)===0)break;a.isub(c)}while(!0);return c.iushln(f)},o.prototype.invm=function(n){return this.egcd(n).a.umod(n)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(n){return this.words[0]&n},o.prototype.bincn=function(n){e(typeof n=="number");var a=n%26,c=(n-a)/26,f=1<>>26,b&=67108863,this.words[g]=b}return l!==0&&(this.words[g]=l,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(n){var a=n<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this._strip();var c;if(this.length>1)c=1;else{a&&(n=-n),e(n<=67108863,"Number is too big");var f=this.words[0]|0;c=f===n?0:fn.length)return 1;if(this.length=0;c--){var f=this.words[c]|0,l=n.words[c]|0;if(f!==l){fl&&(a=1);break}}return a},o.prototype.gtn=function(n){return this.cmpn(n)===1},o.prototype.gt=function(n){return this.cmp(n)===1},o.prototype.gten=function(n){return this.cmpn(n)>=0},o.prototype.gte=function(n){return this.cmp(n)>=0},o.prototype.ltn=function(n){return this.cmpn(n)===-1},o.prototype.lt=function(n){return this.cmp(n)===-1},o.prototype.lten=function(n){return this.cmpn(n)<=0},o.prototype.lte=function(n){return this.cmp(n)<=0},o.prototype.eqn=function(n){return this.cmpn(n)===0},o.prototype.eq=function(n){return this.cmp(n)===0},o.red=function(n){return new V(n)},o.prototype.toRed=function(n){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(n){return this.red=n,this},o.prototype.forceRed=function(n){return e(!this.red,"Already a number in reduction context"),this._forceRed(n)},o.prototype.redAdd=function(n){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},o.prototype.redIAdd=function(n){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},o.prototype.redSub=function(n){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},o.prototype.redISub=function(n){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},o.prototype.redShl=function(n){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},o.prototype.redMul=function(n){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},o.prototype.redIMul=function(n){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(n){return e(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var tt={k256:null,p224:null,p192:null,p25519:null};function D(y,n){this.name=y,this.p=new o(n,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}D.prototype._tmp=function(){var n=new o(null);return n.words=new Array(Math.ceil(this.n/13)),n},D.prototype.ireduce=function(n){var a=n,c;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),c=a.bitLength();while(c>this.n);var f=c0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},D.prototype.split=function(n,a){n.iushrn(this.n,0,a)},D.prototype.imulK=function(n){return n.imul(this.k)};function Z(){D.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(Z,D),Z.prototype.split=function(n,a){for(var c=4194303,f=Math.min(n.length,9),l=0;l>>22,g=b}g>>>=22,n.words[l-10]=g,g===0&&n.length>10?n.length-=10:n.length-=9},Z.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var a=0,c=0;c>>=26,n.words[c]=l,a=f}return a!==0&&(n.words[n.length++]=a),n},o._prime=function(n){if(tt[n])return tt[n];var a;if(n==="k256")a=new Z;else if(n==="p224")a=new X;else if(n==="p192")a=new et;else if(n==="p25519")a=new Yt;else throw new Error("Unknown prime "+n);return tt[n]=a,a};function V(y){if(typeof y=="string"){var n=o._prime(y);this.m=n.p,this.prime=n}else e(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}V.prototype._verify1=function(n){e(n.negative===0,"red works only with positives"),e(n.red,"red works only with red numbers")},V.prototype._verify2=function(n,a){e((n.negative|a.negative)===0,"red works only with positives"),e(n.red&&n.red===a.red,"red works only with red numbers")},V.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(x(n,n.umod(this.m)._forceRed(this)),n)},V.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},V.prototype.add=function(n,a){this._verify2(n,a);var c=n.add(a);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},V.prototype.iadd=function(n,a){this._verify2(n,a);var c=n.iadd(a);return c.cmp(this.m)>=0&&c.isub(this.m),c},V.prototype.sub=function(n,a){this._verify2(n,a);var c=n.sub(a);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},V.prototype.isub=function(n,a){this._verify2(n,a);var c=n.isub(a);return c.cmpn(0)<0&&c.iadd(this.m),c},V.prototype.shl=function(n,a){return this._verify1(n),this.imod(n.ushln(a))},V.prototype.imul=function(n,a){return this._verify2(n,a),this.imod(n.imul(a))},V.prototype.mul=function(n,a){return this._verify2(n,a),this.imod(n.mul(a))},V.prototype.isqr=function(n){return this.imul(n,n.clone())},V.prototype.sqr=function(n){return this.mul(n,n)},V.prototype.sqrt=function(n){if(n.isZero())return n.clone();var a=this.m.andln(3);if(e(a%2===1),a===3){var c=this.m.add(new o(1)).iushrn(2);return this.pow(n,c)}for(var f=this.m.subn(1),l=0;!f.isZero()&&f.andln(1)===0;)l++,f.iushrn(1);e(!f.isZero());var g=new o(1).toRed(this),b=g.redNeg(),d=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);this.pow(s,d).cmp(b)!==0;)s.redIAdd(b);for(var p=this.pow(s,f),_=this.pow(n,f.addn(1).iushrn(1)),L=this.pow(n,f),T=l;L.cmp(g)!==0;){for(var q=L,H=0;q.cmp(g)!==0;H++)q=q.redSqr();e(H=0;l--){for(var p=a.words[l],_=s-1;_>=0;_--){var L=p>>_&1;if(g!==f[0]&&(g=this.sqr(g)),L===0&&b===0){d=0;continue}b<<=1,b|=L,d++,!(d!==c&&(l!==0||_!==0))&&(g=this.mul(g,f[b]),d=0,b=0)}s=26}return g},V.prototype.convertTo=function(n){var a=n.umod(this.m);return a===n?a.clone():a},V.prototype.convertFrom=function(n){var a=n.clone();return a.red=null,a},o.mont=function(n){return new nt(n)};function nt(y){V.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(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)}i(nt,V),nt.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},nt.prototype.convertFrom=function(n){var a=this.imod(n.mul(this.rinv));return a.red=null,a},nt.prototype.imul=function(n,a){if(n.isZero()||a.isZero())return n.words[0]=0,n.length=1,n;var c=n.imul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=c.isub(f).iushrn(this.shift),g=l;return l.cmp(this.m)>=0?g=l.isub(this.m):l.cmpn(0)<0&&(g=l.iadd(this.m)),g._forceRed(this)},nt.prototype.mul=function(n,a){if(n.isZero()||a.isZero())return new o(0)._forceRed(this);var c=n.mul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=c.isub(f).iushrn(this.shift),g=l;return l.cmp(this.m)>=0?g=l.isub(this.m):l.cmpn(0)<0&&(g=l.iadd(this.m)),g._forceRed(this)},nt.prototype.invm=function(n){var a=this.imod(n._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(typeof gs>"u"||gs,lu)});var gu=oe((ms,yu)=>{var gp=P(O());var qi=mn(),Ke=qi.Buffer;function pu(r,t){for(var e in r)t[e]=r[e]}Ke.from&&Ke.alloc&&Ke.allocUnsafe&&Ke.allocUnsafeSlow?yu.exports=qi:(pu(qi,ms),ms.Buffer=nn);function nn(r,t,e){return Ke(r,t,e)}nn.prototype=Object.create(Ke.prototype);pu(Ke,nn);nn.from=function(r,t,e){if(typeof r=="number")throw new TypeError("Argument must not be a number");return Ke(r,t,e)};nn.alloc=function(r,t,e){if(typeof r!="number")throw new TypeError("Argument must be a number");var i=Ke(r);return t!==void 0?typeof e=="string"?i.fill(t,e):i.fill(t):i.fill(0),i};nn.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return Ke(r)};nn.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return qi.SlowBuffer(r)}});var ws=oe((mp,mu)=>{"use strict";var wp=P(O()),Fi=gu().Buffer;function Vh(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,N=new Uint8Array(K);B!==U;){for(var F=M[B],tt=0,D=K-1;(F!==0||tt>>0,N[D]=F%h>>>0,F=F/h>>>0;if(F!==0)throw new Error("Non-zero carry");R=tt,B++}for(var Z=K-R;Z!==K&&N[Z]===0;)Z++;for(var X=w.repeat($);Z>>0,K=new Uint8Array(U);$>>0,K[tt]=N%256>>>0,N=N/256>>>0;if(N!==0)throw new Error("Non-zero carry");B=F,$++}for(var D=U-B;D!==U&&K[D]===0;)D++;var Z=Fi.allocUnsafe(R+(U-D));Z.fill(0,0,R);for(var X=R;D!==U;)Z[X++]=K[D++];return Z}function E(M){var $=k(M);if($)return $;throw new Error("Non-base"+h+" character")}return{encode:v,decodeUnsafe:k,decode:E}}mu.exports=Vh});var bu=oe((bp,wu)=>{var vp=P(O()),Gh=ws(),Zh="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";wu.exports=Gh(Zh)});var Bp,jh,yr,gr,bs,Xn,vs=wt(()=>{Bp=P(O(),1);Vo();ur();jh=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),yr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),gr=new Uint32Array(64),bs=class extends bn{constructor(){super(64,32,8,!1),this.A=yr[0]|0,this.B=yr[1]|0,this.C=yr[2]|0,this.D=yr[3]|0,this.E=yr[4]|0,this.F=yr[5]|0,this.G=yr[6]|0,this.H=yr[7]|0}get(){let{A:t,B:e,C:i,D:o,E:u,F:h,G:w,H:m}=this;return[t,e,i,o,u,h,w,m]}set(t,e,i,o,u,h,w,m){this.A=t|0,this.B=e|0,this.C=i|0,this.D=o|0,this.E=u|0,this.F=h|0,this.G=w|0,this.H=m|0}process(t,e){for(let k=0;k<16;k++,e+=4)gr[k]=t.getUint32(e,!1);for(let k=16;k<64;k++){let E=gr[k-15],M=gr[k-2],$=Pe(E,7)^Pe(E,18)^E>>>3,R=Pe(M,17)^Pe(M,19)^M>>>10;gr[k]=R+gr[k-7]+$+gr[k-16]|0}let{A:i,B:o,C:u,D:h,E:w,F:m,G:x,H:v}=this;for(let k=0;k<64;k++){let E=Pe(w,6)^Pe(w,11)^Pe(w,25),M=v+E+Za(w,m,x)+jh[k]+gr[k]|0,R=(Pe(i,2)^Pe(i,13)^Pe(i,22))+ja(i,o,u)|0;v=x,x=m,m=w,w=h+M|0,h=u,u=o,o=i,i=M+R|0}i=i+this.A|0,o=o+this.B|0,u=u+this.C|0,h=h+this.D|0,w=w+this.E|0,m=m+this.F|0,x=x+this.G|0,v=v+this.H|0,this.set(i,o,u,h,w,m,x,v)}roundClean(){gr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Xn=wn(()=>new bs)});var xu=oe((vu,xs)=>{var Ep=P(O());(function(r,t){"use strict";function e(y,n){if(!y)throw new Error(n||"Assertion failed")}function i(y,n){y.super_=n;var a=function(){};a.prototype=n.prototype,y.prototype=new a,y.prototype.constructor=y}function o(y,n,a){if(o.isBN(y))return y;this.negative=0,this.words=null,this.length=0,this.red=null,y!==null&&((n==="le"||n==="be")&&(a=n,n=10),this._init(y||0,n||10,a||"be"))}typeof r=="object"?r.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=ys().Buffer}catch{}o.isBN=function(n){return n instanceof o?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===o.wordSize&&Array.isArray(n.words)},o.max=function(n,a){return n.cmp(a)>0?n:a},o.min=function(n,a){return n.cmp(a)<0?n:a},o.prototype._init=function(n,a,c){if(typeof n=="number")return this._initNumber(n,a,c);if(typeof n=="object")return this._initArray(n,a,c);a==="hex"&&(a=16),e(a===(a|0)&&a>=2&&a<=36),n=n.toString().replace(/\\s+/g,"");var f=0;n[0]==="-"&&(f++,this.negative=1),f=0;f-=3)g=n[f]|n[f-1]<<8|n[f-2]<<16,this.words[l]|=g<>>26-b&67108863,b+=24,b>=26&&(b-=26,l++);else if(c==="le")for(f=0,l=0;f>>26-b&67108863,b+=24,b>=26&&(b-=26,l++);return this._strip()};function h(y,n){var a=y.charCodeAt(n);if(a>=48&&a<=57)return a-48;if(a>=65&&a<=70)return a-55;if(a>=97&&a<=102)return a-87;e(!1,"Invalid character in "+y)}function w(y,n,a){var c=h(y,a);return a-1>=n&&(c|=h(y,a-1)<<4),c}o.prototype._parseHex=function(n,a,c){this.length=Math.ceil((n.length-a)/6),this.words=new Array(this.length);for(var f=0;f=a;f-=2)b=w(n,a,f)<=18?(l-=18,g+=1,this.words[g]|=b>>>26):l+=8;else{var d=n.length-a;for(f=d%2===0?a+1:a;f=18?(l-=18,g+=1,this.words[g]|=b>>>26):l+=8}this._strip()};function m(y,n,a,c){for(var f=0,l=0,g=Math.min(y.length,a),b=n;b=49?l=d-49+10:d>=17?l=d-17+10:l=d,e(d>=0&&l1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=v}catch{o.prototype.inspect=v}else o.prototype.inspect=v;function v(){return(this.red?""}var k=["","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"],E=[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],M=[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];o.prototype.toString=function(n,a){n=n||10,a=a|0||1;var c;if(n===16||n==="hex"){c="";for(var f=0,l=0,g=0;g>>24-f&16777215,f+=2,f>=26&&(f-=26,g--),l!==0||g!==this.length-1?c=k[6-d.length]+d+c:c=d+c}for(l!==0&&(c=l.toString(16)+c);c.length%a!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}if(n===(n|0)&&n>=2&&n<=36){var s=E[n],p=M[n];c="";var _=this.clone();for(_.negative=0;!_.isZero();){var L=_.modrn(p).toString(n);_=_.idivn(p),_.isZero()?c=L+c:c=k[s-L.length]+L+c}for(this.isZero()&&(c="0"+c);c.length%a!==0;)c="0"+c;return this.negative!==0&&(c="-"+c),c}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},o.prototype.toJSON=function(){return this.toString(16,2)},u&&(o.prototype.toBuffer=function(n,a){return this.toArrayLike(u,n,a)}),o.prototype.toArray=function(n,a){return this.toArrayLike(Array,n,a)};var $=function(n,a){return n.allocUnsafe?n.allocUnsafe(a):new n(a)};o.prototype.toArrayLike=function(n,a,c){this._strip();var f=this.byteLength(),l=c||Math.max(1,f);e(f<=l,"byte array longer than desired length"),e(l>0,"Requested array length <= 0");var g=$(n,l),b=a==="le"?"LE":"BE";return this["_toArrayLike"+b](g,f),g},o.prototype._toArrayLikeLE=function(n,a){for(var c=0,f=0,l=0,g=0;l>8&255),c>16&255),g===6?(c>24&255),f=0,g=0):(f=b>>>24,g+=2)}if(c=0&&(n[c--]=b>>8&255),c>=0&&(n[c--]=b>>16&255),g===6?(c>=0&&(n[c--]=b>>24&255),f=0,g=0):(f=b>>>24,g+=2)}if(c>=0)for(n[c--]=f;c>=0;)n[c--]=0},Math.clz32?o.prototype._countBits=function(n){return 32-Math.clz32(n)}:o.prototype._countBits=function(n){var a=n,c=0;return a>=4096&&(c+=13,a>>>=13),a>=64&&(c+=7,a>>>=7),a>=8&&(c+=4,a>>>=4),a>=2&&(c+=2,a>>>=2),c+a},o.prototype._zeroBits=function(n){if(n===0)return 26;var a=n,c=0;return a&8191||(c+=13,a>>>=13),a&127||(c+=7,a>>>=7),a&15||(c+=4,a>>>=4),a&3||(c+=2,a>>>=2),a&1||c++,c},o.prototype.bitLength=function(){var n=this.words[this.length-1],a=this._countBits(n);return(this.length-1)*26+a};function R(y){for(var n=new Array(y.bitLength()),a=0;a>>f&1}return n}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,a=0;an.length?this.clone().ior(n):n.clone().ior(this)},o.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},o.prototype.iuand=function(n){var a;this.length>n.length?a=n:a=this;for(var c=0;cn.length?this.clone().iand(n):n.clone().iand(this)},o.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},o.prototype.iuxor=function(n){var a,c;this.length>n.length?(a=this,c=n):(a=n,c=this);for(var f=0;fn.length?this.clone().ixor(n):n.clone().ixor(this)},o.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},o.prototype.inotn=function(n){e(typeof n=="number"&&n>=0);var a=Math.ceil(n/26)|0,c=n%26;this._expand(a),c>0&&a--;for(var f=0;f0&&(this.words[f]=~this.words[f]&67108863>>26-c),this._strip()},o.prototype.notn=function(n){return this.clone().inotn(n)},o.prototype.setn=function(n,a){e(typeof n=="number"&&n>=0);var c=n/26|0,f=n%26;return this._expand(c+1),a?this.words[c]=this.words[c]|1<n.length?(c=this,f=n):(c=n,f=this);for(var l=0,g=0;g>>26;for(;l!==0&&g>>26;if(this.length=c.length,l!==0)this.words[this.length]=l,this.length++;else if(c!==this)for(;gn.length?this.clone().iadd(n):n.clone().iadd(this)},o.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var a=this.iadd(n);return n.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var c=this.cmp(n);if(c===0)return this.negative=0,this.length=1,this.words[0]=0,this;var f,l;c>0?(f=this,l=n):(f=n,l=this);for(var g=0,b=0;b>26,this.words[b]=a&67108863;for(;g!==0&&b>26,this.words[b]=a&67108863;if(g===0&&b>>26,_=d&67108863,L=Math.min(s,n.length-1),T=Math.max(0,s-y.length+1);T<=L;T++){var q=s-T|0;f=y.words[q]|0,l=n.words[T]|0,g=f*l+_,p+=g/67108864|0,_=g&67108863}a.words[s]=_|0,d=p|0}return d!==0?a.words[s]=d|0:a.length--,a._strip()}var U=function(n,a,c){var f=n.words,l=a.words,g=c.words,b=0,d,s,p,_=f[0]|0,L=_&8191,T=_>>>13,q=f[1]|0,H=q&8191,j=q>>>13,Wt=f[2]|0,G=Wt&8191,Q=Wt>>>13,ve=f[3]|0,ot=ve&8191,st=ve>>>13,Br=f[4]|0,pt=Br&8191,yt=Br>>>13,Er=f[5]|0,ut=Er&8191,ct=Er>>>13,He=f[6]|0,ft=He&8191,ht=He>>>13,nr=f[7]|0,lt=nr&8191,dt=nr>>>13,_r=f[8]|0,gt=_r&8191,mt=_r>>>13,Ir=f[9]|0,bt=Ir&8191,vt=Ir>>>13,Un=l[0]|0,xt=Un&8191,kt=Un>>>13,Nn=l[1]|0,St=Nn&8191,Bt=Nn>>>13,zn=l[2]|0,Et=zn&8191,_t=zn>>>13,qn=l[3]|0,It=qn&8191,At=qn>>>13,Fn=l[4]|0,Mt=Fn&8191,Lt=Fn>>>13,Kn=l[5]|0,Rt=Kn&8191,Tt=Kn>>>13,Dn=l[6]|0,Pt=Dn&8191,Ct=Dn>>>13,Wn=l[7]|0,Ot=Wn&8191,Ut=Wn>>>13,Hn=l[8]|0,Nt=Hn&8191,zt=Hn>>>13,$n=l[9]|0,qt=$n&8191,Ft=$n>>>13;c.negative=n.negative^a.negative,c.length=19,d=Math.imul(L,xt),s=Math.imul(L,kt),s=s+Math.imul(T,xt)|0,p=Math.imul(T,kt);var Ar=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Ar>>>26)|0,Ar&=67108863,d=Math.imul(H,xt),s=Math.imul(H,kt),s=s+Math.imul(j,xt)|0,p=Math.imul(j,kt),d=d+Math.imul(L,St)|0,s=s+Math.imul(L,Bt)|0,s=s+Math.imul(T,St)|0,p=p+Math.imul(T,Bt)|0;var Mr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,d=Math.imul(G,xt),s=Math.imul(G,kt),s=s+Math.imul(Q,xt)|0,p=Math.imul(Q,kt),d=d+Math.imul(H,St)|0,s=s+Math.imul(H,Bt)|0,s=s+Math.imul(j,St)|0,p=p+Math.imul(j,Bt)|0,d=d+Math.imul(L,Et)|0,s=s+Math.imul(L,_t)|0,s=s+Math.imul(T,Et)|0,p=p+Math.imul(T,_t)|0;var Lr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,d=Math.imul(ot,xt),s=Math.imul(ot,kt),s=s+Math.imul(st,xt)|0,p=Math.imul(st,kt),d=d+Math.imul(G,St)|0,s=s+Math.imul(G,Bt)|0,s=s+Math.imul(Q,St)|0,p=p+Math.imul(Q,Bt)|0,d=d+Math.imul(H,Et)|0,s=s+Math.imul(H,_t)|0,s=s+Math.imul(j,Et)|0,p=p+Math.imul(j,_t)|0,d=d+Math.imul(L,It)|0,s=s+Math.imul(L,At)|0,s=s+Math.imul(T,It)|0,p=p+Math.imul(T,At)|0;var Rr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,d=Math.imul(pt,xt),s=Math.imul(pt,kt),s=s+Math.imul(yt,xt)|0,p=Math.imul(yt,kt),d=d+Math.imul(ot,St)|0,s=s+Math.imul(ot,Bt)|0,s=s+Math.imul(st,St)|0,p=p+Math.imul(st,Bt)|0,d=d+Math.imul(G,Et)|0,s=s+Math.imul(G,_t)|0,s=s+Math.imul(Q,Et)|0,p=p+Math.imul(Q,_t)|0,d=d+Math.imul(H,It)|0,s=s+Math.imul(H,At)|0,s=s+Math.imul(j,It)|0,p=p+Math.imul(j,At)|0,d=d+Math.imul(L,Mt)|0,s=s+Math.imul(L,Lt)|0,s=s+Math.imul(T,Mt)|0,p=p+Math.imul(T,Lt)|0;var Tr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,d=Math.imul(ut,xt),s=Math.imul(ut,kt),s=s+Math.imul(ct,xt)|0,p=Math.imul(ct,kt),d=d+Math.imul(pt,St)|0,s=s+Math.imul(pt,Bt)|0,s=s+Math.imul(yt,St)|0,p=p+Math.imul(yt,Bt)|0,d=d+Math.imul(ot,Et)|0,s=s+Math.imul(ot,_t)|0,s=s+Math.imul(st,Et)|0,p=p+Math.imul(st,_t)|0,d=d+Math.imul(G,It)|0,s=s+Math.imul(G,At)|0,s=s+Math.imul(Q,It)|0,p=p+Math.imul(Q,At)|0,d=d+Math.imul(H,Mt)|0,s=s+Math.imul(H,Lt)|0,s=s+Math.imul(j,Mt)|0,p=p+Math.imul(j,Lt)|0,d=d+Math.imul(L,Rt)|0,s=s+Math.imul(L,Tt)|0,s=s+Math.imul(T,Rt)|0,p=p+Math.imul(T,Tt)|0;var Pr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Pr>>>26)|0,Pr&=67108863,d=Math.imul(ft,xt),s=Math.imul(ft,kt),s=s+Math.imul(ht,xt)|0,p=Math.imul(ht,kt),d=d+Math.imul(ut,St)|0,s=s+Math.imul(ut,Bt)|0,s=s+Math.imul(ct,St)|0,p=p+Math.imul(ct,Bt)|0,d=d+Math.imul(pt,Et)|0,s=s+Math.imul(pt,_t)|0,s=s+Math.imul(yt,Et)|0,p=p+Math.imul(yt,_t)|0,d=d+Math.imul(ot,It)|0,s=s+Math.imul(ot,At)|0,s=s+Math.imul(st,It)|0,p=p+Math.imul(st,At)|0,d=d+Math.imul(G,Mt)|0,s=s+Math.imul(G,Lt)|0,s=s+Math.imul(Q,Mt)|0,p=p+Math.imul(Q,Lt)|0,d=d+Math.imul(H,Rt)|0,s=s+Math.imul(H,Tt)|0,s=s+Math.imul(j,Rt)|0,p=p+Math.imul(j,Tt)|0,d=d+Math.imul(L,Pt)|0,s=s+Math.imul(L,Ct)|0,s=s+Math.imul(T,Pt)|0,p=p+Math.imul(T,Ct)|0;var Cr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,d=Math.imul(lt,xt),s=Math.imul(lt,kt),s=s+Math.imul(dt,xt)|0,p=Math.imul(dt,kt),d=d+Math.imul(ft,St)|0,s=s+Math.imul(ft,Bt)|0,s=s+Math.imul(ht,St)|0,p=p+Math.imul(ht,Bt)|0,d=d+Math.imul(ut,Et)|0,s=s+Math.imul(ut,_t)|0,s=s+Math.imul(ct,Et)|0,p=p+Math.imul(ct,_t)|0,d=d+Math.imul(pt,It)|0,s=s+Math.imul(pt,At)|0,s=s+Math.imul(yt,It)|0,p=p+Math.imul(yt,At)|0,d=d+Math.imul(ot,Mt)|0,s=s+Math.imul(ot,Lt)|0,s=s+Math.imul(st,Mt)|0,p=p+Math.imul(st,Lt)|0,d=d+Math.imul(G,Rt)|0,s=s+Math.imul(G,Tt)|0,s=s+Math.imul(Q,Rt)|0,p=p+Math.imul(Q,Tt)|0,d=d+Math.imul(H,Pt)|0,s=s+Math.imul(H,Ct)|0,s=s+Math.imul(j,Pt)|0,p=p+Math.imul(j,Ct)|0,d=d+Math.imul(L,Ot)|0,s=s+Math.imul(L,Ut)|0,s=s+Math.imul(T,Ot)|0,p=p+Math.imul(T,Ut)|0;var Or=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Or>>>26)|0,Or&=67108863,d=Math.imul(gt,xt),s=Math.imul(gt,kt),s=s+Math.imul(mt,xt)|0,p=Math.imul(mt,kt),d=d+Math.imul(lt,St)|0,s=s+Math.imul(lt,Bt)|0,s=s+Math.imul(dt,St)|0,p=p+Math.imul(dt,Bt)|0,d=d+Math.imul(ft,Et)|0,s=s+Math.imul(ft,_t)|0,s=s+Math.imul(ht,Et)|0,p=p+Math.imul(ht,_t)|0,d=d+Math.imul(ut,It)|0,s=s+Math.imul(ut,At)|0,s=s+Math.imul(ct,It)|0,p=p+Math.imul(ct,At)|0,d=d+Math.imul(pt,Mt)|0,s=s+Math.imul(pt,Lt)|0,s=s+Math.imul(yt,Mt)|0,p=p+Math.imul(yt,Lt)|0,d=d+Math.imul(ot,Rt)|0,s=s+Math.imul(ot,Tt)|0,s=s+Math.imul(st,Rt)|0,p=p+Math.imul(st,Tt)|0,d=d+Math.imul(G,Pt)|0,s=s+Math.imul(G,Ct)|0,s=s+Math.imul(Q,Pt)|0,p=p+Math.imul(Q,Ct)|0,d=d+Math.imul(H,Ot)|0,s=s+Math.imul(H,Ut)|0,s=s+Math.imul(j,Ot)|0,p=p+Math.imul(j,Ut)|0,d=d+Math.imul(L,Nt)|0,s=s+Math.imul(L,zt)|0,s=s+Math.imul(T,Nt)|0,p=p+Math.imul(T,zt)|0;var Ur=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,d=Math.imul(bt,xt),s=Math.imul(bt,kt),s=s+Math.imul(vt,xt)|0,p=Math.imul(vt,kt),d=d+Math.imul(gt,St)|0,s=s+Math.imul(gt,Bt)|0,s=s+Math.imul(mt,St)|0,p=p+Math.imul(mt,Bt)|0,d=d+Math.imul(lt,Et)|0,s=s+Math.imul(lt,_t)|0,s=s+Math.imul(dt,Et)|0,p=p+Math.imul(dt,_t)|0,d=d+Math.imul(ft,It)|0,s=s+Math.imul(ft,At)|0,s=s+Math.imul(ht,It)|0,p=p+Math.imul(ht,At)|0,d=d+Math.imul(ut,Mt)|0,s=s+Math.imul(ut,Lt)|0,s=s+Math.imul(ct,Mt)|0,p=p+Math.imul(ct,Lt)|0,d=d+Math.imul(pt,Rt)|0,s=s+Math.imul(pt,Tt)|0,s=s+Math.imul(yt,Rt)|0,p=p+Math.imul(yt,Tt)|0,d=d+Math.imul(ot,Pt)|0,s=s+Math.imul(ot,Ct)|0,s=s+Math.imul(st,Pt)|0,p=p+Math.imul(st,Ct)|0,d=d+Math.imul(G,Ot)|0,s=s+Math.imul(G,Ut)|0,s=s+Math.imul(Q,Ot)|0,p=p+Math.imul(Q,Ut)|0,d=d+Math.imul(H,Nt)|0,s=s+Math.imul(H,zt)|0,s=s+Math.imul(j,Nt)|0,p=p+Math.imul(j,zt)|0,d=d+Math.imul(L,qt)|0,s=s+Math.imul(L,Ft)|0,s=s+Math.imul(T,qt)|0,p=p+Math.imul(T,Ft)|0;var Nr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,d=Math.imul(bt,St),s=Math.imul(bt,Bt),s=s+Math.imul(vt,St)|0,p=Math.imul(vt,Bt),d=d+Math.imul(gt,Et)|0,s=s+Math.imul(gt,_t)|0,s=s+Math.imul(mt,Et)|0,p=p+Math.imul(mt,_t)|0,d=d+Math.imul(lt,It)|0,s=s+Math.imul(lt,At)|0,s=s+Math.imul(dt,It)|0,p=p+Math.imul(dt,At)|0,d=d+Math.imul(ft,Mt)|0,s=s+Math.imul(ft,Lt)|0,s=s+Math.imul(ht,Mt)|0,p=p+Math.imul(ht,Lt)|0,d=d+Math.imul(ut,Rt)|0,s=s+Math.imul(ut,Tt)|0,s=s+Math.imul(ct,Rt)|0,p=p+Math.imul(ct,Tt)|0,d=d+Math.imul(pt,Pt)|0,s=s+Math.imul(pt,Ct)|0,s=s+Math.imul(yt,Pt)|0,p=p+Math.imul(yt,Ct)|0,d=d+Math.imul(ot,Ot)|0,s=s+Math.imul(ot,Ut)|0,s=s+Math.imul(st,Ot)|0,p=p+Math.imul(st,Ut)|0,d=d+Math.imul(G,Nt)|0,s=s+Math.imul(G,zt)|0,s=s+Math.imul(Q,Nt)|0,p=p+Math.imul(Q,zt)|0,d=d+Math.imul(H,qt)|0,s=s+Math.imul(H,Ft)|0,s=s+Math.imul(j,qt)|0,p=p+Math.imul(j,Ft)|0;var zr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(zr>>>26)|0,zr&=67108863,d=Math.imul(bt,Et),s=Math.imul(bt,_t),s=s+Math.imul(vt,Et)|0,p=Math.imul(vt,_t),d=d+Math.imul(gt,It)|0,s=s+Math.imul(gt,At)|0,s=s+Math.imul(mt,It)|0,p=p+Math.imul(mt,At)|0,d=d+Math.imul(lt,Mt)|0,s=s+Math.imul(lt,Lt)|0,s=s+Math.imul(dt,Mt)|0,p=p+Math.imul(dt,Lt)|0,d=d+Math.imul(ft,Rt)|0,s=s+Math.imul(ft,Tt)|0,s=s+Math.imul(ht,Rt)|0,p=p+Math.imul(ht,Tt)|0,d=d+Math.imul(ut,Pt)|0,s=s+Math.imul(ut,Ct)|0,s=s+Math.imul(ct,Pt)|0,p=p+Math.imul(ct,Ct)|0,d=d+Math.imul(pt,Ot)|0,s=s+Math.imul(pt,Ut)|0,s=s+Math.imul(yt,Ot)|0,p=p+Math.imul(yt,Ut)|0,d=d+Math.imul(ot,Nt)|0,s=s+Math.imul(ot,zt)|0,s=s+Math.imul(st,Nt)|0,p=p+Math.imul(st,zt)|0,d=d+Math.imul(G,qt)|0,s=s+Math.imul(G,Ft)|0,s=s+Math.imul(Q,qt)|0,p=p+Math.imul(Q,Ft)|0;var qr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(qr>>>26)|0,qr&=67108863,d=Math.imul(bt,It),s=Math.imul(bt,At),s=s+Math.imul(vt,It)|0,p=Math.imul(vt,At),d=d+Math.imul(gt,Mt)|0,s=s+Math.imul(gt,Lt)|0,s=s+Math.imul(mt,Mt)|0,p=p+Math.imul(mt,Lt)|0,d=d+Math.imul(lt,Rt)|0,s=s+Math.imul(lt,Tt)|0,s=s+Math.imul(dt,Rt)|0,p=p+Math.imul(dt,Tt)|0,d=d+Math.imul(ft,Pt)|0,s=s+Math.imul(ft,Ct)|0,s=s+Math.imul(ht,Pt)|0,p=p+Math.imul(ht,Ct)|0,d=d+Math.imul(ut,Ot)|0,s=s+Math.imul(ut,Ut)|0,s=s+Math.imul(ct,Ot)|0,p=p+Math.imul(ct,Ut)|0,d=d+Math.imul(pt,Nt)|0,s=s+Math.imul(pt,zt)|0,s=s+Math.imul(yt,Nt)|0,p=p+Math.imul(yt,zt)|0,d=d+Math.imul(ot,qt)|0,s=s+Math.imul(ot,Ft)|0,s=s+Math.imul(st,qt)|0,p=p+Math.imul(st,Ft)|0;var Fr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,d=Math.imul(bt,Mt),s=Math.imul(bt,Lt),s=s+Math.imul(vt,Mt)|0,p=Math.imul(vt,Lt),d=d+Math.imul(gt,Rt)|0,s=s+Math.imul(gt,Tt)|0,s=s+Math.imul(mt,Rt)|0,p=p+Math.imul(mt,Tt)|0,d=d+Math.imul(lt,Pt)|0,s=s+Math.imul(lt,Ct)|0,s=s+Math.imul(dt,Pt)|0,p=p+Math.imul(dt,Ct)|0,d=d+Math.imul(ft,Ot)|0,s=s+Math.imul(ft,Ut)|0,s=s+Math.imul(ht,Ot)|0,p=p+Math.imul(ht,Ut)|0,d=d+Math.imul(ut,Nt)|0,s=s+Math.imul(ut,zt)|0,s=s+Math.imul(ct,Nt)|0,p=p+Math.imul(ct,zt)|0,d=d+Math.imul(pt,qt)|0,s=s+Math.imul(pt,Ft)|0,s=s+Math.imul(yt,qt)|0,p=p+Math.imul(yt,Ft)|0;var Kr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,d=Math.imul(bt,Rt),s=Math.imul(bt,Tt),s=s+Math.imul(vt,Rt)|0,p=Math.imul(vt,Tt),d=d+Math.imul(gt,Pt)|0,s=s+Math.imul(gt,Ct)|0,s=s+Math.imul(mt,Pt)|0,p=p+Math.imul(mt,Ct)|0,d=d+Math.imul(lt,Ot)|0,s=s+Math.imul(lt,Ut)|0,s=s+Math.imul(dt,Ot)|0,p=p+Math.imul(dt,Ut)|0,d=d+Math.imul(ft,Nt)|0,s=s+Math.imul(ft,zt)|0,s=s+Math.imul(ht,Nt)|0,p=p+Math.imul(ht,zt)|0,d=d+Math.imul(ut,qt)|0,s=s+Math.imul(ut,Ft)|0,s=s+Math.imul(ct,qt)|0,p=p+Math.imul(ct,Ft)|0;var Dr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,d=Math.imul(bt,Pt),s=Math.imul(bt,Ct),s=s+Math.imul(vt,Pt)|0,p=Math.imul(vt,Ct),d=d+Math.imul(gt,Ot)|0,s=s+Math.imul(gt,Ut)|0,s=s+Math.imul(mt,Ot)|0,p=p+Math.imul(mt,Ut)|0,d=d+Math.imul(lt,Nt)|0,s=s+Math.imul(lt,zt)|0,s=s+Math.imul(dt,Nt)|0,p=p+Math.imul(dt,zt)|0,d=d+Math.imul(ft,qt)|0,s=s+Math.imul(ft,Ft)|0,s=s+Math.imul(ht,qt)|0,p=p+Math.imul(ht,Ft)|0;var Wr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,d=Math.imul(bt,Ot),s=Math.imul(bt,Ut),s=s+Math.imul(vt,Ot)|0,p=Math.imul(vt,Ut),d=d+Math.imul(gt,Nt)|0,s=s+Math.imul(gt,zt)|0,s=s+Math.imul(mt,Nt)|0,p=p+Math.imul(mt,zt)|0,d=d+Math.imul(lt,qt)|0,s=s+Math.imul(lt,Ft)|0,s=s+Math.imul(dt,qt)|0,p=p+Math.imul(dt,Ft)|0;var Hr=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,d=Math.imul(bt,Nt),s=Math.imul(bt,zt),s=s+Math.imul(vt,Nt)|0,p=Math.imul(vt,zt),d=d+Math.imul(gt,qt)|0,s=s+Math.imul(gt,Ft)|0,s=s+Math.imul(mt,qt)|0,p=p+Math.imul(mt,Ft)|0;var $r=(b+d|0)+((s&8191)<<13)|0;b=(p+(s>>>13)|0)+($r>>>26)|0,$r&=67108863,d=Math.imul(bt,qt),s=Math.imul(bt,Ft),s=s+Math.imul(vt,qt)|0,p=Math.imul(vt,Ft);var Vr=(b+d|0)+((s&8191)<<13)|0;return b=(p+(s>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,g[0]=Ar,g[1]=Mr,g[2]=Lr,g[3]=Rr,g[4]=Tr,g[5]=Pr,g[6]=Cr,g[7]=Or,g[8]=Ur,g[9]=Nr,g[10]=zr,g[11]=qr,g[12]=Fr,g[13]=Kr,g[14]=Dr,g[15]=Wr,g[16]=Hr,g[17]=$r,g[18]=Vr,b!==0&&(g[19]=b,c.length++),c};Math.imul||(U=B);function K(y,n,a){a.negative=n.negative^y.negative,a.length=y.length+n.length;for(var c=0,f=0,l=0;l>>26)|0,f+=g>>>26,g&=67108863}a.words[l]=b,c=g,g=f}return c!==0?a.words[l]=c:a.length--,a._strip()}function N(y,n,a){return K(y,n,a)}o.prototype.mulTo=function(n,a){var c,f=this.length+n.length;return this.length===10&&n.length===10?c=U(this,n,a):f<63?c=B(this,n,a):f<1024?c=K(this,n,a):c=N(this,n,a),c};function F(y,n){this.x=y,this.y=n}F.prototype.makeRBT=function(n){for(var a=new Array(n),c=o.prototype._countBits(n)-1,f=0;f>=1;return f},F.prototype.permute=function(n,a,c,f,l,g){for(var b=0;b>>1)l++;return 1<>>13,c[2*g+1]=l&8191,l=l>>>13;for(g=2*a;g>=26,c+=l/67108864|0,c+=g>>>26,this.words[f]=g&67108863}return c!==0&&(this.words[f]=c,this.length++),a?this.ineg():this},o.prototype.muln=function(n){return this.clone().imuln(n)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(n){var a=R(n);if(a.length===0)return new o(1);for(var c=this,f=0;f=0);var a=n%26,c=(n-a)/26,f=67108863>>>26-a<<26-a,l;if(a!==0){var g=0;for(l=0;l>>26-a}g&&(this.words[l]=g,this.length++)}if(c!==0){for(l=this.length-1;l>=0;l--)this.words[l+c]=this.words[l];for(l=0;l=0);var f;a?f=(a-a%26)/26:f=0;var l=n%26,g=Math.min((n-l)/26,this.length),b=67108863^67108863>>>l<g)for(this.length-=g,s=0;s=0&&(p!==0||s>=f);s--){var _=this.words[s]|0;this.words[s]=p<<26-l|_>>>l,p=_&b}return d&&p!==0&&(d.words[d.length++]=p),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(n,a,c){return e(this.negative===0),this.iushrn(n,a,c)},o.prototype.shln=function(n){return this.clone().ishln(n)},o.prototype.ushln=function(n){return this.clone().iushln(n)},o.prototype.shrn=function(n){return this.clone().ishrn(n)},o.prototype.ushrn=function(n){return this.clone().iushrn(n)},o.prototype.testn=function(n){e(typeof n=="number"&&n>=0);var a=n%26,c=(n-a)/26,f=1<=0);var a=n%26,c=(n-a)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=c)return this;if(a!==0&&c++,this.length=Math.min(c,this.length),a!==0){var f=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},o.prototype.isubn=function(n){if(e(typeof n=="number"),e(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(d/67108864|0),this.words[l+c]=g&67108863}for(;l>26,this.words[l+c]=g&67108863;if(b===0)return this._strip();for(e(b===-1),b=0,l=0;l>26,this.words[l]=g&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(n,a){var c=this.length-n.length,f=this.clone(),l=n,g=l.words[l.length-1]|0,b=this._countBits(g);c=26-b,c!==0&&(l=l.ushln(c),f.iushln(c),g=l.words[l.length-1]|0);var d=f.length-l.length,s;if(a!=="mod"){s=new o(null),s.length=d+1,s.words=new Array(s.length);for(var p=0;p=0;L--){var T=(f.words[l.length+L]|0)*67108864+(f.words[l.length+L-1]|0);for(T=Math.min(T/g|0,67108863),f._ishlnsubmul(l,T,L);f.negative!==0;)T--,f.negative=0,f._ishlnsubmul(l,1,L),f.isZero()||(f.negative^=1);s&&(s.words[L]=T)}return s&&s._strip(),f._strip(),a!=="div"&&c!==0&&f.iushrn(c),{div:s||null,mod:f}},o.prototype.divmod=function(n,a,c){if(e(!n.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var f,l,g;return this.negative!==0&&n.negative===0?(g=this.neg().divmod(n,a),a!=="mod"&&(f=g.div.neg()),a!=="div"&&(l=g.mod.neg(),c&&l.negative!==0&&l.iadd(n)),{div:f,mod:l}):this.negative===0&&n.negative!==0?(g=this.divmod(n.neg(),a),a!=="mod"&&(f=g.div.neg()),{div:f,mod:g.mod}):this.negative&n.negative?(g=this.neg().divmod(n.neg(),a),a!=="div"&&(l=g.mod.neg(),c&&l.negative!==0&&l.isub(n)),{div:g.div,mod:l}):n.length>this.length||this.cmp(n)<0?{div:new o(0),mod:this}:n.length===1?a==="div"?{div:this.divn(n.words[0]),mod:null}:a==="mod"?{div:null,mod:new o(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new o(this.modrn(n.words[0]))}:this._wordDiv(n,a)},o.prototype.div=function(n){return this.divmod(n,"div",!1).div},o.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},o.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},o.prototype.divRound=function(n){var a=this.divmod(n);if(a.mod.isZero())return a.div;var c=a.div.negative!==0?a.mod.isub(n):a.mod,f=n.ushrn(1),l=n.andln(1),g=c.cmp(f);return g<0||l===1&&g===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},o.prototype.modrn=function(n){var a=n<0;a&&(n=-n),e(n<=67108863);for(var c=(1<<26)%n,f=0,l=this.length-1;l>=0;l--)f=(c*f+(this.words[l]|0))%n;return a?-f:f},o.prototype.modn=function(n){return this.modrn(n)},o.prototype.idivn=function(n){var a=n<0;a&&(n=-n),e(n<=67108863);for(var c=0,f=this.length-1;f>=0;f--){var l=(this.words[f]|0)+c*67108864;this.words[f]=l/n|0,c=l%n}return this._strip(),a?this.ineg():this},o.prototype.divn=function(n){return this.clone().idivn(n)},o.prototype.egcd=function(n){e(n.negative===0),e(!n.isZero());var a=this,c=n.clone();a.negative!==0?a=a.umod(n):a=a.clone();for(var f=new o(1),l=new o(0),g=new o(0),b=new o(1),d=0;a.isEven()&&c.isEven();)a.iushrn(1),c.iushrn(1),++d;for(var s=c.clone(),p=a.clone();!a.isZero();){for(var _=0,L=1;!(a.words[0]&L)&&_<26;++_,L<<=1);if(_>0)for(a.iushrn(_);_-- >0;)(f.isOdd()||l.isOdd())&&(f.iadd(s),l.isub(p)),f.iushrn(1),l.iushrn(1);for(var T=0,q=1;!(c.words[0]&q)&&T<26;++T,q<<=1);if(T>0)for(c.iushrn(T);T-- >0;)(g.isOdd()||b.isOdd())&&(g.iadd(s),b.isub(p)),g.iushrn(1),b.iushrn(1);a.cmp(c)>=0?(a.isub(c),f.isub(g),l.isub(b)):(c.isub(a),g.isub(f),b.isub(l))}return{a:g,b,gcd:c.iushln(d)}},o.prototype._invmp=function(n){e(n.negative===0),e(!n.isZero());var a=this,c=n.clone();a.negative!==0?a=a.umod(n):a=a.clone();for(var f=new o(1),l=new o(0),g=c.clone();a.cmpn(1)>0&&c.cmpn(1)>0;){for(var b=0,d=1;!(a.words[0]&d)&&b<26;++b,d<<=1);if(b>0)for(a.iushrn(b);b-- >0;)f.isOdd()&&f.iadd(g),f.iushrn(1);for(var s=0,p=1;!(c.words[0]&p)&&s<26;++s,p<<=1);if(s>0)for(c.iushrn(s);s-- >0;)l.isOdd()&&l.iadd(g),l.iushrn(1);a.cmp(c)>=0?(a.isub(c),f.isub(l)):(c.isub(a),l.isub(f))}var _;return a.cmpn(1)===0?_=f:_=l,_.cmpn(0)<0&&_.iadd(n),_},o.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var a=this.clone(),c=n.clone();a.negative=0,c.negative=0;for(var f=0;a.isEven()&&c.isEven();f++)a.iushrn(1),c.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;c.isEven();)c.iushrn(1);var l=a.cmp(c);if(l<0){var g=a;a=c,c=g}else if(l===0||c.cmpn(1)===0)break;a.isub(c)}while(!0);return c.iushln(f)},o.prototype.invm=function(n){return this.egcd(n).a.umod(n)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(n){return this.words[0]&n},o.prototype.bincn=function(n){e(typeof n=="number");var a=n%26,c=(n-a)/26,f=1<>>26,b&=67108863,this.words[g]=b}return l!==0&&(this.words[g]=l,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(n){var a=n<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this._strip();var c;if(this.length>1)c=1;else{a&&(n=-n),e(n<=67108863,"Number is too big");var f=this.words[0]|0;c=f===n?0:fn.length)return 1;if(this.length=0;c--){var f=this.words[c]|0,l=n.words[c]|0;if(f!==l){fl&&(a=1);break}}return a},o.prototype.gtn=function(n){return this.cmpn(n)===1},o.prototype.gt=function(n){return this.cmp(n)===1},o.prototype.gten=function(n){return this.cmpn(n)>=0},o.prototype.gte=function(n){return this.cmp(n)>=0},o.prototype.ltn=function(n){return this.cmpn(n)===-1},o.prototype.lt=function(n){return this.cmp(n)===-1},o.prototype.lten=function(n){return this.cmpn(n)<=0},o.prototype.lte=function(n){return this.cmp(n)<=0},o.prototype.eqn=function(n){return this.cmpn(n)===0},o.prototype.eq=function(n){return this.cmp(n)===0},o.red=function(n){return new V(n)},o.prototype.toRed=function(n){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(n){return this.red=n,this},o.prototype.forceRed=function(n){return e(!this.red,"Already a number in reduction context"),this._forceRed(n)},o.prototype.redAdd=function(n){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},o.prototype.redIAdd=function(n){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},o.prototype.redSub=function(n){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},o.prototype.redISub=function(n){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},o.prototype.redShl=function(n){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},o.prototype.redMul=function(n){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},o.prototype.redIMul=function(n){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(n){return e(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var tt={k256:null,p224:null,p192:null,p25519:null};function D(y,n){this.name=y,this.p=new o(n,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}D.prototype._tmp=function(){var n=new o(null);return n.words=new Array(Math.ceil(this.n/13)),n},D.prototype.ireduce=function(n){var a=n,c;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),c=a.bitLength();while(c>this.n);var f=c0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},D.prototype.split=function(n,a){n.iushrn(this.n,0,a)},D.prototype.imulK=function(n){return n.imul(this.k)};function Z(){D.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(Z,D),Z.prototype.split=function(n,a){for(var c=4194303,f=Math.min(n.length,9),l=0;l>>22,g=b}g>>>=22,n.words[l-10]=g,g===0&&n.length>10?n.length-=10:n.length-=9},Z.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var a=0,c=0;c>>=26,n.words[c]=l,a=f}return a!==0&&(n.words[n.length++]=a),n},o._prime=function(n){if(tt[n])return tt[n];var a;if(n==="k256")a=new Z;else if(n==="p224")a=new X;else if(n==="p192")a=new et;else if(n==="p25519")a=new Yt;else throw new Error("Unknown prime "+n);return tt[n]=a,a};function V(y){if(typeof y=="string"){var n=o._prime(y);this.m=n.p,this.prime=n}else e(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}V.prototype._verify1=function(n){e(n.negative===0,"red works only with positives"),e(n.red,"red works only with red numbers")},V.prototype._verify2=function(n,a){e((n.negative|a.negative)===0,"red works only with positives"),e(n.red&&n.red===a.red,"red works only with red numbers")},V.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(x(n,n.umod(this.m)._forceRed(this)),n)},V.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},V.prototype.add=function(n,a){this._verify2(n,a);var c=n.add(a);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},V.prototype.iadd=function(n,a){this._verify2(n,a);var c=n.iadd(a);return c.cmp(this.m)>=0&&c.isub(this.m),c},V.prototype.sub=function(n,a){this._verify2(n,a);var c=n.sub(a);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},V.prototype.isub=function(n,a){this._verify2(n,a);var c=n.isub(a);return c.cmpn(0)<0&&c.iadd(this.m),c},V.prototype.shl=function(n,a){return this._verify1(n),this.imod(n.ushln(a))},V.prototype.imul=function(n,a){return this._verify2(n,a),this.imod(n.imul(a))},V.prototype.mul=function(n,a){return this._verify2(n,a),this.imod(n.mul(a))},V.prototype.isqr=function(n){return this.imul(n,n.clone())},V.prototype.sqr=function(n){return this.mul(n,n)},V.prototype.sqrt=function(n){if(n.isZero())return n.clone();var a=this.m.andln(3);if(e(a%2===1),a===3){var c=this.m.add(new o(1)).iushrn(2);return this.pow(n,c)}for(var f=this.m.subn(1),l=0;!f.isZero()&&f.andln(1)===0;)l++,f.iushrn(1);e(!f.isZero());var g=new o(1).toRed(this),b=g.redNeg(),d=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);this.pow(s,d).cmp(b)!==0;)s.redIAdd(b);for(var p=this.pow(s,f),_=this.pow(n,f.addn(1).iushrn(1)),L=this.pow(n,f),T=l;L.cmp(g)!==0;){for(var q=L,H=0;q.cmp(g)!==0;H++)q=q.redSqr();e(H=0;l--){for(var p=a.words[l],_=s-1;_>=0;_--){var L=p>>_&1;if(g!==f[0]&&(g=this.sqr(g)),L===0&&b===0){d=0;continue}b<<=1,b|=L,d++,!(d!==c&&(l!==0||_!==0))&&(g=this.mul(g,f[b]),d=0,b=0)}s=26}return g},V.prototype.convertTo=function(n){var a=n.umod(this.m);return a===n?a.clone():a},V.prototype.convertFrom=function(n){var a=n.clone();return a.red=null,a},o.mont=function(n){return new nt(n)};function nt(y){V.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(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)}i(nt,V),nt.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},nt.prototype.convertFrom=function(n){var a=this.imod(n.mul(this.rinv));return a.red=null,a},nt.prototype.imul=function(n,a){if(n.isZero()||a.isZero())return n.words[0]=0,n.length=1,n;var c=n.imul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=c.isub(f).iushrn(this.shift),g=l;return l.cmp(this.m)>=0?g=l.isub(this.m):l.cmpn(0)<0&&(g=l.iadd(this.m)),g._forceRed(this)},nt.prototype.mul=function(n,a){if(n.isZero()||a.isZero())return new o(0)._forceRed(this);var c=n.mul(a),f=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=c.isub(f).iushrn(this.shift),g=l;return l.cmp(this.m)>=0?g=l.isub(this.m):l.cmpn(0)<0&&(g=l.iadd(this.m)),g._forceRed(this)},nt.prototype.invm=function(n){var a=this.imod(n._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(typeof xs>"u"||xs,vu)});var Su=oe((_p,ku)=>{var Ip=P(O()),Yh=ws(),Jh="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";ku.exports=Yh(Jh)});var Bu=oe(Bs=>{"use strict";var Mp=P(O());function Je(r,t,e){return t<=r&&r<=e}function $i(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function Xh(r){for(var t=String(r),e=t.length,i=0,o=[];i57343)o.push(u);else if(56320<=u&&u<=57343)o.push(65533);else if(55296<=u&&u<=56319)if(i===e-1)o.push(65533);else{var h=r.charCodeAt(i+1);if(56320<=h&&h<=57343){var w=u&1023,m=h&1023;o.push(65536+(w<<10)+m),i+=1}else o.push(65533)}i+=1}return o}function Qh(r){for(var t="",e=0;e>10)+55296,(i&1023)+56320))}return t}var Ki=-1;function Ss(r){this.tokens=[].slice.call(r)}Ss.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():Ki},prepend:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.push(t.shift());else this.tokens.push(r)}};var kn=-1;function ks(r,t){if(r)throw TypeError("Decoder error");return t||65533}var Di="utf-8";function Wi(r,t){if(!(this instanceof Wi))return new Wi(r,t);if(r=r!==void 0?String(r).toLowerCase():Di,r!==Di)throw new Error("Encoding not supported. Only utf-8 is supported");t=$i(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}Wi.prototype={decode:function(t,e){var i;typeof t=="object"&&t instanceof ArrayBuffer?i=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):i=new Uint8Array(0),e=$i(e),this._streaming||(this._decoder=new tl({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var o=new Ss(i),u=[],h;!o.endOfStream()&&(h=this._decoder.handler(o,o.read()),h!==kn);)h!==null&&(Array.isArray(h)?u.push.apply(u,h):u.push(h));if(!this._streaming){do{if(h=this._decoder.handler(o,o.read()),h===kn)break;h!==null&&(Array.isArray(h)?u.push.apply(u,h):u.push(h))}while(!o.endOfStream());this._decoder=null}return u.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(u[0]===65279?(this._BOMseen=!0,u.shift()):this._BOMseen=!0),Qh(u)}};function Hi(r,t){if(!(this instanceof Hi))return new Hi(r,t);if(r=r!==void 0?String(r).toLowerCase():Di,r!==Di)throw new Error("Encoding not supported. Only utf-8 is supported");t=$i(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}Hi.prototype={encode:function(t,e){t=t?String(t):"",e=$i(e),this._streaming||(this._encoder=new el(this._options)),this._streaming=!!e.stream;for(var i=[],o=new Ss(Xh(t)),u;!o.endOfStream()&&(u=this._encoder.handler(o,o.read()),u!==kn);)Array.isArray(u)?i.push.apply(i,u):i.push(u);if(!this._streaming){for(;u=this._encoder.handler(o,o.read()),u!==kn;)Array.isArray(u)?i.push.apply(i,u):i.push(u);this._encoder=null}return new Uint8Array(i)}};function tl(r){var t=r.fatal,e=0,i=0,o=0,u=128,h=191;this.handler=function(w,m){if(m===Ki&&o!==0)return o=0,ks(t);if(m===Ki)return kn;if(o===0){if(Je(m,0,127))return m;if(Je(m,194,223))o=1,e=m-192;else if(Je(m,224,239))m===224&&(u=160),m===237&&(h=159),o=2,e=m-224;else if(Je(m,240,244))m===240&&(u=144),m===244&&(h=143),o=3,e=m-240;else return ks(t);return e=e<<6*o,null}if(!Je(m,u,h))return e=o=i=0,u=128,h=191,w.prepend(m),ks(t);if(u=128,h=191,i+=1,e+=m-128<<6*(o-i),i!==o)return null;var x=e;return e=o=i=0,x}}function el(r){var t=r.fatal;this.handler=function(e,i){if(i===Ki)return kn;if(Je(i,0,127))return i;var o,u;Je(i,128,2047)?(o=1,u=192):Je(i,2048,65535)?(o=2,u=224):Je(i,65536,1114111)&&(o=3,u=240);for(var h=[(i>>6*o)+u];o>0;){var w=i>>6*(o-1);h.push(128|w&63),o-=1}return h}}Bs.TextEncoder=Hi;Bs.TextDecoder=Wi});var Mu=oe(jt=>{"use strict";var Rp=P(O()),rl=jt&&jt.__createBinding||(Object.create?function(r,t,e,i){i===void 0&&(i=e),Object.defineProperty(r,i,{enumerable:!0,get:function(){return t[e]}})}:function(r,t,e,i){i===void 0&&(i=e),r[i]=t[e]}),nl=jt&&jt.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),De=jt&&jt.__decorate||function(r,t,e,i){var o=arguments.length,u=o<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(r,t,e,i);else for(var w=r.length-1;w>=0;w--)(h=r[w])&&(u=(o<3?h(u):o>3?h(t,e,u):h(t,e))||u);return o>3&&u&&Object.defineProperty(t,e,u),u},il=jt&&jt.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.hasOwnProperty.call(r,e)&&rl(t,r,e);return nl(t,r),t},Eu=jt&&jt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(jt,"__esModule",{value:!0});jt.deserializeUnchecked=jt.deserialize=jt.serialize=jt.BinaryReader=jt.BinaryWriter=jt.BorshError=jt.baseDecode=jt.baseEncode=void 0;var mr=Eu(xu()),_u=Eu(Su()),ol=il(Bu()),sl=typeof TextDecoder!="function"?ol.TextDecoder:TextDecoder,al=new sl("utf-8",{fatal:!0});function ul(r){return typeof r=="string"&&(r=Buffer.from(r,"utf8")),_u.default.encode(Buffer.from(r))}jt.baseEncode=ul;function cl(r){return Buffer.from(_u.default.decode(r))}jt.baseDecode=cl;var Es=1024,he=class extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}};jt.BorshError=he;var Vi=class{constructor(){this.buf=Buffer.alloc(Es),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(Es)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mr.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mr.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mr.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mr.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),t,Buffer.alloc(Es)]),this.length+=t.length}writeString(t){this.maybeResize();let e=Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(let i of t)this.maybeResize(),e(i)}toArray(){return this.buf.subarray(0,this.length)}};jt.BinaryWriter=Vi;function We(r,t,e){let i=e.value;e.value=function(...o){try{return i.apply(this,o)}catch(u){if(u instanceof RangeError){let h=u.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(h)>=0)throw new he("Reached the end of buffer when deserializing")}throw u}}}var xe=class{constructor(t){this.buf=t,this.offset=0}readU8(){let t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){let t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){let t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){let t=this.readBuffer(8);return new mr.default(t,"le")}readU128(){let t=this.readBuffer(16);return new mr.default(t,"le")}readU256(){let t=this.readBuffer(32);return new mr.default(t,"le")}readU512(){let t=this.readBuffer(64);return new mr.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new he(`Expected buffer length ${t} isn\'t within bounds`);let e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){let t=this.readU32(),e=this.readBuffer(t);try{return al.decode(e)}catch(i){throw new he(`Error decoding UTF-8 string: ${i}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){let e=this.readU32(),i=Array();for(let o=0;o{on(r,t,u,i[0],o)});else if(i.kind!==void 0)switch(i.kind){case"option":{e==null?o.writeU8(0):(o.writeU8(1),on(r,t,e,i.type,o));break}case"map":{o.writeU32(e.size),e.forEach((u,h)=>{on(r,t,h,i.key,o),on(r,t,u,i.value,o)});break}default:throw new he(`FieldType ${i} unrecognized`)}else Au(r,e,o)}catch(u){throw u instanceof he&&u.addToFieldPath(t),u}}function Au(r,t,e){if(typeof t.borshSerialize=="function"){t.borshSerialize(e);return}let i=r.get(t.constructor);if(!i)throw new he(`Class ${t.constructor.name} is missing in schema`);if(i.kind==="struct")i.fields.map(([o,u])=>{on(r,o,t[o],u,e)});else if(i.kind==="enum"){let o=t[i.field];for(let u=0;usn(r,t,e[0],i))}if(e.kind==="option")return i.readU8()?sn(r,t,e.type,i):void 0;if(e.kind==="map"){let o=new Map,u=i.readU32();for(let h=0;h=i.values.length)throw new he(`Enum index: ${o} is out of range`);let[u,h]=i.values[o],w=sn(r,u,h,e);return new t({[u]:w})}throw new he(`Unexpected schema kind: ${i.kind} for ${t.constructor.name}`)}function hl(r,t,e,i=xe){let o=new i(e),u=_s(r,t,o);if(o.offset{"use strict";var Pp=P(O());Object.defineProperty(A,"__esModule",{value:!0});A.s16=A.s8=A.nu64be=A.u48be=A.u40be=A.u32be=A.u24be=A.u16be=A.nu64=A.u48=A.u40=A.u32=A.u24=A.u16=A.u8=A.offset=A.greedy=A.Constant=A.UTF8=A.CString=A.Blob=A.Boolean=A.BitField=A.BitStructure=A.VariantLayout=A.Union=A.UnionLayoutDiscriminator=A.UnionDiscriminator=A.Structure=A.Sequence=A.DoubleBE=A.Double=A.FloatBE=A.Float=A.NearInt64BE=A.NearInt64=A.NearUInt64BE=A.NearUInt64=A.IntBE=A.Int=A.UIntBE=A.UInt=A.OffsetLayout=A.GreedyCount=A.ExternalLayout=A.bindConstructorLayout=A.nameWithProperty=A.Layout=A.uint8ArrayToBuffer=A.checkUint8Array=void 0;A.constant=A.utf8=A.cstr=A.blob=A.unionLayoutDiscriminator=A.union=A.seq=A.bits=A.struct=A.f64be=A.f64=A.f32be=A.f32=A.ns64be=A.s48be=A.s40be=A.s32be=A.s24be=A.s16be=A.ns64=A.s48=A.s40=A.s32=A.s24=void 0;var As=mn();function En(r){if(!(r instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}A.checkUint8Array=En;function $t(r){return En(r),As.Buffer.from(r.buffer,r.byteOffset,r.length)}A.uint8ArrayToBuffer=$t;var Gt=class{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){let e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}};A.Layout=Gt;function Ms(r,t){return t.property?r+"["+t.property+"]":r}A.nameWithProperty=Ms;function dl(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Gt))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(e,i){return t.encode(this,e,i)},writable:!0}),Object.defineProperty(r,"decode",{value(e,i){return t.decode(e,i)},writable:!0})}A.bindConstructorLayout=dl;var de=class extends Gt{isCount(){throw new Error("ExternalLayout is abstract")}};A.ExternalLayout=de;var Gi=class extends de{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){En(t);let i=t.length-e;return Math.floor(i/this.elementSpan)}encode(t,e,i){return 0}};A.GreedyCount=Gi;var Qn=class extends de{constructor(t,e=0,i){if(!(t instanceof Gt))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,i||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof _e||this.layout instanceof Ae}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,i=0){return this.layout.encode(t,e,i+this.offset)}};A.OffsetLayout=Qn;var _e=class extends Gt{constructor(t,e){if(super(t,e),6h+o.encode(w,e,i+h),0);return this.count instanceof de&&this.count.encode(t.length,e,i),u}};A.Sequence=ro;var no=class extends Gt{constructor(t,e,i){if(!(Array.isArray(t)&&t.reduce((u,h)=>u&&h instanceof Gt,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&i===void 0&&(i=e,e=void 0);for(let u of t)if(0>u.span&&u.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let o=-1;try{o=t.reduce((u,h)=>u+h.getSpan(),0)}catch{}super(o,e),this.fields=t,this.decodePrefixes=!!i}getSpan(t,e=0){if(0<=this.span)return this.span;let i=0;try{i=this.fields.reduce((o,u)=>{let h=u.getSpan(t,e);return e+=h,o+h},0)}catch{throw new RangeError("indeterminate span")}return i}decode(t,e=0){En(t);let i=this.makeDestinationObject();for(let o of this.fields)if(o.property!==void 0&&(i[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return i}encode(t,e,i=0){let o=i,u=0,h=0;for(let w of this.fields){let m=w.span;if(h=0m&&(m=w.getSpan(e,i)))}u=i,i+=m}return u+h-o}fromArray(t){let e=this.makeDestinationObject();for(let i of this.fields)i.property!==void 0&&0i.span?e=-1:0<=e&&(e+=i.span)}}};A.Structure=no;var ti=class{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,i){throw new Error("UnionDiscriminator is abstract")}};A.UnionDiscriminator=ti;var Bn=class extends ti{constructor(t,e){if(!(t instanceof de&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,i){return this.layout.encode(t,e,i)}};A.UnionLayoutDiscriminator=Bn;var ei=class extends Gt{constructor(t,e,i){let o;if(t instanceof _e||t instanceof Ae)o=new Bn(new Qn(t));else if(t instanceof de&&t.isCount())o=new Bn(t);else if(t instanceof ti)o=t;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Gt))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let u=-1;e&&(u=e.span,0<=u&&(t instanceof _e||t instanceof Ae)&&(u+=o.layout.span)),super(u,i),this.discriminator=o,this.usesPrefixDiscriminator=t instanceof _e||t instanceof Ae,this.defaultLayout=e,this.registry={};let h=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(w){return h(w)},this.configGetSourceVariant=function(w){h=w.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;let i=this.getVariant(t,e);if(!i)throw new Error("unable to determine span for unrecognized variant");return i.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;let e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(let e in this.registry){let i=this.registry[e];if(i.property&&Object.prototype.hasOwnProperty.call(t,i.property))return i}throw new Error("unable to infer src variant")}decode(t,e=0){let i,o=this.discriminator,u=o.decode(t,e),h=this.registry[u];if(h===void 0){let w=this.defaultLayout,m=0;this.usesPrefixDiscriminator&&(m=o.layout.span),i=this.makeDestinationObject(),i[o.property]=u,i[w.property]=w.decode(t,e+m)}else i=h.decode(t,e);return i}encode(t,e,i=0){let o=this.getSourceVariant(t);if(o===void 0){let u=this.discriminator,h=this.defaultLayout,w=0;return this.usesPrefixDiscriminator&&(w=u.layout.span),u.encode(t[u.property],e,i),w+h.encode(t[h.property],e,i+w)}return o.encode(t,e,i)}addVariant(t,e,i){let o=new io(this,t,e,i);return this.registry[t]=o,o}getVariant(t,e=0){let i;return t instanceof Uint8Array?i=this.discriminator.decode(t,e):i=t,this.registry[i]}};A.Union=ei;var io=class extends Gt{constructor(t,e,i,o){if(!(t instanceof ei))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof i=="string"&&o===void 0&&(o=i,i=null),i){if(!(i instanceof Gt))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=i.span&&i.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof o!="string")throw new TypeError("variant must have a String property")}let u=t.span;0>t.span&&(u=i?i.span:0,0<=u&&t.usesPrefixDiscriminator&&(u+=t.discriminator.layout.span)),super(u,o),this.union=t,this.variant=e,this.layout=i||null}getSpan(t,e=0){if(0<=this.span)return this.span;let i=0;this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span);let o=0;return this.layout&&(o=this.layout.getSpan(t,e+i)),i+o}decode(t,e=0){let i=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let o=0;return this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout?i[this.property]=this.layout.decode(t,e+o):this.property?i[this.property]=!0:this.union.usesPrefixDiscriminator&&(i[this.union.discriminator.property]=this.variant),i}encode(t,e,i=0){let o=0;if(this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,i);let u=o;if(this.layout&&(this.layout.encode(t[this.property],e,i+o),u+=this.layout.getSpan(e,i+o),0<=this.union.span&&u>this.union.span))throw new Error("encoded variant overruns containing union");return u}fromArray(t){if(this.layout)return this.layout.fromArray(t)}};A.VariantLayout=io;function Sn(r){return 0>r&&(r+=4294967296),r}var ri=class extends Gt{constructor(t,e,i){if(!(t instanceof _e||t instanceof Ae))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&i===void 0&&(i=e,e=!1),4=e)throw new TypeError("bits must be positive integer");let o=8*t.span,u=t.fields.reduce((h,w)=>h+w.bits,0);if(e+u>o)throw new Error("bits too long for span remainder ("+(o-u)+" of "+o+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==Sn(t&this.valueMask))throw new TypeError(Ms("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let e=this.container._packedGetValue(),i=Sn(t<i&&(i=this.length.decode(t,e)),i}decode(t,e=0){let i=this.span;return 0>i&&(i=this.length.decode(t,e)),$t(t).slice(e,e+i)}encode(t,e,i){let o=this.length;if(this.length instanceof de&&(o=t.length),!(t instanceof Uint8Array&&o===t.length))throw new TypeError(Ms("Blob.encode",this)+" requires (length "+o+") Uint8Array as src");if(i+o>e.length)throw new RangeError("encoding overruns Uint8Array");let u=$t(t);return $t(e).write(u.toString("hex"),i,o,"hex"),this.length instanceof de&&this.length.encode(o,e,i),o}};A.Blob=so;var ao=class extends Gt{constructor(t){super(-1,t)}getSpan(t,e=0){En(t);let i=e;for(;ie.length)throw new RangeError("encoding overruns Buffer");let h=$t(e);return o.copy(h,i),h[i+u]=0,u+1}};A.CString=ao;var uo=class extends Gt{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return En(t),t.length-e}decode(t,e=0){let i=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return o.copy($t(e),i),u}};A.UTF8=uo;var co=class extends Gt{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,i){return 0}};A.Constant=co;A.greedy=(r,t)=>new Gi(r,t);A.offset=(r,t,e)=>new Qn(r,t,e);A.u8=r=>new _e(1,r);A.u16=r=>new _e(2,r);A.u24=r=>new _e(3,r);A.u32=r=>new _e(4,r);A.u40=r=>new _e(5,r);A.u48=r=>new _e(6,r);A.nu64=r=>new Zi(r);A.u16be=r=>new Ae(2,r);A.u24be=r=>new Ae(3,r);A.u32be=r=>new Ae(4,r);A.u40be=r=>new Ae(5,r);A.u48be=r=>new Ae(6,r);A.nu64be=r=>new ji(r);A.s8=r=>new Xe(1,r);A.s16=r=>new Xe(2,r);A.s24=r=>new Xe(3,r);A.s32=r=>new Xe(4,r);A.s40=r=>new Xe(5,r);A.s48=r=>new Xe(6,r);A.ns64=r=>new Yi(r);A.s16be=r=>new wr(2,r);A.s24be=r=>new wr(3,r);A.s32be=r=>new wr(4,r);A.s40be=r=>new wr(5,r);A.s48be=r=>new wr(6,r);A.ns64be=r=>new Ji(r);A.f32=r=>new Xi(r);A.f32be=r=>new Qi(r);A.f64=r=>new to(r);A.f64be=r=>new eo(r);A.struct=(r,t,e)=>new no(r,t,e);A.bits=(r,t,e)=>new ri(r,t,e);A.seq=(r,t,e)=>new ro(r,t,e);A.union=(r,t,e)=>new ei(r,t,e);A.unionLayoutDiscriminator=(r,t)=>new Bn(r,t);A.blob=(r,t)=>new so(r,t);A.cstr=r=>new ao(r);A.utf8=(r,t)=>new uo(r,t);A.constant=(r,t)=>new co(r,t)});var Lu=oe(_n=>{"use strict";var Op=P(O());Object.defineProperty(_n,"__esModule",{value:!0});var lo;function pl(r){{let t=Buffer.from(r);t.reverse();let e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}return lo.toBigInt(r,!1)}_n.toBigIntLE=pl;function yl(r){{let t=r.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}return lo.toBigInt(r,!0)}_n.toBigIntBE=yl;function gl(r,t){{let e=r.toString(16),i=Buffer.from(e.padStart(t*2,"0").slice(0,t*2),"hex");return i.reverse(),i}return lo.fromBigInt(r,Buffer.allocUnsafe(t),!1)}_n.toBufferLE=gl;function ml(r,t){{let e=r.toString(16);return Buffer.from(e.padStart(t*2,"0").slice(0,t*2),"hex")}return lo.fromBigInt(r,Buffer.allocUnsafe(t),!0)}_n.toBufferBE=ml});function wl(r){return ii(r)&&typeof r[Symbol.iterator]=="function"}function ii(r){return typeof r=="object"&&r!=null}function po(r){return ii(r)&&!Array.isArray(r)}function Ue(r){return typeof r=="symbol"?r.toString():typeof r=="string"?JSON.stringify(r):`${r}`}function bl(r){let{done:t,value:e}=r.next();return t?void 0:e}function vl(r,t,e,i){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});let{path:o,branch:u}=t,{type:h}=e,{refinement:w,message:m=`Expected a value of type \\`${h}\\`${w?` with refinement \\`${w}\\``:""}, but received: \\`${Ue(i)}\\``}=r;return{value:i,type:h,refinement:w,key:o[o.length-1],path:o,branch:u,...r,message:m}}function*Ru(r,t,e,i){wl(r)||(r=[r]);for(let o of r){let u=vl(o,t,e,i);u&&(yield u)}}function*Ts(r,t,e={}){let{path:i=[],branch:o=[r],coerce:u=!1,mask:h=!1}=e,w={path:i,branch:o,mask:h};u&&(r=t.coercer(r,w));let m="valid";for(let x of t.validator(r,w))x.explanation=e.message,m="not_valid",yield[x,void 0];for(let[x,v,k]of t.entries(r,w)){let E=Ts(v,k,{path:x===void 0?i:[...i,x],branch:x===void 0?o:[...o,v],coerce:u,mask:h,message:e.message});for(let M of E)M[0]?(m=M[0].refinement!=null?"not_refined":"not_valid",yield[M[0],void 0]):u&&(v=M[1],x===void 0?r=v:r instanceof Map?r.set(x,v):r instanceof Set?r.add(v):ii(r)&&(v!==void 0||x in r)&&(r[x]=v))}if(m!=="not_valid")for(let x of t.refiner(r,w))x.explanation=e.message,m="not_refined",yield[x,void 0];m==="valid"&&(yield[void 0,r])}function Tu(r,t,e){let i=oi(r,t,{message:e});if(i[0])throw i[0]}function In(r,t,e){let i=oi(r,t,{coerce:!0,message:e});if(i[0])throw i[0];return i[1]}function xl(r,t,e){let i=oi(r,t,{coerce:!0,mask:!0,message:e});if(i[0])throw i[0];return i[1]}function Pu(r,t){return!oi(r,t)[0]}function oi(r,t,e={}){let i=Ts(r,t,e),o=bl(i);return o[0]?[new Rs(o[0],function*(){for(let h of i)h[0]&&(yield h[0])}),void 0]:[void 0,o[1]]}function an(r,t){return new Le({type:r,schema:null,validator:t})}function Cu(){return an("any",()=>!0)}function Y(r){return new Le({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(let[e,i]of t.entries())yield[e,i,r]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Ue(t)}`}})}function Ne(){return an("boolean",r=>typeof r=="boolean")}function yo(r){return an("instance",t=>t instanceof r||`Expected a \\`${r.name}\\` instance, but received: ${Ue(t)}`)}function re(r){let t=Ue(r),e=typeof r;return new Le({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator(i){return i===r||`Expected the literal \\`${t}\\`, but received: ${Ue(i)}`}})}function kl(){return an("never",()=>!1)}function J(r){return new Le({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function I(){return an("number",r=>typeof r=="number"&&!isNaN(r)||`Expected a number, but received: ${Ue(r)}`)}function rt(r){return new Le({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function Ps(r,t){return new Le({type:"record",schema:null,*entries(e){if(ii(e))for(let i in e){let o=e[i];yield[i,i,r],yield[i,o,t]}},validator(e){return po(e)||`Expected an object, but received: ${Ue(e)}`},coercer(e){return po(e)?{...e}:e}})}function W(){return an("string",r=>typeof r=="string"||`Expected a string, but received: ${Ue(r)}`)}function go(r){let t=kl();return new Le({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){let i=Math.max(r.length,e.length);for(let o=0;oe.type).join(" | ");return new Le({type:"union",schema:null,coercer(e,i){for(let o of r){let[u,h]=o.validate(e,{coerce:!0,mask:i.mask});if(!u)return h}return e},validator(e,i){let o=[];for(let u of r){let[...h]=Ts(e,u,i),[w]=h;if(w[0])for(let[m]of h)m&&o.push(m);else return[]}return[`Expected the value to satisfy a union of \\`${t}\\`, but received: ${Ue(e)}`,...o]}})}function un(){return an("unknown",()=>!0)}function An(r,t,e){return new Le({...r,coercer:(i,o)=>Pu(i,t)?r.coercer(e(i,o),o):r.coercer(i,o)})}var Np,Rs,Le,Ou=wt(()=>{Np=P(O(),1),Rs=class extends TypeError{constructor(t,e){let i,{message:o,explanation:u,...h}=t,{path:w}=t,m=w.length===0?o:`At path: ${w.join(".")} -- ${o}`;super(u??m),u!=null&&(this.cause=m),Object.assign(this,h),this.name=this.constructor.name,this.failures=()=>i??(i=[t,...e()])}};Le=class{constructor(t){let{type:e,schema:i,validator:o,refiner:u,coercer:h=m=>m,entries:w=function*(){}}=t;this.type=e,this.schema=i,this.entries=w,this.coercer=h,o?this.validator=(m,x)=>{let v=o(m,x);return Ru(v,x,this,m)}:this.validator=()=>[],u?this.refiner=(m,x)=>{let v=u(m,x);return Ru(v,x,this,m)}:this.refiner=()=>[]}assert(t,e){return Tu(t,this,e)}create(t,e){return In(t,this,e)}is(t){return Pu(t,this)}mask(t,e){return xl(t,this,e)}validate(t,e={}){return oi(t,this,e)}}});function si(){if(!mo&&(mo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!mo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return mo(Sl)}var qp,mo,Sl,Cs=wt(()=>{qp=P(O()),Sl=new Uint8Array(16)});var Kp,Uu,Nu=wt(()=>{Kp=P(O()),Uu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function Bl(r){return typeof r=="string"&&Uu.test(r)}var Hp,br,ai=wt(()=>{Hp=P(O());Nu();br=Bl});function El(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(le[r[t+0]]+le[r[t+1]]+le[r[t+2]]+le[r[t+3]]+"-"+le[r[t+4]]+le[r[t+5]]+"-"+le[r[t+6]]+le[r[t+7]]+"-"+le[r[t+8]]+le[r[t+9]]+"-"+le[r[t+10]]+le[r[t+11]]+le[r[t+12]]+le[r[t+13]]+le[r[t+14]]+le[r[t+15]]).toLowerCase();if(!br(e))throw TypeError("Stringified UUID is invalid");return e}var Gp,le,wo,vr,ui=wt(()=>{Gp=P(O());ai();le=[];for(wo=0;wo<256;++wo)le.push((wo+256).toString(16).substr(1));vr=El});function _l(r,t,e){var i=t&&e||0,o=t||new Array(16);r=r||{};var u=r.node||zu,h=r.clockseq!==void 0?r.clockseq:Os;if(u==null||h==null){var w=r.random||(r.rng||si)();u==null&&(u=zu=[w[0]|1,w[1],w[2],w[3],w[4],w[5]]),h==null&&(h=Os=(w[6]<<8|w[7])&16383)}var m=r.msecs!==void 0?r.msecs:Date.now(),x=r.nsecs!==void 0?r.nsecs:Ns+1,v=m-Us+(x-Ns)/1e4;if(v<0&&r.clockseq===void 0&&(h=h+1&16383),(v<0||m>Us)&&r.nsecs===void 0&&(x=0),x>=1e4)throw new Error("uuid.v1(): Can\'t create more than 10M uuids/sec");Us=m,Ns=x,Os=h,m+=122192928e5;var k=((m&268435455)*1e4+x)%4294967296;o[i++]=k>>>24&255,o[i++]=k>>>16&255,o[i++]=k>>>8&255,o[i++]=k&255;var E=m/4294967296*1e4&268435455;o[i++]=E>>>8&255,o[i++]=E&255,o[i++]=E>>>24&15|16,o[i++]=E>>>16&255,o[i++]=h>>>8|128,o[i++]=h&255;for(var M=0;M<6;++M)o[i+M]=u[M];return t||vr(o)}var Jp,zu,Os,Us,Ns,qu,Fu=wt(()=>{Jp=P(O());Cs();ui();Us=0,Ns=0;qu=_l});function Il(r){if(!br(r))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(r.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(r.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(r.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(r.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}var ty,bo,zs=wt(()=>{ty=P(O());ai();bo=Il});function Al(r){r=unescape(encodeURIComponent(r));for(var t=[],e=0;e{iy=P(O());ui();zs();Ml="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Ll="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function Rl(r){if(typeof r=="string"){var t=unescape(encodeURIComponent(r));r=new Uint8Array(t.length);for(var e=0;e>5]>>>o%32&255,h=parseInt(i.charAt(u>>>4&15)+i.charAt(u&15),16);t.push(h)}return t}function Ku(r){return(r+64>>>9<<4)+14+1}function Pl(r,t){r[t>>5]|=128<>5]|=(r[i/8]&255)<>16)+(t>>16)+(e>>16);return i<<16|e&65535}function Ol(r,t){return r<>>32-t}function xo(r,t,e,i,o,u){return xr(Ol(xr(xr(t,r),xr(i,u)),o),e)}function ye(r,t,e,i,o,u,h){return xo(t&e|~t&i,r,t,o,u,h)}function ge(r,t,e,i,o,u,h){return xo(t&i|e&~i,r,t,o,u,h)}function me(r,t,e,i,o,u,h){return xo(t^e^i,r,t,o,u,h)}function we(r,t,e,i,o,u,h){return xo(e^(t|~i),r,t,o,u,h)}var sy,Du,Wu=wt(()=>{sy=P(O());Du=Rl});var fy,Ul,Hu,$u=wt(()=>{fy=P(O());qs();Wu();Ul=vo("v3",48,Du),Hu=Ul});function Nl(r,t,e){r=r||{};var i=r.random||(r.rng||si)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){e=e||0;for(var o=0;o<16;++o)t[e+o]=i[o];return t}return vr(i)}var py,Vu,Gu=wt(()=>{py=P(O());Cs();ui();Vu=Nl});function zl(r,t,e,i){switch(r){case 0:return t&e^~t&i;case 1:return t^e^i;case 2:return t&e^t&i^e&i;case 3:return t^e^i}}function Fs(r,t){return r<>>32-t}function ql(r){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var i=unescape(encodeURIComponent(r));r=[];for(var o=0;o>>0;N=K,K=U,U=Fs(B,30)>>>0,B=R,R=D}e[0]=e[0]+R>>>0,e[1]=e[1]+B>>>0,e[2]=e[2]+U>>>0,e[3]=e[3]+K>>>0,e[4]=e[4]+N>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var gy,Zu,ju=wt(()=>{gy=P(O());Zu=ql});var vy,Fl,Yu,Ju=wt(()=>{vy=P(O());qs();ju();Fl=vo("v5",80,Zu),Yu=Fl});var ky,Xu,Qu=wt(()=>{ky=P(O()),Xu="00000000-0000-0000-0000-000000000000"});function Kl(r){if(!br(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)}var Ey,tc,ec=wt(()=>{Ey=P(O());ai();tc=Kl});var Ks={};la(Ks,{NIL:()=>Xu,parse:()=>bo,stringify:()=>vr,v1:()=>qu,v3:()=>Hu,v4:()=>Vu,v5:()=>Yu,validate:()=>br,version:()=>tc});var _y,Ds=wt(()=>{_y=P(O());Fu();$u();Gu();Ju();Qu();ec();ai();ui();zs()});var nc=oe((Uy,rc)=>{"use strict";var Ny=P(O()),Dl=(Ds(),pa(Ks)).v4,Wl=function(r,t,e,i){if(typeof r!="string")throw new TypeError(r+" must be a string");i=i||{};let o=typeof i.version=="number"?i.version:2;if(o!==1&&o!==2)throw new TypeError(o+" must be 1 or 2");let u={method:r};if(o===2&&(u.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");u.params=t}if(typeof e>"u"){let h=typeof i.generator=="function"?i.generator:function(){return Dl()};u.id=h(u,i)}else o===2&&e===null?i.notificationIdNull&&(u.id=null):u.id=e;return u};rc.exports=Wl});var oc=oe((zy,ic)=>{"use strict";var qy=P(O()),Hl=(Ds(),pa(Ks)).v4,$l=nc(),ci=function(r,t){if(!(this instanceof ci))return new ci(r,t);t||(t={}),this.options={reviver:typeof t.reviver<"u"?t.reviver:null,replacer:typeof t.replacer<"u"?t.replacer:null,generator:typeof t.generator<"u"?t.generator:function(){return Hl()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=r};ic.exports=ci;ci.prototype.request=function(r,t,e,i){let o=this,u=null,h=Array.isArray(r)&&typeof t=="function";if(this.options.version===1&&h)throw new TypeError("JSON-RPC 1.0 does not support batching");if(h||!h&&r&&typeof r=="object"&&typeof t=="function")i=t,u=r;else{typeof e=="function"&&(i=e,e=void 0);let x=typeof i=="function";try{u=$l(r,t,e,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(v){if(x)return i(v);throw v}if(!x)return u}let m;try{m=JSON.stringify(u,this.options.replacer)}catch(x){return i(x)}return this.callServer(m,function(x,v){o._parseResponse(x,v,i)}),u};ci.prototype._parseResponse=function(r,t,e){if(r){e(r);return}if(!t)return e();let i;try{i=JSON.parse(t,this.options.reviver)}catch(o){return e(o)}if(e.length===3)if(Array.isArray(i)){let o=function(h){return typeof h.error<"u"},u=function(h){return!o(h)};return e(null,i.filter(o),i.filter(u))}else return e(null,i.error,i.result);e(null,i)}});var ac=oe((Fy,Ws)=>{"use strict";var Ky=P(O()),Vl=Object.prototype.hasOwnProperty,ke="~";function fi(){}Object.create&&(fi.prototype=Object.create(null),new fi().__proto__||(ke=!1));function Gl(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function sc(r,t,e,i,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var u=new Gl(e,i||r,o),h=ke?ke+t:t;return r._events[h]?r._events[h].fn?r._events[h]=[r._events[h],u]:r._events[h].push(u):(r._events[h]=u,r._eventsCount++),r}function ko(r,t){--r._eventsCount===0?r._events=new fi:delete r._events[t]}function be(){this._events=new fi,this._eventsCount=0}be.prototype.eventNames=function(){var t=[],e,i;if(this._eventsCount===0)return t;for(i in e=this._events)Vl.call(e,i)&&t.push(ke?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};be.prototype.listeners=function(t){var e=ke?ke+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,u=i.length,h=new Array(u);o{Wy=P(O(),1),uc=P(ac(),1)});var Vy,Zl,fc=wt(()=>{Vy=P(O(),1),Zl=P(mn(),1);cc()});function r0(r,t=24){let e=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let h=0;h<10;h++)e[h]=r[h]^r[h+10]^r[h+20]^r[h+30]^r[h+40];for(let h=0;h<10;h+=2){let w=(h+8)%10,m=(h+2)%10,x=e[m],v=e[m+1],k=hc(x,v,1)^e[w],E=lc(x,v,1)^e[w+1];for(let M=0;M<50;M+=10)r[h+M]^=k,r[h+M+1]^=E}let o=r[2],u=r[3];for(let h=0;h<24;h++){let w=pc[h],m=hc(o,u,w),x=lc(o,u,w),v=dc[h];o=r[v],u=r[v+1],r[v]=m,r[v+1]=x}for(let h=0;h<50;h+=10){for(let w=0;w<10;w++)e[w]=r[h+w];for(let w=0;w<10;w++)r[h+w]^=~e[(w+2)%10]&e[(w+4)%10]}r[0]^=t0[i],r[1]^=e0[i]}e.fill(0)}var sg,dc,pc,yc,jl,hi,Yl,Jl,Xl,Ql,t0,e0,hc,lc,Mn,kr,Yy,Jy,Xy,Qy,tg,Hs,eg,rg,gc,ng,ig,mc=wt(()=>{sg=P(O(),1);Zn();Qo();ur();dc=[],pc=[],yc=[],jl=BigInt(0),hi=BigInt(1),Yl=BigInt(2),Jl=BigInt(7),Xl=BigInt(256),Ql=BigInt(113);for(let r=0,t=hi,e=1,i=0;r<24;r++){[e,i]=[i,(2*e+3*i)%5],dc.push(2*(5*i+e)),pc.push((r+1)*(r+2)/2%64);let o=jl;for(let u=0;u<7;u++)t=(t<>Jl)*Ql)%Xl,t&Yl&&(o^=hi<<(hi<e>32?Jo(r,t,e):jo(r,t,e),lc=(r,t,e)=>e>32?Xo(r,t,e):Yo(r,t,e);Mn=class extends sr{constructor(t,e,i,o=!1,u=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=i,this.enableXOF=o,this.rounds=u,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Gn(i),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=$a(this.state)}keccak(){Wo||Ho(this.state32),r0(this.state32,this.rounds),Wo||Ho(this.state32),this.posOut=0,this.pos=0}update(t){Ve(this);let{blockLen:e,state:i}=this;t=ar(t);let o=t.length;for(let u=0;u=i&&this.keccak();let h=Math.min(i-this.posOut,u-o);t.set(e.subarray(this.posOut,this.posOut+h),o),this.posOut+=h,o+=h}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Gn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Mi(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:i,outputLen:o,rounds:u,enableXOF:h}=this;return t||(t=new Mn(e,i,o,h,u)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=u,t.suffix=i,t.outputLen=o,t.enableXOF=h,t.destroyed=this.destroyed,t}},kr=(r,t,e)=>wn(()=>new Mn(t,r,e)),Yy=kr(6,144,224/8),Jy=kr(6,136,256/8),Xy=kr(6,104,384/8),Qy=kr(6,72,512/8),tg=kr(1,144,224/8),Hs=kr(1,136,256/8),eg=kr(1,104,384/8),rg=kr(1,72,512/8),gc=(r,t,e)=>Ga((i={})=>new Mn(t,r,i.dkLen===void 0?e:i.dkLen,!0)),ng=gc(31,168,128/8),ig=gc(31,136,256/8)});var fg,So,$s,wc=wt(()=>{fg=P(O(),1);Zn();ur();So=class extends sr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Wa(t);let i=ar(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,u=new Uint8Array(o);u.set(i.length>o?t.create().update(i).digest():i);for(let h=0;hnew So(r,t).update(e).digest();$s.create=(r,t)=>new So(r,t)});function bc(r){r.lowS!==void 0&&Ce("lowS",r.lowS),r.prehash!==void 0&&Ce("prehash",r.prehash)}function n0(r){let t=Jn(r);Fe(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:i,a:o}=t;if(e){if(!i.eql(o,i.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}function s0(r){let t=n0(r),{Fp:e}=t,i=pr(t.n,t.nBitLength),o=t.toBytes||((R,B,U)=>{let K=B.toAffine();return Ye(Uint8Array.from([4]),e.toBytes(K.x),e.toBytes(K.y))}),u=t.fromBytes||(R=>{let B=R.subarray(1),U=e.fromBytes(B.subarray(0,e.BYTES)),K=e.fromBytes(B.subarray(e.BYTES,2*e.BYTES));return{x:U,y:K}});function h(R){let{a:B,b:U}=t,K=e.sqr(R),N=e.mul(K,R);return e.add(e.add(N,e.mul(R,B)),U)}if(!e.eql(e.sqr(t.Gy),h(t.Gx)))throw new Error("bad generator point: equation left != right");function w(R){return jn(R,ce,t.n)}function m(R){let{allowedPrivateKeyLengths:B,nByteLength:U,wrapPrivateKey:K,n:N}=t;if(B&&typeof R!="bigint"){if(hr(R)&&(R=Ze(R)),typeof R!="string"||!B.includes(R.length))throw new Error("Invalid key");R=R.padStart(U*2,"0")}let F;try{F=typeof R=="bigint"?R:je(ne("private key",R,U))}catch{throw new Error(`private key must be ${U} bytes, hex or bigint, not ${typeof R}`)}return K&&(F=Zt(F,N)),Be("private key",F,ce,N),F}function x(R){if(!(R instanceof E))throw new Error("ProjectivePoint expected")}let v=Qr((R,B)=>{let{px:U,py:K,pz:N}=R;if(e.eql(N,e.ONE))return{x:U,y:K};let F=R.is0();B==null&&(B=F?e.ONE:e.inv(N));let tt=e.mul(U,B),D=e.mul(K,B),Z=e.mul(N,B);if(F)return{x:e.ZERO,y:e.ZERO};if(!e.eql(Z,e.ONE))throw new Error("invZ was invalid");return{x:tt,y:D}}),k=Qr(R=>{if(R.is0()){if(t.allowInfinityPoint&&!e.is0(R.py))return;throw new Error("bad point: ZERO")}let{x:B,y:U}=R.toAffine();if(!e.isValid(B)||!e.isValid(U))throw new Error("bad point: x or y not FE");let K=e.sqr(U),N=h(B);if(!e.eql(K,N))throw new Error("bad point: equation left != right");if(!R.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class E{constructor(B,U,K){if(this.px=B,this.py=U,this.pz=K,B==null||!e.isValid(B))throw new Error("x required");if(U==null||!e.isValid(U))throw new Error("y required");if(K==null||!e.isValid(K))throw new Error("z required");Object.freeze(this)}static fromAffine(B){let{x:U,y:K}=B||{};if(!B||!e.isValid(U)||!e.isValid(K))throw new Error("invalid affine point");if(B instanceof E)throw new Error("projective point not allowed");let N=F=>e.eql(F,e.ZERO);return N(U)&&N(K)?E.ZERO:new E(U,K,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(B){let U=e.invertBatch(B.map(K=>K.pz));return B.map((K,N)=>K.toAffine(U[N])).map(E.fromAffine)}static fromHex(B){let U=E.fromAffine(u(ne("pointHex",B)));return U.assertValidity(),U}static fromPrivateKey(B){return E.BASE.multiply(m(B))}static msm(B,U){return Ni(E,i,B,U)}_setWindowSize(B){$.setWindowSize(this,B)}assertValidity(){k(this)}hasEvenY(){let{y:B}=this.toAffine();if(e.isOdd)return!e.isOdd(B);throw new Error("Field doesn\'t support isOdd")}equals(B){x(B);let{px:U,py:K,pz:N}=this,{px:F,py:tt,pz:D}=B,Z=e.eql(e.mul(U,D),e.mul(F,N)),X=e.eql(e.mul(K,D),e.mul(tt,N));return Z&&X}negate(){return new E(this.px,e.neg(this.py),this.pz)}double(){let{a:B,b:U}=t,K=e.mul(U,vc),{px:N,py:F,pz:tt}=this,D=e.ZERO,Z=e.ZERO,X=e.ZERO,et=e.mul(N,N),Yt=e.mul(F,F),V=e.mul(tt,tt),nt=e.mul(N,F);return nt=e.add(nt,nt),X=e.mul(N,tt),X=e.add(X,X),D=e.mul(B,X),Z=e.mul(K,V),Z=e.add(D,Z),D=e.sub(Yt,Z),Z=e.add(Yt,Z),Z=e.mul(D,Z),D=e.mul(nt,D),X=e.mul(K,X),V=e.mul(B,V),nt=e.sub(et,V),nt=e.mul(B,nt),nt=e.add(nt,X),X=e.add(et,et),et=e.add(X,et),et=e.add(et,V),et=e.mul(et,nt),Z=e.add(Z,et),V=e.mul(F,tt),V=e.add(V,V),et=e.mul(V,nt),D=e.sub(D,et),X=e.mul(V,Yt),X=e.add(X,X),X=e.add(X,X),new E(D,Z,X)}add(B){x(B);let{px:U,py:K,pz:N}=this,{px:F,py:tt,pz:D}=B,Z=e.ZERO,X=e.ZERO,et=e.ZERO,Yt=t.a,V=e.mul(t.b,vc),nt=e.mul(U,F),y=e.mul(K,tt),n=e.mul(N,D),a=e.add(U,K),c=e.add(F,tt);a=e.mul(a,c),c=e.add(nt,y),a=e.sub(a,c),c=e.add(U,N);let f=e.add(F,D);return c=e.mul(c,f),f=e.add(nt,n),c=e.sub(c,f),f=e.add(K,N),Z=e.add(tt,D),f=e.mul(f,Z),Z=e.add(y,n),f=e.sub(f,Z),et=e.mul(Yt,c),Z=e.mul(V,n),et=e.add(Z,et),Z=e.sub(y,et),et=e.add(y,et),X=e.mul(Z,et),y=e.add(nt,nt),y=e.add(y,nt),n=e.mul(Yt,n),c=e.mul(V,c),y=e.add(y,n),n=e.sub(nt,n),n=e.mul(Yt,n),c=e.add(c,n),nt=e.mul(y,c),X=e.add(X,nt),nt=e.mul(f,c),Z=e.mul(a,Z),Z=e.sub(Z,nt),nt=e.mul(a,y),et=e.mul(f,et),et=e.add(et,nt),new E(Z,X,et)}subtract(B){return this.add(B.negate())}is0(){return this.equals(E.ZERO)}wNAF(B){return $.wNAFCached(this,B,E.normalizeZ)}multiplyUnsafe(B){Be("scalar",B,tr,t.n);let U=E.ZERO;if(B===tr)return U;if(B===ce)return this;let{endo:K}=t;if(!K)return $.unsafeLadder(this,B);let{k1neg:N,k1:F,k2neg:tt,k2:D}=K.splitScalar(B),Z=U,X=U,et=this;for(;F>tr||D>tr;)F&ce&&(Z=Z.add(et)),D&ce&&(X=X.add(et)),et=et.double(),F>>=ce,D>>=ce;return N&&(Z=Z.negate()),tt&&(X=X.negate()),X=new E(e.mul(X.px,K.beta),X.py,X.pz),Z.add(X)}multiply(B){let{endo:U,n:K}=t;Be("scalar",B,ce,K);let N,F;if(U){let{k1neg:tt,k1:D,k2neg:Z,k2:X}=U.splitScalar(B),{p:et,f:Yt}=this.wNAF(D),{p:V,f:nt}=this.wNAF(X);et=$.constTimeNegate(tt,et),V=$.constTimeNegate(Z,V),V=new E(e.mul(V.px,U.beta),V.py,V.pz),N=et.add(V),F=Yt.add(nt)}else{let{p:tt,f:D}=this.wNAF(B);N=tt,F=D}return E.normalizeZ([N,F])[0]}multiplyAndAddUnsafe(B,U,K){let N=E.BASE,F=(D,Z)=>Z===tr||Z===ce||!D.equals(N)?D.multiplyUnsafe(Z):D.multiply(Z),tt=F(this,U).add(F(B,K));return tt.is0()?void 0:tt}toAffine(B){return v(this,B)}isTorsionFree(){let{h:B,isTorsionFree:U}=t;if(B===ce)return!0;if(U)return U(E,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:B,clearCofactor:U}=t;return B===ce?this:U?U(E,this):this.multiplyUnsafe(t.h)}toRawBytes(B=!0){return Ce("isCompressed",B),this.assertValidity(),o(E,this,B)}toHex(B=!0){return Ce("isCompressed",B),Ze(this.toRawBytes(B))}}E.BASE=new E(t.Gx,t.Gy,e.ONE),E.ZERO=new E(e.ZERO,e.ONE,e.ZERO);let M=t.nBitLength,$=Ui(E,t.endo?Math.ceil(M/2):M);return{CURVE:t,ProjectivePoint:E,normPrivateKeyToScalar:m,weierstrassEquation:h,isWithinCurveOrder:w}}function a0(r){let t=Jn(r);return Fe(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function xc(r){let t=a0(r),{Fp:e,n:i}=t,o=e.BYTES+1,u=2*e.BYTES+1;function h(n){return Zt(n,i)}function w(n){return Oi(n,i)}let{ProjectivePoint:m,normPrivateKeyToScalar:x,weierstrassEquation:v,isWithinCurveOrder:k}=s0({...t,toBytes(n,a,c){let f=a.toAffine(),l=e.toBytes(f.x),g=Ye;return Ce("isCompressed",c),c?g(Uint8Array.from([a.hasEvenY()?2:3]),l):g(Uint8Array.from([4]),l,e.toBytes(f.y))},fromBytes(n){let a=n.length,c=n[0],f=n.subarray(1);if(a===o&&(c===2||c===3)){let l=je(f);if(!jn(l,ce,e.ORDER))throw new Error("Point is not on curve");let g=v(l),b;try{b=e.sqrt(g)}catch(p){let _=p instanceof Error?": "+p.message:"";throw new Error("Point is not on curve"+_)}let d=(b&ce)===ce;return(c&1)===1!==d&&(b=e.neg(b)),{x:l,y:b}}else if(a===u&&c===4){let l=e.fromBytes(f.subarray(0,e.BYTES)),g=e.fromBytes(f.subarray(e.BYTES,2*e.BYTES));return{x:l,y:g}}else throw new Error(`Point of length ${a} was invalid. Expected ${o} compressed bytes or ${u} uncompressed bytes`)}}),E=n=>Ze(dr(n,t.nByteLength));function M(n){let a=i>>ce;return n>a}function $(n){return M(n)?h(-n):n}let R=(n,a,c)=>je(n.slice(a,c));class B{constructor(a,c,f){this.r=a,this.s=c,this.recovery=f,this.assertValidity()}static fromCompact(a){let c=t.nByteLength;return a=ne("compactSignature",a,c*2),new B(R(a,0,c),R(a,c,2*c))}static fromDER(a){let{r:c,s:f}=Qe.toSig(ne("DER",a));return new B(c,f)}assertValidity(){Be("r",this.r,ce,i),Be("s",this.s,ce,i)}addRecoveryBit(a){return new B(this.r,this.s,a)}recoverPublicKey(a){let{r:c,s:f,recovery:l}=this,g=D(ne("msgHash",a));if(l==null||![0,1,2,3].includes(l))throw new Error("recovery id invalid");let b=l===2||l===3?c+t.n:c;if(b>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let d=l&1?"03":"02",s=m.fromHex(d+E(b)),p=w(b),_=h(-g*p),L=h(f*p),T=m.BASE.multiplyAndAddUnsafe(s,_,L);if(!T)throw new Error("point at infinify");return T.assertValidity(),T}hasHighS(){return M(this.s)}normalizeS(){return this.hasHighS()?new B(this.r,h(-this.s),this.recovery):this}toDERRawBytes(){return Jr(this.toDERHex())}toDERHex(){return Qe.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Jr(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}let U={isValidPrivateKey(n){try{return x(n),!0}catch{return!1}},normPrivateKeyToScalar:x,randomPrivateKey:()=>{let n=fs(t.n);return ou(t.randomBytes(n),t.n)},precompute(n=8,a=m.BASE){return a._setWindowSize(n),a.multiply(BigInt(3)),a}};function K(n,a=!0){return m.fromPrivateKey(n).toRawBytes(a)}function N(n){let a=hr(n),c=typeof n=="string",f=(a||c)&&n.length;return a?f===o||f===u:c?f===2*o||f===2*u:n instanceof m}function F(n,a,c=!0){if(N(n))throw new Error("first arg must be private key");if(!N(a))throw new Error("second arg must be public key");return m.fromHex(a).multiply(x(n)).toRawBytes(c)}let tt=t.bits2int||function(n){let a=je(n),c=n.length*8-t.nBitLength;return c>0?a>>BigInt(c):a},D=t.bits2int_modN||function(n){return h(tt(n))},Z=Yn(t.nBitLength);function X(n){return Be(`num < 2^${t.nBitLength}`,n,tr,Z),dr(n,t.nByteLength)}function et(n,a,c=Yt){if(["recovered","canonical"].some(H=>H in c))throw new Error("sign() legacy options not supported");let{hash:f,randomBytes:l}=t,{lowS:g,prehash:b,extraEntropy:d}=c;g==null&&(g=!0),n=ne("msgHash",n),bc(c),b&&(n=ne("prehashed msgHash",f(n)));let s=D(n),p=x(a),_=[X(p),X(s)];if(d!=null&&d!==!1){let H=d===!0?l(e.BYTES):d;_.push(ne("extraEntropy",H))}let L=Ye(..._),T=s;function q(H){let j=tt(H);if(!k(j))return;let Wt=w(j),G=m.BASE.multiply(j).toAffine(),Q=h(G.x);if(Q===tr)return;let ve=h(Wt*h(T+Q*p));if(ve===tr)return;let ot=(G.x===Q?0:2)|Number(G.y&ce),st=ve;return g&&M(ve)&&(st=$(ve),ot^=1),new B(Q,st,ot)}return{seed:L,k2sig:q}}let Yt={lowS:t.lowS,prehash:!1},V={lowS:t.lowS,prehash:!1};function nt(n,a,c=Yt){let{seed:f,k2sig:l}=et(n,a,c),g=t;return ss(g.hash.outputLen,g.nByteLength,g.hmac)(f,l)}m.BASE._setWindowSize(8);function y(n,a,c,f=V){let l=n;if(a=ne("msgHash",a),c=ne("publicKey",c),"strict"in f)throw new Error("options.strict was renamed to lowS");bc(f);let{lowS:g,prehash:b}=f,d,s;try{if(typeof l=="string"||hr(l))try{d=B.fromDER(l)}catch(G){if(!(G instanceof Qe.Err))throw G;d=B.fromCompact(l)}else if(typeof l=="object"&&typeof l.r=="bigint"&&typeof l.s=="bigint"){let{r:G,s:Q}=l;d=new B(G,Q)}else throw new Error("PARSE");s=m.fromHex(c)}catch(G){if(G.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(g&&d.hasHighS())return!1;b&&(a=t.hash(a));let{r:p,s:_}=d,L=D(a),T=w(_),q=h(L*T),H=h(p*T),j=m.BASE.multiplyAndAddUnsafe(s,q,H)?.toAffine();return j?h(j.x)===p:!1}return{CURVE:t,getPublicKey:K,getSharedSecret:F,sign:nt,verify:y,ProjectivePoint:m,Signature:B,utils:U}}var mg,i0,o0,Qe,tr,ce,pg,vc,yg,kc=wt(()=>{mg=P(O(),1);ds();xn();tn();tn();({bytesToNumberBE:i0,hexToBytes:o0}=Ci),Qe={Err:class extends Error{constructor(t=""){super(t)}},_tlv:{encode:(r,t)=>{let{Err:e}=Qe;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");let i=t.length/2,o=Yr(i);if(o.length/2&128)throw new e("tlv.encode: long form length too big");let u=i>127?Yr(o.length/2|128):"";return`${Yr(r)}${u}${o}${t}`},decode(r,t){let{Err:e}=Qe,i=0;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[i++]!==r)throw new e("tlv.decode: wrong tlv");let o=t[i++],u=!!(o&128),h=0;if(!u)h=o;else{let m=o&127;if(!m)throw new e("tlv.decode(long): indefinite length not supported");if(m>4)throw new e("tlv.decode(long): byte length is too big");let x=t.subarray(i,i+m);if(x.length!==m)throw new e("tlv.decode: length bytes not complete");if(x[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(let v of x)h=h<<8|v;if(i+=m,h<128)throw new e("tlv.decode(long): not minimal encoding")}let w=t.subarray(i,i+h);if(w.length!==h)throw new e("tlv.decode: wrong value length");return{v:w,l:t.subarray(i+h)}}},_int:{encode(r){let{Err:t}=Qe;if(r$s(r,t,$o(...e)),randomBytes:Ri}}function Sc(r,t){let e=i=>xc({...r,...u0(i)});return Object.freeze({...e(t),create:e})}var kg,Bc=wt(()=>{kg=P(O(),1);wc();ur();kc();});function f0(r){let t=Ic,e=BigInt(3),i=BigInt(6),o=BigInt(11),u=BigInt(22),h=BigInt(23),w=BigInt(44),m=BigInt(88),x=r*r*r%t,v=x*x*r%t,k=ee(v,e,t)*v%t,E=ee(k,e,t)*v%t,M=ee(E,Vs,t)*x%t,$=ee(M,o,t)*M%t,R=ee($,u,t)*$%t,B=ee(R,w,t)*R%t,U=ee(B,m,t)*B%t,K=ee(U,w,t)*R%t,N=ee(K,e,t)*v%t,F=ee(N,h,t)*$%t,tt=ee(F,i,t)*x%t,D=ee(tt,Vs,t);if(!Gs.eql(Gs.sqr(D),r))throw new Error("Cannot find square root");return D}var Mg,Ic,Ec,c0,Vs,_c,Gs,li,_g,Ig,Ac=wt(()=>{Mg=P(O(),1);vs();Bc();xn();Ic=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ec=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),c0=BigInt(1),Vs=BigInt(2),_c=(r,t)=>(r+t/Vs)/t;Gs=pr(Ic,void 0,void 0,{sqrt:f0}),li=Sc({a:BigInt(0),b:BigInt(7),Fp:Gs,n:Ec,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=Ec,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),i=-c0*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),u=e,h=BigInt("0x100000000000000000000000000000000"),w=_c(u*r,t),m=_c(-i*r,t),x=Zt(r-w*e-m*o,t),v=Zt(-w*i-m*u,t),k=x>h,E=v>h;if(k&&(x=t-x),E&&(v=t-v),x>h||v>h)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:k,k1:x,k2neg:E,k2:v}}}},Xn),_g=BigInt(0),Ig=li.ProjectivePoint});function Lc(r){try{return rn.ExtendedPoint.fromHex(r),!0}catch{return!1}}function p0(r){return r._bn!==void 0}function $c(r,t){let e=o=>{if(o.span>=0)return o.span;if(typeof o.alloc=="function")return o.alloc(t[o.property]);if("count"in o&&"elementLayout"in o){let u=t[o.property];if(Array.isArray(u))return u.length*e(o.elementLayout)}else if("fields"in o)return $c({layout:o},t[o.property]);return 0},i=0;return r.layout.fields.forEach(o=>{i+=e(o)}),i}function yi(r){let t=0,e=0;for(;;){let i=r.shift();if(t|=(i&127)<>=7,e==0){r.push(i);break}else i|=128,r.push(i)}}function ae(r,t){if(!r)throw new Error(t||"Assertion failed")}function Bo(r){if(r.length===0)throw new Error(Vc);return r.shift()}function mi(r,...t){let[e]=t;if(t.length===2?e+(t[1]??0)>r.length:e>=r.length)throw new Error(Vc);return r.splice(...t)}async function Tc(r,t,e,i){let o=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},u=await r.sendTransaction(t,e,o),h;if(t.recentBlockhash!=null&&t.lastValidBlockHeight!=null)h=(await r.confirmTransaction({abortSignal:i?.abortSignal,signature:u,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},i&&i.commitment)).value;else if(t.minNonceContextSlot!=null&&t.nonceInfo!=null){let{nonceInstruction:w}=t.nonceInfo,m=w.keys[0].pubkey;h=(await r.confirmTransaction({abortSignal:i?.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:m,nonceValue:t.nonceInfo.nonce,signature:u},i&&i.commitment)).value}else i?.abortSignal!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),h=(await r.confirmTransaction(u,i&&i.commitment)).value;if(h.err)throw u!=null?new ia({action:"send",signature:u,transactionMessage:`Status: (${JSON.stringify(h)})`}):new Error(`Transaction ${u} failed (${JSON.stringify(h)})`);return u}function E0(r){return new Promise(t=>setTimeout(t,r))}function Dt(r,t){let e=r.layout.span>=0?r.layout.span:$c(r,t),i=it.Buffer.alloc(e),o=Object.assign({instruction:r.index},t);return r.layout.encode(o,i),i}function Zc(r){return pe([z({jsonrpc:re("2.0"),id:W(),result:r}),z({jsonrpc:re("2.0"),id:W(),error:z({code:un(),message:W(),data:rt(Cu())})})])}function Qt(r){return An(Zc(r),R0,t=>"error"in t?t:{...t,result:In(t.result,r)})}function Te(r){return Qt(z({context:z({slot:I()}),value:r}))}function Ro(r){return z({context:z({slot:I()}),value:r})}var Jm,it,Xs,Ie,Cn,S,Kc,Si,h0,zg,Mc,Qs,Dc,l0,Vt,ta,_o,Wc,d0,wi,Rc,at,qg,Io,y0,Hc,ea,ra,na,Ao,Ht,Ln,g0,m0,w0,b0,bi,Vc,fn,v0,Xt,Jt,x0,k0,S0,B0,er,Fg,Kg,Zs,vi,Dg,Wg,Hg,js,ia,_0,I0,Pc,A0,M0,Rn,Re,fe,L0,Tn,$g,Vg,Gg,ie,Gc,ua,Zg,R0,T0,jg,P0,C0,O0,U0,N0,hn,z0,q0,Yg,F0,K0,Jg,Xg,Qg,tm,em,rm,nm,im,om,sm,D0,am,um,oa,cm,fm,ca,hm,W0,H0,lm,dm,pm,ym,gm,$0,mm,V0,wm,G0,bm,vm,xm,km,Cc,Sm,Z0,j0,Bm,Em,jc,fa,Yc,Jc,Xc,Qc,Y0,J0,tf,ef,Mo,rf,To,ha,On,ln,_m,Im,Am,Mm,Lm,Rm,Tm,Pm,Cm,Om,Um,Nm,zm,X0,qm,Fm,Km,Dm,Q0,Wm,rr,di,sa,Eo,aa,Oc,Uc,Nc,zc,xi,td,ed,qc,Ys,Fc,rd,Js,cn,nf,nd,ki,Sr,Hm,Lo,pi,$m,Pn,Vm,Gm,Zm,jm,of=wt(()=>{Jm=P(O()),it=P(mn());hu();Xs=P(du()),Ie=P(bu());vs();Cn=P(Mu()),S=P(Ls()),Kc=P(Ls()),Si=P(Lu());Ou();h0=P(oc());fc();mc();Ac();zg=rn.utils.randomPrivateKey,Mc=()=>{let r=rn.utils.randomPrivateKey(),t=Qs(r),e=new Uint8Array(64);return e.set(r),e.set(t,32),{publicKey:t,secretKey:e}},Qs=rn.getPublicKey;Dc=(r,t)=>rn.sign(r,t.slice(0,32)),l0=rn.verify,Vt=r=>it.Buffer.isBuffer(r)?r:r instanceof Uint8Array?it.Buffer.from(r.buffer,r.byteOffset,r.byteLength):it.Buffer.from(r),ta=class{constructor(t){Object.assign(this,t)}encode(){return it.Buffer.from((0,Cn.serialize)(_o,this))}static decode(t){return(0,Cn.deserialize)(_o,this,t)}static decodeUnchecked(t){return(0,Cn.deserializeUnchecked)(_o,this,t)}},_o=new Map,d0=32,wi=32;Rc=1,at=class extends ta{constructor(t){if(super({}),this._bn=void 0,p0(t))this._bn=t._bn;else{if(typeof t=="string"){let e=Ie.default.decode(t);if(e.length!=wi)throw new Error("Invalid public key input");this._bn=new Xs.default(e)}else this._bn=new Xs.default(t);if(this._bn.byteLength()>wi)throw new Error("Invalid public key input")}}static unique(){let t=new at(Rc);return Rc+=1,new at(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Ie.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){let t=this._bn.toArrayLike(it.Buffer);if(t.length===wi)return t;let e=it.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,i){let o=it.Buffer.concat([t.toBuffer(),it.Buffer.from(e),i.toBuffer()]),u=Xn(o);return new at(u)}static createProgramAddressSync(t,e){let i=it.Buffer.alloc(0);t.forEach(function(u){if(u.length>d0)throw new TypeError("Max seed length exceeded");i=it.Buffer.concat([i,Vt(u)])}),i=it.Buffer.concat([i,e.toBuffer(),it.Buffer.from("ProgramDerivedAddress")]);let o=Xn(i);if(Lc(o))throw new Error("Invalid seeds, address must fall off the curve");return new at(o)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let i=255,o;for(;i!=0;){try{let u=t.concat(it.Buffer.from([i]));o=this.createProgramAddressSync(u,e)}catch(u){if(u instanceof TypeError)throw u;i--;continue}return[o,i]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){let e=new at(t);return Lc(e.toBytes())}};Wc=at;at.default=new Wc("11111111111111111111111111111111");_o.set(at,{kind:"struct",fields:[["_bn","u256"]]});qg=new at("BPFLoader1111111111111111111111111111111111"),Io=1280-40-8,y0=127,Hc=64,ea=class extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}};Object.defineProperty(ea.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});ra=class extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}};Object.defineProperty(ra.prototype,"name",{value:"TransactionExpiredTimeoutError"});na=class extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}};Object.defineProperty(na.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});Ao=class{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){let t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(let e of this.keySegments()){if(t255+1)throw new Error("Account index overflow encountered during compilation");let i=new Map;this.keySegments().flat().forEach((u,h)=>{i.set(u.toBase58(),h)});let o=u=>{let h=i.get(u.toBase58());if(h===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return h};return t.map(u=>({programIdIndex:o(u.programId),accountKeyIndexes:u.keys.map(h=>o(h.pubkey)),data:u.data}))}},Ht=(r="publicKey")=>S.blob(32,r),Ln=(r="string")=>{let t=S.struct([S.u32("length"),S.u32("lengthPadding"),S.blob(S.offset(S.u32(),-8),"chars")],r),e=t.decode.bind(t),i=t.encode.bind(t),o=t;return o.decode=(u,h)=>e(u,h).chars.toString(),o.encode=(u,h,w)=>{let m={chars:it.Buffer.from(u,"utf8")};return i(m,h,w)},o.alloc=u=>S.u32().span+S.u32().span+it.Buffer.from(u,"utf8").length,o},g0=(r="authorized")=>S.struct([Ht("staker"),Ht("withdrawer")],r),m0=(r="lockup")=>S.struct([S.ns64("unixTimestamp"),S.ns64("epoch"),Ht("custodian")],r),w0=(r="voteInit")=>S.struct([Ht("nodePubkey"),Ht("authorizedVoter"),Ht("authorizedWithdrawer"),S.u8("commission")],r),b0=(r="voteAuthorizeWithSeedArgs")=>S.struct([S.u32("voteAuthorizationType"),Ht("currentAuthorityDerivedKeyOwnerPubkey"),Ln("currentAuthorityDerivedKeySeed"),Ht("newAuthorized")],r);bi=class{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){let i=new Map,o=h=>{let w=h.toBase58(),m=i.get(w);return m===void 0&&(m={isSigner:!1,isWritable:!1,isInvoked:!1},i.set(w,m)),m},u=o(e);u.isSigner=!0,u.isWritable=!0;for(let h of t){o(h.programId).isInvoked=!0;for(let w of h.keys){let m=o(w.pubkey);m.isSigner||=w.isSigner,m.isWritable||=w.isWritable}}return new bi(e,i)}getMessageComponents(){let t=[...this.keyMetaMap.entries()];ae(t.length<=256,"Max static account keys length exceeded");let e=t.filter(([,m])=>m.isSigner&&m.isWritable),i=t.filter(([,m])=>m.isSigner&&!m.isWritable),o=t.filter(([,m])=>!m.isSigner&&m.isWritable),u=t.filter(([,m])=>!m.isSigner&&!m.isWritable),h={numRequiredSignatures:e.length+i.length,numReadonlySignedAccounts:i.length,numReadonlyUnsignedAccounts:u.length};{ae(e.length>0,"Expected at least one writable signer key");let[m]=e[0];ae(m===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let w=[...e.map(([m])=>new at(m)),...i.map(([m])=>new at(m)),...o.map(([m])=>new at(m)),...u.map(([m])=>new at(m))];return[h,w]}extractTableLookup(t){let[e,i]=this.drainKeysFoundInLookupTable(t.state.addresses,h=>!h.isSigner&&!h.isInvoked&&h.isWritable),[o,u]=this.drainKeysFoundInLookupTable(t.state.addresses,h=>!h.isSigner&&!h.isInvoked&&!h.isWritable);if(!(e.length===0&&o.length===0))return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:o},{writable:i,readonly:u}]}drainKeysFoundInLookupTable(t,e){let i=new Array,o=new Array;for(let[u,h]of this.keyMetaMap.entries())if(e(h)){let w=new at(u),m=t.findIndex(x=>x.equals(w));m>=0&&(ae(m<256,"Max lookup table index exceeded"),i.push(m),o.push(w),this.keyMetaMap.delete(u))}return[i,o]}},Vc="Reached end of buffer unexpectedly";fn=class{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(e=>new at(e)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Ie.default.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Ao(this.staticAccountKeys)}static compile(t){let e=bi.compile(t.instructions,t.payerKey),[i,o]=e.getMessageComponents(),h=new Ao(o).compileInstructions(t.instructions).map(w=>({programIdIndex:w.programIdIndex,accounts:w.accountKeyIndexes,data:Ie.default.encode(w.data)}));return new fn({header:i,accountKeys:o,recentBlockhash:t.recentBlockhash,instructions:h})}isAccountSigner(t){return t=this.header.numRequiredSignatures){let i=t-e,u=this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts;return i!this.isProgramId(e))}serialize(){let t=this.accountKeys.length,e=[];gi(e,t);let i=this.instructions.map(k=>{let{accounts:E,programIdIndex:M}=k,$=Array.from(Ie.default.decode(k.data)),R=[];gi(R,E.length);let B=[];return gi(B,$.length),{programIdIndex:M,keyIndicesCount:it.Buffer.from(R),keyIndices:E,dataLength:it.Buffer.from(B),data:$}}),o=[];gi(o,i.length);let u=it.Buffer.alloc(Io);it.Buffer.from(o).copy(u);let h=o.length;i.forEach(k=>{let M=S.struct([S.u8("programIdIndex"),S.blob(k.keyIndicesCount.length,"keyIndicesCount"),S.seq(S.u8("keyIndex"),k.keyIndices.length,"keyIndices"),S.blob(k.dataLength.length,"dataLength"),S.seq(S.u8("userdatum"),k.data.length,"data")]).encode(k,u,h);h+=M}),u=u.slice(0,h);let w=S.struct([S.blob(1,"numRequiredSignatures"),S.blob(1,"numReadonlySignedAccounts"),S.blob(1,"numReadonlyUnsignedAccounts"),S.blob(e.length,"keyCount"),S.seq(Ht("key"),t,"keys"),Ht("recentBlockhash")]),m={numRequiredSignatures:it.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:it.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:it.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:it.Buffer.from(e),keys:this.accountKeys.map(k=>Vt(k.toBytes())),recentBlockhash:Ie.default.decode(this.recentBlockhash)},x=it.Buffer.alloc(2048),v=w.encode(m,x);return u.copy(x,v),x.slice(0,v+u.length)}static from(t){let e=[...t],i=Bo(e);if(i!==(i&y0))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let o=Bo(e),u=Bo(e),h=yi(e),w=[];for(let E=0;E({pubkey:t.toJSON(),isSigner:e,isWritable:i})),programId:this.programId.toJSON(),data:[...this.data]}}},Jt=class{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){let{minContextSlot:e,nonceInfo:i}=t;this.minNonceContextSlot=e,this.nonceInfo=i}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){let{blockhash:e,lastValidBlockHeight:i}=t;this.recentBlockhash=e,this.lastValidBlockHeight=i}else{let{recentBlockhash:e,nonceInfo:i}=t;i&&(this.nonceInfo=i),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new Xt(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?e=[this.nonceInfo.nonceInstruction,...this.instructions]:e=this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");e.length<1&&console.warn("No instructions provided");let i;if(this.feePayer)i=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)i=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let R=0;R{R.keys.forEach(U=>{u.push({...U})});let B=R.programId.toString();o.includes(B)||o.push(B)}),o.forEach(R=>{u.push({pubkey:new at(R),isSigner:!1,isWritable:!1})});let h=[];u.forEach(R=>{let B=R.pubkey.toString(),U=h.findIndex(K=>K.pubkey.toString()===B);U>-1?(h[U].isWritable=h[U].isWritable||R.isWritable,h[U].isSigner=h[U].isSigner||R.isSigner):h.push(R)}),h.sort(function(R,B){if(R.isSigner!==B.isSigner)return R.isSigner?-1:1;if(R.isWritable!==B.isWritable)return R.isWritable?-1:1;let U={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return R.pubkey.toBase58().localeCompare(B.pubkey.toBase58(),"en",U)});let w=h.findIndex(R=>R.pubkey.equals(i));if(w>-1){let[R]=h.splice(w,1);R.isSigner=!0,R.isWritable=!0,h.unshift(R)}else h.unshift({pubkey:i,isSigner:!0,isWritable:!0});for(let R of this.signatures){let B=h.findIndex(U=>U.pubkey.equals(R.publicKey));if(B>-1)h[B].isSigner||(h[B].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${R.publicKey.toString()}`)}let m=0,x=0,v=0,k=[],E=[];h.forEach(({pubkey:R,isSigner:B,isWritable:U})=>{B?(k.push(R.toString()),m+=1,U||(x+=1)):(E.push(R.toString()),U||(v+=1))});let M=k.concat(E),$=e.map(R=>{let{data:B,programId:U}=R;return{programIdIndex:M.indexOf(U.toString()),accounts:R.keys.map(K=>M.indexOf(K.pubkey.toString())),data:Ie.default.encode(B)}});return $.forEach(R=>{ae(R.programIdIndex>=0),R.accounts.forEach(B=>ae(B>=0))}),new fn({header:{numRequiredSignatures:m,numReadonlySignedAccounts:x,numReadonlyUnsignedAccounts:v},accountKeys:M,recentBlockhash:t,instructions:$})}_compile(){let t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((o,u)=>e[u].equals(o.publicKey))||(this.signatures=e.map(i=>({signature:null,publicKey:i}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");let e=new Set;this.signatures=t.filter(i=>{let o=i.toString();return e.has(o)?!1:(e.add(o),!0)}).map(i=>({signature:null,publicKey:i}))}sign(...t){if(t.length===0)throw new Error("No signers");let e=new Set,i=[];for(let u of t){let h=u.publicKey.toString();e.has(h)||(e.add(h),i.push(u))}this.signatures=i.map(u=>({signature:null,publicKey:u.publicKey}));let o=this._compile();this._partialSign(o,...i)}partialSign(...t){if(t.length===0)throw new Error("No signers");let e=new Set,i=[];for(let u of t){let h=u.publicKey.toString();e.has(h)||(e.add(h),i.push(u))}let o=this._compile();this._partialSign(o,...i)}_partialSign(t,...e){let i=t.serialize();e.forEach(o=>{let u=Dc(i,o.secretKey);this._addSignature(o.publicKey,Vt(u))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){ae(e.length===64);let i=this.signatures.findIndex(o=>t.equals(o.publicKey));if(i<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[i].signature=it.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){let i={};for(let{signature:o,publicKey:u}of this.signatures)o===null?e&&(i.missing||=[]).push(u):l0(o,t,u.toBytes())||(i.invalid||=[]).push(u);return i.invalid||i.missing?i:void 0}serialize(t){let{requireAllSignatures:e,verifySignatures:i}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),o=this.serializeMessage();if(i){let u=this._getMessageSignednessErrors(o,e);if(u){let h="Signature verification failed.";throw u.invalid&&(h+=`\nInvalid signature for public key${u.invalid.length===1?"":"(s)"} [\\`${u.invalid.map(w=>w.toBase58()).join("`, `")}\\`].`),u.missing&&(h+=`\nMissing signature for public key${u.missing.length===1?"":"(s)"} [\\`${u.missing.map(w=>w.toBase58()).join("`, `")}\\`].`),new Error(h)}}return this._serialize(o)}_serialize(t){let{signatures:e}=this,i=[];gi(i,e.length);let o=i.length+e.length*64+t.length,u=it.Buffer.alloc(o);return ae(e.length<256),it.Buffer.from(i).copy(u,0),e.forEach(({signature:h},w)=>{h!==null&&(ae(h.length===64,"signature has invalid length"),it.Buffer.from(h).copy(u,i.length+w*64))}),t.copy(u,i.length+e.length*64),ae(u.length<=Io,`Transaction too large: ${u.length} > ${Io}`),u}get keys(){return ae(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return ae(this.instructions.length===1),this.instructions[0].programId}get data(){return ae(this.instructions.length===1),this.instructions[0].data}static from(t){let e=[...t],i=yi(e),o=[];for(let u=0;u0&&(i.feePayer=t.accountKeys[0]),e.forEach((o,u)=>{let h={signature:o==Ie.default.encode(v0)?null:Ie.default.decode(o),publicKey:t.accountKeys[u]};i.signatures.push(h)}),t.instructions.forEach(o=>{let u=o.accounts.map(h=>{let w=t.accountKeys[h];return{pubkey:w,isSigner:i.signatures.some(m=>m.publicKey.toString()===w.toString())||t.isAccountSigner(h),isWritable:t.isAccountWritable(h)}});i.instructions.push(new Xt({keys:u,programId:t.accountKeys[o.programIdIndex],data:Ie.default.decode(o.data)}))}),i._message=t,i._json=i.toJSON(),i}},x0=160,k0=64,S0=x0/k0,B0=1e3/S0,er=new at("SysvarC1ock11111111111111111111111111111111"),Fg=new at("SysvarEpochSchedu1e111111111111111111111111"),Kg=new at("Sysvar1nstructions1111111111111111111111111"),Zs=new at("SysvarRecentB1ockHashes11111111111111111111"),vi=new at("SysvarRent111111111111111111111111111111111"),Dg=new at("SysvarRewards111111111111111111111111111111"),Wg=new at("SysvarS1otHashes111111111111111111111111111"),Hg=new at("SysvarS1otHistory11111111111111111111111111"),js=new at("SysvarStakeHistory1111111111111111111111111"),ia=class extends Error{constructor({action:t,signature:e,transactionMessage:i,logs:o}){let u=o?`Logs: \n${JSON.stringify(o.slice(-10),null,2)}. `:"",h="\\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.",w;switch(t){case"send":w=`Transaction ${e} resulted in an error. \n${i}. `+u+h;break;case"simulate":w=`Simulation failed. \nMessage: ${i}. \n`+u+h;break;default:w=`Unknown action \'${(m=>m)(t)}\'`}super(w),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=e,this.transactionMessage=i,this.transactionLogs=o||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let t=this.transactionLogs;if(!(t!=null&&typeof t=="object"&&"then"in t))return t}async getLogs(t){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((e,i)=>{t.getTransaction(this.signature).then(o=>{if(o&&o.meta&&o.meta.logMessages){let u=o.meta.logMessages;this.transactionLogs=u,e(u)}else i(new Error("Log messages not found"))}).catch(i)})),await this.transactionLogs}};_0=S.nu64("lamportsPerSignature"),I0=S.struct([S.u32("version"),S.u32("state"),Ht("authorizedPubkey"),Ht("nonce"),S.struct([_0],"feeCalculator")]),Pc=I0.span,A0=r=>{let t=r.decode.bind(r),e=r.encode.bind(r);return{decode:t,encode:e}},M0=r=>t=>{let e=(0,Kc.blob)(r,t),{encode:i,decode:o}=A0(e),u=e;return u.decode=(h,w)=>{let m=o(h,w);return(0,Si.toBigIntLE)(it.Buffer.from(m))},u.encode=(h,w,m)=>{let x=(0,Si.toBufferLE)(h,r);return i(x,w,m)},u},Rn=M0(8),Re=Object.freeze({Create:{index:0,layout:S.struct([S.u32("instruction"),S.ns64("lamports"),S.ns64("space"),Ht("programId")])},Assign:{index:1,layout:S.struct([S.u32("instruction"),Ht("programId")])},Transfer:{index:2,layout:S.struct([S.u32("instruction"),Rn("lamports")])},CreateWithSeed:{index:3,layout:S.struct([S.u32("instruction"),Ht("base"),Ln("seed"),S.ns64("lamports"),S.ns64("space"),Ht("programId")])},AdvanceNonceAccount:{index:4,layout:S.struct([S.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:S.struct([S.u32("instruction"),Ht("authorized")])},AuthorizeNonceAccount:{index:7,layout:S.struct([S.u32("instruction"),Ht("authorized")])},Allocate:{index:8,layout:S.struct([S.u32("instruction"),S.ns64("space")])},AllocateWithSeed:{index:9,layout:S.struct([S.u32("instruction"),Ht("base"),Ln("seed"),S.ns64("space"),Ht("programId")])},AssignWithSeed:{index:10,layout:S.struct([S.u32("instruction"),Ht("base"),Ln("seed"),Ht("programId")])},TransferWithSeed:{index:11,layout:S.struct([S.u32("instruction"),Rn("lamports"),Ln("seed"),Ht("programId")])},UpgradeNonceAccount:{index:12,layout:S.struct([S.u32("instruction")])}}),fe=class{constructor(){}static createAccount(t){let e=Re.Create,i=Dt(e,{lamports:t.lamports,space:t.space,programId:Vt(t.programId.toBuffer())});return new Xt({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:i})}static transfer(t){let e,i;if("basePubkey"in t){let o=Re.TransferWithSeed;e=Dt(o,{lamports:BigInt(t.lamports),seed:t.seed,programId:Vt(t.programId.toBuffer())}),i=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}else{let o=Re.Transfer;e=Dt(o,{lamports:BigInt(t.lamports)}),i=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}return new Xt({keys:i,programId:this.programId,data:e})}static assign(t){let e,i;if("basePubkey"in t){let o=Re.AssignWithSeed;e=Dt(o,{base:Vt(t.basePubkey.toBuffer()),seed:t.seed,programId:Vt(t.programId.toBuffer())}),i=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{let o=Re.Assign;e=Dt(o,{programId:Vt(t.programId.toBuffer())}),i=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new Xt({keys:i,programId:this.programId,data:e})}static createAccountWithSeed(t){let e=Re.CreateWithSeed,i=Dt(e,{base:Vt(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:Vt(t.programId.toBuffer())}),o=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey.equals(t.fromPubkey)||o.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new Xt({keys:o,programId:this.programId,data:i})}static createNonceAccount(t){let e=new Jt;"basePubkey"in t&&"seed"in t?e.add(fe.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:Pc,programId:this.programId})):e.add(fe.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:Pc,programId:this.programId}));let i={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(i)),e}static nonceInitialize(t){let e=Re.InitializeNonceAccount,i=Dt(e,{authorized:Vt(t.authorizedPubkey.toBuffer())}),o={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Zs,isSigner:!1,isWritable:!1},{pubkey:vi,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new Xt(o)}static nonceAdvance(t){let e=Re.AdvanceNonceAccount,i=Dt(e),o={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Zs,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new Xt(o)}static nonceWithdraw(t){let e=Re.WithdrawNonceAccount,i=Dt(e,{lamports:t.lamports});return new Xt({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:Zs,isSigner:!1,isWritable:!1},{pubkey:vi,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static nonceAuthorize(t){let e=Re.AuthorizeNonceAccount,i=Dt(e,{authorized:Vt(t.newAuthorizedPubkey.toBuffer())});return new Xt({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static allocate(t){let e,i;if("basePubkey"in t){let o=Re.AllocateWithSeed;e=Dt(o,{base:Vt(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:Vt(t.programId.toBuffer())}),i=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{let o=Re.Allocate;e=Dt(o,{space:t.space}),i=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new Xt({keys:i,programId:this.programId,data:e})}};fe.programId=new at("11111111111111111111111111111111");L0=Io-300,Tn=class{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/Tn.chunkSize)+1+1)}static async load(t,e,i,o,u){{let k=await t.getMinimumBalanceForRentExemption(u.length),E=await t.getAccountInfo(i.publicKey,"confirmed"),M=null;if(E!==null){if(E.executable)return console.error("Program load failed, account is already executable"),!1;E.data.length!==u.length&&(M=M||new Jt,M.add(fe.allocate({accountPubkey:i.publicKey,space:u.length}))),E.owner.equals(o)||(M=M||new Jt,M.add(fe.assign({accountPubkey:i.publicKey,programId:o}))),E.lamports0?k:1,space:u.length,programId:o}));M!==null&&await Tc(t,M,[e,i],{commitment:"confirmed"})}let h=S.struct([S.u32("instruction"),S.u32("offset"),S.u32("bytesLength"),S.u32("bytesLengthPadding"),S.seq(S.u8("byte"),S.offset(S.u32(),-8),"bytes")]),w=Tn.chunkSize,m=0,x=u,v=[];for(;x.length>0;){let k=x.slice(0,w),E=it.Buffer.alloc(w+16);h.encode({instruction:0,offset:m,bytes:k,bytesLength:0,bytesLengthPadding:0},E);let M=new Jt().add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:E});v.push(Tc(t,M,[e,i],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await E0(1e3/4),m+=w,x=x.slice(w)}await Promise.all(v);{let k=S.struct([S.u32("instruction")]),E=it.Buffer.alloc(k.span);k.encode({instruction:1},E);let M=new Jt().add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:vi,isSigner:!1,isWritable:!1}],programId:o,data:E}),$="processed",R=await t.sendTransaction(M,[e,i],{preflightCommitment:$}),{context:B,value:U}=await t.confirmTransaction({signature:R,lastValidBlockHeight:M.lastValidBlockHeight,blockhash:M.recentBlockhash},$);if(U.err)throw new Error(`Transaction ${R} failed (${JSON.stringify(U)})`);for(;;){try{if(await t.getSlot({commitment:$})>B.slot)break}catch{}await new Promise(K=>setTimeout(K,Math.round(B0/2)))}}return!0}};Tn.chunkSize=L0;$g=new at("BPFLoader2111111111111111111111111111111111"),Vg=globalThis.fetch,Gg={index:1,layout:S.struct([S.u32("typeIndex"),Rn("deactivationSlot"),S.nu64("lastExtendedSlot"),S.u8("lastExtendedStartIndex"),S.u8(),S.seq(Ht(),S.offset(S.u8(),-1),"authority")])},ie=An(yo(at),W(),r=>new at(r)),Gc=go([W(),re("base64")]),ua=An(yo(it.Buffer),Gc,r=>it.Buffer.from(r[0],"base64")),Zg=30*1e3;R0=Zc(un());T0=z({foundation:I(),foundationTerm:I(),initial:I(),taper:I(),terminal:I()}),jg=Qt(Y(J(z({epoch:I(),effectiveSlot:I(),amount:I(),postBalance:I(),commission:rt(J(I()))})))),P0=Y(z({slot:I(),prioritizationFee:I()})),C0=z({total:I(),validator:I(),foundation:I(),epoch:I()}),O0=z({epoch:I(),slotIndex:I(),slotsInEpoch:I(),absoluteSlot:I(),blockHeight:rt(I()),transactionCount:rt(I())}),U0=z({slotsPerEpoch:I(),leaderScheduleSlotOffset:I(),warmup:Ne(),firstNormalEpoch:I(),firstNormalSlot:I()}),N0=Ps(W(),Y(I())),hn=J(pe([z({}),W()])),z0=z({err:hn}),q0=re("receivedSignature"),Yg=z({"solana-core":W(),"feature-set":rt(I())}),F0=z({program:W(),programId:ie,parsed:un()}),K0=z({programId:ie,accounts:Y(ie),data:W()}),Jg=Te(z({err:J(pe([z({}),W()])),logs:J(Y(W())),accounts:rt(J(Y(J(z({executable:Ne(),owner:W(),lamports:I(),data:Y(W()),rentEpoch:rt(I())}))))),unitsConsumed:rt(I()),returnData:rt(J(z({programId:W(),data:go([W(),re("base64")])}))),innerInstructions:rt(J(Y(z({index:I(),instructions:Y(pe([F0,K0]))}))))})),Xg=Te(z({byIdentity:Ps(W(),Y(I())),range:z({firstSlot:I(),lastSlot:I()})})),Qg=Qt(T0),tm=Qt(C0),em=Qt(P0),rm=Qt(O0),nm=Qt(U0),im=Qt(N0),om=Qt(I()),sm=Te(z({total:I(),circulating:I(),nonCirculating:I(),nonCirculatingAccounts:Y(ie)})),D0=z({amount:W(),uiAmount:J(I()),decimals:I(),uiAmountString:rt(W())}),am=Te(Y(z({address:ie,amount:W(),uiAmount:J(I()),decimals:I(),uiAmountString:rt(W())}))),um=Te(Y(z({pubkey:ie,account:z({executable:Ne(),owner:ie,lamports:I(),data:ua,rentEpoch:I()})}))),oa=z({program:W(),parsed:un(),space:I()}),cm=Te(Y(z({pubkey:ie,account:z({executable:Ne(),owner:ie,lamports:I(),data:oa,rentEpoch:I()})}))),fm=Te(Y(z({lamports:I(),address:ie}))),ca=z({executable:Ne(),owner:ie,lamports:I(),data:ua,rentEpoch:I()}),hm=z({pubkey:ie,account:ca}),W0=An(pe([yo(it.Buffer),oa]),pe([Gc,oa]),r=>Array.isArray(r)?In(r,ua):r),H0=z({executable:Ne(),owner:ie,lamports:I(),data:W0,rentEpoch:I()}),lm=z({pubkey:ie,account:H0}),dm=z({state:pe([re("active"),re("inactive"),re("activating"),re("deactivating")]),active:I(),inactive:I()}),pm=Qt(Y(z({signature:W(),slot:I(),err:hn,memo:J(W()),blockTime:rt(J(I()))}))),ym=Qt(Y(z({signature:W(),slot:I(),err:hn,memo:J(W()),blockTime:rt(J(I()))}))),gm=z({subscription:I(),result:Ro(ca)}),$0=z({pubkey:ie,account:ca}),mm=z({subscription:I(),result:Ro($0)}),V0=z({parent:I(),slot:I(),root:I()}),wm=z({subscription:I(),result:V0}),G0=pe([z({type:pe([re("firstShredReceived"),re("completed"),re("optimisticConfirmation"),re("root")]),slot:I(),timestamp:I()}),z({type:re("createdBank"),parent:I(),slot:I(),timestamp:I()}),z({type:re("frozen"),slot:I(),timestamp:I(),stats:z({numTransactionEntries:I(),numSuccessfulTransactions:I(),numFailedTransactions:I(),maxTransactionsPerEntry:I()})}),z({type:re("dead"),slot:I(),timestamp:I(),err:W()})]),bm=z({subscription:I(),result:G0}),vm=z({subscription:I(),result:Ro(pe([z0,q0]))}),xm=z({subscription:I(),result:I()}),km=z({pubkey:W(),gossip:J(W()),tpu:J(W()),rpc:J(W()),version:J(W())}),Cc=z({votePubkey:W(),nodePubkey:W(),activatedStake:I(),epochVoteAccount:Ne(),epochCredits:Y(go([I(),I(),I()])),commission:I(),lastVote:I(),rootSlot:J(I())}),Sm=Qt(z({current:Y(Cc),delinquent:Y(Cc)})),Z0=pe([re("processed"),re("confirmed"),re("finalized")]),j0=z({slot:I(),confirmations:J(I()),err:hn,confirmationStatus:rt(Z0)}),Bm=Te(Y(J(j0))),Em=Qt(I()),jc=z({accountKey:ie,writableIndexes:Y(I()),readonlyIndexes:Y(I())}),fa=z({signatures:Y(W()),message:z({accountKeys:Y(W()),header:z({numRequiredSignatures:I(),numReadonlySignedAccounts:I(),numReadonlyUnsignedAccounts:I()}),instructions:Y(z({accounts:Y(I()),data:W(),programIdIndex:I()})),recentBlockhash:W(),addressTableLookups:rt(Y(jc))})}),Yc=z({pubkey:ie,signer:Ne(),writable:Ne(),source:rt(pe([re("transaction"),re("lookupTable")]))}),Jc=z({accountKeys:Y(Yc),signatures:Y(W())}),Xc=z({parsed:un(),program:W(),programId:ie}),Qc=z({accounts:Y(ie),data:W(),programId:ie}),Y0=pe([Qc,Xc]),J0=pe([z({parsed:un(),program:W(),programId:W()}),z({accounts:Y(W()),data:W(),programId:W()})]),tf=An(Y0,J0,r=>"accounts"in r?In(r,Qc):In(r,Xc)),ef=z({signatures:Y(W()),message:z({accountKeys:Y(Yc),instructions:Y(tf),recentBlockhash:W(),addressTableLookups:rt(J(Y(jc)))})}),Mo=z({accountIndex:I(),mint:W(),owner:rt(W()),uiTokenAmount:D0}),rf=z({writable:Y(ie),readonly:Y(ie)}),To=z({err:hn,fee:I(),innerInstructions:rt(J(Y(z({index:I(),instructions:Y(z({accounts:Y(I()),data:W(),programIdIndex:I()}))})))),preBalances:Y(I()),postBalances:Y(I()),logMessages:rt(J(Y(W()))),preTokenBalances:rt(J(Y(Mo))),postTokenBalances:rt(J(Y(Mo))),loadedAddresses:rt(rf),computeUnitsConsumed:rt(I())}),ha=z({err:hn,fee:I(),innerInstructions:rt(J(Y(z({index:I(),instructions:Y(tf)})))),preBalances:Y(I()),postBalances:Y(I()),logMessages:rt(J(Y(W()))),preTokenBalances:rt(J(Y(Mo))),postTokenBalances:rt(J(Y(Mo))),loadedAddresses:rt(rf),computeUnitsConsumed:rt(I())}),On=pe([re(0),re("legacy")]),ln=z({pubkey:W(),lamports:I(),postBalance:J(I()),rewardType:J(W()),commission:rt(J(I()))}),_m=Qt(J(z({blockhash:W(),previousBlockhash:W(),parentSlot:I(),transactions:Y(z({transaction:fa,meta:J(To),version:rt(On)})),rewards:rt(Y(ln)),blockTime:J(I()),blockHeight:J(I())}))),Im=Qt(J(z({blockhash:W(),previousBlockhash:W(),parentSlot:I(),rewards:rt(Y(ln)),blockTime:J(I()),blockHeight:J(I())}))),Am=Qt(J(z({blockhash:W(),previousBlockhash:W(),parentSlot:I(),transactions:Y(z({transaction:Jc,meta:J(To),version:rt(On)})),rewards:rt(Y(ln)),blockTime:J(I()),blockHeight:J(I())}))),Mm=Qt(J(z({blockhash:W(),previousBlockhash:W(),parentSlot:I(),transactions:Y(z({transaction:ef,meta:J(ha),version:rt(On)})),rewards:rt(Y(ln)),blockTime:J(I()),blockHeight:J(I())}))),Lm=Qt(J(z({blockhash:W(),previousBlockhash:W(),parentSlot:I(),transactions:Y(z({transaction:Jc,meta:J(ha),version:rt(On)})),rewards:rt(Y(ln)),blockTime:J(I()),blockHeight:J(I())}))),Rm=Qt(J(z({blockhash:W(),previousBlockhash:W(),parentSlot:I(),rewards:rt(Y(ln)),blockTime:J(I()),blockHeight:J(I())}))),Tm=Qt(J(z({blockhash:W(),previousBlockhash:W(),parentSlot:I(),transactions:Y(z({transaction:fa,meta:J(To)})),rewards:rt(Y(ln)),blockTime:J(I())}))),Pm=Qt(J(z({blockhash:W(),previousBlockhash:W(),parentSlot:I(),signatures:Y(W()),blockTime:J(I())}))),Cm=Qt(J(z({slot:I(),meta:J(To),blockTime:rt(J(I())),transaction:fa,version:rt(On)}))),Om=Qt(J(z({slot:I(),transaction:ef,meta:J(ha),blockTime:rt(J(I())),version:rt(On)}))),Um=Te(z({blockhash:W(),feeCalculator:z({lamportsPerSignature:I()})})),Nm=Te(z({blockhash:W(),lastValidBlockHeight:I()})),zm=Te(Ne()),X0=z({slot:I(),numTransactions:I(),numSlots:I(),samplePeriodSecs:I()}),qm=Qt(Y(X0)),Fm=Te(J(z({feeCalculator:z({lamportsPerSignature:I()})}))),Km=Qt(W()),Dm=Qt(W()),Q0=z({err:hn,logs:Y(W()),signature:W()}),Wm=z({result:Ro(Q0),subscription:I()}),rr=class{constructor(t){this._keypair=void 0,this._keypair=t??Mc()}static generate(){return new rr(Mc())}static fromSecretKey(t,e){if(t.byteLength!==64)throw new Error("bad secret key size");let i=t.slice(32,64);if(!e||!e.skipValidation){let o=t.slice(0,32),u=Qs(o);for(let h=0;h<32;h++)if(i[h]!==u[h])throw new Error("provided secretKey is invalid")}return new rr({publicKey:i,secretKey:t})}static fromSeed(t){let e=Qs(t),i=new Uint8Array(64);return i.set(t),i.set(e,32),new rr({publicKey:e,secretKey:i})}get publicKey(){return new at(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}},di=Object.freeze({CreateLookupTable:{index:0,layout:S.struct([S.u32("instruction"),Rn("recentSlot"),S.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:S.struct([S.u32("instruction")])},ExtendLookupTable:{index:2,layout:S.struct([S.u32("instruction"),Rn(),S.seq(Ht(),S.offset(S.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:S.struct([S.u32("instruction")])},CloseLookupTable:{index:4,layout:S.struct([S.u32("instruction")])}}),sa=class{constructor(){}static createLookupTable(t){let[e,i]=at.findProgramAddressSync([t.authority.toBuffer(),(0,Si.toBufferLE)(BigInt(t.recentSlot),8)],this.programId),o=di.CreateLookupTable,u=Dt(o,{recentSlot:BigInt(t.recentSlot),bumpSeed:i}),h=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:fe.programId,isSigner:!1,isWritable:!1}];return[new Xt({programId:this.programId,keys:h,data:u}),e]}static freezeLookupTable(t){let e=di.FreezeLookupTable,i=Dt(e),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Xt({programId:this.programId,keys:o,data:i})}static extendLookupTable(t){let e=di.ExtendLookupTable,i=Dt(e,{addresses:t.addresses.map(u=>u.toBytes())}),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&o.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:fe.programId,isSigner:!1,isWritable:!1}),new Xt({programId:this.programId,keys:o,data:i})}static deactivateLookupTable(t){let e=di.DeactivateLookupTable,i=Dt(e),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Xt({programId:this.programId,keys:o,data:i})}static closeLookupTable(t){let e=di.CloseLookupTable,i=Dt(e),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new Xt({programId:this.programId,keys:o,data:i})}};sa.programId=new at("AddressLookupTab1e1111111111111111111111111");Eo=Object.freeze({RequestUnits:{index:0,layout:S.struct([S.u8("instruction"),S.u32("units"),S.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:S.struct([S.u8("instruction"),S.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:S.struct([S.u8("instruction"),S.u32("units")])},SetComputeUnitPrice:{index:3,layout:S.struct([S.u8("instruction"),Rn("microLamports")])}}),aa=class{constructor(){}static requestUnits(t){let e=Eo.RequestUnits,i=Dt(e,t);return new Xt({keys:[],programId:this.programId,data:i})}static requestHeapFrame(t){let e=Eo.RequestHeapFrame,i=Dt(e,t);return new Xt({keys:[],programId:this.programId,data:i})}static setComputeUnitLimit(t){let e=Eo.SetComputeUnitLimit,i=Dt(e,t);return new Xt({keys:[],programId:this.programId,data:i})}static setComputeUnitPrice(t){let e=Eo.SetComputeUnitPrice,i=Dt(e,{microLamports:BigInt(t.microLamports)});return new Xt({keys:[],programId:this.programId,data:i})}};aa.programId=new at("ComputeBudget111111111111111111111111111111");Oc=64,Uc=32,Nc=64,zc=S.struct([S.u8("numSignatures"),S.u8("padding"),S.u16("signatureOffset"),S.u16("signatureInstructionIndex"),S.u16("publicKeyOffset"),S.u16("publicKeyInstructionIndex"),S.u16("messageDataOffset"),S.u16("messageDataSize"),S.u16("messageInstructionIndex")]),xi=class{constructor(){}static createInstructionWithPublicKey(t){let{publicKey:e,message:i,signature:o,instructionIndex:u}=t;ae(e.length===Uc,`Public Key must be ${Uc} bytes but received ${e.length} bytes`),ae(o.length===Nc,`Signature must be ${Nc} bytes but received ${o.length} bytes`);let h=zc.span,w=h+e.length,m=w+o.length,x=1,v=it.Buffer.alloc(m+i.length),k=u??65535;return zc.encode({numSignatures:x,padding:0,signatureOffset:w,signatureInstructionIndex:k,publicKeyOffset:h,publicKeyInstructionIndex:k,messageDataOffset:m,messageDataSize:i.length,messageInstructionIndex:k},v),v.fill(e,h),v.fill(o,w),v.fill(i,m),new Xt({keys:[],programId:xi.programId,data:v})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:i,instructionIndex:o}=t;ae(e.length===Oc,`Private key must be ${Oc} bytes but received ${e.length} bytes`);try{let u=rr.fromSecretKey(e),h=u.publicKey.toBytes(),w=Dc(i,u.secretKey);return this.createInstructionWithPublicKey({publicKey:h,message:i,signature:w,instructionIndex:o})}catch(u){throw new Error(`Error creating instruction; ${u}`)}}};xi.programId=new at("Ed25519SigVerify111111111111111111111111111");td=(r,t)=>{let e=li.sign(r,t);return[e.toCompactRawBytes(),e.recovery]};li.utils.isValidPrivateKey;ed=li.getPublicKey,qc=32,Ys=20,Fc=64,rd=11,Js=S.struct([S.u8("numSignatures"),S.u16("signatureOffset"),S.u8("signatureInstructionIndex"),S.u16("ethAddressOffset"),S.u8("ethAddressInstructionIndex"),S.u16("messageDataOffset"),S.u16("messageDataSize"),S.u8("messageInstructionIndex"),S.blob(20,"ethAddress"),S.blob(64,"signature"),S.u8("recoveryId")]),cn=class{constructor(){}static publicKeyToEthAddress(t){ae(t.length===Fc,`Public key must be ${Fc} bytes but received ${t.length} bytes`);try{return it.Buffer.from(Hs(Vt(t))).slice(-Ys)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(t){let{publicKey:e,message:i,signature:o,recoveryId:u,instructionIndex:h}=t;return cn.createInstructionWithEthAddress({ethAddress:cn.publicKeyToEthAddress(e),message:i,signature:o,recoveryId:u,instructionIndex:h})}static createInstructionWithEthAddress(t){let{ethAddress:e,message:i,signature:o,recoveryId:u,instructionIndex:h=0}=t,w;typeof e=="string"?e.startsWith("0x")?w=it.Buffer.from(e.substr(2),"hex"):w=it.Buffer.from(e,"hex"):w=e,ae(w.length===Ys,`Address must be ${Ys} bytes but received ${w.length} bytes`);let m=1+rd,x=m,v=m+w.length,k=v+o.length+1,E=1,M=it.Buffer.alloc(Js.span+i.length);return Js.encode({numSignatures:E,signatureOffset:v,signatureInstructionIndex:h,ethAddressOffset:x,ethAddressInstructionIndex:h,messageDataOffset:k,messageDataSize:i.length,messageInstructionIndex:h,signature:Vt(o),ethAddress:Vt(w),recoveryId:u},M),M.fill(Vt(i),Js.span),new Xt({keys:[],programId:cn.programId,data:M})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:i,instructionIndex:o}=t;ae(e.length===qc,`Private key must be ${qc} bytes but received ${e.length} bytes`);try{let u=Vt(e),h=ed(u,!1).slice(1),w=it.Buffer.from(Hs(Vt(i))),[m,x]=td(w,u);return this.createInstructionWithPublicKey({publicKey:h,message:i,signature:m,recoveryId:x,instructionIndex:o})}catch(u){throw new Error(`Error creating instruction; ${u}`)}}};cn.programId=new at("KeccakSecp256k11111111111111111111111111111");nd=new at("StakeConfig11111111111111111111111111111111"),ki=class{constructor(t,e,i){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=i}};nf=ki;ki.default=new nf(0,0,at.default);Sr=Object.freeze({Initialize:{index:0,layout:S.struct([S.u32("instruction"),g0(),m0()])},Authorize:{index:1,layout:S.struct([S.u32("instruction"),Ht("newAuthorized"),S.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:S.struct([S.u32("instruction")])},Split:{index:3,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},Withdraw:{index:4,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},Deactivate:{index:5,layout:S.struct([S.u32("instruction")])},Merge:{index:7,layout:S.struct([S.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:S.struct([S.u32("instruction"),Ht("newAuthorized"),S.u32("stakeAuthorizationType"),Ln("authoritySeed"),Ht("authorityOwner")])}}),Hm=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),Lo=class{constructor(){}static initialize(t){let{stakePubkey:e,authorized:i,lockup:o}=t,u=o||ki.default,h=Sr.Initialize,w=Dt(h,{authorized:{staker:Vt(i.staker.toBuffer()),withdrawer:Vt(i.withdrawer.toBuffer())},lockup:{unixTimestamp:u.unixTimestamp,epoch:u.epoch,custodian:Vt(u.custodian.toBuffer())}}),m={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:vi,isSigner:!1,isWritable:!1}],programId:this.programId,data:w};return new Xt(m)}static createAccountWithSeed(t){let e=new Jt;e.add(fe.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:i,authorized:o,lockup:u}=t;return e.add(this.initialize({stakePubkey:i,authorized:o,lockup:u}))}static createAccount(t){let e=new Jt;e.add(fe.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:i,authorized:o,lockup:u}=t;return e.add(this.initialize({stakePubkey:i,authorized:o,lockup:u}))}static delegate(t){let{stakePubkey:e,authorizedPubkey:i,votePubkey:o}=t,u=Sr.Delegate,h=Dt(u);return new Jt().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:er,isSigner:!1,isWritable:!1},{pubkey:js,isSigner:!1,isWritable:!1},{pubkey:nd,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:h})}static authorize(t){let{stakePubkey:e,authorizedPubkey:i,newAuthorizedPubkey:o,stakeAuthorizationType:u,custodianPubkey:h}=t,w=Sr.Authorize,m=Dt(w,{newAuthorized:Vt(o.toBuffer()),stakeAuthorizationType:u.index}),x=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:er,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1}];return h&&x.push({pubkey:h,isSigner:!0,isWritable:!1}),new Jt().add({keys:x,programId:this.programId,data:m})}static authorizeWithSeed(t){let{stakePubkey:e,authorityBase:i,authoritySeed:o,authorityOwner:u,newAuthorizedPubkey:h,stakeAuthorizationType:w,custodianPubkey:m}=t,x=Sr.AuthorizeWithSeed,v=Dt(x,{newAuthorized:Vt(h.toBuffer()),stakeAuthorizationType:w.index,authoritySeed:o,authorityOwner:Vt(u.toBuffer())}),k=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:er,isSigner:!1,isWritable:!1}];return m&&k.push({pubkey:m,isSigner:!0,isWritable:!1}),new Jt().add({keys:k,programId:this.programId,data:v})}static splitInstruction(t){let{stakePubkey:e,authorizedPubkey:i,splitStakePubkey:o,lamports:u}=t,h=Sr.Split,w=Dt(h,{lamports:u});return new Xt({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:w})}static split(t,e){let i=new Jt;return i.add(fe.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:e,space:this.space,programId:this.programId})),i.add(this.splitInstruction(t))}static splitWithSeed(t,e){let{stakePubkey:i,authorizedPubkey:o,splitStakePubkey:u,basePubkey:h,seed:w,lamports:m}=t,x=new Jt;return x.add(fe.allocate({accountPubkey:u,basePubkey:h,seed:w,space:this.space,programId:this.programId})),e&&e>0&&x.add(fe.transfer({fromPubkey:t.authorizedPubkey,toPubkey:u,lamports:e})),x.add(this.splitInstruction({stakePubkey:i,authorizedPubkey:o,splitStakePubkey:u,lamports:m}))}static merge(t){let{stakePubkey:e,sourceStakePubKey:i,authorizedPubkey:o}=t,u=Sr.Merge,h=Dt(u);return new Jt().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:er,isSigner:!1,isWritable:!1},{pubkey:js,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!0,isWritable:!1}],programId:this.programId,data:h})}static withdraw(t){let{stakePubkey:e,authorizedPubkey:i,toPubkey:o,lamports:u,custodianPubkey:h}=t,w=Sr.Withdraw,m=Dt(w,{lamports:u}),x=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:er,isSigner:!1,isWritable:!1},{pubkey:js,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}];return h&&x.push({pubkey:h,isSigner:!0,isWritable:!1}),new Jt().add({keys:x,programId:this.programId,data:m})}static deactivate(t){let{stakePubkey:e,authorizedPubkey:i}=t,o=Sr.Deactivate,u=Dt(o);return new Jt().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:er,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:u})}};Lo.programId=new at("Stake11111111111111111111111111111111111111");Lo.space=200;pi=Object.freeze({InitializeAccount:{index:0,layout:S.struct([S.u32("instruction"),w0()])},Authorize:{index:1,layout:S.struct([S.u32("instruction"),Ht("newAuthorized"),S.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:S.struct([S.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:S.struct([S.u32("instruction"),b0()])}}),$m=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),Pn=class{constructor(){}static initializeAccount(t){let{votePubkey:e,nodePubkey:i,voteInit:o}=t,u=pi.InitializeAccount,h=Dt(u,{voteInit:{nodePubkey:Vt(o.nodePubkey.toBuffer()),authorizedVoter:Vt(o.authorizedVoter.toBuffer()),authorizedWithdrawer:Vt(o.authorizedWithdrawer.toBuffer()),commission:o.commission}}),w={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:vi,isSigner:!1,isWritable:!1},{pubkey:er,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:h};return new Xt(w)}static createAccount(t){let e=new Jt;return e.add(fe.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){let{votePubkey:e,authorizedPubkey:i,newAuthorizedPubkey:o,voteAuthorizationType:u}=t,h=pi.Authorize,w=Dt(h,{newAuthorized:Vt(o.toBuffer()),voteAuthorizationType:u.index}),m=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:er,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}];return new Jt().add({keys:m,programId:this.programId,data:w})}static authorizeWithSeed(t){let{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:i,currentAuthorityDerivedKeySeed:o,newAuthorizedPubkey:u,voteAuthorizationType:h,votePubkey:w}=t,m=pi.AuthorizeWithSeed,x=Dt(m,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Vt(i.toBuffer()),currentAuthorityDerivedKeySeed:o,newAuthorized:Vt(u.toBuffer()),voteAuthorizationType:h.index}}),v=[{pubkey:w,isSigner:!1,isWritable:!0},{pubkey:er,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return new Jt().add({keys:v,programId:this.programId,data:x})}static withdraw(t){let{votePubkey:e,authorizedWithdrawerPubkey:i,lamports:o,toPubkey:u}=t,h=pi.Withdraw,w=Dt(h,{lamports:o}),m=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:u,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1}];return new Jt().add({keys:m,programId:this.programId,data:w})}static safeWithdraw(t,e,i){if(t.lamports>e-i)throw new Error("Withdraw will leave vote account with insufficient funds.");return Pn.withdraw(t)}static updateValidatorIdentity(t){let{votePubkey:e,authorizedWithdrawerPubkey:i,nodePubkey:o}=t,u=pi.UpdateValidatorIdentity,h=Dt(u),w=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}];return new Jt().add({keys:w,programId:this.programId,data:h})}};Pn.programId=new at("Vote111111111111111111111111111111111111111");Pn.space=3762;Vm=new at("Va1idator1nfo111111111111111111111111111111"),Gm=z({name:W(),website:rt(W()),details:rt(W()),iconUrl:rt(W()),keybaseUsername:rt(W())}),Zm=new at("Vote111111111111111111111111111111111111111"),jm=S.struct([Ht("nodePubkey"),Ht("authorizedWithdrawer"),S.u8("commission"),S.nu64(),S.seq(S.struct([S.nu64("slot"),S.u32("confirmationCount")]),S.offset(S.u32(),-8),"votes"),S.u8("rootSlotValid"),S.nu64("rootSlot"),S.nu64(),S.seq(S.struct([S.nu64("epoch"),Ht("authorizedVoter")]),S.offset(S.u32(),-8),"authorizedVoters"),S.struct([S.seq(S.struct([Ht("authorizedPubkey"),S.nu64("epochOfLastAuthorizedSwitch"),S.nu64("targetEpoch")]),32,"buf"),S.nu64("idx"),S.u8("isEmpty")],"priorVoters"),S.nu64(),S.seq(S.struct([S.nu64("epoch"),S.nu64("credits"),S.nu64("prevCredits")]),S.offset(S.u32(),-8),"epochCredits"),S.struct([S.nu64("slot"),S.nu64("timestamp")],"lastTimestamp")])});function sf(){let r=rr.generate();return{privateKey:Buffer.from(r.secretKey).toString("hex"),publicKey:r.publicKey.toString()}}var t1,af=wt(()=>{"use strict";t1=P(O());of()});async function uf({accessControlConditions:r}){let{privateKey:t,publicKey:e}=sf();return Ka({accessControlConditions:r,publicKey:e,privateKey:t})}var i1,cf=wt(()=>{"use strict";i1=P(O());Da();af()});var id=oe(()=>{var c1=P(O());za();cf();(async()=>Na(async()=>uf({accessControlConditions})))()});id();})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n *)\n\n@noble/hashes/esm/utils.js:\n (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/utils.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/modular.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/curve.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/edwards.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/ed25519.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\nsafe-buffer/index.js:\n (*! safe-buffer. MIT License. Feross Aboukhadijeh *)\n\n@solana/buffer-layout/lib/Layout.js:\n (**\n * Support for translating between Uint8Array instances and JavaScript\n * native types.\n *\n * {@link module:Layout~Layout|Layout} is the basis of a class\n * hierarchy that associates property names with sequences of encoded\n * bytes.\n *\n * Layouts are supported for these scalar (numeric) types:\n * * {@link module:Layout~UInt|Unsigned integers in little-endian\n * format} with {@link module:Layout.u8|8-bit}, {@link\n * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},\n * {@link module:Layout.u32|32-bit}, {@link\n * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}\n * representation ranges;\n * * {@link module:Layout~UIntBE|Unsigned integers in big-endian\n * format} with {@link module:Layout.u16be|16-bit}, {@link\n * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},\n * {@link module:Layout.u40be|40-bit}, and {@link\n * module:Layout.u48be|48-bit} representation ranges;\n * * {@link module:Layout~Int|Signed integers in little-endian\n * format} with {@link module:Layout.s8|8-bit}, {@link\n * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},\n * {@link module:Layout.s32|32-bit}, {@link\n * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}\n * representation ranges;\n * * {@link module:Layout~IntBE|Signed integers in big-endian format}\n * with {@link module:Layout.s16be|16-bit}, {@link\n * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},\n * {@link module:Layout.s40be|40-bit}, and {@link\n * module:Layout.s48be|48-bit} representation ranges;\n * * 64-bit integral values that decode to an exact (if magnitude is\n * less than 2^53) or nearby integral Number in {@link\n * module:Layout.nu64|unsigned little-endian}, {@link\n * module:Layout.nu64be|unsigned big-endian}, {@link\n * module:Layout.ns64|signed little-endian}, and {@link\n * module:Layout.ns64be|unsigned big-endian} encodings;\n * * 32-bit floating point values with {@link\n * module:Layout.f32|little-endian} and {@link\n * module:Layout.f32be|big-endian} representations;\n * * 64-bit floating point values with {@link\n * module:Layout.f64|little-endian} and {@link\n * module:Layout.f64be|big-endian} representations;\n * * {@link module:Layout.const|Constants} that take no space in the\n * encoded expression.\n *\n * and for these aggregate types:\n * * {@link module:Layout.seq|Sequence}s of instances of a {@link\n * module:Layout~Layout|Layout}, with JavaScript representation as\n * an Array and constant or data-dependent {@link\n * module:Layout~Sequence#count|length};\n * * {@link module:Layout.struct|Structure}s that aggregate a\n * heterogeneous sequence of {@link module:Layout~Layout|Layout}\n * instances, with JavaScript representation as an Object;\n * * {@link module:Layout.union|Union}s that support multiple {@link\n * module:Layout~VariantLayout|variant layouts} over a fixed\n * (padded) or variable (not padded) span of bytes, using an\n * unsigned integer at the start of the data or a separate {@link\n * module:Layout.unionLayoutDiscriminator|layout element} to\n * determine which layout to use when interpreting the buffer\n * contents;\n * * {@link module:Layout.bits|BitStructure}s that contain a sequence\n * of individual {@link\n * module:Layout~BitStructure#addField|BitField}s packed into an 8,\n * 16, 24, or 32-bit unsigned integer starting at the least- or\n * most-significant bit;\n * * {@link module:Layout.cstr|C strings} of varying length;\n * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link\n * module:Layout~Blob#length|length} raw data.\n *\n * All {@link module:Layout~Layout|Layout} instances are immutable\n * after construction, to prevent internal state from becoming\n * inconsistent.\n *\n * @local Layout\n * @local ExternalLayout\n * @local GreedyCount\n * @local OffsetLayout\n * @local UInt\n * @local UIntBE\n * @local Int\n * @local IntBE\n * @local NearUInt64\n * @local NearUInt64BE\n * @local NearInt64\n * @local NearInt64BE\n * @local Float\n * @local FloatBE\n * @local Double\n * @local DoubleBE\n * @local Sequence\n * @local Structure\n * @local UnionDiscriminator\n * @local UnionLayoutDiscriminator\n * @local Union\n * @local VariantLayout\n * @local BitStructure\n * @local BitField\n * @local Boolean\n * @local Blob\n * @local CString\n * @local Constant\n * @local bindConstructorLayout\n * @module Layout\n * @license MIT\n * @author Peter A. Bigot\n * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}\n *)\n\n@noble/curves/esm/abstract/weierstrass.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/_shortw_utils.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/secp256k1.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n*/\n'; + module2.exports = { + code: code9 + }; + } +}); + +// packages/wrapped-keys-lit-actions/src/generated/solana/signMessageWithEncryptedSolanaKey.js +var require_signMessageWithEncryptedSolanaKey = __commonJS({ + "packages/wrapped-keys-lit-actions/src/generated/solana/signMessageWithEncryptedSolanaKey.js"(exports, module2) { + "use strict"; + init_shim(); + var code9 = '"use strict";(()=>{var qc=Object.create;var Vi=Object.defineProperty;var Fc=Object.getOwnPropertyDescriptor;var Kc=Object.getOwnPropertyNames;var Dc=Object.getPrototypeOf,Wc=Object.prototype.hasOwnProperty;var za=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error(\'Dynamic require of "\'+r+\'" is not supported\')});var le=(r,t)=>()=>(r&&(t=r(r=0)),t);var $e=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),qa=(r,t)=>{for(var e in t)Vi(r,e,{get:t[e],enumerable:!0})},Fa=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kc(t))!Wc.call(r,o)&&o!==e&&Vi(r,o,{get:()=>t[o],enumerable:!(n=Fc(t,o))||n.enumerable});return r};var H=(r,t,e)=>(e=r!=null?qc(Dc(r)):{},Fa(t||!r||!r.__esModule?Vi(e,"default",{value:r,enumerable:!0}):e,r)),Ka=r=>Fa(Vi({},"__esModule",{value:!0}),r);var Ha=$e(ji=>{"use strict";var qd=H(V());ji.byteLength=$c;ji.toByteArray=jc;ji.fromByteArray=Zc;var Nr=[],Br=[],Hc=typeof Uint8Array<"u"?Uint8Array:Array,rs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_n=0,Da=rs.length;_n0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}function $c(r){var t=Wa(r),e=t[0],n=t[1];return(e+n)*3/4-n}function Vc(r,t,e){return(t+e)*3/4-e}function jc(r){var t,e=Wa(r),n=e[0],o=e[1],f=new Hc(Vc(r,n,o)),h=0,x=o>0?n-4:n,b;for(b=0;b>16&255,f[h++]=t>>8&255,f[h++]=t&255;return o===2&&(t=Br[r.charCodeAt(b)]<<2|Br[r.charCodeAt(b+1)]>>4,f[h++]=t&255),o===1&&(t=Br[r.charCodeAt(b)]<<10|Br[r.charCodeAt(b+1)]<<4|Br[r.charCodeAt(b+2)]>>2,f[h++]=t>>8&255,f[h++]=t&255),f}function Gc(r){return Nr[r>>18&63]+Nr[r>>12&63]+Nr[r>>6&63]+Nr[r&63]}function Yc(r,t,e){for(var n,o=[],f=t;fx?x:h+f));return n===1?(t=r[e-1],o.push(Nr[t>>2]+Nr[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],o.push(Nr[t>>10]+Nr[t>>4&63]+Nr[t<<2&63]+"=")),o.join("")}});var $a=$e(ns=>{var Kd=H(V());ns.read=function(r,t,e,n,o){var f,h,x=o*8-n-1,b=(1<>1,_=-7,I=e?o-1:0,C=e?-1:1,N=r[t+I];for(I+=C,f=N&(1<<-_)-1,N>>=-_,_+=x;_>0;f=f*256+r[t+I],I+=C,_-=8);for(h=f&(1<<-_)-1,f>>=-_,_+=n;_>0;h=h*256+r[t+I],I+=C,_-=8);if(f===0)f=1-E;else{if(f===b)return h?NaN:(N?-1:1)*(1/0);h=h+Math.pow(2,n),f=f-E}return(N?-1:1)*h*Math.pow(2,f-n)};ns.write=function(r,t,e,n,o,f){var h,x,b,E=f*8-o-1,_=(1<>1,C=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=n?0:f-1,ft=n?1:-1,D=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(x=isNaN(t)?1:0,h=_):(h=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-h))<1&&(h--,b*=2),h+I>=1?t+=C/b:t+=C*Math.pow(2,1-I),t*b>=2&&(h++,b/=2),h+I>=_?(x=0,h=_):h+I>=1?(x=(t*b-1)*Math.pow(2,o),h=h+I):(x=t*Math.pow(2,I-1)*Math.pow(2,o),h=0));o>=8;r[e+N]=x&255,N+=ft,x/=256,o-=8);for(h=h<0;r[e+N]=h&255,N+=ft,h/=256,E-=8);r[e+N-ft]|=D*128}});var An=$e(Gn=>{"use strict";var Hd=H(V());var is=Ha(),Vn=$a(),Va=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Gn.Buffer=j;Gn.SlowBuffer=rh;Gn.INSPECT_MAX_BYTES=50;var Gi=2147483647;Gn.kMaxLength=Gi;j.TYPED_ARRAY_SUPPORT=Jc();!j.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Jc(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(j.prototype,"parent",{enumerable:!0,get:function(){if(j.isBuffer(this))return this.buffer}});Object.defineProperty(j.prototype,"offset",{enumerable:!0,get:function(){if(j.isBuffer(this))return this.byteOffset}});function Hr(r){if(r>Gi)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\');let t=new Uint8Array(r);return Object.setPrototypeOf(t,j.prototype),t}function j(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return fs(r)}return Za(r,t,e)}j.poolSize=8192;function Za(r,t,e){if(typeof r=="string")return Qc(r,t);if(ArrayBuffer.isView(r))return th(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(zr(r,ArrayBuffer)||r&&zr(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(zr(r,SharedArrayBuffer)||r&&zr(r.buffer,SharedArrayBuffer)))return ss(r,t,e);if(typeof r=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return j.from(n,t,e);let o=eh(r);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return j.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}j.from=function(r,t,e){return Za(r,t,e)};Object.setPrototypeOf(j.prototype,Uint8Array.prototype);Object.setPrototypeOf(j,Uint8Array);function Ja(r){if(typeof r!="number")throw new TypeError(\'"size" argument must be of type number\');if(r<0)throw new RangeError(\'The value "\'+r+\'" is invalid for option "size"\')}function Xc(r,t,e){return Ja(r),r<=0?Hr(r):t!==void 0?typeof e=="string"?Hr(r).fill(t,e):Hr(r).fill(t):Hr(r)}j.alloc=function(r,t,e){return Xc(r,t,e)};function fs(r){return Ja(r),Hr(r<0?0:us(r)|0)}j.allocUnsafe=function(r){return fs(r)};j.allocUnsafeSlow=function(r){return fs(r)};function Qc(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!j.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=Xa(r,t)|0,n=Hr(e),o=n.write(r,t);return o!==e&&(n=n.slice(0,o)),n}function os(r){let t=r.length<0?0:us(r.length)|0,e=Hr(t);for(let n=0;n=Gi)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Gi.toString(16)+" bytes");return r|0}function rh(r){return+r!=r&&(r=0),j.alloc(+r)}j.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==j.prototype};j.compare=function(t,e){if(zr(t,Uint8Array)&&(t=j.from(t,t.offset,t.byteLength)),zr(e,Uint8Array)&&(e=j.from(e,e.offset,e.byteLength)),!j.isBuffer(t)||!j.isBuffer(e))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(t===e)return 0;let n=t.length,o=e.length;for(let f=0,h=Math.min(n,o);fo.length?(j.isBuffer(h)||(h=j.from(h)),h.copy(o,f)):Uint8Array.prototype.set.call(o,h,f);else if(j.isBuffer(h))h.copy(o,f);else throw new TypeError(\'"list" argument must be an Array of Buffers\');f+=h.length}return o};function Xa(r,t){if(j.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||zr(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof r);let e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return as(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return ff(r).length;default:if(o)return n?-1:as(r).length;t=(""+t).toLowerCase(),o=!0}}j.byteLength=Xa;function nh(r,t,e){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return dh(this,t,e);case"utf8":case"utf-8":return tf(this,t,e);case"ascii":return hh(this,t,e);case"latin1":case"binary":return lh(this,t,e);case"base64":return uh(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ph(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}j.prototype._isBuffer=!0;function En(r,t,e){let n=r[t];r[t]=r[e],r[e]=n}j.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;ee&&(t+=" ... "),""};Va&&(j.prototype[Va]=j.prototype.inspect);j.prototype.compare=function(t,e,n,o,f){if(zr(t,Uint8Array)&&(t=j.from(t,t.offset,t.byteLength)),!j.isBuffer(t))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),o===void 0&&(o=0),f===void 0&&(f=this.length),e<0||n>t.length||o<0||f>this.length)throw new RangeError("out of range index");if(o>=f&&e>=n)return 0;if(o>=f)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,f>>>=0,this===t)return 0;let h=f-o,x=n-e,b=Math.min(h,x),E=this.slice(o,f),_=t.slice(e,n);for(let I=0;I2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,hs(e)&&(e=o?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(o)return-1;e=r.length-1}else if(e<0)if(o)e=0;else return-1;if(typeof t=="string"&&(t=j.from(t,n)),j.isBuffer(t))return t.length===0?-1:ja(r,t,e,n,o);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):ja(r,[t],e,n,o);throw new TypeError("val must be string, number or Buffer")}function ja(r,t,e,n,o){let f=1,h=r.length,x=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;f=2,h/=2,x/=2,e/=2}function b(_,I){return f===1?_[I]:_.readUInt16BE(I*f)}let E;if(o){let _=-1;for(E=e;Eh&&(e=h-x),E=e;E>=0;E--){let _=!0;for(let I=0;Io&&(n=o)):n=o;let f=t.length;n>f/2&&(n=f/2);let h;for(h=0;h>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let f=this.length-e;if((n===void 0||n>f)&&(n=f),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let h=!1;for(;;)switch(o){case"hex":return ih(this,t,e,n);case"utf8":case"utf-8":return oh(this,t,e,n);case"ascii":case"latin1":case"binary":return sh(this,t,e,n);case"base64":return ah(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fh(this,t,e,n);default:if(h)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),h=!0}};j.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function uh(r,t,e){return t===0&&e===r.length?is.fromByteArray(r):is.fromByteArray(r.slice(t,e))}function tf(r,t,e){e=Math.min(r.length,e);let n=[],o=t;for(;o239?4:f>223?3:f>191?2:1;if(o+x<=e){let b,E,_,I;switch(x){case 1:f<128&&(h=f);break;case 2:b=r[o+1],(b&192)===128&&(I=(f&31)<<6|b&63,I>127&&(h=I));break;case 3:b=r[o+1],E=r[o+2],(b&192)===128&&(E&192)===128&&(I=(f&15)<<12|(b&63)<<6|E&63,I>2047&&(I<55296||I>57343)&&(h=I));break;case 4:b=r[o+1],E=r[o+2],_=r[o+3],(b&192)===128&&(E&192)===128&&(_&192)===128&&(I=(f&15)<<18|(b&63)<<12|(E&63)<<6|_&63,I>65535&&I<1114112&&(h=I))}}h===null?(h=65533,x=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|h&1023),n.push(h),o+=x}return ch(n)}var Ga=4096;function ch(r){let t=r.length;if(t<=Ga)return String.fromCharCode.apply(String,r);let e="",n=0;for(;nn)&&(e=n);let o="";for(let f=t;fn&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),ee)throw new RangeError("Trying to access beyond buffer length")}j.prototype.readUintLE=j.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||Ye(t,e,this.length);let o=this[t],f=1,h=0;for(;++h>>0,e=e>>>0,n||Ye(t,e,this.length);let o=this[t+--e],f=1;for(;e>0&&(f*=256);)o+=this[t+--e]*f;return o};j.prototype.readUint8=j.prototype.readUInt8=function(t,e){return t=t>>>0,e||Ye(t,1,this.length),this[t]};j.prototype.readUint16LE=j.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||Ye(t,2,this.length),this[t]|this[t+1]<<8};j.prototype.readUint16BE=j.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||Ye(t,2,this.length),this[t]<<8|this[t+1]};j.prototype.readUint32LE=j.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||Ye(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};j.prototype.readUint32BE=j.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||Ye(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};j.prototype.readBigUInt64LE=nn(function(t){t=t>>>0,jn(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&pi(t,this.length-8);let o=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,f=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(o)+(BigInt(f)<>>0,jn(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&pi(t,this.length-8);let o=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],f=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(o)<>>0,e=e>>>0,n||Ye(t,e,this.length);let o=this[t],f=1,h=0;for(;++h=f&&(o-=Math.pow(2,8*e)),o};j.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||Ye(t,e,this.length);let o=e,f=1,h=this[t+--o];for(;o>0&&(f*=256);)h+=this[t+--o]*f;return f*=128,h>=f&&(h-=Math.pow(2,8*e)),h};j.prototype.readInt8=function(t,e){return t=t>>>0,e||Ye(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};j.prototype.readInt16LE=function(t,e){t=t>>>0,e||Ye(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};j.prototype.readInt16BE=function(t,e){t=t>>>0,e||Ye(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};j.prototype.readInt32LE=function(t,e){return t=t>>>0,e||Ye(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};j.prototype.readInt32BE=function(t,e){return t=t>>>0,e||Ye(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};j.prototype.readBigInt64LE=nn(function(t){t=t>>>0,jn(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&pi(t,this.length-8);let o=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(o)<>>0,jn(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&pi(t,this.length-8);let o=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(o)<>>0,e||Ye(t,4,this.length),Vn.read(this,t,!0,23,4)};j.prototype.readFloatBE=function(t,e){return t=t>>>0,e||Ye(t,4,this.length),Vn.read(this,t,!1,23,4)};j.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||Ye(t,8,this.length),Vn.read(this,t,!0,52,8)};j.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||Ye(t,8,this.length),Vn.read(this,t,!1,52,8)};function pr(r,t,e,n,o,f){if(!j.isBuffer(r))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(t>o||tr.length)throw new RangeError("Index out of range")}j.prototype.writeUintLE=j.prototype.writeUIntLE=function(t,e,n,o){if(t=+t,e=e>>>0,n=n>>>0,!o){let x=Math.pow(2,8*n)-1;pr(this,t,e,n,x,0)}let f=1,h=0;for(this[e]=t&255;++h>>0,n=n>>>0,!o){let x=Math.pow(2,8*n)-1;pr(this,t,e,n,x,0)}let f=n-1,h=1;for(this[e+f]=t&255;--f>=0&&(h*=256);)this[e+f]=t/h&255;return e+n};j.prototype.writeUint8=j.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,1,255,0),this[e]=t&255,e+1};j.prototype.writeUint16LE=j.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};j.prototype.writeUint16BE=j.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};j.prototype.writeUint32LE=j.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};j.prototype.writeUint32BE=j.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function ef(r,t,e,n,o){af(t,n,o,r,e,7);let f=Number(t&BigInt(4294967295));r[e++]=f,f=f>>8,r[e++]=f,f=f>>8,r[e++]=f,f=f>>8,r[e++]=f;let h=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=h,h=h>>8,r[e++]=h,h=h>>8,r[e++]=h,h=h>>8,r[e++]=h,e}function rf(r,t,e,n,o){af(t,n,o,r,e,7);let f=Number(t&BigInt(4294967295));r[e+7]=f,f=f>>8,r[e+6]=f,f=f>>8,r[e+5]=f,f=f>>8,r[e+4]=f;let h=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=h,h=h>>8,r[e+2]=h,h=h>>8,r[e+1]=h,h=h>>8,r[e]=h,e+8}j.prototype.writeBigUInt64LE=nn(function(t,e=0){return ef(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});j.prototype.writeBigUInt64BE=nn(function(t,e=0){return rf(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});j.prototype.writeIntLE=function(t,e,n,o){if(t=+t,e=e>>>0,!o){let b=Math.pow(2,8*n-1);pr(this,t,e,n,b-1,-b)}let f=0,h=1,x=0;for(this[e]=t&255;++f>0)-x&255;return e+n};j.prototype.writeIntBE=function(t,e,n,o){if(t=+t,e=e>>>0,!o){let b=Math.pow(2,8*n-1);pr(this,t,e,n,b-1,-b)}let f=n-1,h=1,x=0;for(this[e+f]=t&255;--f>=0&&(h*=256);)t<0&&x===0&&this[e+f+1]!==0&&(x=1),this[e+f]=(t/h>>0)-x&255;return e+n};j.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};j.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};j.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};j.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};j.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||pr(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};j.prototype.writeBigInt64LE=nn(function(t,e=0){return ef(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});j.prototype.writeBigInt64BE=nn(function(t,e=0){return rf(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nf(r,t,e,n,o,f){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function of(r,t,e,n,o){return t=+t,e=e>>>0,o||nf(r,t,e,4,34028234663852886e22,-34028234663852886e22),Vn.write(r,t,e,n,23,4),e+4}j.prototype.writeFloatLE=function(t,e,n){return of(this,t,e,!0,n)};j.prototype.writeFloatBE=function(t,e,n){return of(this,t,e,!1,n)};function sf(r,t,e,n,o){return t=+t,e=e>>>0,o||nf(r,t,e,8,17976931348623157e292,-17976931348623157e292),Vn.write(r,t,e,n,52,8),e+8}j.prototype.writeDoubleLE=function(t,e,n){return sf(this,t,e,!0,n)};j.prototype.writeDoubleBE=function(t,e,n){return sf(this,t,e,!1,n)};j.prototype.copy=function(t,e,n,o){if(!j.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let f;if(typeof t=="number")for(f=e;f2**32?o=Ya(String(e)):typeof e=="bigint"&&(o=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(o=Ya(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n},RangeError);function Ya(r){let t="",e=r.length,n=r[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function yh(r,t,e){jn(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&pi(t,r.length-(e+1))}function af(r,t,e,n,o,f){if(r>e||r3?t===0||t===BigInt(0)?x=`>= 0${h} and < 2${h} ** ${(f+1)*8}${h}`:x=`>= -(2${h} ** ${(f+1)*8-1}${h}) and < 2 ** ${(f+1)*8-1}${h}`:x=`>= ${t}${h} and <= ${e}${h}`,new $n.ERR_OUT_OF_RANGE("value",x,r)}yh(n,o,f)}function jn(r,t){if(typeof r!="number")throw new $n.ERR_INVALID_ARG_TYPE(t,"number",r)}function pi(r,t,e){throw Math.floor(r)!==r?(jn(r,e),new $n.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new $n.ERR_BUFFER_OUT_OF_BOUNDS:new $n.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var gh=/[^+/0-9A-Za-z-_]/g;function mh(r){if(r=r.split("=")[0],r=r.trim().replace(gh,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function as(r,t){t=t||1/0;let e,n=r.length,o=null,f=[];for(let h=0;h55295&&e<57344){if(!o){if(e>56319){(t-=3)>-1&&f.push(239,191,189);continue}else if(h+1===n){(t-=3)>-1&&f.push(239,191,189);continue}o=e;continue}if(e<56320){(t-=3)>-1&&f.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536}else o&&(t-=3)>-1&&f.push(239,191,189);if(o=null,e<128){if((t-=1)<0)break;f.push(e)}else if(e<2048){if((t-=2)<0)break;f.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;f.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;f.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return f}function wh(r){let t=[];for(let e=0;e>8,o=e%256,f.push(o),f.push(n);return f}function ff(r){return is.toByteArray(mh(r))}function Yi(r,t,e,n){let o;for(o=0;o=t.length||o>=r.length);++o)t[o+e]=r[o];return o}function zr(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function hs(r){return r!==r}var xh=function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let o=0;o<16;++o)t[n+o]=r[e]+r[o]}return t}();function nn(r){return typeof BigInt>"u"?vh:r}function vh(){throw new Error("BigInt not supported")}});var V=$e(()=>{"use strict";var uf=H(An());globalThis.Buffer=uf.Buffer});var Gd,Yn,ls=le(()=>{"use strict";Gd=H(V()),Yn=class extends Error{constructor(){super(...arguments);this.name="AbortError"}}});async function cf(r){try{let t=await r(),e=typeof t=="string"?t:JSON.stringify(t);Lit.Actions.setResponse({response:e})}catch(t){if(t instanceof Yn)return;Lit.Actions.setResponse({response:`Error: ${t.message}`})}}var Jd,hf=le(()=>{"use strict";Jd=H(V());ls()});var Qd,Zi,lf=le(()=>{"use strict";Qd=H(V()),Zi="lit_"});function df(r){if(!r.startsWith(Zi))throw new Error(`PKey was not encrypted with salt; all wrapped keys must be prefixed with \'${Zi}\'`);return r.slice(Zi.length)}var rp,pf=le(()=>{"use strict";rp=H(V());lf()});async function kh({accessControlConditions:r,ciphertext:t,dataToEncryptHash:e}){try{return await Lit.Actions.decryptToSingleNode({accessControlConditions:r,ciphertext:t,dataToEncryptHash:e,chain:"ethereum",authSig:null})}catch(n){throw new Error(`When decrypting key to a single node - ${n.message}`)}}async function yf({accessControlConditions:r,ciphertext:t,dataToEncryptHash:e}){let n=await kh({accessControlConditions:r,ciphertext:t,dataToEncryptHash:e});if(!n)throw new Yn;return df(n)}var sp,gf=le(()=>{"use strict";sp=H(V());ls();pf()});function yi(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function Sh(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function on(r,...t){if(!Sh(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${r.length}`)}function mf(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");yi(r.outputLen),yi(r.blockLen)}function $r(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Ji(r,t){on(r);let e=t.outputLen;if(r.length{fp=H(V(),1)});var cp,In,wf=le(()=>{cp=H(V(),1),In=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function ps(r){for(let t=0;tr().update(an(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function vf(r){let t=(n,o)=>r(o).update(an(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function Qi(r=32){if(In&&typeof In.getRandomValues=="function")return In.getRandomValues(new Uint8Array(r));if(In&&typeof In.randomBytes=="function")return In.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}var yp,bf,Xi,Lr,ds,Bh,sn,dp,fn=le(()=>{yp=H(V(),1);wf();gi();bf=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),Xi=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Lr=(r,t)=>r<<32-t|r>>>t,ds=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Bh=r=>r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255;sn=class{clone(){return this._cloneInto()}},dp={}.toString});function _h(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),f=BigInt(4294967295),h=Number(e>>o&f),x=Number(e&f),b=n?4:0,E=n?0:4;r.setUint32(t+b,h,n),r.setUint32(t+E,x,n)}var bp,kf,Sf,Jn,gs=le(()=>{bp=H(V(),1);gi();fn();kf=(r,t,e)=>r&t^~r&e,Sf=(r,t,e)=>r&t^r&e^t&e,Jn=class extends sn{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Xi(this.buffer)}update(t){$r(this);let{view:e,buffer:n,blockLen:o}=this;t=an(t);let f=t.length;for(let h=0;ho-h&&(this.process(n,0),h=0);for(let I=h;I_.length)throw new Error("_sha2: outputLen bigger than state");for(let I=0;I>ms&to)}:{h:Number(r>>ms&to)|0,l:Number(r&to)|0}}function ws(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var vp,to,ms,Eh,Ah,Ih,Mh,Lh,Rh,Th,Ph,Ch,bs,xs,vs,ks,Oh,Nh,zh,qh,Fh,Kh,Dh,ge,Ss=le(()=>{vp=H(V(),1),to=BigInt(4294967295),ms=BigInt(32);Eh=(r,t)=>BigInt(r>>>0)<>>0),Ah=(r,t,e)=>r>>>e,Ih=(r,t,e)=>r<<32-e|t>>>e,Mh=(r,t,e)=>r>>>e|t<<32-e,Lh=(r,t,e)=>r<<32-e|t>>>e,Rh=(r,t,e)=>r<<64-e|t>>>e-32,Th=(r,t,e)=>r>>>e-32|t<<64-e,Ph=(r,t)=>t,Ch=(r,t)=>r,bs=(r,t,e)=>r<>>32-e,xs=(r,t,e)=>t<>>32-e,vs=(r,t,e)=>t<>>64-e,ks=(r,t,e)=>r<>>64-e;Oh=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Nh=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,zh=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),qh=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,Fh=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Kh=(r,t,e,n,o,f)=>t+e+n+o+f+(r/2**32|0)|0,Dh={fromBig:Bf,split:ws,toBig:Eh,shrSH:Ah,shrSL:Ih,rotrSH:Mh,rotrSL:Lh,rotrBH:Rh,rotrBL:Th,rotr32H:Ph,rotr32L:Ch,rotlSH:bs,rotlSL:xs,rotlBH:vs,rotlBL:ks,add:Uh,add3L:Oh,add3H:Nh,add4L:zh,add4H:qh,add5H:Kh,add5L:Fh},ge=Dh});var Ep,Wh,Hh,un,cn,Bs,_f,Ef=le(()=>{Ep=H(V(),1);gs();Ss();fn();[Wh,Hh]=(()=>ge.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))))(),un=new Uint32Array(80),cn=new Uint32Array(80),Bs=class extends Jn{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:f,Cl:h,Dh:x,Dl:b,Eh:E,El:_,Fh:I,Fl:C,Gh:N,Gl:ft,Hh:D,Hl:P}=this;return[t,e,n,o,f,h,x,b,E,_,I,C,N,ft,D,P]}set(t,e,n,o,f,h,x,b,E,_,I,C,N,ft,D,P){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=f|0,this.Cl=h|0,this.Dh=x|0,this.Dl=b|0,this.Eh=E|0,this.El=_|0,this.Fh=I|0,this.Fl=C|0,this.Gh=N|0,this.Gl=ft|0,this.Hh=D|0,this.Hl=P|0}process(t,e){for(let G=0;G<16;G++,e+=4)un[G]=t.getUint32(e),cn[G]=t.getUint32(e+=4);for(let G=16;G<80;G++){let rt=un[G-15]|0,xt=cn[G-15]|0,ot=ge.rotrSH(rt,xt,1)^ge.rotrSH(rt,xt,8)^ge.shrSH(rt,xt,7),pt=ge.rotrSL(rt,xt,1)^ge.rotrSL(rt,xt,8)^ge.shrSL(rt,xt,7),St=un[G-2]|0,At=cn[G-2]|0,Ee=ge.rotrSH(St,At,19)^ge.rotrBH(St,At,61)^ge.shrSH(St,At,6),ct=ge.rotrSL(St,At,19)^ge.rotrBL(St,At,61)^ge.shrSL(St,At,6),Lt=ge.add4L(pt,ct,cn[G-7],cn[G-16]),g=ge.add4H(Lt,ot,Ee,un[G-7],un[G-16]);un[G]=g|0,cn[G]=Lt|0}let{Ah:n,Al:o,Bh:f,Bl:h,Ch:x,Cl:b,Dh:E,Dl:_,Eh:I,El:C,Fh:N,Fl:ft,Gh:D,Gl:P,Hh:J,Hl:it}=this;for(let G=0;G<80;G++){let rt=ge.rotrSH(I,C,14)^ge.rotrSH(I,C,18)^ge.rotrBH(I,C,41),xt=ge.rotrSL(I,C,14)^ge.rotrSL(I,C,18)^ge.rotrBL(I,C,41),ot=I&N^~I&D,pt=C&ft^~C&P,St=ge.add5L(it,xt,pt,Hh[G],cn[G]),At=ge.add5H(St,J,rt,ot,Wh[G],un[G]),Ee=St|0,ct=ge.rotrSH(n,o,28)^ge.rotrBH(n,o,34)^ge.rotrBH(n,o,39),Lt=ge.rotrSL(n,o,28)^ge.rotrBL(n,o,34)^ge.rotrBL(n,o,39),g=n&f^n&x^f&x,i=o&h^o&b^h&b;J=D|0,it=P|0,D=N|0,P=ft|0,N=I|0,ft=C|0,{h:I,l:C}=ge.add(E|0,_|0,At|0,Ee|0),E=x|0,_=b|0,x=f|0,b=h|0,f=n|0,h=o|0;let a=ge.add3L(Ee,Lt,i);n=ge.add3H(a,At,ct,g),o=a|0}({h:n,l:o}=ge.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:f,l:h}=ge.add(this.Bh|0,this.Bl|0,f|0,h|0),{h:x,l:b}=ge.add(this.Ch|0,this.Cl|0,x|0,b|0),{h:E,l:_}=ge.add(this.Dh|0,this.Dl|0,E|0,_|0),{h:I,l:C}=ge.add(this.Eh|0,this.El|0,I|0,C|0),{h:N,l:ft}=ge.add(this.Fh|0,this.Fl|0,N|0,ft|0),{h:D,l:P}=ge.add(this.Gh|0,this.Gl|0,D|0,P|0),{h:J,l:it}=ge.add(this.Hh|0,this.Hl|0,J|0,it|0),this.set(n,o,f,h,x,b,E,_,I,C,N,ft,D,P,J,it)}roundClean(){un.fill(0),cn.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},_f=Zn(()=>new Bs)});var ro={};qa(ro,{aInRange:()=>yr,abool:()=>Rr,abytes:()=>Xn,bitGet:()=>Zh,bitLen:()=>Ms,bitMask:()=>wi,bitSet:()=>Jh,bytesToHex:()=>jr,bytesToNumberBE:()=>Gr,bytesToNumberLE:()=>ln,concatBytes:()=>Yr,createHmacDrbg:()=>Ls,ensureBytes:()=>De,equalBytes:()=>Gh,hexToBytes:()=>Ln,hexToNumber:()=>Is,inRange:()=>mi,isBytes:()=>hn,memoized:()=>Tn,notImplemented:()=>Qh,numberToBytesBE:()=>dn,numberToBytesLE:()=>Rn,numberToHexUnpadded:()=>Mn,numberToVarBytesBE:()=>jh,utf8ToBytes:()=>Yh,validateObject:()=>qr});function hn(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Xn(r){if(!hn(r))throw new Error("Uint8Array expected")}function Rr(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}function jr(r){Xn(r);let t="";for(let e=0;e=Vr._0&&r<=Vr._9)return r-Vr._0;if(r>=Vr._A&&r<=Vr._F)return r-(Vr._A-10);if(r>=Vr._a&&r<=Vr._f)return r-(Vr._a-10)}function Ln(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,f=0;oAs;r>>=eo,t+=1);return t}function Zh(r,t){return r>>BigInt(t)&eo}function Jh(r,t,e){return r|(e?eo:As)<{n.fill(1),o.fill(0),f=0},x=(...I)=>e(o,n,...I),b=(I=Es())=>{o=x(If([0]),I),n=x(),I.length!==0&&(o=x(If([1]),I),n=x())},E=()=>{if(f++>=1e3)throw new Error("drbg: tried 1000 values");let I=0,C=[];for(;I{h(),b(I);let N;for(;!(N=C(E()));)b();return h(),N}}function qr(r,t,e={}){let n=(o,f,h)=>{let x=Xh[f];if(typeof x!="function")throw new Error(`Invalid validator "${f}", expected function`);let b=r[o];if(!(h&&b===void 0)&&!x(b,r))throw new Error(`Invalid param ${String(o)}=${b} (${typeof b}), expected ${f}`)};for(let[o,f]of Object.entries(t))n(o,f,!1);for(let[o,f]of Object.entries(e))n(o,f,!0);return r}function Tn(r){let t=new WeakMap;return(e,...n)=>{let o=t.get(e);if(o!==void 0)return o;let f=r(e,...n);return t.set(e,f),f}}var Ap,As,eo,$h,Vh,Vr,_s,wi,Es,If,Xh,Qh,Pn=le(()=>{Ap=H(V(),1);As=BigInt(0),eo=BigInt(1),$h=BigInt(2);Vh=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));Vr={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};_s=r=>typeof r=="bigint"&&As<=r;wi=r=>($h<new Uint8Array(r),If=r=>Uint8Array.from(r);Xh={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||hn(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};Qh=()=>{throw new Error("not implemented")}});function Re(r,t){let e=r%t;return e>=je?e:t+e}function n0(r,t,e){if(e<=je||t 0");if(e===Oe)return je;let n=Oe;for(;t>je;)t&Oe&&(n=n*r%e),r=r*r%e,t>>=Oe;return n}function Ne(r,t,e){let n=r;for(;t-- >je;)n*=n,n%=e;return n}function no(r,t){if(r===je||t<=je)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=Re(r,t),n=t,o=je,f=Oe,h=Oe,x=je;for(;e!==je;){let E=n/e,_=n%e,I=o-h*E,C=f-x*E;n=e,e=_,o=h,f=x,h=I,x=C}if(n!==Oe)throw new Error("invert: does not exist");return Re(o,t)}function i0(r){let t=(r-Oe)/Cn,e,n,o;for(e=r-Oe,n=0;e%Cn===je;e/=Cn,n++);for(o=Cn;o(n[o]="function",n),t);return qr(r,e)}function a0(r,t,e){if(e 0");if(e===je)return r.ONE;if(e===Oe)return t;let n=r.ONE,o=t;for(;e>je;)e&Oe&&(n=r.mul(n,o)),o=r.sqr(o),e>>=Oe;return n}function f0(r,t){let e=new Array(t.length),n=t.reduce((f,h,x)=>r.is0(h)?f:(e[x]=f,r.mul(f,h)),r.ONE),o=r.inv(n);return t.reduceRight((f,h,x)=>r.is0(h)?f:(e[x]=r.mul(f,e[x]),r.mul(f,h)),o),e}function Ps(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function pn(r,t,e=!1,n={}){if(r<=je)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:f}=Ps(r,t);if(f>2048)throw new Error("Field lengths over 2048 bytes are not supported");let h=o0(r),x=Object.freeze({ORDER:r,BITS:o,BYTES:f,MASK:wi(o),ZERO:je,ONE:Oe,create:b=>Re(b,r),isValid:b=>{if(typeof b!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof b}`);return je<=b&&bb===je,isOdd:b=>(b&Oe)===Oe,neg:b=>Re(-b,r),eql:(b,E)=>b===E,sqr:b=>Re(b*b,r),add:(b,E)=>Re(b+E,r),sub:(b,E)=>Re(b-E,r),mul:(b,E)=>Re(b*E,r),pow:(b,E)=>a0(x,b,E),div:(b,E)=>Re(b*no(E,r),r),sqrN:b=>b*b,addN:(b,E)=>b+E,subN:(b,E)=>b-E,mulN:(b,E)=>b*E,inv:b=>no(b,r),sqrt:n.sqrt||(b=>h(x,b)),invertBatch:b=>f0(x,b),cmov:(b,E,_)=>_?E:b,toBytes:b=>e?Rn(b,f):dn(b,f),fromBytes:b=>{if(b.length!==f)throw new Error(`Fp.fromBytes: expected ${f}, got ${b.length}`);return e?ln(b):Gr(b)}});return Object.freeze(x)}function Tf(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function Cs(r){let t=Tf(r);return t+Math.ceil(t/2)}function Pf(r,t,e=!1){let n=r.length,o=Tf(t),f=Cs(t);if(n<16||n1024)throw new Error(`expected ${f}-1024 bytes of input, got ${n}`);let h=e?Gr(r):ln(r),x=Re(h,t-Oe)+Oe;return e?Rn(x,o):dn(x,o)}var Mp,je,Oe,Cn,t0,Rs,Mf,Lf,e0,r0,Rf,s0,Qn=le(()=>{Mp=H(V(),1);Pn();je=BigInt(0),Oe=BigInt(1),Cn=BigInt(2),t0=BigInt(3),Rs=BigInt(4),Mf=BigInt(5),Lf=BigInt(8),e0=BigInt(9),r0=BigInt(16);Rf=(r,t)=>(Re(r,t)&Oe)===Oe,s0=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function io(r,t){let e=(f,h)=>{let x=h.negate();return f?x:h},n=f=>{if(!Number.isSafeInteger(f)||f<=0||f>t)throw new Error(`Wrong window size=${f}, should be [1..${t}]`)},o=f=>{n(f);let h=Math.ceil(t/f)+1,x=2**(f-1);return{windows:h,windowSize:x}};return{constTimeNegate:e,unsafeLadder(f,h){let x=r.ZERO,b=f;for(;h>c0;)h&Us&&(x=x.add(b)),b=b.double(),h>>=Us;return x},precomputeWindow(f,h){let{windows:x,windowSize:b}=o(h),E=[],_=f,I=_;for(let C=0;C>=ft,J>E&&(J-=N,x+=Us);let it=P,G=P+Math.abs(J)-1,rt=D%2!==0,xt=J<0;J===0?I=I.add(e(rt,h[it])):_=_.add(e(xt,h[G]))}return{p:_,f:I}},wNAFCached(f,h,x){let b=Cf.get(f)||1,E=Os.get(f);return E||(E=this.precomputeWindow(f,b),b!==1&&Os.set(f,x(E))),this.wNAF(b,E,h)},setWindowSize(f,h){n(h),Cf.set(f,h),Os.delete(f)}}}function oo(r,t,e,n){if(!Array.isArray(e)||!Array.isArray(n)||n.length!==e.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((_,I)=>{if(!t.isValid(_))throw new Error(`wrong scalar at index ${I}`)}),e.forEach((_,I)=>{if(!(_ instanceof r))throw new Error(`wrong point at index ${I}`)});let o=Ms(BigInt(e.length)),f=o>12?o-3:o>4?o-2:o?2:1,h=(1<=0;_-=f){x.fill(r.ZERO);for(let C=0;C>BigInt(_)&BigInt(h));x[ft]=x[ft].add(e[C])}let I=r.ZERO;for(let C=x.length-1,N=r.ZERO;C>0;C--)N=N.add(x[C]),I=I.add(N);if(E=E.add(I),_!==0)for(let C=0;C{Pp=H(V(),1);Qn();Pn();c0=BigInt(0),Us=BigInt(1),Os=new WeakMap,Cf=new WeakMap});function d0(r){let t=bi(r);return qr(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function Uf(r){let t=d0(r),{Fp:e,n,prehash:o,hash:f,randomBytes:h,nByteLength:x,h:b}=t,E=so<{try{return{isValid:!0,value:e.sqrt(u*e.inv(c))}}catch{return{isValid:!1,value:Tr}}}),N=t.adjustScalarBytes||(u=>u),ft=t.domain||((u,c,d)=>{if(Rr("phflag",d),c.length||d)throw new Error("Contexts/pre-hash are not supported");return u});function D(u,c){yr("coordinate "+u,c,Tr,E)}function P(u){if(!(u instanceof G))throw new Error("ExtendedPoint expected")}let J=Tn((u,c)=>{let{ex:d,ey:w,ez:v}=u,p=u.is0();c==null&&(c=p?h0:e.inv(v));let s=_(d*c),y=_(w*c),R=_(v*c);if(p)return{x:Tr,y:gr};if(R!==gr)throw new Error("invZ was invalid");return{x:s,y}}),it=Tn(u=>{let{a:c,d}=t;if(u.is0())throw new Error("bad point: ZERO");let{ex:w,ey:v,ez:p,et:s}=u,y=_(w*w),R=_(v*v),U=_(p*p),W=_(U*U),tt=_(y*c),st=_(U*_(tt+R)),dt=_(W+_(d*_(y*R)));if(st!==dt)throw new Error("bad point: equation left != right (1)");let be=_(w*v),ht=_(p*s);if(be!==ht)throw new Error("bad point: equation left != right (2)");return!0});class G{constructor(c,d,w,v){this.ex=c,this.ey=d,this.ez=w,this.et=v,D("x",c),D("y",d),D("z",w),D("t",v),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(c){if(c instanceof G)throw new Error("extended point not allowed");let{x:d,y:w}=c||{};return D("x",d),D("y",w),new G(d,w,gr,_(d*w))}static normalizeZ(c){let d=e.invertBatch(c.map(w=>w.ez));return c.map((w,v)=>w.toAffine(d[v])).map(G.fromAffine)}static msm(c,d){return oo(G,I,c,d)}_setWindowSize(c){ot.setWindowSize(this,c)}assertValidity(){it(this)}equals(c){P(c);let{ex:d,ey:w,ez:v}=this,{ex:p,ey:s,ez:y}=c,R=_(d*y),U=_(p*v),W=_(w*y),tt=_(s*v);return R===U&&W===tt}is0(){return this.equals(G.ZERO)}negate(){return new G(_(-this.ex),this.ey,this.ez,_(-this.et))}double(){let{a:c}=t,{ex:d,ey:w,ez:v}=this,p=_(d*d),s=_(w*w),y=_(so*_(v*v)),R=_(c*p),U=d+w,W=_(_(U*U)-p-s),tt=R+s,st=tt-y,dt=R-s,be=_(W*st),ht=_(tt*dt),Bt=_(W*dt),Xe=_(st*tt);return new G(be,ht,Xe,Bt)}add(c){P(c);let{a:d,d:w}=t,{ex:v,ey:p,ez:s,et:y}=this,{ex:R,ey:U,ez:W,et:tt}=c;if(d===BigInt(-1)){let Zt=_((p-v)*(U+R)),Ht=_((p+v)*(U-R)),br=_(Ht-Zt);if(br===Tr)return this.double();let Dt=_(s*so*tt),$t=_(y*so*W),xr=$t+Dt,Vt=Ht+Zt,jt=$t-Dt,Or=_(xr*br),ie=_(Vt*jt),Jt=_(xr*jt),Ir=_(br*Vt);return new G(Or,ie,Ir,Jt)}let st=_(v*R),dt=_(p*U),be=_(y*w*tt),ht=_(s*W),Bt=_((v+p)*(R+U)-st-dt),Xe=ht-be,Ft=ht+be,Kt=_(dt-d*st),Ur=_(Bt*Xe),ee=_(Ft*Kt),Nt=_(Bt*Kt),kr=_(Xe*Ft);return new G(Ur,ee,kr,Nt)}subtract(c){return this.add(c.negate())}wNAF(c){return ot.wNAFCached(this,c,G.normalizeZ)}multiply(c){let d=c;yr("scalar",d,gr,n);let{p:w,f:v}=this.wNAF(d);return G.normalizeZ([w,v])[0]}multiplyUnsafe(c){let d=c;return yr("scalar",d,Tr,n),d===Tr?xt:this.equals(xt)||d===gr?this:this.equals(rt)?this.wNAF(d).p:ot.unsafeLadder(this,d)}isSmallOrder(){return this.multiplyUnsafe(b).is0()}isTorsionFree(){return ot.unsafeLadder(this,n).is0()}toAffine(c){return J(this,c)}clearCofactor(){let{h:c}=t;return c===gr?this:this.multiplyUnsafe(c)}static fromHex(c,d=!1){let{d:w,a:v}=t,p=e.BYTES;c=De("pointHex",c,p),Rr("zip215",d);let s=c.slice(),y=c[p-1];s[p-1]=y&-129;let R=ln(s),U=d?E:e.ORDER;yr("pointHex.y",R,Tr,U);let W=_(R*R),tt=_(W-gr),st=_(w*W-v),{isValid:dt,value:be}=C(tt,st);if(!dt)throw new Error("Point.fromHex: invalid y coordinate");let ht=(be&gr)===gr,Bt=(y&128)!==0;if(!d&&be===Tr&&Bt)throw new Error("Point.fromHex: x=0 and x_0=1");return Bt!==ht&&(be=_(-be)),G.fromAffine({x:be,y:R})}static fromPrivateKey(c){return At(c).point}toRawBytes(){let{x:c,y:d}=this.toAffine(),w=Rn(d,e.BYTES);return w[w.length-1]|=c&gr?128:0,w}toHex(){return jr(this.toRawBytes())}}G.BASE=new G(t.Gx,t.Gy,gr,_(t.Gx*t.Gy)),G.ZERO=new G(Tr,gr,gr,Tr);let{BASE:rt,ZERO:xt}=G,ot=io(G,x*8);function pt(u){return Re(u,n)}function St(u){return pt(ln(u))}function At(u){let c=x;u=De("private key",u,c);let d=De("hashed private key",f(u),2*c),w=N(d.slice(0,c)),v=d.slice(c,2*c),p=St(w),s=rt.multiply(p),y=s.toRawBytes();return{head:w,prefix:v,scalar:p,point:s,pointBytes:y}}function Ee(u){return At(u).pointBytes}function ct(u=new Uint8Array,...c){let d=Yr(...c);return St(f(ft(d,De("context",u),!!o)))}function Lt(u,c,d={}){u=De("message",u),o&&(u=o(u));let{prefix:w,scalar:v,pointBytes:p}=At(c),s=ct(d.context,w,u),y=rt.multiply(s).toRawBytes(),R=ct(d.context,y,p,u),U=pt(s+R*v);yr("signature.s",U,Tr,n);let W=Yr(y,Rn(U,e.BYTES));return De("result",W,x*2)}let g=l0;function i(u,c,d,w=g){let{context:v,zip215:p}=w,s=e.BYTES;u=De("signature",u,2*s),c=De("message",c),p!==void 0&&Rr("zip215",p),o&&(c=o(c));let y=ln(u.slice(s,2*s)),R,U,W;try{R=G.fromHex(d,p),U=G.fromHex(u.slice(0,s),p),W=rt.multiplyUnsafe(y)}catch{return!1}if(!p&&R.isSmallOrder())return!1;let tt=ct(v,U.toRawBytes(),R.toRawBytes(),c);return U.add(R.multiplyUnsafe(tt)).subtract(W).clearCofactor().equals(G.ZERO)}return rt._setWindowSize(8),{CURVE:t,getPublicKey:Ee,sign:Lt,verify:i,ExtendedPoint:G,utils:{getExtendedPublicKey:At,randomPrivateKey:()=>h(e.BYTES),precompute(u=8,c=G.BASE){return c._setWindowSize(u),c.multiply(BigInt(3)),c}}}}var zp,Tr,gr,so,h0,l0,Of=le(()=>{zp=H(V(),1);Ns();Qn();Pn();Pn();Tr=BigInt(0),gr=BigInt(1),so=BigInt(2),h0=BigInt(8),l0={zip215:!0}});function m0(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),f=zs,x=r*r%f*r%f,b=Ne(x,zf,f)*x%f,E=Ne(b,p0,f)*r%f,_=Ne(E,y0,f)*E%f,I=Ne(_,t,f)*_%f,C=Ne(I,e,f)*I%f,N=Ne(C,n,f)*C%f,ft=Ne(N,o,f)*N%f,D=Ne(ft,o,f)*N%f,P=Ne(D,t,f)*_%f;return{pow_p_5_8:Ne(P,zf,f)*r%f,b2:x}}function w0(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function b0(r,t){let e=zs,n=Re(t*t*t,e),o=Re(n*n*t,e),f=m0(r*o).pow_p_5_8,h=Re(r*n*f,e),x=Re(t*h*h,e),b=h,E=Re(h*Nf,e),_=x===r,I=x===Re(-r,e),C=x===Re(-r*Nf,e);return _&&(h=b),(I||C)&&(h=E),Rf(h,e)&&(h=Re(-h,e)),{isValid:_||I,value:h}}var jp,zs,Nf,Hp,p0,zf,$p,y0,g0,x0,v0,Un,qf=le(()=>{jp=H(V(),1);Ef();fn();Of();Qn();zs=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Nf=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Hp=BigInt(0),p0=BigInt(1),zf=BigInt(2),$p=BigInt(3),y0=BigInt(5),g0=BigInt(8);x0=(()=>pn(zs,void 0,!0))(),v0=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:x0,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:g0,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:_f,randomBytes:Qi,adjustScalarBytes:w0,uvRatio:b0}))(),Un=(()=>Uf(v0))()});var qs=$e(()=>{var Zp=H(V())});var Kf=$e((Ff,Fs)=>{var Jp=H(V());(function(r,t){"use strict";function e(g,i){if(!g)throw new Error(i||"Assertion failed")}function n(g,i){g.super_=i;var a=function(){};a.prototype=i.prototype,g.prototype=new a,g.prototype.constructor=g}function o(g,i,a){if(o.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((i==="le"||i==="be")&&(a=i,i=10),this._init(g||0,i||10,a||"be"))}typeof r=="object"?r.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var f;try{typeof window<"u"&&typeof window.Buffer<"u"?f=window.Buffer:f=qs().Buffer}catch{}o.isBN=function(i){return i instanceof o?!0:i!==null&&typeof i=="object"&&i.constructor.wordSize===o.wordSize&&Array.isArray(i.words)},o.max=function(i,a){return i.cmp(a)>0?i:a},o.min=function(i,a){return i.cmp(a)<0?i:a},o.prototype._init=function(i,a,u){if(typeof i=="number")return this._initNumber(i,a,u);if(typeof i=="object")return this._initArray(i,a,u);a==="hex"&&(a=16),e(a===(a|0)&&a>=2&&a<=36),i=i.toString().replace(/\\s+/g,"");var c=0;i[0]==="-"&&(c++,this.negative=1),c=0;c-=3)w=i[c]|i[c-1]<<8|i[c-2]<<16,this.words[d]|=w<>>26-v&67108863,v+=24,v>=26&&(v-=26,d++);else if(u==="le")for(c=0,d=0;c>>26-v&67108863,v+=24,v>=26&&(v-=26,d++);return this._strip()};function h(g,i){var a=g.charCodeAt(i);if(a>=48&&a<=57)return a-48;if(a>=65&&a<=70)return a-55;if(a>=97&&a<=102)return a-87;e(!1,"Invalid character in "+g)}function x(g,i,a){var u=h(g,a);return a-1>=i&&(u|=h(g,a-1)<<4),u}o.prototype._parseHex=function(i,a,u){this.length=Math.ceil((i.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)v=x(i,a,c)<=18?(d-=18,w+=1,this.words[w]|=v>>>26):d+=8;else{var p=i.length-a;for(c=p%2===0?a+1:a;c=18?(d-=18,w+=1,this.words[w]|=v>>>26):d+=8}this._strip()};function b(g,i,a,u){for(var c=0,d=0,w=Math.min(g.length,a),v=i;v=49?d=p-49+10:p>=17?d=p-17+10:d=p,e(p>=0&&d1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=_}catch{o.prototype.inspect=_}else o.prototype.inspect=_;function _(){return(this.red?""}var I=["","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"],C=[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],N=[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];o.prototype.toString=function(i,a){i=i||10,a=a|0||1;var u;if(i===16||i==="hex"){u="";for(var c=0,d=0,w=0;w>>24-c&16777215,c+=2,c>=26&&(c-=26,w--),d!==0||w!==this.length-1?u=I[6-p.length]+p+u:u=p+u}for(d!==0&&(u=d.toString(16)+u);u.length%a!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(i===(i|0)&&i>=2&&i<=36){var s=C[i],y=N[i];u="";var R=this.clone();for(R.negative=0;!R.isZero();){var U=R.modrn(y).toString(i);R=R.idivn(y),R.isZero()?u=U+u:u=I[s-U.length]+U+u}for(this.isZero()&&(u="0"+u);u.length%a!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var i=this.words[0];return this.length===2?i+=this.words[1]*67108864:this.length===3&&this.words[2]===1?i+=4503599627370496+this.words[1]*67108864:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-i:i},o.prototype.toJSON=function(){return this.toString(16,2)},f&&(o.prototype.toBuffer=function(i,a){return this.toArrayLike(f,i,a)}),o.prototype.toArray=function(i,a){return this.toArrayLike(Array,i,a)};var ft=function(i,a){return i.allocUnsafe?i.allocUnsafe(a):new i(a)};o.prototype.toArrayLike=function(i,a,u){this._strip();var c=this.byteLength(),d=u||Math.max(1,c);e(c<=d,"byte array longer than desired length"),e(d>0,"Requested array length <= 0");var w=ft(i,d),v=a==="le"?"LE":"BE";return this["_toArrayLike"+v](w,c),w},o.prototype._toArrayLikeLE=function(i,a){for(var u=0,c=0,d=0,w=0;d>8&255),u>16&255),w===6?(u>24&255),c=0,w=0):(c=v>>>24,w+=2)}if(u=0&&(i[u--]=v>>8&255),u>=0&&(i[u--]=v>>16&255),w===6?(u>=0&&(i[u--]=v>>24&255),c=0,w=0):(c=v>>>24,w+=2)}if(u>=0)for(i[u--]=c;u>=0;)i[u--]=0},Math.clz32?o.prototype._countBits=function(i){return 32-Math.clz32(i)}:o.prototype._countBits=function(i){var a=i,u=0;return a>=4096&&(u+=13,a>>>=13),a>=64&&(u+=7,a>>>=7),a>=8&&(u+=4,a>>>=4),a>=2&&(u+=2,a>>>=2),u+a},o.prototype._zeroBits=function(i){if(i===0)return 26;var a=i,u=0;return a&8191||(u+=13,a>>>=13),a&127||(u+=7,a>>>=7),a&15||(u+=4,a>>>=4),a&3||(u+=2,a>>>=2),a&1||u++,u},o.prototype.bitLength=function(){var i=this.words[this.length-1],a=this._countBits(i);return(this.length-1)*26+a};function D(g){for(var i=new Array(g.bitLength()),a=0;a>>c&1}return i}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var i=0,a=0;ai.length?this.clone().ior(i):i.clone().ior(this)},o.prototype.uor=function(i){return this.length>i.length?this.clone().iuor(i):i.clone().iuor(this)},o.prototype.iuand=function(i){var a;this.length>i.length?a=i:a=this;for(var u=0;ui.length?this.clone().iand(i):i.clone().iand(this)},o.prototype.uand=function(i){return this.length>i.length?this.clone().iuand(i):i.clone().iuand(this)},o.prototype.iuxor=function(i){var a,u;this.length>i.length?(a=this,u=i):(a=i,u=this);for(var c=0;ci.length?this.clone().ixor(i):i.clone().ixor(this)},o.prototype.uxor=function(i){return this.length>i.length?this.clone().iuxor(i):i.clone().iuxor(this)},o.prototype.inotn=function(i){e(typeof i=="number"&&i>=0);var a=Math.ceil(i/26)|0,u=i%26;this._expand(a),u>0&&a--;for(var c=0;c0&&(this.words[c]=~this.words[c]&67108863>>26-u),this._strip()},o.prototype.notn=function(i){return this.clone().inotn(i)},o.prototype.setn=function(i,a){e(typeof i=="number"&&i>=0);var u=i/26|0,c=i%26;return this._expand(u+1),a?this.words[u]=this.words[u]|1<i.length?(u=this,c=i):(u=i,c=this);for(var d=0,w=0;w>>26;for(;d!==0&&w>>26;if(this.length=u.length,d!==0)this.words[this.length]=d,this.length++;else if(u!==this)for(;wi.length?this.clone().iadd(i):i.clone().iadd(this)},o.prototype.isub=function(i){if(i.negative!==0){i.negative=0;var a=this.iadd(i);return i.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(i),this.negative=1,this._normSign();var u=this.cmp(i);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var c,d;u>0?(c=this,d=i):(c=i,d=this);for(var w=0,v=0;v>26,this.words[v]=a&67108863;for(;w!==0&&v>26,this.words[v]=a&67108863;if(w===0&&v>>26,R=p&67108863,U=Math.min(s,i.length-1),W=Math.max(0,s-g.length+1);W<=U;W++){var tt=s-W|0;c=g.words[tt]|0,d=i.words[W]|0,w=c*d+R,y+=w/67108864|0,R=w&67108863}a.words[s]=R|0,p=y|0}return p!==0?a.words[s]=p|0:a.length--,a._strip()}var J=function(i,a,u){var c=i.words,d=a.words,w=u.words,v=0,p,s,y,R=c[0]|0,U=R&8191,W=R>>>13,tt=c[1]|0,st=tt&8191,dt=tt>>>13,be=c[2]|0,ht=be&8191,Bt=be>>>13,Xe=c[3]|0,Ft=Xe&8191,Kt=Xe>>>13,Ur=c[4]|0,ee=Ur&8191,Nt=Ur>>>13,kr=c[5]|0,Zt=kr&8191,Ht=kr>>>13,br=c[6]|0,Dt=br&8191,$t=br>>>13,xr=c[7]|0,Vt=xr&8191,jt=xr>>>13,Or=c[8]|0,ie=Or&8191,Jt=Or>>>13,Ir=c[9]|0,re=Ir&8191,Xt=Ir>>>13,Sr=d[0]|0,Qt=Sr&8191,ne=Sr>>>13,Mr=d[1]|0,te=Mr&8191,oe=Mr>>>13,rn=d[2]|0,ce=rn&8191,he=rn>>>13,hr=d[3]|0,Wt=hr&8191,Gt=hr>>>13,Wr=d[4]|0,se=Wr&8191,fe=Wr>>>13,Bn=d[5]|0,It=Bn&8191,ue=Bn>>>13,m=d[6]|0,S=m&8191,k=m>>>13,l=d[7]|0,B=l&8191,M=l>>>13,T=d[8]|0,O=T&8191,$=T>>>13,_t=d[9]|0,X=_t&8191,yt=_t>>>13;u.negative=i.negative^a.negative,u.length=19,p=Math.imul(U,Qt),s=Math.imul(U,ne),s=s+Math.imul(W,Qt)|0,y=Math.imul(W,ne);var gt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(gt>>>26)|0,gt&=67108863,p=Math.imul(st,Qt),s=Math.imul(st,ne),s=s+Math.imul(dt,Qt)|0,y=Math.imul(dt,ne),p=p+Math.imul(U,te)|0,s=s+Math.imul(U,oe)|0,s=s+Math.imul(W,te)|0,y=y+Math.imul(W,oe)|0;var Mt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,p=Math.imul(ht,Qt),s=Math.imul(ht,ne),s=s+Math.imul(Bt,Qt)|0,y=Math.imul(Bt,ne),p=p+Math.imul(st,te)|0,s=s+Math.imul(st,oe)|0,s=s+Math.imul(dt,te)|0,y=y+Math.imul(dt,oe)|0,p=p+Math.imul(U,ce)|0,s=s+Math.imul(U,he)|0,s=s+Math.imul(W,ce)|0,y=y+Math.imul(W,he)|0;var Rt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,p=Math.imul(Ft,Qt),s=Math.imul(Ft,ne),s=s+Math.imul(Kt,Qt)|0,y=Math.imul(Kt,ne),p=p+Math.imul(ht,te)|0,s=s+Math.imul(ht,oe)|0,s=s+Math.imul(Bt,te)|0,y=y+Math.imul(Bt,oe)|0,p=p+Math.imul(st,ce)|0,s=s+Math.imul(st,he)|0,s=s+Math.imul(dt,ce)|0,y=y+Math.imul(dt,he)|0,p=p+Math.imul(U,Wt)|0,s=s+Math.imul(U,Gt)|0,s=s+Math.imul(W,Wt)|0,y=y+Math.imul(W,Gt)|0;var qt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(qt>>>26)|0,qt&=67108863,p=Math.imul(ee,Qt),s=Math.imul(ee,ne),s=s+Math.imul(Nt,Qt)|0,y=Math.imul(Nt,ne),p=p+Math.imul(Ft,te)|0,s=s+Math.imul(Ft,oe)|0,s=s+Math.imul(Kt,te)|0,y=y+Math.imul(Kt,oe)|0,p=p+Math.imul(ht,ce)|0,s=s+Math.imul(ht,he)|0,s=s+Math.imul(Bt,ce)|0,y=y+Math.imul(Bt,he)|0,p=p+Math.imul(st,Wt)|0,s=s+Math.imul(st,Gt)|0,s=s+Math.imul(dt,Wt)|0,y=y+Math.imul(dt,Gt)|0,p=p+Math.imul(U,se)|0,s=s+Math.imul(U,fe)|0,s=s+Math.imul(W,se)|0,y=y+Math.imul(W,fe)|0;var zt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(zt>>>26)|0,zt&=67108863,p=Math.imul(Zt,Qt),s=Math.imul(Zt,ne),s=s+Math.imul(Ht,Qt)|0,y=Math.imul(Ht,ne),p=p+Math.imul(ee,te)|0,s=s+Math.imul(ee,oe)|0,s=s+Math.imul(Nt,te)|0,y=y+Math.imul(Nt,oe)|0,p=p+Math.imul(Ft,ce)|0,s=s+Math.imul(Ft,he)|0,s=s+Math.imul(Kt,ce)|0,y=y+Math.imul(Kt,he)|0,p=p+Math.imul(ht,Wt)|0,s=s+Math.imul(ht,Gt)|0,s=s+Math.imul(Bt,Wt)|0,y=y+Math.imul(Bt,Gt)|0,p=p+Math.imul(st,se)|0,s=s+Math.imul(st,fe)|0,s=s+Math.imul(dt,se)|0,y=y+Math.imul(dt,fe)|0,p=p+Math.imul(U,It)|0,s=s+Math.imul(U,ue)|0,s=s+Math.imul(W,It)|0,y=y+Math.imul(W,ue)|0;var Tt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,p=Math.imul(Dt,Qt),s=Math.imul(Dt,ne),s=s+Math.imul($t,Qt)|0,y=Math.imul($t,ne),p=p+Math.imul(Zt,te)|0,s=s+Math.imul(Zt,oe)|0,s=s+Math.imul(Ht,te)|0,y=y+Math.imul(Ht,oe)|0,p=p+Math.imul(ee,ce)|0,s=s+Math.imul(ee,he)|0,s=s+Math.imul(Nt,ce)|0,y=y+Math.imul(Nt,he)|0,p=p+Math.imul(Ft,Wt)|0,s=s+Math.imul(Ft,Gt)|0,s=s+Math.imul(Kt,Wt)|0,y=y+Math.imul(Kt,Gt)|0,p=p+Math.imul(ht,se)|0,s=s+Math.imul(ht,fe)|0,s=s+Math.imul(Bt,se)|0,y=y+Math.imul(Bt,fe)|0,p=p+Math.imul(st,It)|0,s=s+Math.imul(st,ue)|0,s=s+Math.imul(dt,It)|0,y=y+Math.imul(dt,ue)|0,p=p+Math.imul(U,S)|0,s=s+Math.imul(U,k)|0,s=s+Math.imul(W,S)|0,y=y+Math.imul(W,k)|0;var Ct=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,p=Math.imul(Vt,Qt),s=Math.imul(Vt,ne),s=s+Math.imul(jt,Qt)|0,y=Math.imul(jt,ne),p=p+Math.imul(Dt,te)|0,s=s+Math.imul(Dt,oe)|0,s=s+Math.imul($t,te)|0,y=y+Math.imul($t,oe)|0,p=p+Math.imul(Zt,ce)|0,s=s+Math.imul(Zt,he)|0,s=s+Math.imul(Ht,ce)|0,y=y+Math.imul(Ht,he)|0,p=p+Math.imul(ee,Wt)|0,s=s+Math.imul(ee,Gt)|0,s=s+Math.imul(Nt,Wt)|0,y=y+Math.imul(Nt,Gt)|0,p=p+Math.imul(Ft,se)|0,s=s+Math.imul(Ft,fe)|0,s=s+Math.imul(Kt,se)|0,y=y+Math.imul(Kt,fe)|0,p=p+Math.imul(ht,It)|0,s=s+Math.imul(ht,ue)|0,s=s+Math.imul(Bt,It)|0,y=y+Math.imul(Bt,ue)|0,p=p+Math.imul(st,S)|0,s=s+Math.imul(st,k)|0,s=s+Math.imul(dt,S)|0,y=y+Math.imul(dt,k)|0,p=p+Math.imul(U,B)|0,s=s+Math.imul(U,M)|0,s=s+Math.imul(W,B)|0,y=y+Math.imul(W,M)|0;var Pt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,p=Math.imul(ie,Qt),s=Math.imul(ie,ne),s=s+Math.imul(Jt,Qt)|0,y=Math.imul(Jt,ne),p=p+Math.imul(Vt,te)|0,s=s+Math.imul(Vt,oe)|0,s=s+Math.imul(jt,te)|0,y=y+Math.imul(jt,oe)|0,p=p+Math.imul(Dt,ce)|0,s=s+Math.imul(Dt,he)|0,s=s+Math.imul($t,ce)|0,y=y+Math.imul($t,he)|0,p=p+Math.imul(Zt,Wt)|0,s=s+Math.imul(Zt,Gt)|0,s=s+Math.imul(Ht,Wt)|0,y=y+Math.imul(Ht,Gt)|0,p=p+Math.imul(ee,se)|0,s=s+Math.imul(ee,fe)|0,s=s+Math.imul(Nt,se)|0,y=y+Math.imul(Nt,fe)|0,p=p+Math.imul(Ft,It)|0,s=s+Math.imul(Ft,ue)|0,s=s+Math.imul(Kt,It)|0,y=y+Math.imul(Kt,ue)|0,p=p+Math.imul(ht,S)|0,s=s+Math.imul(ht,k)|0,s=s+Math.imul(Bt,S)|0,y=y+Math.imul(Bt,k)|0,p=p+Math.imul(st,B)|0,s=s+Math.imul(st,M)|0,s=s+Math.imul(dt,B)|0,y=y+Math.imul(dt,M)|0,p=p+Math.imul(U,O)|0,s=s+Math.imul(U,$)|0,s=s+Math.imul(W,O)|0,y=y+Math.imul(W,$)|0;var mt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(mt>>>26)|0,mt&=67108863,p=Math.imul(re,Qt),s=Math.imul(re,ne),s=s+Math.imul(Xt,Qt)|0,y=Math.imul(Xt,ne),p=p+Math.imul(ie,te)|0,s=s+Math.imul(ie,oe)|0,s=s+Math.imul(Jt,te)|0,y=y+Math.imul(Jt,oe)|0,p=p+Math.imul(Vt,ce)|0,s=s+Math.imul(Vt,he)|0,s=s+Math.imul(jt,ce)|0,y=y+Math.imul(jt,he)|0,p=p+Math.imul(Dt,Wt)|0,s=s+Math.imul(Dt,Gt)|0,s=s+Math.imul($t,Wt)|0,y=y+Math.imul($t,Gt)|0,p=p+Math.imul(Zt,se)|0,s=s+Math.imul(Zt,fe)|0,s=s+Math.imul(Ht,se)|0,y=y+Math.imul(Ht,fe)|0,p=p+Math.imul(ee,It)|0,s=s+Math.imul(ee,ue)|0,s=s+Math.imul(Nt,It)|0,y=y+Math.imul(Nt,ue)|0,p=p+Math.imul(Ft,S)|0,s=s+Math.imul(Ft,k)|0,s=s+Math.imul(Kt,S)|0,y=y+Math.imul(Kt,k)|0,p=p+Math.imul(ht,B)|0,s=s+Math.imul(ht,M)|0,s=s+Math.imul(Bt,B)|0,y=y+Math.imul(Bt,M)|0,p=p+Math.imul(st,O)|0,s=s+Math.imul(st,$)|0,s=s+Math.imul(dt,O)|0,y=y+Math.imul(dt,$)|0,p=p+Math.imul(U,X)|0,s=s+Math.imul(U,yt)|0,s=s+Math.imul(W,X)|0,y=y+Math.imul(W,yt)|0;var Et=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Et>>>26)|0,Et&=67108863,p=Math.imul(re,te),s=Math.imul(re,oe),s=s+Math.imul(Xt,te)|0,y=Math.imul(Xt,oe),p=p+Math.imul(ie,ce)|0,s=s+Math.imul(ie,he)|0,s=s+Math.imul(Jt,ce)|0,y=y+Math.imul(Jt,he)|0,p=p+Math.imul(Vt,Wt)|0,s=s+Math.imul(Vt,Gt)|0,s=s+Math.imul(jt,Wt)|0,y=y+Math.imul(jt,Gt)|0,p=p+Math.imul(Dt,se)|0,s=s+Math.imul(Dt,fe)|0,s=s+Math.imul($t,se)|0,y=y+Math.imul($t,fe)|0,p=p+Math.imul(Zt,It)|0,s=s+Math.imul(Zt,ue)|0,s=s+Math.imul(Ht,It)|0,y=y+Math.imul(Ht,ue)|0,p=p+Math.imul(ee,S)|0,s=s+Math.imul(ee,k)|0,s=s+Math.imul(Nt,S)|0,y=y+Math.imul(Nt,k)|0,p=p+Math.imul(Ft,B)|0,s=s+Math.imul(Ft,M)|0,s=s+Math.imul(Kt,B)|0,y=y+Math.imul(Kt,M)|0,p=p+Math.imul(ht,O)|0,s=s+Math.imul(ht,$)|0,s=s+Math.imul(Bt,O)|0,y=y+Math.imul(Bt,$)|0,p=p+Math.imul(st,X)|0,s=s+Math.imul(st,yt)|0,s=s+Math.imul(dt,X)|0,y=y+Math.imul(dt,yt)|0;var lt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(lt>>>26)|0,lt&=67108863,p=Math.imul(re,ce),s=Math.imul(re,he),s=s+Math.imul(Xt,ce)|0,y=Math.imul(Xt,he),p=p+Math.imul(ie,Wt)|0,s=s+Math.imul(ie,Gt)|0,s=s+Math.imul(Jt,Wt)|0,y=y+Math.imul(Jt,Gt)|0,p=p+Math.imul(Vt,se)|0,s=s+Math.imul(Vt,fe)|0,s=s+Math.imul(jt,se)|0,y=y+Math.imul(jt,fe)|0,p=p+Math.imul(Dt,It)|0,s=s+Math.imul(Dt,ue)|0,s=s+Math.imul($t,It)|0,y=y+Math.imul($t,ue)|0,p=p+Math.imul(Zt,S)|0,s=s+Math.imul(Zt,k)|0,s=s+Math.imul(Ht,S)|0,y=y+Math.imul(Ht,k)|0,p=p+Math.imul(ee,B)|0,s=s+Math.imul(ee,M)|0,s=s+Math.imul(Nt,B)|0,y=y+Math.imul(Nt,M)|0,p=p+Math.imul(Ft,O)|0,s=s+Math.imul(Ft,$)|0,s=s+Math.imul(Kt,O)|0,y=y+Math.imul(Kt,$)|0,p=p+Math.imul(ht,X)|0,s=s+Math.imul(ht,yt)|0,s=s+Math.imul(Bt,X)|0,y=y+Math.imul(Bt,yt)|0;var wt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(wt>>>26)|0,wt&=67108863,p=Math.imul(re,Wt),s=Math.imul(re,Gt),s=s+Math.imul(Xt,Wt)|0,y=Math.imul(Xt,Gt),p=p+Math.imul(ie,se)|0,s=s+Math.imul(ie,fe)|0,s=s+Math.imul(Jt,se)|0,y=y+Math.imul(Jt,fe)|0,p=p+Math.imul(Vt,It)|0,s=s+Math.imul(Vt,ue)|0,s=s+Math.imul(jt,It)|0,y=y+Math.imul(jt,ue)|0,p=p+Math.imul(Dt,S)|0,s=s+Math.imul(Dt,k)|0,s=s+Math.imul($t,S)|0,y=y+Math.imul($t,k)|0,p=p+Math.imul(Zt,B)|0,s=s+Math.imul(Zt,M)|0,s=s+Math.imul(Ht,B)|0,y=y+Math.imul(Ht,M)|0,p=p+Math.imul(ee,O)|0,s=s+Math.imul(ee,$)|0,s=s+Math.imul(Nt,O)|0,y=y+Math.imul(Nt,$)|0,p=p+Math.imul(Ft,X)|0,s=s+Math.imul(Ft,yt)|0,s=s+Math.imul(Kt,X)|0,y=y+Math.imul(Kt,yt)|0;var bt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(bt>>>26)|0,bt&=67108863,p=Math.imul(re,se),s=Math.imul(re,fe),s=s+Math.imul(Xt,se)|0,y=Math.imul(Xt,fe),p=p+Math.imul(ie,It)|0,s=s+Math.imul(ie,ue)|0,s=s+Math.imul(Jt,It)|0,y=y+Math.imul(Jt,ue)|0,p=p+Math.imul(Vt,S)|0,s=s+Math.imul(Vt,k)|0,s=s+Math.imul(jt,S)|0,y=y+Math.imul(jt,k)|0,p=p+Math.imul(Dt,B)|0,s=s+Math.imul(Dt,M)|0,s=s+Math.imul($t,B)|0,y=y+Math.imul($t,M)|0,p=p+Math.imul(Zt,O)|0,s=s+Math.imul(Zt,$)|0,s=s+Math.imul(Ht,O)|0,y=y+Math.imul(Ht,$)|0,p=p+Math.imul(ee,X)|0,s=s+Math.imul(ee,yt)|0,s=s+Math.imul(Nt,X)|0,y=y+Math.imul(Nt,yt)|0;var ut=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(ut>>>26)|0,ut&=67108863,p=Math.imul(re,It),s=Math.imul(re,ue),s=s+Math.imul(Xt,It)|0,y=Math.imul(Xt,ue),p=p+Math.imul(ie,S)|0,s=s+Math.imul(ie,k)|0,s=s+Math.imul(Jt,S)|0,y=y+Math.imul(Jt,k)|0,p=p+Math.imul(Vt,B)|0,s=s+Math.imul(Vt,M)|0,s=s+Math.imul(jt,B)|0,y=y+Math.imul(jt,M)|0,p=p+Math.imul(Dt,O)|0,s=s+Math.imul(Dt,$)|0,s=s+Math.imul($t,O)|0,y=y+Math.imul($t,$)|0,p=p+Math.imul(Zt,X)|0,s=s+Math.imul(Zt,yt)|0,s=s+Math.imul(Ht,X)|0,y=y+Math.imul(Ht,yt)|0;var F=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(F>>>26)|0,F&=67108863,p=Math.imul(re,S),s=Math.imul(re,k),s=s+Math.imul(Xt,S)|0,y=Math.imul(Xt,k),p=p+Math.imul(ie,B)|0,s=s+Math.imul(ie,M)|0,s=s+Math.imul(Jt,B)|0,y=y+Math.imul(Jt,M)|0,p=p+Math.imul(Vt,O)|0,s=s+Math.imul(Vt,$)|0,s=s+Math.imul(jt,O)|0,y=y+Math.imul(jt,$)|0,p=p+Math.imul(Dt,X)|0,s=s+Math.imul(Dt,yt)|0,s=s+Math.imul($t,X)|0,y=y+Math.imul($t,yt)|0;var K=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(K>>>26)|0,K&=67108863,p=Math.imul(re,B),s=Math.imul(re,M),s=s+Math.imul(Xt,B)|0,y=Math.imul(Xt,M),p=p+Math.imul(ie,O)|0,s=s+Math.imul(ie,$)|0,s=s+Math.imul(Jt,O)|0,y=y+Math.imul(Jt,$)|0,p=p+Math.imul(Vt,X)|0,s=s+Math.imul(Vt,yt)|0,s=s+Math.imul(jt,X)|0,y=y+Math.imul(jt,yt)|0;var Q=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Q>>>26)|0,Q&=67108863,p=Math.imul(re,O),s=Math.imul(re,$),s=s+Math.imul(Xt,O)|0,y=Math.imul(Xt,$),p=p+Math.imul(ie,X)|0,s=s+Math.imul(ie,yt)|0,s=s+Math.imul(Jt,X)|0,y=y+Math.imul(Jt,yt)|0;var Y=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Y>>>26)|0,Y&=67108863,p=Math.imul(re,X),s=Math.imul(re,yt),s=s+Math.imul(Xt,X)|0,y=Math.imul(Xt,yt);var Z=(v+p|0)+((s&8191)<<13)|0;return v=(y+(s>>>13)|0)+(Z>>>26)|0,Z&=67108863,w[0]=gt,w[1]=Mt,w[2]=Rt,w[3]=qt,w[4]=zt,w[5]=Tt,w[6]=Ct,w[7]=Pt,w[8]=mt,w[9]=Et,w[10]=lt,w[11]=wt,w[12]=bt,w[13]=ut,w[14]=F,w[15]=K,w[16]=Q,w[17]=Y,w[18]=Z,v!==0&&(w[19]=v,u.length++),u};Math.imul||(J=P);function it(g,i,a){a.negative=i.negative^g.negative,a.length=g.length+i.length;for(var u=0,c=0,d=0;d>>26)|0,c+=w>>>26,w&=67108863}a.words[d]=v,u=w,w=c}return u!==0?a.words[d]=u:a.length--,a._strip()}function G(g,i,a){return it(g,i,a)}o.prototype.mulTo=function(i,a){var u,c=this.length+i.length;return this.length===10&&i.length===10?u=J(this,i,a):c<63?u=P(this,i,a):c<1024?u=it(this,i,a):u=G(this,i,a),u};function rt(g,i){this.x=g,this.y=i}rt.prototype.makeRBT=function(i){for(var a=new Array(i),u=o.prototype._countBits(i)-1,c=0;c>=1;return c},rt.prototype.permute=function(i,a,u,c,d,w){for(var v=0;v>>1)d++;return 1<>>13,u[2*w+1]=d&8191,d=d>>>13;for(w=2*a;w>=26,u+=d/67108864|0,u+=w>>>26,this.words[c]=w&67108863}return u!==0&&(this.words[c]=u,this.length++),a?this.ineg():this},o.prototype.muln=function(i){return this.clone().imuln(i)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(i){var a=D(i);if(a.length===0)return new o(1);for(var u=this,c=0;c=0);var a=i%26,u=(i-a)/26,c=67108863>>>26-a<<26-a,d;if(a!==0){var w=0;for(d=0;d>>26-a}w&&(this.words[d]=w,this.length++)}if(u!==0){for(d=this.length-1;d>=0;d--)this.words[d+u]=this.words[d];for(d=0;d=0);var c;a?c=(a-a%26)/26:c=0;var d=i%26,w=Math.min((i-d)/26,this.length),v=67108863^67108863>>>d<w)for(this.length-=w,s=0;s=0&&(y!==0||s>=c);s--){var R=this.words[s]|0;this.words[s]=y<<26-d|R>>>d,y=R&v}return p&&y!==0&&(p.words[p.length++]=y),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(i,a,u){return e(this.negative===0),this.iushrn(i,a,u)},o.prototype.shln=function(i){return this.clone().ishln(i)},o.prototype.ushln=function(i){return this.clone().iushln(i)},o.prototype.shrn=function(i){return this.clone().ishrn(i)},o.prototype.ushrn=function(i){return this.clone().iushrn(i)},o.prototype.testn=function(i){e(typeof i=="number"&&i>=0);var a=i%26,u=(i-a)/26,c=1<=0);var a=i%26,u=(i-a)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(a!==0&&u++,this.length=Math.min(u,this.length),a!==0){var c=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},o.prototype.isubn=function(i){if(e(typeof i=="number"),e(i<67108864),i<0)return this.iaddn(-i);if(this.negative!==0)return this.negative=0,this.iaddn(i),this.negative=1,this;if(this.words[0]-=i,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(p/67108864|0),this.words[d+u]=w&67108863}for(;d>26,this.words[d+u]=w&67108863;if(v===0)return this._strip();for(e(v===-1),v=0,d=0;d>26,this.words[d]=w&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(i,a){var u=this.length-i.length,c=this.clone(),d=i,w=d.words[d.length-1]|0,v=this._countBits(w);u=26-v,u!==0&&(d=d.ushln(u),c.iushln(u),w=d.words[d.length-1]|0);var p=c.length-d.length,s;if(a!=="mod"){s=new o(null),s.length=p+1,s.words=new Array(s.length);for(var y=0;y=0;U--){var W=(c.words[d.length+U]|0)*67108864+(c.words[d.length+U-1]|0);for(W=Math.min(W/w|0,67108863),c._ishlnsubmul(d,W,U);c.negative!==0;)W--,c.negative=0,c._ishlnsubmul(d,1,U),c.isZero()||(c.negative^=1);s&&(s.words[U]=W)}return s&&s._strip(),c._strip(),a!=="div"&&u!==0&&c.iushrn(u),{div:s||null,mod:c}},o.prototype.divmod=function(i,a,u){if(e(!i.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var c,d,w;return this.negative!==0&&i.negative===0?(w=this.neg().divmod(i,a),a!=="mod"&&(c=w.div.neg()),a!=="div"&&(d=w.mod.neg(),u&&d.negative!==0&&d.iadd(i)),{div:c,mod:d}):this.negative===0&&i.negative!==0?(w=this.divmod(i.neg(),a),a!=="mod"&&(c=w.div.neg()),{div:c,mod:w.mod}):this.negative&i.negative?(w=this.neg().divmod(i.neg(),a),a!=="div"&&(d=w.mod.neg(),u&&d.negative!==0&&d.isub(i)),{div:w.div,mod:d}):i.length>this.length||this.cmp(i)<0?{div:new o(0),mod:this}:i.length===1?a==="div"?{div:this.divn(i.words[0]),mod:null}:a==="mod"?{div:null,mod:new o(this.modrn(i.words[0]))}:{div:this.divn(i.words[0]),mod:new o(this.modrn(i.words[0]))}:this._wordDiv(i,a)},o.prototype.div=function(i){return this.divmod(i,"div",!1).div},o.prototype.mod=function(i){return this.divmod(i,"mod",!1).mod},o.prototype.umod=function(i){return this.divmod(i,"mod",!0).mod},o.prototype.divRound=function(i){var a=this.divmod(i);if(a.mod.isZero())return a.div;var u=a.div.negative!==0?a.mod.isub(i):a.mod,c=i.ushrn(1),d=i.andln(1),w=u.cmp(c);return w<0||d===1&&w===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},o.prototype.modrn=function(i){var a=i<0;a&&(i=-i),e(i<=67108863);for(var u=(1<<26)%i,c=0,d=this.length-1;d>=0;d--)c=(u*c+(this.words[d]|0))%i;return a?-c:c},o.prototype.modn=function(i){return this.modrn(i)},o.prototype.idivn=function(i){var a=i<0;a&&(i=-i),e(i<=67108863);for(var u=0,c=this.length-1;c>=0;c--){var d=(this.words[c]|0)+u*67108864;this.words[c]=d/i|0,u=d%i}return this._strip(),a?this.ineg():this},o.prototype.divn=function(i){return this.clone().idivn(i)},o.prototype.egcd=function(i){e(i.negative===0),e(!i.isZero());var a=this,u=i.clone();a.negative!==0?a=a.umod(i):a=a.clone();for(var c=new o(1),d=new o(0),w=new o(0),v=new o(1),p=0;a.isEven()&&u.isEven();)a.iushrn(1),u.iushrn(1),++p;for(var s=u.clone(),y=a.clone();!a.isZero();){for(var R=0,U=1;!(a.words[0]&U)&&R<26;++R,U<<=1);if(R>0)for(a.iushrn(R);R-- >0;)(c.isOdd()||d.isOdd())&&(c.iadd(s),d.isub(y)),c.iushrn(1),d.iushrn(1);for(var W=0,tt=1;!(u.words[0]&tt)&&W<26;++W,tt<<=1);if(W>0)for(u.iushrn(W);W-- >0;)(w.isOdd()||v.isOdd())&&(w.iadd(s),v.isub(y)),w.iushrn(1),v.iushrn(1);a.cmp(u)>=0?(a.isub(u),c.isub(w),d.isub(v)):(u.isub(a),w.isub(c),v.isub(d))}return{a:w,b:v,gcd:u.iushln(p)}},o.prototype._invmp=function(i){e(i.negative===0),e(!i.isZero());var a=this,u=i.clone();a.negative!==0?a=a.umod(i):a=a.clone();for(var c=new o(1),d=new o(0),w=u.clone();a.cmpn(1)>0&&u.cmpn(1)>0;){for(var v=0,p=1;!(a.words[0]&p)&&v<26;++v,p<<=1);if(v>0)for(a.iushrn(v);v-- >0;)c.isOdd()&&c.iadd(w),c.iushrn(1);for(var s=0,y=1;!(u.words[0]&y)&&s<26;++s,y<<=1);if(s>0)for(u.iushrn(s);s-- >0;)d.isOdd()&&d.iadd(w),d.iushrn(1);a.cmp(u)>=0?(a.isub(u),c.isub(d)):(u.isub(a),d.isub(c))}var R;return a.cmpn(1)===0?R=c:R=d,R.cmpn(0)<0&&R.iadd(i),R},o.prototype.gcd=function(i){if(this.isZero())return i.abs();if(i.isZero())return this.abs();var a=this.clone(),u=i.clone();a.negative=0,u.negative=0;for(var c=0;a.isEven()&&u.isEven();c++)a.iushrn(1),u.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;u.isEven();)u.iushrn(1);var d=a.cmp(u);if(d<0){var w=a;a=u,u=w}else if(d===0||u.cmpn(1)===0)break;a.isub(u)}while(!0);return u.iushln(c)},o.prototype.invm=function(i){return this.egcd(i).a.umod(i)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(i){return this.words[0]&i},o.prototype.bincn=function(i){e(typeof i=="number");var a=i%26,u=(i-a)/26,c=1<>>26,v&=67108863,this.words[w]=v}return d!==0&&(this.words[w]=d,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(i){var a=i<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this._strip();var u;if(this.length>1)u=1;else{a&&(i=-i),e(i<=67108863,"Number is too big");var c=this.words[0]|0;u=c===i?0:ci.length)return 1;if(this.length=0;u--){var c=this.words[u]|0,d=i.words[u]|0;if(c!==d){cd&&(a=1);break}}return a},o.prototype.gtn=function(i){return this.cmpn(i)===1},o.prototype.gt=function(i){return this.cmp(i)===1},o.prototype.gten=function(i){return this.cmpn(i)>=0},o.prototype.gte=function(i){return this.cmp(i)>=0},o.prototype.ltn=function(i){return this.cmpn(i)===-1},o.prototype.lt=function(i){return this.cmp(i)===-1},o.prototype.lten=function(i){return this.cmpn(i)<=0},o.prototype.lte=function(i){return this.cmp(i)<=0},o.prototype.eqn=function(i){return this.cmpn(i)===0},o.prototype.eq=function(i){return this.cmp(i)===0},o.red=function(i){return new ct(i)},o.prototype.toRed=function(i){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),i.convertTo(this)._forceRed(i)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(i){return this.red=i,this},o.prototype.forceRed=function(i){return e(!this.red,"Already a number in reduction context"),this._forceRed(i)},o.prototype.redAdd=function(i){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,i)},o.prototype.redIAdd=function(i){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,i)},o.prototype.redSub=function(i){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,i)},o.prototype.redISub=function(i){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,i)},o.prototype.redShl=function(i){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,i)},o.prototype.redMul=function(i){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,i),this.red.mul(this,i)},o.prototype.redIMul=function(i){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,i),this.red.imul(this,i)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(i){return e(this.red&&!i.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,i)};var xt={k256:null,p224:null,p192:null,p25519:null};function ot(g,i){this.name=g,this.p=new o(i,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ot.prototype._tmp=function(){var i=new o(null);return i.words=new Array(Math.ceil(this.n/13)),i},ot.prototype.ireduce=function(i){var a=i,u;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),u=a.bitLength();while(u>this.n);var c=u0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},ot.prototype.split=function(i,a){i.iushrn(this.n,0,a)},ot.prototype.imulK=function(i){return i.imul(this.k)};function pt(){ot.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(pt,ot),pt.prototype.split=function(i,a){for(var u=4194303,c=Math.min(i.length,9),d=0;d>>22,w=v}w>>>=22,i.words[d-10]=w,w===0&&i.length>10?i.length-=10:i.length-=9},pt.prototype.imulK=function(i){i.words[i.length]=0,i.words[i.length+1]=0,i.length+=2;for(var a=0,u=0;u>>=26,i.words[u]=d,a=c}return a!==0&&(i.words[i.length++]=a),i},o._prime=function(i){if(xt[i])return xt[i];var a;if(i==="k256")a=new pt;else if(i==="p224")a=new St;else if(i==="p192")a=new At;else if(i==="p25519")a=new Ee;else throw new Error("Unknown prime "+i);return xt[i]=a,a};function ct(g){if(typeof g=="string"){var i=o._prime(g);this.m=i.p,this.prime=i}else e(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}ct.prototype._verify1=function(i){e(i.negative===0,"red works only with positives"),e(i.red,"red works only with red numbers")},ct.prototype._verify2=function(i,a){e((i.negative|a.negative)===0,"red works only with positives"),e(i.red&&i.red===a.red,"red works only with red numbers")},ct.prototype.imod=function(i){return this.prime?this.prime.ireduce(i)._forceRed(this):(E(i,i.umod(this.m)._forceRed(this)),i)},ct.prototype.neg=function(i){return i.isZero()?i.clone():this.m.sub(i)._forceRed(this)},ct.prototype.add=function(i,a){this._verify2(i,a);var u=i.add(a);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},ct.prototype.iadd=function(i,a){this._verify2(i,a);var u=i.iadd(a);return u.cmp(this.m)>=0&&u.isub(this.m),u},ct.prototype.sub=function(i,a){this._verify2(i,a);var u=i.sub(a);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},ct.prototype.isub=function(i,a){this._verify2(i,a);var u=i.isub(a);return u.cmpn(0)<0&&u.iadd(this.m),u},ct.prototype.shl=function(i,a){return this._verify1(i),this.imod(i.ushln(a))},ct.prototype.imul=function(i,a){return this._verify2(i,a),this.imod(i.imul(a))},ct.prototype.mul=function(i,a){return this._verify2(i,a),this.imod(i.mul(a))},ct.prototype.isqr=function(i){return this.imul(i,i.clone())},ct.prototype.sqr=function(i){return this.mul(i,i)},ct.prototype.sqrt=function(i){if(i.isZero())return i.clone();var a=this.m.andln(3);if(e(a%2===1),a===3){var u=this.m.add(new o(1)).iushrn(2);return this.pow(i,u)}for(var c=this.m.subn(1),d=0;!c.isZero()&&c.andln(1)===0;)d++,c.iushrn(1);e(!c.isZero());var w=new o(1).toRed(this),v=w.redNeg(),p=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);this.pow(s,p).cmp(v)!==0;)s.redIAdd(v);for(var y=this.pow(s,c),R=this.pow(i,c.addn(1).iushrn(1)),U=this.pow(i,c),W=d;U.cmp(w)!==0;){for(var tt=U,st=0;tt.cmp(w)!==0;st++)tt=tt.redSqr();e(st=0;d--){for(var y=a.words[d],R=s-1;R>=0;R--){var U=y>>R&1;if(w!==c[0]&&(w=this.sqr(w)),U===0&&v===0){p=0;continue}v<<=1,v|=U,p++,!(p!==u&&(d!==0||R!==0))&&(w=this.mul(w,c[v]),p=0,v=0)}s=26}return w},ct.prototype.convertTo=function(i){var a=i.umod(this.m);return a===i?a.clone():a},ct.prototype.convertFrom=function(i){var a=i.clone();return a.red=null,a},o.mont=function(i){return new Lt(i)};function Lt(g){ct.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(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)}n(Lt,ct),Lt.prototype.convertTo=function(i){return this.imod(i.ushln(this.shift))},Lt.prototype.convertFrom=function(i){var a=this.imod(i.mul(this.rinv));return a.red=null,a},Lt.prototype.imul=function(i,a){if(i.isZero()||a.isZero())return i.words[0]=0,i.length=1,i;var u=i.imul(a),c=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=u.isub(c).iushrn(this.shift),w=d;return d.cmp(this.m)>=0?w=d.isub(this.m):d.cmpn(0)<0&&(w=d.iadd(this.m)),w._forceRed(this)},Lt.prototype.mul=function(i,a){if(i.isZero()||a.isZero())return new o(0)._forceRed(this);var u=i.mul(a),c=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=u.isub(c).iushrn(this.shift),w=d;return d.cmp(this.m)>=0?w=d.isub(this.m):d.cmpn(0)<0&&(w=d.iadd(this.m)),w._forceRed(this)},Lt.prototype.invm=function(i){var a=this.imod(i._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(typeof Fs>"u"||Fs,Ff)});var Hf=$e((Ks,Wf)=>{var Xp=H(V());var ao=An(),Fr=ao.Buffer;function Df(r,t){for(var e in r)t[e]=r[e]}Fr.from&&Fr.alloc&&Fr.allocUnsafe&&Fr.allocUnsafeSlow?Wf.exports=ao:(Df(ao,Ks),Ks.Buffer=On);function On(r,t,e){return Fr(r,t,e)}On.prototype=Object.create(Fr.prototype);Df(Fr,On);On.from=function(r,t,e){if(typeof r=="number")throw new TypeError("Argument must not be a number");return Fr(r,t,e)};On.alloc=function(r,t,e){if(typeof r!="number")throw new TypeError("Argument must be a number");var n=Fr(r);return t!==void 0?typeof e=="string"?n.fill(t,e):n.fill(t):n.fill(0),n};On.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return Fr(r)};On.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return ao.SlowBuffer(r)}});var Ds=$e((Qp,$f)=>{"use strict";var ty=H(V()),fo=Hf().Buffer;function k0(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,G=new Uint8Array(it);P!==J;){for(var rt=N[P],xt=0,ot=it-1;(rt!==0||xt>>0,G[ot]=rt%h>>>0,rt=rt/h>>>0;if(rt!==0)throw new Error("Non-zero carry");D=xt,P++}for(var pt=it-D;pt!==it&&G[pt]===0;)pt++;for(var St=x.repeat(ft);pt>>0,it=new Uint8Array(J);ft>>0,it[xt]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");P=rt,ft++}for(var ot=J-P;ot!==J&&it[ot]===0;)ot++;var pt=fo.allocUnsafe(D+(J-ot));pt.fill(0,0,D);for(var St=D;ot!==J;)pt[St++]=it[ot++];return pt}function C(N){var ft=I(N);if(ft)return ft;throw new Error("Non-base"+h+" character")}return{encode:_,decodeUnsafe:I,decode:C}}$f.exports=k0});var jf=$e((ey,Vf)=>{var ry=H(V()),S0=Ds(),B0="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Vf.exports=S0(B0)});var sy,_0,yn,gn,Ws,xi,Hs=le(()=>{sy=H(V(),1);gs();fn();_0=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),yn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),gn=new Uint32Array(64),Ws=class extends Jn{constructor(){super(64,32,8,!1),this.A=yn[0]|0,this.B=yn[1]|0,this.C=yn[2]|0,this.D=yn[3]|0,this.E=yn[4]|0,this.F=yn[5]|0,this.G=yn[6]|0,this.H=yn[7]|0}get(){let{A:t,B:e,C:n,D:o,E:f,F:h,G:x,H:b}=this;return[t,e,n,o,f,h,x,b]}set(t,e,n,o,f,h,x,b){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=f|0,this.F=h|0,this.G=x|0,this.H=b|0}process(t,e){for(let I=0;I<16;I++,e+=4)gn[I]=t.getUint32(e,!1);for(let I=16;I<64;I++){let C=gn[I-15],N=gn[I-2],ft=Lr(C,7)^Lr(C,18)^C>>>3,D=Lr(N,17)^Lr(N,19)^N>>>10;gn[I]=D+gn[I-7]+ft+gn[I-16]|0}let{A:n,B:o,C:f,D:h,E:x,F:b,G:E,H:_}=this;for(let I=0;I<64;I++){let C=Lr(x,6)^Lr(x,11)^Lr(x,25),N=_+C+kf(x,b,E)+_0[I]+gn[I]|0,D=(Lr(n,2)^Lr(n,13)^Lr(n,22))+Sf(n,o,f)|0;_=E,E=b,b=x,x=h+N|0,h=f,f=o,o=n,n=N+D|0}n=n+this.A|0,o=o+this.B|0,f=f+this.C|0,h=h+this.D|0,x=x+this.E|0,b=b+this.F|0,E=E+this.G|0,_=_+this.H|0,this.set(n,o,f,h,x,b,E,_)}roundClean(){gn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},xi=Zn(()=>new Ws)});var Yf=$e((Gf,$s)=>{var ay=H(V());(function(r,t){"use strict";function e(g,i){if(!g)throw new Error(i||"Assertion failed")}function n(g,i){g.super_=i;var a=function(){};a.prototype=i.prototype,g.prototype=new a,g.prototype.constructor=g}function o(g,i,a){if(o.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((i==="le"||i==="be")&&(a=i,i=10),this._init(g||0,i||10,a||"be"))}typeof r=="object"?r.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var f;try{typeof window<"u"&&typeof window.Buffer<"u"?f=window.Buffer:f=qs().Buffer}catch{}o.isBN=function(i){return i instanceof o?!0:i!==null&&typeof i=="object"&&i.constructor.wordSize===o.wordSize&&Array.isArray(i.words)},o.max=function(i,a){return i.cmp(a)>0?i:a},o.min=function(i,a){return i.cmp(a)<0?i:a},o.prototype._init=function(i,a,u){if(typeof i=="number")return this._initNumber(i,a,u);if(typeof i=="object")return this._initArray(i,a,u);a==="hex"&&(a=16),e(a===(a|0)&&a>=2&&a<=36),i=i.toString().replace(/\\s+/g,"");var c=0;i[0]==="-"&&(c++,this.negative=1),c=0;c-=3)w=i[c]|i[c-1]<<8|i[c-2]<<16,this.words[d]|=w<>>26-v&67108863,v+=24,v>=26&&(v-=26,d++);else if(u==="le")for(c=0,d=0;c>>26-v&67108863,v+=24,v>=26&&(v-=26,d++);return this._strip()};function h(g,i){var a=g.charCodeAt(i);if(a>=48&&a<=57)return a-48;if(a>=65&&a<=70)return a-55;if(a>=97&&a<=102)return a-87;e(!1,"Invalid character in "+g)}function x(g,i,a){var u=h(g,a);return a-1>=i&&(u|=h(g,a-1)<<4),u}o.prototype._parseHex=function(i,a,u){this.length=Math.ceil((i.length-a)/6),this.words=new Array(this.length);for(var c=0;c=a;c-=2)v=x(i,a,c)<=18?(d-=18,w+=1,this.words[w]|=v>>>26):d+=8;else{var p=i.length-a;for(c=p%2===0?a+1:a;c=18?(d-=18,w+=1,this.words[w]|=v>>>26):d+=8}this._strip()};function b(g,i,a,u){for(var c=0,d=0,w=Math.min(g.length,a),v=i;v=49?d=p-49+10:p>=17?d=p-17+10:d=p,e(p>=0&&d1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=_}catch{o.prototype.inspect=_}else o.prototype.inspect=_;function _(){return(this.red?""}var I=["","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"],C=[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],N=[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];o.prototype.toString=function(i,a){i=i||10,a=a|0||1;var u;if(i===16||i==="hex"){u="";for(var c=0,d=0,w=0;w>>24-c&16777215,c+=2,c>=26&&(c-=26,w--),d!==0||w!==this.length-1?u=I[6-p.length]+p+u:u=p+u}for(d!==0&&(u=d.toString(16)+u);u.length%a!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(i===(i|0)&&i>=2&&i<=36){var s=C[i],y=N[i];u="";var R=this.clone();for(R.negative=0;!R.isZero();){var U=R.modrn(y).toString(i);R=R.idivn(y),R.isZero()?u=U+u:u=I[s-U.length]+U+u}for(this.isZero()&&(u="0"+u);u.length%a!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}e(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var i=this.words[0];return this.length===2?i+=this.words[1]*67108864:this.length===3&&this.words[2]===1?i+=4503599627370496+this.words[1]*67108864:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-i:i},o.prototype.toJSON=function(){return this.toString(16,2)},f&&(o.prototype.toBuffer=function(i,a){return this.toArrayLike(f,i,a)}),o.prototype.toArray=function(i,a){return this.toArrayLike(Array,i,a)};var ft=function(i,a){return i.allocUnsafe?i.allocUnsafe(a):new i(a)};o.prototype.toArrayLike=function(i,a,u){this._strip();var c=this.byteLength(),d=u||Math.max(1,c);e(c<=d,"byte array longer than desired length"),e(d>0,"Requested array length <= 0");var w=ft(i,d),v=a==="le"?"LE":"BE";return this["_toArrayLike"+v](w,c),w},o.prototype._toArrayLikeLE=function(i,a){for(var u=0,c=0,d=0,w=0;d>8&255),u>16&255),w===6?(u>24&255),c=0,w=0):(c=v>>>24,w+=2)}if(u=0&&(i[u--]=v>>8&255),u>=0&&(i[u--]=v>>16&255),w===6?(u>=0&&(i[u--]=v>>24&255),c=0,w=0):(c=v>>>24,w+=2)}if(u>=0)for(i[u--]=c;u>=0;)i[u--]=0},Math.clz32?o.prototype._countBits=function(i){return 32-Math.clz32(i)}:o.prototype._countBits=function(i){var a=i,u=0;return a>=4096&&(u+=13,a>>>=13),a>=64&&(u+=7,a>>>=7),a>=8&&(u+=4,a>>>=4),a>=2&&(u+=2,a>>>=2),u+a},o.prototype._zeroBits=function(i){if(i===0)return 26;var a=i,u=0;return a&8191||(u+=13,a>>>=13),a&127||(u+=7,a>>>=7),a&15||(u+=4,a>>>=4),a&3||(u+=2,a>>>=2),a&1||u++,u},o.prototype.bitLength=function(){var i=this.words[this.length-1],a=this._countBits(i);return(this.length-1)*26+a};function D(g){for(var i=new Array(g.bitLength()),a=0;a>>c&1}return i}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var i=0,a=0;ai.length?this.clone().ior(i):i.clone().ior(this)},o.prototype.uor=function(i){return this.length>i.length?this.clone().iuor(i):i.clone().iuor(this)},o.prototype.iuand=function(i){var a;this.length>i.length?a=i:a=this;for(var u=0;ui.length?this.clone().iand(i):i.clone().iand(this)},o.prototype.uand=function(i){return this.length>i.length?this.clone().iuand(i):i.clone().iuand(this)},o.prototype.iuxor=function(i){var a,u;this.length>i.length?(a=this,u=i):(a=i,u=this);for(var c=0;ci.length?this.clone().ixor(i):i.clone().ixor(this)},o.prototype.uxor=function(i){return this.length>i.length?this.clone().iuxor(i):i.clone().iuxor(this)},o.prototype.inotn=function(i){e(typeof i=="number"&&i>=0);var a=Math.ceil(i/26)|0,u=i%26;this._expand(a),u>0&&a--;for(var c=0;c0&&(this.words[c]=~this.words[c]&67108863>>26-u),this._strip()},o.prototype.notn=function(i){return this.clone().inotn(i)},o.prototype.setn=function(i,a){e(typeof i=="number"&&i>=0);var u=i/26|0,c=i%26;return this._expand(u+1),a?this.words[u]=this.words[u]|1<i.length?(u=this,c=i):(u=i,c=this);for(var d=0,w=0;w>>26;for(;d!==0&&w>>26;if(this.length=u.length,d!==0)this.words[this.length]=d,this.length++;else if(u!==this)for(;wi.length?this.clone().iadd(i):i.clone().iadd(this)},o.prototype.isub=function(i){if(i.negative!==0){i.negative=0;var a=this.iadd(i);return i.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(i),this.negative=1,this._normSign();var u=this.cmp(i);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var c,d;u>0?(c=this,d=i):(c=i,d=this);for(var w=0,v=0;v>26,this.words[v]=a&67108863;for(;w!==0&&v>26,this.words[v]=a&67108863;if(w===0&&v>>26,R=p&67108863,U=Math.min(s,i.length-1),W=Math.max(0,s-g.length+1);W<=U;W++){var tt=s-W|0;c=g.words[tt]|0,d=i.words[W]|0,w=c*d+R,y+=w/67108864|0,R=w&67108863}a.words[s]=R|0,p=y|0}return p!==0?a.words[s]=p|0:a.length--,a._strip()}var J=function(i,a,u){var c=i.words,d=a.words,w=u.words,v=0,p,s,y,R=c[0]|0,U=R&8191,W=R>>>13,tt=c[1]|0,st=tt&8191,dt=tt>>>13,be=c[2]|0,ht=be&8191,Bt=be>>>13,Xe=c[3]|0,Ft=Xe&8191,Kt=Xe>>>13,Ur=c[4]|0,ee=Ur&8191,Nt=Ur>>>13,kr=c[5]|0,Zt=kr&8191,Ht=kr>>>13,br=c[6]|0,Dt=br&8191,$t=br>>>13,xr=c[7]|0,Vt=xr&8191,jt=xr>>>13,Or=c[8]|0,ie=Or&8191,Jt=Or>>>13,Ir=c[9]|0,re=Ir&8191,Xt=Ir>>>13,Sr=d[0]|0,Qt=Sr&8191,ne=Sr>>>13,Mr=d[1]|0,te=Mr&8191,oe=Mr>>>13,rn=d[2]|0,ce=rn&8191,he=rn>>>13,hr=d[3]|0,Wt=hr&8191,Gt=hr>>>13,Wr=d[4]|0,se=Wr&8191,fe=Wr>>>13,Bn=d[5]|0,It=Bn&8191,ue=Bn>>>13,m=d[6]|0,S=m&8191,k=m>>>13,l=d[7]|0,B=l&8191,M=l>>>13,T=d[8]|0,O=T&8191,$=T>>>13,_t=d[9]|0,X=_t&8191,yt=_t>>>13;u.negative=i.negative^a.negative,u.length=19,p=Math.imul(U,Qt),s=Math.imul(U,ne),s=s+Math.imul(W,Qt)|0,y=Math.imul(W,ne);var gt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(gt>>>26)|0,gt&=67108863,p=Math.imul(st,Qt),s=Math.imul(st,ne),s=s+Math.imul(dt,Qt)|0,y=Math.imul(dt,ne),p=p+Math.imul(U,te)|0,s=s+Math.imul(U,oe)|0,s=s+Math.imul(W,te)|0,y=y+Math.imul(W,oe)|0;var Mt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,p=Math.imul(ht,Qt),s=Math.imul(ht,ne),s=s+Math.imul(Bt,Qt)|0,y=Math.imul(Bt,ne),p=p+Math.imul(st,te)|0,s=s+Math.imul(st,oe)|0,s=s+Math.imul(dt,te)|0,y=y+Math.imul(dt,oe)|0,p=p+Math.imul(U,ce)|0,s=s+Math.imul(U,he)|0,s=s+Math.imul(W,ce)|0,y=y+Math.imul(W,he)|0;var Rt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,p=Math.imul(Ft,Qt),s=Math.imul(Ft,ne),s=s+Math.imul(Kt,Qt)|0,y=Math.imul(Kt,ne),p=p+Math.imul(ht,te)|0,s=s+Math.imul(ht,oe)|0,s=s+Math.imul(Bt,te)|0,y=y+Math.imul(Bt,oe)|0,p=p+Math.imul(st,ce)|0,s=s+Math.imul(st,he)|0,s=s+Math.imul(dt,ce)|0,y=y+Math.imul(dt,he)|0,p=p+Math.imul(U,Wt)|0,s=s+Math.imul(U,Gt)|0,s=s+Math.imul(W,Wt)|0,y=y+Math.imul(W,Gt)|0;var qt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(qt>>>26)|0,qt&=67108863,p=Math.imul(ee,Qt),s=Math.imul(ee,ne),s=s+Math.imul(Nt,Qt)|0,y=Math.imul(Nt,ne),p=p+Math.imul(Ft,te)|0,s=s+Math.imul(Ft,oe)|0,s=s+Math.imul(Kt,te)|0,y=y+Math.imul(Kt,oe)|0,p=p+Math.imul(ht,ce)|0,s=s+Math.imul(ht,he)|0,s=s+Math.imul(Bt,ce)|0,y=y+Math.imul(Bt,he)|0,p=p+Math.imul(st,Wt)|0,s=s+Math.imul(st,Gt)|0,s=s+Math.imul(dt,Wt)|0,y=y+Math.imul(dt,Gt)|0,p=p+Math.imul(U,se)|0,s=s+Math.imul(U,fe)|0,s=s+Math.imul(W,se)|0,y=y+Math.imul(W,fe)|0;var zt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(zt>>>26)|0,zt&=67108863,p=Math.imul(Zt,Qt),s=Math.imul(Zt,ne),s=s+Math.imul(Ht,Qt)|0,y=Math.imul(Ht,ne),p=p+Math.imul(ee,te)|0,s=s+Math.imul(ee,oe)|0,s=s+Math.imul(Nt,te)|0,y=y+Math.imul(Nt,oe)|0,p=p+Math.imul(Ft,ce)|0,s=s+Math.imul(Ft,he)|0,s=s+Math.imul(Kt,ce)|0,y=y+Math.imul(Kt,he)|0,p=p+Math.imul(ht,Wt)|0,s=s+Math.imul(ht,Gt)|0,s=s+Math.imul(Bt,Wt)|0,y=y+Math.imul(Bt,Gt)|0,p=p+Math.imul(st,se)|0,s=s+Math.imul(st,fe)|0,s=s+Math.imul(dt,se)|0,y=y+Math.imul(dt,fe)|0,p=p+Math.imul(U,It)|0,s=s+Math.imul(U,ue)|0,s=s+Math.imul(W,It)|0,y=y+Math.imul(W,ue)|0;var Tt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,p=Math.imul(Dt,Qt),s=Math.imul(Dt,ne),s=s+Math.imul($t,Qt)|0,y=Math.imul($t,ne),p=p+Math.imul(Zt,te)|0,s=s+Math.imul(Zt,oe)|0,s=s+Math.imul(Ht,te)|0,y=y+Math.imul(Ht,oe)|0,p=p+Math.imul(ee,ce)|0,s=s+Math.imul(ee,he)|0,s=s+Math.imul(Nt,ce)|0,y=y+Math.imul(Nt,he)|0,p=p+Math.imul(Ft,Wt)|0,s=s+Math.imul(Ft,Gt)|0,s=s+Math.imul(Kt,Wt)|0,y=y+Math.imul(Kt,Gt)|0,p=p+Math.imul(ht,se)|0,s=s+Math.imul(ht,fe)|0,s=s+Math.imul(Bt,se)|0,y=y+Math.imul(Bt,fe)|0,p=p+Math.imul(st,It)|0,s=s+Math.imul(st,ue)|0,s=s+Math.imul(dt,It)|0,y=y+Math.imul(dt,ue)|0,p=p+Math.imul(U,S)|0,s=s+Math.imul(U,k)|0,s=s+Math.imul(W,S)|0,y=y+Math.imul(W,k)|0;var Ct=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,p=Math.imul(Vt,Qt),s=Math.imul(Vt,ne),s=s+Math.imul(jt,Qt)|0,y=Math.imul(jt,ne),p=p+Math.imul(Dt,te)|0,s=s+Math.imul(Dt,oe)|0,s=s+Math.imul($t,te)|0,y=y+Math.imul($t,oe)|0,p=p+Math.imul(Zt,ce)|0,s=s+Math.imul(Zt,he)|0,s=s+Math.imul(Ht,ce)|0,y=y+Math.imul(Ht,he)|0,p=p+Math.imul(ee,Wt)|0,s=s+Math.imul(ee,Gt)|0,s=s+Math.imul(Nt,Wt)|0,y=y+Math.imul(Nt,Gt)|0,p=p+Math.imul(Ft,se)|0,s=s+Math.imul(Ft,fe)|0,s=s+Math.imul(Kt,se)|0,y=y+Math.imul(Kt,fe)|0,p=p+Math.imul(ht,It)|0,s=s+Math.imul(ht,ue)|0,s=s+Math.imul(Bt,It)|0,y=y+Math.imul(Bt,ue)|0,p=p+Math.imul(st,S)|0,s=s+Math.imul(st,k)|0,s=s+Math.imul(dt,S)|0,y=y+Math.imul(dt,k)|0,p=p+Math.imul(U,B)|0,s=s+Math.imul(U,M)|0,s=s+Math.imul(W,B)|0,y=y+Math.imul(W,M)|0;var Pt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,p=Math.imul(ie,Qt),s=Math.imul(ie,ne),s=s+Math.imul(Jt,Qt)|0,y=Math.imul(Jt,ne),p=p+Math.imul(Vt,te)|0,s=s+Math.imul(Vt,oe)|0,s=s+Math.imul(jt,te)|0,y=y+Math.imul(jt,oe)|0,p=p+Math.imul(Dt,ce)|0,s=s+Math.imul(Dt,he)|0,s=s+Math.imul($t,ce)|0,y=y+Math.imul($t,he)|0,p=p+Math.imul(Zt,Wt)|0,s=s+Math.imul(Zt,Gt)|0,s=s+Math.imul(Ht,Wt)|0,y=y+Math.imul(Ht,Gt)|0,p=p+Math.imul(ee,se)|0,s=s+Math.imul(ee,fe)|0,s=s+Math.imul(Nt,se)|0,y=y+Math.imul(Nt,fe)|0,p=p+Math.imul(Ft,It)|0,s=s+Math.imul(Ft,ue)|0,s=s+Math.imul(Kt,It)|0,y=y+Math.imul(Kt,ue)|0,p=p+Math.imul(ht,S)|0,s=s+Math.imul(ht,k)|0,s=s+Math.imul(Bt,S)|0,y=y+Math.imul(Bt,k)|0,p=p+Math.imul(st,B)|0,s=s+Math.imul(st,M)|0,s=s+Math.imul(dt,B)|0,y=y+Math.imul(dt,M)|0,p=p+Math.imul(U,O)|0,s=s+Math.imul(U,$)|0,s=s+Math.imul(W,O)|0,y=y+Math.imul(W,$)|0;var mt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(mt>>>26)|0,mt&=67108863,p=Math.imul(re,Qt),s=Math.imul(re,ne),s=s+Math.imul(Xt,Qt)|0,y=Math.imul(Xt,ne),p=p+Math.imul(ie,te)|0,s=s+Math.imul(ie,oe)|0,s=s+Math.imul(Jt,te)|0,y=y+Math.imul(Jt,oe)|0,p=p+Math.imul(Vt,ce)|0,s=s+Math.imul(Vt,he)|0,s=s+Math.imul(jt,ce)|0,y=y+Math.imul(jt,he)|0,p=p+Math.imul(Dt,Wt)|0,s=s+Math.imul(Dt,Gt)|0,s=s+Math.imul($t,Wt)|0,y=y+Math.imul($t,Gt)|0,p=p+Math.imul(Zt,se)|0,s=s+Math.imul(Zt,fe)|0,s=s+Math.imul(Ht,se)|0,y=y+Math.imul(Ht,fe)|0,p=p+Math.imul(ee,It)|0,s=s+Math.imul(ee,ue)|0,s=s+Math.imul(Nt,It)|0,y=y+Math.imul(Nt,ue)|0,p=p+Math.imul(Ft,S)|0,s=s+Math.imul(Ft,k)|0,s=s+Math.imul(Kt,S)|0,y=y+Math.imul(Kt,k)|0,p=p+Math.imul(ht,B)|0,s=s+Math.imul(ht,M)|0,s=s+Math.imul(Bt,B)|0,y=y+Math.imul(Bt,M)|0,p=p+Math.imul(st,O)|0,s=s+Math.imul(st,$)|0,s=s+Math.imul(dt,O)|0,y=y+Math.imul(dt,$)|0,p=p+Math.imul(U,X)|0,s=s+Math.imul(U,yt)|0,s=s+Math.imul(W,X)|0,y=y+Math.imul(W,yt)|0;var Et=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Et>>>26)|0,Et&=67108863,p=Math.imul(re,te),s=Math.imul(re,oe),s=s+Math.imul(Xt,te)|0,y=Math.imul(Xt,oe),p=p+Math.imul(ie,ce)|0,s=s+Math.imul(ie,he)|0,s=s+Math.imul(Jt,ce)|0,y=y+Math.imul(Jt,he)|0,p=p+Math.imul(Vt,Wt)|0,s=s+Math.imul(Vt,Gt)|0,s=s+Math.imul(jt,Wt)|0,y=y+Math.imul(jt,Gt)|0,p=p+Math.imul(Dt,se)|0,s=s+Math.imul(Dt,fe)|0,s=s+Math.imul($t,se)|0,y=y+Math.imul($t,fe)|0,p=p+Math.imul(Zt,It)|0,s=s+Math.imul(Zt,ue)|0,s=s+Math.imul(Ht,It)|0,y=y+Math.imul(Ht,ue)|0,p=p+Math.imul(ee,S)|0,s=s+Math.imul(ee,k)|0,s=s+Math.imul(Nt,S)|0,y=y+Math.imul(Nt,k)|0,p=p+Math.imul(Ft,B)|0,s=s+Math.imul(Ft,M)|0,s=s+Math.imul(Kt,B)|0,y=y+Math.imul(Kt,M)|0,p=p+Math.imul(ht,O)|0,s=s+Math.imul(ht,$)|0,s=s+Math.imul(Bt,O)|0,y=y+Math.imul(Bt,$)|0,p=p+Math.imul(st,X)|0,s=s+Math.imul(st,yt)|0,s=s+Math.imul(dt,X)|0,y=y+Math.imul(dt,yt)|0;var lt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(lt>>>26)|0,lt&=67108863,p=Math.imul(re,ce),s=Math.imul(re,he),s=s+Math.imul(Xt,ce)|0,y=Math.imul(Xt,he),p=p+Math.imul(ie,Wt)|0,s=s+Math.imul(ie,Gt)|0,s=s+Math.imul(Jt,Wt)|0,y=y+Math.imul(Jt,Gt)|0,p=p+Math.imul(Vt,se)|0,s=s+Math.imul(Vt,fe)|0,s=s+Math.imul(jt,se)|0,y=y+Math.imul(jt,fe)|0,p=p+Math.imul(Dt,It)|0,s=s+Math.imul(Dt,ue)|0,s=s+Math.imul($t,It)|0,y=y+Math.imul($t,ue)|0,p=p+Math.imul(Zt,S)|0,s=s+Math.imul(Zt,k)|0,s=s+Math.imul(Ht,S)|0,y=y+Math.imul(Ht,k)|0,p=p+Math.imul(ee,B)|0,s=s+Math.imul(ee,M)|0,s=s+Math.imul(Nt,B)|0,y=y+Math.imul(Nt,M)|0,p=p+Math.imul(Ft,O)|0,s=s+Math.imul(Ft,$)|0,s=s+Math.imul(Kt,O)|0,y=y+Math.imul(Kt,$)|0,p=p+Math.imul(ht,X)|0,s=s+Math.imul(ht,yt)|0,s=s+Math.imul(Bt,X)|0,y=y+Math.imul(Bt,yt)|0;var wt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(wt>>>26)|0,wt&=67108863,p=Math.imul(re,Wt),s=Math.imul(re,Gt),s=s+Math.imul(Xt,Wt)|0,y=Math.imul(Xt,Gt),p=p+Math.imul(ie,se)|0,s=s+Math.imul(ie,fe)|0,s=s+Math.imul(Jt,se)|0,y=y+Math.imul(Jt,fe)|0,p=p+Math.imul(Vt,It)|0,s=s+Math.imul(Vt,ue)|0,s=s+Math.imul(jt,It)|0,y=y+Math.imul(jt,ue)|0,p=p+Math.imul(Dt,S)|0,s=s+Math.imul(Dt,k)|0,s=s+Math.imul($t,S)|0,y=y+Math.imul($t,k)|0,p=p+Math.imul(Zt,B)|0,s=s+Math.imul(Zt,M)|0,s=s+Math.imul(Ht,B)|0,y=y+Math.imul(Ht,M)|0,p=p+Math.imul(ee,O)|0,s=s+Math.imul(ee,$)|0,s=s+Math.imul(Nt,O)|0,y=y+Math.imul(Nt,$)|0,p=p+Math.imul(Ft,X)|0,s=s+Math.imul(Ft,yt)|0,s=s+Math.imul(Kt,X)|0,y=y+Math.imul(Kt,yt)|0;var bt=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(bt>>>26)|0,bt&=67108863,p=Math.imul(re,se),s=Math.imul(re,fe),s=s+Math.imul(Xt,se)|0,y=Math.imul(Xt,fe),p=p+Math.imul(ie,It)|0,s=s+Math.imul(ie,ue)|0,s=s+Math.imul(Jt,It)|0,y=y+Math.imul(Jt,ue)|0,p=p+Math.imul(Vt,S)|0,s=s+Math.imul(Vt,k)|0,s=s+Math.imul(jt,S)|0,y=y+Math.imul(jt,k)|0,p=p+Math.imul(Dt,B)|0,s=s+Math.imul(Dt,M)|0,s=s+Math.imul($t,B)|0,y=y+Math.imul($t,M)|0,p=p+Math.imul(Zt,O)|0,s=s+Math.imul(Zt,$)|0,s=s+Math.imul(Ht,O)|0,y=y+Math.imul(Ht,$)|0,p=p+Math.imul(ee,X)|0,s=s+Math.imul(ee,yt)|0,s=s+Math.imul(Nt,X)|0,y=y+Math.imul(Nt,yt)|0;var ut=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(ut>>>26)|0,ut&=67108863,p=Math.imul(re,It),s=Math.imul(re,ue),s=s+Math.imul(Xt,It)|0,y=Math.imul(Xt,ue),p=p+Math.imul(ie,S)|0,s=s+Math.imul(ie,k)|0,s=s+Math.imul(Jt,S)|0,y=y+Math.imul(Jt,k)|0,p=p+Math.imul(Vt,B)|0,s=s+Math.imul(Vt,M)|0,s=s+Math.imul(jt,B)|0,y=y+Math.imul(jt,M)|0,p=p+Math.imul(Dt,O)|0,s=s+Math.imul(Dt,$)|0,s=s+Math.imul($t,O)|0,y=y+Math.imul($t,$)|0,p=p+Math.imul(Zt,X)|0,s=s+Math.imul(Zt,yt)|0,s=s+Math.imul(Ht,X)|0,y=y+Math.imul(Ht,yt)|0;var F=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(F>>>26)|0,F&=67108863,p=Math.imul(re,S),s=Math.imul(re,k),s=s+Math.imul(Xt,S)|0,y=Math.imul(Xt,k),p=p+Math.imul(ie,B)|0,s=s+Math.imul(ie,M)|0,s=s+Math.imul(Jt,B)|0,y=y+Math.imul(Jt,M)|0,p=p+Math.imul(Vt,O)|0,s=s+Math.imul(Vt,$)|0,s=s+Math.imul(jt,O)|0,y=y+Math.imul(jt,$)|0,p=p+Math.imul(Dt,X)|0,s=s+Math.imul(Dt,yt)|0,s=s+Math.imul($t,X)|0,y=y+Math.imul($t,yt)|0;var K=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(K>>>26)|0,K&=67108863,p=Math.imul(re,B),s=Math.imul(re,M),s=s+Math.imul(Xt,B)|0,y=Math.imul(Xt,M),p=p+Math.imul(ie,O)|0,s=s+Math.imul(ie,$)|0,s=s+Math.imul(Jt,O)|0,y=y+Math.imul(Jt,$)|0,p=p+Math.imul(Vt,X)|0,s=s+Math.imul(Vt,yt)|0,s=s+Math.imul(jt,X)|0,y=y+Math.imul(jt,yt)|0;var Q=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Q>>>26)|0,Q&=67108863,p=Math.imul(re,O),s=Math.imul(re,$),s=s+Math.imul(Xt,O)|0,y=Math.imul(Xt,$),p=p+Math.imul(ie,X)|0,s=s+Math.imul(ie,yt)|0,s=s+Math.imul(Jt,X)|0,y=y+Math.imul(Jt,yt)|0;var Y=(v+p|0)+((s&8191)<<13)|0;v=(y+(s>>>13)|0)+(Y>>>26)|0,Y&=67108863,p=Math.imul(re,X),s=Math.imul(re,yt),s=s+Math.imul(Xt,X)|0,y=Math.imul(Xt,yt);var Z=(v+p|0)+((s&8191)<<13)|0;return v=(y+(s>>>13)|0)+(Z>>>26)|0,Z&=67108863,w[0]=gt,w[1]=Mt,w[2]=Rt,w[3]=qt,w[4]=zt,w[5]=Tt,w[6]=Ct,w[7]=Pt,w[8]=mt,w[9]=Et,w[10]=lt,w[11]=wt,w[12]=bt,w[13]=ut,w[14]=F,w[15]=K,w[16]=Q,w[17]=Y,w[18]=Z,v!==0&&(w[19]=v,u.length++),u};Math.imul||(J=P);function it(g,i,a){a.negative=i.negative^g.negative,a.length=g.length+i.length;for(var u=0,c=0,d=0;d>>26)|0,c+=w>>>26,w&=67108863}a.words[d]=v,u=w,w=c}return u!==0?a.words[d]=u:a.length--,a._strip()}function G(g,i,a){return it(g,i,a)}o.prototype.mulTo=function(i,a){var u,c=this.length+i.length;return this.length===10&&i.length===10?u=J(this,i,a):c<63?u=P(this,i,a):c<1024?u=it(this,i,a):u=G(this,i,a),u};function rt(g,i){this.x=g,this.y=i}rt.prototype.makeRBT=function(i){for(var a=new Array(i),u=o.prototype._countBits(i)-1,c=0;c>=1;return c},rt.prototype.permute=function(i,a,u,c,d,w){for(var v=0;v>>1)d++;return 1<>>13,u[2*w+1]=d&8191,d=d>>>13;for(w=2*a;w>=26,u+=d/67108864|0,u+=w>>>26,this.words[c]=w&67108863}return u!==0&&(this.words[c]=u,this.length++),a?this.ineg():this},o.prototype.muln=function(i){return this.clone().imuln(i)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(i){var a=D(i);if(a.length===0)return new o(1);for(var u=this,c=0;c=0);var a=i%26,u=(i-a)/26,c=67108863>>>26-a<<26-a,d;if(a!==0){var w=0;for(d=0;d>>26-a}w&&(this.words[d]=w,this.length++)}if(u!==0){for(d=this.length-1;d>=0;d--)this.words[d+u]=this.words[d];for(d=0;d=0);var c;a?c=(a-a%26)/26:c=0;var d=i%26,w=Math.min((i-d)/26,this.length),v=67108863^67108863>>>d<w)for(this.length-=w,s=0;s=0&&(y!==0||s>=c);s--){var R=this.words[s]|0;this.words[s]=y<<26-d|R>>>d,y=R&v}return p&&y!==0&&(p.words[p.length++]=y),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(i,a,u){return e(this.negative===0),this.iushrn(i,a,u)},o.prototype.shln=function(i){return this.clone().ishln(i)},o.prototype.ushln=function(i){return this.clone().iushln(i)},o.prototype.shrn=function(i){return this.clone().ishrn(i)},o.prototype.ushrn=function(i){return this.clone().iushrn(i)},o.prototype.testn=function(i){e(typeof i=="number"&&i>=0);var a=i%26,u=(i-a)/26,c=1<=0);var a=i%26,u=(i-a)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(a!==0&&u++,this.length=Math.min(u,this.length),a!==0){var c=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},o.prototype.isubn=function(i){if(e(typeof i=="number"),e(i<67108864),i<0)return this.iaddn(-i);if(this.negative!==0)return this.negative=0,this.iaddn(i),this.negative=1,this;if(this.words[0]-=i,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(p/67108864|0),this.words[d+u]=w&67108863}for(;d>26,this.words[d+u]=w&67108863;if(v===0)return this._strip();for(e(v===-1),v=0,d=0;d>26,this.words[d]=w&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(i,a){var u=this.length-i.length,c=this.clone(),d=i,w=d.words[d.length-1]|0,v=this._countBits(w);u=26-v,u!==0&&(d=d.ushln(u),c.iushln(u),w=d.words[d.length-1]|0);var p=c.length-d.length,s;if(a!=="mod"){s=new o(null),s.length=p+1,s.words=new Array(s.length);for(var y=0;y=0;U--){var W=(c.words[d.length+U]|0)*67108864+(c.words[d.length+U-1]|0);for(W=Math.min(W/w|0,67108863),c._ishlnsubmul(d,W,U);c.negative!==0;)W--,c.negative=0,c._ishlnsubmul(d,1,U),c.isZero()||(c.negative^=1);s&&(s.words[U]=W)}return s&&s._strip(),c._strip(),a!=="div"&&u!==0&&c.iushrn(u),{div:s||null,mod:c}},o.prototype.divmod=function(i,a,u){if(e(!i.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var c,d,w;return this.negative!==0&&i.negative===0?(w=this.neg().divmod(i,a),a!=="mod"&&(c=w.div.neg()),a!=="div"&&(d=w.mod.neg(),u&&d.negative!==0&&d.iadd(i)),{div:c,mod:d}):this.negative===0&&i.negative!==0?(w=this.divmod(i.neg(),a),a!=="mod"&&(c=w.div.neg()),{div:c,mod:w.mod}):this.negative&i.negative?(w=this.neg().divmod(i.neg(),a),a!=="div"&&(d=w.mod.neg(),u&&d.negative!==0&&d.isub(i)),{div:w.div,mod:d}):i.length>this.length||this.cmp(i)<0?{div:new o(0),mod:this}:i.length===1?a==="div"?{div:this.divn(i.words[0]),mod:null}:a==="mod"?{div:null,mod:new o(this.modrn(i.words[0]))}:{div:this.divn(i.words[0]),mod:new o(this.modrn(i.words[0]))}:this._wordDiv(i,a)},o.prototype.div=function(i){return this.divmod(i,"div",!1).div},o.prototype.mod=function(i){return this.divmod(i,"mod",!1).mod},o.prototype.umod=function(i){return this.divmod(i,"mod",!0).mod},o.prototype.divRound=function(i){var a=this.divmod(i);if(a.mod.isZero())return a.div;var u=a.div.negative!==0?a.mod.isub(i):a.mod,c=i.ushrn(1),d=i.andln(1),w=u.cmp(c);return w<0||d===1&&w===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},o.prototype.modrn=function(i){var a=i<0;a&&(i=-i),e(i<=67108863);for(var u=(1<<26)%i,c=0,d=this.length-1;d>=0;d--)c=(u*c+(this.words[d]|0))%i;return a?-c:c},o.prototype.modn=function(i){return this.modrn(i)},o.prototype.idivn=function(i){var a=i<0;a&&(i=-i),e(i<=67108863);for(var u=0,c=this.length-1;c>=0;c--){var d=(this.words[c]|0)+u*67108864;this.words[c]=d/i|0,u=d%i}return this._strip(),a?this.ineg():this},o.prototype.divn=function(i){return this.clone().idivn(i)},o.prototype.egcd=function(i){e(i.negative===0),e(!i.isZero());var a=this,u=i.clone();a.negative!==0?a=a.umod(i):a=a.clone();for(var c=new o(1),d=new o(0),w=new o(0),v=new o(1),p=0;a.isEven()&&u.isEven();)a.iushrn(1),u.iushrn(1),++p;for(var s=u.clone(),y=a.clone();!a.isZero();){for(var R=0,U=1;!(a.words[0]&U)&&R<26;++R,U<<=1);if(R>0)for(a.iushrn(R);R-- >0;)(c.isOdd()||d.isOdd())&&(c.iadd(s),d.isub(y)),c.iushrn(1),d.iushrn(1);for(var W=0,tt=1;!(u.words[0]&tt)&&W<26;++W,tt<<=1);if(W>0)for(u.iushrn(W);W-- >0;)(w.isOdd()||v.isOdd())&&(w.iadd(s),v.isub(y)),w.iushrn(1),v.iushrn(1);a.cmp(u)>=0?(a.isub(u),c.isub(w),d.isub(v)):(u.isub(a),w.isub(c),v.isub(d))}return{a:w,b:v,gcd:u.iushln(p)}},o.prototype._invmp=function(i){e(i.negative===0),e(!i.isZero());var a=this,u=i.clone();a.negative!==0?a=a.umod(i):a=a.clone();for(var c=new o(1),d=new o(0),w=u.clone();a.cmpn(1)>0&&u.cmpn(1)>0;){for(var v=0,p=1;!(a.words[0]&p)&&v<26;++v,p<<=1);if(v>0)for(a.iushrn(v);v-- >0;)c.isOdd()&&c.iadd(w),c.iushrn(1);for(var s=0,y=1;!(u.words[0]&y)&&s<26;++s,y<<=1);if(s>0)for(u.iushrn(s);s-- >0;)d.isOdd()&&d.iadd(w),d.iushrn(1);a.cmp(u)>=0?(a.isub(u),c.isub(d)):(u.isub(a),d.isub(c))}var R;return a.cmpn(1)===0?R=c:R=d,R.cmpn(0)<0&&R.iadd(i),R},o.prototype.gcd=function(i){if(this.isZero())return i.abs();if(i.isZero())return this.abs();var a=this.clone(),u=i.clone();a.negative=0,u.negative=0;for(var c=0;a.isEven()&&u.isEven();c++)a.iushrn(1),u.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;u.isEven();)u.iushrn(1);var d=a.cmp(u);if(d<0){var w=a;a=u,u=w}else if(d===0||u.cmpn(1)===0)break;a.isub(u)}while(!0);return u.iushln(c)},o.prototype.invm=function(i){return this.egcd(i).a.umod(i)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(i){return this.words[0]&i},o.prototype.bincn=function(i){e(typeof i=="number");var a=i%26,u=(i-a)/26,c=1<>>26,v&=67108863,this.words[w]=v}return d!==0&&(this.words[w]=d,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(i){var a=i<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this._strip();var u;if(this.length>1)u=1;else{a&&(i=-i),e(i<=67108863,"Number is too big");var c=this.words[0]|0;u=c===i?0:ci.length)return 1;if(this.length=0;u--){var c=this.words[u]|0,d=i.words[u]|0;if(c!==d){cd&&(a=1);break}}return a},o.prototype.gtn=function(i){return this.cmpn(i)===1},o.prototype.gt=function(i){return this.cmp(i)===1},o.prototype.gten=function(i){return this.cmpn(i)>=0},o.prototype.gte=function(i){return this.cmp(i)>=0},o.prototype.ltn=function(i){return this.cmpn(i)===-1},o.prototype.lt=function(i){return this.cmp(i)===-1},o.prototype.lten=function(i){return this.cmpn(i)<=0},o.prototype.lte=function(i){return this.cmp(i)<=0},o.prototype.eqn=function(i){return this.cmpn(i)===0},o.prototype.eq=function(i){return this.cmp(i)===0},o.red=function(i){return new ct(i)},o.prototype.toRed=function(i){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),i.convertTo(this)._forceRed(i)},o.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(i){return this.red=i,this},o.prototype.forceRed=function(i){return e(!this.red,"Already a number in reduction context"),this._forceRed(i)},o.prototype.redAdd=function(i){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,i)},o.prototype.redIAdd=function(i){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,i)},o.prototype.redSub=function(i){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,i)},o.prototype.redISub=function(i){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,i)},o.prototype.redShl=function(i){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,i)},o.prototype.redMul=function(i){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,i),this.red.mul(this,i)},o.prototype.redIMul=function(i){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,i),this.red.imul(this,i)},o.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(i){return e(this.red&&!i.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,i)};var xt={k256:null,p224:null,p192:null,p25519:null};function ot(g,i){this.name=g,this.p=new o(i,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ot.prototype._tmp=function(){var i=new o(null);return i.words=new Array(Math.ceil(this.n/13)),i},ot.prototype.ireduce=function(i){var a=i,u;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),u=a.bitLength();while(u>this.n);var c=u0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},ot.prototype.split=function(i,a){i.iushrn(this.n,0,a)},ot.prototype.imulK=function(i){return i.imul(this.k)};function pt(){ot.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(pt,ot),pt.prototype.split=function(i,a){for(var u=4194303,c=Math.min(i.length,9),d=0;d>>22,w=v}w>>>=22,i.words[d-10]=w,w===0&&i.length>10?i.length-=10:i.length-=9},pt.prototype.imulK=function(i){i.words[i.length]=0,i.words[i.length+1]=0,i.length+=2;for(var a=0,u=0;u>>=26,i.words[u]=d,a=c}return a!==0&&(i.words[i.length++]=a),i},o._prime=function(i){if(xt[i])return xt[i];var a;if(i==="k256")a=new pt;else if(i==="p224")a=new St;else if(i==="p192")a=new At;else if(i==="p25519")a=new Ee;else throw new Error("Unknown prime "+i);return xt[i]=a,a};function ct(g){if(typeof g=="string"){var i=o._prime(g);this.m=i.p,this.prime=i}else e(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}ct.prototype._verify1=function(i){e(i.negative===0,"red works only with positives"),e(i.red,"red works only with red numbers")},ct.prototype._verify2=function(i,a){e((i.negative|a.negative)===0,"red works only with positives"),e(i.red&&i.red===a.red,"red works only with red numbers")},ct.prototype.imod=function(i){return this.prime?this.prime.ireduce(i)._forceRed(this):(E(i,i.umod(this.m)._forceRed(this)),i)},ct.prototype.neg=function(i){return i.isZero()?i.clone():this.m.sub(i)._forceRed(this)},ct.prototype.add=function(i,a){this._verify2(i,a);var u=i.add(a);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},ct.prototype.iadd=function(i,a){this._verify2(i,a);var u=i.iadd(a);return u.cmp(this.m)>=0&&u.isub(this.m),u},ct.prototype.sub=function(i,a){this._verify2(i,a);var u=i.sub(a);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},ct.prototype.isub=function(i,a){this._verify2(i,a);var u=i.isub(a);return u.cmpn(0)<0&&u.iadd(this.m),u},ct.prototype.shl=function(i,a){return this._verify1(i),this.imod(i.ushln(a))},ct.prototype.imul=function(i,a){return this._verify2(i,a),this.imod(i.imul(a))},ct.prototype.mul=function(i,a){return this._verify2(i,a),this.imod(i.mul(a))},ct.prototype.isqr=function(i){return this.imul(i,i.clone())},ct.prototype.sqr=function(i){return this.mul(i,i)},ct.prototype.sqrt=function(i){if(i.isZero())return i.clone();var a=this.m.andln(3);if(e(a%2===1),a===3){var u=this.m.add(new o(1)).iushrn(2);return this.pow(i,u)}for(var c=this.m.subn(1),d=0;!c.isZero()&&c.andln(1)===0;)d++,c.iushrn(1);e(!c.isZero());var w=new o(1).toRed(this),v=w.redNeg(),p=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);this.pow(s,p).cmp(v)!==0;)s.redIAdd(v);for(var y=this.pow(s,c),R=this.pow(i,c.addn(1).iushrn(1)),U=this.pow(i,c),W=d;U.cmp(w)!==0;){for(var tt=U,st=0;tt.cmp(w)!==0;st++)tt=tt.redSqr();e(st=0;d--){for(var y=a.words[d],R=s-1;R>=0;R--){var U=y>>R&1;if(w!==c[0]&&(w=this.sqr(w)),U===0&&v===0){p=0;continue}v<<=1,v|=U,p++,!(p!==u&&(d!==0||R!==0))&&(w=this.mul(w,c[v]),p=0,v=0)}s=26}return w},ct.prototype.convertTo=function(i){var a=i.umod(this.m);return a===i?a.clone():a},ct.prototype.convertFrom=function(i){var a=i.clone();return a.red=null,a},o.mont=function(i){return new Lt(i)};function Lt(g){ct.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(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)}n(Lt,ct),Lt.prototype.convertTo=function(i){return this.imod(i.ushln(this.shift))},Lt.prototype.convertFrom=function(i){var a=this.imod(i.mul(this.rinv));return a.red=null,a},Lt.prototype.imul=function(i,a){if(i.isZero()||a.isZero())return i.words[0]=0,i.length=1,i;var u=i.imul(a),c=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=u.isub(c).iushrn(this.shift),w=d;return d.cmp(this.m)>=0?w=d.isub(this.m):d.cmpn(0)<0&&(w=d.iadd(this.m)),w._forceRed(this)},Lt.prototype.mul=function(i,a){if(i.isZero()||a.isZero())return new o(0)._forceRed(this);var u=i.mul(a),c=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),d=u.isub(c).iushrn(this.shift),w=d;return d.cmp(this.m)>=0?w=d.isub(this.m):d.cmpn(0)<0&&(w=d.iadd(this.m)),w._forceRed(this)},Lt.prototype.invm=function(i){var a=this.imod(i._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(typeof $s>"u"||$s,Gf)});var Jf=$e((fy,Zf)=>{var uy=H(V()),E0=Ds(),A0="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Zf.exports=E0(A0)});var Xf=$e(Gs=>{"use strict";var hy=H(V());function Zr(r,t,e){return t<=r&&r<=e}function po(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function I0(r){for(var t=String(r),e=t.length,n=0,o=[];n57343)o.push(f);else if(56320<=f&&f<=57343)o.push(65533);else if(55296<=f&&f<=56319)if(n===e-1)o.push(65533);else{var h=r.charCodeAt(n+1);if(56320<=h&&h<=57343){var x=f&1023,b=h&1023;o.push(65536+(x<<10)+b),n+=1}else o.push(65533)}n+=1}return o}function M0(r){for(var t="",e=0;e>10)+55296,(n&1023)+56320))}return t}var uo=-1;function js(r){this.tokens=[].slice.call(r)}js.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():uo},prepend:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.push(t.shift());else this.tokens.push(r)}};var ti=-1;function Vs(r,t){if(r)throw TypeError("Decoder error");return t||65533}var co="utf-8";function ho(r,t){if(!(this instanceof ho))return new ho(r,t);if(r=r!==void 0?String(r).toLowerCase():co,r!==co)throw new Error("Encoding not supported. Only utf-8 is supported");t=po(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}ho.prototype={decode:function(t,e){var n;typeof t=="object"&&t instanceof ArrayBuffer?n=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):n=new Uint8Array(0),e=po(e),this._streaming||(this._decoder=new L0({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var o=new js(n),f=[],h;!o.endOfStream()&&(h=this._decoder.handler(o,o.read()),h!==ti);)h!==null&&(Array.isArray(h)?f.push.apply(f,h):f.push(h));if(!this._streaming){do{if(h=this._decoder.handler(o,o.read()),h===ti)break;h!==null&&(Array.isArray(h)?f.push.apply(f,h):f.push(h))}while(!o.endOfStream());this._decoder=null}return f.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(f[0]===65279?(this._BOMseen=!0,f.shift()):this._BOMseen=!0),M0(f)}};function lo(r,t){if(!(this instanceof lo))return new lo(r,t);if(r=r!==void 0?String(r).toLowerCase():co,r!==co)throw new Error("Encoding not supported. Only utf-8 is supported");t=po(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}lo.prototype={encode:function(t,e){t=t?String(t):"",e=po(e),this._streaming||(this._encoder=new R0(this._options)),this._streaming=!!e.stream;for(var n=[],o=new js(I0(t)),f;!o.endOfStream()&&(f=this._encoder.handler(o,o.read()),f!==ti);)Array.isArray(f)?n.push.apply(n,f):n.push(f);if(!this._streaming){for(;f=this._encoder.handler(o,o.read()),f!==ti;)Array.isArray(f)?n.push.apply(n,f):n.push(f);this._encoder=null}return new Uint8Array(n)}};function L0(r){var t=r.fatal,e=0,n=0,o=0,f=128,h=191;this.handler=function(x,b){if(b===uo&&o!==0)return o=0,Vs(t);if(b===uo)return ti;if(o===0){if(Zr(b,0,127))return b;if(Zr(b,194,223))o=1,e=b-192;else if(Zr(b,224,239))b===224&&(f=160),b===237&&(h=159),o=2,e=b-224;else if(Zr(b,240,244))b===240&&(f=144),b===244&&(h=143),o=3,e=b-240;else return Vs(t);return e=e<<6*o,null}if(!Zr(b,f,h))return e=o=n=0,f=128,h=191,x.prepend(b),Vs(t);if(f=128,h=191,n+=1,e+=b-128<<6*(o-n),n!==o)return null;var E=e;return e=o=n=0,E}}function R0(r){var t=r.fatal;this.handler=function(e,n){if(n===uo)return ti;if(Zr(n,0,127))return n;var o,f;Zr(n,128,2047)?(o=1,f=192):Zr(n,2048,65535)?(o=2,f=224):Zr(n,65536,1114111)&&(o=3,f=240);for(var h=[(n>>6*o)+f];o>0;){var x=n>>6*(o-1);h.push(128|x&63),o-=1}return h}}Gs.TextEncoder=lo;Gs.TextDecoder=ho});var nu=$e(Te=>{"use strict";var dy=H(V()),T0=Te&&Te.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e),Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[e]}})}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),P0=Te&&Te.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Kr=Te&&Te.__decorate||function(r,t,e,n){var o=arguments.length,f=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(r,t,e,n);else for(var x=r.length-1;x>=0;x--)(h=r[x])&&(f=(o<3?h(f):o>3?h(t,e,f):h(t,e))||f);return o>3&&f&&Object.defineProperty(t,e,f),f},C0=Te&&Te.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.hasOwnProperty.call(r,e)&&T0(t,r,e);return P0(t,r),t},Qf=Te&&Te.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Te,"__esModule",{value:!0});Te.deserializeUnchecked=Te.deserialize=Te.serialize=Te.BinaryReader=Te.BinaryWriter=Te.BorshError=Te.baseDecode=Te.baseEncode=void 0;var mn=Qf(Yf()),tu=Qf(Jf()),U0=C0(Xf()),O0=typeof TextDecoder!="function"?U0.TextDecoder:TextDecoder,N0=new O0("utf-8",{fatal:!0});function z0(r){return typeof r=="string"&&(r=Buffer.from(r,"utf8")),tu.default.encode(Buffer.from(r))}Te.baseEncode=z0;function q0(r){return Buffer.from(tu.default.decode(r))}Te.baseDecode=q0;var Ys=1024,Qe=class extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}};Te.BorshError=Qe;var yo=class{constructor(){this.buf=Buffer.alloc(Ys),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(Ys)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mn.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mn.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mn.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer.from(new mn.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),t,Buffer.alloc(Ys)]),this.length+=t.length}writeString(t){this.maybeResize();let e=Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(let n of t)this.maybeResize(),e(n)}toArray(){return this.buf.subarray(0,this.length)}};Te.BinaryWriter=yo;function Dr(r,t,e){let n=e.value;e.value=function(...o){try{return n.apply(this,o)}catch(f){if(f instanceof RangeError){let h=f.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(h)>=0)throw new Qe("Reached the end of buffer when deserializing")}throw f}}}var lr=class{constructor(t){this.buf=t,this.offset=0}readU8(){let t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){let t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){let t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){let t=this.readBuffer(8);return new mn.default(t,"le")}readU128(){let t=this.readBuffer(16);return new mn.default(t,"le")}readU256(){let t=this.readBuffer(32);return new mn.default(t,"le")}readU512(){let t=this.readBuffer(64);return new mn.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new Qe(`Expected buffer length ${t} isn\'t within bounds`);let e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){let t=this.readU32(),e=this.readBuffer(t);try{return N0.decode(e)}catch(n){throw new Qe(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){let e=this.readU32(),n=Array();for(let o=0;o{Nn(r,t,f,n[0],o)});else if(n.kind!==void 0)switch(n.kind){case"option":{e==null?o.writeU8(0):(o.writeU8(1),Nn(r,t,e,n.type,o));break}case"map":{o.writeU32(e.size),e.forEach((f,h)=>{Nn(r,t,h,n.key,o),Nn(r,t,f,n.value,o)});break}default:throw new Qe(`FieldType ${n} unrecognized`)}else ru(r,e,o)}catch(f){throw f instanceof Qe&&f.addToFieldPath(t),f}}function ru(r,t,e){if(typeof t.borshSerialize=="function"){t.borshSerialize(e);return}let n=r.get(t.constructor);if(!n)throw new Qe(`Class ${t.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([o,f])=>{Nn(r,o,t[o],f,e)});else if(n.kind==="enum"){let o=t[n.field];for(let f=0;fzn(r,t,e[0],n))}if(e.kind==="option")return n.readU8()?zn(r,t,e.type,n):void 0;if(e.kind==="map"){let o=new Map,f=n.readU32();for(let h=0;h=n.values.length)throw new Qe(`Enum index: ${o} is out of range`);let[f,h]=n.values[o],x=zn(r,f,h,e);return new t({[f]:x})}throw new Qe(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}function K0(r,t,e,n=lr){let o=new n(e),f=Zs(r,t,o);if(o.offset{"use strict";var yy=H(V());Object.defineProperty(q,"__esModule",{value:!0});q.s16=q.s8=q.nu64be=q.u48be=q.u40be=q.u32be=q.u24be=q.u16be=q.nu64=q.u48=q.u40=q.u32=q.u24=q.u16=q.u8=q.offset=q.greedy=q.Constant=q.UTF8=q.CString=q.Blob=q.Boolean=q.BitField=q.BitStructure=q.VariantLayout=q.Union=q.UnionLayoutDiscriminator=q.UnionDiscriminator=q.Structure=q.Sequence=q.DoubleBE=q.Double=q.FloatBE=q.Float=q.NearInt64BE=q.NearInt64=q.NearUInt64BE=q.NearUInt64=q.IntBE=q.Int=q.UIntBE=q.UInt=q.OffsetLayout=q.GreedyCount=q.ExternalLayout=q.bindConstructorLayout=q.nameWithProperty=q.Layout=q.uint8ArrayToBuffer=q.checkUint8Array=void 0;q.constant=q.utf8=q.cstr=q.blob=q.unionLayoutDiscriminator=q.union=q.seq=q.bits=q.struct=q.f64be=q.f64=q.f32be=q.f32=q.ns64be=q.s48be=q.s40be=q.s32be=q.s24be=q.s16be=q.ns64=q.s48=q.s40=q.s32=q.s24=void 0;var Xs=An();function ni(r){if(!(r instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}q.checkUint8Array=ni;function Ae(r){return ni(r),Xs.Buffer.from(r.buffer,r.byteOffset,r.length)}q.uint8ArrayToBuffer=Ae;var Me=class{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){let e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}};q.Layout=Me;function Qs(r,t){return t.property?r+"["+t.property+"]":r}q.nameWithProperty=Qs;function W0(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Me))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value(e,n){return t.decode(e,n)},writable:!0})}q.bindConstructorLayout=W0;var ir=class extends Me{isCount(){throw new Error("ExternalLayout is abstract")}};q.ExternalLayout=ir;var go=class extends ir{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){ni(t);let n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}};q.GreedyCount=go;var vi=class extends ir{constructor(t,e=0,n){if(!(t instanceof Me))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof mr||this.layout instanceof vr}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}};q.OffsetLayout=vi;var mr=class extends Me{constructor(t,e){if(super(t,e),6h+o.encode(x,e,n+h),0);return this.count instanceof ir&&this.count.encode(t.length,e,n),f}};q.Sequence=_o;var Eo=class extends Me{constructor(t,e,n){if(!(Array.isArray(t)&&t.reduce((f,h)=>f&&h instanceof Me,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(let f of t)if(0>f.span&&f.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let o=-1;try{o=t.reduce((f,h)=>f+h.getSpan(),0)}catch{}super(o,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((o,f)=>{let h=f.getSpan(t,e);return e+=h,o+h},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e=0){ni(t);let n=this.makeDestinationObject();for(let o of this.fields)if(o.property!==void 0&&(n[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){let o=n,f=0,h=0;for(let x of this.fields){let b=x.span;if(h=0b&&(b=x.getSpan(e,n)))}f=n,n+=b}return f+h-o}fromArray(t){let e=this.makeDestinationObject();for(let n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}};q.Structure=Eo;var ki=class{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}};q.UnionDiscriminator=ki;var ri=class extends ki{constructor(t,e){if(!(t instanceof ir&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}};q.UnionLayoutDiscriminator=ri;var Si=class extends Me{constructor(t,e,n){let o;if(t instanceof mr||t instanceof vr)o=new ri(new vi(t));else if(t instanceof ir&&t.isCount())o=new ri(t);else if(t instanceof ki)o=t;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Me))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let f=-1;e&&(f=e.span,0<=f&&(t instanceof mr||t instanceof vr)&&(f+=o.layout.span)),super(f,n),this.discriminator=o,this.usesPrefixDiscriminator=t instanceof mr||t instanceof vr,this.defaultLayout=e,this.registry={};let h=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(x){return h(x)},this.configGetSourceVariant=function(x){h=x.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;let n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;let e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(let e in this.registry){let n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n,o=this.discriminator,f=o.decode(t,e),h=this.registry[f];if(h===void 0){let x=this.defaultLayout,b=0;this.usesPrefixDiscriminator&&(b=o.layout.span),n=this.makeDestinationObject(),n[o.property]=f,n[x.property]=x.decode(t,e+b)}else n=h.decode(t,e);return n}encode(t,e,n=0){let o=this.getSourceVariant(t);if(o===void 0){let f=this.discriminator,h=this.defaultLayout,x=0;return this.usesPrefixDiscriminator&&(x=f.layout.span),f.encode(t[f.property],e,n),x+h.encode(t[h.property],e,n+x)}return o.encode(t,e,n)}addVariant(t,e,n){let o=new Ao(this,t,e,n);return this.registry[t]=o,o}getVariant(t,e=0){let n;return t instanceof Uint8Array?n=this.discriminator.decode(t,e):n=t,this.registry[n]}};q.Union=Si;var Ao=class extends Me{constructor(t,e,n,o){if(!(t instanceof Si))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&o===void 0&&(o=n,n=null),n){if(!(n instanceof Me))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof o!="string")throw new TypeError("variant must have a String property")}let f=t.span;0>t.span&&(f=n?n.span:0,0<=f&&t.usesPrefixDiscriminator&&(f+=t.discriminator.layout.span)),super(f,o),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let o=0;return this.layout&&(o=this.layout.getSpan(t,e+n)),n+o}decode(t,e=0){let n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let o=0;return this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+o):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let o=0;if(this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let f=o;if(this.layout&&(this.layout.encode(t[this.property],e,n+o),f+=this.layout.getSpan(e,n+o),0<=this.union.span&&f>this.union.span))throw new Error("encoded variant overruns containing union");return f}fromArray(t){if(this.layout)return this.layout.fromArray(t)}};q.VariantLayout=Ao;function ei(r){return 0>r&&(r+=4294967296),r}var Bi=class extends Me{constructor(t,e,n){if(!(t instanceof mr||t instanceof vr))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");let o=8*t.span,f=t.fields.reduce((h,x)=>h+x.bits,0);if(e+f>o)throw new Error("bits too long for span remainder ("+(o-f)+" of "+o+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==ei(t&this.valueMask))throw new TypeError(Qs("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let e=this.container._packedGetValue(),n=ei(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),Ae(t).slice(e,e+n)}encode(t,e,n){let o=this.length;if(this.length instanceof ir&&(o=t.length),!(t instanceof Uint8Array&&o===t.length))throw new TypeError(Qs("Blob.encode",this)+" requires (length "+o+") Uint8Array as src");if(n+o>e.length)throw new RangeError("encoding overruns Uint8Array");let f=Ae(t);return Ae(e).write(f.toString("hex"),n,o,"hex"),this.length instanceof ir&&this.length.encode(o,e,n),o}};q.Blob=Mo;var Lo=class extends Me{constructor(t){super(-1,t)}getSpan(t,e=0){ni(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");let h=Ae(e);return o.copy(h,n),h[n+f]=0,f+1}};q.CString=Lo;var Ro=class extends Me{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return ni(t),t.length-e}decode(t,e=0){let n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return o.copy(Ae(e),n),f}};q.UTF8=Ro;var To=class extends Me{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}};q.Constant=To;q.greedy=(r,t)=>new go(r,t);q.offset=(r,t,e)=>new vi(r,t,e);q.u8=r=>new mr(1,r);q.u16=r=>new mr(2,r);q.u24=r=>new mr(3,r);q.u32=r=>new mr(4,r);q.u40=r=>new mr(5,r);q.u48=r=>new mr(6,r);q.nu64=r=>new mo(r);q.u16be=r=>new vr(2,r);q.u24be=r=>new vr(3,r);q.u32be=r=>new vr(4,r);q.u40be=r=>new vr(5,r);q.u48be=r=>new vr(6,r);q.nu64be=r=>new wo(r);q.s8=r=>new Jr(1,r);q.s16=r=>new Jr(2,r);q.s24=r=>new Jr(3,r);q.s32=r=>new Jr(4,r);q.s40=r=>new Jr(5,r);q.s48=r=>new Jr(6,r);q.ns64=r=>new bo(r);q.s16be=r=>new wn(2,r);q.s24be=r=>new wn(3,r);q.s32be=r=>new wn(4,r);q.s40be=r=>new wn(5,r);q.s48be=r=>new wn(6,r);q.ns64be=r=>new xo(r);q.f32=r=>new vo(r);q.f32be=r=>new ko(r);q.f64=r=>new So(r);q.f64be=r=>new Bo(r);q.struct=(r,t,e)=>new Eo(r,t,e);q.bits=(r,t,e)=>new Bi(r,t,e);q.seq=(r,t,e)=>new _o(r,t,e);q.union=(r,t,e)=>new Si(r,t,e);q.unionLayoutDiscriminator=(r,t)=>new ri(r,t);q.blob=(r,t)=>new Mo(r,t);q.cstr=r=>new Lo(r);q.utf8=(r,t)=>new Ro(r,t);q.constant=(r,t)=>new To(r,t)});var iu=$e(ii=>{"use strict";var my=H(V());Object.defineProperty(ii,"__esModule",{value:!0});var Uo;function H0(r){{let t=Buffer.from(r);t.reverse();let e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}return Uo.toBigInt(r,!1)}ii.toBigIntLE=H0;function $0(r){{let t=r.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}return Uo.toBigInt(r,!0)}ii.toBigIntBE=$0;function V0(r,t){{let e=r.toString(16),n=Buffer.from(e.padStart(t*2,"0").slice(0,t*2),"hex");return n.reverse(),n}return Uo.fromBigInt(r,Buffer.allocUnsafe(t),!1)}ii.toBufferLE=V0;function j0(r,t){{let e=r.toString(16);return Buffer.from(e.padStart(t*2,"0").slice(0,t*2),"hex")}return Uo.fromBigInt(r,Buffer.allocUnsafe(t),!0)}ii.toBufferBE=j0});function G0(r){return Ei(r)&&typeof r[Symbol.iterator]=="function"}function Ei(r){return typeof r=="object"&&r!=null}function Oo(r){return Ei(r)&&!Array.isArray(r)}function Pr(r){return typeof r=="symbol"?r.toString():typeof r=="string"?JSON.stringify(r):`${r}`}function Y0(r){let{done:t,value:e}=r.next();return t?void 0:e}function Z0(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});let{path:o,branch:f}=t,{type:h}=e,{refinement:x,message:b=`Expected a value of type \\`${h}\\`${x?` with refinement \\`${x}\\``:""}, but received: \\`${Pr(n)}\\``}=r;return{value:n,type:h,refinement:x,key:o[o.length-1],path:o,branch:f,...r,message:b}}function*ou(r,t,e,n){G0(r)||(r=[r]);for(let o of r){let f=Z0(o,t,e,n);f&&(yield f)}}function*ra(r,t,e={}){let{path:n=[],branch:o=[r],coerce:f=!1,mask:h=!1}=e,x={path:n,branch:o,mask:h};f&&(r=t.coercer(r,x));let b="valid";for(let E of t.validator(r,x))E.explanation=e.message,b="not_valid",yield[E,void 0];for(let[E,_,I]of t.entries(r,x)){let C=ra(_,I,{path:E===void 0?n:[...n,E],branch:E===void 0?o:[...o,_],coerce:f,mask:h,message:e.message});for(let N of C)N[0]?(b=N[0].refinement!=null?"not_refined":"not_valid",yield[N[0],void 0]):f&&(_=N[1],E===void 0?r=_:r instanceof Map?r.set(E,_):r instanceof Set?r.add(_):Ei(r)&&(_!==void 0||E in r)&&(r[E]=_))}if(b!=="not_valid")for(let E of t.refiner(r,x))E.explanation=e.message,b="not_refined",yield[E,void 0];b==="valid"&&(yield[void 0,r])}function su(r,t,e){let n=Ai(r,t,{message:e});if(n[0])throw n[0]}function oi(r,t,e){let n=Ai(r,t,{coerce:!0,message:e});if(n[0])throw n[0];return n[1]}function J0(r,t,e){let n=Ai(r,t,{coerce:!0,mask:!0,message:e});if(n[0])throw n[0];return n[1]}function au(r,t){return!Ai(r,t)[0]}function Ai(r,t,e={}){let n=ra(r,t,e),o=Y0(n);return o[0]?[new ea(o[0],function*(){for(let h of n)h[0]&&(yield h[0])}),void 0]:[void 0,o[1]]}function qn(r,t){return new _r({type:r,schema:null,validator:t})}function fu(){return qn("any",()=>!0)}function vt(r){return new _r({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(let[e,n]of t.entries())yield[e,n,r]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Pr(t)}`}})}function Cr(){return qn("boolean",r=>typeof r=="boolean")}function No(r){return qn("instance",t=>t instanceof r||`Expected a \\`${r.name}\\` instance, but received: ${Pr(t)}`)}function ze(r){let t=Pr(r),e=typeof r;return new _r({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator(n){return n===r||`Expected the literal \\`${t}\\`, but received: ${Pr(n)}`}})}function X0(){return qn("never",()=>!1)}function kt(r){return new _r({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function z(){return qn("number",r=>typeof r=="number"&&!isNaN(r)||`Expected a number, but received: ${Pr(r)}`)}function Ot(r){return new _r({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function na(r,t){return new _r({type:"record",schema:null,*entries(e){if(Ei(e))for(let n in e){let o=e[n];yield[n,n,r],yield[n,o,t]}},validator(e){return Oo(e)||`Expected an object, but received: ${Pr(e)}`},coercer(e){return Oo(e)?{...e}:e}})}function at(){return qn("string",r=>typeof r=="string"||`Expected a string, but received: ${Pr(r)}`)}function zo(r){let t=X0();return new _r({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){let n=Math.max(r.length,e.length);for(let o=0;oe.type).join(" | ");return new _r({type:"union",schema:null,coercer(e,n){for(let o of r){let[f,h]=o.validate(e,{coerce:!0,mask:n.mask});if(!f)return h}return e},validator(e,n){let o=[];for(let f of r){let[...h]=ra(e,f,n),[x]=h;if(x[0])for(let[b]of h)b&&o.push(b);else return[]}return[`Expected the value to satisfy a union of \\`${t}\\`, but received: ${Pr(e)}`,...o]}})}function Fn(){return qn("unknown",()=>!0)}function si(r,t,e){return new _r({...r,coercer:(n,o)=>au(n,t)?r.coercer(e(n,o),o):r.coercer(n,o)})}var by,ea,_r,uu=le(()=>{by=H(V(),1),ea=class extends TypeError{constructor(t,e){let n,{message:o,explanation:f,...h}=t,{path:x}=t,b=x.length===0?o:`At path: ${x.join(".")} -- ${o}`;super(f??b),f!=null&&(this.cause=b),Object.assign(this,h),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...e()])}};_r=class{constructor(t){let{type:e,schema:n,validator:o,refiner:f,coercer:h=b=>b,entries:x=function*(){}}=t;this.type=e,this.schema=n,this.entries=x,this.coercer=h,o?this.validator=(b,E)=>{let _=o(b,E);return ou(_,E,this,b)}:this.validator=()=>[],f?this.refiner=(b,E)=>{let _=f(b,E);return ou(_,E,this,b)}:this.refiner=()=>[]}assert(t,e){return su(t,this,e)}create(t,e){return oi(t,this,e)}is(t){return au(t,this)}mask(t,e){return J0(t,this,e)}validate(t,e={}){return Ai(t,this,e)}}});function Ii(){if(!qo&&(qo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!qo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qo(Q0)}var vy,qo,Q0,ia=le(()=>{vy=H(V()),Q0=new Uint8Array(16)});var Sy,cu,hu=le(()=>{Sy=H(V()),cu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function tl(r){return typeof r=="string"&&cu.test(r)}var Ey,bn,Mi=le(()=>{Ey=H(V());hu();bn=tl});function el(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(tr[r[t+0]]+tr[r[t+1]]+tr[r[t+2]]+tr[r[t+3]]+"-"+tr[r[t+4]]+tr[r[t+5]]+"-"+tr[r[t+6]]+tr[r[t+7]]+"-"+tr[r[t+8]]+tr[r[t+9]]+"-"+tr[r[t+10]]+tr[r[t+11]]+tr[r[t+12]]+tr[r[t+13]]+tr[r[t+14]]+tr[r[t+15]]).toLowerCase();if(!bn(e))throw TypeError("Stringified UUID is invalid");return e}var My,tr,Fo,xn,Li=le(()=>{My=H(V());Mi();tr=[];for(Fo=0;Fo<256;++Fo)tr.push((Fo+256).toString(16).substr(1));xn=el});function rl(r,t,e){var n=t&&e||0,o=t||new Array(16);r=r||{};var f=r.node||lu,h=r.clockseq!==void 0?r.clockseq:oa;if(f==null||h==null){var x=r.random||(r.rng||Ii)();f==null&&(f=lu=[x[0]|1,x[1],x[2],x[3],x[4],x[5]]),h==null&&(h=oa=(x[6]<<8|x[7])&16383)}var b=r.msecs!==void 0?r.msecs:Date.now(),E=r.nsecs!==void 0?r.nsecs:aa+1,_=b-sa+(E-aa)/1e4;if(_<0&&r.clockseq===void 0&&(h=h+1&16383),(_<0||b>sa)&&r.nsecs===void 0&&(E=0),E>=1e4)throw new Error("uuid.v1(): Can\'t create more than 10M uuids/sec");sa=b,aa=E,oa=h,b+=122192928e5;var I=((b&268435455)*1e4+E)%4294967296;o[n++]=I>>>24&255,o[n++]=I>>>16&255,o[n++]=I>>>8&255,o[n++]=I&255;var C=b/4294967296*1e4&268435455;o[n++]=C>>>8&255,o[n++]=C&255,o[n++]=C>>>24&15|16,o[n++]=C>>>16&255,o[n++]=h>>>8|128,o[n++]=h&255;for(var N=0;N<6;++N)o[n+N]=f[N];return t||xn(o)}var Py,lu,oa,sa,aa,du,pu=le(()=>{Py=H(V());ia();Li();sa=0,aa=0;du=rl});function nl(r){if(!bn(r))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(r.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(r.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(r.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(r.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}var Oy,Ko,fa=le(()=>{Oy=H(V());Mi();Ko=nl});function il(r){r=unescape(encodeURIComponent(r));for(var t=[],e=0;e{Fy=H(V());Li();fa();ol="6ba7b810-9dad-11d1-80b4-00c04fd430c8",sl="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function al(r){if(typeof r=="string"){var t=unescape(encodeURIComponent(r));r=new Uint8Array(t.length);for(var e=0;e>5]>>>o%32&255,h=parseInt(n.charAt(f>>>4&15)+n.charAt(f&15),16);t.push(h)}return t}function yu(r){return(r+64>>>9<<4)+14+1}function ul(r,t){r[t>>5]|=128<>5]|=(r[n/8]&255)<>16)+(t>>16)+(e>>16);return n<<16|e&65535}function hl(r,t){return r<>>32-t}function Wo(r,t,e,n,o,f){return vn(hl(vn(vn(t,r),vn(n,f)),o),e)}function sr(r,t,e,n,o,f,h){return Wo(t&e|~t&n,r,t,o,f,h)}function ar(r,t,e,n,o,f,h){return Wo(t&n|e&~n,r,t,o,f,h)}function fr(r,t,e,n,o,f,h){return Wo(t^e^n,r,t,o,f,h)}function ur(r,t,e,n,o,f,h){return Wo(e^(t|~n),r,t,o,f,h)}var Dy,gu,mu=le(()=>{Dy=H(V());gu=al});var Vy,ll,wu,bu=le(()=>{Vy=H(V());ua();mu();ll=Do("v3",48,gu),wu=ll});function dl(r,t,e){r=r||{};var n=r.random||(r.rng||Ii)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){e=e||0;for(var o=0;o<16;++o)t[e+o]=n[o];return t}return xn(n)}var Zy,xu,vu=le(()=>{Zy=H(V());ia();Li();xu=dl});function pl(r,t,e,n){switch(r){case 0:return t&e^~t&n;case 1:return t^e^n;case 2:return t&e^t&n^e&n;case 3:return t^e^n}}function ca(r,t){return r<>>32-t}function yl(r){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var o=0;o>>0;G=it,it=J,J=ca(P,30)>>>0,P=D,D=ot}e[0]=e[0]+D>>>0,e[1]=e[1]+P>>>0,e[2]=e[2]+J>>>0,e[3]=e[3]+it>>>0,e[4]=e[4]+G>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var Xy,ku,Su=le(()=>{Xy=H(V());ku=yl});var r1,gl,Bu,_u=le(()=>{r1=H(V());ua();Su();gl=Do("v5",80,ku),Bu=gl});var i1,Eu,Au=le(()=>{i1=H(V()),Eu="00000000-0000-0000-0000-000000000000"});function ml(r){if(!bn(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)}var a1,Iu,Mu=le(()=>{a1=H(V());Mi();Iu=ml});var ha={};qa(ha,{NIL:()=>Eu,parse:()=>Ko,stringify:()=>xn,v1:()=>du,v3:()=>wu,v4:()=>xu,v5:()=>Bu,validate:()=>bn,version:()=>Iu});var f1,la=le(()=>{f1=H(V());pu();bu();vu();_u();Au();Mu();Mi();Li();fa()});var Ru=$e((w1,Lu)=>{"use strict";var b1=H(V()),wl=(la(),Ka(ha)).v4,bl=function(r,t,e,n){if(typeof r!="string")throw new TypeError(r+" must be a string");n=n||{};let o=typeof n.version=="number"?n.version:2;if(o!==1&&o!==2)throw new TypeError(o+" must be 1 or 2");let f={method:r};if(o===2&&(f.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");f.params=t}if(typeof e>"u"){let h=typeof n.generator=="function"?n.generator:function(){return wl()};f.id=h(f,n)}else o===2&&e===null?n.notificationIdNull&&(f.id=null):f.id=e;return f};Lu.exports=bl});var Pu=$e((x1,Tu)=>{"use strict";var v1=H(V()),xl=(la(),Ka(ha)).v4,vl=Ru(),Ri=function(r,t){if(!(this instanceof Ri))return new Ri(r,t);t||(t={}),this.options={reviver:typeof t.reviver<"u"?t.reviver:null,replacer:typeof t.replacer<"u"?t.replacer:null,generator:typeof t.generator<"u"?t.generator:function(){return xl()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=r};Tu.exports=Ri;Ri.prototype.request=function(r,t,e,n){let o=this,f=null,h=Array.isArray(r)&&typeof t=="function";if(this.options.version===1&&h)throw new TypeError("JSON-RPC 1.0 does not support batching");if(h||!h&&r&&typeof r=="object"&&typeof t=="function")n=t,f=r;else{typeof e=="function"&&(n=e,e=void 0);let E=typeof n=="function";try{f=vl(r,t,e,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(_){if(E)return n(_);throw _}if(!E)return f}let b;try{b=JSON.stringify(f,this.options.replacer)}catch(E){return n(E)}return this.callServer(b,function(E,_){o._parseResponse(E,_,n)}),f};Ri.prototype._parseResponse=function(r,t,e){if(r){e(r);return}if(!t)return e();let n;try{n=JSON.parse(t,this.options.reviver)}catch(o){return e(o)}if(e.length===3)if(Array.isArray(n)){let o=function(h){return typeof h.error<"u"},f=function(h){return!o(h)};return e(null,n.filter(o),n.filter(f))}else return e(null,n.error,n.result);e(null,n)}});var Uu=$e((k1,da)=>{"use strict";var S1=H(V()),kl=Object.prototype.hasOwnProperty,dr="~";function Ti(){}Object.create&&(Ti.prototype=Object.create(null),new Ti().__proto__||(dr=!1));function Sl(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function Cu(r,t,e,n,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var f=new Sl(e,n||r,o),h=dr?dr+t:t;return r._events[h]?r._events[h].fn?r._events[h]=[r._events[h],f]:r._events[h].push(f):(r._events[h]=f,r._eventsCount++),r}function Ho(r,t){--r._eventsCount===0?r._events=new Ti:delete r._events[t]}function cr(){this._events=new Ti,this._eventsCount=0}cr.prototype.eventNames=function(){var t=[],e,n;if(this._eventsCount===0)return t;for(n in e=this._events)kl.call(e,n)&&t.push(dr?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};cr.prototype.listeners=function(t){var e=dr?dr+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,f=n.length,h=new Array(f);o{_1=H(V(),1),Ou=H(Uu(),1)});var I1,Bl,zu=le(()=>{I1=H(V(),1),Bl=H(An(),1);Nu()});function Tl(r,t=24){let e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let h=0;h<10;h++)e[h]=r[h]^r[h+10]^r[h+20]^r[h+30]^r[h+40];for(let h=0;h<10;h+=2){let x=(h+8)%10,b=(h+2)%10,E=e[b],_=e[b+1],I=qu(E,_,1)^e[x],C=Fu(E,_,1)^e[x+1];for(let N=0;N<50;N+=10)r[h+N]^=I,r[h+N+1]^=C}let o=r[2],f=r[3];for(let h=0;h<24;h++){let x=Du[h],b=qu(o,f,x),E=Fu(o,f,x),_=Ku[h];o=r[_],f=r[_+1],r[_]=b,r[_+1]=E}for(let h=0;h<50;h+=10){for(let x=0;x<10;x++)e[x]=r[h+x];for(let x=0;x<10;x++)r[h+x]^=~e[(x+2)%10]&e[(x+4)%10]}r[0]^=Ll[n],r[1]^=Rl[n]}e.fill(0)}var D1,Ku,Du,Wu,_l,Pi,El,Al,Il,Ml,Ll,Rl,qu,Fu,ai,kn,T1,P1,C1,U1,O1,pa,N1,z1,Hu,q1,F1,$u=le(()=>{D1=H(V(),1);gi();Ss();fn();Ku=[],Du=[],Wu=[],_l=BigInt(0),Pi=BigInt(1),El=BigInt(2),Al=BigInt(7),Il=BigInt(256),Ml=BigInt(113);for(let r=0,t=Pi,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],Ku.push(2*(5*n+e)),Du.push((r+1)*(r+2)/2%64);let o=_l;for(let f=0;f<7;f++)t=(t<>Al)*Ml)%Il,t&El&&(o^=Pi<<(Pi<e>32?vs(r,t,e):bs(r,t,e),Fu=(r,t,e)=>e>32?ks(r,t,e):xs(r,t,e);ai=class extends sn{constructor(t,e,n,o=!1,f=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=o,this.rounds=f,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,yi(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=bf(this.state)}keccak(){ds||ps(this.state32),Tl(this.state32,this.rounds),ds||ps(this.state32),this.posOut=0,this.pos=0}update(t){$r(this);let{blockLen:e,state:n}=this;t=an(t);let o=t.length;for(let f=0;f=n&&this.keccak();let h=Math.min(n-this.posOut,f-o);t.set(e.subarray(this.posOut,this.posOut+h),o),this.posOut+=h,o+=h}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return yi(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ji(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:n,outputLen:o,rounds:f,enableXOF:h}=this;return t||(t=new ai(e,n,o,h,f)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=f,t.suffix=n,t.outputLen=o,t.enableXOF=h,t.destroyed=this.destroyed,t}},kn=(r,t,e)=>Zn(()=>new ai(t,r,e)),T1=kn(6,144,224/8),P1=kn(6,136,256/8),C1=kn(6,104,384/8),U1=kn(6,72,512/8),O1=kn(1,144,224/8),pa=kn(1,136,256/8),N1=kn(1,104,384/8),z1=kn(1,72,512/8),Hu=(r,t,e)=>vf((n={})=>new ai(t,r,n.dkLen===void 0?e:n.dkLen,!0)),q1=Hu(31,168,128/8),F1=Hu(31,136,256/8)});var V1,$o,ya,Vu=le(()=>{V1=H(V(),1);gi();fn();$o=class extends sn{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,mf(t);let n=an(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,f=new Uint8Array(o);f.set(n.length>o?t.create().update(n).digest():n);for(let h=0;hnew $o(r,t).update(e).digest();ya.create=(r,t)=>new $o(r,t)});function ju(r){r.lowS!==void 0&&Rr("lowS",r.lowS),r.prehash!==void 0&&Rr("prehash",r.prehash)}function Pl(r){let t=bi(r);qr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}function Ol(r){let t=Pl(r),{Fp:e}=t,n=pn(t.n,t.nBitLength),o=t.toBytes||((D,P,J)=>{let it=P.toAffine();return Yr(Uint8Array.from([4]),e.toBytes(it.x),e.toBytes(it.y))}),f=t.fromBytes||(D=>{let P=D.subarray(1),J=e.fromBytes(P.subarray(0,e.BYTES)),it=e.fromBytes(P.subarray(e.BYTES,2*e.BYTES));return{x:J,y:it}});function h(D){let{a:P,b:J}=t,it=e.sqr(D),G=e.mul(it,D);return e.add(e.add(G,e.mul(D,P)),J)}if(!e.eql(e.sqr(t.Gy),h(t.Gx)))throw new Error("bad generator point: equation left != right");function x(D){return mi(D,Ze,t.n)}function b(D){let{allowedPrivateKeyLengths:P,nByteLength:J,wrapPrivateKey:it,n:G}=t;if(P&&typeof D!="bigint"){if(hn(D)&&(D=jr(D)),typeof D!="string"||!P.includes(D.length))throw new Error("Invalid key");D=D.padStart(J*2,"0")}let rt;try{rt=typeof D=="bigint"?D:Gr(De("private key",D,J))}catch{throw new Error(`private key must be ${J} bytes, hex or bigint, not ${typeof D}`)}return it&&(rt=Re(rt,G)),yr("private key",rt,Ze,G),rt}function E(D){if(!(D instanceof C))throw new Error("ProjectivePoint expected")}let _=Tn((D,P)=>{let{px:J,py:it,pz:G}=D;if(e.eql(G,e.ONE))return{x:J,y:it};let rt=D.is0();P==null&&(P=rt?e.ONE:e.inv(G));let xt=e.mul(J,P),ot=e.mul(it,P),pt=e.mul(G,P);if(rt)return{x:e.ZERO,y:e.ZERO};if(!e.eql(pt,e.ONE))throw new Error("invZ was invalid");return{x:xt,y:ot}}),I=Tn(D=>{if(D.is0()){if(t.allowInfinityPoint&&!e.is0(D.py))return;throw new Error("bad point: ZERO")}let{x:P,y:J}=D.toAffine();if(!e.isValid(P)||!e.isValid(J))throw new Error("bad point: x or y not FE");let it=e.sqr(J),G=h(P);if(!e.eql(it,G))throw new Error("bad point: equation left != right");if(!D.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class C{constructor(P,J,it){if(this.px=P,this.py=J,this.pz=it,P==null||!e.isValid(P))throw new Error("x required");if(J==null||!e.isValid(J))throw new Error("y required");if(it==null||!e.isValid(it))throw new Error("z required");Object.freeze(this)}static fromAffine(P){let{x:J,y:it}=P||{};if(!P||!e.isValid(J)||!e.isValid(it))throw new Error("invalid affine point");if(P instanceof C)throw new Error("projective point not allowed");let G=rt=>e.eql(rt,e.ZERO);return G(J)&&G(it)?C.ZERO:new C(J,it,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(P){let J=e.invertBatch(P.map(it=>it.pz));return P.map((it,G)=>it.toAffine(J[G])).map(C.fromAffine)}static fromHex(P){let J=C.fromAffine(f(De("pointHex",P)));return J.assertValidity(),J}static fromPrivateKey(P){return C.BASE.multiply(b(P))}static msm(P,J){return oo(C,n,P,J)}_setWindowSize(P){ft.setWindowSize(this,P)}assertValidity(){I(this)}hasEvenY(){let{y:P}=this.toAffine();if(e.isOdd)return!e.isOdd(P);throw new Error("Field doesn\'t support isOdd")}equals(P){E(P);let{px:J,py:it,pz:G}=this,{px:rt,py:xt,pz:ot}=P,pt=e.eql(e.mul(J,ot),e.mul(rt,G)),St=e.eql(e.mul(it,ot),e.mul(xt,G));return pt&&St}negate(){return new C(this.px,e.neg(this.py),this.pz)}double(){let{a:P,b:J}=t,it=e.mul(J,Gu),{px:G,py:rt,pz:xt}=this,ot=e.ZERO,pt=e.ZERO,St=e.ZERO,At=e.mul(G,G),Ee=e.mul(rt,rt),ct=e.mul(xt,xt),Lt=e.mul(G,rt);return Lt=e.add(Lt,Lt),St=e.mul(G,xt),St=e.add(St,St),ot=e.mul(P,St),pt=e.mul(it,ct),pt=e.add(ot,pt),ot=e.sub(Ee,pt),pt=e.add(Ee,pt),pt=e.mul(ot,pt),ot=e.mul(Lt,ot),St=e.mul(it,St),ct=e.mul(P,ct),Lt=e.sub(At,ct),Lt=e.mul(P,Lt),Lt=e.add(Lt,St),St=e.add(At,At),At=e.add(St,At),At=e.add(At,ct),At=e.mul(At,Lt),pt=e.add(pt,At),ct=e.mul(rt,xt),ct=e.add(ct,ct),At=e.mul(ct,Lt),ot=e.sub(ot,At),St=e.mul(ct,Ee),St=e.add(St,St),St=e.add(St,St),new C(ot,pt,St)}add(P){E(P);let{px:J,py:it,pz:G}=this,{px:rt,py:xt,pz:ot}=P,pt=e.ZERO,St=e.ZERO,At=e.ZERO,Ee=t.a,ct=e.mul(t.b,Gu),Lt=e.mul(J,rt),g=e.mul(it,xt),i=e.mul(G,ot),a=e.add(J,it),u=e.add(rt,xt);a=e.mul(a,u),u=e.add(Lt,g),a=e.sub(a,u),u=e.add(J,G);let c=e.add(rt,ot);return u=e.mul(u,c),c=e.add(Lt,i),u=e.sub(u,c),c=e.add(it,G),pt=e.add(xt,ot),c=e.mul(c,pt),pt=e.add(g,i),c=e.sub(c,pt),At=e.mul(Ee,u),pt=e.mul(ct,i),At=e.add(pt,At),pt=e.sub(g,At),At=e.add(g,At),St=e.mul(pt,At),g=e.add(Lt,Lt),g=e.add(g,Lt),i=e.mul(Ee,i),u=e.mul(ct,u),g=e.add(g,i),i=e.sub(Lt,i),i=e.mul(Ee,i),u=e.add(u,i),Lt=e.mul(g,u),St=e.add(St,Lt),Lt=e.mul(c,u),pt=e.mul(a,pt),pt=e.sub(pt,Lt),Lt=e.mul(a,g),At=e.mul(c,At),At=e.add(At,Lt),new C(pt,St,At)}subtract(P){return this.add(P.negate())}is0(){return this.equals(C.ZERO)}wNAF(P){return ft.wNAFCached(this,P,C.normalizeZ)}multiplyUnsafe(P){yr("scalar",P,Qr,t.n);let J=C.ZERO;if(P===Qr)return J;if(P===Ze)return this;let{endo:it}=t;if(!it)return ft.unsafeLadder(this,P);let{k1neg:G,k1:rt,k2neg:xt,k2:ot}=it.splitScalar(P),pt=J,St=J,At=this;for(;rt>Qr||ot>Qr;)rt&Ze&&(pt=pt.add(At)),ot&Ze&&(St=St.add(At)),At=At.double(),rt>>=Ze,ot>>=Ze;return G&&(pt=pt.negate()),xt&&(St=St.negate()),St=new C(e.mul(St.px,it.beta),St.py,St.pz),pt.add(St)}multiply(P){let{endo:J,n:it}=t;yr("scalar",P,Ze,it);let G,rt;if(J){let{k1neg:xt,k1:ot,k2neg:pt,k2:St}=J.splitScalar(P),{p:At,f:Ee}=this.wNAF(ot),{p:ct,f:Lt}=this.wNAF(St);At=ft.constTimeNegate(xt,At),ct=ft.constTimeNegate(pt,ct),ct=new C(e.mul(ct.px,J.beta),ct.py,ct.pz),G=At.add(ct),rt=Ee.add(Lt)}else{let{p:xt,f:ot}=this.wNAF(P);G=xt,rt=ot}return C.normalizeZ([G,rt])[0]}multiplyAndAddUnsafe(P,J,it){let G=C.BASE,rt=(ot,pt)=>pt===Qr||pt===Ze||!ot.equals(G)?ot.multiplyUnsafe(pt):ot.multiply(pt),xt=rt(this,J).add(rt(P,it));return xt.is0()?void 0:xt}toAffine(P){return _(this,P)}isTorsionFree(){let{h:P,isTorsionFree:J}=t;if(P===Ze)return!0;if(J)return J(C,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:P,clearCofactor:J}=t;return P===Ze?this:J?J(C,this):this.multiplyUnsafe(t.h)}toRawBytes(P=!0){return Rr("isCompressed",P),this.assertValidity(),o(C,this,P)}toHex(P=!0){return Rr("isCompressed",P),jr(this.toRawBytes(P))}}C.BASE=new C(t.Gx,t.Gy,e.ONE),C.ZERO=new C(e.ZERO,e.ONE,e.ZERO);let N=t.nBitLength,ft=io(C,t.endo?Math.ceil(N/2):N);return{CURVE:t,ProjectivePoint:C,normPrivateKeyToScalar:b,weierstrassEquation:h,isWithinCurveOrder:x}}function Nl(r){let t=bi(r);return qr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Yu(r){let t=Nl(r),{Fp:e,n}=t,o=e.BYTES+1,f=2*e.BYTES+1;function h(i){return Re(i,n)}function x(i){return no(i,n)}let{ProjectivePoint:b,normPrivateKeyToScalar:E,weierstrassEquation:_,isWithinCurveOrder:I}=Ol({...t,toBytes(i,a,u){let c=a.toAffine(),d=e.toBytes(c.x),w=Yr;return Rr("isCompressed",u),u?w(Uint8Array.from([a.hasEvenY()?2:3]),d):w(Uint8Array.from([4]),d,e.toBytes(c.y))},fromBytes(i){let a=i.length,u=i[0],c=i.subarray(1);if(a===o&&(u===2||u===3)){let d=Gr(c);if(!mi(d,Ze,e.ORDER))throw new Error("Point is not on curve");let w=_(d),v;try{v=e.sqrt(w)}catch(y){let R=y instanceof Error?": "+y.message:"";throw new Error("Point is not on curve"+R)}let p=(v&Ze)===Ze;return(u&1)===1!==p&&(v=e.neg(v)),{x:d,y:v}}else if(a===f&&u===4){let d=e.fromBytes(c.subarray(0,e.BYTES)),w=e.fromBytes(c.subarray(e.BYTES,2*e.BYTES));return{x:d,y:w}}else throw new Error(`Point of length ${a} was invalid. Expected ${o} compressed bytes or ${f} uncompressed bytes`)}}),C=i=>jr(dn(i,t.nByteLength));function N(i){let a=n>>Ze;return i>a}function ft(i){return N(i)?h(-i):i}let D=(i,a,u)=>Gr(i.slice(a,u));class P{constructor(a,u,c){this.r=a,this.s=u,this.recovery=c,this.assertValidity()}static fromCompact(a){let u=t.nByteLength;return a=De("compactSignature",a,u*2),new P(D(a,0,u),D(a,u,2*u))}static fromDER(a){let{r:u,s:c}=Xr.toSig(De("DER",a));return new P(u,c)}assertValidity(){yr("r",this.r,Ze,n),yr("s",this.s,Ze,n)}addRecoveryBit(a){return new P(this.r,this.s,a)}recoverPublicKey(a){let{r:u,s:c,recovery:d}=this,w=ot(De("msgHash",a));if(d==null||![0,1,2,3].includes(d))throw new Error("recovery id invalid");let v=d===2||d===3?u+t.n:u;if(v>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let p=d&1?"03":"02",s=b.fromHex(p+C(v)),y=x(v),R=h(-w*y),U=h(c*y),W=b.BASE.multiplyAndAddUnsafe(s,R,U);if(!W)throw new Error("point at infinify");return W.assertValidity(),W}hasHighS(){return N(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,h(-this.s),this.recovery):this}toDERRawBytes(){return Ln(this.toDERHex())}toDERHex(){return Xr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ln(this.toCompactHex())}toCompactHex(){return C(this.r)+C(this.s)}}let J={isValidPrivateKey(i){try{return E(i),!0}catch{return!1}},normPrivateKeyToScalar:E,randomPrivateKey:()=>{let i=Cs(t.n);return Pf(t.randomBytes(i),t.n)},precompute(i=8,a=b.BASE){return a._setWindowSize(i),a.multiply(BigInt(3)),a}};function it(i,a=!0){return b.fromPrivateKey(i).toRawBytes(a)}function G(i){let a=hn(i),u=typeof i=="string",c=(a||u)&&i.length;return a?c===o||c===f:u?c===2*o||c===2*f:i instanceof b}function rt(i,a,u=!0){if(G(i))throw new Error("first arg must be private key");if(!G(a))throw new Error("second arg must be public key");return b.fromHex(a).multiply(E(i)).toRawBytes(u)}let xt=t.bits2int||function(i){let a=Gr(i),u=i.length*8-t.nBitLength;return u>0?a>>BigInt(u):a},ot=t.bits2int_modN||function(i){return h(xt(i))},pt=wi(t.nBitLength);function St(i){return yr(`num < 2^${t.nBitLength}`,i,Qr,pt),dn(i,t.nByteLength)}function At(i,a,u=Ee){if(["recovered","canonical"].some(st=>st in u))throw new Error("sign() legacy options not supported");let{hash:c,randomBytes:d}=t,{lowS:w,prehash:v,extraEntropy:p}=u;w==null&&(w=!0),i=De("msgHash",i),ju(u),v&&(i=De("prehashed msgHash",c(i)));let s=ot(i),y=E(a),R=[St(y),St(s)];if(p!=null&&p!==!1){let st=p===!0?d(e.BYTES):p;R.push(De("extraEntropy",st))}let U=Yr(...R),W=s;function tt(st){let dt=xt(st);if(!I(dt))return;let be=x(dt),ht=b.BASE.multiply(dt).toAffine(),Bt=h(ht.x);if(Bt===Qr)return;let Xe=h(be*h(W+Bt*y));if(Xe===Qr)return;let Ft=(ht.x===Bt?0:2)|Number(ht.y&Ze),Kt=Xe;return w&&N(Xe)&&(Kt=ft(Xe),Ft^=1),new P(Bt,Kt,Ft)}return{seed:U,k2sig:tt}}let Ee={lowS:t.lowS,prehash:!1},ct={lowS:t.lowS,prehash:!1};function Lt(i,a,u=Ee){let{seed:c,k2sig:d}=At(i,a,u),w=t;return Ls(w.hash.outputLen,w.nByteLength,w.hmac)(c,d)}b.BASE._setWindowSize(8);function g(i,a,u,c=ct){let d=i;if(a=De("msgHash",a),u=De("publicKey",u),"strict"in c)throw new Error("options.strict was renamed to lowS");ju(c);let{lowS:w,prehash:v}=c,p,s;try{if(typeof d=="string"||hn(d))try{p=P.fromDER(d)}catch(ht){if(!(ht instanceof Xr.Err))throw ht;p=P.fromCompact(d)}else if(typeof d=="object"&&typeof d.r=="bigint"&&typeof d.s=="bigint"){let{r:ht,s:Bt}=d;p=new P(ht,Bt)}else throw new Error("PARSE");s=b.fromHex(u)}catch(ht){if(ht.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(w&&p.hasHighS())return!1;v&&(a=t.hash(a));let{r:y,s:R}=p,U=ot(a),W=x(R),tt=h(U*W),st=h(y*W),dt=b.BASE.multiplyAndAddUnsafe(s,tt,st)?.toAffine();return dt?h(dt.x)===y:!1}return{CURVE:t,getPublicKey:it,getSharedSecret:rt,sign:Lt,verify:g,ProjectivePoint:b,Signature:P,utils:J}}var Q1,Cl,Ul,Xr,Qr,Ze,Z1,Gu,J1,Zu=le(()=>{Q1=H(V(),1);Ns();Qn();Pn();Pn();({bytesToNumberBE:Cl,hexToBytes:Ul}=ro),Xr={Err:class extends Error{constructor(t=""){super(t)}},_tlv:{encode:(r,t)=>{let{Err:e}=Xr;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");let n=t.length/2,o=Mn(n);if(o.length/2&128)throw new e("tlv.encode: long form length too big");let f=n>127?Mn(o.length/2|128):"";return`${Mn(r)}${f}${o}${t}`},decode(r,t){let{Err:e}=Xr,n=0;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[n++]!==r)throw new e("tlv.decode: wrong tlv");let o=t[n++],f=!!(o&128),h=0;if(!f)h=o;else{let b=o&127;if(!b)throw new e("tlv.decode(long): indefinite length not supported");if(b>4)throw new e("tlv.decode(long): byte length is too big");let E=t.subarray(n,n+b);if(E.length!==b)throw new e("tlv.decode: length bytes not complete");if(E[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(let _ of E)h=h<<8|_;if(n+=b,h<128)throw new e("tlv.decode(long): not minimal encoding")}let x=t.subarray(n,n+h);if(x.length!==h)throw new e("tlv.decode: wrong value length");return{v:x,l:t.subarray(n+h)}}},_int:{encode(r){let{Err:t}=Xr;if(rya(r,t,ys(...e)),randomBytes:Qi}}function Ju(r,t){let e=n=>Yu({...r,...zl(n)});return Object.freeze({...e(t),create:e})}var ig,Xu=le(()=>{ig=H(V(),1);Vu();fn();Zu();});function Fl(r){let t=ec,e=BigInt(3),n=BigInt(6),o=BigInt(11),f=BigInt(22),h=BigInt(23),x=BigInt(44),b=BigInt(88),E=r*r*r%t,_=E*E*r%t,I=Ne(_,e,t)*_%t,C=Ne(I,e,t)*_%t,N=Ne(C,ga,t)*E%t,ft=Ne(N,o,t)*N%t,D=Ne(ft,f,t)*ft%t,P=Ne(D,x,t)*D%t,J=Ne(P,b,t)*P%t,it=Ne(J,x,t)*D%t,G=Ne(it,e,t)*_%t,rt=Ne(G,h,t)*ft%t,xt=Ne(rt,n,t)*E%t,ot=Ne(xt,ga,t);if(!ma.eql(ma.sqr(ot),r))throw new Error("Cannot find square root");return ot}var hg,ec,Qu,ql,ga,tc,ma,Ci,fg,ug,rc=le(()=>{hg=H(V(),1);Hs();Xu();Qn();ec=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Qu=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ql=BigInt(1),ga=BigInt(2),tc=(r,t)=>(r+t/ga)/t;ma=pn(ec,void 0,void 0,{sqrt:Fl}),Ci=Ju({a:BigInt(0),b:BigInt(7),Fp:ma,n:Qu,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=Qu,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-ql*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),f=e,h=BigInt("0x100000000000000000000000000000000"),x=tc(f*r,t),b=tc(-n*r,t),E=Re(r-x*e-b*o,t),_=Re(-x*n-b*f,t),I=E>h,C=_>h;if(I&&(E=t-E),C&&(_=t-_),E>h||_>h)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:I,k1:E,k2neg:C,k2:_}}}},xi),fg=BigInt(0),ug=Ci.ProjectivePoint});function ic(r){try{return Un.ExtendedPoint.fromHex(r),!0}catch{return!1}}function Hl(r){return r._bn!==void 0}function bc(r,t){let e=o=>{if(o.span>=0)return o.span;if(typeof o.alloc=="function")return o.alloc(t[o.property]);if("count"in o&&"elementLayout"in o){let f=t[o.property];if(Array.isArray(f))return f.length*e(o.elementLayout)}else if("fields"in o)return bc({layout:o},t[o.property]);return 0},n=0;return r.layout.fields.forEach(o=>{n+=e(o)}),n}function Ni(r){let t=0,e=0;for(;;){let n=r.shift();if(t|=(n&127)<>=7,e==0){r.push(n);break}else n|=128,r.push(n)}}function Ge(r,t){if(!r)throw new Error(t||"Assertion failed")}function Vo(r){if(r.length===0)throw new Error(xc);return r.shift()}function qi(r,...t){let[e]=t;if(t.length===2?e+(t[1]??0)>r.length:e>=r.length)throw new Error(xc);return r.splice(...t)}async function sc(r,t,e,n){let o=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},f=await r.sendTransaction(t,e,o),h;if(t.recentBlockhash!=null&&t.lastValidBlockHeight!=null)h=(await r.confirmTransaction({abortSignal:n?.abortSignal,signature:f,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},n&&n.commitment)).value;else if(t.minNonceContextSlot!=null&&t.nonceInfo!=null){let{nonceInstruction:x}=t.nonceInfo,b=x.keys[0].pubkey;h=(await r.confirmTransaction({abortSignal:n?.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:b,nonceValue:t.nonceInfo.nonce,signature:f},n&&n.commitment)).value}else n?.abortSignal!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),h=(await r.confirmTransaction(f,n&&n.commitment)).value;if(h.err)throw f!=null?new Ia({action:"send",signature:f,transactionMessage:`Status: (${JSON.stringify(h)})`}):new Error(`Transaction ${f} failed (${JSON.stringify(h)})`);return f}function ed(r){return new Promise(t=>setTimeout(t,r))}function ke(r,t){let e=r.layout.span>=0?r.layout.span:bc(r,t),n=Yt.Buffer.alloc(e),o=Object.assign({instruction:r.index},t);return r.layout.encode(o,n),n}function kc(r){return or([et({jsonrpc:ze("2.0"),id:at(),result:r}),et({jsonrpc:ze("2.0"),id:at(),error:et({code:Fn(),message:at(),data:Ot(fu())})})])}function Ue(r){return si(kc(r),ad,t=>"error"in t?t:{...t,result:oi(t.result,r)})}function Ar(r){return Ue(et({context:et({slot:z()}),value:r}))}function Qo(r){return et({context:et({slot:z()}),value:r})}var Pm,Yt,ka,wr,li,L,yc,$i,Kl,xg,nc,Sa,gc,Dl,Ie,Ba,Go,mc,Wl,Fi,oc,ae,vg,Yo,$l,wc,_a,Ea,Aa,Zo,_e,fi,Vl,jl,Gl,Yl,Ki,xc,Dn,Zl,Ce,Pe,Jl,Xl,Ql,td,tn,kg,Sg,wa,Di,Bg,_g,Eg,ba,Ia,rd,nd,ac,id,od,ui,Er,Je,sd,ci,Ag,Ig,Mg,We,vc,Ta,Lg,ad,fd,Rg,ud,cd,hd,ld,dd,Wn,pd,yd,Tg,gd,md,Pg,Cg,Ug,Og,Ng,zg,qg,Fg,Kg,Dg,wd,Wg,Hg,Ma,$g,Vg,Pa,jg,bd,xd,Gg,Yg,Zg,Jg,Xg,vd,Qg,kd,tm,Sd,em,rm,nm,im,fc,om,Bd,_d,sm,am,Sc,Ca,Bc,_c,Ec,Ac,Ed,Ad,Ic,Mc,Jo,Lc,ts,Ua,di,Hn,fm,um,cm,hm,lm,dm,pm,ym,gm,mm,wm,bm,xm,Id,vm,km,Sm,Bm,Md,_m,en,Ui,La,jo,Ra,uc,cc,hc,lc,Wi,Ld,Rd,dc,xa,pc,Td,va,Kn,Rc,Pd,Hi,Sn,Em,Xo,Oi,Am,hi,Im,Mm,Lm,Rm,Tc=le(()=>{Pm=H(V()),Yt=H(An());qf();ka=H(Kf()),wr=H(jf());Hs();li=H(nu()),L=H(ta()),yc=H(ta()),$i=H(iu());uu();Kl=H(Pu());zu();$u();rc();xg=Un.utils.randomPrivateKey,nc=()=>{let r=Un.utils.randomPrivateKey(),t=Sa(r),e=new Uint8Array(64);return e.set(r),e.set(t,32),{publicKey:t,secretKey:e}},Sa=Un.getPublicKey;gc=(r,t)=>Un.sign(r,t.slice(0,32)),Dl=Un.verify,Ie=r=>Yt.Buffer.isBuffer(r)?r:r instanceof Uint8Array?Yt.Buffer.from(r.buffer,r.byteOffset,r.byteLength):Yt.Buffer.from(r),Ba=class{constructor(t){Object.assign(this,t)}encode(){return Yt.Buffer.from((0,li.serialize)(Go,this))}static decode(t){return(0,li.deserialize)(Go,this,t)}static decodeUnchecked(t){return(0,li.deserializeUnchecked)(Go,this,t)}},Go=new Map,Wl=32,Fi=32;oc=1,ae=class extends Ba{constructor(t){if(super({}),this._bn=void 0,Hl(t))this._bn=t._bn;else{if(typeof t=="string"){let e=wr.default.decode(t);if(e.length!=Fi)throw new Error("Invalid public key input");this._bn=new ka.default(e)}else this._bn=new ka.default(t);if(this._bn.byteLength()>Fi)throw new Error("Invalid public key input")}}static unique(){let t=new ae(oc);return oc+=1,new ae(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return wr.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){let t=this._bn.toArrayLike(Yt.Buffer);if(t.length===Fi)return t;let e=Yt.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){let o=Yt.Buffer.concat([t.toBuffer(),Yt.Buffer.from(e),n.toBuffer()]),f=xi(o);return new ae(f)}static createProgramAddressSync(t,e){let n=Yt.Buffer.alloc(0);t.forEach(function(f){if(f.length>Wl)throw new TypeError("Max seed length exceeded");n=Yt.Buffer.concat([n,Ie(f)])}),n=Yt.Buffer.concat([n,e.toBuffer(),Yt.Buffer.from("ProgramDerivedAddress")]);let o=xi(n);if(ic(o))throw new Error("Invalid seeds, address must fall off the curve");return new ae(o)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n=255,o;for(;n!=0;){try{let f=t.concat(Yt.Buffer.from([n]));o=this.createProgramAddressSync(f,e)}catch(f){if(f instanceof TypeError)throw f;n--;continue}return[o,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){let e=new ae(t);return ic(e.toBytes())}};mc=ae;ae.default=new mc("11111111111111111111111111111111");Go.set(ae,{kind:"struct",fields:[["_bn","u256"]]});vg=new ae("BPFLoader1111111111111111111111111111111111"),Yo=1280-40-8,$l=127,wc=64,_a=class extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}};Object.defineProperty(_a.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});Ea=class extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}};Object.defineProperty(Ea.prototype,"name",{value:"TransactionExpiredTimeoutError"});Aa=class extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}};Object.defineProperty(Aa.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});Zo=class{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){let t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(let e of this.keySegments()){if(t255+1)throw new Error("Account index overflow encountered during compilation");let n=new Map;this.keySegments().flat().forEach((f,h)=>{n.set(f.toBase58(),h)});let o=f=>{let h=n.get(f.toBase58());if(h===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return h};return t.map(f=>({programIdIndex:o(f.programId),accountKeyIndexes:f.keys.map(h=>o(h.pubkey)),data:f.data}))}},_e=(r="publicKey")=>L.blob(32,r),fi=(r="string")=>{let t=L.struct([L.u32("length"),L.u32("lengthPadding"),L.blob(L.offset(L.u32(),-8),"chars")],r),e=t.decode.bind(t),n=t.encode.bind(t),o=t;return o.decode=(f,h)=>e(f,h).chars.toString(),o.encode=(f,h,x)=>{let b={chars:Yt.Buffer.from(f,"utf8")};return n(b,h,x)},o.alloc=f=>L.u32().span+L.u32().span+Yt.Buffer.from(f,"utf8").length,o},Vl=(r="authorized")=>L.struct([_e("staker"),_e("withdrawer")],r),jl=(r="lockup")=>L.struct([L.ns64("unixTimestamp"),L.ns64("epoch"),_e("custodian")],r),Gl=(r="voteInit")=>L.struct([_e("nodePubkey"),_e("authorizedVoter"),_e("authorizedWithdrawer"),L.u8("commission")],r),Yl=(r="voteAuthorizeWithSeedArgs")=>L.struct([L.u32("voteAuthorizationType"),_e("currentAuthorityDerivedKeyOwnerPubkey"),fi("currentAuthorityDerivedKeySeed"),_e("newAuthorized")],r);Ki=class{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){let n=new Map,o=h=>{let x=h.toBase58(),b=n.get(x);return b===void 0&&(b={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(x,b)),b},f=o(e);f.isSigner=!0,f.isWritable=!0;for(let h of t){o(h.programId).isInvoked=!0;for(let x of h.keys){let b=o(x.pubkey);b.isSigner||=x.isSigner,b.isWritable||=x.isWritable}}return new Ki(e,n)}getMessageComponents(){let t=[...this.keyMetaMap.entries()];Ge(t.length<=256,"Max static account keys length exceeded");let e=t.filter(([,b])=>b.isSigner&&b.isWritable),n=t.filter(([,b])=>b.isSigner&&!b.isWritable),o=t.filter(([,b])=>!b.isSigner&&b.isWritable),f=t.filter(([,b])=>!b.isSigner&&!b.isWritable),h={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:f.length};{Ge(e.length>0,"Expected at least one writable signer key");let[b]=e[0];Ge(b===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let x=[...e.map(([b])=>new ae(b)),...n.map(([b])=>new ae(b)),...o.map(([b])=>new ae(b)),...f.map(([b])=>new ae(b))];return[h,x]}extractTableLookup(t){let[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,h=>!h.isSigner&&!h.isInvoked&&h.isWritable),[o,f]=this.drainKeysFoundInLookupTable(t.state.addresses,h=>!h.isSigner&&!h.isInvoked&&!h.isWritable);if(!(e.length===0&&o.length===0))return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:o},{writable:n,readonly:f}]}drainKeysFoundInLookupTable(t,e){let n=new Array,o=new Array;for(let[f,h]of this.keyMetaMap.entries())if(e(h)){let x=new ae(f),b=t.findIndex(E=>E.equals(x));b>=0&&(Ge(b<256,"Max lookup table index exceeded"),n.push(b),o.push(x),this.keyMetaMap.delete(f))}return[n,o]}},xc="Reached end of buffer unexpectedly";Dn=class{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(e=>new ae(e)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:wr.default.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Zo(this.staticAccountKeys)}static compile(t){let e=Ki.compile(t.instructions,t.payerKey),[n,o]=e.getMessageComponents(),h=new Zo(o).compileInstructions(t.instructions).map(x=>({programIdIndex:x.programIdIndex,accounts:x.accountKeyIndexes,data:wr.default.encode(x.data)}));return new Dn({header:n,accountKeys:o,recentBlockhash:t.recentBlockhash,instructions:h})}isAccountSigner(t){return t=this.header.numRequiredSignatures){let n=t-e,f=this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts;return n!this.isProgramId(e))}serialize(){let t=this.accountKeys.length,e=[];zi(e,t);let n=this.instructions.map(I=>{let{accounts:C,programIdIndex:N}=I,ft=Array.from(wr.default.decode(I.data)),D=[];zi(D,C.length);let P=[];return zi(P,ft.length),{programIdIndex:N,keyIndicesCount:Yt.Buffer.from(D),keyIndices:C,dataLength:Yt.Buffer.from(P),data:ft}}),o=[];zi(o,n.length);let f=Yt.Buffer.alloc(Yo);Yt.Buffer.from(o).copy(f);let h=o.length;n.forEach(I=>{let N=L.struct([L.u8("programIdIndex"),L.blob(I.keyIndicesCount.length,"keyIndicesCount"),L.seq(L.u8("keyIndex"),I.keyIndices.length,"keyIndices"),L.blob(I.dataLength.length,"dataLength"),L.seq(L.u8("userdatum"),I.data.length,"data")]).encode(I,f,h);h+=N}),f=f.slice(0,h);let x=L.struct([L.blob(1,"numRequiredSignatures"),L.blob(1,"numReadonlySignedAccounts"),L.blob(1,"numReadonlyUnsignedAccounts"),L.blob(e.length,"keyCount"),L.seq(_e("key"),t,"keys"),_e("recentBlockhash")]),b={numRequiredSignatures:Yt.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Yt.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Yt.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Yt.Buffer.from(e),keys:this.accountKeys.map(I=>Ie(I.toBytes())),recentBlockhash:wr.default.decode(this.recentBlockhash)},E=Yt.Buffer.alloc(2048),_=x.encode(b,E);return f.copy(E,_),E.slice(0,_+f.length)}static from(t){let e=[...t],n=Vo(e);if(n!==(n&$l))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let o=Vo(e),f=Vo(e),h=Ni(e),x=[];for(let C=0;C({pubkey:t.toJSON(),isSigner:e,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}},Pe=class{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){let{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){let{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{let{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new Ce(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?e=[this.nonceInfo.nonceInstruction,...this.instructions]:e=this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");e.length<1&&console.warn("No instructions provided");let n;if(this.feePayer)n=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)n=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let D=0;D{D.keys.forEach(J=>{f.push({...J})});let P=D.programId.toString();o.includes(P)||o.push(P)}),o.forEach(D=>{f.push({pubkey:new ae(D),isSigner:!1,isWritable:!1})});let h=[];f.forEach(D=>{let P=D.pubkey.toString(),J=h.findIndex(it=>it.pubkey.toString()===P);J>-1?(h[J].isWritable=h[J].isWritable||D.isWritable,h[J].isSigner=h[J].isSigner||D.isSigner):h.push(D)}),h.sort(function(D,P){if(D.isSigner!==P.isSigner)return D.isSigner?-1:1;if(D.isWritable!==P.isWritable)return D.isWritable?-1:1;let J={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return D.pubkey.toBase58().localeCompare(P.pubkey.toBase58(),"en",J)});let x=h.findIndex(D=>D.pubkey.equals(n));if(x>-1){let[D]=h.splice(x,1);D.isSigner=!0,D.isWritable=!0,h.unshift(D)}else h.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(let D of this.signatures){let P=h.findIndex(J=>J.pubkey.equals(D.publicKey));if(P>-1)h[P].isSigner||(h[P].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${D.publicKey.toString()}`)}let b=0,E=0,_=0,I=[],C=[];h.forEach(({pubkey:D,isSigner:P,isWritable:J})=>{P?(I.push(D.toString()),b+=1,J||(E+=1)):(C.push(D.toString()),J||(_+=1))});let N=I.concat(C),ft=e.map(D=>{let{data:P,programId:J}=D;return{programIdIndex:N.indexOf(J.toString()),accounts:D.keys.map(it=>N.indexOf(it.pubkey.toString())),data:wr.default.encode(P)}});return ft.forEach(D=>{Ge(D.programIdIndex>=0),D.accounts.forEach(P=>Ge(P>=0))}),new Dn({header:{numRequiredSignatures:b,numReadonlySignedAccounts:E,numReadonlyUnsignedAccounts:_},accountKeys:N,recentBlockhash:t,instructions:ft})}_compile(){let t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((o,f)=>e[f].equals(o.publicKey))||(this.signatures=e.map(n=>({signature:null,publicKey:n}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");let e=new Set;this.signatures=t.filter(n=>{let o=n.toString();return e.has(o)?!1:(e.add(o),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...t){if(t.length===0)throw new Error("No signers");let e=new Set,n=[];for(let f of t){let h=f.publicKey.toString();e.has(h)||(e.add(h),n.push(f))}this.signatures=n.map(f=>({signature:null,publicKey:f.publicKey}));let o=this._compile();this._partialSign(o,...n)}partialSign(...t){if(t.length===0)throw new Error("No signers");let e=new Set,n=[];for(let f of t){let h=f.publicKey.toString();e.has(h)||(e.add(h),n.push(f))}let o=this._compile();this._partialSign(o,...n)}_partialSign(t,...e){let n=t.serialize();e.forEach(o=>{let f=gc(n,o.secretKey);this._addSignature(o.publicKey,Ie(f))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){Ge(e.length===64);let n=this.signatures.findIndex(o=>t.equals(o.publicKey));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=Yt.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){let n={};for(let{signature:o,publicKey:f}of this.signatures)o===null?e&&(n.missing||=[]).push(f):Dl(o,t,f.toBytes())||(n.invalid||=[]).push(f);return n.invalid||n.missing?n:void 0}serialize(t){let{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),o=this.serializeMessage();if(n){let f=this._getMessageSignednessErrors(o,e);if(f){let h="Signature verification failed.";throw f.invalid&&(h+=`\nInvalid signature for public key${f.invalid.length===1?"":"(s)"} [\\`${f.invalid.map(x=>x.toBase58()).join("`, `")}\\`].`),f.missing&&(h+=`\nMissing signature for public key${f.missing.length===1?"":"(s)"} [\\`${f.missing.map(x=>x.toBase58()).join("`, `")}\\`].`),new Error(h)}}return this._serialize(o)}_serialize(t){let{signatures:e}=this,n=[];zi(n,e.length);let o=n.length+e.length*64+t.length,f=Yt.Buffer.alloc(o);return Ge(e.length<256),Yt.Buffer.from(n).copy(f,0),e.forEach(({signature:h},x)=>{h!==null&&(Ge(h.length===64,"signature has invalid length"),Yt.Buffer.from(h).copy(f,n.length+x*64))}),t.copy(f,n.length+e.length*64),Ge(f.length<=Yo,`Transaction too large: ${f.length} > ${Yo}`),f}get keys(){return Ge(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return Ge(this.instructions.length===1),this.instructions[0].programId}get data(){return Ge(this.instructions.length===1),this.instructions[0].data}static from(t){let e=[...t],n=Ni(e),o=[];for(let f=0;f0&&(n.feePayer=t.accountKeys[0]),e.forEach((o,f)=>{let h={signature:o==wr.default.encode(Zl)?null:wr.default.decode(o),publicKey:t.accountKeys[f]};n.signatures.push(h)}),t.instructions.forEach(o=>{let f=o.accounts.map(h=>{let x=t.accountKeys[h];return{pubkey:x,isSigner:n.signatures.some(b=>b.publicKey.toString()===x.toString())||t.isAccountSigner(h),isWritable:t.isAccountWritable(h)}});n.instructions.push(new Ce({keys:f,programId:t.accountKeys[o.programIdIndex],data:wr.default.decode(o.data)}))}),n._message=t,n._json=n.toJSON(),n}},Jl=160,Xl=64,Ql=Jl/Xl,td=1e3/Ql,tn=new ae("SysvarC1ock11111111111111111111111111111111"),kg=new ae("SysvarEpochSchedu1e111111111111111111111111"),Sg=new ae("Sysvar1nstructions1111111111111111111111111"),wa=new ae("SysvarRecentB1ockHashes11111111111111111111"),Di=new ae("SysvarRent111111111111111111111111111111111"),Bg=new ae("SysvarRewards111111111111111111111111111111"),_g=new ae("SysvarS1otHashes111111111111111111111111111"),Eg=new ae("SysvarS1otHistory11111111111111111111111111"),ba=new ae("SysvarStakeHistory1111111111111111111111111"),Ia=class extends Error{constructor({action:t,signature:e,transactionMessage:n,logs:o}){let f=o?`Logs: \n${JSON.stringify(o.slice(-10),null,2)}. `:"",h="\\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.",x;switch(t){case"send":x=`Transaction ${e} resulted in an error. \n${n}. `+f+h;break;case"simulate":x=`Simulation failed. \nMessage: ${n}. \n`+f+h;break;default:x=`Unknown action \'${(b=>b)(t)}\'`}super(x),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=e,this.transactionMessage=n,this.transactionLogs=o||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let t=this.transactionLogs;if(!(t!=null&&typeof t=="object"&&"then"in t))return t}async getLogs(t){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((e,n)=>{t.getTransaction(this.signature).then(o=>{if(o&&o.meta&&o.meta.logMessages){let f=o.meta.logMessages;this.transactionLogs=f,e(f)}else n(new Error("Log messages not found"))}).catch(n)})),await this.transactionLogs}};rd=L.nu64("lamportsPerSignature"),nd=L.struct([L.u32("version"),L.u32("state"),_e("authorizedPubkey"),_e("nonce"),L.struct([rd],"feeCalculator")]),ac=nd.span,id=r=>{let t=r.decode.bind(r),e=r.encode.bind(r);return{decode:t,encode:e}},od=r=>t=>{let e=(0,yc.blob)(r,t),{encode:n,decode:o}=id(e),f=e;return f.decode=(h,x)=>{let b=o(h,x);return(0,$i.toBigIntLE)(Yt.Buffer.from(b))},f.encode=(h,x,b)=>{let E=(0,$i.toBufferLE)(h,r);return n(E,x,b)},f},ui=od(8),Er=Object.freeze({Create:{index:0,layout:L.struct([L.u32("instruction"),L.ns64("lamports"),L.ns64("space"),_e("programId")])},Assign:{index:1,layout:L.struct([L.u32("instruction"),_e("programId")])},Transfer:{index:2,layout:L.struct([L.u32("instruction"),ui("lamports")])},CreateWithSeed:{index:3,layout:L.struct([L.u32("instruction"),_e("base"),fi("seed"),L.ns64("lamports"),L.ns64("space"),_e("programId")])},AdvanceNonceAccount:{index:4,layout:L.struct([L.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:L.struct([L.u32("instruction"),L.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:L.struct([L.u32("instruction"),_e("authorized")])},AuthorizeNonceAccount:{index:7,layout:L.struct([L.u32("instruction"),_e("authorized")])},Allocate:{index:8,layout:L.struct([L.u32("instruction"),L.ns64("space")])},AllocateWithSeed:{index:9,layout:L.struct([L.u32("instruction"),_e("base"),fi("seed"),L.ns64("space"),_e("programId")])},AssignWithSeed:{index:10,layout:L.struct([L.u32("instruction"),_e("base"),fi("seed"),_e("programId")])},TransferWithSeed:{index:11,layout:L.struct([L.u32("instruction"),ui("lamports"),fi("seed"),_e("programId")])},UpgradeNonceAccount:{index:12,layout:L.struct([L.u32("instruction")])}}),Je=class{constructor(){}static createAccount(t){let e=Er.Create,n=ke(e,{lamports:t.lamports,space:t.space,programId:Ie(t.programId.toBuffer())});return new Ce({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:n})}static transfer(t){let e,n;if("basePubkey"in t){let o=Er.TransferWithSeed;e=ke(o,{lamports:BigInt(t.lamports),seed:t.seed,programId:Ie(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}else{let o=Er.Transfer;e=ke(o,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}return new Ce({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;if("basePubkey"in t){let o=Er.AssignWithSeed;e=ke(o,{base:Ie(t.basePubkey.toBuffer()),seed:t.seed,programId:Ie(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{let o=Er.Assign;e=ke(o,{programId:Ie(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new Ce({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){let e=Er.CreateWithSeed,n=ke(e,{base:Ie(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:Ie(t.programId.toBuffer())}),o=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey.equals(t.fromPubkey)||o.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new Ce({keys:o,programId:this.programId,data:n})}static createNonceAccount(t){let e=new Pe;"basePubkey"in t&&"seed"in t?e.add(Je.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:ac,programId:this.programId})):e.add(Je.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:ac,programId:this.programId}));let n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){let e=Er.InitializeNonceAccount,n=ke(e,{authorized:Ie(t.authorizedPubkey.toBuffer())}),o={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:wa,isSigner:!1,isWritable:!1},{pubkey:Di,isSigner:!1,isWritable:!1}],programId:this.programId,data:n};return new Ce(o)}static nonceAdvance(t){let e=Er.AdvanceNonceAccount,n=ke(e),o={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:wa,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n};return new Ce(o)}static nonceWithdraw(t){let e=Er.WithdrawNonceAccount,n=ke(e,{lamports:t.lamports});return new Ce({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:wa,isSigner:!1,isWritable:!1},{pubkey:Di,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static nonceAuthorize(t){let e=Er.AuthorizeNonceAccount,n=ke(e,{authorized:Ie(t.newAuthorizedPubkey.toBuffer())});return new Ce({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}static allocate(t){let e,n;if("basePubkey"in t){let o=Er.AllocateWithSeed;e=ke(o,{base:Ie(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:Ie(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{let o=Er.Allocate;e=ke(o,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new Ce({keys:n,programId:this.programId,data:e})}};Je.programId=new ae("11111111111111111111111111111111");sd=Yo-300,ci=class{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/ci.chunkSize)+1+1)}static async load(t,e,n,o,f){{let I=await t.getMinimumBalanceForRentExemption(f.length),C=await t.getAccountInfo(n.publicKey,"confirmed"),N=null;if(C!==null){if(C.executable)return console.error("Program load failed, account is already executable"),!1;C.data.length!==f.length&&(N=N||new Pe,N.add(Je.allocate({accountPubkey:n.publicKey,space:f.length}))),C.owner.equals(o)||(N=N||new Pe,N.add(Je.assign({accountPubkey:n.publicKey,programId:o}))),C.lamports0?I:1,space:f.length,programId:o}));N!==null&&await sc(t,N,[e,n],{commitment:"confirmed"})}let h=L.struct([L.u32("instruction"),L.u32("offset"),L.u32("bytesLength"),L.u32("bytesLengthPadding"),L.seq(L.u8("byte"),L.offset(L.u32(),-8),"bytes")]),x=ci.chunkSize,b=0,E=f,_=[];for(;E.length>0;){let I=E.slice(0,x),C=Yt.Buffer.alloc(x+16);h.encode({instruction:0,offset:b,bytes:I,bytesLength:0,bytesLengthPadding:0},C);let N=new Pe().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:C});_.push(sc(t,N,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await ed(1e3/4),b+=x,E=E.slice(x)}await Promise.all(_);{let I=L.struct([L.u32("instruction")]),C=Yt.Buffer.alloc(I.span);I.encode({instruction:1},C);let N=new Pe().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Di,isSigner:!1,isWritable:!1}],programId:o,data:C}),ft="processed",D=await t.sendTransaction(N,[e,n],{preflightCommitment:ft}),{context:P,value:J}=await t.confirmTransaction({signature:D,lastValidBlockHeight:N.lastValidBlockHeight,blockhash:N.recentBlockhash},ft);if(J.err)throw new Error(`Transaction ${D} failed (${JSON.stringify(J)})`);for(;;){try{if(await t.getSlot({commitment:ft})>P.slot)break}catch{}await new Promise(it=>setTimeout(it,Math.round(td/2)))}}return!0}};ci.chunkSize=sd;Ag=new ae("BPFLoader2111111111111111111111111111111111"),Ig=globalThis.fetch,Mg={index:1,layout:L.struct([L.u32("typeIndex"),ui("deactivationSlot"),L.nu64("lastExtendedSlot"),L.u8("lastExtendedStartIndex"),L.u8(),L.seq(_e(),L.offset(L.u8(),-1),"authority")])},We=si(No(ae),at(),r=>new ae(r)),vc=zo([at(),ze("base64")]),Ta=si(No(Yt.Buffer),vc,r=>Yt.Buffer.from(r[0],"base64")),Lg=30*1e3;ad=kc(Fn());fd=et({foundation:z(),foundationTerm:z(),initial:z(),taper:z(),terminal:z()}),Rg=Ue(vt(kt(et({epoch:z(),effectiveSlot:z(),amount:z(),postBalance:z(),commission:Ot(kt(z()))})))),ud=vt(et({slot:z(),prioritizationFee:z()})),cd=et({total:z(),validator:z(),foundation:z(),epoch:z()}),hd=et({epoch:z(),slotIndex:z(),slotsInEpoch:z(),absoluteSlot:z(),blockHeight:Ot(z()),transactionCount:Ot(z())}),ld=et({slotsPerEpoch:z(),leaderScheduleSlotOffset:z(),warmup:Cr(),firstNormalEpoch:z(),firstNormalSlot:z()}),dd=na(at(),vt(z())),Wn=kt(or([et({}),at()])),pd=et({err:Wn}),yd=ze("receivedSignature"),Tg=et({"solana-core":at(),"feature-set":Ot(z())}),gd=et({program:at(),programId:We,parsed:Fn()}),md=et({programId:We,accounts:vt(We),data:at()}),Pg=Ar(et({err:kt(or([et({}),at()])),logs:kt(vt(at())),accounts:Ot(kt(vt(kt(et({executable:Cr(),owner:at(),lamports:z(),data:vt(at()),rentEpoch:Ot(z())}))))),unitsConsumed:Ot(z()),returnData:Ot(kt(et({programId:at(),data:zo([at(),ze("base64")])}))),innerInstructions:Ot(kt(vt(et({index:z(),instructions:vt(or([gd,md]))}))))})),Cg=Ar(et({byIdentity:na(at(),vt(z())),range:et({firstSlot:z(),lastSlot:z()})})),Ug=Ue(fd),Og=Ue(cd),Ng=Ue(ud),zg=Ue(hd),qg=Ue(ld),Fg=Ue(dd),Kg=Ue(z()),Dg=Ar(et({total:z(),circulating:z(),nonCirculating:z(),nonCirculatingAccounts:vt(We)})),wd=et({amount:at(),uiAmount:kt(z()),decimals:z(),uiAmountString:Ot(at())}),Wg=Ar(vt(et({address:We,amount:at(),uiAmount:kt(z()),decimals:z(),uiAmountString:Ot(at())}))),Hg=Ar(vt(et({pubkey:We,account:et({executable:Cr(),owner:We,lamports:z(),data:Ta,rentEpoch:z()})}))),Ma=et({program:at(),parsed:Fn(),space:z()}),$g=Ar(vt(et({pubkey:We,account:et({executable:Cr(),owner:We,lamports:z(),data:Ma,rentEpoch:z()})}))),Vg=Ar(vt(et({lamports:z(),address:We}))),Pa=et({executable:Cr(),owner:We,lamports:z(),data:Ta,rentEpoch:z()}),jg=et({pubkey:We,account:Pa}),bd=si(or([No(Yt.Buffer),Ma]),or([vc,Ma]),r=>Array.isArray(r)?oi(r,Ta):r),xd=et({executable:Cr(),owner:We,lamports:z(),data:bd,rentEpoch:z()}),Gg=et({pubkey:We,account:xd}),Yg=et({state:or([ze("active"),ze("inactive"),ze("activating"),ze("deactivating")]),active:z(),inactive:z()}),Zg=Ue(vt(et({signature:at(),slot:z(),err:Wn,memo:kt(at()),blockTime:Ot(kt(z()))}))),Jg=Ue(vt(et({signature:at(),slot:z(),err:Wn,memo:kt(at()),blockTime:Ot(kt(z()))}))),Xg=et({subscription:z(),result:Qo(Pa)}),vd=et({pubkey:We,account:Pa}),Qg=et({subscription:z(),result:Qo(vd)}),kd=et({parent:z(),slot:z(),root:z()}),tm=et({subscription:z(),result:kd}),Sd=or([et({type:or([ze("firstShredReceived"),ze("completed"),ze("optimisticConfirmation"),ze("root")]),slot:z(),timestamp:z()}),et({type:ze("createdBank"),parent:z(),slot:z(),timestamp:z()}),et({type:ze("frozen"),slot:z(),timestamp:z(),stats:et({numTransactionEntries:z(),numSuccessfulTransactions:z(),numFailedTransactions:z(),maxTransactionsPerEntry:z()})}),et({type:ze("dead"),slot:z(),timestamp:z(),err:at()})]),em=et({subscription:z(),result:Sd}),rm=et({subscription:z(),result:Qo(or([pd,yd]))}),nm=et({subscription:z(),result:z()}),im=et({pubkey:at(),gossip:kt(at()),tpu:kt(at()),rpc:kt(at()),version:kt(at())}),fc=et({votePubkey:at(),nodePubkey:at(),activatedStake:z(),epochVoteAccount:Cr(),epochCredits:vt(zo([z(),z(),z()])),commission:z(),lastVote:z(),rootSlot:kt(z())}),om=Ue(et({current:vt(fc),delinquent:vt(fc)})),Bd=or([ze("processed"),ze("confirmed"),ze("finalized")]),_d=et({slot:z(),confirmations:kt(z()),err:Wn,confirmationStatus:Ot(Bd)}),sm=Ar(vt(kt(_d))),am=Ue(z()),Sc=et({accountKey:We,writableIndexes:vt(z()),readonlyIndexes:vt(z())}),Ca=et({signatures:vt(at()),message:et({accountKeys:vt(at()),header:et({numRequiredSignatures:z(),numReadonlySignedAccounts:z(),numReadonlyUnsignedAccounts:z()}),instructions:vt(et({accounts:vt(z()),data:at(),programIdIndex:z()})),recentBlockhash:at(),addressTableLookups:Ot(vt(Sc))})}),Bc=et({pubkey:We,signer:Cr(),writable:Cr(),source:Ot(or([ze("transaction"),ze("lookupTable")]))}),_c=et({accountKeys:vt(Bc),signatures:vt(at())}),Ec=et({parsed:Fn(),program:at(),programId:We}),Ac=et({accounts:vt(We),data:at(),programId:We}),Ed=or([Ac,Ec]),Ad=or([et({parsed:Fn(),program:at(),programId:at()}),et({accounts:vt(at()),data:at(),programId:at()})]),Ic=si(Ed,Ad,r=>"accounts"in r?oi(r,Ac):oi(r,Ec)),Mc=et({signatures:vt(at()),message:et({accountKeys:vt(Bc),instructions:vt(Ic),recentBlockhash:at(),addressTableLookups:Ot(kt(vt(Sc)))})}),Jo=et({accountIndex:z(),mint:at(),owner:Ot(at()),uiTokenAmount:wd}),Lc=et({writable:vt(We),readonly:vt(We)}),ts=et({err:Wn,fee:z(),innerInstructions:Ot(kt(vt(et({index:z(),instructions:vt(et({accounts:vt(z()),data:at(),programIdIndex:z()}))})))),preBalances:vt(z()),postBalances:vt(z()),logMessages:Ot(kt(vt(at()))),preTokenBalances:Ot(kt(vt(Jo))),postTokenBalances:Ot(kt(vt(Jo))),loadedAddresses:Ot(Lc),computeUnitsConsumed:Ot(z())}),Ua=et({err:Wn,fee:z(),innerInstructions:Ot(kt(vt(et({index:z(),instructions:vt(Ic)})))),preBalances:vt(z()),postBalances:vt(z()),logMessages:Ot(kt(vt(at()))),preTokenBalances:Ot(kt(vt(Jo))),postTokenBalances:Ot(kt(vt(Jo))),loadedAddresses:Ot(Lc),computeUnitsConsumed:Ot(z())}),di=or([ze(0),ze("legacy")]),Hn=et({pubkey:at(),lamports:z(),postBalance:kt(z()),rewardType:kt(at()),commission:Ot(kt(z()))}),fm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),transactions:vt(et({transaction:Ca,meta:kt(ts),version:Ot(di)})),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),um=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),cm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),transactions:vt(et({transaction:_c,meta:kt(ts),version:Ot(di)})),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),hm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),transactions:vt(et({transaction:Mc,meta:kt(Ua),version:Ot(di)})),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),lm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),transactions:vt(et({transaction:_c,meta:kt(Ua),version:Ot(di)})),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),dm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),rewards:Ot(vt(Hn)),blockTime:kt(z()),blockHeight:kt(z())}))),pm=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),transactions:vt(et({transaction:Ca,meta:kt(ts)})),rewards:Ot(vt(Hn)),blockTime:kt(z())}))),ym=Ue(kt(et({blockhash:at(),previousBlockhash:at(),parentSlot:z(),signatures:vt(at()),blockTime:kt(z())}))),gm=Ue(kt(et({slot:z(),meta:kt(ts),blockTime:Ot(kt(z())),transaction:Ca,version:Ot(di)}))),mm=Ue(kt(et({slot:z(),transaction:Mc,meta:kt(Ua),blockTime:Ot(kt(z())),version:Ot(di)}))),wm=Ar(et({blockhash:at(),feeCalculator:et({lamportsPerSignature:z()})})),bm=Ar(et({blockhash:at(),lastValidBlockHeight:z()})),xm=Ar(Cr()),Id=et({slot:z(),numTransactions:z(),numSlots:z(),samplePeriodSecs:z()}),vm=Ue(vt(Id)),km=Ar(kt(et({feeCalculator:et({lamportsPerSignature:z()})}))),Sm=Ue(at()),Bm=Ue(at()),Md=et({err:Wn,logs:vt(at()),signature:at()}),_m=et({result:Qo(Md),subscription:z()}),en=class{constructor(t){this._keypair=void 0,this._keypair=t??nc()}static generate(){return new en(nc())}static fromSecretKey(t,e){if(t.byteLength!==64)throw new Error("bad secret key size");let n=t.slice(32,64);if(!e||!e.skipValidation){let o=t.slice(0,32),f=Sa(o);for(let h=0;h<32;h++)if(n[h]!==f[h])throw new Error("provided secretKey is invalid")}return new en({publicKey:n,secretKey:t})}static fromSeed(t){let e=Sa(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new en({publicKey:e,secretKey:n})}get publicKey(){return new ae(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}},Ui=Object.freeze({CreateLookupTable:{index:0,layout:L.struct([L.u32("instruction"),ui("recentSlot"),L.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:L.struct([L.u32("instruction")])},ExtendLookupTable:{index:2,layout:L.struct([L.u32("instruction"),ui(),L.seq(_e(),L.offset(L.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:L.struct([L.u32("instruction")])},CloseLookupTable:{index:4,layout:L.struct([L.u32("instruction")])}}),La=class{constructor(){}static createLookupTable(t){let[e,n]=ae.findProgramAddressSync([t.authority.toBuffer(),(0,$i.toBufferLE)(BigInt(t.recentSlot),8)],this.programId),o=Ui.CreateLookupTable,f=ke(o,{recentSlot:BigInt(t.recentSlot),bumpSeed:n}),h=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Je.programId,isSigner:!1,isWritable:!1}];return[new Ce({programId:this.programId,keys:h,data:f}),e]}static freezeLookupTable(t){let e=Ui.FreezeLookupTable,n=ke(e),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Ce({programId:this.programId,keys:o,data:n})}static extendLookupTable(t){let e=Ui.ExtendLookupTable,n=ke(e,{addresses:t.addresses.map(f=>f.toBytes())}),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&o.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:Je.programId,isSigner:!1,isWritable:!1}),new Ce({programId:this.programId,keys:o,data:n})}static deactivateLookupTable(t){let e=Ui.DeactivateLookupTable,n=ke(e),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Ce({programId:this.programId,keys:o,data:n})}static closeLookupTable(t){let e=Ui.CloseLookupTable,n=ke(e),o=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new Ce({programId:this.programId,keys:o,data:n})}};La.programId=new ae("AddressLookupTab1e1111111111111111111111111");jo=Object.freeze({RequestUnits:{index:0,layout:L.struct([L.u8("instruction"),L.u32("units"),L.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:L.struct([L.u8("instruction"),L.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:L.struct([L.u8("instruction"),L.u32("units")])},SetComputeUnitPrice:{index:3,layout:L.struct([L.u8("instruction"),ui("microLamports")])}}),Ra=class{constructor(){}static requestUnits(t){let e=jo.RequestUnits,n=ke(e,t);return new Ce({keys:[],programId:this.programId,data:n})}static requestHeapFrame(t){let e=jo.RequestHeapFrame,n=ke(e,t);return new Ce({keys:[],programId:this.programId,data:n})}static setComputeUnitLimit(t){let e=jo.SetComputeUnitLimit,n=ke(e,t);return new Ce({keys:[],programId:this.programId,data:n})}static setComputeUnitPrice(t){let e=jo.SetComputeUnitPrice,n=ke(e,{microLamports:BigInt(t.microLamports)});return new Ce({keys:[],programId:this.programId,data:n})}};Ra.programId=new ae("ComputeBudget111111111111111111111111111111");uc=64,cc=32,hc=64,lc=L.struct([L.u8("numSignatures"),L.u8("padding"),L.u16("signatureOffset"),L.u16("signatureInstructionIndex"),L.u16("publicKeyOffset"),L.u16("publicKeyInstructionIndex"),L.u16("messageDataOffset"),L.u16("messageDataSize"),L.u16("messageInstructionIndex")]),Wi=class{constructor(){}static createInstructionWithPublicKey(t){let{publicKey:e,message:n,signature:o,instructionIndex:f}=t;Ge(e.length===cc,`Public Key must be ${cc} bytes but received ${e.length} bytes`),Ge(o.length===hc,`Signature must be ${hc} bytes but received ${o.length} bytes`);let h=lc.span,x=h+e.length,b=x+o.length,E=1,_=Yt.Buffer.alloc(b+n.length),I=f??65535;return lc.encode({numSignatures:E,padding:0,signatureOffset:x,signatureInstructionIndex:I,publicKeyOffset:h,publicKeyInstructionIndex:I,messageDataOffset:b,messageDataSize:n.length,messageInstructionIndex:I},_),_.fill(e,h),_.fill(o,x),_.fill(n,b),new Ce({keys:[],programId:Wi.programId,data:_})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:n,instructionIndex:o}=t;Ge(e.length===uc,`Private key must be ${uc} bytes but received ${e.length} bytes`);try{let f=en.fromSecretKey(e),h=f.publicKey.toBytes(),x=gc(n,f.secretKey);return this.createInstructionWithPublicKey({publicKey:h,message:n,signature:x,instructionIndex:o})}catch(f){throw new Error(`Error creating instruction; ${f}`)}}};Wi.programId=new ae("Ed25519SigVerify111111111111111111111111111");Ld=(r,t)=>{let e=Ci.sign(r,t);return[e.toCompactRawBytes(),e.recovery]};Ci.utils.isValidPrivateKey;Rd=Ci.getPublicKey,dc=32,xa=20,pc=64,Td=11,va=L.struct([L.u8("numSignatures"),L.u16("signatureOffset"),L.u8("signatureInstructionIndex"),L.u16("ethAddressOffset"),L.u8("ethAddressInstructionIndex"),L.u16("messageDataOffset"),L.u16("messageDataSize"),L.u8("messageInstructionIndex"),L.blob(20,"ethAddress"),L.blob(64,"signature"),L.u8("recoveryId")]),Kn=class{constructor(){}static publicKeyToEthAddress(t){Ge(t.length===pc,`Public key must be ${pc} bytes but received ${t.length} bytes`);try{return Yt.Buffer.from(pa(Ie(t))).slice(-xa)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(t){let{publicKey:e,message:n,signature:o,recoveryId:f,instructionIndex:h}=t;return Kn.createInstructionWithEthAddress({ethAddress:Kn.publicKeyToEthAddress(e),message:n,signature:o,recoveryId:f,instructionIndex:h})}static createInstructionWithEthAddress(t){let{ethAddress:e,message:n,signature:o,recoveryId:f,instructionIndex:h=0}=t,x;typeof e=="string"?e.startsWith("0x")?x=Yt.Buffer.from(e.substr(2),"hex"):x=Yt.Buffer.from(e,"hex"):x=e,Ge(x.length===xa,`Address must be ${xa} bytes but received ${x.length} bytes`);let b=1+Td,E=b,_=b+x.length,I=_+o.length+1,C=1,N=Yt.Buffer.alloc(va.span+n.length);return va.encode({numSignatures:C,signatureOffset:_,signatureInstructionIndex:h,ethAddressOffset:E,ethAddressInstructionIndex:h,messageDataOffset:I,messageDataSize:n.length,messageInstructionIndex:h,signature:Ie(o),ethAddress:Ie(x),recoveryId:f},N),N.fill(Ie(n),va.span),new Ce({keys:[],programId:Kn.programId,data:N})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:n,instructionIndex:o}=t;Ge(e.length===dc,`Private key must be ${dc} bytes but received ${e.length} bytes`);try{let f=Ie(e),h=Rd(f,!1).slice(1),x=Yt.Buffer.from(pa(Ie(n))),[b,E]=Ld(x,f);return this.createInstructionWithPublicKey({publicKey:h,message:n,signature:b,recoveryId:E,instructionIndex:o})}catch(f){throw new Error(`Error creating instruction; ${f}`)}}};Kn.programId=new ae("KeccakSecp256k11111111111111111111111111111");Pd=new ae("StakeConfig11111111111111111111111111111111"),Hi=class{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}};Rc=Hi;Hi.default=new Rc(0,0,ae.default);Sn=Object.freeze({Initialize:{index:0,layout:L.struct([L.u32("instruction"),Vl(),jl()])},Authorize:{index:1,layout:L.struct([L.u32("instruction"),_e("newAuthorized"),L.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:L.struct([L.u32("instruction")])},Split:{index:3,layout:L.struct([L.u32("instruction"),L.ns64("lamports")])},Withdraw:{index:4,layout:L.struct([L.u32("instruction"),L.ns64("lamports")])},Deactivate:{index:5,layout:L.struct([L.u32("instruction")])},Merge:{index:7,layout:L.struct([L.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:L.struct([L.u32("instruction"),_e("newAuthorized"),L.u32("stakeAuthorizationType"),fi("authoritySeed"),_e("authorityOwner")])}}),Em=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),Xo=class{constructor(){}static initialize(t){let{stakePubkey:e,authorized:n,lockup:o}=t,f=o||Hi.default,h=Sn.Initialize,x=ke(h,{authorized:{staker:Ie(n.staker.toBuffer()),withdrawer:Ie(n.withdrawer.toBuffer())},lockup:{unixTimestamp:f.unixTimestamp,epoch:f.epoch,custodian:Ie(f.custodian.toBuffer())}}),b={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Di,isSigner:!1,isWritable:!1}],programId:this.programId,data:x};return new Ce(b)}static createAccountWithSeed(t){let e=new Pe;e.add(Je.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:n,authorized:o,lockup:f}=t;return e.add(this.initialize({stakePubkey:n,authorized:o,lockup:f}))}static createAccount(t){let e=new Pe;e.add(Je.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:n,authorized:o,lockup:f}=t;return e.add(this.initialize({stakePubkey:n,authorized:o,lockup:f}))}static delegate(t){let{stakePubkey:e,authorizedPubkey:n,votePubkey:o}=t,f=Sn.Delegate,h=ke(f);return new Pe().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:tn,isSigner:!1,isWritable:!1},{pubkey:ba,isSigner:!1,isWritable:!1},{pubkey:Pd,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:h})}static authorize(t){let{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:o,stakeAuthorizationType:f,custodianPubkey:h}=t,x=Sn.Authorize,b=ke(x,{newAuthorized:Ie(o.toBuffer()),stakeAuthorizationType:f.index}),E=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tn,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return h&&E.push({pubkey:h,isSigner:!0,isWritable:!1}),new Pe().add({keys:E,programId:this.programId,data:b})}static authorizeWithSeed(t){let{stakePubkey:e,authorityBase:n,authoritySeed:o,authorityOwner:f,newAuthorizedPubkey:h,stakeAuthorizationType:x,custodianPubkey:b}=t,E=Sn.AuthorizeWithSeed,_=ke(E,{newAuthorized:Ie(h.toBuffer()),stakeAuthorizationType:x.index,authoritySeed:o,authorityOwner:Ie(f.toBuffer())}),I=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:tn,isSigner:!1,isWritable:!1}];return b&&I.push({pubkey:b,isSigner:!0,isWritable:!1}),new Pe().add({keys:I,programId:this.programId,data:_})}static splitInstruction(t){let{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:o,lamports:f}=t,h=Sn.Split,x=ke(h,{lamports:f});return new Ce({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:x})}static split(t,e){let n=new Pe;return n.add(Je.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:e,space:this.space,programId:this.programId})),n.add(this.splitInstruction(t))}static splitWithSeed(t,e){let{stakePubkey:n,authorizedPubkey:o,splitStakePubkey:f,basePubkey:h,seed:x,lamports:b}=t,E=new Pe;return E.add(Je.allocate({accountPubkey:f,basePubkey:h,seed:x,space:this.space,programId:this.programId})),e&&e>0&&E.add(Je.transfer({fromPubkey:t.authorizedPubkey,toPubkey:f,lamports:e})),E.add(this.splitInstruction({stakePubkey:n,authorizedPubkey:o,splitStakePubkey:f,lamports:b}))}static merge(t){let{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:o}=t,f=Sn.Merge,h=ke(f);return new Pe().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:tn,isSigner:!1,isWritable:!1},{pubkey:ba,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!0,isWritable:!1}],programId:this.programId,data:h})}static withdraw(t){let{stakePubkey:e,authorizedPubkey:n,toPubkey:o,lamports:f,custodianPubkey:h}=t,x=Sn.Withdraw,b=ke(x,{lamports:f}),E=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:tn,isSigner:!1,isWritable:!1},{pubkey:ba,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return h&&E.push({pubkey:h,isSigner:!0,isWritable:!1}),new Pe().add({keys:E,programId:this.programId,data:b})}static deactivate(t){let{stakePubkey:e,authorizedPubkey:n}=t,o=Sn.Deactivate,f=ke(o);return new Pe().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:f})}};Xo.programId=new ae("Stake11111111111111111111111111111111111111");Xo.space=200;Oi=Object.freeze({InitializeAccount:{index:0,layout:L.struct([L.u32("instruction"),Gl()])},Authorize:{index:1,layout:L.struct([L.u32("instruction"),_e("newAuthorized"),L.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:L.struct([L.u32("instruction"),L.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:L.struct([L.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:L.struct([L.u32("instruction"),Yl()])}}),Am=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),hi=class{constructor(){}static initializeAccount(t){let{votePubkey:e,nodePubkey:n,voteInit:o}=t,f=Oi.InitializeAccount,h=ke(f,{voteInit:{nodePubkey:Ie(o.nodePubkey.toBuffer()),authorizedVoter:Ie(o.authorizedVoter.toBuffer()),authorizedWithdrawer:Ie(o.authorizedWithdrawer.toBuffer()),commission:o.commission}}),x={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Di,isSigner:!1,isWritable:!1},{pubkey:tn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:h};return new Ce(x)}static createAccount(t){let e=new Pe;return e.add(Je.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){let{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:o,voteAuthorizationType:f}=t,h=Oi.Authorize,x=ke(h,{newAuthorized:Ie(o.toBuffer()),voteAuthorizationType:f.index}),b=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:tn,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new Pe().add({keys:b,programId:this.programId,data:x})}static authorizeWithSeed(t){let{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:o,newAuthorizedPubkey:f,voteAuthorizationType:h,votePubkey:x}=t,b=Oi.AuthorizeWithSeed,E=ke(b,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Ie(n.toBuffer()),currentAuthorityDerivedKeySeed:o,newAuthorized:Ie(f.toBuffer()),voteAuthorizationType:h.index}}),_=[{pubkey:x,isSigner:!1,isWritable:!0},{pubkey:tn,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return new Pe().add({keys:_,programId:this.programId,data:E})}static withdraw(t){let{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:o,toPubkey:f}=t,h=Oi.Withdraw,x=ke(h,{lamports:o}),b=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:f,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return new Pe().add({keys:b,programId:this.programId,data:x})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insufficient funds.");return hi.withdraw(t)}static updateValidatorIdentity(t){let{votePubkey:e,authorizedWithdrawerPubkey:n,nodePubkey:o}=t,f=Oi.UpdateValidatorIdentity,h=ke(f),x=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new Pe().add({keys:x,programId:this.programId,data:h})}};hi.programId=new ae("Vote111111111111111111111111111111111111111");hi.space=3762;Im=new ae("Va1idator1nfo111111111111111111111111111111"),Mm=et({name:at(),website:Ot(at()),details:Ot(at()),iconUrl:Ot(at()),keybaseUsername:Ot(at())}),Lm=new ae("Vote111111111111111111111111111111111111111"),Rm=L.struct([_e("nodePubkey"),_e("authorizedWithdrawer"),L.u8("commission"),L.nu64(),L.seq(L.struct([L.nu64("slot"),L.u32("confirmationCount")]),L.offset(L.u32(),-8),"votes"),L.u8("rootSlotValid"),L.nu64("rootSlot"),L.nu64(),L.seq(L.struct([L.nu64("epoch"),_e("authorizedVoter")]),L.offset(L.u32(),-8),"authorizedVoters"),L.struct([L.seq(L.struct([_e("authorizedPubkey"),L.nu64("epochOfLastAuthorizedSwitch"),L.nu64("targetEpoch")]),32,"buf"),L.nu64("idx"),L.u8("isEmpty")],"priorVoters"),L.nu64(),L.seq(L.struct([L.nu64("epoch"),L.nu64("credits"),L.nu64("prevCredits")]),L.offset(L.u32(),-8),"epochCredits"),L.struct([L.nu64("slot"),L.nu64("timestamp")],"lastTimestamp")])});var Pc=$e(()=>{var Om=H(V())});var Cc=$e((Nm,es)=>{var zm=H(V());(function(r){"use strict";var t=function(m){var S,k=new Float64Array(16);if(m)for(S=0;S>24&255,m[S+1]=k>>16&255,m[S+2]=k>>8&255,m[S+3]=k&255,m[S+4]=l>>24&255,m[S+5]=l>>16&255,m[S+6]=l>>8&255,m[S+7]=l&255}function ft(m,S,k,l,B){var M,T=0;for(M=0;M>>8)-1}function D(m,S,k,l){return ft(m,S,k,l,16)}function P(m,S,k,l){return ft(m,S,k,l,32)}function J(m,S,k,l){for(var B=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,M=k[0]&255|(k[1]&255)<<8|(k[2]&255)<<16|(k[3]&255)<<24,T=k[4]&255|(k[5]&255)<<8|(k[6]&255)<<16|(k[7]&255)<<24,O=k[8]&255|(k[9]&255)<<8|(k[10]&255)<<16|(k[11]&255)<<24,$=k[12]&255|(k[13]&255)<<8|(k[14]&255)<<16|(k[15]&255)<<24,_t=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,X=S[0]&255|(S[1]&255)<<8|(S[2]&255)<<16|(S[3]&255)<<24,yt=S[4]&255|(S[5]&255)<<8|(S[6]&255)<<16|(S[7]&255)<<24,gt=S[8]&255|(S[9]&255)<<8|(S[10]&255)<<16|(S[11]&255)<<24,Mt=S[12]&255|(S[13]&255)<<8|(S[14]&255)<<16|(S[15]&255)<<24,Rt=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,qt=k[16]&255|(k[17]&255)<<8|(k[18]&255)<<16|(k[19]&255)<<24,zt=k[20]&255|(k[21]&255)<<8|(k[22]&255)<<16|(k[23]&255)<<24,Tt=k[24]&255|(k[25]&255)<<8|(k[26]&255)<<16|(k[27]&255)<<24,Ct=k[28]&255|(k[29]&255)<<8|(k[30]&255)<<16|(k[31]&255)<<24,Pt=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,mt=B,Et=M,lt=T,wt=O,bt=$,ut=_t,F=X,K=yt,Q=gt,Y=Mt,Z=Rt,nt=qt,Ut=zt,de=Tt,ye=Ct,pe=Pt,A,we=0;we<20;we+=2)A=mt+Ut|0,bt^=A<<7|A>>>32-7,A=bt+mt|0,Q^=A<<9|A>>>32-9,A=Q+bt|0,Ut^=A<<13|A>>>32-13,A=Ut+Q|0,mt^=A<<18|A>>>32-18,A=ut+Et|0,Y^=A<<7|A>>>32-7,A=Y+ut|0,de^=A<<9|A>>>32-9,A=de+Y|0,Et^=A<<13|A>>>32-13,A=Et+de|0,ut^=A<<18|A>>>32-18,A=Z+F|0,ye^=A<<7|A>>>32-7,A=ye+Z|0,lt^=A<<9|A>>>32-9,A=lt+ye|0,F^=A<<13|A>>>32-13,A=F+lt|0,Z^=A<<18|A>>>32-18,A=pe+nt|0,wt^=A<<7|A>>>32-7,A=wt+pe|0,K^=A<<9|A>>>32-9,A=K+wt|0,nt^=A<<13|A>>>32-13,A=nt+K|0,pe^=A<<18|A>>>32-18,A=mt+wt|0,Et^=A<<7|A>>>32-7,A=Et+mt|0,lt^=A<<9|A>>>32-9,A=lt+Et|0,wt^=A<<13|A>>>32-13,A=wt+lt|0,mt^=A<<18|A>>>32-18,A=ut+bt|0,F^=A<<7|A>>>32-7,A=F+ut|0,K^=A<<9|A>>>32-9,A=K+F|0,bt^=A<<13|A>>>32-13,A=bt+K|0,ut^=A<<18|A>>>32-18,A=Z+Y|0,nt^=A<<7|A>>>32-7,A=nt+Z|0,Q^=A<<9|A>>>32-9,A=Q+nt|0,Y^=A<<13|A>>>32-13,A=Y+Q|0,Z^=A<<18|A>>>32-18,A=pe+ye|0,Ut^=A<<7|A>>>32-7,A=Ut+pe|0,de^=A<<9|A>>>32-9,A=de+Ut|0,ye^=A<<13|A>>>32-13,A=ye+de|0,pe^=A<<18|A>>>32-18;mt=mt+B|0,Et=Et+M|0,lt=lt+T|0,wt=wt+O|0,bt=bt+$|0,ut=ut+_t|0,F=F+X|0,K=K+yt|0,Q=Q+gt|0,Y=Y+Mt|0,Z=Z+Rt|0,nt=nt+qt|0,Ut=Ut+zt|0,de=de+Tt|0,ye=ye+Ct|0,pe=pe+Pt|0,m[0]=mt>>>0&255,m[1]=mt>>>8&255,m[2]=mt>>>16&255,m[3]=mt>>>24&255,m[4]=Et>>>0&255,m[5]=Et>>>8&255,m[6]=Et>>>16&255,m[7]=Et>>>24&255,m[8]=lt>>>0&255,m[9]=lt>>>8&255,m[10]=lt>>>16&255,m[11]=lt>>>24&255,m[12]=wt>>>0&255,m[13]=wt>>>8&255,m[14]=wt>>>16&255,m[15]=wt>>>24&255,m[16]=bt>>>0&255,m[17]=bt>>>8&255,m[18]=bt>>>16&255,m[19]=bt>>>24&255,m[20]=ut>>>0&255,m[21]=ut>>>8&255,m[22]=ut>>>16&255,m[23]=ut>>>24&255,m[24]=F>>>0&255,m[25]=F>>>8&255,m[26]=F>>>16&255,m[27]=F>>>24&255,m[28]=K>>>0&255,m[29]=K>>>8&255,m[30]=K>>>16&255,m[31]=K>>>24&255,m[32]=Q>>>0&255,m[33]=Q>>>8&255,m[34]=Q>>>16&255,m[35]=Q>>>24&255,m[36]=Y>>>0&255,m[37]=Y>>>8&255,m[38]=Y>>>16&255,m[39]=Y>>>24&255,m[40]=Z>>>0&255,m[41]=Z>>>8&255,m[42]=Z>>>16&255,m[43]=Z>>>24&255,m[44]=nt>>>0&255,m[45]=nt>>>8&255,m[46]=nt>>>16&255,m[47]=nt>>>24&255,m[48]=Ut>>>0&255,m[49]=Ut>>>8&255,m[50]=Ut>>>16&255,m[51]=Ut>>>24&255,m[52]=de>>>0&255,m[53]=de>>>8&255,m[54]=de>>>16&255,m[55]=de>>>24&255,m[56]=ye>>>0&255,m[57]=ye>>>8&255,m[58]=ye>>>16&255,m[59]=ye>>>24&255,m[60]=pe>>>0&255,m[61]=pe>>>8&255,m[62]=pe>>>16&255,m[63]=pe>>>24&255}function it(m,S,k,l){for(var B=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,M=k[0]&255|(k[1]&255)<<8|(k[2]&255)<<16|(k[3]&255)<<24,T=k[4]&255|(k[5]&255)<<8|(k[6]&255)<<16|(k[7]&255)<<24,O=k[8]&255|(k[9]&255)<<8|(k[10]&255)<<16|(k[11]&255)<<24,$=k[12]&255|(k[13]&255)<<8|(k[14]&255)<<16|(k[15]&255)<<24,_t=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,X=S[0]&255|(S[1]&255)<<8|(S[2]&255)<<16|(S[3]&255)<<24,yt=S[4]&255|(S[5]&255)<<8|(S[6]&255)<<16|(S[7]&255)<<24,gt=S[8]&255|(S[9]&255)<<8|(S[10]&255)<<16|(S[11]&255)<<24,Mt=S[12]&255|(S[13]&255)<<8|(S[14]&255)<<16|(S[15]&255)<<24,Rt=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,qt=k[16]&255|(k[17]&255)<<8|(k[18]&255)<<16|(k[19]&255)<<24,zt=k[20]&255|(k[21]&255)<<8|(k[22]&255)<<16|(k[23]&255)<<24,Tt=k[24]&255|(k[25]&255)<<8|(k[26]&255)<<16|(k[27]&255)<<24,Ct=k[28]&255|(k[29]&255)<<8|(k[30]&255)<<16|(k[31]&255)<<24,Pt=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,mt=B,Et=M,lt=T,wt=O,bt=$,ut=_t,F=X,K=yt,Q=gt,Y=Mt,Z=Rt,nt=qt,Ut=zt,de=Tt,ye=Ct,pe=Pt,A,we=0;we<20;we+=2)A=mt+Ut|0,bt^=A<<7|A>>>32-7,A=bt+mt|0,Q^=A<<9|A>>>32-9,A=Q+bt|0,Ut^=A<<13|A>>>32-13,A=Ut+Q|0,mt^=A<<18|A>>>32-18,A=ut+Et|0,Y^=A<<7|A>>>32-7,A=Y+ut|0,de^=A<<9|A>>>32-9,A=de+Y|0,Et^=A<<13|A>>>32-13,A=Et+de|0,ut^=A<<18|A>>>32-18,A=Z+F|0,ye^=A<<7|A>>>32-7,A=ye+Z|0,lt^=A<<9|A>>>32-9,A=lt+ye|0,F^=A<<13|A>>>32-13,A=F+lt|0,Z^=A<<18|A>>>32-18,A=pe+nt|0,wt^=A<<7|A>>>32-7,A=wt+pe|0,K^=A<<9|A>>>32-9,A=K+wt|0,nt^=A<<13|A>>>32-13,A=nt+K|0,pe^=A<<18|A>>>32-18,A=mt+wt|0,Et^=A<<7|A>>>32-7,A=Et+mt|0,lt^=A<<9|A>>>32-9,A=lt+Et|0,wt^=A<<13|A>>>32-13,A=wt+lt|0,mt^=A<<18|A>>>32-18,A=ut+bt|0,F^=A<<7|A>>>32-7,A=F+ut|0,K^=A<<9|A>>>32-9,A=K+F|0,bt^=A<<13|A>>>32-13,A=bt+K|0,ut^=A<<18|A>>>32-18,A=Z+Y|0,nt^=A<<7|A>>>32-7,A=nt+Z|0,Q^=A<<9|A>>>32-9,A=Q+nt|0,Y^=A<<13|A>>>32-13,A=Y+Q|0,Z^=A<<18|A>>>32-18,A=pe+ye|0,Ut^=A<<7|A>>>32-7,A=Ut+pe|0,de^=A<<9|A>>>32-9,A=de+Ut|0,ye^=A<<13|A>>>32-13,A=ye+de|0,pe^=A<<18|A>>>32-18;m[0]=mt>>>0&255,m[1]=mt>>>8&255,m[2]=mt>>>16&255,m[3]=mt>>>24&255,m[4]=ut>>>0&255,m[5]=ut>>>8&255,m[6]=ut>>>16&255,m[7]=ut>>>24&255,m[8]=Z>>>0&255,m[9]=Z>>>8&255,m[10]=Z>>>16&255,m[11]=Z>>>24&255,m[12]=pe>>>0&255,m[13]=pe>>>8&255,m[14]=pe>>>16&255,m[15]=pe>>>24&255,m[16]=F>>>0&255,m[17]=F>>>8&255,m[18]=F>>>16&255,m[19]=F>>>24&255,m[20]=K>>>0&255,m[21]=K>>>8&255,m[22]=K>>>16&255,m[23]=K>>>24&255,m[24]=Q>>>0&255,m[25]=Q>>>8&255,m[26]=Q>>>16&255,m[27]=Q>>>24&255,m[28]=Y>>>0&255,m[29]=Y>>>8&255,m[30]=Y>>>16&255,m[31]=Y>>>24&255}function G(m,S,k,l){J(m,S,k,l)}function rt(m,S,k,l){it(m,S,k,l)}var xt=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function ot(m,S,k,l,B,M,T){var O=new Uint8Array(16),$=new Uint8Array(64),_t,X;for(X=0;X<16;X++)O[X]=0;for(X=0;X<8;X++)O[X]=M[X];for(;B>=64;){for(G($,O,T,xt),X=0;X<64;X++)m[S+X]=k[l+X]^$[X];for(_t=1,X=8;X<16;X++)_t=_t+(O[X]&255)|0,O[X]=_t&255,_t>>>=8;B-=64,S+=64,l+=64}if(B>0)for(G($,O,T,xt),X=0;X=64;){for(G(T,M,B,xt),$=0;$<64;$++)m[S+$]=T[$];for(O=1,$=8;$<16;$++)O=O+(M[$]&255)|0,M[$]=O&255,O>>>=8;k-=64,S+=64}if(k>0)for(G(T,M,B,xt),$=0;$>>13|k<<3)&8191,l=m[4]&255|(m[5]&255)<<8,this.r[2]=(k>>>10|l<<6)&7939,B=m[6]&255|(m[7]&255)<<8,this.r[3]=(l>>>7|B<<9)&8191,M=m[8]&255|(m[9]&255)<<8,this.r[4]=(B>>>4|M<<12)&255,this.r[5]=M>>>1&8190,T=m[10]&255|(m[11]&255)<<8,this.r[6]=(M>>>14|T<<2)&8191,O=m[12]&255|(m[13]&255)<<8,this.r[7]=(T>>>11|O<<5)&8065,$=m[14]&255|(m[15]&255)<<8,this.r[8]=(O>>>8|$<<8)&8191,this.r[9]=$>>>5&127,this.pad[0]=m[16]&255|(m[17]&255)<<8,this.pad[1]=m[18]&255|(m[19]&255)<<8,this.pad[2]=m[20]&255|(m[21]&255)<<8,this.pad[3]=m[22]&255|(m[23]&255)<<8,this.pad[4]=m[24]&255|(m[25]&255)<<8,this.pad[5]=m[26]&255|(m[27]&255)<<8,this.pad[6]=m[28]&255|(m[29]&255)<<8,this.pad[7]=m[30]&255|(m[31]&255)<<8};Ee.prototype.blocks=function(m,S,k){for(var l=this.fin?0:2048,B,M,T,O,$,_t,X,yt,gt,Mt,Rt,qt,zt,Tt,Ct,Pt,mt,Et,lt,wt=this.h[0],bt=this.h[1],ut=this.h[2],F=this.h[3],K=this.h[4],Q=this.h[5],Y=this.h[6],Z=this.h[7],nt=this.h[8],Ut=this.h[9],de=this.r[0],ye=this.r[1],pe=this.r[2],A=this.r[3],we=this.r[4],Se=this.r[5],Be=this.r[6],me=this.r[7],xe=this.r[8],ve=this.r[9];k>=16;)B=m[S+0]&255|(m[S+1]&255)<<8,wt+=B&8191,M=m[S+2]&255|(m[S+3]&255)<<8,bt+=(B>>>13|M<<3)&8191,T=m[S+4]&255|(m[S+5]&255)<<8,ut+=(M>>>10|T<<6)&8191,O=m[S+6]&255|(m[S+7]&255)<<8,F+=(T>>>7|O<<9)&8191,$=m[S+8]&255|(m[S+9]&255)<<8,K+=(O>>>4|$<<12)&8191,Q+=$>>>1&8191,_t=m[S+10]&255|(m[S+11]&255)<<8,Y+=($>>>14|_t<<2)&8191,X=m[S+12]&255|(m[S+13]&255)<<8,Z+=(_t>>>11|X<<5)&8191,yt=m[S+14]&255|(m[S+15]&255)<<8,nt+=(X>>>8|yt<<8)&8191,Ut+=yt>>>5|l,gt=0,Mt=gt,Mt+=wt*de,Mt+=bt*(5*ve),Mt+=ut*(5*xe),Mt+=F*(5*me),Mt+=K*(5*Be),gt=Mt>>>13,Mt&=8191,Mt+=Q*(5*Se),Mt+=Y*(5*we),Mt+=Z*(5*A),Mt+=nt*(5*pe),Mt+=Ut*(5*ye),gt+=Mt>>>13,Mt&=8191,Rt=gt,Rt+=wt*ye,Rt+=bt*de,Rt+=ut*(5*ve),Rt+=F*(5*xe),Rt+=K*(5*me),gt=Rt>>>13,Rt&=8191,Rt+=Q*(5*Be),Rt+=Y*(5*Se),Rt+=Z*(5*we),Rt+=nt*(5*A),Rt+=Ut*(5*pe),gt+=Rt>>>13,Rt&=8191,qt=gt,qt+=wt*pe,qt+=bt*ye,qt+=ut*de,qt+=F*(5*ve),qt+=K*(5*xe),gt=qt>>>13,qt&=8191,qt+=Q*(5*me),qt+=Y*(5*Be),qt+=Z*(5*Se),qt+=nt*(5*we),qt+=Ut*(5*A),gt+=qt>>>13,qt&=8191,zt=gt,zt+=wt*A,zt+=bt*pe,zt+=ut*ye,zt+=F*de,zt+=K*(5*ve),gt=zt>>>13,zt&=8191,zt+=Q*(5*xe),zt+=Y*(5*me),zt+=Z*(5*Be),zt+=nt*(5*Se),zt+=Ut*(5*we),gt+=zt>>>13,zt&=8191,Tt=gt,Tt+=wt*we,Tt+=bt*A,Tt+=ut*pe,Tt+=F*ye,Tt+=K*de,gt=Tt>>>13,Tt&=8191,Tt+=Q*(5*ve),Tt+=Y*(5*xe),Tt+=Z*(5*me),Tt+=nt*(5*Be),Tt+=Ut*(5*Se),gt+=Tt>>>13,Tt&=8191,Ct=gt,Ct+=wt*Se,Ct+=bt*we,Ct+=ut*A,Ct+=F*pe,Ct+=K*ye,gt=Ct>>>13,Ct&=8191,Ct+=Q*de,Ct+=Y*(5*ve),Ct+=Z*(5*xe),Ct+=nt*(5*me),Ct+=Ut*(5*Be),gt+=Ct>>>13,Ct&=8191,Pt=gt,Pt+=wt*Be,Pt+=bt*Se,Pt+=ut*we,Pt+=F*A,Pt+=K*pe,gt=Pt>>>13,Pt&=8191,Pt+=Q*ye,Pt+=Y*de,Pt+=Z*(5*ve),Pt+=nt*(5*xe),Pt+=Ut*(5*me),gt+=Pt>>>13,Pt&=8191,mt=gt,mt+=wt*me,mt+=bt*Be,mt+=ut*Se,mt+=F*we,mt+=K*A,gt=mt>>>13,mt&=8191,mt+=Q*pe,mt+=Y*ye,mt+=Z*de,mt+=nt*(5*ve),mt+=Ut*(5*xe),gt+=mt>>>13,mt&=8191,Et=gt,Et+=wt*xe,Et+=bt*me,Et+=ut*Be,Et+=F*Se,Et+=K*we,gt=Et>>>13,Et&=8191,Et+=Q*A,Et+=Y*pe,Et+=Z*ye,Et+=nt*de,Et+=Ut*(5*ve),gt+=Et>>>13,Et&=8191,lt=gt,lt+=wt*ve,lt+=bt*xe,lt+=ut*me,lt+=F*Be,lt+=K*Se,gt=lt>>>13,lt&=8191,lt+=Q*we,lt+=Y*A,lt+=Z*pe,lt+=nt*ye,lt+=Ut*de,gt+=lt>>>13,lt&=8191,gt=(gt<<2)+gt|0,gt=gt+Mt|0,Mt=gt&8191,gt=gt>>>13,Rt+=gt,wt=Mt,bt=Rt,ut=qt,F=zt,K=Tt,Q=Ct,Y=Pt,Z=mt,nt=Et,Ut=lt,S+=16,k-=16;this.h[0]=wt,this.h[1]=bt,this.h[2]=ut,this.h[3]=F,this.h[4]=K,this.h[5]=Q,this.h[6]=Y,this.h[7]=Z,this.h[8]=nt,this.h[9]=Ut},Ee.prototype.finish=function(m,S){var k=new Uint16Array(10),l,B,M,T;if(this.leftover){for(T=this.leftover,this.buffer[T++]=1;T<16;T++)this.buffer[T]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(l=this.h[1]>>>13,this.h[1]&=8191,T=2;T<10;T++)this.h[T]+=l,l=this.h[T]>>>13,this.h[T]&=8191;for(this.h[0]+=l*5,l=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=l,l=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=l,k[0]=this.h[0]+5,l=k[0]>>>13,k[0]&=8191,T=1;T<10;T++)k[T]=this.h[T]+l,l=k[T]>>>13,k[T]&=8191;for(k[9]-=8192,B=(l^1)-1,T=0;T<10;T++)k[T]&=B;for(B=~B,T=0;T<10;T++)this.h[T]=this.h[T]&B|k[T];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,M=this.h[0]+this.pad[0],this.h[0]=M&65535,T=1;T<8;T++)M=(this.h[T]+this.pad[T]|0)+(M>>>16)|0,this.h[T]=M&65535;m[S+0]=this.h[0]>>>0&255,m[S+1]=this.h[0]>>>8&255,m[S+2]=this.h[1]>>>0&255,m[S+3]=this.h[1]>>>8&255,m[S+4]=this.h[2]>>>0&255,m[S+5]=this.h[2]>>>8&255,m[S+6]=this.h[3]>>>0&255,m[S+7]=this.h[3]>>>8&255,m[S+8]=this.h[4]>>>0&255,m[S+9]=this.h[4]>>>8&255,m[S+10]=this.h[5]>>>0&255,m[S+11]=this.h[5]>>>8&255,m[S+12]=this.h[6]>>>0&255,m[S+13]=this.h[6]>>>8&255,m[S+14]=this.h[7]>>>0&255,m[S+15]=this.h[7]>>>8&255},Ee.prototype.update=function(m,S,k){var l,B;if(this.leftover){for(B=16-this.leftover,B>k&&(B=k),l=0;l=16&&(B=k-k%16,this.blocks(m,S,B),S+=B,k-=B),k){for(l=0;l>16&1),M[k-1]&=65535;M[15]=T[15]-32767-(M[14]>>16&1),B=M[15]>>16&1,M[14]&=65535,c(T,M,1-B)}for(k=0;k<16;k++)m[2*k]=T[k]&255,m[2*k+1]=T[k]>>8}function w(m,S){var k=new Uint8Array(32),l=new Uint8Array(32);return d(k,m),d(l,S),P(k,0,l,0)}function v(m){var S=new Uint8Array(32);return d(S,m),S[0]&1}function p(m,S){var k;for(k=0;k<16;k++)m[k]=S[2*k]+(S[2*k+1]<<8);m[15]&=32767}function s(m,S,k){for(var l=0;l<16;l++)m[l]=S[l]+k[l]}function y(m,S,k){for(var l=0;l<16;l++)m[l]=S[l]-k[l]}function R(m,S,k){var l,B,M=0,T=0,O=0,$=0,_t=0,X=0,yt=0,gt=0,Mt=0,Rt=0,qt=0,zt=0,Tt=0,Ct=0,Pt=0,mt=0,Et=0,lt=0,wt=0,bt=0,ut=0,F=0,K=0,Q=0,Y=0,Z=0,nt=0,Ut=0,de=0,ye=0,pe=0,A=k[0],we=k[1],Se=k[2],Be=k[3],me=k[4],xe=k[5],ve=k[6],He=k[7],Le=k[8],qe=k[9],Fe=k[10],Ke=k[11],Ve=k[12],er=k[13],rr=k[14],nr=k[15];l=S[0],M+=l*A,T+=l*we,O+=l*Se,$+=l*Be,_t+=l*me,X+=l*xe,yt+=l*ve,gt+=l*He,Mt+=l*Le,Rt+=l*qe,qt+=l*Fe,zt+=l*Ke,Tt+=l*Ve,Ct+=l*er,Pt+=l*rr,mt+=l*nr,l=S[1],T+=l*A,O+=l*we,$+=l*Se,_t+=l*Be,X+=l*me,yt+=l*xe,gt+=l*ve,Mt+=l*He,Rt+=l*Le,qt+=l*qe,zt+=l*Fe,Tt+=l*Ke,Ct+=l*Ve,Pt+=l*er,mt+=l*rr,Et+=l*nr,l=S[2],O+=l*A,$+=l*we,_t+=l*Se,X+=l*Be,yt+=l*me,gt+=l*xe,Mt+=l*ve,Rt+=l*He,qt+=l*Le,zt+=l*qe,Tt+=l*Fe,Ct+=l*Ke,Pt+=l*Ve,mt+=l*er,Et+=l*rr,lt+=l*nr,l=S[3],$+=l*A,_t+=l*we,X+=l*Se,yt+=l*Be,gt+=l*me,Mt+=l*xe,Rt+=l*ve,qt+=l*He,zt+=l*Le,Tt+=l*qe,Ct+=l*Fe,Pt+=l*Ke,mt+=l*Ve,Et+=l*er,lt+=l*rr,wt+=l*nr,l=S[4],_t+=l*A,X+=l*we,yt+=l*Se,gt+=l*Be,Mt+=l*me,Rt+=l*xe,qt+=l*ve,zt+=l*He,Tt+=l*Le,Ct+=l*qe,Pt+=l*Fe,mt+=l*Ke,Et+=l*Ve,lt+=l*er,wt+=l*rr,bt+=l*nr,l=S[5],X+=l*A,yt+=l*we,gt+=l*Se,Mt+=l*Be,Rt+=l*me,qt+=l*xe,zt+=l*ve,Tt+=l*He,Ct+=l*Le,Pt+=l*qe,mt+=l*Fe,Et+=l*Ke,lt+=l*Ve,wt+=l*er,bt+=l*rr,ut+=l*nr,l=S[6],yt+=l*A,gt+=l*we,Mt+=l*Se,Rt+=l*Be,qt+=l*me,zt+=l*xe,Tt+=l*ve,Ct+=l*He,Pt+=l*Le,mt+=l*qe,Et+=l*Fe,lt+=l*Ke,wt+=l*Ve,bt+=l*er,ut+=l*rr,F+=l*nr,l=S[7],gt+=l*A,Mt+=l*we,Rt+=l*Se,qt+=l*Be,zt+=l*me,Tt+=l*xe,Ct+=l*ve,Pt+=l*He,mt+=l*Le,Et+=l*qe,lt+=l*Fe,wt+=l*Ke,bt+=l*Ve,ut+=l*er,F+=l*rr,K+=l*nr,l=S[8],Mt+=l*A,Rt+=l*we,qt+=l*Se,zt+=l*Be,Tt+=l*me,Ct+=l*xe,Pt+=l*ve,mt+=l*He,Et+=l*Le,lt+=l*qe,wt+=l*Fe,bt+=l*Ke,ut+=l*Ve,F+=l*er,K+=l*rr,Q+=l*nr,l=S[9],Rt+=l*A,qt+=l*we,zt+=l*Se,Tt+=l*Be,Ct+=l*me,Pt+=l*xe,mt+=l*ve,Et+=l*He,lt+=l*Le,wt+=l*qe,bt+=l*Fe,ut+=l*Ke,F+=l*Ve,K+=l*er,Q+=l*rr,Y+=l*nr,l=S[10],qt+=l*A,zt+=l*we,Tt+=l*Se,Ct+=l*Be,Pt+=l*me,mt+=l*xe,Et+=l*ve,lt+=l*He,wt+=l*Le,bt+=l*qe,ut+=l*Fe,F+=l*Ke,K+=l*Ve,Q+=l*er,Y+=l*rr,Z+=l*nr,l=S[11],zt+=l*A,Tt+=l*we,Ct+=l*Se,Pt+=l*Be,mt+=l*me,Et+=l*xe,lt+=l*ve,wt+=l*He,bt+=l*Le,ut+=l*qe,F+=l*Fe,K+=l*Ke,Q+=l*Ve,Y+=l*er,Z+=l*rr,nt+=l*nr,l=S[12],Tt+=l*A,Ct+=l*we,Pt+=l*Se,mt+=l*Be,Et+=l*me,lt+=l*xe,wt+=l*ve,bt+=l*He,ut+=l*Le,F+=l*qe,K+=l*Fe,Q+=l*Ke,Y+=l*Ve,Z+=l*er,nt+=l*rr,Ut+=l*nr,l=S[13],Ct+=l*A,Pt+=l*we,mt+=l*Se,Et+=l*Be,lt+=l*me,wt+=l*xe,bt+=l*ve,ut+=l*He,F+=l*Le,K+=l*qe,Q+=l*Fe,Y+=l*Ke,Z+=l*Ve,nt+=l*er,Ut+=l*rr,de+=l*nr,l=S[14],Pt+=l*A,mt+=l*we,Et+=l*Se,lt+=l*Be,wt+=l*me,bt+=l*xe,ut+=l*ve,F+=l*He,K+=l*Le,Q+=l*qe,Y+=l*Fe,Z+=l*Ke,nt+=l*Ve,Ut+=l*er,de+=l*rr,ye+=l*nr,l=S[15],mt+=l*A,Et+=l*we,lt+=l*Se,wt+=l*Be,bt+=l*me,ut+=l*xe,F+=l*ve,K+=l*He,Q+=l*Le,Y+=l*qe,Z+=l*Fe,nt+=l*Ke,Ut+=l*Ve,de+=l*er,ye+=l*rr,pe+=l*nr,M+=38*Et,T+=38*lt,O+=38*wt,$+=38*bt,_t+=38*ut,X+=38*F,yt+=38*K,gt+=38*Q,Mt+=38*Y,Rt+=38*Z,qt+=38*nt,zt+=38*Ut,Tt+=38*de,Ct+=38*ye,Pt+=38*pe,B=1,l=M+B+65535,B=Math.floor(l/65536),M=l-B*65536,l=T+B+65535,B=Math.floor(l/65536),T=l-B*65536,l=O+B+65535,B=Math.floor(l/65536),O=l-B*65536,l=$+B+65535,B=Math.floor(l/65536),$=l-B*65536,l=_t+B+65535,B=Math.floor(l/65536),_t=l-B*65536,l=X+B+65535,B=Math.floor(l/65536),X=l-B*65536,l=yt+B+65535,B=Math.floor(l/65536),yt=l-B*65536,l=gt+B+65535,B=Math.floor(l/65536),gt=l-B*65536,l=Mt+B+65535,B=Math.floor(l/65536),Mt=l-B*65536,l=Rt+B+65535,B=Math.floor(l/65536),Rt=l-B*65536,l=qt+B+65535,B=Math.floor(l/65536),qt=l-B*65536,l=zt+B+65535,B=Math.floor(l/65536),zt=l-B*65536,l=Tt+B+65535,B=Math.floor(l/65536),Tt=l-B*65536,l=Ct+B+65535,B=Math.floor(l/65536),Ct=l-B*65536,l=Pt+B+65535,B=Math.floor(l/65536),Pt=l-B*65536,l=mt+B+65535,B=Math.floor(l/65536),mt=l-B*65536,M+=B-1+37*(B-1),B=1,l=M+B+65535,B=Math.floor(l/65536),M=l-B*65536,l=T+B+65535,B=Math.floor(l/65536),T=l-B*65536,l=O+B+65535,B=Math.floor(l/65536),O=l-B*65536,l=$+B+65535,B=Math.floor(l/65536),$=l-B*65536,l=_t+B+65535,B=Math.floor(l/65536),_t=l-B*65536,l=X+B+65535,B=Math.floor(l/65536),X=l-B*65536,l=yt+B+65535,B=Math.floor(l/65536),yt=l-B*65536,l=gt+B+65535,B=Math.floor(l/65536),gt=l-B*65536,l=Mt+B+65535,B=Math.floor(l/65536),Mt=l-B*65536,l=Rt+B+65535,B=Math.floor(l/65536),Rt=l-B*65536,l=qt+B+65535,B=Math.floor(l/65536),qt=l-B*65536,l=zt+B+65535,B=Math.floor(l/65536),zt=l-B*65536,l=Tt+B+65535,B=Math.floor(l/65536),Tt=l-B*65536,l=Ct+B+65535,B=Math.floor(l/65536),Ct=l-B*65536,l=Pt+B+65535,B=Math.floor(l/65536),Pt=l-B*65536,l=mt+B+65535,B=Math.floor(l/65536),mt=l-B*65536,M+=B-1+37*(B-1),m[0]=M,m[1]=T,m[2]=O,m[3]=$,m[4]=_t,m[5]=X,m[6]=yt,m[7]=gt,m[8]=Mt,m[9]=Rt,m[10]=qt,m[11]=zt,m[12]=Tt,m[13]=Ct,m[14]=Pt,m[15]=mt}function U(m,S){R(m,S,S)}function W(m,S){var k=t(),l;for(l=0;l<16;l++)k[l]=S[l];for(l=253;l>=0;l--)U(k,k),l!==2&&l!==4&&R(k,k,S);for(l=0;l<16;l++)m[l]=k[l]}function tt(m,S){var k=t(),l;for(l=0;l<16;l++)k[l]=S[l];for(l=250;l>=0;l--)U(k,k),l!==1&&R(k,k,S);for(l=0;l<16;l++)m[l]=k[l]}function st(m,S,k){var l=new Uint8Array(32),B=new Float64Array(80),M,T,O=t(),$=t(),_t=t(),X=t(),yt=t(),gt=t();for(T=0;T<31;T++)l[T]=S[T];for(l[31]=S[31]&127|64,l[0]&=248,p(B,k),T=0;T<16;T++)$[T]=B[T],X[T]=O[T]=_t[T]=0;for(O[0]=X[0]=1,T=254;T>=0;--T)M=l[T>>>3]>>>(T&7)&1,c(O,$,M),c(_t,X,M),s(yt,O,_t),y(O,O,_t),s(_t,$,X),y($,$,X),U(X,yt),U(gt,O),R(O,_t,O),R(_t,$,yt),s(yt,O,_t),y(O,O,_t),U($,O),y(_t,X,gt),R(O,_t,x),s(O,O,X),R(_t,_t,O),R(O,X,gt),R(X,$,B),U($,yt),c(O,$,M),c(_t,X,M);for(T=0;T<16;T++)B[T+16]=O[T],B[T+32]=_t[T],B[T+48]=$[T],B[T+64]=X[T];var Mt=B.subarray(32),Rt=B.subarray(16);return W(Mt,Mt),R(Rt,Rt,Mt),d(m,Rt),0}function dt(m,S){return st(m,S,o)}function be(m,S){return e(S,32),dt(m,S)}function ht(m,S,k){var l=new Uint8Array(32);return st(l,k,S),rt(m,n,l,xt)}var Bt=g,Xe=i;function Ft(m,S,k,l,B,M){var T=new Uint8Array(32);return ht(T,B,M),Bt(m,S,k,l,T)}function Kt(m,S,k,l,B,M){var T=new Uint8Array(32);return ht(T,B,M),Xe(m,S,k,l,T)}var Ur=[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 ee(m,S,k,l){for(var B=new Int32Array(16),M=new Int32Array(16),T,O,$,_t,X,yt,gt,Mt,Rt,qt,zt,Tt,Ct,Pt,mt,Et,lt,wt,bt,ut,F,K,Q,Y,Z,nt,Ut=m[0],de=m[1],ye=m[2],pe=m[3],A=m[4],we=m[5],Se=m[6],Be=m[7],me=S[0],xe=S[1],ve=S[2],He=S[3],Le=S[4],qe=S[5],Fe=S[6],Ke=S[7],Ve=0;l>=128;){for(bt=0;bt<16;bt++)ut=8*bt+Ve,B[bt]=k[ut+0]<<24|k[ut+1]<<16|k[ut+2]<<8|k[ut+3],M[bt]=k[ut+4]<<24|k[ut+5]<<16|k[ut+6]<<8|k[ut+7];for(bt=0;bt<80;bt++)if(T=Ut,O=de,$=ye,_t=pe,X=A,yt=we,gt=Se,Mt=Be,Rt=me,qt=xe,zt=ve,Tt=He,Ct=Le,Pt=qe,mt=Fe,Et=Ke,F=Be,K=Ke,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=(A>>>14|Le<<32-14)^(A>>>18|Le<<32-18)^(Le>>>41-32|A<<32-(41-32)),K=(Le>>>14|A<<32-14)^(Le>>>18|A<<32-18)^(A>>>41-32|Le<<32-(41-32)),Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,F=A&we^~A&Se,K=Le&qe^~Le&Fe,Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,F=Ur[bt*2],K=Ur[bt*2+1],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,F=B[bt%16],K=M[bt%16],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,lt=Z&65535|nt<<16,wt=Q&65535|Y<<16,F=lt,K=wt,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=(Ut>>>28|me<<32-28)^(me>>>34-32|Ut<<32-(34-32))^(me>>>39-32|Ut<<32-(39-32)),K=(me>>>28|Ut<<32-28)^(Ut>>>34-32|me<<32-(34-32))^(Ut>>>39-32|me<<32-(39-32)),Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,F=Ut&de^Ut&ye^de&ye,K=me&xe^me&ve^xe&ve,Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,Mt=Z&65535|nt<<16,Et=Q&65535|Y<<16,F=_t,K=Tt,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=lt,K=wt,Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,_t=Z&65535|nt<<16,Tt=Q&65535|Y<<16,de=T,ye=O,pe=$,A=_t,we=X,Se=yt,Be=gt,Ut=Mt,xe=Rt,ve=qt,He=zt,Le=Tt,qe=Ct,Fe=Pt,Ke=mt,me=Et,bt%16===15)for(ut=0;ut<16;ut++)F=B[ut],K=M[ut],Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=B[(ut+9)%16],K=M[(ut+9)%16],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,lt=B[(ut+1)%16],wt=M[(ut+1)%16],F=(lt>>>1|wt<<32-1)^(lt>>>8|wt<<32-8)^lt>>>7,K=(wt>>>1|lt<<32-1)^(wt>>>8|lt<<32-8)^(wt>>>7|lt<<32-7),Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,lt=B[(ut+14)%16],wt=M[(ut+14)%16],F=(lt>>>19|wt<<32-19)^(wt>>>61-32|lt<<32-(61-32))^lt>>>6,K=(wt>>>19|lt<<32-19)^(lt>>>61-32|wt<<32-(61-32))^(wt>>>6|lt<<32-6),Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,B[ut]=Z&65535|nt<<16,M[ut]=Q&65535|Y<<16;F=Ut,K=me,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=m[0],K=S[0],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[0]=Ut=Z&65535|nt<<16,S[0]=me=Q&65535|Y<<16,F=de,K=xe,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=m[1],K=S[1],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[1]=de=Z&65535|nt<<16,S[1]=xe=Q&65535|Y<<16,F=ye,K=ve,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=m[2],K=S[2],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[2]=ye=Z&65535|nt<<16,S[2]=ve=Q&65535|Y<<16,F=pe,K=He,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=m[3],K=S[3],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[3]=pe=Z&65535|nt<<16,S[3]=He=Q&65535|Y<<16,F=A,K=Le,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=m[4],K=S[4],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[4]=A=Z&65535|nt<<16,S[4]=Le=Q&65535|Y<<16,F=we,K=qe,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=m[5],K=S[5],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[5]=we=Z&65535|nt<<16,S[5]=qe=Q&65535|Y<<16,F=Se,K=Fe,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=m[6],K=S[6],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[6]=Se=Z&65535|nt<<16,S[6]=Fe=Q&65535|Y<<16,F=Be,K=Ke,Q=K&65535,Y=K>>>16,Z=F&65535,nt=F>>>16,F=m[7],K=S[7],Q+=K&65535,Y+=K>>>16,Z+=F&65535,nt+=F>>>16,Y+=Q>>>16,Z+=Y>>>16,nt+=Z>>>16,m[7]=Be=Z&65535|nt<<16,S[7]=Ke=Q&65535|Y<<16,Ve+=128,l-=128}return l}function Nt(m,S,k){var l=new Int32Array(8),B=new Int32Array(8),M=new Uint8Array(256),T,O=k;for(l[0]=1779033703,l[1]=3144134277,l[2]=1013904242,l[3]=2773480762,l[4]=1359893119,l[5]=2600822924,l[6]=528734635,l[7]=1541459225,B[0]=4089235720,B[1]=2227873595,B[2]=4271175723,B[3]=1595750129,B[4]=2917565137,B[5]=725511199,B[6]=4215389547,B[7]=327033209,ee(l,B,S,k),k%=128,T=0;T=0;--B)l=k[B/8|0]>>(B&7)&1,Zt(m,S,l),kr(S,m),kr(m,m),Zt(m,S,l)}function Dt(m,S){var k=[t(),t(),t(),t()];a(k[0],_),a(k[1],I),a(k[2],h),R(k[3],_,I),br(m,k,S)}function $t(m,S,k){var l=new Uint8Array(64),B=[t(),t(),t(),t()],M;for(k||e(S,32),Nt(l,S,32),l[0]&=248,l[31]&=127,l[31]|=64,Dt(B,l),Ht(m,B),M=0;M<32;M++)S[M+32]=m[M];return 0}var xr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Vt(m,S){var k,l,B,M;for(l=63;l>=32;--l){for(k=0,B=l-32,M=l-12;B>4)*xr[B],k=S[B]>>8,S[B]&=255;for(B=0;B<32;B++)S[B]-=k*xr[B];for(l=0;l<32;l++)S[l+1]+=S[l]>>8,m[l]=S[l]&255}function jt(m){var S=new Float64Array(64),k;for(k=0;k<64;k++)S[k]=m[k];for(k=0;k<64;k++)m[k]=0;Vt(m,S)}function Or(m,S,k,l){var B=new Uint8Array(64),M=new Uint8Array(64),T=new Uint8Array(64),O,$,_t=new Float64Array(64),X=[t(),t(),t(),t()];Nt(B,l,32),B[0]&=248,B[31]&=127,B[31]|=64;var yt=k+64;for(O=0;O>7&&y(m[0],f,m[0]),R(m[3],m[0],m[1]),0)}function Jt(m,S,k,l){var B,M=new Uint8Array(32),T=new Uint8Array(64),O=[t(),t(),t(),t()],$=[t(),t(),t(),t()];if(k<64||ie($,l))return-1;for(B=0;B=0},r.sign.keyPair=function(){var m=new Uint8Array(Wt),S=new Uint8Array(Gt);return $t(m,S),{publicKey:m,secretKey:S}},r.sign.keyPair.fromSecretKey=function(m){if(It(m),m.length!==Gt)throw new Error("bad secret key size");for(var S=new Uint8Array(Wt),k=0;k{"use strict";Dm=H(V()),Oa=H(An());Tc();Na=H(Cc())});async function Nc({accessControlConditions:r,ciphertext:t,dataToEncryptHash:e,messageToSign:n}){let o=await yf({accessControlConditions:r,ciphertext:t,dataToEncryptHash:e});return Uc({messageToSign:n,privateKey:o})}var Vm,zc=le(()=>{"use strict";Vm=H(V());gf();Oc()});var Od=$e(()=>{var Jm=H(V());hf();zc();(async()=>cf(async()=>Nc({accessControlConditions,ciphertext,dataToEncryptHash,messageToSign})))()});Od();})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n *)\n\n@noble/hashes/esm/utils.js:\n (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/utils.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/modular.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/curve.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/edwards.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/ed25519.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\nsafe-buffer/index.js:\n (*! safe-buffer. MIT License. Feross Aboukhadijeh *)\n\n@solana/buffer-layout/lib/Layout.js:\n (**\n * Support for translating between Uint8Array instances and JavaScript\n * native types.\n *\n * {@link module:Layout~Layout|Layout} is the basis of a class\n * hierarchy that associates property names with sequences of encoded\n * bytes.\n *\n * Layouts are supported for these scalar (numeric) types:\n * * {@link module:Layout~UInt|Unsigned integers in little-endian\n * format} with {@link module:Layout.u8|8-bit}, {@link\n * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},\n * {@link module:Layout.u32|32-bit}, {@link\n * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}\n * representation ranges;\n * * {@link module:Layout~UIntBE|Unsigned integers in big-endian\n * format} with {@link module:Layout.u16be|16-bit}, {@link\n * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},\n * {@link module:Layout.u40be|40-bit}, and {@link\n * module:Layout.u48be|48-bit} representation ranges;\n * * {@link module:Layout~Int|Signed integers in little-endian\n * format} with {@link module:Layout.s8|8-bit}, {@link\n * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},\n * {@link module:Layout.s32|32-bit}, {@link\n * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}\n * representation ranges;\n * * {@link module:Layout~IntBE|Signed integers in big-endian format}\n * with {@link module:Layout.s16be|16-bit}, {@link\n * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},\n * {@link module:Layout.s40be|40-bit}, and {@link\n * module:Layout.s48be|48-bit} representation ranges;\n * * 64-bit integral values that decode to an exact (if magnitude is\n * less than 2^53) or nearby integral Number in {@link\n * module:Layout.nu64|unsigned little-endian}, {@link\n * module:Layout.nu64be|unsigned big-endian}, {@link\n * module:Layout.ns64|signed little-endian}, and {@link\n * module:Layout.ns64be|unsigned big-endian} encodings;\n * * 32-bit floating point values with {@link\n * module:Layout.f32|little-endian} and {@link\n * module:Layout.f32be|big-endian} representations;\n * * 64-bit floating point values with {@link\n * module:Layout.f64|little-endian} and {@link\n * module:Layout.f64be|big-endian} representations;\n * * {@link module:Layout.const|Constants} that take no space in the\n * encoded expression.\n *\n * and for these aggregate types:\n * * {@link module:Layout.seq|Sequence}s of instances of a {@link\n * module:Layout~Layout|Layout}, with JavaScript representation as\n * an Array and constant or data-dependent {@link\n * module:Layout~Sequence#count|length};\n * * {@link module:Layout.struct|Structure}s that aggregate a\n * heterogeneous sequence of {@link module:Layout~Layout|Layout}\n * instances, with JavaScript representation as an Object;\n * * {@link module:Layout.union|Union}s that support multiple {@link\n * module:Layout~VariantLayout|variant layouts} over a fixed\n * (padded) or variable (not padded) span of bytes, using an\n * unsigned integer at the start of the data or a separate {@link\n * module:Layout.unionLayoutDiscriminator|layout element} to\n * determine which layout to use when interpreting the buffer\n * contents;\n * * {@link module:Layout.bits|BitStructure}s that contain a sequence\n * of individual {@link\n * module:Layout~BitStructure#addField|BitField}s packed into an 8,\n * 16, 24, or 32-bit unsigned integer starting at the least- or\n * most-significant bit;\n * * {@link module:Layout.cstr|C strings} of varying length;\n * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link\n * module:Layout~Blob#length|length} raw data.\n *\n * All {@link module:Layout~Layout|Layout} instances are immutable\n * after construction, to prevent internal state from becoming\n * inconsistent.\n *\n * @local Layout\n * @local ExternalLayout\n * @local GreedyCount\n * @local OffsetLayout\n * @local UInt\n * @local UIntBE\n * @local Int\n * @local IntBE\n * @local NearUInt64\n * @local NearUInt64BE\n * @local NearInt64\n * @local NearInt64BE\n * @local Float\n * @local FloatBE\n * @local Double\n * @local DoubleBE\n * @local Sequence\n * @local Structure\n * @local UnionDiscriminator\n * @local UnionLayoutDiscriminator\n * @local Union\n * @local VariantLayout\n * @local BitStructure\n * @local BitField\n * @local Boolean\n * @local Blob\n * @local CString\n * @local Constant\n * @local bindConstructorLayout\n * @module Layout\n * @license MIT\n * @author Peter A. Bigot\n * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}\n *)\n\n@noble/curves/esm/abstract/weierstrass.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/_shortw_utils.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/secp256k1.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n*/\n'; + module2.exports = { + code: code9 + }; + } +}); + +// packages/wrapped-keys-lit-actions/src/generated/solana/signTransactionWithEncryptedSolanaKey.js +var require_signTransactionWithEncryptedSolanaKey = __commonJS({ + "packages/wrapped-keys-lit-actions/src/generated/solana/signTransactionWithEncryptedSolanaKey.js"(exports, module2) { + "use strict"; + init_shim(); + var code9 = '"use strict";(()=>{var Vf=Object.create;var zi=Object.defineProperty;var Gf=Object.getOwnPropertyDescriptor;var Zf=Object.getOwnPropertyNames;var jf=Object.getPrototypeOf,Yf=Object.prototype.hasOwnProperty;var vt=(n,t)=>()=>(n&&(t=n(n=0)),t);var fe=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Pa=(n,t)=>{for(var e in t)zi(n,e,{get:t[e],enumerable:!0})},Ca=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Zf(t))!Yf.call(n,i)&&i!==e&&zi(n,i,{get:()=>t[i],enumerable:!(r=Gf(t,i))||r.enumerable});return n};var C=(n,t,e)=>(e=n!=null?Vf(jf(n)):{},Ca(t||!n||!n.__esModule?zi(e,"default",{value:n,enumerable:!0}):e,n)),Oa=n=>Ca(zi({},"__esModule",{value:!0}),n);var za=fe(qi=>{"use strict";var Vp=C(N());qi.byteLength=Xf;qi.toByteArray=th;qi.fromByteArray=nh;var He=[],Pe=[],Jf=typeof Uint8Array<"u"?Uint8Array:Array,Yo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(nn=0,Ua=Yo.length;nn0)throw new Error("Invalid string. Length must be a multiple of 4");var e=n.indexOf("=");e===-1&&(e=t);var r=e===t?0:4-e%4;return[e,r]}function Xf(n){var t=Na(n),e=t[0],r=t[1];return(e+r)*3/4-r}function Qf(n,t,e){return(t+e)*3/4-e}function th(n){var t,e=Na(n),r=e[0],i=e[1],s=new Jf(Qf(n,r,i)),c=0,p=i>0?r-4:r,y;for(y=0;y>16&255,s[c++]=t>>8&255,s[c++]=t&255;return i===2&&(t=Pe[n.charCodeAt(y)]<<2|Pe[n.charCodeAt(y+1)]>>4,s[c++]=t&255),i===1&&(t=Pe[n.charCodeAt(y)]<<10|Pe[n.charCodeAt(y+1)]<<4|Pe[n.charCodeAt(y+2)]>>2,s[c++]=t>>8&255,s[c++]=t&255),s}function eh(n){return He[n>>18&63]+He[n>>12&63]+He[n>>6&63]+He[n&63]}function rh(n,t,e){for(var r,i=[],s=t;sp?p:c+s));return r===1?(t=n[e-1],i.push(He[t>>2]+He[t<<4&63]+"==")):r===2&&(t=(n[e-2]<<8)+n[e-1],i.push(He[t>>10]+He[t>>4&63]+He[t<<2&63]+"=")),i.join("")}});var qa=fe(Jo=>{var Zp=C(N());Jo.read=function(n,t,e,r,i){var s,c,p=i*8-r-1,y=(1<>1,x=-7,k=e?i-1:0,_=e?-1:1,B=n[t+k];for(k+=_,s=B&(1<<-x)-1,B>>=-x,x+=p;x>0;s=s*256+n[t+k],k+=_,x-=8);for(c=s&(1<<-x)-1,s>>=-x,x+=r;x>0;c=c*256+n[t+k],k+=_,x-=8);if(s===0)s=1-v;else{if(s===y)return c?NaN:(B?-1:1)*(1/0);c=c+Math.pow(2,r),s=s-v}return(B?-1:1)*c*Math.pow(2,s-r)};Jo.write=function(n,t,e,r,i,s){var c,p,y,v=s*8-i-1,x=(1<>1,_=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,B=r?0:s-1,P=r?1:-1,I=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(p=isNaN(t)?1:0,c=x):(c=Math.floor(Math.log(t)/Math.LN2),t*(y=Math.pow(2,-c))<1&&(c--,y*=2),c+k>=1?t+=_/y:t+=_*Math.pow(2,1-k),t*y>=2&&(c++,y/=2),c+k>=x?(p=0,c=x):c+k>=1?(p=(t*y-1)*Math.pow(2,i),c=c+k):(p=t*Math.pow(2,k-1)*Math.pow(2,i),c=0));i>=8;n[e+B]=p&255,B+=P,p/=256,i-=8);for(c=c<0;n[e+B]=c&255,B+=P,c/=256,v-=8);n[e+B-P]|=I*128}});var Mn=fe(An=>{"use strict";var Jp=C(N());var Xo=za(),_n=qa(),Fa=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;An.Buffer=U;An.SlowBuffer=ch;An.INSPECT_MAX_BYTES=50;var Fi=2147483647;An.kMaxLength=Fi;U.TYPED_ARRAY_SUPPORT=ih();!U.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ih(){try{let n=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(n,t),n.foo()===42}catch{return!1}}Object.defineProperty(U.prototype,"parent",{enumerable:!0,get:function(){if(U.isBuffer(this))return this.buffer}});Object.defineProperty(U.prototype,"offset",{enumerable:!0,get:function(){if(U.isBuffer(this))return this.byteOffset}});function Xe(n){if(n>Fi)throw new RangeError(\'The value "\'+n+\'" is invalid for option "size"\');let t=new Uint8Array(n);return Object.setPrototypeOf(t,U.prototype),t}function U(n,t,e){if(typeof n=="number"){if(typeof t=="string")throw new TypeError(\'The "string" argument must be of type string. Received type number\');return rs(n)}return Ha(n,t,e)}U.poolSize=8192;function Ha(n,t,e){if(typeof n=="string")return sh(n,t);if(ArrayBuffer.isView(n))return ah(n);if(n==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n);if($e(n,ArrayBuffer)||n&&$e(n.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($e(n,SharedArrayBuffer)||n&&$e(n.buffer,SharedArrayBuffer)))return ts(n,t,e);if(typeof n=="number")throw new TypeError(\'The "value" argument must not be of type number. Received type number\');let r=n.valueOf&&n.valueOf();if(r!=null&&r!==n)return U.from(r,t,e);let i=uh(n);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof n[Symbol.toPrimitive]=="function")return U.from(n[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n)}U.from=function(n,t,e){return Ha(n,t,e)};Object.setPrototypeOf(U.prototype,Uint8Array.prototype);Object.setPrototypeOf(U,Uint8Array);function $a(n){if(typeof n!="number")throw new TypeError(\'"size" argument must be of type number\');if(n<0)throw new RangeError(\'The value "\'+n+\'" is invalid for option "size"\')}function oh(n,t,e){return $a(n),n<=0?Xe(n):t!==void 0?typeof e=="string"?Xe(n).fill(t,e):Xe(n).fill(t):Xe(n)}U.alloc=function(n,t,e){return oh(n,t,e)};function rs(n){return $a(n),Xe(n<0?0:ns(n)|0)}U.allocUnsafe=function(n){return rs(n)};U.allocUnsafeSlow=function(n){return rs(n)};function sh(n,t){if((typeof t!="string"||t==="")&&(t="utf8"),!U.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=Va(n,t)|0,r=Xe(e),i=r.write(n,t);return i!==e&&(r=r.slice(0,i)),r}function Qo(n){let t=n.length<0?0:ns(n.length)|0,e=Xe(t);for(let r=0;r=Fi)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Fi.toString(16)+" bytes");return n|0}function ch(n){return+n!=n&&(n=0),U.alloc(+n)}U.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==U.prototype};U.compare=function(t,e){if($e(t,Uint8Array)&&(t=U.from(t,t.offset,t.byteLength)),$e(e,Uint8Array)&&(e=U.from(e,e.offset,e.byteLength)),!U.isBuffer(t)||!U.isBuffer(e))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(t===e)return 0;let r=t.length,i=e.length;for(let s=0,c=Math.min(r,i);si.length?(U.isBuffer(c)||(c=U.from(c)),c.copy(i,s)):Uint8Array.prototype.set.call(i,c,s);else if(U.isBuffer(c))c.copy(i,s);else throw new TypeError(\'"list" argument must be an Array of Buffers\');s+=c.length}return i};function Va(n,t){if(U.isBuffer(n))return n.length;if(ArrayBuffer.isView(n)||$e(n,ArrayBuffer))return n.byteLength;if(typeof n!="string")throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof n);let e=n.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&e===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return es(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return eu(n).length;default:if(i)return r?-1:es(n).length;t=(""+t).toLowerCase(),i=!0}}U.byteLength=Va;function fh(n,t,e){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return vh(this,t,e);case"utf8":case"utf-8":return Za(this,t,e);case"ascii":return wh(this,t,e);case"latin1":case"binary":return bh(this,t,e);case"base64":return gh(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xh(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}U.prototype._isBuffer=!0;function on(n,t,e){let r=n[t];n[t]=n[e],n[e]=r}U.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;ee&&(t+=" ... "),""};Fa&&(U.prototype[Fa]=U.prototype.inspect);U.prototype.compare=function(t,e,r,i,s){if($e(t,Uint8Array)&&(t=U.from(t,t.offset,t.byteLength)),!U.isBuffer(t))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof t);if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||r>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=r)return 0;if(i>=s)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,s>>>=0,this===t)return 0;let c=s-i,p=r-e,y=Math.min(c,p),v=this.slice(i,s),x=t.slice(e,r);for(let k=0;k2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,os(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=U.from(t,r)),U.isBuffer(t))return t.length===0?-1:Ka(n,t,e,r,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):Ka(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function Ka(n,t,e,r,i){let s=1,c=n.length,p=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;s=2,c/=2,p/=2,e/=2}function y(x,k){return s===1?x[k]:x.readUInt16BE(k*s)}let v;if(i){let x=-1;for(v=e;vc&&(e=c-p),v=e;v>=0;v--){let x=!0;for(let k=0;ki&&(r=i)):r=i;let s=t.length;r>s/2&&(r=s/2);let c;for(c=0;c>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-e;if((r===void 0||r>s)&&(r=s),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let c=!1;for(;;)switch(i){case"hex":return hh(this,t,e,r);case"utf8":case"utf-8":return lh(this,t,e,r);case"ascii":case"latin1":case"binary":return dh(this,t,e,r);case"base64":return ph(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yh(this,t,e,r);default:if(c)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),c=!0}};U.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function gh(n,t,e){return t===0&&e===n.length?Xo.fromByteArray(n):Xo.fromByteArray(n.slice(t,e))}function Za(n,t,e){e=Math.min(n.length,e);let r=[],i=t;for(;i239?4:s>223?3:s>191?2:1;if(i+p<=e){let y,v,x,k;switch(p){case 1:s<128&&(c=s);break;case 2:y=n[i+1],(y&192)===128&&(k=(s&31)<<6|y&63,k>127&&(c=k));break;case 3:y=n[i+1],v=n[i+2],(y&192)===128&&(v&192)===128&&(k=(s&15)<<12|(y&63)<<6|v&63,k>2047&&(k<55296||k>57343)&&(c=k));break;case 4:y=n[i+1],v=n[i+2],x=n[i+3],(y&192)===128&&(v&192)===128&&(x&192)===128&&(k=(s&15)<<18|(y&63)<<12|(v&63)<<6|x&63,k>65535&&k<1114112&&(c=k))}}c===null?(c=65533,p=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|c&1023),r.push(c),i+=p}return mh(r)}var Da=4096;function mh(n){let t=n.length;if(t<=Da)return String.fromCharCode.apply(String,n);let e="",r=0;for(;rr)&&(e=r);let i="";for(let s=t;sr&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),ee)throw new RangeError("Trying to access beyond buffer length")}U.prototype.readUintLE=U.prototype.readUIntLE=function(t,e,r){t=t>>>0,e=e>>>0,r||le(t,e,this.length);let i=this[t],s=1,c=0;for(;++c>>0,e=e>>>0,r||le(t,e,this.length);let i=this[t+--e],s=1;for(;e>0&&(s*=256);)i+=this[t+--e]*s;return i};U.prototype.readUint8=U.prototype.readUInt8=function(t,e){return t=t>>>0,e||le(t,1,this.length),this[t]};U.prototype.readUint16LE=U.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||le(t,2,this.length),this[t]|this[t+1]<<8};U.prototype.readUint16BE=U.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||le(t,2,this.length),this[t]<<8|this[t+1]};U.prototype.readUint32LE=U.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||le(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};U.prototype.readUint32BE=U.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||le(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};U.prototype.readBigUInt64LE=lr(function(t){t=t>>>0,In(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&ai(t,this.length-8);let i=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+r*2**24;return BigInt(i)+(BigInt(s)<>>0,In(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&ai(t,this.length-8);let i=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+r;return(BigInt(i)<>>0,e=e>>>0,r||le(t,e,this.length);let i=this[t],s=1,c=0;for(;++c=s&&(i-=Math.pow(2,8*e)),i};U.prototype.readIntBE=function(t,e,r){t=t>>>0,e=e>>>0,r||le(t,e,this.length);let i=e,s=1,c=this[t+--i];for(;i>0&&(s*=256);)c+=this[t+--i]*s;return s*=128,c>=s&&(c-=Math.pow(2,8*e)),c};U.prototype.readInt8=function(t,e){return t=t>>>0,e||le(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};U.prototype.readInt16LE=function(t,e){t=t>>>0,e||le(t,2,this.length);let r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};U.prototype.readInt16BE=function(t,e){t=t>>>0,e||le(t,2,this.length);let r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};U.prototype.readInt32LE=function(t,e){return t=t>>>0,e||le(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};U.prototype.readInt32BE=function(t,e){return t=t>>>0,e||le(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};U.prototype.readBigInt64LE=lr(function(t){t=t>>>0,In(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&ai(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(r<<24);return(BigInt(i)<>>0,In(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&ai(t,this.length-8);let i=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<>>0,e||le(t,4,this.length),_n.read(this,t,!0,23,4)};U.prototype.readFloatBE=function(t,e){return t=t>>>0,e||le(t,4,this.length),_n.read(this,t,!1,23,4)};U.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||le(t,8,this.length),_n.read(this,t,!0,52,8)};U.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||le(t,8,this.length),_n.read(this,t,!1,52,8)};function Ae(n,t,e,r,i,s){if(!U.isBuffer(n))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(t>i||tn.length)throw new RangeError("Index out of range")}U.prototype.writeUintLE=U.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e>>>0,r=r>>>0,!i){let p=Math.pow(2,8*r)-1;Ae(this,t,e,r,p,0)}let s=1,c=0;for(this[e]=t&255;++c>>0,r=r>>>0,!i){let p=Math.pow(2,8*r)-1;Ae(this,t,e,r,p,0)}let s=r-1,c=1;for(this[e+s]=t&255;--s>=0&&(c*=256);)this[e+s]=t/c&255;return e+r};U.prototype.writeUint8=U.prototype.writeUInt8=function(t,e,r){return t=+t,e=e>>>0,r||Ae(this,t,e,1,255,0),this[e]=t&255,e+1};U.prototype.writeUint16LE=U.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e>>>0,r||Ae(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};U.prototype.writeUint16BE=U.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e>>>0,r||Ae(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};U.prototype.writeUint32LE=U.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e>>>0,r||Ae(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};U.prototype.writeUint32BE=U.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e>>>0,r||Ae(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function ja(n,t,e,r,i){tu(t,r,i,n,e,7);let s=Number(t&BigInt(4294967295));n[e++]=s,s=s>>8,n[e++]=s,s=s>>8,n[e++]=s,s=s>>8,n[e++]=s;let c=Number(t>>BigInt(32)&BigInt(4294967295));return n[e++]=c,c=c>>8,n[e++]=c,c=c>>8,n[e++]=c,c=c>>8,n[e++]=c,e}function Ya(n,t,e,r,i){tu(t,r,i,n,e,7);let s=Number(t&BigInt(4294967295));n[e+7]=s,s=s>>8,n[e+6]=s,s=s>>8,n[e+5]=s,s=s>>8,n[e+4]=s;let c=Number(t>>BigInt(32)&BigInt(4294967295));return n[e+3]=c,c=c>>8,n[e+2]=c,c=c>>8,n[e+1]=c,c=c>>8,n[e]=c,e+8}U.prototype.writeBigUInt64LE=lr(function(t,e=0){return ja(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});U.prototype.writeBigUInt64BE=lr(function(t,e=0){return Ya(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});U.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e>>>0,!i){let y=Math.pow(2,8*r-1);Ae(this,t,e,r,y-1,-y)}let s=0,c=1,p=0;for(this[e]=t&255;++s>0)-p&255;return e+r};U.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e>>>0,!i){let y=Math.pow(2,8*r-1);Ae(this,t,e,r,y-1,-y)}let s=r-1,c=1,p=0;for(this[e+s]=t&255;--s>=0&&(c*=256);)t<0&&p===0&&this[e+s+1]!==0&&(p=1),this[e+s]=(t/c>>0)-p&255;return e+r};U.prototype.writeInt8=function(t,e,r){return t=+t,e=e>>>0,r||Ae(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};U.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e>>>0,r||Ae(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};U.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e>>>0,r||Ae(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};U.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e>>>0,r||Ae(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};U.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e>>>0,r||Ae(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};U.prototype.writeBigInt64LE=lr(function(t,e=0){return ja(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});U.prototype.writeBigInt64BE=lr(function(t,e=0){return Ya(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ja(n,t,e,r,i,s){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Xa(n,t,e,r,i){return t=+t,e=e>>>0,i||Ja(n,t,e,4,34028234663852886e22,-34028234663852886e22),_n.write(n,t,e,r,23,4),e+4}U.prototype.writeFloatLE=function(t,e,r){return Xa(this,t,e,!0,r)};U.prototype.writeFloatBE=function(t,e,r){return Xa(this,t,e,!1,r)};function Qa(n,t,e,r,i){return t=+t,e=e>>>0,i||Ja(n,t,e,8,17976931348623157e292,-17976931348623157e292),_n.write(n,t,e,r,52,8),e+8}U.prototype.writeDoubleLE=function(t,e,r){return Qa(this,t,e,!0,r)};U.prototype.writeDoubleBE=function(t,e,r){return Qa(this,t,e,!1,r)};U.prototype.copy=function(t,e,r,i){if(!U.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e>>0,r=r===void 0?this.length:r>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s2**32?i=Wa(String(e)):typeof e=="bigint"&&(i=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(i=Wa(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r},RangeError);function Wa(n){let t="",e=n.length,r=n[0]==="-"?1:0;for(;e>=r+4;e-=3)t=`_${n.slice(e-3,e)}${t}`;return`${n.slice(0,e)}${t}`}function kh(n,t,e){In(t,"offset"),(n[t]===void 0||n[t+e]===void 0)&&ai(t,n.length-(e+1))}function tu(n,t,e,r,i,s){if(n>e||n3?t===0||t===BigInt(0)?p=`>= 0${c} and < 2${c} ** ${(s+1)*8}${c}`:p=`>= -(2${c} ** ${(s+1)*8-1}${c}) and < 2 ** ${(s+1)*8-1}${c}`:p=`>= ${t}${c} and <= ${e}${c}`,new En.ERR_OUT_OF_RANGE("value",p,n)}kh(r,i,s)}function In(n,t){if(typeof n!="number")throw new En.ERR_INVALID_ARG_TYPE(t,"number",n)}function ai(n,t,e){throw Math.floor(n)!==n?(In(n,e),new En.ERR_OUT_OF_RANGE(e||"offset","an integer",n)):t<0?new En.ERR_BUFFER_OUT_OF_BOUNDS:new En.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,n)}var Sh=/[^+/0-9A-Za-z-_]/g;function Bh(n){if(n=n.split("=")[0],n=n.trim().replace(Sh,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function es(n,t){t=t||1/0;let e,r=n.length,i=null,s=[];for(let c=0;c55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(c+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function Eh(n){let t=[];for(let e=0;e>8,i=e%256,s.push(i),s.push(r);return s}function eu(n){return Xo.toByteArray(Bh(n))}function Ki(n,t,e,r){let i;for(i=0;i=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function $e(n,t){return n instanceof t||n!=null&&n.constructor!=null&&n.constructor.name!=null&&n.constructor.name===t.name}function os(n){return n!==n}var Ih=function(){let n="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let r=e*16;for(let i=0;i<16;++i)t[r+i]=n[e]+n[i]}return t}();function lr(n){return typeof BigInt>"u"?Ah:n}function Ah(){throw new Error("BigInt not supported")}});var N=fe(()=>{"use strict";var ru=C(Mn());globalThis.Buffer=ru.Buffer});var ey,Ln,ss=vt(()=>{"use strict";ey=C(N()),Ln=class extends Error{constructor(){super(...arguments);this.name="AbortError"}}});async function nu(n){try{let t=await n(),e=typeof t=="string"?t:JSON.stringify(t);Lit.Actions.setResponse({response:e})}catch(t){if(t instanceof Ln)return;Lit.Actions.setResponse({response:`Error: ${t.message}`})}}var iy,iu=vt(()=>{"use strict";iy=C(N());ss()});var sy,Di,ou=vt(()=>{"use strict";sy=C(N()),Di="lit_"});function su(n){if(!n.startsWith(Di))throw new Error(`PKey was not encrypted with salt; all wrapped keys must be prefixed with \'${Di}\'`);return n.slice(Di.length)}var cy,au=vt(()=>{"use strict";cy=C(N());ou()});async function Mh({accessControlConditions:n,ciphertext:t,dataToEncryptHash:e}){try{return await Lit.Actions.decryptToSingleNode({accessControlConditions:n,ciphertext:t,dataToEncryptHash:e,chain:"ethereum",authSig:null})}catch(r){throw new Error(`When decrypting key to a single node - ${r.message}`)}}async function uu({accessControlConditions:n,ciphertext:t,dataToEncryptHash:e}){let r=await Mh({accessControlConditions:n,ciphertext:t,dataToEncryptHash:e});if(!r)throw new Ln;return su(r)}var dy,cu=vt(()=>{"use strict";dy=C(N());ss();au()});function ui(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`positive integer expected, not ${n}`)}function Lh(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function dr(n,...t){if(!Lh(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${n.length}`)}function fu(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ui(n.outputLen),ui(n.blockLen)}function Qe(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function Wi(n,t){dr(n);let e=t.outputLen;if(n.length{yy=C(N(),1)});var my,sn,hu=vt(()=>{my=C(N(),1),sn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function us(n){for(let t=0;tn().update(yr(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function pu(n){let t=(r,i)=>n(i).update(yr(r)).digest(),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}function $i(n=32){if(sn&&typeof sn.getRandomValues=="function")return sn.getRandomValues(new Uint8Array(n));if(sn&&typeof sn.randomBytes=="function")return sn.randomBytes(n);throw new Error("crypto.getRandomValues must be defined")}var ky,lu,Hi,qe,as,Rh,pr,vy,gr=vt(()=>{ky=C(N(),1);hu();ci();lu=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),Hi=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),qe=(n,t)=>n<<32-t|n>>>t,as=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Rh=n=>n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255;pr=class{clone(){return this._cloneInto()}},vy={}.toString});function Th(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);let i=BigInt(32),s=BigInt(4294967295),c=Number(e>>i&s),p=Number(e&s),y=r?4:0,v=r?0:4;n.setUint32(t+y,c,r),n.setUint32(t+v,p,r)}var _y,yu,gu,Tn,fs=vt(()=>{_y=C(N(),1);ci();gr();yu=(n,t,e)=>n&t^~n&e,gu=(n,t,e)=>n&t^n&e^t&e,Tn=class extends pr{constructor(t,e,r,i){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Hi(this.buffer)}update(t){Qe(this);let{view:e,buffer:r,blockLen:i}=this;t=yr(t);let s=t.length;for(let c=0;ci-c&&(this.process(r,0),c=0);for(let k=c;kx.length)throw new Error("_sha2: outputLen bigger than state");for(let k=0;k>hs&Vi)}:{h:Number(n>>hs&Vi)|0,l:Number(n&Vi)|0}}function ls(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let i=0;i>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:i|0}}var Ay,Vi,hs,Ph,Ch,Oh,Uh,Nh,zh,qh,Fh,Kh,ds,ps,ys,gs,Wh,Hh,$h,Vh,Gh,Zh,jh,Wt,ms=vt(()=>{Ay=C(N(),1),Vi=BigInt(4294967295),hs=BigInt(32);Ph=(n,t)=>BigInt(n>>>0)<>>0),Ch=(n,t,e)=>n>>>e,Oh=(n,t,e)=>n<<32-e|t>>>e,Uh=(n,t,e)=>n>>>e|t<<32-e,Nh=(n,t,e)=>n<<32-e|t>>>e,zh=(n,t,e)=>n<<64-e|t>>>e-32,qh=(n,t,e)=>n>>>e-32|t<<64-e,Fh=(n,t)=>t,Kh=(n,t)=>n,ds=(n,t,e)=>n<>>32-e,ps=(n,t,e)=>t<>>32-e,ys=(n,t,e)=>t<>>64-e,gs=(n,t,e)=>n<>>64-e;Wh=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Hh=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,$h=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),Vh=(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,Gh=(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),Zh=(n,t,e,r,i,s)=>t+e+r+i+s+(n/2**32|0)|0,jh={fromBig:mu,split:ls,toBig:Ph,shrSH:Ch,shrSL:Oh,rotrSH:Uh,rotrSL:Nh,rotrBH:zh,rotrBL:qh,rotr32H:Fh,rotr32L:Kh,rotlSH:ds,rotlSL:ps,rotlBH:ys,rotlBL:gs,add:Dh,add3L:Wh,add3H:Hh,add4L:$h,add4H:Vh,add5H:Zh,add5L:Gh},Wt=jh});var Py,Yh,Jh,mr,wr,ws,wu,bu=vt(()=>{Py=C(N(),1);fs();ms();gr();[Yh,Jh]=(()=>Wt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))))(),mr=new Uint32Array(80),wr=new Uint32Array(80),ws=class extends Tn{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:r,Bl:i,Ch:s,Cl:c,Dh:p,Dl:y,Eh:v,El:x,Fh:k,Fl:_,Gh:B,Gl:P,Hh:I,Hl:E}=this;return[t,e,r,i,s,c,p,y,v,x,k,_,B,P,I,E]}set(t,e,r,i,s,c,p,y,v,x,k,_,B,P,I,E){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=c|0,this.Dh=p|0,this.Dl=y|0,this.Eh=v|0,this.El=x|0,this.Fh=k|0,this.Fl=_|0,this.Gh=B|0,this.Gl=P|0,this.Hh=I|0,this.Hl=E|0}process(t,e){for(let z=0;z<16;z++,e+=4)mr[z]=t.getUint32(e),wr[z]=t.getUint32(e+=4);for(let z=16;z<80;z++){let D=mr[z-15]|0,et=wr[z-15]|0,W=Wt.rotrSH(D,et,1)^Wt.rotrSH(D,et,8)^Wt.shrSH(D,et,7),J=Wt.rotrSL(D,et,1)^Wt.rotrSL(D,et,8)^Wt.shrSL(D,et,7),Q=mr[z-2]|0,nt=wr[z-2]|0,te=Wt.rotrSH(Q,nt,19)^Wt.rotrBH(Q,nt,61)^Wt.shrSH(Q,nt,6),G=Wt.rotrSL(Q,nt,19)^Wt.rotrBL(Q,nt,61)^Wt.shrSL(Q,nt,6),st=Wt.add4L(J,G,wr[z-7],wr[z-16]),m=Wt.add4H(st,W,te,mr[z-7],mr[z-16]);mr[z]=m|0,wr[z]=st|0}let{Ah:r,Al:i,Bh:s,Bl:c,Ch:p,Cl:y,Dh:v,Dl:x,Eh:k,El:_,Fh:B,Fl:P,Gh:I,Gl:E,Hh:O,Hl:K}=this;for(let z=0;z<80;z++){let D=Wt.rotrSH(k,_,14)^Wt.rotrSH(k,_,18)^Wt.rotrBH(k,_,41),et=Wt.rotrSL(k,_,14)^Wt.rotrSL(k,_,18)^Wt.rotrBL(k,_,41),W=k&B^~k&I,J=_&P^~_&E,Q=Wt.add5L(K,et,J,Jh[z],wr[z]),nt=Wt.add5H(Q,O,D,W,Yh[z],mr[z]),te=Q|0,G=Wt.rotrSH(r,i,28)^Wt.rotrBH(r,i,34)^Wt.rotrBH(r,i,39),st=Wt.rotrSL(r,i,28)^Wt.rotrBL(r,i,34)^Wt.rotrBL(r,i,39),m=r&s^r&p^s&p,o=i&c^i&y^c&y;O=I|0,K=E|0,I=B|0,E=P|0,B=k|0,P=_|0,{h:k,l:_}=Wt.add(v|0,x|0,nt|0,te|0),v=p|0,x=y|0,p=s|0,y=c|0,s=r|0,c=i|0;let u=Wt.add3L(te,st,o);r=Wt.add3H(u,nt,G,m),i=u|0}({h:r,l:i}=Wt.add(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:c}=Wt.add(this.Bh|0,this.Bl|0,s|0,c|0),{h:p,l:y}=Wt.add(this.Ch|0,this.Cl|0,p|0,y|0),{h:v,l:x}=Wt.add(this.Dh|0,this.Dl|0,v|0,x|0),{h:k,l:_}=Wt.add(this.Eh|0,this.El|0,k|0,_|0),{h:B,l:P}=Wt.add(this.Fh|0,this.Fl|0,B|0,P|0),{h:I,l:E}=Wt.add(this.Gh|0,this.Gl|0,I|0,E|0),{h:O,l:K}=Wt.add(this.Hh|0,this.Hl|0,O|0,K|0),this.set(r,i,s,c,p,y,v,x,k,_,B,P,I,E,O,K)}roundClean(){mr.fill(0),wr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},wu=Rn(()=>new ws)});var Zi={};Pa(Zi,{aInRange:()=>Me,abool:()=>Fe,abytes:()=>Pn,bitGet:()=>nl,bitLen:()=>Ss,bitMask:()=>hi,bitSet:()=>il,bytesToHex:()=>er,bytesToNumberBE:()=>rr,bytesToNumberLE:()=>vr,concatBytes:()=>nr,createHmacDrbg:()=>Bs,ensureBytes:()=>ue,equalBytes:()=>el,hexToBytes:()=>un,hexToNumber:()=>ks,inRange:()=>fi,isBytes:()=>br,memoized:()=>fn,notImplemented:()=>sl,numberToBytesBE:()=>xr,numberToBytesLE:()=>cn,numberToHexUnpadded:()=>an,numberToVarBytesBE:()=>tl,utf8ToBytes:()=>rl,validateObject:()=>Ve});function br(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function Pn(n){if(!br(n))throw new Error("Uint8Array expected")}function Fe(n,t){if(typeof t!="boolean")throw new Error(`${n} must be valid boolean, got "${t}".`)}function er(n){Pn(n);let t="";for(let e=0;e=tr._0&&n<=tr._9)return n-tr._0;if(n>=tr._A&&n<=tr._F)return n-(tr._A-10);if(n>=tr._a&&n<=tr._f)return n-(tr._a-10)}function un(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);let t=n.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(e);for(let i=0,s=0;ixs;n>>=Gi,t+=1);return t}function nl(n,t){return n>>BigInt(t)&Gi}function il(n,t,e){return n|(e?Gi:xs)<{r.fill(1),i.fill(0),s=0},p=(...k)=>e(i,r,...k),y=(k=vs())=>{i=p(xu([0]),k),r=p(),k.length!==0&&(i=p(xu([1]),k),r=p())},v=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let k=0,_=[];for(;k{c(),y(k);let B;for(;!(B=_(v()));)y();return c(),B}}function Ve(n,t,e={}){let r=(i,s,c)=>{let p=ol[s];if(typeof p!="function")throw new Error(`Invalid validator "${s}", expected function`);let y=n[i];if(!(c&&y===void 0)&&!p(y,n))throw new Error(`Invalid param ${String(i)}=${y} (${typeof y}), expected ${s}`)};for(let[i,s]of Object.entries(t))r(i,s,!1);for(let[i,s]of Object.entries(e))r(i,s,!0);return n}function fn(n){let t=new WeakMap;return(e,...r)=>{let i=t.get(e);if(i!==void 0)return i;let s=n(e,...r);return t.set(e,s),s}}var Cy,xs,Gi,Xh,Qh,tr,bs,hi,vs,xu,ol,sl,hn=vt(()=>{Cy=C(N(),1);xs=BigInt(0),Gi=BigInt(1),Xh=BigInt(2);Qh=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));tr={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};bs=n=>typeof n=="bigint"&&xs<=n;hi=n=>(Xh<new Uint8Array(n),xu=n=>Uint8Array.from(n);ol={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||br(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};sl=()=>{throw new Error("not implemented")}});function Xt(n,t){let e=n%t;return e>=he?e:t+e}function fl(n,t,e){if(e<=he||t 0");if(e===ie)return he;let r=ie;for(;t>he;)t&ie&&(r=r*n%e),n=n*n%e,t>>=ie;return r}function oe(n,t,e){let r=n;for(;t-- >he;)r*=r,r%=e;return r}function ji(n,t){if(n===he||t<=he)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=Xt(n,t),r=t,i=he,s=ie,c=ie,p=he;for(;e!==he;){let v=r/e,x=r%e,k=i-c*v,_=s-p*v;r=e,e=x,i=c,s=p,c=k,p=_}if(r!==ie)throw new Error("invert: does not exist");return Xt(i,t)}function hl(n){let t=(n-ie)/ln,e,r,i;for(e=n-ie,r=0;e%ln===he;e/=ln,r++);for(i=ln;i(r[i]="function",r),t);return Ve(n,e)}function pl(n,t,e){if(e 0");if(e===he)return n.ONE;if(e===ie)return t;let r=n.ONE,i=t;for(;e>he;)e&ie&&(r=n.mul(r,i)),i=n.sqr(i),e>>=ie;return r}function yl(n,t){let e=new Array(t.length),r=t.reduce((s,c,p)=>n.is0(c)?s:(e[p]=s,n.mul(s,c)),n.ONE),i=n.inv(r);return t.reduceRight((s,c,p)=>n.is0(c)?s:(e[p]=n.mul(s,e[p]),n.mul(s,c)),i),e}function Is(n,t){let e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function kr(n,t,e=!1,r={}){if(n<=he)throw new Error(`Expected Field ORDER > 0, got ${n}`);let{nBitLength:i,nByteLength:s}=Is(n,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let c=ll(n),p=Object.freeze({ORDER:n,BITS:i,BYTES:s,MASK:hi(i),ZERO:he,ONE:ie,create:y=>Xt(y,n),isValid:y=>{if(typeof y!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof y}`);return he<=y&&yy===he,isOdd:y=>(y&ie)===ie,neg:y=>Xt(-y,n),eql:(y,v)=>y===v,sqr:y=>Xt(y*y,n),add:(y,v)=>Xt(y+v,n),sub:(y,v)=>Xt(y-v,n),mul:(y,v)=>Xt(y*v,n),pow:(y,v)=>pl(p,y,v),div:(y,v)=>Xt(y*ji(v,n),n),sqrN:y=>y*y,addN:(y,v)=>y+v,subN:(y,v)=>y-v,mulN:(y,v)=>y*v,inv:y=>ji(y,n),sqrt:r.sqrt||(y=>c(p,y)),invertBatch:y=>yl(p,y),cmov:(y,v,x)=>x?v:y,toBytes:y=>e?cn(y,s):xr(y,s),fromBytes:y=>{if(y.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${y.length}`);return e?vr(y):rr(y)}});return Object.freeze(p)}function Eu(n){if(typeof n!="bigint")throw new Error("field order must be bigint");let t=n.toString(2).length;return Math.ceil(t/8)}function As(n){let t=Eu(n);return t+Math.ceil(t/2)}function _u(n,t,e=!1){let r=n.length,i=Eu(t),s=As(t);if(r<16||r1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);let c=e?rr(n):vr(n),p=Xt(c,t-ie)+ie;return e?cn(p,i):xr(p,i)}var Uy,he,ie,ln,al,Es,ku,Su,ul,cl,Bu,dl,Cn=vt(()=>{Uy=C(N(),1);hn();he=BigInt(0),ie=BigInt(1),ln=BigInt(2),al=BigInt(3),Es=BigInt(4),ku=BigInt(5),Su=BigInt(8),ul=BigInt(9),cl=BigInt(16);Bu=(n,t)=>(Xt(n,t)&ie)===ie,dl=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function Yi(n,t){let e=(s,c)=>{let p=c.negate();return s?p:c},r=s=>{if(!Number.isSafeInteger(s)||s<=0||s>t)throw new Error(`Wrong window size=${s}, should be [1..${t}]`)},i=s=>{r(s);let c=Math.ceil(t/s)+1,p=2**(s-1);return{windows:c,windowSize:p}};return{constTimeNegate:e,unsafeLadder(s,c){let p=n.ZERO,y=s;for(;c>ml;)c&Ms&&(p=p.add(y)),y=y.double(),c>>=Ms;return p},precomputeWindow(s,c){let{windows:p,windowSize:y}=i(c),v=[],x=s,k=x;for(let _=0;_>=P,O>v&&(O-=B,p+=Ms);let K=E,z=E+Math.abs(O)-1,D=I%2!==0,et=O<0;O===0?k=k.add(e(D,c[K])):x=x.add(e(et,c[z]))}return{p:x,f:k}},wNAFCached(s,c,p){let y=Iu.get(s)||1,v=Ls.get(s);return v||(v=this.precomputeWindow(s,y),y!==1&&Ls.set(s,p(v))),this.wNAF(y,v,c)},setWindowSize(s,c){r(c),Iu.set(s,c),Ls.delete(s)}}}function Ji(n,t,e,r){if(!Array.isArray(e)||!Array.isArray(r)||r.length!==e.length)throw new Error("arrays of points and scalars must have equal length");r.forEach((x,k)=>{if(!t.isValid(x))throw new Error(`wrong scalar at index ${k}`)}),e.forEach((x,k)=>{if(!(x instanceof n))throw new Error(`wrong point at index ${k}`)});let i=Ss(BigInt(e.length)),s=i>12?i-3:i>4?i-2:i?2:1,c=(1<=0;x-=s){p.fill(n.ZERO);for(let _=0;_>BigInt(x)&BigInt(c));p[P]=p[P].add(e[_])}let k=n.ZERO;for(let _=p.length-1,B=n.ZERO;_>0;_--)B=B.add(p[_]),k=k.add(B);if(v=v.add(k),x!==0)for(let _=0;_{Fy=C(N(),1);Cn();hn();ml=BigInt(0),Ms=BigInt(1),Ls=new WeakMap,Iu=new WeakMap});function vl(n){let t=li(n);return Ve(n,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function Au(n){let t=vl(n),{Fp:e,n:r,prehash:i,hash:s,randomBytes:c,nByteLength:p,h:y}=t,v=Xi<{try{return{isValid:!0,value:e.sqrt(f*e.inv(h))}}catch{return{isValid:!1,value:Ke}}}),B=t.adjustScalarBytes||(f=>f),P=t.domain||((f,h,l)=>{if(Fe("phflag",l),h.length||l)throw new Error("Contexts/pre-hash are not supported");return f});function I(f,h){Me("coordinate "+f,h,Ke,v)}function E(f){if(!(f instanceof z))throw new Error("ExtendedPoint expected")}let O=fn((f,h)=>{let{ex:l,ey:w,ez:b}=f,d=f.is0();h==null&&(h=d?wl:e.inv(b));let a=x(l*h),g=x(w*h),M=x(b*h);if(d)return{x:Ke,y:Le};if(M!==Le)throw new Error("invZ was invalid");return{x:a,y:g}}),K=fn(f=>{let{a:h,d:l}=t;if(f.is0())throw new Error("bad point: ZERO");let{ex:w,ey:b,ez:d,et:a}=f,g=x(w*w),M=x(b*b),R=x(d*d),T=x(R*R),F=x(g*h),V=x(R*x(F+M)),X=x(T+x(l*x(g*M)));if(V!==X)throw new Error("bad point: equation left != right (1)");let jt=x(w*b),Y=x(d*a);if(jt!==Y)throw new Error("bad point: equation left != right (2)");return!0});class z{constructor(h,l,w,b){this.ex=h,this.ey=l,this.ez=w,this.et=b,I("x",h),I("y",l),I("z",w),I("t",b),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof z)throw new Error("extended point not allowed");let{x:l,y:w}=h||{};return I("x",l),I("y",w),new z(l,w,Le,x(l*w))}static normalizeZ(h){let l=e.invertBatch(h.map(w=>w.ez));return h.map((w,b)=>w.toAffine(l[b])).map(z.fromAffine)}static msm(h,l){return Ji(z,k,h,l)}_setWindowSize(h){W.setWindowSize(this,h)}assertValidity(){K(this)}equals(h){E(h);let{ex:l,ey:w,ez:b}=this,{ex:d,ey:a,ez:g}=h,M=x(l*g),R=x(d*b),T=x(w*g),F=x(a*b);return M===R&&T===F}is0(){return this.equals(z.ZERO)}negate(){return new z(x(-this.ex),this.ey,this.ez,x(-this.et))}double(){let{a:h}=t,{ex:l,ey:w,ez:b}=this,d=x(l*l),a=x(w*w),g=x(Xi*x(b*b)),M=x(h*d),R=l+w,T=x(x(R*R)-d-a),F=M+a,V=F-g,X=M-a,jt=x(T*V),Y=x(F*X),tt=x(T*X),Ee=x(V*F);return new z(jt,Y,Ee,tt)}add(h){E(h);let{a:l,d:w}=t,{ex:b,ey:d,ez:a,et:g}=this,{ex:M,ey:R,ez:T,et:F}=h;if(l===BigInt(-1)){let ft=x((d-b)*(R+M)),ht=x((d+b)*(R-M)),Je=x(ht-ft);if(Je===Ke)return this.double();let lt=x(a*Xi*F),dt=x(g*Xi*T),hr=dt+lt,pt=ht+ft,yt=dt-lt,Ur=x(hr*Je),wt=x(pt*yt),bt=x(hr*yt),Nr=x(Je*pt);return new z(Ur,wt,Nr,bt)}let V=x(b*M),X=x(d*R),jt=x(g*w*F),Y=x(a*T),tt=x((b+d)*(M+R)-V-X),Ee=Y-jt,ut=Y+jt,ct=x(X-l*V),Cr=x(tt*Ee),gt=x(ut*ct),mt=x(tt*ct),Or=x(Ee*ut);return new z(Cr,gt,Or,mt)}subtract(h){return this.add(h.negate())}wNAF(h){return W.wNAFCached(this,h,z.normalizeZ)}multiply(h){let l=h;Me("scalar",l,Le,r);let{p:w,f:b}=this.wNAF(l);return z.normalizeZ([w,b])[0]}multiplyUnsafe(h){let l=h;return Me("scalar",l,Ke,r),l===Ke?et:this.equals(et)||l===Le?this:this.equals(D)?this.wNAF(l).p:W.unsafeLadder(this,l)}isSmallOrder(){return this.multiplyUnsafe(y).is0()}isTorsionFree(){return W.unsafeLadder(this,r).is0()}toAffine(h){return O(this,h)}clearCofactor(){let{h}=t;return h===Le?this:this.multiplyUnsafe(h)}static fromHex(h,l=!1){let{d:w,a:b}=t,d=e.BYTES;h=ue("pointHex",h,d),Fe("zip215",l);let a=h.slice(),g=h[d-1];a[d-1]=g&-129;let M=vr(a),R=l?v:e.ORDER;Me("pointHex.y",M,Ke,R);let T=x(M*M),F=x(T-Le),V=x(w*T-b),{isValid:X,value:jt}=_(F,V);if(!X)throw new Error("Point.fromHex: invalid y coordinate");let Y=(jt&Le)===Le,tt=(g&128)!==0;if(!l&&jt===Ke&&tt)throw new Error("Point.fromHex: x=0 and x_0=1");return tt!==Y&&(jt=x(-jt)),z.fromAffine({x:jt,y:M})}static fromPrivateKey(h){return nt(h).point}toRawBytes(){let{x:h,y:l}=this.toAffine(),w=cn(l,e.BYTES);return w[w.length-1]|=h&Le?128:0,w}toHex(){return er(this.toRawBytes())}}z.BASE=new z(t.Gx,t.Gy,Le,x(t.Gx*t.Gy)),z.ZERO=new z(Ke,Le,Le,Ke);let{BASE:D,ZERO:et}=z,W=Yi(z,p*8);function J(f){return Xt(f,r)}function Q(f){return J(vr(f))}function nt(f){let h=p;f=ue("private key",f,h);let l=ue("hashed private key",s(f),2*h),w=B(l.slice(0,h)),b=l.slice(h,2*h),d=Q(w),a=D.multiply(d),g=a.toRawBytes();return{head:w,prefix:b,scalar:d,point:a,pointBytes:g}}function te(f){return nt(f).pointBytes}function G(f=new Uint8Array,...h){let l=nr(...h);return Q(s(P(l,ue("context",f),!!i)))}function st(f,h,l={}){f=ue("message",f),i&&(f=i(f));let{prefix:w,scalar:b,pointBytes:d}=nt(h),a=G(l.context,w,f),g=D.multiply(a).toRawBytes(),M=G(l.context,g,d,f),R=J(a+M*b);Me("signature.s",R,Ke,r);let T=nr(g,cn(R,e.BYTES));return ue("result",T,p*2)}let m=bl;function o(f,h,l,w=m){let{context:b,zip215:d}=w,a=e.BYTES;f=ue("signature",f,2*a),h=ue("message",h),d!==void 0&&Fe("zip215",d),i&&(h=i(h));let g=vr(f.slice(a,2*a)),M,R,T;try{M=z.fromHex(l,d),R=z.fromHex(f.slice(0,a),d),T=D.multiplyUnsafe(g)}catch{return!1}if(!d&&M.isSmallOrder())return!1;let F=G(b,R.toRawBytes(),M.toRawBytes(),h);return R.add(M.multiplyUnsafe(F)).subtract(T).clearCofactor().equals(z.ZERO)}return D._setWindowSize(8),{CURVE:t,getPublicKey:te,sign:st,verify:o,ExtendedPoint:z,utils:{getExtendedPublicKey:nt,randomPrivateKey:()=>c(e.BYTES),precompute(f=8,h=z.BASE){return h._setWindowSize(f),h.multiply(BigInt(3)),h}}}}var $y,Ke,Le,Xi,wl,bl,Mu=vt(()=>{$y=C(N(),1);Rs();Cn();hn();hn();Ke=BigInt(0),Le=BigInt(1),Xi=BigInt(2),wl=BigInt(8),bl={zip215:!0}});function Bl(n){let t=BigInt(10),e=BigInt(20),r=BigInt(40),i=BigInt(80),s=Ts,p=n*n%s*n%s,y=oe(p,Ru,s)*p%s,v=oe(y,xl,s)*n%s,x=oe(v,kl,s)*v%s,k=oe(x,t,s)*x%s,_=oe(k,e,s)*k%s,B=oe(_,r,s)*_%s,P=oe(B,i,s)*B%s,I=oe(P,i,s)*B%s,E=oe(I,t,s)*x%s;return{pow_p_5_8:oe(E,Ru,s)*n%s,b2:p}}function El(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}function _l(n,t){let e=Ts,r=Xt(t*t*t,e),i=Xt(r*r*t,e),s=Bl(n*i).pow_p_5_8,c=Xt(n*r*s,e),p=Xt(t*c*c,e),y=c,v=Xt(c*Lu,e),x=p===n,k=p===Xt(-n,e),_=p===Xt(-n*Lu,e);return x&&(c=y),(k||_)&&(c=v),Bu(c,e)&&(c=Xt(-c,e)),{isValid:x||k,value:c}}var tg,Ts,Lu,Jy,xl,Ru,Xy,kl,Sl,Il,Al,dn,Tu=vt(()=>{tg=C(N(),1);bu();gr();Mu();Cn();Ts=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Lu=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Jy=BigInt(0),xl=BigInt(1),Ru=BigInt(2),Xy=BigInt(3),kl=BigInt(5),Sl=BigInt(8);Il=(()=>kr(Ts,void 0,!0))(),Al=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Il,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Sl,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:wu,randomBytes:$i,adjustScalarBytes:El,uvRatio:_l}))(),dn=(()=>Au(Al))()});var Ps=fe(()=>{var ng=C(N())});var Cu=fe((Pu,Cs)=>{var ig=C(N());(function(n,t){"use strict";function e(m,o){if(!m)throw new Error(o||"Assertion failed")}function r(m,o){m.super_=o;var u=function(){};u.prototype=o.prototype,m.prototype=new u,m.prototype.constructor=m}function i(m,o,u){if(i.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((o==="le"||o==="be")&&(u=o,o=10),this._init(m||0,o||10,u||"be"))}typeof n=="object"?n.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Ps().Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,u){return o.cmp(u)>0?o:u},i.min=function(o,u){return o.cmp(u)<0?o:u},i.prototype._init=function(o,u,f){if(typeof o=="number")return this._initNumber(o,u,f);if(typeof o=="object")return this._initArray(o,u,f);u==="hex"&&(u=16),e(u===(u|0)&&u>=2&&u<=36),o=o.toString().replace(/\\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)w=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[l]|=w<>>26-b&67108863,b+=24,b>=26&&(b-=26,l++);else if(f==="le")for(h=0,l=0;h>>26-b&67108863,b+=24,b>=26&&(b-=26,l++);return this._strip()};function c(m,o){var u=m.charCodeAt(o);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;e(!1,"Invalid character in "+m)}function p(m,o,u){var f=c(m,u);return u-1>=o&&(f|=c(m,u-1)<<4),f}i.prototype._parseHex=function(o,u,f){this.length=Math.ceil((o.length-u)/6),this.words=new Array(this.length);for(var h=0;h=u;h-=2)b=p(o,u,h)<=18?(l-=18,w+=1,this.words[w]|=b>>>26):l+=8;else{var d=o.length-u;for(h=d%2===0?u+1:u;h=18?(l-=18,w+=1,this.words[w]|=b>>>26):l+=8}this._strip()};function y(m,o,u,f){for(var h=0,l=0,w=Math.min(m.length,u),b=o;b=49?l=d-49+10:d>=17?l=d-17+10:l=d,e(d>=0&&l1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=x}catch{i.prototype.inspect=x}else i.prototype.inspect=x;function x(){return(this.red?""}var k=["","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"],_=[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],B=[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];i.prototype.toString=function(o,u){o=o||10,u=u|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,l=0,w=0;w>>24-h&16777215,h+=2,h>=26&&(h-=26,w--),l!==0||w!==this.length-1?f=k[6-d.length]+d+f:f=d+f}for(l!==0&&(f=l.toString(16)+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var a=_[o],g=B[o];f="";var M=this.clone();for(M.negative=0;!M.isZero();){var R=M.modrn(g).toString(o);M=M.idivn(g),M.isZero()?f=R+f:f=k[a-R.length]+R+f}for(this.isZero()&&(f="0"+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}e(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16,2)},s&&(i.prototype.toBuffer=function(o,u){return this.toArrayLike(s,o,u)}),i.prototype.toArray=function(o,u){return this.toArrayLike(Array,o,u)};var P=function(o,u){return o.allocUnsafe?o.allocUnsafe(u):new o(u)};i.prototype.toArrayLike=function(o,u,f){this._strip();var h=this.byteLength(),l=f||Math.max(1,h);e(h<=l,"byte array longer than desired length"),e(l>0,"Requested array length <= 0");var w=P(o,l),b=u==="le"?"LE":"BE";return this["_toArrayLike"+b](w,h),w},i.prototype._toArrayLikeLE=function(o,u){for(var f=0,h=0,l=0,w=0;l>8&255),f>16&255),w===6?(f>24&255),h=0,w=0):(h=b>>>24,w+=2)}if(f=0&&(o[f--]=b>>8&255),f>=0&&(o[f--]=b>>16&255),w===6?(f>=0&&(o[f--]=b>>24&255),h=0,w=0):(h=b>>>24,w+=2)}if(f>=0)for(o[f--]=h;f>=0;)o[f--]=0},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var u=o,f=0;return u>=4096&&(f+=13,u>>>=13),u>=64&&(f+=7,u>>>=7),u>=8&&(f+=4,u>>>=4),u>=2&&(f+=2,u>>>=2),f+u},i.prototype._zeroBits=function(o){if(o===0)return 26;var u=o,f=0;return u&8191||(f+=13,u>>>=13),u&127||(f+=7,u>>>=7),u&15||(f+=4,u>>>=4),u&3||(f+=2,u>>>=2),u&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],u=this._countBits(o);return(this.length-1)*26+u};function I(m){for(var o=new Array(m.bitLength()),u=0;u>>h&1}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,u=0;uo.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var u;this.length>o.length?u=o:u=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var u,f;this.length>o.length?(u=this,f=o):(u=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){e(typeof o=="number"&&o>=0);var u=Math.ceil(o/26)|0,f=o%26;this._expand(u),f>0&&u--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this._strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,u){e(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),u?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var l=0,w=0;w>>26;for(;l!==0&&w>>26;if(this.length=f.length,l!==0)this.words[this.length]=l,this.length++;else if(f!==this)for(;wo.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var u=this.iadd(o);return o.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,l;f>0?(h=this,l=o):(h=o,l=this);for(var w=0,b=0;b>26,this.words[b]=u&67108863;for(;w!==0&&b>26,this.words[b]=u&67108863;if(w===0&&b>>26,M=d&67108863,R=Math.min(a,o.length-1),T=Math.max(0,a-m.length+1);T<=R;T++){var F=a-T|0;h=m.words[F]|0,l=o.words[T]|0,w=h*l+M,g+=w/67108864|0,M=w&67108863}u.words[a]=M|0,d=g|0}return d!==0?u.words[a]=d|0:u.length--,u._strip()}var O=function(o,u,f){var h=o.words,l=u.words,w=f.words,b=0,d,a,g,M=h[0]|0,R=M&8191,T=M>>>13,F=h[1]|0,V=F&8191,X=F>>>13,jt=h[2]|0,Y=jt&8191,tt=jt>>>13,Ee=h[3]|0,ut=Ee&8191,ct=Ee>>>13,Cr=h[4]|0,gt=Cr&8191,mt=Cr>>>13,Or=h[5]|0,ft=Or&8191,ht=Or>>>13,Je=h[6]|0,lt=Je&8191,dt=Je>>>13,hr=h[7]|0,pt=hr&8191,yt=hr>>>13,Ur=h[8]|0,wt=Ur&8191,bt=Ur>>>13,Nr=h[9]|0,xt=Nr&8191,kt=Nr>>>13,Jn=l[0]|0,St=Jn&8191,Bt=Jn>>>13,Xn=l[1]|0,Et=Xn&8191,_t=Xn>>>13,Qn=l[2]|0,It=Qn&8191,At=Qn>>>13,ti=l[3]|0,Mt=ti&8191,Lt=ti>>>13,ei=l[4]|0,Rt=ei&8191,Tt=ei>>>13,ri=l[5]|0,Pt=ri&8191,Ct=ri>>>13,ni=l[6]|0,Ot=ni&8191,Ut=ni>>>13,ii=l[7]|0,Nt=ii&8191,zt=ii>>>13,oi=l[8]|0,qt=oi&8191,Ft=oi>>>13,si=l[9]|0,Kt=si&8191,Dt=si>>>13;f.negative=o.negative^u.negative,f.length=19,d=Math.imul(R,St),a=Math.imul(R,Bt),a=a+Math.imul(T,St)|0,g=Math.imul(T,Bt);var zr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(zr>>>26)|0,zr&=67108863,d=Math.imul(V,St),a=Math.imul(V,Bt),a=a+Math.imul(X,St)|0,g=Math.imul(X,Bt),d=d+Math.imul(R,Et)|0,a=a+Math.imul(R,_t)|0,a=a+Math.imul(T,Et)|0,g=g+Math.imul(T,_t)|0;var qr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(qr>>>26)|0,qr&=67108863,d=Math.imul(Y,St),a=Math.imul(Y,Bt),a=a+Math.imul(tt,St)|0,g=Math.imul(tt,Bt),d=d+Math.imul(V,Et)|0,a=a+Math.imul(V,_t)|0,a=a+Math.imul(X,Et)|0,g=g+Math.imul(X,_t)|0,d=d+Math.imul(R,It)|0,a=a+Math.imul(R,At)|0,a=a+Math.imul(T,It)|0,g=g+Math.imul(T,At)|0;var Fr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,d=Math.imul(ut,St),a=Math.imul(ut,Bt),a=a+Math.imul(ct,St)|0,g=Math.imul(ct,Bt),d=d+Math.imul(Y,Et)|0,a=a+Math.imul(Y,_t)|0,a=a+Math.imul(tt,Et)|0,g=g+Math.imul(tt,_t)|0,d=d+Math.imul(V,It)|0,a=a+Math.imul(V,At)|0,a=a+Math.imul(X,It)|0,g=g+Math.imul(X,At)|0,d=d+Math.imul(R,Mt)|0,a=a+Math.imul(R,Lt)|0,a=a+Math.imul(T,Mt)|0,g=g+Math.imul(T,Lt)|0;var Kr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,d=Math.imul(gt,St),a=Math.imul(gt,Bt),a=a+Math.imul(mt,St)|0,g=Math.imul(mt,Bt),d=d+Math.imul(ut,Et)|0,a=a+Math.imul(ut,_t)|0,a=a+Math.imul(ct,Et)|0,g=g+Math.imul(ct,_t)|0,d=d+Math.imul(Y,It)|0,a=a+Math.imul(Y,At)|0,a=a+Math.imul(tt,It)|0,g=g+Math.imul(tt,At)|0,d=d+Math.imul(V,Mt)|0,a=a+Math.imul(V,Lt)|0,a=a+Math.imul(X,Mt)|0,g=g+Math.imul(X,Lt)|0,d=d+Math.imul(R,Rt)|0,a=a+Math.imul(R,Tt)|0,a=a+Math.imul(T,Rt)|0,g=g+Math.imul(T,Tt)|0;var Dr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,d=Math.imul(ft,St),a=Math.imul(ft,Bt),a=a+Math.imul(ht,St)|0,g=Math.imul(ht,Bt),d=d+Math.imul(gt,Et)|0,a=a+Math.imul(gt,_t)|0,a=a+Math.imul(mt,Et)|0,g=g+Math.imul(mt,_t)|0,d=d+Math.imul(ut,It)|0,a=a+Math.imul(ut,At)|0,a=a+Math.imul(ct,It)|0,g=g+Math.imul(ct,At)|0,d=d+Math.imul(Y,Mt)|0,a=a+Math.imul(Y,Lt)|0,a=a+Math.imul(tt,Mt)|0,g=g+Math.imul(tt,Lt)|0,d=d+Math.imul(V,Rt)|0,a=a+Math.imul(V,Tt)|0,a=a+Math.imul(X,Rt)|0,g=g+Math.imul(X,Tt)|0,d=d+Math.imul(R,Pt)|0,a=a+Math.imul(R,Ct)|0,a=a+Math.imul(T,Pt)|0,g=g+Math.imul(T,Ct)|0;var Wr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,d=Math.imul(lt,St),a=Math.imul(lt,Bt),a=a+Math.imul(dt,St)|0,g=Math.imul(dt,Bt),d=d+Math.imul(ft,Et)|0,a=a+Math.imul(ft,_t)|0,a=a+Math.imul(ht,Et)|0,g=g+Math.imul(ht,_t)|0,d=d+Math.imul(gt,It)|0,a=a+Math.imul(gt,At)|0,a=a+Math.imul(mt,It)|0,g=g+Math.imul(mt,At)|0,d=d+Math.imul(ut,Mt)|0,a=a+Math.imul(ut,Lt)|0,a=a+Math.imul(ct,Mt)|0,g=g+Math.imul(ct,Lt)|0,d=d+Math.imul(Y,Rt)|0,a=a+Math.imul(Y,Tt)|0,a=a+Math.imul(tt,Rt)|0,g=g+Math.imul(tt,Tt)|0,d=d+Math.imul(V,Pt)|0,a=a+Math.imul(V,Ct)|0,a=a+Math.imul(X,Pt)|0,g=g+Math.imul(X,Ct)|0,d=d+Math.imul(R,Ot)|0,a=a+Math.imul(R,Ut)|0,a=a+Math.imul(T,Ot)|0,g=g+Math.imul(T,Ut)|0;var Hr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,d=Math.imul(pt,St),a=Math.imul(pt,Bt),a=a+Math.imul(yt,St)|0,g=Math.imul(yt,Bt),d=d+Math.imul(lt,Et)|0,a=a+Math.imul(lt,_t)|0,a=a+Math.imul(dt,Et)|0,g=g+Math.imul(dt,_t)|0,d=d+Math.imul(ft,It)|0,a=a+Math.imul(ft,At)|0,a=a+Math.imul(ht,It)|0,g=g+Math.imul(ht,At)|0,d=d+Math.imul(gt,Mt)|0,a=a+Math.imul(gt,Lt)|0,a=a+Math.imul(mt,Mt)|0,g=g+Math.imul(mt,Lt)|0,d=d+Math.imul(ut,Rt)|0,a=a+Math.imul(ut,Tt)|0,a=a+Math.imul(ct,Rt)|0,g=g+Math.imul(ct,Tt)|0,d=d+Math.imul(Y,Pt)|0,a=a+Math.imul(Y,Ct)|0,a=a+Math.imul(tt,Pt)|0,g=g+Math.imul(tt,Ct)|0,d=d+Math.imul(V,Ot)|0,a=a+Math.imul(V,Ut)|0,a=a+Math.imul(X,Ot)|0,g=g+Math.imul(X,Ut)|0,d=d+Math.imul(R,Nt)|0,a=a+Math.imul(R,zt)|0,a=a+Math.imul(T,Nt)|0,g=g+Math.imul(T,zt)|0;var $r=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+($r>>>26)|0,$r&=67108863,d=Math.imul(wt,St),a=Math.imul(wt,Bt),a=a+Math.imul(bt,St)|0,g=Math.imul(bt,Bt),d=d+Math.imul(pt,Et)|0,a=a+Math.imul(pt,_t)|0,a=a+Math.imul(yt,Et)|0,g=g+Math.imul(yt,_t)|0,d=d+Math.imul(lt,It)|0,a=a+Math.imul(lt,At)|0,a=a+Math.imul(dt,It)|0,g=g+Math.imul(dt,At)|0,d=d+Math.imul(ft,Mt)|0,a=a+Math.imul(ft,Lt)|0,a=a+Math.imul(ht,Mt)|0,g=g+Math.imul(ht,Lt)|0,d=d+Math.imul(gt,Rt)|0,a=a+Math.imul(gt,Tt)|0,a=a+Math.imul(mt,Rt)|0,g=g+Math.imul(mt,Tt)|0,d=d+Math.imul(ut,Pt)|0,a=a+Math.imul(ut,Ct)|0,a=a+Math.imul(ct,Pt)|0,g=g+Math.imul(ct,Ct)|0,d=d+Math.imul(Y,Ot)|0,a=a+Math.imul(Y,Ut)|0,a=a+Math.imul(tt,Ot)|0,g=g+Math.imul(tt,Ut)|0,d=d+Math.imul(V,Nt)|0,a=a+Math.imul(V,zt)|0,a=a+Math.imul(X,Nt)|0,g=g+Math.imul(X,zt)|0,d=d+Math.imul(R,qt)|0,a=a+Math.imul(R,Ft)|0,a=a+Math.imul(T,qt)|0,g=g+Math.imul(T,Ft)|0;var Vr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,d=Math.imul(xt,St),a=Math.imul(xt,Bt),a=a+Math.imul(kt,St)|0,g=Math.imul(kt,Bt),d=d+Math.imul(wt,Et)|0,a=a+Math.imul(wt,_t)|0,a=a+Math.imul(bt,Et)|0,g=g+Math.imul(bt,_t)|0,d=d+Math.imul(pt,It)|0,a=a+Math.imul(pt,At)|0,a=a+Math.imul(yt,It)|0,g=g+Math.imul(yt,At)|0,d=d+Math.imul(lt,Mt)|0,a=a+Math.imul(lt,Lt)|0,a=a+Math.imul(dt,Mt)|0,g=g+Math.imul(dt,Lt)|0,d=d+Math.imul(ft,Rt)|0,a=a+Math.imul(ft,Tt)|0,a=a+Math.imul(ht,Rt)|0,g=g+Math.imul(ht,Tt)|0,d=d+Math.imul(gt,Pt)|0,a=a+Math.imul(gt,Ct)|0,a=a+Math.imul(mt,Pt)|0,g=g+Math.imul(mt,Ct)|0,d=d+Math.imul(ut,Ot)|0,a=a+Math.imul(ut,Ut)|0,a=a+Math.imul(ct,Ot)|0,g=g+Math.imul(ct,Ut)|0,d=d+Math.imul(Y,Nt)|0,a=a+Math.imul(Y,zt)|0,a=a+Math.imul(tt,Nt)|0,g=g+Math.imul(tt,zt)|0,d=d+Math.imul(V,qt)|0,a=a+Math.imul(V,Ft)|0,a=a+Math.imul(X,qt)|0,g=g+Math.imul(X,Ft)|0,d=d+Math.imul(R,Kt)|0,a=a+Math.imul(R,Dt)|0,a=a+Math.imul(T,Kt)|0,g=g+Math.imul(T,Dt)|0;var Gr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,d=Math.imul(xt,Et),a=Math.imul(xt,_t),a=a+Math.imul(kt,Et)|0,g=Math.imul(kt,_t),d=d+Math.imul(wt,It)|0,a=a+Math.imul(wt,At)|0,a=a+Math.imul(bt,It)|0,g=g+Math.imul(bt,At)|0,d=d+Math.imul(pt,Mt)|0,a=a+Math.imul(pt,Lt)|0,a=a+Math.imul(yt,Mt)|0,g=g+Math.imul(yt,Lt)|0,d=d+Math.imul(lt,Rt)|0,a=a+Math.imul(lt,Tt)|0,a=a+Math.imul(dt,Rt)|0,g=g+Math.imul(dt,Tt)|0,d=d+Math.imul(ft,Pt)|0,a=a+Math.imul(ft,Ct)|0,a=a+Math.imul(ht,Pt)|0,g=g+Math.imul(ht,Ct)|0,d=d+Math.imul(gt,Ot)|0,a=a+Math.imul(gt,Ut)|0,a=a+Math.imul(mt,Ot)|0,g=g+Math.imul(mt,Ut)|0,d=d+Math.imul(ut,Nt)|0,a=a+Math.imul(ut,zt)|0,a=a+Math.imul(ct,Nt)|0,g=g+Math.imul(ct,zt)|0,d=d+Math.imul(Y,qt)|0,a=a+Math.imul(Y,Ft)|0,a=a+Math.imul(tt,qt)|0,g=g+Math.imul(tt,Ft)|0,d=d+Math.imul(V,Kt)|0,a=a+Math.imul(V,Dt)|0,a=a+Math.imul(X,Kt)|0,g=g+Math.imul(X,Dt)|0;var Zr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,d=Math.imul(xt,It),a=Math.imul(xt,At),a=a+Math.imul(kt,It)|0,g=Math.imul(kt,At),d=d+Math.imul(wt,Mt)|0,a=a+Math.imul(wt,Lt)|0,a=a+Math.imul(bt,Mt)|0,g=g+Math.imul(bt,Lt)|0,d=d+Math.imul(pt,Rt)|0,a=a+Math.imul(pt,Tt)|0,a=a+Math.imul(yt,Rt)|0,g=g+Math.imul(yt,Tt)|0,d=d+Math.imul(lt,Pt)|0,a=a+Math.imul(lt,Ct)|0,a=a+Math.imul(dt,Pt)|0,g=g+Math.imul(dt,Ct)|0,d=d+Math.imul(ft,Ot)|0,a=a+Math.imul(ft,Ut)|0,a=a+Math.imul(ht,Ot)|0,g=g+Math.imul(ht,Ut)|0,d=d+Math.imul(gt,Nt)|0,a=a+Math.imul(gt,zt)|0,a=a+Math.imul(mt,Nt)|0,g=g+Math.imul(mt,zt)|0,d=d+Math.imul(ut,qt)|0,a=a+Math.imul(ut,Ft)|0,a=a+Math.imul(ct,qt)|0,g=g+Math.imul(ct,Ft)|0,d=d+Math.imul(Y,Kt)|0,a=a+Math.imul(Y,Dt)|0,a=a+Math.imul(tt,Kt)|0,g=g+Math.imul(tt,Dt)|0;var jr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(jr>>>26)|0,jr&=67108863,d=Math.imul(xt,Mt),a=Math.imul(xt,Lt),a=a+Math.imul(kt,Mt)|0,g=Math.imul(kt,Lt),d=d+Math.imul(wt,Rt)|0,a=a+Math.imul(wt,Tt)|0,a=a+Math.imul(bt,Rt)|0,g=g+Math.imul(bt,Tt)|0,d=d+Math.imul(pt,Pt)|0,a=a+Math.imul(pt,Ct)|0,a=a+Math.imul(yt,Pt)|0,g=g+Math.imul(yt,Ct)|0,d=d+Math.imul(lt,Ot)|0,a=a+Math.imul(lt,Ut)|0,a=a+Math.imul(dt,Ot)|0,g=g+Math.imul(dt,Ut)|0,d=d+Math.imul(ft,Nt)|0,a=a+Math.imul(ft,zt)|0,a=a+Math.imul(ht,Nt)|0,g=g+Math.imul(ht,zt)|0,d=d+Math.imul(gt,qt)|0,a=a+Math.imul(gt,Ft)|0,a=a+Math.imul(mt,qt)|0,g=g+Math.imul(mt,Ft)|0,d=d+Math.imul(ut,Kt)|0,a=a+Math.imul(ut,Dt)|0,a=a+Math.imul(ct,Kt)|0,g=g+Math.imul(ct,Dt)|0;var Yr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,d=Math.imul(xt,Rt),a=Math.imul(xt,Tt),a=a+Math.imul(kt,Rt)|0,g=Math.imul(kt,Tt),d=d+Math.imul(wt,Pt)|0,a=a+Math.imul(wt,Ct)|0,a=a+Math.imul(bt,Pt)|0,g=g+Math.imul(bt,Ct)|0,d=d+Math.imul(pt,Ot)|0,a=a+Math.imul(pt,Ut)|0,a=a+Math.imul(yt,Ot)|0,g=g+Math.imul(yt,Ut)|0,d=d+Math.imul(lt,Nt)|0,a=a+Math.imul(lt,zt)|0,a=a+Math.imul(dt,Nt)|0,g=g+Math.imul(dt,zt)|0,d=d+Math.imul(ft,qt)|0,a=a+Math.imul(ft,Ft)|0,a=a+Math.imul(ht,qt)|0,g=g+Math.imul(ht,Ft)|0,d=d+Math.imul(gt,Kt)|0,a=a+Math.imul(gt,Dt)|0,a=a+Math.imul(mt,Kt)|0,g=g+Math.imul(mt,Dt)|0;var Jr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,d=Math.imul(xt,Pt),a=Math.imul(xt,Ct),a=a+Math.imul(kt,Pt)|0,g=Math.imul(kt,Ct),d=d+Math.imul(wt,Ot)|0,a=a+Math.imul(wt,Ut)|0,a=a+Math.imul(bt,Ot)|0,g=g+Math.imul(bt,Ut)|0,d=d+Math.imul(pt,Nt)|0,a=a+Math.imul(pt,zt)|0,a=a+Math.imul(yt,Nt)|0,g=g+Math.imul(yt,zt)|0,d=d+Math.imul(lt,qt)|0,a=a+Math.imul(lt,Ft)|0,a=a+Math.imul(dt,qt)|0,g=g+Math.imul(dt,Ft)|0,d=d+Math.imul(ft,Kt)|0,a=a+Math.imul(ft,Dt)|0,a=a+Math.imul(ht,Kt)|0,g=g+Math.imul(ht,Dt)|0;var Xr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,d=Math.imul(xt,Ot),a=Math.imul(xt,Ut),a=a+Math.imul(kt,Ot)|0,g=Math.imul(kt,Ut),d=d+Math.imul(wt,Nt)|0,a=a+Math.imul(wt,zt)|0,a=a+Math.imul(bt,Nt)|0,g=g+Math.imul(bt,zt)|0,d=d+Math.imul(pt,qt)|0,a=a+Math.imul(pt,Ft)|0,a=a+Math.imul(yt,qt)|0,g=g+Math.imul(yt,Ft)|0,d=d+Math.imul(lt,Kt)|0,a=a+Math.imul(lt,Dt)|0,a=a+Math.imul(dt,Kt)|0,g=g+Math.imul(dt,Dt)|0;var Qr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,d=Math.imul(xt,Nt),a=Math.imul(xt,zt),a=a+Math.imul(kt,Nt)|0,g=Math.imul(kt,zt),d=d+Math.imul(wt,qt)|0,a=a+Math.imul(wt,Ft)|0,a=a+Math.imul(bt,qt)|0,g=g+Math.imul(bt,Ft)|0,d=d+Math.imul(pt,Kt)|0,a=a+Math.imul(pt,Dt)|0,a=a+Math.imul(yt,Kt)|0,g=g+Math.imul(yt,Dt)|0;var tn=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(tn>>>26)|0,tn&=67108863,d=Math.imul(xt,qt),a=Math.imul(xt,Ft),a=a+Math.imul(kt,qt)|0,g=Math.imul(kt,Ft),d=d+Math.imul(wt,Kt)|0,a=a+Math.imul(wt,Dt)|0,a=a+Math.imul(bt,Kt)|0,g=g+Math.imul(bt,Dt)|0;var en=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(en>>>26)|0,en&=67108863,d=Math.imul(xt,Kt),a=Math.imul(xt,Dt),a=a+Math.imul(kt,Kt)|0,g=Math.imul(kt,Dt);var rn=(b+d|0)+((a&8191)<<13)|0;return b=(g+(a>>>13)|0)+(rn>>>26)|0,rn&=67108863,w[0]=zr,w[1]=qr,w[2]=Fr,w[3]=Kr,w[4]=Dr,w[5]=Wr,w[6]=Hr,w[7]=$r,w[8]=Vr,w[9]=Gr,w[10]=Zr,w[11]=jr,w[12]=Yr,w[13]=Jr,w[14]=Xr,w[15]=Qr,w[16]=tn,w[17]=en,w[18]=rn,b!==0&&(w[19]=b,f.length++),f};Math.imul||(O=E);function K(m,o,u){u.negative=o.negative^m.negative,u.length=m.length+o.length;for(var f=0,h=0,l=0;l>>26)|0,h+=w>>>26,w&=67108863}u.words[l]=b,f=w,w=h}return f!==0?u.words[l]=f:u.length--,u._strip()}function z(m,o,u){return K(m,o,u)}i.prototype.mulTo=function(o,u){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=O(this,o,u):h<63?f=E(this,o,u):h<1024?f=K(this,o,u):f=z(this,o,u),f};function D(m,o){this.x=m,this.y=o}D.prototype.makeRBT=function(o){for(var u=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},D.prototype.permute=function(o,u,f,h,l,w){for(var b=0;b>>1)l++;return 1<>>13,f[2*w+1]=l&8191,l=l>>>13;for(w=2*u;w>=26,f+=l/67108864|0,f+=w>>>26,this.words[h]=w&67108863}return f!==0&&(this.words[h]=f,this.length++),u?this.ineg():this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var u=I(o);if(u.length===0)return new i(1);for(var f=this,h=0;h=0);var u=o%26,f=(o-u)/26,h=67108863>>>26-u<<26-u,l;if(u!==0){var w=0;for(l=0;l>>26-u}w&&(this.words[l]=w,this.length++)}if(f!==0){for(l=this.length-1;l>=0;l--)this.words[l+f]=this.words[l];for(l=0;l=0);var h;u?h=(u-u%26)/26:h=0;var l=o%26,w=Math.min((o-l)/26,this.length),b=67108863^67108863>>>l<w)for(this.length-=w,a=0;a=0&&(g!==0||a>=h);a--){var M=this.words[a]|0;this.words[a]=g<<26-l|M>>>l,g=M&b}return d&&g!==0&&(d.words[d.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(o,u,f){return e(this.negative===0),this.iushrn(o,u,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){e(typeof o=="number"&&o>=0);var u=o%26,f=(o-u)/26,h=1<=0);var u=o%26,f=(o-u)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(u!==0&&f++,this.length=Math.min(f,this.length),u!==0){var h=67108863^67108863>>>u<=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},i.prototype.isubn=function(o){if(e(typeof o=="number"),e(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u>26)-(d/67108864|0),this.words[l+f]=w&67108863}for(;l>26,this.words[l+f]=w&67108863;if(b===0)return this._strip();for(e(b===-1),b=0,l=0;l>26,this.words[l]=w&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(o,u){var f=this.length-o.length,h=this.clone(),l=o,w=l.words[l.length-1]|0,b=this._countBits(w);f=26-b,f!==0&&(l=l.ushln(f),h.iushln(f),w=l.words[l.length-1]|0);var d=h.length-l.length,a;if(u!=="mod"){a=new i(null),a.length=d+1,a.words=new Array(a.length);for(var g=0;g=0;R--){var T=(h.words[l.length+R]|0)*67108864+(h.words[l.length+R-1]|0);for(T=Math.min(T/w|0,67108863),h._ishlnsubmul(l,T,R);h.negative!==0;)T--,h.negative=0,h._ishlnsubmul(l,1,R),h.isZero()||(h.negative^=1);a&&(a.words[R]=T)}return a&&a._strip(),h._strip(),u!=="div"&&f!==0&&h.iushrn(f),{div:a||null,mod:h}},i.prototype.divmod=function(o,u,f){if(e(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,l,w;return this.negative!==0&&o.negative===0?(w=this.neg().divmod(o,u),u!=="mod"&&(h=w.div.neg()),u!=="div"&&(l=w.mod.neg(),f&&l.negative!==0&&l.iadd(o)),{div:h,mod:l}):this.negative===0&&o.negative!==0?(w=this.divmod(o.neg(),u),u!=="mod"&&(h=w.div.neg()),{div:h,mod:w.mod}):this.negative&o.negative?(w=this.neg().divmod(o.neg(),u),u!=="div"&&(l=w.mod.neg(),f&&l.negative!==0&&l.isub(o)),{div:w.div,mod:l}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?u==="div"?{div:this.divn(o.words[0]),mod:null}:u==="mod"?{div:null,mod:new i(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modrn(o.words[0]))}:this._wordDiv(o,u)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var u=this.divmod(o);if(u.mod.isZero())return u.div;var f=u.div.negative!==0?u.mod.isub(o):u.mod,h=o.ushrn(1),l=o.andln(1),w=f.cmp(h);return w<0||l===1&&w===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},i.prototype.modrn=function(o){var u=o<0;u&&(o=-o),e(o<=67108863);for(var f=(1<<26)%o,h=0,l=this.length-1;l>=0;l--)h=(f*h+(this.words[l]|0))%o;return u?-h:h},i.prototype.modn=function(o){return this.modrn(o)},i.prototype.idivn=function(o){var u=o<0;u&&(o=-o),e(o<=67108863);for(var f=0,h=this.length-1;h>=0;h--){var l=(this.words[h]|0)+f*67108864;this.words[h]=l/o|0,f=l%o}return this._strip(),u?this.ineg():this},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){e(o.negative===0),e(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var h=new i(1),l=new i(0),w=new i(0),b=new i(1),d=0;u.isEven()&&f.isEven();)u.iushrn(1),f.iushrn(1),++d;for(var a=f.clone(),g=u.clone();!u.isZero();){for(var M=0,R=1;!(u.words[0]&R)&&M<26;++M,R<<=1);if(M>0)for(u.iushrn(M);M-- >0;)(h.isOdd()||l.isOdd())&&(h.iadd(a),l.isub(g)),h.iushrn(1),l.iushrn(1);for(var T=0,F=1;!(f.words[0]&F)&&T<26;++T,F<<=1);if(T>0)for(f.iushrn(T);T-- >0;)(w.isOdd()||b.isOdd())&&(w.iadd(a),b.isub(g)),w.iushrn(1),b.iushrn(1);u.cmp(f)>=0?(u.isub(f),h.isub(w),l.isub(b)):(f.isub(u),w.isub(h),b.isub(l))}return{a:w,b,gcd:f.iushln(d)}},i.prototype._invmp=function(o){e(o.negative===0),e(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var h=new i(1),l=new i(0),w=f.clone();u.cmpn(1)>0&&f.cmpn(1)>0;){for(var b=0,d=1;!(u.words[0]&d)&&b<26;++b,d<<=1);if(b>0)for(u.iushrn(b);b-- >0;)h.isOdd()&&h.iadd(w),h.iushrn(1);for(var a=0,g=1;!(f.words[0]&g)&&a<26;++a,g<<=1);if(a>0)for(f.iushrn(a);a-- >0;)l.isOdd()&&l.iadd(w),l.iushrn(1);u.cmp(f)>=0?(u.isub(f),h.isub(l)):(f.isub(u),l.isub(h))}var M;return u.cmpn(1)===0?M=h:M=l,M.cmpn(0)<0&&M.iadd(o),M},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var u=this.clone(),f=o.clone();u.negative=0,f.negative=0;for(var h=0;u.isEven()&&f.isEven();h++)u.iushrn(1),f.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;f.isEven();)f.iushrn(1);var l=u.cmp(f);if(l<0){var w=u;u=f,f=w}else if(l===0||f.cmpn(1)===0)break;u.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){e(typeof o=="number");var u=o%26,f=(o-u)/26,h=1<>>26,b&=67108863,this.words[w]=b}return l!==0&&(this.words[w]=l,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var u=o<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var f;if(this.length>1)f=1;else{u&&(o=-o),e(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,l=o.words[f]|0;if(h!==l){hl&&(u=1);break}}return u},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return e(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return e(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var et={k256:null,p224:null,p192:null,p25519:null};function W(m,o){this.name=m,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}W.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},W.prototype.ireduce=function(o){var u=o,f;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),f=u.bitLength();while(f>this.n);var h=f0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},W.prototype.split=function(o,u){o.iushrn(this.n,0,u)},W.prototype.imulK=function(o){return o.imul(this.k)};function J(){W.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}r(J,W),J.prototype.split=function(o,u){for(var f=4194303,h=Math.min(o.length,9),l=0;l>>22,w=b}w>>>=22,o.words[l-10]=w,w===0&&o.length>10?o.length-=10:o.length-=9},J.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var u=0,f=0;f>>=26,o.words[f]=l,u=h}return u!==0&&(o.words[o.length++]=u),o},i._prime=function(o){if(et[o])return et[o];var u;if(o==="k256")u=new J;else if(o==="p224")u=new Q;else if(o==="p192")u=new nt;else if(o==="p25519")u=new te;else throw new Error("Unknown prime "+o);return et[o]=u,u};function G(m){if(typeof m=="string"){var o=i._prime(m);this.m=o.p,this.prime=o}else e(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(o){e(o.negative===0,"red works only with positives"),e(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,u){e((o.negative|u.negative)===0,"red works only with positives"),e(o.red&&o.red===u.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(v(o,o.umod(this.m)._forceRed(this)),o)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,u){this._verify2(o,u);var f=o.add(u);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,u){this._verify2(o,u);var f=o.iadd(u);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,u){this._verify2(o,u);var f=o.sub(u);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,u){this._verify2(o,u);var f=o.isub(u);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,u){return this._verify1(o),this.imod(o.ushln(u))},G.prototype.imul=function(o,u){return this._verify2(o,u),this.imod(o.imul(u))},G.prototype.mul=function(o,u){return this._verify2(o,u),this.imod(o.mul(u))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var u=this.m.andln(3);if(e(u%2===1),u===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),l=0;!h.isZero()&&h.andln(1)===0;)l++,h.iushrn(1);e(!h.isZero());var w=new i(1).toRed(this),b=w.redNeg(),d=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,d).cmp(b)!==0;)a.redIAdd(b);for(var g=this.pow(a,h),M=this.pow(o,h.addn(1).iushrn(1)),R=this.pow(o,h),T=l;R.cmp(w)!==0;){for(var F=R,V=0;F.cmp(w)!==0;V++)F=F.redSqr();e(V=0;l--){for(var g=u.words[l],M=a-1;M>=0;M--){var R=g>>M&1;if(w!==h[0]&&(w=this.sqr(w)),R===0&&b===0){d=0;continue}b<<=1,b|=R,d++,!(d!==f&&(l!==0||M!==0))&&(w=this.mul(w,h[b]),d=0,b=0)}a=26}return w},G.prototype.convertTo=function(o){var u=o.umod(this.m);return u===o?u.clone():u},G.prototype.convertFrom=function(o){var u=o.clone();return u.red=null,u},i.mont=function(o){return new st(o)};function st(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}r(st,G),st.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},st.prototype.convertFrom=function(o){var u=this.imod(o.mul(this.rinv));return u.red=null,u},st.prototype.imul=function(o,u){if(o.isZero()||u.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(u),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=f.isub(h).iushrn(this.shift),w=l;return l.cmp(this.m)>=0?w=l.isub(this.m):l.cmpn(0)<0&&(w=l.iadd(this.m)),w._forceRed(this)},st.prototype.mul=function(o,u){if(o.isZero()||u.isZero())return new i(0)._forceRed(this);var f=o.mul(u),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=f.isub(h).iushrn(this.shift),w=l;return l.cmp(this.m)>=0?w=l.isub(this.m):l.cmpn(0)<0&&(w=l.iadd(this.m)),w._forceRed(this)},st.prototype.invm=function(o){var u=this.imod(o._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof Cs>"u"||Cs,Pu)});var Nu=fe((Os,Uu)=>{var og=C(N());var Qi=Mn(),Ge=Qi.Buffer;function Ou(n,t){for(var e in n)t[e]=n[e]}Ge.from&&Ge.alloc&&Ge.allocUnsafe&&Ge.allocUnsafeSlow?Uu.exports=Qi:(Ou(Qi,Os),Os.Buffer=pn);function pn(n,t,e){return Ge(n,t,e)}pn.prototype=Object.create(Ge.prototype);Ou(Ge,pn);pn.from=function(n,t,e){if(typeof n=="number")throw new TypeError("Argument must not be a number");return Ge(n,t,e)};pn.alloc=function(n,t,e){if(typeof n!="number")throw new TypeError("Argument must be a number");var r=Ge(n);return t!==void 0?typeof e=="string"?r.fill(t,e):r.fill(t):r.fill(0),r};pn.allocUnsafe=function(n){if(typeof n!="number")throw new TypeError("Argument must be a number");return Ge(n)};pn.allocUnsafeSlow=function(n){if(typeof n!="number")throw new TypeError("Argument must be a number");return Qi.SlowBuffer(n)}});var Us=fe((sg,zu)=>{"use strict";var ag=C(N()),to=Nu().Buffer;function Ml(n){if(n.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,z=new Uint8Array(K);E!==O;){for(var D=B[E],et=0,W=K-1;(D!==0||et>>0,z[W]=D%c>>>0,D=D/c>>>0;if(D!==0)throw new Error("Non-zero carry");I=et,E++}for(var J=K-I;J!==K&&z[J]===0;)J++;for(var Q=p.repeat(P);J>>0,K=new Uint8Array(O);P>>0,K[et]=z%256>>>0,z=z/256>>>0;if(z!==0)throw new Error("Non-zero carry");E=D,P++}for(var W=O-E;W!==O&&K[W]===0;)W++;var J=to.allocUnsafe(I+(O-W));J.fill(0,0,I);for(var Q=I;W!==O;)J[Q++]=K[W++];return J}function _(B){var P=k(B);if(P)return P;throw new Error("Non-base"+c+" character")}return{encode:x,decodeUnsafe:k,decode:_}}zu.exports=Ml});var Fu=fe((ug,qu)=>{var cg=C(N()),Ll=Us(),Rl="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";qu.exports=Ll(Rl)});var dg,Tl,Sr,Br,Ns,di,zs=vt(()=>{dg=C(N(),1);fs();gr();Tl=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Sr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Br=new Uint32Array(64),Ns=class extends Tn{constructor(){super(64,32,8,!1),this.A=Sr[0]|0,this.B=Sr[1]|0,this.C=Sr[2]|0,this.D=Sr[3]|0,this.E=Sr[4]|0,this.F=Sr[5]|0,this.G=Sr[6]|0,this.H=Sr[7]|0}get(){let{A:t,B:e,C:r,D:i,E:s,F:c,G:p,H:y}=this;return[t,e,r,i,s,c,p,y]}set(t,e,r,i,s,c,p,y){this.A=t|0,this.B=e|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=c|0,this.G=p|0,this.H=y|0}process(t,e){for(let k=0;k<16;k++,e+=4)Br[k]=t.getUint32(e,!1);for(let k=16;k<64;k++){let _=Br[k-15],B=Br[k-2],P=qe(_,7)^qe(_,18)^_>>>3,I=qe(B,17)^qe(B,19)^B>>>10;Br[k]=I+Br[k-7]+P+Br[k-16]|0}let{A:r,B:i,C:s,D:c,E:p,F:y,G:v,H:x}=this;for(let k=0;k<64;k++){let _=qe(p,6)^qe(p,11)^qe(p,25),B=x+_+yu(p,y,v)+Tl[k]+Br[k]|0,I=(qe(r,2)^qe(r,13)^qe(r,22))+gu(r,i,s)|0;x=v,v=y,y=p,p=c+B|0,c=s,s=i,i=r,r=B+I|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,c=c+this.D|0,p=p+this.E|0,y=y+this.F|0,v=v+this.G|0,x=x+this.H|0,this.set(r,i,s,c,p,y,v,x)}roundClean(){Br.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},di=Rn(()=>new Ns)});var Du=fe((Ku,qs)=>{var pg=C(N());(function(n,t){"use strict";function e(m,o){if(!m)throw new Error(o||"Assertion failed")}function r(m,o){m.super_=o;var u=function(){};u.prototype=o.prototype,m.prototype=new u,m.prototype.constructor=m}function i(m,o,u){if(i.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((o==="le"||o==="be")&&(u=o,o=10),this._init(m||0,o||10,u||"be"))}typeof n=="object"?n.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Ps().Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,u){return o.cmp(u)>0?o:u},i.min=function(o,u){return o.cmp(u)<0?o:u},i.prototype._init=function(o,u,f){if(typeof o=="number")return this._initNumber(o,u,f);if(typeof o=="object")return this._initArray(o,u,f);u==="hex"&&(u=16),e(u===(u|0)&&u>=2&&u<=36),o=o.toString().replace(/\\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)w=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[l]|=w<>>26-b&67108863,b+=24,b>=26&&(b-=26,l++);else if(f==="le")for(h=0,l=0;h>>26-b&67108863,b+=24,b>=26&&(b-=26,l++);return this._strip()};function c(m,o){var u=m.charCodeAt(o);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;e(!1,"Invalid character in "+m)}function p(m,o,u){var f=c(m,u);return u-1>=o&&(f|=c(m,u-1)<<4),f}i.prototype._parseHex=function(o,u,f){this.length=Math.ceil((o.length-u)/6),this.words=new Array(this.length);for(var h=0;h=u;h-=2)b=p(o,u,h)<=18?(l-=18,w+=1,this.words[w]|=b>>>26):l+=8;else{var d=o.length-u;for(h=d%2===0?u+1:u;h=18?(l-=18,w+=1,this.words[w]|=b>>>26):l+=8}this._strip()};function y(m,o,u,f){for(var h=0,l=0,w=Math.min(m.length,u),b=o;b=49?l=d-49+10:d>=17?l=d-17+10:l=d,e(d>=0&&l1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=x}catch{i.prototype.inspect=x}else i.prototype.inspect=x;function x(){return(this.red?""}var k=["","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"],_=[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],B=[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];i.prototype.toString=function(o,u){o=o||10,u=u|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,l=0,w=0;w>>24-h&16777215,h+=2,h>=26&&(h-=26,w--),l!==0||w!==this.length-1?f=k[6-d.length]+d+f:f=d+f}for(l!==0&&(f=l.toString(16)+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var a=_[o],g=B[o];f="";var M=this.clone();for(M.negative=0;!M.isZero();){var R=M.modrn(g).toString(o);M=M.idivn(g),M.isZero()?f=R+f:f=k[a-R.length]+R+f}for(this.isZero()&&(f="0"+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}e(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16,2)},s&&(i.prototype.toBuffer=function(o,u){return this.toArrayLike(s,o,u)}),i.prototype.toArray=function(o,u){return this.toArrayLike(Array,o,u)};var P=function(o,u){return o.allocUnsafe?o.allocUnsafe(u):new o(u)};i.prototype.toArrayLike=function(o,u,f){this._strip();var h=this.byteLength(),l=f||Math.max(1,h);e(h<=l,"byte array longer than desired length"),e(l>0,"Requested array length <= 0");var w=P(o,l),b=u==="le"?"LE":"BE";return this["_toArrayLike"+b](w,h),w},i.prototype._toArrayLikeLE=function(o,u){for(var f=0,h=0,l=0,w=0;l>8&255),f>16&255),w===6?(f>24&255),h=0,w=0):(h=b>>>24,w+=2)}if(f=0&&(o[f--]=b>>8&255),f>=0&&(o[f--]=b>>16&255),w===6?(f>=0&&(o[f--]=b>>24&255),h=0,w=0):(h=b>>>24,w+=2)}if(f>=0)for(o[f--]=h;f>=0;)o[f--]=0},Math.clz32?i.prototype._countBits=function(o){return 32-Math.clz32(o)}:i.prototype._countBits=function(o){var u=o,f=0;return u>=4096&&(f+=13,u>>>=13),u>=64&&(f+=7,u>>>=7),u>=8&&(f+=4,u>>>=4),u>=2&&(f+=2,u>>>=2),f+u},i.prototype._zeroBits=function(o){if(o===0)return 26;var u=o,f=0;return u&8191||(f+=13,u>>>=13),u&127||(f+=7,u>>>=7),u&15||(f+=4,u>>>=4),u&3||(f+=2,u>>>=2),u&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],u=this._countBits(o);return(this.length-1)*26+u};function I(m){for(var o=new Array(m.bitLength()),u=0;u>>h&1}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,u=0;uo.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var u;this.length>o.length?u=o:u=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var u,f;this.length>o.length?(u=this,f=o):(u=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){e(typeof o=="number"&&o>=0);var u=Math.ceil(o/26)|0,f=o%26;this._expand(u),f>0&&u--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this._strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,u){e(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),u?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var l=0,w=0;w>>26;for(;l!==0&&w>>26;if(this.length=f.length,l!==0)this.words[this.length]=l,this.length++;else if(f!==this)for(;wo.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var u=this.iadd(o);return o.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,l;f>0?(h=this,l=o):(h=o,l=this);for(var w=0,b=0;b>26,this.words[b]=u&67108863;for(;w!==0&&b>26,this.words[b]=u&67108863;if(w===0&&b>>26,M=d&67108863,R=Math.min(a,o.length-1),T=Math.max(0,a-m.length+1);T<=R;T++){var F=a-T|0;h=m.words[F]|0,l=o.words[T]|0,w=h*l+M,g+=w/67108864|0,M=w&67108863}u.words[a]=M|0,d=g|0}return d!==0?u.words[a]=d|0:u.length--,u._strip()}var O=function(o,u,f){var h=o.words,l=u.words,w=f.words,b=0,d,a,g,M=h[0]|0,R=M&8191,T=M>>>13,F=h[1]|0,V=F&8191,X=F>>>13,jt=h[2]|0,Y=jt&8191,tt=jt>>>13,Ee=h[3]|0,ut=Ee&8191,ct=Ee>>>13,Cr=h[4]|0,gt=Cr&8191,mt=Cr>>>13,Or=h[5]|0,ft=Or&8191,ht=Or>>>13,Je=h[6]|0,lt=Je&8191,dt=Je>>>13,hr=h[7]|0,pt=hr&8191,yt=hr>>>13,Ur=h[8]|0,wt=Ur&8191,bt=Ur>>>13,Nr=h[9]|0,xt=Nr&8191,kt=Nr>>>13,Jn=l[0]|0,St=Jn&8191,Bt=Jn>>>13,Xn=l[1]|0,Et=Xn&8191,_t=Xn>>>13,Qn=l[2]|0,It=Qn&8191,At=Qn>>>13,ti=l[3]|0,Mt=ti&8191,Lt=ti>>>13,ei=l[4]|0,Rt=ei&8191,Tt=ei>>>13,ri=l[5]|0,Pt=ri&8191,Ct=ri>>>13,ni=l[6]|0,Ot=ni&8191,Ut=ni>>>13,ii=l[7]|0,Nt=ii&8191,zt=ii>>>13,oi=l[8]|0,qt=oi&8191,Ft=oi>>>13,si=l[9]|0,Kt=si&8191,Dt=si>>>13;f.negative=o.negative^u.negative,f.length=19,d=Math.imul(R,St),a=Math.imul(R,Bt),a=a+Math.imul(T,St)|0,g=Math.imul(T,Bt);var zr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(zr>>>26)|0,zr&=67108863,d=Math.imul(V,St),a=Math.imul(V,Bt),a=a+Math.imul(X,St)|0,g=Math.imul(X,Bt),d=d+Math.imul(R,Et)|0,a=a+Math.imul(R,_t)|0,a=a+Math.imul(T,Et)|0,g=g+Math.imul(T,_t)|0;var qr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(qr>>>26)|0,qr&=67108863,d=Math.imul(Y,St),a=Math.imul(Y,Bt),a=a+Math.imul(tt,St)|0,g=Math.imul(tt,Bt),d=d+Math.imul(V,Et)|0,a=a+Math.imul(V,_t)|0,a=a+Math.imul(X,Et)|0,g=g+Math.imul(X,_t)|0,d=d+Math.imul(R,It)|0,a=a+Math.imul(R,At)|0,a=a+Math.imul(T,It)|0,g=g+Math.imul(T,At)|0;var Fr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,d=Math.imul(ut,St),a=Math.imul(ut,Bt),a=a+Math.imul(ct,St)|0,g=Math.imul(ct,Bt),d=d+Math.imul(Y,Et)|0,a=a+Math.imul(Y,_t)|0,a=a+Math.imul(tt,Et)|0,g=g+Math.imul(tt,_t)|0,d=d+Math.imul(V,It)|0,a=a+Math.imul(V,At)|0,a=a+Math.imul(X,It)|0,g=g+Math.imul(X,At)|0,d=d+Math.imul(R,Mt)|0,a=a+Math.imul(R,Lt)|0,a=a+Math.imul(T,Mt)|0,g=g+Math.imul(T,Lt)|0;var Kr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,d=Math.imul(gt,St),a=Math.imul(gt,Bt),a=a+Math.imul(mt,St)|0,g=Math.imul(mt,Bt),d=d+Math.imul(ut,Et)|0,a=a+Math.imul(ut,_t)|0,a=a+Math.imul(ct,Et)|0,g=g+Math.imul(ct,_t)|0,d=d+Math.imul(Y,It)|0,a=a+Math.imul(Y,At)|0,a=a+Math.imul(tt,It)|0,g=g+Math.imul(tt,At)|0,d=d+Math.imul(V,Mt)|0,a=a+Math.imul(V,Lt)|0,a=a+Math.imul(X,Mt)|0,g=g+Math.imul(X,Lt)|0,d=d+Math.imul(R,Rt)|0,a=a+Math.imul(R,Tt)|0,a=a+Math.imul(T,Rt)|0,g=g+Math.imul(T,Tt)|0;var Dr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,d=Math.imul(ft,St),a=Math.imul(ft,Bt),a=a+Math.imul(ht,St)|0,g=Math.imul(ht,Bt),d=d+Math.imul(gt,Et)|0,a=a+Math.imul(gt,_t)|0,a=a+Math.imul(mt,Et)|0,g=g+Math.imul(mt,_t)|0,d=d+Math.imul(ut,It)|0,a=a+Math.imul(ut,At)|0,a=a+Math.imul(ct,It)|0,g=g+Math.imul(ct,At)|0,d=d+Math.imul(Y,Mt)|0,a=a+Math.imul(Y,Lt)|0,a=a+Math.imul(tt,Mt)|0,g=g+Math.imul(tt,Lt)|0,d=d+Math.imul(V,Rt)|0,a=a+Math.imul(V,Tt)|0,a=a+Math.imul(X,Rt)|0,g=g+Math.imul(X,Tt)|0,d=d+Math.imul(R,Pt)|0,a=a+Math.imul(R,Ct)|0,a=a+Math.imul(T,Pt)|0,g=g+Math.imul(T,Ct)|0;var Wr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,d=Math.imul(lt,St),a=Math.imul(lt,Bt),a=a+Math.imul(dt,St)|0,g=Math.imul(dt,Bt),d=d+Math.imul(ft,Et)|0,a=a+Math.imul(ft,_t)|0,a=a+Math.imul(ht,Et)|0,g=g+Math.imul(ht,_t)|0,d=d+Math.imul(gt,It)|0,a=a+Math.imul(gt,At)|0,a=a+Math.imul(mt,It)|0,g=g+Math.imul(mt,At)|0,d=d+Math.imul(ut,Mt)|0,a=a+Math.imul(ut,Lt)|0,a=a+Math.imul(ct,Mt)|0,g=g+Math.imul(ct,Lt)|0,d=d+Math.imul(Y,Rt)|0,a=a+Math.imul(Y,Tt)|0,a=a+Math.imul(tt,Rt)|0,g=g+Math.imul(tt,Tt)|0,d=d+Math.imul(V,Pt)|0,a=a+Math.imul(V,Ct)|0,a=a+Math.imul(X,Pt)|0,g=g+Math.imul(X,Ct)|0,d=d+Math.imul(R,Ot)|0,a=a+Math.imul(R,Ut)|0,a=a+Math.imul(T,Ot)|0,g=g+Math.imul(T,Ut)|0;var Hr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,d=Math.imul(pt,St),a=Math.imul(pt,Bt),a=a+Math.imul(yt,St)|0,g=Math.imul(yt,Bt),d=d+Math.imul(lt,Et)|0,a=a+Math.imul(lt,_t)|0,a=a+Math.imul(dt,Et)|0,g=g+Math.imul(dt,_t)|0,d=d+Math.imul(ft,It)|0,a=a+Math.imul(ft,At)|0,a=a+Math.imul(ht,It)|0,g=g+Math.imul(ht,At)|0,d=d+Math.imul(gt,Mt)|0,a=a+Math.imul(gt,Lt)|0,a=a+Math.imul(mt,Mt)|0,g=g+Math.imul(mt,Lt)|0,d=d+Math.imul(ut,Rt)|0,a=a+Math.imul(ut,Tt)|0,a=a+Math.imul(ct,Rt)|0,g=g+Math.imul(ct,Tt)|0,d=d+Math.imul(Y,Pt)|0,a=a+Math.imul(Y,Ct)|0,a=a+Math.imul(tt,Pt)|0,g=g+Math.imul(tt,Ct)|0,d=d+Math.imul(V,Ot)|0,a=a+Math.imul(V,Ut)|0,a=a+Math.imul(X,Ot)|0,g=g+Math.imul(X,Ut)|0,d=d+Math.imul(R,Nt)|0,a=a+Math.imul(R,zt)|0,a=a+Math.imul(T,Nt)|0,g=g+Math.imul(T,zt)|0;var $r=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+($r>>>26)|0,$r&=67108863,d=Math.imul(wt,St),a=Math.imul(wt,Bt),a=a+Math.imul(bt,St)|0,g=Math.imul(bt,Bt),d=d+Math.imul(pt,Et)|0,a=a+Math.imul(pt,_t)|0,a=a+Math.imul(yt,Et)|0,g=g+Math.imul(yt,_t)|0,d=d+Math.imul(lt,It)|0,a=a+Math.imul(lt,At)|0,a=a+Math.imul(dt,It)|0,g=g+Math.imul(dt,At)|0,d=d+Math.imul(ft,Mt)|0,a=a+Math.imul(ft,Lt)|0,a=a+Math.imul(ht,Mt)|0,g=g+Math.imul(ht,Lt)|0,d=d+Math.imul(gt,Rt)|0,a=a+Math.imul(gt,Tt)|0,a=a+Math.imul(mt,Rt)|0,g=g+Math.imul(mt,Tt)|0,d=d+Math.imul(ut,Pt)|0,a=a+Math.imul(ut,Ct)|0,a=a+Math.imul(ct,Pt)|0,g=g+Math.imul(ct,Ct)|0,d=d+Math.imul(Y,Ot)|0,a=a+Math.imul(Y,Ut)|0,a=a+Math.imul(tt,Ot)|0,g=g+Math.imul(tt,Ut)|0,d=d+Math.imul(V,Nt)|0,a=a+Math.imul(V,zt)|0,a=a+Math.imul(X,Nt)|0,g=g+Math.imul(X,zt)|0,d=d+Math.imul(R,qt)|0,a=a+Math.imul(R,Ft)|0,a=a+Math.imul(T,qt)|0,g=g+Math.imul(T,Ft)|0;var Vr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,d=Math.imul(xt,St),a=Math.imul(xt,Bt),a=a+Math.imul(kt,St)|0,g=Math.imul(kt,Bt),d=d+Math.imul(wt,Et)|0,a=a+Math.imul(wt,_t)|0,a=a+Math.imul(bt,Et)|0,g=g+Math.imul(bt,_t)|0,d=d+Math.imul(pt,It)|0,a=a+Math.imul(pt,At)|0,a=a+Math.imul(yt,It)|0,g=g+Math.imul(yt,At)|0,d=d+Math.imul(lt,Mt)|0,a=a+Math.imul(lt,Lt)|0,a=a+Math.imul(dt,Mt)|0,g=g+Math.imul(dt,Lt)|0,d=d+Math.imul(ft,Rt)|0,a=a+Math.imul(ft,Tt)|0,a=a+Math.imul(ht,Rt)|0,g=g+Math.imul(ht,Tt)|0,d=d+Math.imul(gt,Pt)|0,a=a+Math.imul(gt,Ct)|0,a=a+Math.imul(mt,Pt)|0,g=g+Math.imul(mt,Ct)|0,d=d+Math.imul(ut,Ot)|0,a=a+Math.imul(ut,Ut)|0,a=a+Math.imul(ct,Ot)|0,g=g+Math.imul(ct,Ut)|0,d=d+Math.imul(Y,Nt)|0,a=a+Math.imul(Y,zt)|0,a=a+Math.imul(tt,Nt)|0,g=g+Math.imul(tt,zt)|0,d=d+Math.imul(V,qt)|0,a=a+Math.imul(V,Ft)|0,a=a+Math.imul(X,qt)|0,g=g+Math.imul(X,Ft)|0,d=d+Math.imul(R,Kt)|0,a=a+Math.imul(R,Dt)|0,a=a+Math.imul(T,Kt)|0,g=g+Math.imul(T,Dt)|0;var Gr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,d=Math.imul(xt,Et),a=Math.imul(xt,_t),a=a+Math.imul(kt,Et)|0,g=Math.imul(kt,_t),d=d+Math.imul(wt,It)|0,a=a+Math.imul(wt,At)|0,a=a+Math.imul(bt,It)|0,g=g+Math.imul(bt,At)|0,d=d+Math.imul(pt,Mt)|0,a=a+Math.imul(pt,Lt)|0,a=a+Math.imul(yt,Mt)|0,g=g+Math.imul(yt,Lt)|0,d=d+Math.imul(lt,Rt)|0,a=a+Math.imul(lt,Tt)|0,a=a+Math.imul(dt,Rt)|0,g=g+Math.imul(dt,Tt)|0,d=d+Math.imul(ft,Pt)|0,a=a+Math.imul(ft,Ct)|0,a=a+Math.imul(ht,Pt)|0,g=g+Math.imul(ht,Ct)|0,d=d+Math.imul(gt,Ot)|0,a=a+Math.imul(gt,Ut)|0,a=a+Math.imul(mt,Ot)|0,g=g+Math.imul(mt,Ut)|0,d=d+Math.imul(ut,Nt)|0,a=a+Math.imul(ut,zt)|0,a=a+Math.imul(ct,Nt)|0,g=g+Math.imul(ct,zt)|0,d=d+Math.imul(Y,qt)|0,a=a+Math.imul(Y,Ft)|0,a=a+Math.imul(tt,qt)|0,g=g+Math.imul(tt,Ft)|0,d=d+Math.imul(V,Kt)|0,a=a+Math.imul(V,Dt)|0,a=a+Math.imul(X,Kt)|0,g=g+Math.imul(X,Dt)|0;var Zr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,d=Math.imul(xt,It),a=Math.imul(xt,At),a=a+Math.imul(kt,It)|0,g=Math.imul(kt,At),d=d+Math.imul(wt,Mt)|0,a=a+Math.imul(wt,Lt)|0,a=a+Math.imul(bt,Mt)|0,g=g+Math.imul(bt,Lt)|0,d=d+Math.imul(pt,Rt)|0,a=a+Math.imul(pt,Tt)|0,a=a+Math.imul(yt,Rt)|0,g=g+Math.imul(yt,Tt)|0,d=d+Math.imul(lt,Pt)|0,a=a+Math.imul(lt,Ct)|0,a=a+Math.imul(dt,Pt)|0,g=g+Math.imul(dt,Ct)|0,d=d+Math.imul(ft,Ot)|0,a=a+Math.imul(ft,Ut)|0,a=a+Math.imul(ht,Ot)|0,g=g+Math.imul(ht,Ut)|0,d=d+Math.imul(gt,Nt)|0,a=a+Math.imul(gt,zt)|0,a=a+Math.imul(mt,Nt)|0,g=g+Math.imul(mt,zt)|0,d=d+Math.imul(ut,qt)|0,a=a+Math.imul(ut,Ft)|0,a=a+Math.imul(ct,qt)|0,g=g+Math.imul(ct,Ft)|0,d=d+Math.imul(Y,Kt)|0,a=a+Math.imul(Y,Dt)|0,a=a+Math.imul(tt,Kt)|0,g=g+Math.imul(tt,Dt)|0;var jr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(jr>>>26)|0,jr&=67108863,d=Math.imul(xt,Mt),a=Math.imul(xt,Lt),a=a+Math.imul(kt,Mt)|0,g=Math.imul(kt,Lt),d=d+Math.imul(wt,Rt)|0,a=a+Math.imul(wt,Tt)|0,a=a+Math.imul(bt,Rt)|0,g=g+Math.imul(bt,Tt)|0,d=d+Math.imul(pt,Pt)|0,a=a+Math.imul(pt,Ct)|0,a=a+Math.imul(yt,Pt)|0,g=g+Math.imul(yt,Ct)|0,d=d+Math.imul(lt,Ot)|0,a=a+Math.imul(lt,Ut)|0,a=a+Math.imul(dt,Ot)|0,g=g+Math.imul(dt,Ut)|0,d=d+Math.imul(ft,Nt)|0,a=a+Math.imul(ft,zt)|0,a=a+Math.imul(ht,Nt)|0,g=g+Math.imul(ht,zt)|0,d=d+Math.imul(gt,qt)|0,a=a+Math.imul(gt,Ft)|0,a=a+Math.imul(mt,qt)|0,g=g+Math.imul(mt,Ft)|0,d=d+Math.imul(ut,Kt)|0,a=a+Math.imul(ut,Dt)|0,a=a+Math.imul(ct,Kt)|0,g=g+Math.imul(ct,Dt)|0;var Yr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,d=Math.imul(xt,Rt),a=Math.imul(xt,Tt),a=a+Math.imul(kt,Rt)|0,g=Math.imul(kt,Tt),d=d+Math.imul(wt,Pt)|0,a=a+Math.imul(wt,Ct)|0,a=a+Math.imul(bt,Pt)|0,g=g+Math.imul(bt,Ct)|0,d=d+Math.imul(pt,Ot)|0,a=a+Math.imul(pt,Ut)|0,a=a+Math.imul(yt,Ot)|0,g=g+Math.imul(yt,Ut)|0,d=d+Math.imul(lt,Nt)|0,a=a+Math.imul(lt,zt)|0,a=a+Math.imul(dt,Nt)|0,g=g+Math.imul(dt,zt)|0,d=d+Math.imul(ft,qt)|0,a=a+Math.imul(ft,Ft)|0,a=a+Math.imul(ht,qt)|0,g=g+Math.imul(ht,Ft)|0,d=d+Math.imul(gt,Kt)|0,a=a+Math.imul(gt,Dt)|0,a=a+Math.imul(mt,Kt)|0,g=g+Math.imul(mt,Dt)|0;var Jr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,d=Math.imul(xt,Pt),a=Math.imul(xt,Ct),a=a+Math.imul(kt,Pt)|0,g=Math.imul(kt,Ct),d=d+Math.imul(wt,Ot)|0,a=a+Math.imul(wt,Ut)|0,a=a+Math.imul(bt,Ot)|0,g=g+Math.imul(bt,Ut)|0,d=d+Math.imul(pt,Nt)|0,a=a+Math.imul(pt,zt)|0,a=a+Math.imul(yt,Nt)|0,g=g+Math.imul(yt,zt)|0,d=d+Math.imul(lt,qt)|0,a=a+Math.imul(lt,Ft)|0,a=a+Math.imul(dt,qt)|0,g=g+Math.imul(dt,Ft)|0,d=d+Math.imul(ft,Kt)|0,a=a+Math.imul(ft,Dt)|0,a=a+Math.imul(ht,Kt)|0,g=g+Math.imul(ht,Dt)|0;var Xr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,d=Math.imul(xt,Ot),a=Math.imul(xt,Ut),a=a+Math.imul(kt,Ot)|0,g=Math.imul(kt,Ut),d=d+Math.imul(wt,Nt)|0,a=a+Math.imul(wt,zt)|0,a=a+Math.imul(bt,Nt)|0,g=g+Math.imul(bt,zt)|0,d=d+Math.imul(pt,qt)|0,a=a+Math.imul(pt,Ft)|0,a=a+Math.imul(yt,qt)|0,g=g+Math.imul(yt,Ft)|0,d=d+Math.imul(lt,Kt)|0,a=a+Math.imul(lt,Dt)|0,a=a+Math.imul(dt,Kt)|0,g=g+Math.imul(dt,Dt)|0;var Qr=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,d=Math.imul(xt,Nt),a=Math.imul(xt,zt),a=a+Math.imul(kt,Nt)|0,g=Math.imul(kt,zt),d=d+Math.imul(wt,qt)|0,a=a+Math.imul(wt,Ft)|0,a=a+Math.imul(bt,qt)|0,g=g+Math.imul(bt,Ft)|0,d=d+Math.imul(pt,Kt)|0,a=a+Math.imul(pt,Dt)|0,a=a+Math.imul(yt,Kt)|0,g=g+Math.imul(yt,Dt)|0;var tn=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(tn>>>26)|0,tn&=67108863,d=Math.imul(xt,qt),a=Math.imul(xt,Ft),a=a+Math.imul(kt,qt)|0,g=Math.imul(kt,Ft),d=d+Math.imul(wt,Kt)|0,a=a+Math.imul(wt,Dt)|0,a=a+Math.imul(bt,Kt)|0,g=g+Math.imul(bt,Dt)|0;var en=(b+d|0)+((a&8191)<<13)|0;b=(g+(a>>>13)|0)+(en>>>26)|0,en&=67108863,d=Math.imul(xt,Kt),a=Math.imul(xt,Dt),a=a+Math.imul(kt,Kt)|0,g=Math.imul(kt,Dt);var rn=(b+d|0)+((a&8191)<<13)|0;return b=(g+(a>>>13)|0)+(rn>>>26)|0,rn&=67108863,w[0]=zr,w[1]=qr,w[2]=Fr,w[3]=Kr,w[4]=Dr,w[5]=Wr,w[6]=Hr,w[7]=$r,w[8]=Vr,w[9]=Gr,w[10]=Zr,w[11]=jr,w[12]=Yr,w[13]=Jr,w[14]=Xr,w[15]=Qr,w[16]=tn,w[17]=en,w[18]=rn,b!==0&&(w[19]=b,f.length++),f};Math.imul||(O=E);function K(m,o,u){u.negative=o.negative^m.negative,u.length=m.length+o.length;for(var f=0,h=0,l=0;l>>26)|0,h+=w>>>26,w&=67108863}u.words[l]=b,f=w,w=h}return f!==0?u.words[l]=f:u.length--,u._strip()}function z(m,o,u){return K(m,o,u)}i.prototype.mulTo=function(o,u){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=O(this,o,u):h<63?f=E(this,o,u):h<1024?f=K(this,o,u):f=z(this,o,u),f};function D(m,o){this.x=m,this.y=o}D.prototype.makeRBT=function(o){for(var u=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},D.prototype.permute=function(o,u,f,h,l,w){for(var b=0;b>>1)l++;return 1<>>13,f[2*w+1]=l&8191,l=l>>>13;for(w=2*u;w>=26,f+=l/67108864|0,f+=w>>>26,this.words[h]=w&67108863}return f!==0&&(this.words[h]=f,this.length++),u?this.ineg():this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var u=I(o);if(u.length===0)return new i(1);for(var f=this,h=0;h=0);var u=o%26,f=(o-u)/26,h=67108863>>>26-u<<26-u,l;if(u!==0){var w=0;for(l=0;l>>26-u}w&&(this.words[l]=w,this.length++)}if(f!==0){for(l=this.length-1;l>=0;l--)this.words[l+f]=this.words[l];for(l=0;l=0);var h;u?h=(u-u%26)/26:h=0;var l=o%26,w=Math.min((o-l)/26,this.length),b=67108863^67108863>>>l<w)for(this.length-=w,a=0;a=0&&(g!==0||a>=h);a--){var M=this.words[a]|0;this.words[a]=g<<26-l|M>>>l,g=M&b}return d&&g!==0&&(d.words[d.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(o,u,f){return e(this.negative===0),this.iushrn(o,u,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){e(typeof o=="number"&&o>=0);var u=o%26,f=(o-u)/26,h=1<=0);var u=o%26,f=(o-u)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(u!==0&&f++,this.length=Math.min(f,this.length),u!==0){var h=67108863^67108863>>>u<=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},i.prototype.isubn=function(o){if(e(typeof o=="number"),e(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u>26)-(d/67108864|0),this.words[l+f]=w&67108863}for(;l>26,this.words[l+f]=w&67108863;if(b===0)return this._strip();for(e(b===-1),b=0,l=0;l>26,this.words[l]=w&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(o,u){var f=this.length-o.length,h=this.clone(),l=o,w=l.words[l.length-1]|0,b=this._countBits(w);f=26-b,f!==0&&(l=l.ushln(f),h.iushln(f),w=l.words[l.length-1]|0);var d=h.length-l.length,a;if(u!=="mod"){a=new i(null),a.length=d+1,a.words=new Array(a.length);for(var g=0;g=0;R--){var T=(h.words[l.length+R]|0)*67108864+(h.words[l.length+R-1]|0);for(T=Math.min(T/w|0,67108863),h._ishlnsubmul(l,T,R);h.negative!==0;)T--,h.negative=0,h._ishlnsubmul(l,1,R),h.isZero()||(h.negative^=1);a&&(a.words[R]=T)}return a&&a._strip(),h._strip(),u!=="div"&&f!==0&&h.iushrn(f),{div:a||null,mod:h}},i.prototype.divmod=function(o,u,f){if(e(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,l,w;return this.negative!==0&&o.negative===0?(w=this.neg().divmod(o,u),u!=="mod"&&(h=w.div.neg()),u!=="div"&&(l=w.mod.neg(),f&&l.negative!==0&&l.iadd(o)),{div:h,mod:l}):this.negative===0&&o.negative!==0?(w=this.divmod(o.neg(),u),u!=="mod"&&(h=w.div.neg()),{div:h,mod:w.mod}):this.negative&o.negative?(w=this.neg().divmod(o.neg(),u),u!=="div"&&(l=w.mod.neg(),f&&l.negative!==0&&l.isub(o)),{div:w.div,mod:l}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?u==="div"?{div:this.divn(o.words[0]),mod:null}:u==="mod"?{div:null,mod:new i(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modrn(o.words[0]))}:this._wordDiv(o,u)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var u=this.divmod(o);if(u.mod.isZero())return u.div;var f=u.div.negative!==0?u.mod.isub(o):u.mod,h=o.ushrn(1),l=o.andln(1),w=f.cmp(h);return w<0||l===1&&w===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},i.prototype.modrn=function(o){var u=o<0;u&&(o=-o),e(o<=67108863);for(var f=(1<<26)%o,h=0,l=this.length-1;l>=0;l--)h=(f*h+(this.words[l]|0))%o;return u?-h:h},i.prototype.modn=function(o){return this.modrn(o)},i.prototype.idivn=function(o){var u=o<0;u&&(o=-o),e(o<=67108863);for(var f=0,h=this.length-1;h>=0;h--){var l=(this.words[h]|0)+f*67108864;this.words[h]=l/o|0,f=l%o}return this._strip(),u?this.ineg():this},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){e(o.negative===0),e(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var h=new i(1),l=new i(0),w=new i(0),b=new i(1),d=0;u.isEven()&&f.isEven();)u.iushrn(1),f.iushrn(1),++d;for(var a=f.clone(),g=u.clone();!u.isZero();){for(var M=0,R=1;!(u.words[0]&R)&&M<26;++M,R<<=1);if(M>0)for(u.iushrn(M);M-- >0;)(h.isOdd()||l.isOdd())&&(h.iadd(a),l.isub(g)),h.iushrn(1),l.iushrn(1);for(var T=0,F=1;!(f.words[0]&F)&&T<26;++T,F<<=1);if(T>0)for(f.iushrn(T);T-- >0;)(w.isOdd()||b.isOdd())&&(w.iadd(a),b.isub(g)),w.iushrn(1),b.iushrn(1);u.cmp(f)>=0?(u.isub(f),h.isub(w),l.isub(b)):(f.isub(u),w.isub(h),b.isub(l))}return{a:w,b,gcd:f.iushln(d)}},i.prototype._invmp=function(o){e(o.negative===0),e(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var h=new i(1),l=new i(0),w=f.clone();u.cmpn(1)>0&&f.cmpn(1)>0;){for(var b=0,d=1;!(u.words[0]&d)&&b<26;++b,d<<=1);if(b>0)for(u.iushrn(b);b-- >0;)h.isOdd()&&h.iadd(w),h.iushrn(1);for(var a=0,g=1;!(f.words[0]&g)&&a<26;++a,g<<=1);if(a>0)for(f.iushrn(a);a-- >0;)l.isOdd()&&l.iadd(w),l.iushrn(1);u.cmp(f)>=0?(u.isub(f),h.isub(l)):(f.isub(u),l.isub(h))}var M;return u.cmpn(1)===0?M=h:M=l,M.cmpn(0)<0&&M.iadd(o),M},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var u=this.clone(),f=o.clone();u.negative=0,f.negative=0;for(var h=0;u.isEven()&&f.isEven();h++)u.iushrn(1),f.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;f.isEven();)f.iushrn(1);var l=u.cmp(f);if(l<0){var w=u;u=f,f=w}else if(l===0||f.cmpn(1)===0)break;u.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){e(typeof o=="number");var u=o%26,f=(o-u)/26,h=1<>>26,b&=67108863,this.words[w]=b}return l!==0&&(this.words[w]=l,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var u=o<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var f;if(this.length>1)f=1;else{u&&(o=-o),e(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,l=o.words[f]|0;if(h!==l){hl&&(u=1);break}}return u},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return e(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return e(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var et={k256:null,p224:null,p192:null,p25519:null};function W(m,o){this.name=m,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}W.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},W.prototype.ireduce=function(o){var u=o,f;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),f=u.bitLength();while(f>this.n);var h=f0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},W.prototype.split=function(o,u){o.iushrn(this.n,0,u)},W.prototype.imulK=function(o){return o.imul(this.k)};function J(){W.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}r(J,W),J.prototype.split=function(o,u){for(var f=4194303,h=Math.min(o.length,9),l=0;l>>22,w=b}w>>>=22,o.words[l-10]=w,w===0&&o.length>10?o.length-=10:o.length-=9},J.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var u=0,f=0;f>>=26,o.words[f]=l,u=h}return u!==0&&(o.words[o.length++]=u),o},i._prime=function(o){if(et[o])return et[o];var u;if(o==="k256")u=new J;else if(o==="p224")u=new Q;else if(o==="p192")u=new nt;else if(o==="p25519")u=new te;else throw new Error("Unknown prime "+o);return et[o]=u,u};function G(m){if(typeof m=="string"){var o=i._prime(m);this.m=o.p,this.prime=o}else e(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}G.prototype._verify1=function(o){e(o.negative===0,"red works only with positives"),e(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,u){e((o.negative|u.negative)===0,"red works only with positives"),e(o.red&&o.red===u.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(v(o,o.umod(this.m)._forceRed(this)),o)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,u){this._verify2(o,u);var f=o.add(u);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,u){this._verify2(o,u);var f=o.iadd(u);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,u){this._verify2(o,u);var f=o.sub(u);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,u){this._verify2(o,u);var f=o.isub(u);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,u){return this._verify1(o),this.imod(o.ushln(u))},G.prototype.imul=function(o,u){return this._verify2(o,u),this.imod(o.imul(u))},G.prototype.mul=function(o,u){return this._verify2(o,u),this.imod(o.mul(u))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var u=this.m.andln(3);if(e(u%2===1),u===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),l=0;!h.isZero()&&h.andln(1)===0;)l++,h.iushrn(1);e(!h.isZero());var w=new i(1).toRed(this),b=w.redNeg(),d=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new i(2*a*a).toRed(this);this.pow(a,d).cmp(b)!==0;)a.redIAdd(b);for(var g=this.pow(a,h),M=this.pow(o,h.addn(1).iushrn(1)),R=this.pow(o,h),T=l;R.cmp(w)!==0;){for(var F=R,V=0;F.cmp(w)!==0;V++)F=F.redSqr();e(V=0;l--){for(var g=u.words[l],M=a-1;M>=0;M--){var R=g>>M&1;if(w!==h[0]&&(w=this.sqr(w)),R===0&&b===0){d=0;continue}b<<=1,b|=R,d++,!(d!==f&&(l!==0||M!==0))&&(w=this.mul(w,h[b]),d=0,b=0)}a=26}return w},G.prototype.convertTo=function(o){var u=o.umod(this.m);return u===o?u.clone():u},G.prototype.convertFrom=function(o){var u=o.clone();return u.red=null,u},i.mont=function(o){return new st(o)};function st(m){G.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}r(st,G),st.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},st.prototype.convertFrom=function(o){var u=this.imod(o.mul(this.rinv));return u.red=null,u},st.prototype.imul=function(o,u){if(o.isZero()||u.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(u),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=f.isub(h).iushrn(this.shift),w=l;return l.cmp(this.m)>=0?w=l.isub(this.m):l.cmpn(0)<0&&(w=l.iadd(this.m)),w._forceRed(this)},st.prototype.mul=function(o,u){if(o.isZero()||u.isZero())return new i(0)._forceRed(this);var f=o.mul(u),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=f.isub(h).iushrn(this.shift),w=l;return l.cmp(this.m)>=0?w=l.isub(this.m):l.cmpn(0)<0&&(w=l.iadd(this.m)),w._forceRed(this)},st.prototype.invm=function(o){var u=this.imod(o._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof qs>"u"||qs,Ku)});var Hu=fe((yg,Wu)=>{var gg=C(N()),Pl=Us(),Cl="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Wu.exports=Pl(Cl)});var $u=fe(Ds=>{"use strict";var wg=C(N());function ir(n,t,e){return t<=n&&n<=e}function oo(n){if(n===void 0)return{};if(n===Object(n))return n;throw TypeError("Could not convert argument to dictionary")}function Ol(n){for(var t=String(n),e=t.length,r=0,i=[];r57343)i.push(s);else if(56320<=s&&s<=57343)i.push(65533);else if(55296<=s&&s<=56319)if(r===e-1)i.push(65533);else{var c=n.charCodeAt(r+1);if(56320<=c&&c<=57343){var p=s&1023,y=c&1023;i.push(65536+(p<<10)+y),r+=1}else i.push(65533)}r+=1}return i}function Ul(n){for(var t="",e=0;e>10)+55296,(r&1023)+56320))}return t}var eo=-1;function Ks(n){this.tokens=[].slice.call(n)}Ks.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():eo},prepend:function(n){if(Array.isArray(n))for(var t=n;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(n)},push:function(n){if(Array.isArray(n))for(var t=n;t.length;)this.tokens.push(t.shift());else this.tokens.push(n)}};var On=-1;function Fs(n,t){if(n)throw TypeError("Decoder error");return t||65533}var ro="utf-8";function no(n,t){if(!(this instanceof no))return new no(n,t);if(n=n!==void 0?String(n).toLowerCase():ro,n!==ro)throw new Error("Encoding not supported. Only utf-8 is supported");t=oo(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}no.prototype={decode:function(t,e){var r;typeof t=="object"&&t instanceof ArrayBuffer?r=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):r=new Uint8Array(0),e=oo(e),this._streaming||(this._decoder=new Nl({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var i=new Ks(r),s=[],c;!i.endOfStream()&&(c=this._decoder.handler(i,i.read()),c!==On);)c!==null&&(Array.isArray(c)?s.push.apply(s,c):s.push(c));if(!this._streaming){do{if(c=this._decoder.handler(i,i.read()),c===On)break;c!==null&&(Array.isArray(c)?s.push.apply(s,c):s.push(c))}while(!i.endOfStream());this._decoder=null}return s.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(s[0]===65279?(this._BOMseen=!0,s.shift()):this._BOMseen=!0),Ul(s)}};function io(n,t){if(!(this instanceof io))return new io(n,t);if(n=n!==void 0?String(n).toLowerCase():ro,n!==ro)throw new Error("Encoding not supported. Only utf-8 is supported");t=oo(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}io.prototype={encode:function(t,e){t=t?String(t):"",e=oo(e),this._streaming||(this._encoder=new zl(this._options)),this._streaming=!!e.stream;for(var r=[],i=new Ks(Ol(t)),s;!i.endOfStream()&&(s=this._encoder.handler(i,i.read()),s!==On);)Array.isArray(s)?r.push.apply(r,s):r.push(s);if(!this._streaming){for(;s=this._encoder.handler(i,i.read()),s!==On;)Array.isArray(s)?r.push.apply(r,s):r.push(s);this._encoder=null}return new Uint8Array(r)}};function Nl(n){var t=n.fatal,e=0,r=0,i=0,s=128,c=191;this.handler=function(p,y){if(y===eo&&i!==0)return i=0,Fs(t);if(y===eo)return On;if(i===0){if(ir(y,0,127))return y;if(ir(y,194,223))i=1,e=y-192;else if(ir(y,224,239))y===224&&(s=160),y===237&&(c=159),i=2,e=y-224;else if(ir(y,240,244))y===240&&(s=144),y===244&&(c=143),i=3,e=y-240;else return Fs(t);return e=e<<6*i,null}if(!ir(y,s,c))return e=i=r=0,s=128,c=191,p.prepend(y),Fs(t);if(s=128,c=191,r+=1,e+=y-128<<6*(i-r),r!==i)return null;var v=e;return e=i=r=0,v}}function zl(n){var t=n.fatal;this.handler=function(e,r){if(r===eo)return On;if(ir(r,0,127))return r;var i,s;ir(r,128,2047)?(i=1,s=192):ir(r,2048,65535)?(i=2,s=224):ir(r,65536,1114111)&&(i=3,s=240);for(var c=[(r>>6*i)+s];i>0;){var p=r>>6*(i-1);c.push(128|p&63),i-=1}return c}}Ds.TextEncoder=io;Ds.TextDecoder=no});var Yu=fe(Qt=>{"use strict";var vg=C(N()),ql=Qt&&Qt.__createBinding||(Object.create?function(n,t,e,r){r===void 0&&(r=e),Object.defineProperty(n,r,{enumerable:!0,get:function(){return t[e]}})}:function(n,t,e,r){r===void 0&&(r=e),n[r]=t[e]}),Fl=Qt&&Qt.__setModuleDefault||(Object.create?function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}:function(n,t){n.default=t}),Ze=Qt&&Qt.__decorate||function(n,t,e,r){var i=arguments.length,s=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,r);else for(var p=n.length-1;p>=0;p--)(c=n[p])&&(s=(i<3?c(s):i>3?c(t,e,s):c(t,e))||s);return i>3&&s&&Object.defineProperty(t,e,s),s},Kl=Qt&&Qt.__importStar||function(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e in n)e!=="default"&&Object.hasOwnProperty.call(n,e)&&ql(t,n,e);return Fl(t,n),t},Vu=Qt&&Qt.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.deserializeUnchecked=Qt.deserialize=Qt.serialize=Qt.BinaryReader=Qt.BinaryWriter=Qt.BorshError=Qt.baseDecode=Qt.baseEncode=void 0;var Er=Vu(Du()),Gu=Vu(Hu()),Dl=Kl($u()),Wl=typeof TextDecoder!="function"?Dl.TextDecoder:TextDecoder,Hl=new Wl("utf-8",{fatal:!0});function $l(n){return typeof n=="string"&&(n=Buffer.from(n,"utf8")),Gu.default.encode(Buffer.from(n))}Qt.baseEncode=$l;function Vl(n){return Buffer.from(Gu.default.decode(n))}Qt.baseDecode=Vl;var Ws=1024,ge=class extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}};Qt.BorshError=ge;var so=class{constructor(){this.buf=Buffer.alloc(Ws),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(Ws)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Buffer.from(new Er.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer.from(new Er.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer.from(new Er.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer.from(new Er.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),t,Buffer.alloc(Ws)]),this.length+=t.length}writeString(t){this.maybeResize();let e=Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(let r of t)this.maybeResize(),e(r)}toArray(){return this.buf.subarray(0,this.length)}};Qt.BinaryWriter=so;function je(n,t,e){let r=e.value;e.value=function(...i){try{return r.apply(this,i)}catch(s){if(s instanceof RangeError){let c=s.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(c)>=0)throw new ge("Reached the end of buffer when deserializing")}throw s}}}var _e=class{constructor(t){this.buf=t,this.offset=0}readU8(){let t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){let t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){let t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){let t=this.readBuffer(8);return new Er.default(t,"le")}readU128(){let t=this.readBuffer(16);return new Er.default(t,"le")}readU256(){let t=this.readBuffer(32);return new Er.default(t,"le")}readU512(){let t=this.readBuffer(64);return new Er.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new ge(`Expected buffer length ${t} isn\'t within bounds`);let e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){let t=this.readU32(),e=this.readBuffer(t);try{return Hl.decode(e)}catch(r){throw new ge(`Error decoding UTF-8 string: ${r}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){let e=this.readU32(),r=Array();for(let i=0;i{yn(n,t,s,r[0],i)});else if(r.kind!==void 0)switch(r.kind){case"option":{e==null?i.writeU8(0):(i.writeU8(1),yn(n,t,e,r.type,i));break}case"map":{i.writeU32(e.size),e.forEach((s,c)=>{yn(n,t,c,r.key,i),yn(n,t,s,r.value,i)});break}default:throw new ge(`FieldType ${r} unrecognized`)}else ju(n,e,i)}catch(s){throw s instanceof ge&&s.addToFieldPath(t),s}}function ju(n,t,e){if(typeof t.borshSerialize=="function"){t.borshSerialize(e);return}let r=n.get(t.constructor);if(!r)throw new ge(`Class ${t.constructor.name} is missing in schema`);if(r.kind==="struct")r.fields.map(([i,s])=>{yn(n,i,t[i],s,e)});else if(r.kind==="enum"){let i=t[r.field];for(let s=0;sgn(n,t,e[0],r))}if(e.kind==="option")return r.readU8()?gn(n,t,e.type,r):void 0;if(e.kind==="map"){let i=new Map,s=r.readU32();for(let c=0;c=r.values.length)throw new ge(`Enum index: ${i} is out of range`);let[s,c]=r.values[i],p=gn(n,s,c,e);return new t({[s]:p})}throw new ge(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`)}function Zl(n,t,e,r=_e){let i=new r(e),s=Hs(n,t,i);if(i.offset{"use strict";var kg=C(N());Object.defineProperty(L,"__esModule",{value:!0});L.s16=L.s8=L.nu64be=L.u48be=L.u40be=L.u32be=L.u24be=L.u16be=L.nu64=L.u48=L.u40=L.u32=L.u24=L.u16=L.u8=L.offset=L.greedy=L.Constant=L.UTF8=L.CString=L.Blob=L.Boolean=L.BitField=L.BitStructure=L.VariantLayout=L.Union=L.UnionLayoutDiscriminator=L.UnionDiscriminator=L.Structure=L.Sequence=L.DoubleBE=L.Double=L.FloatBE=L.Float=L.NearInt64BE=L.NearInt64=L.NearUInt64BE=L.NearUInt64=L.IntBE=L.Int=L.UIntBE=L.UInt=L.OffsetLayout=L.GreedyCount=L.ExternalLayout=L.bindConstructorLayout=L.nameWithProperty=L.Layout=L.uint8ArrayToBuffer=L.checkUint8Array=void 0;L.constant=L.utf8=L.cstr=L.blob=L.unionLayoutDiscriminator=L.union=L.seq=L.bits=L.struct=L.f64be=L.f64=L.f32be=L.f32=L.ns64be=L.s48be=L.s40be=L.s32be=L.s24be=L.s16be=L.ns64=L.s48=L.s40=L.s32=L.s24=void 0;var Vs=Mn();function zn(n){if(!(n instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}L.checkUint8Array=zn;function Yt(n){return zn(n),Vs.Buffer.from(n.buffer,n.byteOffset,n.length)}L.uint8ArrayToBuffer=Yt;var Jt=class{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){let e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}};L.Layout=Jt;function Gs(n,t){return t.property?n+"["+t.property+"]":n}L.nameWithProperty=Gs;function Yl(n,t){if(typeof n!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(n,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Jt))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");n.layout_=t,t.boundConstructor_=n,t.makeDestinationObject=()=>new n,Object.defineProperty(n.prototype,"encode",{value(e,r){return t.encode(this,e,r)},writable:!0}),Object.defineProperty(n,"decode",{value(e,r){return t.decode(e,r)},writable:!0})}L.bindConstructorLayout=Yl;var we=class extends Jt{isCount(){throw new Error("ExternalLayout is abstract")}};L.ExternalLayout=we;var ao=class extends we{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){zn(t);let r=t.length-e;return Math.floor(r/this.elementSpan)}encode(t,e,r){return 0}};L.GreedyCount=ao;var pi=class extends we{constructor(t,e=0,r){if(!(t instanceof Jt))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,r||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Re||this.layout instanceof Te}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,r=0){return this.layout.encode(t,e,r+this.offset)}};L.OffsetLayout=pi;var Re=class extends Jt{constructor(t,e){if(super(t,e),6c+i.encode(p,e,r+c),0);return this.count instanceof we&&this.count.encode(t.length,e,r),s}};L.Sequence=mo;var wo=class extends Jt{constructor(t,e,r){if(!(Array.isArray(t)&&t.reduce((s,c)=>s&&c instanceof Jt,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&r===void 0&&(r=e,e=void 0);for(let s of t)if(0>s.span&&s.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=t.reduce((s,c)=>s+c.getSpan(),0)}catch{}super(i,e),this.fields=t,this.decodePrefixes=!!r}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((i,s)=>{let c=s.getSpan(t,e);return e+=c,i+c},0)}catch{throw new RangeError("indeterminate span")}return r}decode(t,e=0){zn(t);let r=this.makeDestinationObject();for(let i of this.fields)if(i.property!==void 0&&(r[i.property]=i.decode(t,e)),e+=i.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return r}encode(t,e,r=0){let i=r,s=0,c=0;for(let p of this.fields){let y=p.span;if(c=0y&&(y=p.getSpan(e,r)))}s=r,r+=y}return s+c-i}fromArray(t){let e=this.makeDestinationObject();for(let r of this.fields)r.property!==void 0&&0r.span?e=-1:0<=e&&(e+=r.span)}}};L.Structure=wo;var yi=class{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,r){throw new Error("UnionDiscriminator is abstract")}};L.UnionDiscriminator=yi;var Nn=class extends yi{constructor(t,e){if(!(t instanceof we&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,r){return this.layout.encode(t,e,r)}};L.UnionLayoutDiscriminator=Nn;var gi=class extends Jt{constructor(t,e,r){let i;if(t instanceof Re||t instanceof Te)i=new Nn(new pi(t));else if(t instanceof we&&t.isCount())i=new Nn(t);else if(t instanceof yi)i=t;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Jt))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let s=-1;e&&(s=e.span,0<=s&&(t instanceof Re||t instanceof Te)&&(s+=i.layout.span)),super(s,r),this.discriminator=i,this.usesPrefixDiscriminator=t instanceof Re||t instanceof Te,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(p){return c(p)},this.configGetSourceVariant=function(p){c=p.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;let r=this.getVariant(t,e);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;let e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(let e in this.registry){let r=this.registry[e];if(r.property&&Object.prototype.hasOwnProperty.call(t,r.property))return r}throw new Error("unable to infer src variant")}decode(t,e=0){let r,i=this.discriminator,s=i.decode(t,e),c=this.registry[s];if(c===void 0){let p=this.defaultLayout,y=0;this.usesPrefixDiscriminator&&(y=i.layout.span),r=this.makeDestinationObject(),r[i.property]=s,r[p.property]=p.decode(t,e+y)}else r=c.decode(t,e);return r}encode(t,e,r=0){let i=this.getSourceVariant(t);if(i===void 0){let s=this.discriminator,c=this.defaultLayout,p=0;return this.usesPrefixDiscriminator&&(p=s.layout.span),s.encode(t[s.property],e,r),p+c.encode(t[c.property],e,r+p)}return i.encode(t,e,r)}addVariant(t,e,r){let i=new bo(this,t,e,r);return this.registry[t]=i,i}getVariant(t,e=0){let r;return t instanceof Uint8Array?r=this.discriminator.decode(t,e):r=t,this.registry[r]}};L.Union=gi;var bo=class extends Jt{constructor(t,e,r,i){if(!(t instanceof gi))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof r=="string"&&i===void 0&&(i=r,r=null),r){if(!(r instanceof Jt))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=r.span&&r.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let s=t.span;0>t.span&&(s=r?r.span:0,0<=s&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span)),super(s,i),this.union=t,this.variant=e,this.layout=r||null}getSpan(t,e=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(t,e+r)),r+i}decode(t,e=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(t,e+i):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(t,e,r=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,r);let s=i;if(this.layout&&(this.layout.encode(t[this.property],e,r+i),s+=this.layout.getSpan(e,r+i),0<=this.union.span&&s>this.union.span))throw new Error("encoded variant overruns containing union");return s}fromArray(t){if(this.layout)return this.layout.fromArray(t)}};L.VariantLayout=bo;function Un(n){return 0>n&&(n+=4294967296),n}var mi=class extends Jt{constructor(t,e,r){if(!(t instanceof Re||t instanceof Te))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&r===void 0&&(r=e,e=!1),4=e)throw new TypeError("bits must be positive integer");let i=8*t.span,s=t.fields.reduce((c,p)=>c+p.bits,0);if(e+s>i)throw new Error("bits too long for span remainder ("+(i-s)+" of "+i+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==Un(t&this.valueMask))throw new TypeError(Gs("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let e=this.container._packedGetValue(),r=Un(t<r&&(r=this.length.decode(t,e)),r}decode(t,e=0){let r=this.span;return 0>r&&(r=this.length.decode(t,e)),Yt(t).slice(e,e+r)}encode(t,e,r){let i=this.length;if(this.length instanceof we&&(i=t.length),!(t instanceof Uint8Array&&i===t.length))throw new TypeError(Gs("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(r+i>e.length)throw new RangeError("encoding overruns Uint8Array");let s=Yt(t);return Yt(e).write(s.toString("hex"),r,i,"hex"),this.length instanceof we&&this.length.encode(i,e,r),i}};L.Blob=xo;var ko=class extends Jt{constructor(t){super(-1,t)}getSpan(t,e=0){zn(t);let r=e;for(;re.length)throw new RangeError("encoding overruns Buffer");let c=Yt(e);return i.copy(c,r),c[r+s]=0,s+1}};L.CString=ko;var So=class extends Jt{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return zn(t),t.length-e}decode(t,e=0){let r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return i.copy(Yt(e),r),s}};L.UTF8=So;var Bo=class extends Jt{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,r){return 0}};L.Constant=Bo;L.greedy=(n,t)=>new ao(n,t);L.offset=(n,t,e)=>new pi(n,t,e);L.u8=n=>new Re(1,n);L.u16=n=>new Re(2,n);L.u24=n=>new Re(3,n);L.u32=n=>new Re(4,n);L.u40=n=>new Re(5,n);L.u48=n=>new Re(6,n);L.nu64=n=>new uo(n);L.u16be=n=>new Te(2,n);L.u24be=n=>new Te(3,n);L.u32be=n=>new Te(4,n);L.u40be=n=>new Te(5,n);L.u48be=n=>new Te(6,n);L.nu64be=n=>new co(n);L.s8=n=>new or(1,n);L.s16=n=>new or(2,n);L.s24=n=>new or(3,n);L.s32=n=>new or(4,n);L.s40=n=>new or(5,n);L.s48=n=>new or(6,n);L.ns64=n=>new fo(n);L.s16be=n=>new _r(2,n);L.s24be=n=>new _r(3,n);L.s32be=n=>new _r(4,n);L.s40be=n=>new _r(5,n);L.s48be=n=>new _r(6,n);L.ns64be=n=>new ho(n);L.f32=n=>new lo(n);L.f32be=n=>new po(n);L.f64=n=>new yo(n);L.f64be=n=>new go(n);L.struct=(n,t,e)=>new wo(n,t,e);L.bits=(n,t,e)=>new mi(n,t,e);L.seq=(n,t,e)=>new mo(n,t,e);L.union=(n,t,e)=>new gi(n,t,e);L.unionLayoutDiscriminator=(n,t)=>new Nn(n,t);L.blob=(n,t)=>new xo(n,t);L.cstr=n=>new ko(n);L.utf8=(n,t)=>new So(n,t);L.constant=(n,t)=>new Bo(n,t)});var Ju=fe(qn=>{"use strict";var Bg=C(N());Object.defineProperty(qn,"__esModule",{value:!0});var Io;function Jl(n){{let t=Buffer.from(n);t.reverse();let e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}return Io.toBigInt(n,!1)}qn.toBigIntLE=Jl;function Xl(n){{let t=n.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}return Io.toBigInt(n,!0)}qn.toBigIntBE=Xl;function Ql(n,t){{let e=n.toString(16),r=Buffer.from(e.padStart(t*2,"0").slice(0,t*2),"hex");return r.reverse(),r}return Io.fromBigInt(n,Buffer.allocUnsafe(t),!1)}qn.toBufferLE=Ql;function t0(n,t){{let e=n.toString(16);return Buffer.from(e.padStart(t*2,"0").slice(0,t*2),"hex")}return Io.fromBigInt(n,Buffer.allocUnsafe(t),!0)}qn.toBufferBE=t0});function e0(n){return bi(n)&&typeof n[Symbol.iterator]=="function"}function bi(n){return typeof n=="object"&&n!=null}function Ao(n){return bi(n)&&!Array.isArray(n)}function De(n){return typeof n=="symbol"?n.toString():typeof n=="string"?JSON.stringify(n):`${n}`}function r0(n){let{done:t,value:e}=n.next();return t?void 0:e}function n0(n,t,e,r){if(n===!0)return;n===!1?n={}:typeof n=="string"&&(n={message:n});let{path:i,branch:s}=t,{type:c}=e,{refinement:p,message:y=`Expected a value of type \\`${c}\\`${p?` with refinement \\`${p}\\``:""}, but received: \\`${De(r)}\\``}=n;return{value:r,type:c,refinement:p,key:i[i.length-1],path:i,branch:s,...n,message:y}}function*Xu(n,t,e,r){e0(n)||(n=[n]);for(let i of n){let s=n0(i,t,e,r);s&&(yield s)}}function*Ys(n,t,e={}){let{path:r=[],branch:i=[n],coerce:s=!1,mask:c=!1}=e,p={path:r,branch:i,mask:c};s&&(n=t.coercer(n,p));let y="valid";for(let v of t.validator(n,p))v.explanation=e.message,y="not_valid",yield[v,void 0];for(let[v,x,k]of t.entries(n,p)){let _=Ys(x,k,{path:v===void 0?r:[...r,v],branch:v===void 0?i:[...i,x],coerce:s,mask:c,message:e.message});for(let B of _)B[0]?(y=B[0].refinement!=null?"not_refined":"not_valid",yield[B[0],void 0]):s&&(x=B[1],v===void 0?n=x:n instanceof Map?n.set(v,x):n instanceof Set?n.add(x):bi(n)&&(x!==void 0||v in n)&&(n[v]=x))}if(y!=="not_valid")for(let v of t.refiner(n,p))v.explanation=e.message,y="not_refined",yield[v,void 0];y==="valid"&&(yield[void 0,n])}function Qu(n,t,e){let r=vi(n,t,{message:e});if(r[0])throw r[0]}function $(n,t,e){let r=vi(n,t,{coerce:!0,message:e});if(r[0])throw r[0];return r[1]}function i0(n,t,e){let r=vi(n,t,{coerce:!0,mask:!0,message:e});if(r[0])throw r[0];return r[1]}function tc(n,t){return!vi(n,t)[0]}function vi(n,t,e={}){let r=Ys(n,t,e),i=r0(r);return i[0]?[new js(i[0],function*(){for(let c of r)c[0]&&(yield c[0])}),void 0]:[void 0,i[1]]}function mn(n,t){return new Ce({type:n,schema:null,validator:t})}function ec(){return mn("any",()=>!0)}function Z(n){return new Ce({type:"array",schema:n,*entries(t){if(n&&Array.isArray(t))for(let[e,r]of t.entries())yield[e,r,n]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${De(t)}`}})}function We(){return mn("boolean",n=>typeof n=="boolean")}function Mo(n){return mn("instance",t=>t instanceof n||`Expected a \\`${n.name}\\` instance, but received: ${De(t)}`)}function se(n){let t=De(n),e=typeof n;return new Ce({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?n:null,validator(r){return r===n||`Expected the literal \\`${t}\\`, but received: ${De(r)}`}})}function o0(){return mn("never",()=>!1)}function j(n){return new Ce({...n,validator:(t,e)=>t===null||n.validator(t,e),refiner:(t,e)=>t===null||n.refiner(t,e)})}function A(){return mn("number",n=>typeof n=="number"&&!isNaN(n)||`Expected a number, but received: ${De(n)}`)}function it(n){return new Ce({...n,validator:(t,e)=>t===void 0||n.validator(t,e),refiner:(t,e)=>t===void 0||n.refiner(t,e)})}function Js(n,t){return new Ce({type:"record",schema:null,*entries(e){if(bi(e))for(let r in e){let i=e[r];yield[r,r,n],yield[r,i,t]}},validator(e){return Ao(e)||`Expected an object, but received: ${De(e)}`},coercer(e){return Ao(e)?{...e}:e}})}function H(){return mn("string",n=>typeof n=="string"||`Expected a string, but received: ${De(n)}`)}function Lo(n){let t=o0();return new Ce({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){let r=Math.max(n.length,e.length);for(let i=0;ie.type).join(" | ");return new Ce({type:"union",schema:null,coercer(e,r){for(let i of n){let[s,c]=i.validate(e,{coerce:!0,mask:r.mask});if(!s)return c}return e},validator(e,r){let i=[];for(let s of n){let[...c]=Ys(e,s,r),[p]=c;if(p[0])for(let[y]of c)y&&i.push(y);else return[]}return[`Expected the value to satisfy a union of \\`${t}\\`, but received: ${De(e)}`,...i]}})}function wn(){return mn("unknown",()=>!0)}function Fn(n,t,e){return new Ce({...n,coercer:(r,i)=>tc(r,t)?n.coercer(e(r,i),i):n.coercer(r,i)})}var _g,js,Ce,rc=vt(()=>{_g=C(N(),1),js=class extends TypeError{constructor(t,e){let r,{message:i,explanation:s,...c}=t,{path:p}=t,y=p.length===0?i:`At path: ${p.join(".")} -- ${i}`;super(s??y),s!=null&&(this.cause=y),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>r??(r=[t,...e()])}};Ce=class{constructor(t){let{type:e,schema:r,validator:i,refiner:s,coercer:c=y=>y,entries:p=function*(){}}=t;this.type=e,this.schema=r,this.entries=p,this.coercer=c,i?this.validator=(y,v)=>{let x=i(y,v);return Xu(x,v,this,y)}:this.validator=()=>[],s?this.refiner=(y,v)=>{let x=s(y,v);return Xu(x,v,this,y)}:this.refiner=()=>[]}assert(t,e){return Qu(t,this,e)}create(t,e){return $(t,this,e)}is(t){return tc(t,this)}mask(t,e){return i0(t,this,e)}validate(t,e={}){return vi(t,this,e)}}});function xi(){if(!Ro&&(Ro=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ro))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ro(s0)}var Ag,Ro,s0,Xs=vt(()=>{Ag=C(N()),s0=new Uint8Array(16)});var Lg,nc,ic=vt(()=>{Lg=C(N()),nc=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function a0(n){return typeof n=="string"&&nc.test(n)}var Pg,Ir,ki=vt(()=>{Pg=C(N());ic();Ir=a0});function u0(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(me[n[t+0]]+me[n[t+1]]+me[n[t+2]]+me[n[t+3]]+"-"+me[n[t+4]]+me[n[t+5]]+"-"+me[n[t+6]]+me[n[t+7]]+"-"+me[n[t+8]]+me[n[t+9]]+"-"+me[n[t+10]]+me[n[t+11]]+me[n[t+12]]+me[n[t+13]]+me[n[t+14]]+me[n[t+15]]).toLowerCase();if(!Ir(e))throw TypeError("Stringified UUID is invalid");return e}var Ug,me,To,Ar,Si=vt(()=>{Ug=C(N());ki();me=[];for(To=0;To<256;++To)me.push((To+256).toString(16).substr(1));Ar=u0});function c0(n,t,e){var r=t&&e||0,i=t||new Array(16);n=n||{};var s=n.node||oc,c=n.clockseq!==void 0?n.clockseq:Qs;if(s==null||c==null){var p=n.random||(n.rng||xi)();s==null&&(s=oc=[p[0]|1,p[1],p[2],p[3],p[4],p[5]]),c==null&&(c=Qs=(p[6]<<8|p[7])&16383)}var y=n.msecs!==void 0?n.msecs:Date.now(),v=n.nsecs!==void 0?n.nsecs:ea+1,x=y-ta+(v-ea)/1e4;if(x<0&&n.clockseq===void 0&&(c=c+1&16383),(x<0||y>ta)&&n.nsecs===void 0&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can\'t create more than 10M uuids/sec");ta=y,ea=v,Qs=c,y+=122192928e5;var k=((y&268435455)*1e4+v)%4294967296;i[r++]=k>>>24&255,i[r++]=k>>>16&255,i[r++]=k>>>8&255,i[r++]=k&255;var _=y/4294967296*1e4&268435455;i[r++]=_>>>8&255,i[r++]=_&255,i[r++]=_>>>24&15|16,i[r++]=_>>>16&255,i[r++]=c>>>8|128,i[r++]=c&255;for(var B=0;B<6;++B)i[r+B]=s[B];return t||Ar(i)}var Fg,oc,Qs,ta,ea,sc,ac=vt(()=>{Fg=C(N());Xs();Si();ta=0,ea=0;sc=c0});function f0(n){if(!Ir(n))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(n.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(n.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(n.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(n.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(n.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}var Wg,Po,ra=vt(()=>{Wg=C(N());ki();Po=f0});function h0(n){n=unescape(encodeURIComponent(n));for(var t=[],e=0;e{Gg=C(N());Si();ra();l0="6ba7b810-9dad-11d1-80b4-00c04fd430c8",d0="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function p0(n){if(typeof n=="string"){var t=unescape(encodeURIComponent(n));n=new Uint8Array(t.length);for(var e=0;e>5]>>>i%32&255,c=parseInt(r.charAt(s>>>4&15)+r.charAt(s&15),16);t.push(c)}return t}function uc(n){return(n+64>>>9<<4)+14+1}function g0(n,t){n[t>>5]|=128<>5]|=(n[r/8]&255)<>16)+(t>>16)+(e>>16);return r<<16|e&65535}function w0(n,t){return n<>>32-t}function Oo(n,t,e,r,i,s){return Mr(w0(Mr(Mr(t,n),Mr(r,s)),i),e)}function ve(n,t,e,r,i,s,c){return Oo(t&e|~t&r,n,t,i,s,c)}function xe(n,t,e,r,i,s,c){return Oo(t&r|e&~r,n,t,i,s,c)}function ke(n,t,e,r,i,s,c){return Oo(t^e^r,n,t,i,s,c)}function Se(n,t,e,r,i,s,c){return Oo(e^(t|~r),n,t,i,s,c)}var jg,cc,fc=vt(()=>{jg=C(N());cc=p0});var Qg,b0,hc,lc=vt(()=>{Qg=C(N());na();fc();b0=Co("v3",48,cc),hc=b0});function v0(n,t,e){n=n||{};var r=n.random||(n.rng||xi)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){e=e||0;for(var i=0;i<16;++i)t[e+i]=r[i];return t}return Ar(r)}var nm,dc,pc=vt(()=>{nm=C(N());Xs();Si();dc=v0});function x0(n,t,e,r){switch(n){case 0:return t&e^~t&r;case 1:return t^e^r;case 2:return t&e^t&r^e&r;case 3:return t^e^r}}function ia(n,t){return n<>>32-t}function k0(n){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof n=="string"){var r=unescape(encodeURIComponent(n));n=[];for(var i=0;i>>0;z=K,K=O,O=ia(E,30)>>>0,E=I,I=W}e[0]=e[0]+I>>>0,e[1]=e[1]+E>>>0,e[2]=e[2]+O>>>0,e[3]=e[3]+K>>>0,e[4]=e[4]+z>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var om,yc,gc=vt(()=>{om=C(N());yc=k0});var cm,S0,mc,wc=vt(()=>{cm=C(N());na();gc();S0=Co("v5",80,yc),mc=S0});var hm,bc,vc=vt(()=>{hm=C(N()),bc="00000000-0000-0000-0000-000000000000"});function B0(n){if(!Ir(n))throw TypeError("Invalid UUID");return parseInt(n.substr(14,1),16)}var pm,xc,kc=vt(()=>{pm=C(N());ki();xc=B0});var oa={};Pa(oa,{NIL:()=>bc,parse:()=>Po,stringify:()=>Ar,v1:()=>sc,v3:()=>hc,v4:()=>dc,v5:()=>mc,validate:()=>Ir,version:()=>xc});var ym,sa=vt(()=>{ym=C(N());ac();lc();pc();wc();vc();kc();ki();Si();ra()});var Bc=fe((Em,Sc)=>{"use strict";var _m=C(N()),E0=(sa(),Oa(oa)).v4,_0=function(n,t,e,r){if(typeof n!="string")throw new TypeError(n+" must be a string");r=r||{};let i=typeof r.version=="number"?r.version:2;if(i!==1&&i!==2)throw new TypeError(i+" must be 1 or 2");let s={method:n};if(i===2&&(s.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");s.params=t}if(typeof e>"u"){let c=typeof r.generator=="function"?r.generator:function(){return E0()};s.id=c(s,r)}else i===2&&e===null?r.notificationIdNull&&(s.id=null):s.id=e;return s};Sc.exports=_0});var _c=fe((Im,Ec)=>{"use strict";var Am=C(N()),I0=(sa(),Oa(oa)).v4,A0=Bc(),Bi=function(n,t){if(!(this instanceof Bi))return new Bi(n,t);t||(t={}),this.options={reviver:typeof t.reviver<"u"?t.reviver:null,replacer:typeof t.replacer<"u"?t.replacer:null,generator:typeof t.generator<"u"?t.generator:function(){return I0()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=n};Ec.exports=Bi;Bi.prototype.request=function(n,t,e,r){let i=this,s=null,c=Array.isArray(n)&&typeof t=="function";if(this.options.version===1&&c)throw new TypeError("JSON-RPC 1.0 does not support batching");if(c||!c&&n&&typeof n=="object"&&typeof t=="function")r=t,s=n;else{typeof e=="function"&&(r=e,e=void 0);let v=typeof r=="function";try{s=A0(n,t,e,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(x){if(v)return r(x);throw x}if(!v)return s}let y;try{y=JSON.stringify(s,this.options.replacer)}catch(v){return r(v)}return this.callServer(y,function(v,x){i._parseResponse(v,x,r)}),s};Bi.prototype._parseResponse=function(n,t,e){if(n){e(n);return}if(!t)return e();let r;try{r=JSON.parse(t,this.options.reviver)}catch(i){return e(i)}if(e.length===3)if(Array.isArray(r)){let i=function(c){return typeof c.error<"u"},s=function(c){return!i(c)};return e(null,r.filter(i),r.filter(s))}else return e(null,r.error,r.result);e(null,r)}});var Ac=fe((Mm,aa)=>{"use strict";var Lm=C(N()),M0=Object.prototype.hasOwnProperty,Ie="~";function Ei(){}Object.create&&(Ei.prototype=Object.create(null),new Ei().__proto__||(Ie=!1));function L0(n,t,e){this.fn=n,this.context=t,this.once=e||!1}function Ic(n,t,e,r,i){if(typeof e!="function")throw new TypeError("The listener must be a function");var s=new L0(e,r||n,i),c=Ie?Ie+t:t;return n._events[c]?n._events[c].fn?n._events[c]=[n._events[c],s]:n._events[c].push(s):(n._events[c]=s,n._eventsCount++),n}function Uo(n,t){--n._eventsCount===0?n._events=new Ei:delete n._events[t]}function Be(){this._events=new Ei,this._eventsCount=0}Be.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)M0.call(e,r)&&t.push(Ie?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Be.prototype.listeners=function(t){var e=Ie?Ie+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,c=new Array(s);i{Tm=C(N(),1),No=C(Ac(),1)});function Rc(n,t){return new R0(n,t)}var Om,Lc,R0,T0,Tc,Pc=vt(()=>{Om=C(N(),1),Lc=C(Mn(),1);Mc();R0=class extends No.default{socket;constructor(n,t,e){super(),this.socket=new window.WebSocket(n,e),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=r=>this.emit("message",r.data),this.socket.onerror=r=>this.emit("error",r),this.socket.onclose=r=>{this.emit("close",r.code,r.reason)}}send(n,t,e){let r=e||t;try{this.socket.send(n),r()}catch(i){r(i)}}close(n,t){this.socket.close(n,t)}addEventListener(n,t,e){this.socket.addEventListener(n,t,e)}};T0=class{encode(n){return JSON.stringify(n)}decode(n){return JSON.parse(n)}},Tc=class extends No.default{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(n,t="ws://localhost:8080",{autoconnect:e=!0,reconnect:r=!0,reconnect_interval:i=1e3,max_reconnects:s=5,...c}={},p,y){super(),this.webSocketFactory=n,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=e,this.ready=!1,this.reconnect=r,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=s,this.rest_options=c,this.current_reconnects=0,this.generate_request_id=p||(()=>++this.rpc_id),y?this.dataPack=y:this.dataPack=new T0,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(n,t,e,r){return!r&&typeof e=="object"&&(r=e,e=null),new Promise((i,s)=>{if(!this.ready)return s(new Error("socket not ready"));let c=this.generate_request_id(n,t),p={jsonrpc:"2.0",method:n,params:t||void 0,id:c};this.socket.send(this.dataPack.encode(p),r,y=>{if(y)return s(y);this.queue[c]={promise:[i,s]},e&&(this.queue[c].timeout=setTimeout(()=>{delete this.queue[c],s(new Error("reply timeout"))},e))})})}async login(n){let t=await this.call("rpc.login",n);if(!t)throw new Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(n,t){return new Promise((e,r)=>{if(!this.ready)return r(new Error("socket not ready"));let i={jsonrpc:"2.0",method:n,params:t};this.socket.send(this.dataPack.encode(i),s=>{if(s)return r(s);e()})})}async subscribe(n){typeof n=="string"&&(n=[n]);let t=await this.call("rpc.on",n);if(typeof n=="string"&&t[n]!=="ok")throw new Error("Failed subscribing to an event \'"+n+"\' with: "+t[n]);return t}async unsubscribe(n){typeof n=="string"&&(n=[n]);let t=await this.call("rpc.off",n);if(typeof n=="string"&&t[n]!=="ok")throw new Error("Failed unsubscribing from an event with: "+t);return t}close(n,t){this.socket.close(n||1e3,t)}setAutoReconnect(n){this.reconnect=n}setReconnectInterval(n){this.reconnect_interval=n}setMaxReconnects(n){this.max_reconnects=n}_connect(n,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(n,t),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:e})=>{e instanceof ArrayBuffer&&(e=Lc.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch{return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);let r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(let i=0;i{this.emit.apply(this,r)})}if(!this.queue[e.id])return e.method?Promise.resolve().then(()=>{this.emit(e.method,e?.params)}):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](new Error(\'Server response malformed. Response must include either "result" or "error", but not both.\')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]}),this.socket.addEventListener("error",e=>this.emit("error",e)),this.socket.addEventListener("close",({code:e,reason:r})=>{this.ready&&setTimeout(()=>this.emit("close",e,r),0),this.ready=!1,this.socket=void 0,e!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)&&(this.reconnect_timer_id=setTimeout(()=>this._connect(n,t),this.reconnect_interval)))})}}});function F0(n,t=24){let e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let c=0;c<10;c++)e[c]=n[c]^n[c+10]^n[c+20]^n[c+30]^n[c+40];for(let c=0;c<10;c+=2){let p=(c+8)%10,y=(c+2)%10,v=e[y],x=e[y+1],k=Cc(v,x,1)^e[p],_=Oc(v,x,1)^e[p+1];for(let B=0;B<50;B+=10)n[c+B]^=k,n[c+B+1]^=_}let i=n[2],s=n[3];for(let c=0;c<24;c++){let p=Nc[c],y=Cc(i,s,p),v=Oc(i,s,p),x=Uc[c];i=n[x],s=n[x+1],n[x]=y,n[x+1]=v}for(let c=0;c<50;c+=10){for(let p=0;p<10;p++)e[p]=n[c+p];for(let p=0;p<10;p++)n[c+p]^=~e[(p+2)%10]&e[(p+4)%10]}n[0]^=z0[r],n[1]^=q0[r]}e.fill(0)}var Xm,Uc,Nc,zc,P0,_i,C0,O0,U0,N0,z0,q0,Cc,Oc,Kn,Lr,Dm,Wm,Hm,$m,Vm,ua,Gm,Zm,qc,jm,Ym,Fc=vt(()=>{Xm=C(N(),1);ci();ms();gr();Uc=[],Nc=[],zc=[],P0=BigInt(0),_i=BigInt(1),C0=BigInt(2),O0=BigInt(7),U0=BigInt(256),N0=BigInt(113);for(let n=0,t=_i,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],Uc.push(2*(5*r+e)),Nc.push((n+1)*(n+2)/2%64);let i=P0;for(let s=0;s<7;s++)t=(t<<_i^(t>>O0)*N0)%U0,t&C0&&(i^=_i<<(_i<e>32?ys(n,t,e):ds(n,t,e),Oc=(n,t,e)=>e>32?gs(n,t,e):ps(n,t,e);Kn=class extends pr{constructor(t,e,r,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ui(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=lu(this.state)}keccak(){as||us(this.state32),F0(this.state32,this.rounds),as||us(this.state32),this.posOut=0,this.pos=0}update(t){Qe(this);let{blockLen:e,state:r}=this;t=yr(t);let i=t.length;for(let s=0;s=r&&this.keccak();let c=Math.min(r-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+c),i),this.posOut+=c,i+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ui(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Wi(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:r,outputLen:i,rounds:s,enableXOF:c}=this;return t||(t=new Kn(e,r,i,c,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=i,t.enableXOF=c,t.destroyed=this.destroyed,t}},Lr=(n,t,e)=>Rn(()=>new Kn(t,n,e)),Dm=Lr(6,144,224/8),Wm=Lr(6,136,256/8),Hm=Lr(6,104,384/8),$m=Lr(6,72,512/8),Vm=Lr(1,144,224/8),ua=Lr(1,136,256/8),Gm=Lr(1,104,384/8),Zm=Lr(1,72,512/8),qc=(n,t,e)=>pu((r={})=>new Kn(t,n,r.dkLen===void 0?e:r.dkLen,!0)),jm=qc(31,168,128/8),Ym=qc(31,136,256/8)});var r1,zo,ca,Kc=vt(()=>{r1=C(N(),1);ci();gr();zo=class extends pr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,fu(t);let r=yr(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?t.create().update(r).digest():r);for(let c=0;cnew zo(n,t).update(e).digest();ca.create=(n,t)=>new zo(n,t)});function Dc(n){n.lowS!==void 0&&Fe("lowS",n.lowS),n.prehash!==void 0&&Fe("prehash",n.prehash)}function K0(n){let t=li(n);Ve(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:r,a:i}=t;if(e){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}function H0(n){let t=K0(n),{Fp:e}=t,r=kr(t.n,t.nBitLength),i=t.toBytes||((I,E,O)=>{let K=E.toAffine();return nr(Uint8Array.from([4]),e.toBytes(K.x),e.toBytes(K.y))}),s=t.fromBytes||(I=>{let E=I.subarray(1),O=e.fromBytes(E.subarray(0,e.BYTES)),K=e.fromBytes(E.subarray(e.BYTES,2*e.BYTES));return{x:O,y:K}});function c(I){let{a:E,b:O}=t,K=e.sqr(I),z=e.mul(K,I);return e.add(e.add(z,e.mul(I,E)),O)}if(!e.eql(e.sqr(t.Gy),c(t.Gx)))throw new Error("bad generator point: equation left != right");function p(I){return fi(I,de,t.n)}function y(I){let{allowedPrivateKeyLengths:E,nByteLength:O,wrapPrivateKey:K,n:z}=t;if(E&&typeof I!="bigint"){if(br(I)&&(I=er(I)),typeof I!="string"||!E.includes(I.length))throw new Error("Invalid key");I=I.padStart(O*2,"0")}let D;try{D=typeof I=="bigint"?I:rr(ue("private key",I,O))}catch{throw new Error(`private key must be ${O} bytes, hex or bigint, not ${typeof I}`)}return K&&(D=Xt(D,z)),Me("private key",D,de,z),D}function v(I){if(!(I instanceof _))throw new Error("ProjectivePoint expected")}let x=fn((I,E)=>{let{px:O,py:K,pz:z}=I;if(e.eql(z,e.ONE))return{x:O,y:K};let D=I.is0();E==null&&(E=D?e.ONE:e.inv(z));let et=e.mul(O,E),W=e.mul(K,E),J=e.mul(z,E);if(D)return{x:e.ZERO,y:e.ZERO};if(!e.eql(J,e.ONE))throw new Error("invZ was invalid");return{x:et,y:W}}),k=fn(I=>{if(I.is0()){if(t.allowInfinityPoint&&!e.is0(I.py))return;throw new Error("bad point: ZERO")}let{x:E,y:O}=I.toAffine();if(!e.isValid(E)||!e.isValid(O))throw new Error("bad point: x or y not FE");let K=e.sqr(O),z=c(E);if(!e.eql(K,z))throw new Error("bad point: equation left != right");if(!I.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class _{constructor(E,O,K){if(this.px=E,this.py=O,this.pz=K,E==null||!e.isValid(E))throw new Error("x required");if(O==null||!e.isValid(O))throw new Error("y required");if(K==null||!e.isValid(K))throw new Error("z required");Object.freeze(this)}static fromAffine(E){let{x:O,y:K}=E||{};if(!E||!e.isValid(O)||!e.isValid(K))throw new Error("invalid affine point");if(E instanceof _)throw new Error("projective point not allowed");let z=D=>e.eql(D,e.ZERO);return z(O)&&z(K)?_.ZERO:new _(O,K,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(E){let O=e.invertBatch(E.map(K=>K.pz));return E.map((K,z)=>K.toAffine(O[z])).map(_.fromAffine)}static fromHex(E){let O=_.fromAffine(s(ue("pointHex",E)));return O.assertValidity(),O}static fromPrivateKey(E){return _.BASE.multiply(y(E))}static msm(E,O){return Ji(_,r,E,O)}_setWindowSize(E){P.setWindowSize(this,E)}assertValidity(){k(this)}hasEvenY(){let{y:E}=this.toAffine();if(e.isOdd)return!e.isOdd(E);throw new Error("Field doesn\'t support isOdd")}equals(E){v(E);let{px:O,py:K,pz:z}=this,{px:D,py:et,pz:W}=E,J=e.eql(e.mul(O,W),e.mul(D,z)),Q=e.eql(e.mul(K,W),e.mul(et,z));return J&&Q}negate(){return new _(this.px,e.neg(this.py),this.pz)}double(){let{a:E,b:O}=t,K=e.mul(O,Wc),{px:z,py:D,pz:et}=this,W=e.ZERO,J=e.ZERO,Q=e.ZERO,nt=e.mul(z,z),te=e.mul(D,D),G=e.mul(et,et),st=e.mul(z,D);return st=e.add(st,st),Q=e.mul(z,et),Q=e.add(Q,Q),W=e.mul(E,Q),J=e.mul(K,G),J=e.add(W,J),W=e.sub(te,J),J=e.add(te,J),J=e.mul(W,J),W=e.mul(st,W),Q=e.mul(K,Q),G=e.mul(E,G),st=e.sub(nt,G),st=e.mul(E,st),st=e.add(st,Q),Q=e.add(nt,nt),nt=e.add(Q,nt),nt=e.add(nt,G),nt=e.mul(nt,st),J=e.add(J,nt),G=e.mul(D,et),G=e.add(G,G),nt=e.mul(G,st),W=e.sub(W,nt),Q=e.mul(G,te),Q=e.add(Q,Q),Q=e.add(Q,Q),new _(W,J,Q)}add(E){v(E);let{px:O,py:K,pz:z}=this,{px:D,py:et,pz:W}=E,J=e.ZERO,Q=e.ZERO,nt=e.ZERO,te=t.a,G=e.mul(t.b,Wc),st=e.mul(O,D),m=e.mul(K,et),o=e.mul(z,W),u=e.add(O,K),f=e.add(D,et);u=e.mul(u,f),f=e.add(st,m),u=e.sub(u,f),f=e.add(O,z);let h=e.add(D,W);return f=e.mul(f,h),h=e.add(st,o),f=e.sub(f,h),h=e.add(K,z),J=e.add(et,W),h=e.mul(h,J),J=e.add(m,o),h=e.sub(h,J),nt=e.mul(te,f),J=e.mul(G,o),nt=e.add(J,nt),J=e.sub(m,nt),nt=e.add(m,nt),Q=e.mul(J,nt),m=e.add(st,st),m=e.add(m,st),o=e.mul(te,o),f=e.mul(G,f),m=e.add(m,o),o=e.sub(st,o),o=e.mul(te,o),f=e.add(f,o),st=e.mul(m,f),Q=e.add(Q,st),st=e.mul(h,f),J=e.mul(u,J),J=e.sub(J,st),st=e.mul(u,m),nt=e.mul(h,nt),nt=e.add(nt,st),new _(J,Q,nt)}subtract(E){return this.add(E.negate())}is0(){return this.equals(_.ZERO)}wNAF(E){return P.wNAFCached(this,E,_.normalizeZ)}multiplyUnsafe(E){Me("scalar",E,ar,t.n);let O=_.ZERO;if(E===ar)return O;if(E===de)return this;let{endo:K}=t;if(!K)return P.unsafeLadder(this,E);let{k1neg:z,k1:D,k2neg:et,k2:W}=K.splitScalar(E),J=O,Q=O,nt=this;for(;D>ar||W>ar;)D&de&&(J=J.add(nt)),W&de&&(Q=Q.add(nt)),nt=nt.double(),D>>=de,W>>=de;return z&&(J=J.negate()),et&&(Q=Q.negate()),Q=new _(e.mul(Q.px,K.beta),Q.py,Q.pz),J.add(Q)}multiply(E){let{endo:O,n:K}=t;Me("scalar",E,de,K);let z,D;if(O){let{k1neg:et,k1:W,k2neg:J,k2:Q}=O.splitScalar(E),{p:nt,f:te}=this.wNAF(W),{p:G,f:st}=this.wNAF(Q);nt=P.constTimeNegate(et,nt),G=P.constTimeNegate(J,G),G=new _(e.mul(G.px,O.beta),G.py,G.pz),z=nt.add(G),D=te.add(st)}else{let{p:et,f:W}=this.wNAF(E);z=et,D=W}return _.normalizeZ([z,D])[0]}multiplyAndAddUnsafe(E,O,K){let z=_.BASE,D=(W,J)=>J===ar||J===de||!W.equals(z)?W.multiplyUnsafe(J):W.multiply(J),et=D(this,O).add(D(E,K));return et.is0()?void 0:et}toAffine(E){return x(this,E)}isTorsionFree(){let{h:E,isTorsionFree:O}=t;if(E===de)return!0;if(O)return O(_,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:E,clearCofactor:O}=t;return E===de?this:O?O(_,this):this.multiplyUnsafe(t.h)}toRawBytes(E=!0){return Fe("isCompressed",E),this.assertValidity(),i(_,this,E)}toHex(E=!0){return Fe("isCompressed",E),er(this.toRawBytes(E))}}_.BASE=new _(t.Gx,t.Gy,e.ONE),_.ZERO=new _(e.ZERO,e.ONE,e.ZERO);let B=t.nBitLength,P=Yi(_,t.endo?Math.ceil(B/2):B);return{CURVE:t,ProjectivePoint:_,normPrivateKeyToScalar:y,weierstrassEquation:c,isWithinCurveOrder:p}}function $0(n){let t=li(n);return Ve(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Hc(n){let t=$0(n),{Fp:e,n:r}=t,i=e.BYTES+1,s=2*e.BYTES+1;function c(o){return Xt(o,r)}function p(o){return ji(o,r)}let{ProjectivePoint:y,normPrivateKeyToScalar:v,weierstrassEquation:x,isWithinCurveOrder:k}=H0({...t,toBytes(o,u,f){let h=u.toAffine(),l=e.toBytes(h.x),w=nr;return Fe("isCompressed",f),f?w(Uint8Array.from([u.hasEvenY()?2:3]),l):w(Uint8Array.from([4]),l,e.toBytes(h.y))},fromBytes(o){let u=o.length,f=o[0],h=o.subarray(1);if(u===i&&(f===2||f===3)){let l=rr(h);if(!fi(l,de,e.ORDER))throw new Error("Point is not on curve");let w=x(l),b;try{b=e.sqrt(w)}catch(g){let M=g instanceof Error?": "+g.message:"";throw new Error("Point is not on curve"+M)}let d=(b&de)===de;return(f&1)===1!==d&&(b=e.neg(b)),{x:l,y:b}}else if(u===s&&f===4){let l=e.fromBytes(h.subarray(0,e.BYTES)),w=e.fromBytes(h.subarray(e.BYTES,2*e.BYTES));return{x:l,y:w}}else throw new Error(`Point of length ${u} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}}),_=o=>er(xr(o,t.nByteLength));function B(o){let u=r>>de;return o>u}function P(o){return B(o)?c(-o):o}let I=(o,u,f)=>rr(o.slice(u,f));class E{constructor(u,f,h){this.r=u,this.s=f,this.recovery=h,this.assertValidity()}static fromCompact(u){let f=t.nByteLength;return u=ue("compactSignature",u,f*2),new E(I(u,0,f),I(u,f,2*f))}static fromDER(u){let{r:f,s:h}=sr.toSig(ue("DER",u));return new E(f,h)}assertValidity(){Me("r",this.r,de,r),Me("s",this.s,de,r)}addRecoveryBit(u){return new E(this.r,this.s,u)}recoverPublicKey(u){let{r:f,s:h,recovery:l}=this,w=W(ue("msgHash",u));if(l==null||![0,1,2,3].includes(l))throw new Error("recovery id invalid");let b=l===2||l===3?f+t.n:f;if(b>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let d=l&1?"03":"02",a=y.fromHex(d+_(b)),g=p(b),M=c(-w*g),R=c(h*g),T=y.BASE.multiplyAndAddUnsafe(a,M,R);if(!T)throw new Error("point at infinify");return T.assertValidity(),T}hasHighS(){return B(this.s)}normalizeS(){return this.hasHighS()?new E(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return un(this.toDERHex())}toDERHex(){return sr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return un(this.toCompactHex())}toCompactHex(){return _(this.r)+_(this.s)}}let O={isValidPrivateKey(o){try{return v(o),!0}catch{return!1}},normPrivateKeyToScalar:v,randomPrivateKey:()=>{let o=As(t.n);return _u(t.randomBytes(o),t.n)},precompute(o=8,u=y.BASE){return u._setWindowSize(o),u.multiply(BigInt(3)),u}};function K(o,u=!0){return y.fromPrivateKey(o).toRawBytes(u)}function z(o){let u=br(o),f=typeof o=="string",h=(u||f)&&o.length;return u?h===i||h===s:f?h===2*i||h===2*s:o instanceof y}function D(o,u,f=!0){if(z(o))throw new Error("first arg must be private key");if(!z(u))throw new Error("second arg must be public key");return y.fromHex(u).multiply(v(o)).toRawBytes(f)}let et=t.bits2int||function(o){let u=rr(o),f=o.length*8-t.nBitLength;return f>0?u>>BigInt(f):u},W=t.bits2int_modN||function(o){return c(et(o))},J=hi(t.nBitLength);function Q(o){return Me(`num < 2^${t.nBitLength}`,o,ar,J),xr(o,t.nByteLength)}function nt(o,u,f=te){if(["recovered","canonical"].some(V=>V in f))throw new Error("sign() legacy options not supported");let{hash:h,randomBytes:l}=t,{lowS:w,prehash:b,extraEntropy:d}=f;w==null&&(w=!0),o=ue("msgHash",o),Dc(f),b&&(o=ue("prehashed msgHash",h(o)));let a=W(o),g=v(u),M=[Q(g),Q(a)];if(d!=null&&d!==!1){let V=d===!0?l(e.BYTES):d;M.push(ue("extraEntropy",V))}let R=nr(...M),T=a;function F(V){let X=et(V);if(!k(X))return;let jt=p(X),Y=y.BASE.multiply(X).toAffine(),tt=c(Y.x);if(tt===ar)return;let Ee=c(jt*c(T+tt*g));if(Ee===ar)return;let ut=(Y.x===tt?0:2)|Number(Y.y&de),ct=Ee;return w&&B(Ee)&&(ct=P(Ee),ut^=1),new E(tt,ct,ut)}return{seed:R,k2sig:F}}let te={lowS:t.lowS,prehash:!1},G={lowS:t.lowS,prehash:!1};function st(o,u,f=te){let{seed:h,k2sig:l}=nt(o,u,f),w=t;return Bs(w.hash.outputLen,w.nByteLength,w.hmac)(h,l)}y.BASE._setWindowSize(8);function m(o,u,f,h=G){let l=o;if(u=ue("msgHash",u),f=ue("publicKey",f),"strict"in h)throw new Error("options.strict was renamed to lowS");Dc(h);let{lowS:w,prehash:b}=h,d,a;try{if(typeof l=="string"||br(l))try{d=E.fromDER(l)}catch(Y){if(!(Y instanceof sr.Err))throw Y;d=E.fromCompact(l)}else if(typeof l=="object"&&typeof l.r=="bigint"&&typeof l.s=="bigint"){let{r:Y,s:tt}=l;d=new E(Y,tt)}else throw new Error("PARSE");a=y.fromHex(f)}catch(Y){if(Y.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(w&&d.hasHighS())return!1;b&&(u=t.hash(u));let{r:g,s:M}=d,R=W(u),T=p(M),F=c(R*T),V=c(g*T),X=y.BASE.multiplyAndAddUnsafe(a,F,V)?.toAffine();return X?c(X.x)===g:!1}return{CURVE:t,getPublicKey:K,getSharedSecret:D,sign:st,verify:m,ProjectivePoint:y,Signature:E,utils:O}}var c1,D0,W0,sr,ar,de,s1,Wc,a1,$c=vt(()=>{c1=C(N(),1);Rs();Cn();hn();hn();({bytesToNumberBE:D0,hexToBytes:W0}=Zi),sr={Err:class extends Error{constructor(t=""){super(t)}},_tlv:{encode:(n,t)=>{let{Err:e}=sr;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");let r=t.length/2,i=an(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");let s=r>127?an(i.length/2|128):"";return`${an(n)}${s}${i}${t}`},decode(n,t){let{Err:e}=sr,r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");let i=t[r++],s=!!(i&128),c=0;if(!s)c=i;else{let y=i&127;if(!y)throw new e("tlv.decode(long): indefinite length not supported");if(y>4)throw new e("tlv.decode(long): byte length is too big");let v=t.subarray(r,r+y);if(v.length!==y)throw new e("tlv.decode: length bytes not complete");if(v[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(let x of v)c=c<<8|x;if(r+=y,c<128)throw new e("tlv.decode(long): not minimal encoding")}let p=t.subarray(r,r+c);if(p.length!==c)throw new e("tlv.decode: wrong value length");return{v:p,l:t.subarray(r+c)}}},_int:{encode(n){let{Err:t}=sr;if(nca(n,t,cs(...e)),randomBytes:$i}}function Vc(n,t){let e=r=>Hc({...n,...V0(r)});return Object.freeze({...e(t),create:e})}var p1,Gc=vt(()=>{p1=C(N(),1);Kc();gr();$c();});function Z0(n){let t=Yc,e=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),c=BigInt(23),p=BigInt(44),y=BigInt(88),v=n*n*n%t,x=v*v*n%t,k=oe(x,e,t)*x%t,_=oe(k,e,t)*x%t,B=oe(_,fa,t)*v%t,P=oe(B,i,t)*B%t,I=oe(P,s,t)*P%t,E=oe(I,p,t)*I%t,O=oe(E,y,t)*E%t,K=oe(O,p,t)*I%t,z=oe(K,e,t)*x%t,D=oe(z,c,t)*P%t,et=oe(D,r,t)*v%t,W=oe(et,fa,t);if(!ha.eql(ha.sqr(W),n))throw new Error("Cannot find square root");return W}var x1,Yc,Zc,G0,fa,jc,ha,Ii,w1,b1,Jc=vt(()=>{x1=C(N(),1);zs();Gc();Cn();Yc=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Zc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),G0=BigInt(1),fa=BigInt(2),jc=(n,t)=>(n+t/fa)/t;ha=kr(Yc,void 0,void 0,{sqrt:Z0}),Ii=Vc({a:BigInt(0),b:BigInt(7),Fp:ha,n:Zc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{let t=Zc,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-G0*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,c=BigInt("0x100000000000000000000000000000000"),p=jc(s*n,t),y=jc(-r*n,t),v=Xt(n-p*e-y*i,t),x=Xt(-p*r-y*s,t),k=v>c,_=x>c;if(k&&(v=t-v),_&&(x=t-x),v>c||x>c)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:k,k1:v,k2neg:_,k2:x}}}},di),w1=BigInt(0),b1=Ii.ProjectivePoint});function Qc(n){try{return dn.ExtendedPoint.fromHex(n),!0}catch{return!1}}function J0(n){return n._bn!==void 0}function Bf(n,t){let e=i=>{if(i.span>=0)return i.span;if(typeof i.alloc=="function")return i.alloc(t[i.property]);if("count"in i&&"elementLayout"in i){let s=t[i.property];if(Array.isArray(s))return s.length*e(i.elementLayout)}else if("fields"in i)return Bf({layout:i},t[i.property]);return 0},r=0;return n.layout.fields.forEach(i=>{r+=e(i)}),r}function Ue(n){let t=0,e=0;for(;;){let r=n.shift();if(t|=(r&127)<>=7,e==0){n.push(r);break}else r|=128,n.push(r)}}function ne(n,t){if(!n)throw new Error(t||"Assertion failed")}function cr(n){if(n.length===0)throw new Error(Ef);return n.shift()}function ze(n,...t){let[e]=t;if(t.length===2?e+(t[1]??0)>n.length:e>=n.length)throw new Error(Ef);return n.splice(...t)}async function ef(n,t,e,r){let i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},s=await n.sendTransaction(t,e,i),c;if(t.recentBlockhash!=null&&t.lastValidBlockHeight!=null)c=(await n.confirmTransaction({abortSignal:r?.abortSignal,signature:s,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},r&&r.commitment)).value;else if(t.minNonceContextSlot!=null&&t.nonceInfo!=null){let{nonceInstruction:p}=t.nonceInfo,y=p.keys[0].pubkey;c=(await n.confirmTransaction({abortSignal:r?.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:y,nonceValue:t.nonceInfo.nonce,signature:s},r&&r.commitment)).value}else r?.abortSignal!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),c=(await n.confirmTransaction(s,r&&r.commitment)).value;if(c.err)throw s!=null?new Ti({action:"send",signature:s,transactionMessage:`Status: (${JSON.stringify(c)})`}):new Error(`Transaction ${s} failed (${JSON.stringify(c)})`);return s}function bn(n){return new Promise(t=>setTimeout(t,n))}function Gt(n,t){let e=n.layout.span>=0?n.layout.span:Bf(n,t),r=at.Buffer.alloc(e),i=Object.assign({instruction:n.index},t);return n.layout.encode(i,r),r}function fd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function hd(){if(nf)return pa;nf=1;var n=Object.prototype.toString,t=Object.keys||function(r){var i=[];for(var s in r)i.push(s);return i};function e(r,i){var s,c,p,y,v,x,k;if(r===!0)return"true";if(r===!1)return"false";switch(typeof r){case"object":if(r===null)return null;if(r.toJSON&&typeof r.toJSON=="function")return e(r.toJSON(),i);if(k=n.call(r),k==="[object Array]"){for(p="[",c=r.length-1,s=0;s-1&&(p+=e(r[s],!0)),p+"]"}else if(k==="[object Object]"){for(y=t(r).sort(),c=y.length,p="",s=0;s1;)n/=2,t++;return t}function dd(n){return n===0?1:(n--,n|=n>>1,n|=n>>2,n|=n>>4,n|=n>>8,n|=n>>16,n|=n>>32,n+1)}function yd(n,t){let e;try{e=n.layout.decode(t)}catch(r){throw new Error("invalid instruction; "+r)}if(e.typeIndex!==n.index)throw new Error(`invalid account data; account type mismatch ${e.typeIndex} != ${n.index}`);return e}function wd(n){let t=n.match(md);if(t==null)throw TypeError(`Failed to validate endpoint URL \\`${n}\\``);let[e,r,i,s]=t,c=n.startsWith("https:")?"wss:":"ws:",p=i==null?null:parseInt(i.slice(1),10),y=p==null?"":`:${p+1}`;return`${c}//${r}${y}${s}`}function vd(n){if(/^https?:/.test(n)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return n}function re(n){let t,e;if(typeof n=="string")t=n;else if(n){let{commitment:r,...i}=n;t=r,e=i}return{commitment:t,config:e}}function af(n){return n.map(t=>"memcmp"in t?{...t,memcmp:{...t.memcmp,encoding:t.memcmp.encoding??"base58"}}:t)}function Mf(n){return be([q({jsonrpc:se("2.0"),id:H(),result:n}),q({jsonrpc:se("2.0"),id:H(),error:q({code:wn(),message:H(),data:it(ec())})})])}function Ht(n){return Fn(Mf(n),xd,t=>"error"in t?t:{...t,result:$(t.result,n)})}function ce(n){return Ht(q({context:q({slot:A()}),value:n}))}function Zo(n){return q({context:q({slot:A()}),value:n})}function ga(n,t){return n===0?new $n({header:t.header,staticAccountKeys:t.accountKeys.map(e=>new ot(e)),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:pe.default.decode(e.data)})),addressTableLookups:t.addressTableLookups}):new Ye(t)}function Od(n,t,e,r,i,s){let c=e||pd,p;s!=null&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments.");let y;return r&&(y=async(x,k)=>{let _=await new Promise((B,P)=>{try{r(x,k,(I,E)=>B([I,E]))}catch(I){P(I)}});return await c(..._)}),new bf.default(async(x,k)=>{let _={method:"POST",body:x,agent:p,headers:Object.assign({"Content-Type":"application/json"},t||{},Up)};try{let B=5,P,I=500;for(;y?P=await y(n,_):P=await c(n,_),!(P.status!==429||i===!0||(B-=1,B===0));)console.error(`Server responded with ${P.status} ${P.statusText}. Retrying after ${I}ms delay...`),await bn(I),I*=2;let E=await P.text();P.ok?k(null,E):k(new Error(`${P.status} ${P.statusText}: ${E}`))}catch(B){B instanceof Error&&k(B)}},{})}function Ud(n){return(t,e)=>new Promise((r,i)=>{n.request(t,e,(s,c)=>{if(s){i(s);return}r(c)})})}function Nd(n){return t=>new Promise((e,r)=>{t.length===0&&e([]);let i=t.map(s=>n.request(s.methodName,s.args));n.request(i,(s,c)=>{if(s){r(s);return}e(c)})})}function qf(n,t){let e=t===!1?"http":"https";if(!n)return mf[e].devnet;let r=mf[e][n];if(!r)throw new Error(`Unknown ${e} cluster: ${n}`);return r}var W1,at,va,pe,jn,S,wf,Ni,bf,A1,Xc,xa,vf,j0,Vt,ka,Ko,xf,Y0,Pr,tf,ot,M1,xn,kf,Sf,Do,Wo,vn,Wn,$t,Dn,X0,Q0,td,ed,Hn,Ef,Ye,$n,Rr,rd,ee,Zt,nd,id,od,_f,ur,L1,R1,la,Ri,T1,P1,C1,da,Ti,rt,sd,If,rf,Pi,ad,ud,Vn,Oe,ye,cd,Gn,O1,pa,nf,ld,of,Ai,Sa,pd,Ba,sf,Ho,gd,md,ae,Af,La,bd,xd,kd,Sd,Bd,Ed,_d,Id,Ad,Sn,Md,Ld,Rd,Td,Pd,uf,Cd,zd,qd,Fd,Kd,Dd,Wd,Hd,$d,Ea,Vd,Gd,_a,Zd,jd,Ci,Yd,Jd,Ia,Xd,Qd,tp,ep,rp,np,ip,op,sp,ap,up,cp,fp,hp,cf,lp,dp,pp,yp,gp,Lf,Ra,Rf,Tf,Pf,Cf,mp,wp,Of,Uf,$o,Nf,jo,Ta,Yn,Bn,bp,vp,xp,kp,Sp,Bp,Ep,ff,ma,qo,_p,Ip,Ap,Mp,Lp,Rp,Tp,Pp,Cp,Op,Up,Vo,fr,Mi,Aa,Fo,Ma,hf,lf,df,pf,Oi,Np,zp,yf,wa,gf,qp,ba,kn,zf,Fp,Ui,Tr,U1,Go,Li,N1,Zn,z1,q1,F1,K1,mf,Ff=vt(()=>{W1=C(N()),at=C(Mn());Tu();va=C(Cu()),pe=C(Fu());zs();jn=C(Yu()),S=C(Zs()),wf=C(Zs()),Ni=C(Ju());rc();bf=C(_c());Pc();Fc();Jc();A1=dn.utils.randomPrivateKey,Xc=()=>{let n=dn.utils.randomPrivateKey(),t=xa(n),e=new Uint8Array(64);return e.set(n),e.set(t,32),{publicKey:t,secretKey:e}},xa=dn.getPublicKey;vf=(n,t)=>dn.sign(n,t.slice(0,32)),j0=dn.verify,Vt=n=>at.Buffer.isBuffer(n)?n:n instanceof Uint8Array?at.Buffer.from(n.buffer,n.byteOffset,n.byteLength):at.Buffer.from(n),ka=class{constructor(t){Object.assign(this,t)}encode(){return at.Buffer.from((0,jn.serialize)(Ko,this))}static decode(t){return(0,jn.deserialize)(Ko,this,t)}static decodeUnchecked(t){return(0,jn.deserializeUnchecked)(Ko,this,t)}},Ko=new Map,Y0=32,Pr=32;tf=1,ot=class extends ka{constructor(t){if(super({}),this._bn=void 0,J0(t))this._bn=t._bn;else{if(typeof t=="string"){let e=pe.default.decode(t);if(e.length!=Pr)throw new Error("Invalid public key input");this._bn=new va.default(e)}else this._bn=new va.default(t);if(this._bn.byteLength()>Pr)throw new Error("Invalid public key input")}}static unique(){let t=new ot(tf);return tf+=1,new ot(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return pe.default.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){let t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){let t=this._bn.toArrayLike(at.Buffer);if(t.length===Pr)return t;let e=at.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,r){let i=at.Buffer.concat([t.toBuffer(),at.Buffer.from(e),r.toBuffer()]),s=di(i);return new ot(s)}static createProgramAddressSync(t,e){let r=at.Buffer.alloc(0);t.forEach(function(s){if(s.length>Y0)throw new TypeError("Max seed length exceeded");r=at.Buffer.concat([r,Vt(s)])}),r=at.Buffer.concat([r,e.toBuffer(),at.Buffer.from("ProgramDerivedAddress")]);let i=di(r);if(Qc(i))throw new Error("Invalid seeds, address must fall off the curve");return new ot(i)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let r=255,i;for(;r!=0;){try{let s=t.concat(at.Buffer.from([r]));i=this.createProgramAddressSync(s,e)}catch(s){if(s instanceof TypeError)throw s;r--;continue}return[i,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){let e=new ot(t);return Qc(e.toBytes())}};xf=ot;ot.default=new xf("11111111111111111111111111111111");Ko.set(ot,{kind:"struct",fields:[["_bn","u256"]]});M1=new ot("BPFLoader1111111111111111111111111111111111"),xn=1280-40-8,kf=127,Sf=64,Do=class extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}};Object.defineProperty(Do.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});Wo=class extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}};Object.defineProperty(Wo.prototype,"name",{value:"TransactionExpiredTimeoutError"});vn=class extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}};Object.defineProperty(vn.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});Wn=class{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){let t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(let e of this.keySegments()){if(t255+1)throw new Error("Account index overflow encountered during compilation");let r=new Map;this.keySegments().flat().forEach((s,c)=>{r.set(s.toBase58(),c)});let i=s=>{let c=r.get(s.toBase58());if(c===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return c};return t.map(s=>({programIdIndex:i(s.programId),accountKeyIndexes:s.keys.map(c=>i(c.pubkey)),data:s.data}))}},$t=(n="publicKey")=>S.blob(32,n),Dn=(n="string")=>{let t=S.struct([S.u32("length"),S.u32("lengthPadding"),S.blob(S.offset(S.u32(),-8),"chars")],n),e=t.decode.bind(t),r=t.encode.bind(t),i=t;return i.decode=(s,c)=>e(s,c).chars.toString(),i.encode=(s,c,p)=>{let y={chars:at.Buffer.from(s,"utf8")};return r(y,c,p)},i.alloc=s=>S.u32().span+S.u32().span+at.Buffer.from(s,"utf8").length,i},X0=(n="authorized")=>S.struct([$t("staker"),$t("withdrawer")],n),Q0=(n="lockup")=>S.struct([S.ns64("unixTimestamp"),S.ns64("epoch"),$t("custodian")],n),td=(n="voteInit")=>S.struct([$t("nodePubkey"),$t("authorizedVoter"),$t("authorizedWithdrawer"),S.u8("commission")],n),ed=(n="voteAuthorizeWithSeedArgs")=>S.struct([S.u32("voteAuthorizationType"),$t("currentAuthorityDerivedKeyOwnerPubkey"),Dn("currentAuthorityDerivedKeySeed"),$t("newAuthorized")],n);Hn=class{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){let r=new Map,i=c=>{let p=c.toBase58(),y=r.get(p);return y===void 0&&(y={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(p,y)),y},s=i(e);s.isSigner=!0,s.isWritable=!0;for(let c of t){i(c.programId).isInvoked=!0;for(let p of c.keys){let y=i(p.pubkey);y.isSigner||=p.isSigner,y.isWritable||=p.isWritable}}return new Hn(e,r)}getMessageComponents(){let t=[...this.keyMetaMap.entries()];ne(t.length<=256,"Max static account keys length exceeded");let e=t.filter(([,y])=>y.isSigner&&y.isWritable),r=t.filter(([,y])=>y.isSigner&&!y.isWritable),i=t.filter(([,y])=>!y.isSigner&&y.isWritable),s=t.filter(([,y])=>!y.isSigner&&!y.isWritable),c={numRequiredSignatures:e.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:s.length};{ne(e.length>0,"Expected at least one writable signer key");let[y]=e[0];ne(y===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}let p=[...e.map(([y])=>new ot(y)),...r.map(([y])=>new ot(y)),...i.map(([y])=>new ot(y)),...s.map(([y])=>new ot(y))];return[c,p]}extractTableLookup(t){let[e,r]=this.drainKeysFoundInLookupTable(t.state.addresses,c=>!c.isSigner&&!c.isInvoked&&c.isWritable),[i,s]=this.drainKeysFoundInLookupTable(t.state.addresses,c=>!c.isSigner&&!c.isInvoked&&!c.isWritable);if(!(e.length===0&&i.length===0))return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:i},{writable:r,readonly:s}]}drainKeysFoundInLookupTable(t,e){let r=new Array,i=new Array;for(let[s,c]of this.keyMetaMap.entries())if(e(c)){let p=new ot(s),y=t.findIndex(v=>v.equals(p));y>=0&&(ne(y<256,"Max lookup table index exceeded"),r.push(y),i.push(p),this.keyMetaMap.delete(s))}return[r,i]}},Ef="Reached end of buffer unexpectedly";Ye=class{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(e=>new ot(e)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:pe.default.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Wn(this.staticAccountKeys)}static compile(t){let e=Hn.compile(t.instructions,t.payerKey),[r,i]=e.getMessageComponents(),c=new Wn(i).compileInstructions(t.instructions).map(p=>({programIdIndex:p.programIdIndex,accounts:p.accountKeyIndexes,data:pe.default.encode(p.data)}));return new Ye({header:r,accountKeys:i,recentBlockhash:t.recentBlockhash,instructions:c})}isAccountSigner(t){return t=this.header.numRequiredSignatures){let r=t-e,s=this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts;return r!this.isProgramId(e))}serialize(){let t=this.accountKeys.length,e=[];Ne(e,t);let r=this.instructions.map(k=>{let{accounts:_,programIdIndex:B}=k,P=Array.from(pe.default.decode(k.data)),I=[];Ne(I,_.length);let E=[];return Ne(E,P.length),{programIdIndex:B,keyIndicesCount:at.Buffer.from(I),keyIndices:_,dataLength:at.Buffer.from(E),data:P}}),i=[];Ne(i,r.length);let s=at.Buffer.alloc(xn);at.Buffer.from(i).copy(s);let c=i.length;r.forEach(k=>{let B=S.struct([S.u8("programIdIndex"),S.blob(k.keyIndicesCount.length,"keyIndicesCount"),S.seq(S.u8("keyIndex"),k.keyIndices.length,"keyIndices"),S.blob(k.dataLength.length,"dataLength"),S.seq(S.u8("userdatum"),k.data.length,"data")]).encode(k,s,c);c+=B}),s=s.slice(0,c);let p=S.struct([S.blob(1,"numRequiredSignatures"),S.blob(1,"numReadonlySignedAccounts"),S.blob(1,"numReadonlyUnsignedAccounts"),S.blob(e.length,"keyCount"),S.seq($t("key"),t,"keys"),$t("recentBlockhash")]),y={numRequiredSignatures:at.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:at.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:at.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:at.Buffer.from(e),keys:this.accountKeys.map(k=>Vt(k.toBytes())),recentBlockhash:pe.default.decode(this.recentBlockhash)},v=at.Buffer.alloc(2048),x=p.encode(y,v);return s.copy(v,x),v.slice(0,x+s.length)}static from(t){let e=[...t],r=cr(e);if(r!==(r&kf))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");let i=cr(e),s=cr(e),c=Ue(e),p=[];for(let _=0;_0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new Wn(this.staticAccountKeys,e)}isAccountSigner(t){return t=r){let i=t-r,s=this.addressTableLookups.reduce((c,p)=>c+p.writableIndexes.length,0);return i=this.header.numRequiredSignatures){let i=t-e,c=r-e-this.header.numReadonlyUnsignedAccounts;return is.key.equals(r.accountKey));if(!i)throw new Error(`Failed to find address lookup table account for table key ${r.accountKey.toBase58()}`);for(let s of r.writableIndexes)if(sx.toBytes()),recentBlockhash:pe.default.decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(s),serializedAddressTableLookups:i},p);return p.slice(0,v)}serializeInstructions(){let t=0,e=new Uint8Array(xn);for(let r of this.compiledInstructions){let i=Array();Ne(i,r.accountKeyIndexes.length);let s=Array();Ne(s,r.data.length);let c=S.struct([S.u8("programIdIndex"),S.blob(i.length,"encodedAccountKeyIndexesLength"),S.seq(S.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),S.blob(s.length,"encodedDataLength"),S.blob(r.data.length,"data")]);t+=c.encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(s),data:r.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0,e=new Uint8Array(xn);for(let r of this.addressTableLookups){let i=Array();Ne(i,r.writableIndexes.length);let s=Array();Ne(s,r.readonlyIndexes.length);let c=S.struct([$t("accountKey"),S.blob(i.length,"encodedWritableIndexesLength"),S.seq(S.u8(),r.writableIndexes.length,"writableIndexes"),S.blob(s.length,"encodedReadonlyIndexesLength"),S.seq(S.u8(),r.readonlyIndexes.length,"readonlyIndexes")]);t+=c.encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(s),readonlyIndexes:r.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t],r=cr(e),i=r&kf;ne(r!==i,"Expected versioned message but received legacy message");let s=i;ne(s===0,`Expected versioned message with version 0 but found version ${s}`);let c={numRequiredSignatures:cr(e),numReadonlySignedAccounts:cr(e),numReadonlyUnsignedAccounts:cr(e)},p=[],y=Ue(e);for(let P=0;P({pubkey:t.toJSON(),isSigner:e,isWritable:r})),programId:this.programId.toJSON(),data:[...this.data]}}},Zt=class{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){let{minContextSlot:e,nonceInfo:r}=t;this.minNonceContextSlot=e,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){let{blockhash:e,lastValidBlockHeight:r}=t;this.recentBlockhash=e,this.lastValidBlockHeight=r}else{let{recentBlockhash:e,nonceInfo:r}=t;r&&(this.nonceInfo=r),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new ee(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?e=[this.nonceInfo.nonceInstruction,...this.instructions]:e=this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");e.length<1&&console.warn("No instructions provided");let r;if(this.feePayer)r=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)r=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let I=0;I{I.keys.forEach(O=>{s.push({...O})});let E=I.programId.toString();i.includes(E)||i.push(E)}),i.forEach(I=>{s.push({pubkey:new ot(I),isSigner:!1,isWritable:!1})});let c=[];s.forEach(I=>{let E=I.pubkey.toString(),O=c.findIndex(K=>K.pubkey.toString()===E);O>-1?(c[O].isWritable=c[O].isWritable||I.isWritable,c[O].isSigner=c[O].isSigner||I.isSigner):c.push(I)}),c.sort(function(I,E){if(I.isSigner!==E.isSigner)return I.isSigner?-1:1;if(I.isWritable!==E.isWritable)return I.isWritable?-1:1;let O={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return I.pubkey.toBase58().localeCompare(E.pubkey.toBase58(),"en",O)});let p=c.findIndex(I=>I.pubkey.equals(r));if(p>-1){let[I]=c.splice(p,1);I.isSigner=!0,I.isWritable=!0,c.unshift(I)}else c.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(let I of this.signatures){let E=c.findIndex(O=>O.pubkey.equals(I.publicKey));if(E>-1)c[E].isSigner||(c[E].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${I.publicKey.toString()}`)}let y=0,v=0,x=0,k=[],_=[];c.forEach(({pubkey:I,isSigner:E,isWritable:O})=>{E?(k.push(I.toString()),y+=1,O||(v+=1)):(_.push(I.toString()),O||(x+=1))});let B=k.concat(_),P=e.map(I=>{let{data:E,programId:O}=I;return{programIdIndex:B.indexOf(O.toString()),accounts:I.keys.map(K=>B.indexOf(K.pubkey.toString())),data:pe.default.encode(E)}});return P.forEach(I=>{ne(I.programIdIndex>=0),I.accounts.forEach(E=>ne(E>=0))}),new Ye({header:{numRequiredSignatures:y,numReadonlySignedAccounts:v,numReadonlyUnsignedAccounts:x},accountKeys:B,recentBlockhash:t,instructions:P})}_compile(){let t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((i,s)=>e[s].equals(i.publicKey))||(this.signatures=e.map(r=>({signature:null,publicKey:r}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");let e=new Set;this.signatures=t.filter(r=>{let i=r.toString();return e.has(i)?!1:(e.add(i),!0)}).map(r=>({signature:null,publicKey:r}))}sign(...t){if(t.length===0)throw new Error("No signers");let e=new Set,r=[];for(let s of t){let c=s.publicKey.toString();e.has(c)||(e.add(c),r.push(s))}this.signatures=r.map(s=>({signature:null,publicKey:s.publicKey}));let i=this._compile();this._partialSign(i,...r)}partialSign(...t){if(t.length===0)throw new Error("No signers");let e=new Set,r=[];for(let s of t){let c=s.publicKey.toString();e.has(c)||(e.add(c),r.push(s))}let i=this._compile();this._partialSign(i,...r)}_partialSign(t,...e){let r=t.serialize();e.forEach(i=>{let s=vf(r,i.secretKey);this._addSignature(i.publicKey,Vt(s))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){ne(e.length===64);let r=this.signatures.findIndex(i=>t.equals(i.publicKey));if(r<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[r].signature=at.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){let r={};for(let{signature:i,publicKey:s}of this.signatures)i===null?e&&(r.missing||=[]).push(s):j0(i,t,s.toBytes())||(r.invalid||=[]).push(s);return r.invalid||r.missing?r:void 0}serialize(t){let{requireAllSignatures:e,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),i=this.serializeMessage();if(r){let s=this._getMessageSignednessErrors(i,e);if(s){let c="Signature verification failed.";throw s.invalid&&(c+=`\nInvalid signature for public key${s.invalid.length===1?"":"(s)"} [\\`${s.invalid.map(p=>p.toBase58()).join("`, `")}\\`].`),s.missing&&(c+=`\nMissing signature for public key${s.missing.length===1?"":"(s)"} [\\`${s.missing.map(p=>p.toBase58()).join("`, `")}\\`].`),new Error(c)}}return this._serialize(i)}_serialize(t){let{signatures:e}=this,r=[];Ne(r,e.length);let i=r.length+e.length*64+t.length,s=at.Buffer.alloc(i);return ne(e.length<256),at.Buffer.from(r).copy(s,0),e.forEach(({signature:c},p)=>{c!==null&&(ne(c.length===64,"signature has invalid length"),at.Buffer.from(c).copy(s,r.length+p*64))}),t.copy(s,r.length+e.length*64),ne(s.length<=xn,`Transaction too large: ${s.length} > ${xn}`),s}get keys(){return ne(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return ne(this.instructions.length===1),this.instructions[0].programId}get data(){return ne(this.instructions.length===1),this.instructions[0].data}static from(t){let e=[...t],r=Ue(e),i=[];for(let s=0;s0&&(r.feePayer=t.accountKeys[0]),e.forEach((i,s)=>{let c={signature:i==pe.default.encode(rd)?null:pe.default.decode(i),publicKey:t.accountKeys[s]};r.signatures.push(c)}),t.instructions.forEach(i=>{let s=i.accounts.map(c=>{let p=t.accountKeys[c];return{pubkey:p,isSigner:r.signatures.some(y=>y.publicKey.toString()===p.toString())||t.isAccountSigner(c),isWritable:t.isAccountWritable(c)}});r.instructions.push(new ee({keys:s,programId:t.accountKeys[i.programIdIndex],data:pe.default.decode(i.data)}))}),r._message=t,r._json=r.toJSON(),r}},nd=160,id=64,od=nd/id,_f=1e3/od,ur=new ot("SysvarC1ock11111111111111111111111111111111"),L1=new ot("SysvarEpochSchedu1e111111111111111111111111"),R1=new ot("Sysvar1nstructions1111111111111111111111111"),la=new ot("SysvarRecentB1ockHashes11111111111111111111"),Ri=new ot("SysvarRent111111111111111111111111111111111"),T1=new ot("SysvarRewards111111111111111111111111111111"),P1=new ot("SysvarS1otHashes111111111111111111111111111"),C1=new ot("SysvarS1otHistory11111111111111111111111111"),da=new ot("SysvarStakeHistory1111111111111111111111111"),Ti=class extends Error{constructor({action:t,signature:e,transactionMessage:r,logs:i}){let s=i?`Logs: \n${JSON.stringify(i.slice(-10),null,2)}. `:"",c="\\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.",p;switch(t){case"send":p=`Transaction ${e} resulted in an error. \n${r}. `+s+c;break;case"simulate":p=`Simulation failed. \nMessage: ${r}. \n`+s+c;break;default:p=`Unknown action \'${(y=>y)(t)}\'`}super(p),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=e,this.transactionMessage=r,this.transactionLogs=i||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){let t=this.transactionLogs;if(!(t!=null&&typeof t=="object"&&"then"in t))return t}async getLogs(t){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((e,r)=>{t.getTransaction(this.signature).then(i=>{if(i&&i.meta&&i.meta.logMessages){let s=i.meta.logMessages;this.transactionLogs=s,e(s)}else r(new Error("Log messages not found"))}).catch(r)})),await this.transactionLogs}},rt=class extends Error{constructor({code:t,message:e,data:r},i){super(i!=null?`${i}: ${e}`:e),this.code=void 0,this.data=void 0,this.code=t,this.data=r,this.name="SolanaJSONRPCError"}};sd=S.nu64("lamportsPerSignature"),If=S.struct([S.u32("version"),S.u32("state"),$t("authorizedPubkey"),$t("nonce"),S.struct([sd],"feeCalculator")]),rf=If.span,Pi=class{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){let e=If.decode(Vt(t),0);return new Pi({authorizedPubkey:new ot(e.authorizedPubkey),nonce:new ot(e.nonce).toString(),feeCalculator:e.feeCalculator})}},ad=n=>{let t=n.decode.bind(n),e=n.encode.bind(n);return{decode:t,encode:e}},ud=n=>t=>{let e=(0,wf.blob)(n,t),{encode:r,decode:i}=ad(e),s=e;return s.decode=(c,p)=>{let y=i(c,p);return(0,Ni.toBigIntLE)(at.Buffer.from(y))},s.encode=(c,p,y)=>{let v=(0,Ni.toBufferLE)(c,n);return r(v,p,y)},s},Vn=ud(8),Oe=Object.freeze({Create:{index:0,layout:S.struct([S.u32("instruction"),S.ns64("lamports"),S.ns64("space"),$t("programId")])},Assign:{index:1,layout:S.struct([S.u32("instruction"),$t("programId")])},Transfer:{index:2,layout:S.struct([S.u32("instruction"),Vn("lamports")])},CreateWithSeed:{index:3,layout:S.struct([S.u32("instruction"),$t("base"),Dn("seed"),S.ns64("lamports"),S.ns64("space"),$t("programId")])},AdvanceNonceAccount:{index:4,layout:S.struct([S.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:S.struct([S.u32("instruction"),$t("authorized")])},AuthorizeNonceAccount:{index:7,layout:S.struct([S.u32("instruction"),$t("authorized")])},Allocate:{index:8,layout:S.struct([S.u32("instruction"),S.ns64("space")])},AllocateWithSeed:{index:9,layout:S.struct([S.u32("instruction"),$t("base"),Dn("seed"),S.ns64("space"),$t("programId")])},AssignWithSeed:{index:10,layout:S.struct([S.u32("instruction"),$t("base"),Dn("seed"),$t("programId")])},TransferWithSeed:{index:11,layout:S.struct([S.u32("instruction"),Vn("lamports"),Dn("seed"),$t("programId")])},UpgradeNonceAccount:{index:12,layout:S.struct([S.u32("instruction")])}}),ye=class{constructor(){}static createAccount(t){let e=Oe.Create,r=Gt(e,{lamports:t.lamports,space:t.space,programId:Vt(t.programId.toBuffer())});return new ee({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:r})}static transfer(t){let e,r;if("basePubkey"in t){let i=Oe.TransferWithSeed;e=Gt(i,{lamports:BigInt(t.lamports),seed:t.seed,programId:Vt(t.programId.toBuffer())}),r=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}else{let i=Oe.Transfer;e=Gt(i,{lamports:BigInt(t.lamports)}),r=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]}return new ee({keys:r,programId:this.programId,data:e})}static assign(t){let e,r;if("basePubkey"in t){let i=Oe.AssignWithSeed;e=Gt(i,{base:Vt(t.basePubkey.toBuffer()),seed:t.seed,programId:Vt(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{let i=Oe.Assign;e=Gt(i,{programId:Vt(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new ee({keys:r,programId:this.programId,data:e})}static createAccountWithSeed(t){let e=Oe.CreateWithSeed,r=Gt(e,{base:Vt(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:Vt(t.programId.toBuffer())}),i=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey.equals(t.fromPubkey)||i.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new ee({keys:i,programId:this.programId,data:r})}static createNonceAccount(t){let e=new Zt;"basePubkey"in t&&"seed"in t?e.add(ye.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:rf,programId:this.programId})):e.add(ye.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:rf,programId:this.programId}));let r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(r)),e}static nonceInitialize(t){let e=Oe.InitializeNonceAccount,r=Gt(e,{authorized:Vt(t.authorizedPubkey.toBuffer())}),i={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:la,isSigner:!1,isWritable:!1},{pubkey:Ri,isSigner:!1,isWritable:!1}],programId:this.programId,data:r};return new ee(i)}static nonceAdvance(t){let e=Oe.AdvanceNonceAccount,r=Gt(e),i={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:la,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r};return new ee(i)}static nonceWithdraw(t){let e=Oe.WithdrawNonceAccount,r=Gt(e,{lamports:t.lamports});return new ee({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:la,isSigner:!1,isWritable:!1},{pubkey:Ri,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}static nonceAuthorize(t){let e=Oe.AuthorizeNonceAccount,r=Gt(e,{authorized:Vt(t.newAuthorizedPubkey.toBuffer())});return new ee({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}static allocate(t){let e,r;if("basePubkey"in t){let i=Oe.AllocateWithSeed;e=Gt(i,{base:Vt(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:Vt(t.programId.toBuffer())}),r=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]}else{let i=Oe.Allocate;e=Gt(i,{space:t.space}),r=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]}return new ee({keys:r,programId:this.programId,data:e})}};ye.programId=new ot("11111111111111111111111111111111");cd=xn-300,Gn=class{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/Gn.chunkSize)+1+1)}static async load(t,e,r,i,s){{let k=await t.getMinimumBalanceForRentExemption(s.length),_=await t.getAccountInfo(r.publicKey,"confirmed"),B=null;if(_!==null){if(_.executable)return console.error("Program load failed, account is already executable"),!1;_.data.length!==s.length&&(B=B||new Zt,B.add(ye.allocate({accountPubkey:r.publicKey,space:s.length}))),_.owner.equals(i)||(B=B||new Zt,B.add(ye.assign({accountPubkey:r.publicKey,programId:i}))),_.lamports0?k:1,space:s.length,programId:i}));B!==null&&await ef(t,B,[e,r],{commitment:"confirmed"})}let c=S.struct([S.u32("instruction"),S.u32("offset"),S.u32("bytesLength"),S.u32("bytesLengthPadding"),S.seq(S.u8("byte"),S.offset(S.u32(),-8),"bytes")]),p=Gn.chunkSize,y=0,v=s,x=[];for(;v.length>0;){let k=v.slice(0,p),_=at.Buffer.alloc(p+16);c.encode({instruction:0,offset:y,bytes:k,bytesLength:0,bytesLengthPadding:0},_);let B=new Zt().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:i,data:_});x.push(ef(t,B,[e,r],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await bn(1e3/4),y+=p,v=v.slice(p)}await Promise.all(x);{let k=S.struct([S.u32("instruction")]),_=at.Buffer.alloc(k.span);k.encode({instruction:1},_);let B=new Zt().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:Ri,isSigner:!1,isWritable:!1}],programId:i,data:_}),P="processed",I=await t.sendTransaction(B,[e,r],{preflightCommitment:P}),{context:E,value:O}=await t.confirmTransaction({signature:I,lastValidBlockHeight:B.lastValidBlockHeight,blockhash:B.recentBlockhash},P);if(O.err)throw new Error(`Transaction ${I} failed (${JSON.stringify(O)})`);for(;;){try{if(await t.getSlot({commitment:P})>E.slot)break}catch{}await new Promise(K=>setTimeout(K,Math.round(_f/2)))}}return!0}};Gn.chunkSize=cd;O1=new ot("BPFLoader2111111111111111111111111111111111");ld=hd(),of=fd(ld),Ai=32;Sa=class{constructor(t,e,r,i,s){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=s}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t{let c=Rc(s,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return"socket"in c?this.underlyingSocket=c.socket:this.underlyingSocket=c,c};super(i,t,e,r),this.underlyingSocket=void 0}call(...t){let e=this.underlyingSocket?.readyState;return e===1?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){let e=this.underlyingSocket?.readyState;return e===1?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}};sf=56,Ho=class{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){let t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){let e=yd(gd,t),r=t.length-sf;ne(r>=0,"lookup table is invalid"),ne(r%32===0,"lookup table is invalid");let i=r/32,{addresses:s}=S.struct([S.seq($t(),i,"addresses")]).decode(t.slice(sf));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:e.authority.length!==0?new ot(e.authority[0]):void 0,addresses:s.map(c=>new ot(c))}}},gd={index:1,layout:S.struct([S.u32("typeIndex"),Vn("deactivationSlot"),S.nu64("lastExtendedSlot"),S.u8("lastExtendedStartIndex"),S.u8(),S.seq($t(),S.offset(S.u8(),-1),"authority")])},md=/^[^:]+:\\/\\/([^:[]+|\\[[^\\]]+\\])(:\\d+)?(.*)/i;ae=Fn(Mo(ot),H(),n=>new ot(n)),Af=Lo([H(),se("base64")]),La=Fn(Mo(at.Buffer),Af,n=>at.Buffer.from(n[0],"base64")),bd=30*1e3;xd=Mf(wn());kd=q({foundation:A(),foundationTerm:A(),initial:A(),taper:A(),terminal:A()}),Sd=Ht(Z(j(q({epoch:A(),effectiveSlot:A(),amount:A(),postBalance:A(),commission:it(j(A()))})))),Bd=Z(q({slot:A(),prioritizationFee:A()})),Ed=q({total:A(),validator:A(),foundation:A(),epoch:A()}),_d=q({epoch:A(),slotIndex:A(),slotsInEpoch:A(),absoluteSlot:A(),blockHeight:it(A()),transactionCount:it(A())}),Id=q({slotsPerEpoch:A(),leaderScheduleSlotOffset:A(),warmup:We(),firstNormalEpoch:A(),firstNormalSlot:A()}),Ad=Js(H(),Z(A())),Sn=j(be([q({}),H()])),Md=q({err:Sn}),Ld=se("receivedSignature"),Rd=q({"solana-core":H(),"feature-set":it(A())}),Td=q({program:H(),programId:ae,parsed:wn()}),Pd=q({programId:ae,accounts:Z(ae),data:H()}),uf=ce(q({err:j(be([q({}),H()])),logs:j(Z(H())),accounts:it(j(Z(j(q({executable:We(),owner:H(),lamports:A(),data:Z(H()),rentEpoch:it(A())}))))),unitsConsumed:it(A()),returnData:it(j(q({programId:H(),data:Lo([H(),se("base64")])}))),innerInstructions:it(j(Z(q({index:A(),instructions:Z(be([Td,Pd]))}))))})),Cd=ce(q({byIdentity:Js(H(),Z(A())),range:q({firstSlot:A(),lastSlot:A()})}));zd=Ht(kd),qd=Ht(Ed),Fd=Ht(Bd),Kd=Ht(_d),Dd=Ht(Id),Wd=Ht(Ad),Hd=Ht(A()),$d=ce(q({total:A(),circulating:A(),nonCirculating:A(),nonCirculatingAccounts:Z(ae)})),Ea=q({amount:H(),uiAmount:j(A()),decimals:A(),uiAmountString:it(H())}),Vd=ce(Z(q({address:ae,amount:H(),uiAmount:j(A()),decimals:A(),uiAmountString:it(H())}))),Gd=ce(Z(q({pubkey:ae,account:q({executable:We(),owner:ae,lamports:A(),data:La,rentEpoch:A()})}))),_a=q({program:H(),parsed:wn(),space:A()}),Zd=ce(Z(q({pubkey:ae,account:q({executable:We(),owner:ae,lamports:A(),data:_a,rentEpoch:A()})}))),jd=ce(Z(q({lamports:A(),address:ae}))),Ci=q({executable:We(),owner:ae,lamports:A(),data:La,rentEpoch:A()}),Yd=q({pubkey:ae,account:Ci}),Jd=Fn(be([Mo(at.Buffer),_a]),be([Af,_a]),n=>Array.isArray(n)?$(n,La):n),Ia=q({executable:We(),owner:ae,lamports:A(),data:Jd,rentEpoch:A()}),Xd=q({pubkey:ae,account:Ia}),Qd=q({state:be([se("active"),se("inactive"),se("activating"),se("deactivating")]),active:A(),inactive:A()}),tp=Ht(Z(q({signature:H(),slot:A(),err:Sn,memo:j(H()),blockTime:it(j(A()))}))),ep=Ht(Z(q({signature:H(),slot:A(),err:Sn,memo:j(H()),blockTime:it(j(A()))}))),rp=q({subscription:A(),result:Zo(Ci)}),np=q({pubkey:ae,account:Ci}),ip=q({subscription:A(),result:Zo(np)}),op=q({parent:A(),slot:A(),root:A()}),sp=q({subscription:A(),result:op}),ap=be([q({type:be([se("firstShredReceived"),se("completed"),se("optimisticConfirmation"),se("root")]),slot:A(),timestamp:A()}),q({type:se("createdBank"),parent:A(),slot:A(),timestamp:A()}),q({type:se("frozen"),slot:A(),timestamp:A(),stats:q({numTransactionEntries:A(),numSuccessfulTransactions:A(),numFailedTransactions:A(),maxTransactionsPerEntry:A()})}),q({type:se("dead"),slot:A(),timestamp:A(),err:H()})]),up=q({subscription:A(),result:ap}),cp=q({subscription:A(),result:Zo(be([Md,Ld]))}),fp=q({subscription:A(),result:A()}),hp=q({pubkey:H(),gossip:j(H()),tpu:j(H()),rpc:j(H()),version:j(H())}),cf=q({votePubkey:H(),nodePubkey:H(),activatedStake:A(),epochVoteAccount:We(),epochCredits:Z(Lo([A(),A(),A()])),commission:A(),lastVote:A(),rootSlot:j(A())}),lp=Ht(q({current:Z(cf),delinquent:Z(cf)})),dp=be([se("processed"),se("confirmed"),se("finalized")]),pp=q({slot:A(),confirmations:j(A()),err:Sn,confirmationStatus:it(dp)}),yp=ce(Z(j(pp))),gp=Ht(A()),Lf=q({accountKey:ae,writableIndexes:Z(A()),readonlyIndexes:Z(A())}),Ra=q({signatures:Z(H()),message:q({accountKeys:Z(H()),header:q({numRequiredSignatures:A(),numReadonlySignedAccounts:A(),numReadonlyUnsignedAccounts:A()}),instructions:Z(q({accounts:Z(A()),data:H(),programIdIndex:A()})),recentBlockhash:H(),addressTableLookups:it(Z(Lf))})}),Rf=q({pubkey:ae,signer:We(),writable:We(),source:it(be([se("transaction"),se("lookupTable")]))}),Tf=q({accountKeys:Z(Rf),signatures:Z(H())}),Pf=q({parsed:wn(),program:H(),programId:ae}),Cf=q({accounts:Z(ae),data:H(),programId:ae}),mp=be([Cf,Pf]),wp=be([q({parsed:wn(),program:H(),programId:H()}),q({accounts:Z(H()),data:H(),programId:H()})]),Of=Fn(mp,wp,n=>"accounts"in n?$(n,Cf):$(n,Pf)),Uf=q({signatures:Z(H()),message:q({accountKeys:Z(Rf),instructions:Z(Of),recentBlockhash:H(),addressTableLookups:it(j(Z(Lf)))})}),$o=q({accountIndex:A(),mint:H(),owner:it(H()),uiTokenAmount:Ea}),Nf=q({writable:Z(ae),readonly:Z(ae)}),jo=q({err:Sn,fee:A(),innerInstructions:it(j(Z(q({index:A(),instructions:Z(q({accounts:Z(A()),data:H(),programIdIndex:A()}))})))),preBalances:Z(A()),postBalances:Z(A()),logMessages:it(j(Z(H()))),preTokenBalances:it(j(Z($o))),postTokenBalances:it(j(Z($o))),loadedAddresses:it(Nf),computeUnitsConsumed:it(A())}),Ta=q({err:Sn,fee:A(),innerInstructions:it(j(Z(q({index:A(),instructions:Z(Of)})))),preBalances:Z(A()),postBalances:Z(A()),logMessages:it(j(Z(H()))),preTokenBalances:it(j(Z($o))),postTokenBalances:it(j(Z($o))),loadedAddresses:it(Nf),computeUnitsConsumed:it(A())}),Yn=be([se(0),se("legacy")]),Bn=q({pubkey:H(),lamports:A(),postBalance:j(A()),rewardType:j(H()),commission:it(j(A()))}),bp=Ht(j(q({blockhash:H(),previousBlockhash:H(),parentSlot:A(),transactions:Z(q({transaction:Ra,meta:j(jo),version:it(Yn)})),rewards:it(Z(Bn)),blockTime:j(A()),blockHeight:j(A())}))),vp=Ht(j(q({blockhash:H(),previousBlockhash:H(),parentSlot:A(),rewards:it(Z(Bn)),blockTime:j(A()),blockHeight:j(A())}))),xp=Ht(j(q({blockhash:H(),previousBlockhash:H(),parentSlot:A(),transactions:Z(q({transaction:Tf,meta:j(jo),version:it(Yn)})),rewards:it(Z(Bn)),blockTime:j(A()),blockHeight:j(A())}))),kp=Ht(j(q({blockhash:H(),previousBlockhash:H(),parentSlot:A(),transactions:Z(q({transaction:Uf,meta:j(Ta),version:it(Yn)})),rewards:it(Z(Bn)),blockTime:j(A()),blockHeight:j(A())}))),Sp=Ht(j(q({blockhash:H(),previousBlockhash:H(),parentSlot:A(),transactions:Z(q({transaction:Tf,meta:j(Ta),version:it(Yn)})),rewards:it(Z(Bn)),blockTime:j(A()),blockHeight:j(A())}))),Bp=Ht(j(q({blockhash:H(),previousBlockhash:H(),parentSlot:A(),rewards:it(Z(Bn)),blockTime:j(A()),blockHeight:j(A())}))),Ep=Ht(j(q({blockhash:H(),previousBlockhash:H(),parentSlot:A(),transactions:Z(q({transaction:Ra,meta:j(jo)})),rewards:it(Z(Bn)),blockTime:j(A())}))),ff=Ht(j(q({blockhash:H(),previousBlockhash:H(),parentSlot:A(),signatures:Z(H()),blockTime:j(A())}))),ma=Ht(j(q({slot:A(),meta:j(jo),blockTime:it(j(A())),transaction:Ra,version:it(Yn)}))),qo=Ht(j(q({slot:A(),transaction:Uf,meta:j(Ta),blockTime:it(j(A())),version:it(Yn)}))),_p=ce(q({blockhash:H(),feeCalculator:q({lamportsPerSignature:A()})})),Ip=ce(q({blockhash:H(),lastValidBlockHeight:A()})),Ap=ce(We()),Mp=q({slot:A(),numTransactions:A(),numSlots:A(),samplePeriodSecs:A()}),Lp=Ht(Z(Mp)),Rp=ce(j(q({feeCalculator:q({lamportsPerSignature:A()})}))),Tp=Ht(H()),Pp=Ht(H()),Cp=q({err:Sn,logs:Z(H()),signature:H()}),Op=q({result:Zo(Cp),subscription:A()}),Up={"solana-client":"js/1.0.0-maintenance"},Vo=class{constructor(t,e){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{let v={};return async x=>{let{commitment:k,config:_}=re(x),B=this._buildArgs([],k,void 0,_),P=of(B);return v[P]=v[P]??(async()=>{try{let I=await this._rpcRequest("getBlockHeight",B),E=$(I,Ht(A()));if("error"in E)throw new rt(E.error,"failed to get block height information");return E.result}finally{delete v[P]}})(),await v[P]}})();let r,i,s,c,p,y;e&&typeof e=="string"?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,r=e.wsEndpoint,i=e.httpHeaders,s=e.fetch,c=e.fetchMiddleware,p=e.disableRetryOnRateLimit,y=e.httpAgent),this._rpcEndpoint=vd(t),this._rpcWsEndpoint=r||wd(t),this._rpcClient=Od(t,i,s,c,p,y),this._rpcRequest=Ud(this._rpcClient),this._rpcBatchRequest=Nd(this._rpcClient),this._rpcWebSocket=new Ba(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,e){let{commitment:r,config:i}=re(e),s=this._buildArgs([t.toBase58()],r,void 0,i),c=await this._rpcRequest("getBalance",s),p=$(c,ce(A()));if("error"in p)throw new rt(p.error,`failed to get balance for ${t.toBase58()}`);return p.result}async getBalance(t,e){return await this.getBalanceAndContext(t,e).then(r=>r.value).catch(r=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+r)})}async getBlockTime(t){let e=await this._rpcRequest("getBlockTime",[t]),r=$(e,Ht(j(A())));if("error"in r)throw new rt(r.error,`failed to get block time for slot ${t}`);return r.result}async getMinimumLedgerSlot(){let t=await this._rpcRequest("minimumLedgerSlot",[]),e=$(t,Ht(A()));if("error"in e)throw new rt(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){let t=await this._rpcRequest("getFirstAvailableBlock",[]),e=$(t,Hd);if("error"in e)throw new rt(e.error,"failed to get first available block");return e.result}async getSupply(t){let e={};typeof t=="string"?e={commitment:t}:t?e={...t,commitment:t&&t.commitment||this.commitment}:e={commitment:this.commitment};let r=await this._rpcRequest("getSupply",[e]),i=$(r,$d);if("error"in i)throw new rt(i.error,"failed to get supply");return i.result}async getTokenSupply(t,e){let r=this._buildArgs([t.toBase58()],e),i=await this._rpcRequest("getTokenSupply",r),s=$(i,ce(Ea));if("error"in s)throw new rt(s.error,"failed to get token supply");return s.result}async getTokenAccountBalance(t,e){let r=this._buildArgs([t.toBase58()],e),i=await this._rpcRequest("getTokenAccountBalance",r),s=$(i,ce(Ea));if("error"in s)throw new rt(s.error,"failed to get token account balance");return s.result}async getTokenAccountsByOwner(t,e,r){let{commitment:i,config:s}=re(r),c=[t.toBase58()];"mint"in e?c.push({mint:e.mint.toBase58()}):c.push({programId:e.programId.toBase58()});let p=this._buildArgs(c,i,"base64",s),y=await this._rpcRequest("getTokenAccountsByOwner",p),v=$(y,Gd);if("error"in v)throw new rt(v.error,`failed to get token accounts owned by account ${t.toBase58()}`);return v.result}async getParsedTokenAccountsByOwner(t,e,r){let i=[t.toBase58()];"mint"in e?i.push({mint:e.mint.toBase58()}):i.push({programId:e.programId.toBase58()});let s=this._buildArgs(i,r,"jsonParsed"),c=await this._rpcRequest("getTokenAccountsByOwner",s),p=$(c,Zd);if("error"in p)throw new rt(p.error,`failed to get token accounts owned by account ${t.toBase58()}`);return p.result}async getLargestAccounts(t){let e={...t,commitment:t&&t.commitment||this.commitment},r=e.filter||e.commitment?[e]:[],i=await this._rpcRequest("getLargestAccounts",r),s=$(i,jd);if("error"in s)throw new rt(s.error,"failed to get largest accounts");return s.result}async getTokenLargestAccounts(t,e){let r=this._buildArgs([t.toBase58()],e),i=await this._rpcRequest("getTokenLargestAccounts",r),s=$(i,Vd);if("error"in s)throw new rt(s.error,"failed to get token largest accounts");return s.result}async getAccountInfoAndContext(t,e){let{commitment:r,config:i}=re(e),s=this._buildArgs([t.toBase58()],r,"base64",i),c=await this._rpcRequest("getAccountInfo",s),p=$(c,ce(j(Ci)));if("error"in p)throw new rt(p.error,`failed to get info about account ${t.toBase58()}`);return p.result}async getParsedAccountInfo(t,e){let{commitment:r,config:i}=re(e),s=this._buildArgs([t.toBase58()],r,"jsonParsed",i),c=await this._rpcRequest("getAccountInfo",s),p=$(c,ce(j(Ia)));if("error"in p)throw new rt(p.error,`failed to get info about account ${t.toBase58()}`);return p.result}async getAccountInfo(t,e){try{return(await this.getAccountInfoAndContext(t,e)).value}catch(r){throw new Error("failed to get info about account "+t.toBase58()+": "+r)}}async getMultipleParsedAccounts(t,e){let{commitment:r,config:i}=re(e),s=t.map(v=>v.toBase58()),c=this._buildArgs([s],r,"jsonParsed",i),p=await this._rpcRequest("getMultipleAccounts",c),y=$(p,ce(Z(j(Ia))));if("error"in y)throw new rt(y.error,`failed to get info for accounts ${s}`);return y.result}async getMultipleAccountsInfoAndContext(t,e){let{commitment:r,config:i}=re(e),s=t.map(v=>v.toBase58()),c=this._buildArgs([s],r,"base64",i),p=await this._rpcRequest("getMultipleAccounts",c),y=$(p,ce(Z(j(Ci))));if("error"in y)throw new rt(y.error,`failed to get info for accounts ${s}`);return y.result}async getMultipleAccountsInfo(t,e){return(await this.getMultipleAccountsInfoAndContext(t,e)).value}async getStakeActivation(t,e,r){let{commitment:i,config:s}=re(e),c=this._buildArgs([t.toBase58()],i,void 0,{...s,epoch:r??s?.epoch}),p=await this._rpcRequest("getStakeActivation",c),y=$(p,Ht(Qd));if("error"in y)throw new rt(y.error,`failed to get Stake Activation ${t.toBase58()}`);return y.result}async getProgramAccounts(t,e){let{commitment:r,config:i}=re(e),{encoding:s,...c}=i||{},p=this._buildArgs([t.toBase58()],r,s||"base64",{...c,...c.filters?{filters:af(c.filters)}:null}),y=await this._rpcRequest("getProgramAccounts",p),v=Z(Yd),x=c.withContext===!0?$(y,ce(v)):$(y,Ht(v));if("error"in x)throw new rt(x.error,`failed to get accounts owned by program ${t.toBase58()}`);return x.result}async getParsedProgramAccounts(t,e){let{commitment:r,config:i}=re(e),s=this._buildArgs([t.toBase58()],r,"jsonParsed",i),c=await this._rpcRequest("getProgramAccounts",s),p=$(c,Ht(Z(Xd)));if("error"in p)throw new rt(p.error,`failed to get accounts owned by program ${t.toBase58()}`);return p.result}async confirmTransaction(t,e){let r;if(typeof t=="string")r=t;else{let s=t;if(s.abortSignal?.aborted)return Promise.reject(s.abortSignal.reason);r=s.signature}let i;try{i=pe.default.decode(r)}catch{throw new Error("signature must be base58 encoded: "+r)}return ne(i.length===64,"signature has invalid length"),typeof t=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:r}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise((e,r)=>{t!=null&&(t.aborted?r(t.reason):t.addEventListener("abort",()=>{r(t.reason)}))})}getTransactionConfirmationPromise({commitment:t,signature:e}){let r,i,s=!1,c=new Promise((y,v)=>{try{r=this.onSignature(e,(k,_)=>{r=void 0;let B={context:_,value:k};y({__type:Rr.PROCESSED,response:B})},t);let x=new Promise(k=>{r==null?k():i=this._onSubscriptionStateChange(r,_=>{_==="subscribed"&&k()})});(async()=>{if(await x,s)return;let k=await this.getSignatureStatus(e);if(s||k==null)return;let{context:_,value:B}=k;if(B!=null)if(B?.err)v(B.err);else{switch(t){case"confirmed":case"single":case"singleGossip":{if(B.confirmationStatus==="processed")return;break}case"finalized":case"max":case"root":{if(B.confirmationStatus==="processed"||B.confirmationStatus==="confirmed")return;break}case"processed":case"recent":}s=!0,y({__type:Rr.PROCESSED,response:{context:_,value:B}})}})()}catch(x){v(x)}});return{abortConfirmation:()=>{i&&(i(),i=void 0),r!=null&&(this.removeSignatureListener(r),r=void 0)},confirmationPromise:c}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:e,lastValidBlockHeight:r,signature:i}}){let s=!1,c=new Promise(k=>{let _=async()=>{try{return await this.getBlockHeight(t)}catch{return-1}};(async()=>{let B=await _();if(!s){for(;B<=r;)if(await bn(1e3),s||(B=await _(),s))return;k({__type:Rr.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:p,confirmationPromise:y}=this.getTransactionConfirmationPromise({commitment:t,signature:i}),v=this.getCancellationPromise(e),x;try{let k=await Promise.race([v,y,c]);if(k.__type===Rr.PROCESSED)x=k.response;else throw new Do(i)}finally{s=!0,p()}return x}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:e,minContextSlot:r,nonceAccountPubkey:i,nonceValue:s,signature:c}}){let p=!1,y=new Promise(B=>{let P=s,I=null,E=async()=>{try{let{context:O,value:K}=await this.getNonceAndContext(i,{commitment:t,minContextSlot:r});return I=O.slot,K?.nonce}catch{return P}};(async()=>{if(P=await E(),!p)for(;;){if(s!==P){B({__type:Rr.NONCE_INVALID,slotInWhichNonceDidAdvance:I});return}if(await bn(2e3),p||(P=await E(),p))return}})()}),{abortConfirmation:v,confirmationPromise:x}=this.getTransactionConfirmationPromise({commitment:t,signature:c}),k=this.getCancellationPromise(e),_;try{let B=await Promise.race([k,x,y]);if(B.__type===Rr.PROCESSED)_=B.response;else{let P;for(;;){let I=await this.getSignatureStatus(c);if(I==null)break;if(I.context.slot<(B.slotInWhichNonceDidAdvance??r)){await bn(400);continue}P=I;break}if(P?.value){let I=t||"finalized",{confirmationStatus:E}=P.value;switch(I){case"processed":case"recent":if(E!=="processed"&&E!=="confirmed"&&E!=="finalized")throw new vn(c);break;case"confirmed":case"single":case"singleGossip":if(E!=="confirmed"&&E!=="finalized")throw new vn(c);break;case"finalized":case"max":case"root":if(E!=="finalized")throw new vn(c);break;default:(O=>{})(I)}_={context:P.context,value:{err:P.value.err}}}else throw new vn(c)}}finally{p=!0,v()}return _}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:e}){let r,i=new Promise(y=>{let v=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{v=this._confirmTransactionInitialTimeout||3e4;break}}r=setTimeout(()=>y({__type:Rr.TIMED_OUT,timeoutMs:v}),v)}),{abortConfirmation:s,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:e}),p;try{let y=await Promise.race([c,i]);if(y.__type===Rr.PROCESSED)p=y.response;else throw new Wo(e,y.timeoutMs/1e3)}finally{clearTimeout(r),s()}return p}async getClusterNodes(){let t=await this._rpcRequest("getClusterNodes",[]),e=$(t,Ht(Z(hp)));if("error"in e)throw new rt(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(t){let e=this._buildArgs([],t),r=await this._rpcRequest("getVoteAccounts",e),i=$(r,lp);if("error"in i)throw new rt(i.error,"failed to get vote accounts");return i.result}async getSlot(t){let{commitment:e,config:r}=re(t),i=this._buildArgs([],e,void 0,r),s=await this._rpcRequest("getSlot",i),c=$(s,Ht(A()));if("error"in c)throw new rt(c.error,"failed to get slot");return c.result}async getSlotLeader(t){let{commitment:e,config:r}=re(t),i=this._buildArgs([],e,void 0,r),s=await this._rpcRequest("getSlotLeader",i),c=$(s,Ht(H()));if("error"in c)throw new rt(c.error,"failed to get slot leader");return c.result}async getSlotLeaders(t,e){let r=[t,e],i=await this._rpcRequest("getSlotLeaders",r),s=$(i,Ht(Z(ae)));if("error"in s)throw new rt(s.error,"failed to get slot leaders");return s.result}async getSignatureStatus(t,e){let{context:r,value:i}=await this.getSignatureStatuses([t],e);ne(i.length===1);let s=i[0];return{context:r,value:s}}async getSignatureStatuses(t,e){let r=[t];e&&r.push(e);let i=await this._rpcRequest("getSignatureStatuses",r),s=$(i,yp);if("error"in s)throw new rt(s.error,"failed to get signature status");return s.result}async getTransactionCount(t){let{commitment:e,config:r}=re(t),i=this._buildArgs([],e,void 0,r),s=await this._rpcRequest("getTransactionCount",i),c=$(s,Ht(A()));if("error"in c)throw new rt(c.error,"failed to get transaction count");return c.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){let e=this._buildArgs([],t),r=await this._rpcRequest("getInflationGovernor",e),i=$(r,zd);if("error"in i)throw new rt(i.error,"failed to get inflation");return i.result}async getInflationReward(t,e,r){let{commitment:i,config:s}=re(r),c=this._buildArgs([t.map(v=>v.toBase58())],i,void 0,{...s,epoch:e??s?.epoch}),p=await this._rpcRequest("getInflationReward",c),y=$(p,Sd);if("error"in y)throw new rt(y.error,"failed to get inflation reward");return y.result}async getInflationRate(){let t=await this._rpcRequest("getInflationRate",[]),e=$(t,qd);if("error"in e)throw new rt(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(t){let{commitment:e,config:r}=re(t),i=this._buildArgs([],e,void 0,r),s=await this._rpcRequest("getEpochInfo",i),c=$(s,Kd);if("error"in c)throw new rt(c.error,"failed to get epoch info");return c.result}async getEpochSchedule(){let t=await this._rpcRequest("getEpochSchedule",[]),e=$(t,Dd);if("error"in e)throw new rt(e.error,"failed to get epoch schedule");let r=e.result;return new Sa(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot)}async getLeaderSchedule(){let t=await this._rpcRequest("getLeaderSchedule",[]),e=$(t,Wd);if("error"in e)throw new rt(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(t,e){let r=this._buildArgs([t],e),i=await this._rpcRequest("getMinimumBalanceForRentExemption",r),s=$(i,gp);return"error"in s?(console.warn("Unable to fetch minimum balance for rent exemption"),0):s.result}async getRecentBlockhashAndContext(t){let e=this._buildArgs([],t),r=await this._rpcRequest("getRecentBlockhash",e),i=$(r,_p);if("error"in i)throw new rt(i.error,"failed to get recent blockhash");return i.result}async getRecentPerformanceSamples(t){let e=await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),r=$(e,Lp);if("error"in r)throw new rt(r.error,"failed to get recent performance samples");return r.result}async getFeeCalculatorForBlockhash(t,e){let r=this._buildArgs([t],e),i=await this._rpcRequest("getFeeCalculatorForBlockhash",r),s=$(i,Rp);if("error"in s)throw new rt(s.error,"failed to get fee calculator");let{context:c,value:p}=s.result;return{context:c,value:p!==null?p.feeCalculator:null}}async getFeeForMessage(t,e){let r=Vt(t.serialize()).toString("base64"),i=this._buildArgs([r],e),s=await this._rpcRequest("getFeeForMessage",i),c=$(s,ce(j(A())));if("error"in c)throw new rt(c.error,"failed to get fee for message");if(c.result===null)throw new Error("invalid blockhash");return c.result}async getRecentPrioritizationFees(t){let e=t?.lockedWritableAccounts?.map(c=>c.toBase58()),r=e?.length?[e]:[],i=await this._rpcRequest("getRecentPrioritizationFees",r),s=$(i,Fd);if("error"in s)throw new rt(s.error,"failed to get recent prioritization fees");return s.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(e){throw new Error("failed to get recent blockhash: "+e)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(e){throw new Error("failed to get recent blockhash: "+e)}}async getLatestBlockhashAndContext(t){let{commitment:e,config:r}=re(t),i=this._buildArgs([],e,void 0,r),s=await this._rpcRequest("getLatestBlockhash",i),c=$(s,Ip);if("error"in c)throw new rt(c.error,"failed to get latest blockhash");return c.result}async isBlockhashValid(t,e){let{commitment:r,config:i}=re(e),s=this._buildArgs([t],r,void 0,i),c=await this._rpcRequest("isBlockhashValid",s),p=$(c,Ap);if("error"in p)throw new rt(p.error,"failed to determine if the blockhash `"+t+"`is valid");return p.result}async getVersion(){let t=await this._rpcRequest("getVersion",[]),e=$(t,Ht(Rd));if("error"in e)throw new rt(e.error,"failed to get version");return e.result}async getGenesisHash(){let t=await this._rpcRequest("getGenesisHash",[]),e=$(t,Ht(H()));if("error"in e)throw new rt(e.error,"failed to get genesis hash");return e.result}async getBlock(t,e){let{commitment:r,config:i}=re(e),s=this._buildArgsAtLeastConfirmed([t],r,void 0,i),c=await this._rpcRequest("getBlock",s);try{switch(i?.transactionDetails){case"accounts":{let p=$(c,xp);if("error"in p)throw p.error;return p.result}case"none":{let p=$(c,vp);if("error"in p)throw p.error;return p.result}default:{let p=$(c,bp);if("error"in p)throw p.error;let{result:y}=p;return y?{...y,transactions:y.transactions.map(({transaction:v,meta:x,version:k})=>({meta:x,transaction:{...v,message:ga(k,v.message)},version:k}))}:null}}}catch(p){throw new rt(p,"failed to get confirmed block")}}async getParsedBlock(t,e){let{commitment:r,config:i}=re(e),s=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i),c=await this._rpcRequest("getBlock",s);try{switch(i?.transactionDetails){case"accounts":{let p=$(c,Sp);if("error"in p)throw p.error;return p.result}case"none":{let p=$(c,Bp);if("error"in p)throw p.error;return p.result}default:{let p=$(c,kp);if("error"in p)throw p.error;return p.result}}}catch(p){throw new rt(p,"failed to get block")}}async getBlockProduction(t){let e,r;if(typeof t=="string")r=t;else if(t){let{commitment:p,...y}=t;r=p,e=y}let i=this._buildArgs([],r,"base64",e),s=await this._rpcRequest("getBlockProduction",i),c=$(s,Cd);if("error"in c)throw new rt(c.error,"failed to get block production information");return c.result}async getTransaction(t,e){let{commitment:r,config:i}=re(e),s=this._buildArgsAtLeastConfirmed([t],r,void 0,i),c=await this._rpcRequest("getTransaction",s),p=$(c,ma);if("error"in p)throw new rt(p.error,"failed to get transaction");let y=p.result;return y&&{...y,transaction:{...y.transaction,message:ga(y.version,y.transaction.message)}}}async getParsedTransaction(t,e){let{commitment:r,config:i}=re(e),s=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed",i),c=await this._rpcRequest("getTransaction",s),p=$(c,qo);if("error"in p)throw new rt(p.error,"failed to get transaction");return p.result}async getParsedTransactions(t,e){let{commitment:r,config:i}=re(e),s=t.map(y=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([y],r,"jsonParsed",i)}));return(await this._rpcBatchRequest(s)).map(y=>{let v=$(y,qo);if("error"in v)throw new rt(v.error,"failed to get transactions");return v.result})}async getTransactions(t,e){let{commitment:r,config:i}=re(e),s=t.map(y=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([y],r,void 0,i)}));return(await this._rpcBatchRequest(s)).map(y=>{let v=$(y,ma);if("error"in v)throw new rt(v.error,"failed to get transactions");let x=v.result;return x&&{...x,transaction:{...x.transaction,message:ga(x.version,x.transaction.message)}}})}async getConfirmedBlock(t,e){let r=this._buildArgsAtLeastConfirmed([t],e),i=await this._rpcRequest("getConfirmedBlock",r),s=$(i,Ep);if("error"in s)throw new rt(s.error,"failed to get confirmed block");let c=s.result;if(!c)throw new Error("Confirmed block "+t+" not found");let p={...c,transactions:c.transactions.map(({transaction:y,meta:v})=>{let x=new Ye(y.message);return{meta:v,transaction:{...y,message:x}}})};return{...p,transactions:p.transactions.map(({transaction:y,meta:v})=>({meta:v,transaction:Zt.populate(y.message,y.signatures)}))}}async getBlocks(t,e,r){let i=this._buildArgsAtLeastConfirmed(e!==void 0?[t,e]:[t],r),s=await this._rpcRequest("getBlocks",i),c=$(s,Ht(Z(A())));if("error"in c)throw new rt(c.error,"failed to get blocks");return c.result}async getBlockSignatures(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),i=await this._rpcRequest("getBlock",r),s=$(i,ff);if("error"in s)throw new rt(s.error,"failed to get block");let c=s.result;if(!c)throw new Error("Block "+t+" not found");return c}async getConfirmedBlockSignatures(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,void 0,{transactionDetails:"signatures",rewards:!1}),i=await this._rpcRequest("getConfirmedBlock",r),s=$(i,ff);if("error"in s)throw new rt(s.error,"failed to get confirmed block");let c=s.result;if(!c)throw new Error("Confirmed block "+t+" not found");return c}async getConfirmedTransaction(t,e){let r=this._buildArgsAtLeastConfirmed([t],e),i=await this._rpcRequest("getConfirmedTransaction",r),s=$(i,ma);if("error"in s)throw new rt(s.error,"failed to get transaction");let c=s.result;if(!c)return c;let p=new Ye(c.transaction.message),y=c.transaction.signatures;return{...c,transaction:Zt.populate(p,y)}}async getParsedConfirmedTransaction(t,e){let r=this._buildArgsAtLeastConfirmed([t],e,"jsonParsed"),i=await this._rpcRequest("getConfirmedTransaction",r),s=$(i,qo);if("error"in s)throw new rt(s.error,"failed to get confirmed transaction");return s.result}async getParsedConfirmedTransactions(t,e){let r=t.map(c=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([c],e,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(c=>{let p=$(c,qo);if("error"in p)throw new rt(p.error,"failed to get confirmed transactions");return p.result})}async getConfirmedSignaturesForAddress(t,e,r){let i={},s=await this.getFirstAvailableBlock();for(;!("until"in i)&&(e--,!(e<=0||e0&&(i.until=y.signatures[y.signatures.length-1].toString())}catch(y){if(y instanceof Error&&y.message.includes("skipped"))continue;throw y}let c=await this.getSlot("finalized");for(;!("before"in i)&&(r++,!(r>c));)try{let y=await this.getConfirmedBlockSignatures(r);y.signatures.length>0&&(i.before=y.signatures[y.signatures.length-1].toString())}catch(y){if(y instanceof Error&&y.message.includes("skipped"))continue;throw y}return(await this.getConfirmedSignaturesForAddress2(t,i)).map(y=>y.signature)}async getConfirmedSignaturesForAddress2(t,e,r){let i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,e),s=await this._rpcRequest("getConfirmedSignaturesForAddress2",i),c=$(s,tp);if("error"in c)throw new rt(c.error,"failed to get confirmed signatures for address");return c.result}async getSignaturesForAddress(t,e,r){let i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,e),s=await this._rpcRequest("getSignaturesForAddress",i),c=$(s,ep);if("error"in c)throw new rt(c.error,"failed to get signatures for address");return c.result}async getAddressLookupTable(t,e){let{context:r,value:i}=await this.getAccountInfoAndContext(t,e),s=null;return i!==null&&(s=new Ho({key:t,state:Ho.deserialize(i.data)})),{context:r,value:s}}async getNonceAndContext(t,e){let{context:r,value:i}=await this.getAccountInfoAndContext(t,e),s=null;return i!==null&&(s=Pi.fromAccountData(i.data)),{context:r,value:s}}async getNonce(t,e){return await this.getNonceAndContext(t,e).then(r=>r.value).catch(r=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+r)})}async requestAirdrop(t,e){let r=await this._rpcRequest("requestAirdrop",[t.toBase58(),e]),i=$(r,Tp);if("error"in i)throw new rt(i.error,`airdrop to ${t.toBase58()} failed`);return i.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await bn(100);let r=Date.now()-this._blockhashInfo.lastFetch>=bd;if(this._blockhashInfo.latestBlockhash!==null&&!r)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{let t=Date.now(),e=this._blockhashInfo.latestBlockhash,r=e?e.blockhash:null;for(let i=0;i<50;i++){let s=await this.getLatestBlockhash("finalized");if(r!==s.blockhash)return this._blockhashInfo={latestBlockhash:s,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},s;await bn(_f/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){let{commitment:e,config:r}=re(t),i=this._buildArgs([],e,"base64",r),s=await this._rpcRequest("getStakeMinimumDelegation",i),c=$(s,ce(A()));if("error"in c)throw new rt(c.error,"failed to get stake minimum delegation");return c.result}async simulateTransaction(t,e,r){if("message"in t){let I=t.serialize(),E=at.Buffer.from(I).toString("base64");if(Array.isArray(e)||r!==void 0)throw new Error("Invalid arguments");let O=e||{};O.encoding="base64","commitment"in O||(O.commitment=this.commitment),e&&typeof e=="object"&&"innerInstructions"in e&&(O.innerInstructions=e.innerInstructions);let K=[E,O],z=await this._rpcRequest("simulateTransaction",K),D=$(z,uf);if("error"in D)throw new Error("failed to simulate transaction: "+D.error.message);return D.result}let i;if(t instanceof Zt){let P=t;i=new Zt,i.feePayer=P.feePayer,i.instructions=t.instructions,i.nonceInfo=P.nonceInfo,i.signatures=P.signatures}else i=Zt.populate(t),i._message=i._json=void 0;if(e!==void 0&&!Array.isArray(e))throw new Error("Invalid arguments");let s=e;if(i.nonceInfo&&s)i.sign(...s);else{let P=this._disableBlockhashCaching;for(;;){let I=await this._blockhashWithExpiryBlockHeight(P);if(i.lastValidBlockHeight=I.lastValidBlockHeight,i.recentBlockhash=I.blockhash,!s)break;if(i.sign(...s),!i.signature)throw new Error("!signature");let E=i.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(E)&&!this._blockhashInfo.transactionSignatures.includes(E)){this._blockhashInfo.simulatedSignatures.push(E);break}else P=!0}}let c=i._compile(),p=c.serialize(),v=i._serialize(p).toString("base64"),x={encoding:"base64",commitment:this.commitment};if(r){let P=(Array.isArray(r)?r:c.nonProgramIds()).map(I=>I.toBase58());x.accounts={encoding:"base64",addresses:P}}s&&(x.sigVerify=!0),e&&typeof e=="object"&&"innerInstructions"in e&&(x.innerInstructions=e.innerInstructions);let k=[v,x],_=await this._rpcRequest("simulateTransaction",k),B=$(_,uf);if("error"in B){let P;if("data"in B.error&&(P=B.error.data.logs,P&&Array.isArray(P))){let I=`\n `,E=I+P.join(I);console.error(B.error.message,E)}throw new Ti({action:"simulate",signature:"",transactionMessage:B.error.message,logs:P})}return B.result}async sendTransaction(t,e,r){if("version"in t){if(e&&Array.isArray(e))throw new Error("Invalid arguments");let c=t.serialize();return await this.sendRawTransaction(c,e)}if(e===void 0||!Array.isArray(e))throw new Error("Invalid arguments");let i=e;if(t.nonceInfo)t.sign(...i);else{let c=this._disableBlockhashCaching;for(;;){let p=await this._blockhashWithExpiryBlockHeight(c);if(t.lastValidBlockHeight=p.lastValidBlockHeight,t.recentBlockhash=p.blockhash,t.sign(...i),!t.signature)throw new Error("!signature");let y=t.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(y))c=!0;else{this._blockhashInfo.transactionSignatures.push(y);break}}}let s=t.serialize();return await this.sendRawTransaction(s,r)}async sendRawTransaction(t,e){let r=Vt(t).toString("base64");return await this.sendEncodedTransaction(r,e)}async sendEncodedTransaction(t,e){let r={encoding:"base64"},i=e&&e.skipPreflight,s=i===!0?"processed":e&&e.preflightCommitment||this.commitment;e&&e.maxRetries!=null&&(r.maxRetries=e.maxRetries),e&&e.minContextSlot!=null&&(r.minContextSlot=e.minContextSlot),i&&(r.skipPreflight=i),s&&(r.preflightCommitment=s);let c=[t,r],p=await this._rpcRequest("sendTransaction",c),y=$(p,Pp);if("error"in y){let v;throw"data"in y.error&&(v=y.error.data.logs),new Ti({action:i?"send":"simulate",signature:"",transactionMessage:y.error.message,logs:v})}return y.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){if(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),t===1e3){this._updateSubscriptions();return}this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([e,r])=>{this._setSubscription(e,{...r,state:"pending"})})}_setSubscription(t,e){let r=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=e,r!==e.state){let i=this._subscriptionStateChangeCallbacksByHash[t];i&&i.forEach(s=>{try{s(e.state)}catch{}})}}_onSubscriptionStateChange(t,e){let r=this._subscriptionHashByClientSubscriptionId[t];if(r==null)return()=>{};let i=this._subscriptionStateChangeCallbacksByHash[r]||=new Set;return i.add(e),()=>{i.delete(e),i.size===0&&delete this._subscriptionStateChangeCallbacksByHash[r]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(r){r instanceof Error&&console.log(`Error when closing socket connection: ${r.message}`)}},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}let t=this._rpcWebSocketGeneration,e=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async r=>{let i=this._subscriptionsByHash[r];if(i!==void 0)switch(i.state){case"pending":case"unsubscribed":if(i.callbacks.size===0){delete this._subscriptionsByHash[r],i.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],await this._updateSubscriptions();return}await(async()=>{let{args:s,method:c}=i;try{this._setSubscription(r,{...i,state:"subscribing"});let p=await this._rpcWebSocket.call(c,s);this._setSubscription(r,{...i,serverSubscriptionId:p,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[p]=i.callbacks,await this._updateSubscriptions()}catch(p){if(console.error(`Received ${p instanceof Error?"":"JSON-RPC "}error calling \\`${c}\\``,{args:s,error:p}),!e())return;this._setSubscription(r,{...i,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":i.callbacks.size===0&&await(async()=>{let{serverSubscriptionId:s,unsubscribeMethod:c}=i;if(this._subscriptionsAutoDisposedByRpc.has(s))this._subscriptionsAutoDisposedByRpc.delete(s);else{this._setSubscription(r,{...i,state:"unsubscribing"}),this._setSubscription(r,{...i,state:"unsubscribing"});try{await this._rpcWebSocket.call(c,[s])}catch(p){if(p instanceof Error&&console.error(`${c} error:`,p.message),!e())return;this._setSubscription(r,{...i,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(r,{...i,state:"unsubscribed"}),await this._updateSubscriptions()})();break}}))}_handleServerNotification(t,e){let r=this._subscriptionCallbacksByServerSubscriptionId[t];r!==void 0&&r.forEach(i=>{try{i(...e)}catch(s){console.error(s)}})}_wsOnAccountNotification(t){let{result:e,subscription:r}=$(t,rp);this._handleServerNotification(r,[e.value,e.context])}_makeSubscription(t,e){let r=this._nextClientSubscriptionId++,i=of([t.method,e]),s=this._subscriptionsByHash[i];return s===void 0?this._subscriptionsByHash[i]={...t,args:e,callbacks:new Set([t.callback]),state:"pending"}:s.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete this._subscriptionHashByClientSubscriptionId[r];let c=this._subscriptionsByHash[i];ne(c!==void 0,`Could not find a \\`Subscription\\` when tearing down client subscription #${r}`),c.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),r}onAccountChange(t,e,r){let{commitment:i,config:s}=re(r),c=this._buildArgs([t.toBase58()],i||this._commitment||"finalized","base64",s);return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},c)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){let{result:e,subscription:r}=$(t,ip);this._handleServerNotification(r,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(t,e,r,i){let{commitment:s,config:c}=re(r),p=this._buildArgs([t.toBase58()],s||this._commitment||"finalized","base64",c||(i?{filters:af(i)}:void 0));return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},p)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,e,r){let i=this._buildArgs([typeof t=="object"?{mentions:[t.toString()]}:t],r||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},i)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){let{result:e,subscription:r}=$(t,Op);this._handleServerNotification(r,[e.value,e.context])}_wsOnSlotNotification(t){let{result:e,subscription:r}=$(t,sp);this._handleServerNotification(r,[e])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){let{result:e,subscription:r}=$(t,up);this._handleServerNotification(r,[e])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,e){let r=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];r?await r():console.warn(`Ignored unsubscribe request because an active subscription with id \\`${t}\\` for \'${e}\' events could not be found.`)}_buildArgs(t,e,r,i){let s=e||this._commitment;if(s||r||i){let c={};r&&(c.encoding=r),s&&(c.commitment=s),i&&(c=Object.assign(c,i)),t.push(c)}return t}_buildArgsAtLeastConfirmed(t,e,r,i){let s=e||this._commitment;if(s&&!["confirmed","finalized"].includes(s))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,r,i)}_wsOnSignatureNotification(t){let{result:e,subscription:r}=$(t,cp);e.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,e.value==="receivedSignature"?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(t,e,r){let i=this._buildArgs([t],r||this._commitment||"finalized"),s=this._makeSubscription({callback:(c,p)=>{if(c.type==="status"){e(c.result,p);try{this.removeSignatureListener(s)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return s}onSignatureWithOptions(t,e,r){let{commitment:i,...s}={...r,commitment:r&&r.commitment||this._commitment||"finalized"},c=this._buildArgs([t],i,void 0,s),p=this._makeSubscription({callback:(y,v)=>{e(y,v);try{this.removeSignatureListener(p)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},c);return p}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){let{result:e,subscription:r}=$(t,fp);this._handleServerNotification(r,[e])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}},fr=class{constructor(t){this._keypair=void 0,this._keypair=t??Xc()}static generate(){return new fr(Xc())}static fromSecretKey(t,e){if(t.byteLength!==64)throw new Error("bad secret key size");let r=t.slice(32,64);if(!e||!e.skipValidation){let i=t.slice(0,32),s=xa(i);for(let c=0;c<32;c++)if(r[c]!==s[c])throw new Error("provided secretKey is invalid")}return new fr({publicKey:r,secretKey:t})}static fromSeed(t){let e=xa(t),r=new Uint8Array(64);return r.set(t),r.set(e,32),new fr({publicKey:e,secretKey:r})}get publicKey(){return new ot(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}},Mi=Object.freeze({CreateLookupTable:{index:0,layout:S.struct([S.u32("instruction"),Vn("recentSlot"),S.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:S.struct([S.u32("instruction")])},ExtendLookupTable:{index:2,layout:S.struct([S.u32("instruction"),Vn(),S.seq($t(),S.offset(S.u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:S.struct([S.u32("instruction")])},CloseLookupTable:{index:4,layout:S.struct([S.u32("instruction")])}}),Aa=class{constructor(){}static createLookupTable(t){let[e,r]=ot.findProgramAddressSync([t.authority.toBuffer(),(0,Ni.toBufferLE)(BigInt(t.recentSlot),8)],this.programId),i=Mi.CreateLookupTable,s=Gt(i,{recentSlot:BigInt(t.recentSlot),bumpSeed:r}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:ye.programId,isSigner:!1,isWritable:!1}];return[new ee({programId:this.programId,keys:c,data:s}),e]}static freezeLookupTable(t){let e=Mi.FreezeLookupTable,r=Gt(e),i=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new ee({programId:this.programId,keys:i,data:r})}static extendLookupTable(t){let e=Mi.ExtendLookupTable,r=Gt(e,{addresses:t.addresses.map(s=>s.toBytes())}),i=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&i.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:ye.programId,isSigner:!1,isWritable:!1}),new ee({programId:this.programId,keys:i,data:r})}static deactivateLookupTable(t){let e=Mi.DeactivateLookupTable,r=Gt(e),i=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new ee({programId:this.programId,keys:i,data:r})}static closeLookupTable(t){let e=Mi.CloseLookupTable,r=Gt(e),i=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new ee({programId:this.programId,keys:i,data:r})}};Aa.programId=new ot("AddressLookupTab1e1111111111111111111111111");Fo=Object.freeze({RequestUnits:{index:0,layout:S.struct([S.u8("instruction"),S.u32("units"),S.u32("additionalFee")])},RequestHeapFrame:{index:1,layout:S.struct([S.u8("instruction"),S.u32("bytes")])},SetComputeUnitLimit:{index:2,layout:S.struct([S.u8("instruction"),S.u32("units")])},SetComputeUnitPrice:{index:3,layout:S.struct([S.u8("instruction"),Vn("microLamports")])}}),Ma=class{constructor(){}static requestUnits(t){let e=Fo.RequestUnits,r=Gt(e,t);return new ee({keys:[],programId:this.programId,data:r})}static requestHeapFrame(t){let e=Fo.RequestHeapFrame,r=Gt(e,t);return new ee({keys:[],programId:this.programId,data:r})}static setComputeUnitLimit(t){let e=Fo.SetComputeUnitLimit,r=Gt(e,t);return new ee({keys:[],programId:this.programId,data:r})}static setComputeUnitPrice(t){let e=Fo.SetComputeUnitPrice,r=Gt(e,{microLamports:BigInt(t.microLamports)});return new ee({keys:[],programId:this.programId,data:r})}};Ma.programId=new ot("ComputeBudget111111111111111111111111111111");hf=64,lf=32,df=64,pf=S.struct([S.u8("numSignatures"),S.u8("padding"),S.u16("signatureOffset"),S.u16("signatureInstructionIndex"),S.u16("publicKeyOffset"),S.u16("publicKeyInstructionIndex"),S.u16("messageDataOffset"),S.u16("messageDataSize"),S.u16("messageInstructionIndex")]),Oi=class{constructor(){}static createInstructionWithPublicKey(t){let{publicKey:e,message:r,signature:i,instructionIndex:s}=t;ne(e.length===lf,`Public Key must be ${lf} bytes but received ${e.length} bytes`),ne(i.length===df,`Signature must be ${df} bytes but received ${i.length} bytes`);let c=pf.span,p=c+e.length,y=p+i.length,v=1,x=at.Buffer.alloc(y+r.length),k=s??65535;return pf.encode({numSignatures:v,padding:0,signatureOffset:p,signatureInstructionIndex:k,publicKeyOffset:c,publicKeyInstructionIndex:k,messageDataOffset:y,messageDataSize:r.length,messageInstructionIndex:k},x),x.fill(e,c),x.fill(i,p),x.fill(r,y),new ee({keys:[],programId:Oi.programId,data:x})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:r,instructionIndex:i}=t;ne(e.length===hf,`Private key must be ${hf} bytes but received ${e.length} bytes`);try{let s=fr.fromSecretKey(e),c=s.publicKey.toBytes(),p=vf(r,s.secretKey);return this.createInstructionWithPublicKey({publicKey:c,message:r,signature:p,instructionIndex:i})}catch(s){throw new Error(`Error creating instruction; ${s}`)}}};Oi.programId=new ot("Ed25519SigVerify111111111111111111111111111");Np=(n,t)=>{let e=Ii.sign(n,t);return[e.toCompactRawBytes(),e.recovery]};Ii.utils.isValidPrivateKey;zp=Ii.getPublicKey,yf=32,wa=20,gf=64,qp=11,ba=S.struct([S.u8("numSignatures"),S.u16("signatureOffset"),S.u8("signatureInstructionIndex"),S.u16("ethAddressOffset"),S.u8("ethAddressInstructionIndex"),S.u16("messageDataOffset"),S.u16("messageDataSize"),S.u8("messageInstructionIndex"),S.blob(20,"ethAddress"),S.blob(64,"signature"),S.u8("recoveryId")]),kn=class{constructor(){}static publicKeyToEthAddress(t){ne(t.length===gf,`Public key must be ${gf} bytes but received ${t.length} bytes`);try{return at.Buffer.from(ua(Vt(t))).slice(-wa)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(t){let{publicKey:e,message:r,signature:i,recoveryId:s,instructionIndex:c}=t;return kn.createInstructionWithEthAddress({ethAddress:kn.publicKeyToEthAddress(e),message:r,signature:i,recoveryId:s,instructionIndex:c})}static createInstructionWithEthAddress(t){let{ethAddress:e,message:r,signature:i,recoveryId:s,instructionIndex:c=0}=t,p;typeof e=="string"?e.startsWith("0x")?p=at.Buffer.from(e.substr(2),"hex"):p=at.Buffer.from(e,"hex"):p=e,ne(p.length===wa,`Address must be ${wa} bytes but received ${p.length} bytes`);let y=1+qp,v=y,x=y+p.length,k=x+i.length+1,_=1,B=at.Buffer.alloc(ba.span+r.length);return ba.encode({numSignatures:_,signatureOffset:x,signatureInstructionIndex:c,ethAddressOffset:v,ethAddressInstructionIndex:c,messageDataOffset:k,messageDataSize:r.length,messageInstructionIndex:c,signature:Vt(i),ethAddress:Vt(p),recoveryId:s},B),B.fill(Vt(r),ba.span),new ee({keys:[],programId:kn.programId,data:B})}static createInstructionWithPrivateKey(t){let{privateKey:e,message:r,instructionIndex:i}=t;ne(e.length===yf,`Private key must be ${yf} bytes but received ${e.length} bytes`);try{let s=Vt(e),c=zp(s,!1).slice(1),p=at.Buffer.from(ua(Vt(r))),[y,v]=Np(p,s);return this.createInstructionWithPublicKey({publicKey:c,message:r,signature:y,recoveryId:v,instructionIndex:i})}catch(s){throw new Error(`Error creating instruction; ${s}`)}}};kn.programId=new ot("KeccakSecp256k11111111111111111111111111111");Fp=new ot("StakeConfig11111111111111111111111111111111"),Ui=class{constructor(t,e,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=r}};zf=Ui;Ui.default=new zf(0,0,ot.default);Tr=Object.freeze({Initialize:{index:0,layout:S.struct([S.u32("instruction"),X0(),Q0()])},Authorize:{index:1,layout:S.struct([S.u32("instruction"),$t("newAuthorized"),S.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:S.struct([S.u32("instruction")])},Split:{index:3,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},Withdraw:{index:4,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},Deactivate:{index:5,layout:S.struct([S.u32("instruction")])},Merge:{index:7,layout:S.struct([S.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:S.struct([S.u32("instruction"),$t("newAuthorized"),S.u32("stakeAuthorizationType"),Dn("authoritySeed"),$t("authorityOwner")])}}),U1=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),Go=class{constructor(){}static initialize(t){let{stakePubkey:e,authorized:r,lockup:i}=t,s=i||Ui.default,c=Tr.Initialize,p=Gt(c,{authorized:{staker:Vt(r.staker.toBuffer()),withdrawer:Vt(r.withdrawer.toBuffer())},lockup:{unixTimestamp:s.unixTimestamp,epoch:s.epoch,custodian:Vt(s.custodian.toBuffer())}}),y={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Ri,isSigner:!1,isWritable:!1}],programId:this.programId,data:p};return new ee(y)}static createAccountWithSeed(t){let e=new Zt;e.add(ye.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:i,lockup:s}=t;return e.add(this.initialize({stakePubkey:r,authorized:i,lockup:s}))}static createAccount(t){let e=new Zt;e.add(ye.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));let{stakePubkey:r,authorized:i,lockup:s}=t;return e.add(this.initialize({stakePubkey:r,authorized:i,lockup:s}))}static delegate(t){let{stakePubkey:e,authorizedPubkey:r,votePubkey:i}=t,s=Tr.Delegate,c=Gt(s);return new Zt().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:ur,isSigner:!1,isWritable:!1},{pubkey:da,isSigner:!1,isWritable:!1},{pubkey:Fp,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:c})}static authorize(t){let{stakePubkey:e,authorizedPubkey:r,newAuthorizedPubkey:i,stakeAuthorizationType:s,custodianPubkey:c}=t,p=Tr.Authorize,y=Gt(p,{newAuthorized:Vt(i.toBuffer()),stakeAuthorizationType:s.index}),v=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ur,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return c&&v.push({pubkey:c,isSigner:!0,isWritable:!1}),new Zt().add({keys:v,programId:this.programId,data:y})}static authorizeWithSeed(t){let{stakePubkey:e,authorityBase:r,authoritySeed:i,authorityOwner:s,newAuthorizedPubkey:c,stakeAuthorizationType:p,custodianPubkey:y}=t,v=Tr.AuthorizeWithSeed,x=Gt(v,{newAuthorized:Vt(c.toBuffer()),stakeAuthorizationType:p.index,authoritySeed:i,authorityOwner:Vt(s.toBuffer())}),k=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:ur,isSigner:!1,isWritable:!1}];return y&&k.push({pubkey:y,isSigner:!0,isWritable:!1}),new Zt().add({keys:k,programId:this.programId,data:x})}static splitInstruction(t){let{stakePubkey:e,authorizedPubkey:r,splitStakePubkey:i,lamports:s}=t,c=Tr.Split,p=Gt(c,{lamports:s});return new ee({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:p})}static split(t,e){let r=new Zt;return r.add(ye.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:e,space:this.space,programId:this.programId})),r.add(this.splitInstruction(t))}static splitWithSeed(t,e){let{stakePubkey:r,authorizedPubkey:i,splitStakePubkey:s,basePubkey:c,seed:p,lamports:y}=t,v=new Zt;return v.add(ye.allocate({accountPubkey:s,basePubkey:c,seed:p,space:this.space,programId:this.programId})),e&&e>0&&v.add(ye.transfer({fromPubkey:t.authorizedPubkey,toPubkey:s,lamports:e})),v.add(this.splitInstruction({stakePubkey:r,authorizedPubkey:i,splitStakePubkey:s,lamports:y}))}static merge(t){let{stakePubkey:e,sourceStakePubKey:r,authorizedPubkey:i}=t,s=Tr.Merge,c=Gt(s);return new Zt().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:ur,isSigner:!1,isWritable:!1},{pubkey:da,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:c})}static withdraw(t){let{stakePubkey:e,authorizedPubkey:r,toPubkey:i,lamports:s,custodianPubkey:c}=t,p=Tr.Withdraw,y=Gt(p,{lamports:s}),v=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:ur,isSigner:!1,isWritable:!1},{pubkey:da,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return c&&v.push({pubkey:c,isSigner:!0,isWritable:!1}),new Zt().add({keys:v,programId:this.programId,data:y})}static deactivate(t){let{stakePubkey:e,authorizedPubkey:r}=t,i=Tr.Deactivate,s=Gt(i);return new Zt().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ur,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}};Go.programId=new ot("Stake11111111111111111111111111111111111111");Go.space=200;Li=Object.freeze({InitializeAccount:{index:0,layout:S.struct([S.u32("instruction"),td()])},Authorize:{index:1,layout:S.struct([S.u32("instruction"),$t("newAuthorized"),S.u32("voteAuthorizationType")])},Withdraw:{index:3,layout:S.struct([S.u32("instruction"),S.ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:S.struct([S.u32("instruction")])},AuthorizeWithSeed:{index:10,layout:S.struct([S.u32("instruction"),ed()])}}),N1=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),Zn=class{constructor(){}static initializeAccount(t){let{votePubkey:e,nodePubkey:r,voteInit:i}=t,s=Li.InitializeAccount,c=Gt(s,{voteInit:{nodePubkey:Vt(i.nodePubkey.toBuffer()),authorizedVoter:Vt(i.authorizedVoter.toBuffer()),authorizedWithdrawer:Vt(i.authorizedWithdrawer.toBuffer()),commission:i.commission}}),p={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Ri,isSigner:!1,isWritable:!1},{pubkey:ur,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:c};return new ee(p)}static createAccount(t){let e=new Zt;return e.add(ye.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){let{votePubkey:e,authorizedPubkey:r,newAuthorizedPubkey:i,voteAuthorizationType:s}=t,c=Li.Authorize,p=Gt(c,{newAuthorized:Vt(i.toBuffer()),voteAuthorizationType:s.index}),y=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:ur,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return new Zt().add({keys:y,programId:this.programId,data:p})}static authorizeWithSeed(t){let{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:r,currentAuthorityDerivedKeySeed:i,newAuthorizedPubkey:s,voteAuthorizationType:c,votePubkey:p}=t,y=Li.AuthorizeWithSeed,v=Gt(y,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Vt(r.toBuffer()),currentAuthorityDerivedKeySeed:i,newAuthorized:Vt(s.toBuffer()),voteAuthorizationType:c.index}}),x=[{pubkey:p,isSigner:!1,isWritable:!0},{pubkey:ur,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return new Zt().add({keys:x,programId:this.programId,data:v})}static withdraw(t){let{votePubkey:e,authorizedWithdrawerPubkey:r,lamports:i,toPubkey:s}=t,c=Li.Withdraw,p=Gt(c,{lamports:i}),y=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return new Zt().add({keys:y,programId:this.programId,data:p})}static safeWithdraw(t,e,r){if(t.lamports>e-r)throw new Error("Withdraw will leave vote account with insufficient funds.");return Zn.withdraw(t)}static updateValidatorIdentity(t){let{votePubkey:e,authorizedWithdrawerPubkey:r,nodePubkey:i}=t,s=Li.UpdateValidatorIdentity,c=Gt(s),p=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return new Zt().add({keys:p,programId:this.programId,data:c})}};Zn.programId=new ot("Vote111111111111111111111111111111111111111");Zn.space=3762;z1=new ot("Va1idator1nfo111111111111111111111111111111"),q1=q({name:H(),website:it(H()),details:it(H()),iconUrl:it(H()),keybaseUsername:it(H())}),F1=new ot("Vote111111111111111111111111111111111111111"),K1=S.struct([$t("nodePubkey"),$t("authorizedWithdrawer"),S.u8("commission"),S.nu64(),S.seq(S.struct([S.nu64("slot"),S.u32("confirmationCount")]),S.offset(S.u32(),-8),"votes"),S.u8("rootSlotValid"),S.nu64("rootSlot"),S.nu64(),S.seq(S.struct([S.nu64("epoch"),$t("authorizedVoter")]),S.offset(S.u32(),-8),"authorizedVoters"),S.struct([S.seq(S.struct([$t("authorizedPubkey"),S.nu64("epochOfLastAuthorizedSwitch"),S.nu64("targetEpoch")]),32,"buf"),S.nu64("idx"),S.u8("isEmpty")],"priorVoters"),S.nu64(),S.seq(S.struct([S.nu64("epoch"),S.nu64("credits"),S.nu64("prevCredits")]),S.offset(S.u32(),-8),"epochCredits"),S.struct([S.nu64("slot"),S.nu64("timestamp")],"lastTimestamp")]),mf={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}}});function Kf(n){if(!["devnet","testnet","mainnet-beta"].includes(n.chain))throw new Error(`Invalid Solana network: ${n.chain}`);if(!n.serializedTransaction||n.serializedTransaction.length===0)throw new Error(`Invalid serializedTransaction: ${n.serializedTransaction}`)}function Kp({solanaKeyPair:n,transaction:t}){try{if(t.sign(n),!t.signature)throw new Error("Transaction signature is null");return{signature:ethers.utils.base58.encode(t.signature)}}catch(e){throw new Error(`When signing transaction - ${e.message}`)}}async function Dp({chain:n,transaction:t}){try{return await new Vo(qf(n),"confirmed").sendRawTransaction(t.serialize())}catch(e){throw new Error(`When sending transaction - ${e.message}`)}}async function Df({broadcast:n,privateKey:t,unsignedTransaction:e}){let r=fr.fromSecretKey(Buffer.from(t,"hex")),i=Zt.from(Buffer.from(e.serializedTransaction,"base64")),{signature:s}=Kp({transaction:i,solanaKeyPair:r});if(!n)return s;let c=e.chain;return await Dp({chain:c,transaction:i})}var G1,Wf=vt(()=>{"use strict";G1=C(N());Ff()});async function Hf({accessControlConditions:n,ciphertext:t,dataToEncryptHash:e,unsignedTransaction:r,broadcast:i}){Kf(r);let s=await uu({accessControlConditions:n,ciphertext:t,dataToEncryptHash:e});return Df({broadcast:i,privateKey:s,unsignedTransaction:r})}var J1,$f=vt(()=>{"use strict";J1=C(N());cu();Wf()});var Wp=fe(()=>{var rw=C(N());iu();$f();(async()=>nu(async()=>Hf({accessControlConditions,ciphertext,dataToEncryptHash,unsignedTransaction,broadcast})))()});Wp();})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *)\n\nbuffer/index.js:\n (*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n *)\n\n@noble/hashes/esm/utils.js:\n (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/utils.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/modular.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/curve.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/abstract/edwards.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/ed25519.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\nsafe-buffer/index.js:\n (*! safe-buffer. MIT License. Feross Aboukhadijeh *)\n\n@solana/buffer-layout/lib/Layout.js:\n (**\n * Support for translating between Uint8Array instances and JavaScript\n * native types.\n *\n * {@link module:Layout~Layout|Layout} is the basis of a class\n * hierarchy that associates property names with sequences of encoded\n * bytes.\n *\n * Layouts are supported for these scalar (numeric) types:\n * * {@link module:Layout~UInt|Unsigned integers in little-endian\n * format} with {@link module:Layout.u8|8-bit}, {@link\n * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},\n * {@link module:Layout.u32|32-bit}, {@link\n * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}\n * representation ranges;\n * * {@link module:Layout~UIntBE|Unsigned integers in big-endian\n * format} with {@link module:Layout.u16be|16-bit}, {@link\n * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},\n * {@link module:Layout.u40be|40-bit}, and {@link\n * module:Layout.u48be|48-bit} representation ranges;\n * * {@link module:Layout~Int|Signed integers in little-endian\n * format} with {@link module:Layout.s8|8-bit}, {@link\n * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},\n * {@link module:Layout.s32|32-bit}, {@link\n * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}\n * representation ranges;\n * * {@link module:Layout~IntBE|Signed integers in big-endian format}\n * with {@link module:Layout.s16be|16-bit}, {@link\n * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},\n * {@link module:Layout.s40be|40-bit}, and {@link\n * module:Layout.s48be|48-bit} representation ranges;\n * * 64-bit integral values that decode to an exact (if magnitude is\n * less than 2^53) or nearby integral Number in {@link\n * module:Layout.nu64|unsigned little-endian}, {@link\n * module:Layout.nu64be|unsigned big-endian}, {@link\n * module:Layout.ns64|signed little-endian}, and {@link\n * module:Layout.ns64be|unsigned big-endian} encodings;\n * * 32-bit floating point values with {@link\n * module:Layout.f32|little-endian} and {@link\n * module:Layout.f32be|big-endian} representations;\n * * 64-bit floating point values with {@link\n * module:Layout.f64|little-endian} and {@link\n * module:Layout.f64be|big-endian} representations;\n * * {@link module:Layout.const|Constants} that take no space in the\n * encoded expression.\n *\n * and for these aggregate types:\n * * {@link module:Layout.seq|Sequence}s of instances of a {@link\n * module:Layout~Layout|Layout}, with JavaScript representation as\n * an Array and constant or data-dependent {@link\n * module:Layout~Sequence#count|length};\n * * {@link module:Layout.struct|Structure}s that aggregate a\n * heterogeneous sequence of {@link module:Layout~Layout|Layout}\n * instances, with JavaScript representation as an Object;\n * * {@link module:Layout.union|Union}s that support multiple {@link\n * module:Layout~VariantLayout|variant layouts} over a fixed\n * (padded) or variable (not padded) span of bytes, using an\n * unsigned integer at the start of the data or a separate {@link\n * module:Layout.unionLayoutDiscriminator|layout element} to\n * determine which layout to use when interpreting the buffer\n * contents;\n * * {@link module:Layout.bits|BitStructure}s that contain a sequence\n * of individual {@link\n * module:Layout~BitStructure#addField|BitField}s packed into an 8,\n * 16, 24, or 32-bit unsigned integer starting at the least- or\n * most-significant bit;\n * * {@link module:Layout.cstr|C strings} of varying length;\n * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link\n * module:Layout~Blob#length|length} raw data.\n *\n * All {@link module:Layout~Layout|Layout} instances are immutable\n * after construction, to prevent internal state from becoming\n * inconsistent.\n *\n * @local Layout\n * @local ExternalLayout\n * @local GreedyCount\n * @local OffsetLayout\n * @local UInt\n * @local UIntBE\n * @local Int\n * @local IntBE\n * @local NearUInt64\n * @local NearUInt64BE\n * @local NearInt64\n * @local NearInt64BE\n * @local Float\n * @local FloatBE\n * @local Double\n * @local DoubleBE\n * @local Sequence\n * @local Structure\n * @local UnionDiscriminator\n * @local UnionLayoutDiscriminator\n * @local Union\n * @local VariantLayout\n * @local BitStructure\n * @local BitField\n * @local Boolean\n * @local Blob\n * @local CString\n * @local Constant\n * @local bindConstructorLayout\n * @module Layout\n * @license MIT\n * @author Peter A. Bigot\n * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}\n *)\n\n@noble/curves/esm/abstract/weierstrass.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/_shortw_utils.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n\n@noble/curves/esm/secp256k1.js:\n (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)\n*/\n'; + module2.exports = { + code: code9 + }; + } +}); + +// node_modules/safe-buffer/index.js +var require_safe_buffer = __commonJS({ + "node_modules/safe-buffer/index.js"(exports, module2) { + init_shim(); + var buffer = __require("buffer"); + var Buffer4 = buffer.Buffer; + function copyProps(src, dst) { + for (var key2 in src) { + dst[key2] = src[key2]; + } + } + if (Buffer4.from && Buffer4.alloc && Buffer4.allocUnsafe && Buffer4.allocUnsafeSlow) { + module2.exports = buffer; + } else { + copyProps(buffer, exports); + exports.Buffer = SafeBuffer; + } + function SafeBuffer(arg, encodingOrOffset, length) { + return Buffer4(arg, encodingOrOffset, length); + } + SafeBuffer.prototype = Object.create(Buffer4.prototype); + copyProps(Buffer4, SafeBuffer); + SafeBuffer.from = function(arg, encodingOrOffset, length) { + if (typeof arg === "number") { + throw new TypeError("Argument must not be a number"); + } + return Buffer4(arg, encodingOrOffset, length); + }; + SafeBuffer.alloc = function(size, fill, encoding) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); + } + var buf = Buffer4(size); + if (fill !== void 0) { + if (typeof encoding === "string") { + buf.fill(fill, encoding); + } else { + buf.fill(fill); + } + } else { + buf.fill(0); + } + return buf; + }; + SafeBuffer.allocUnsafe = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); + } + return Buffer4(size); + }; + SafeBuffer.allocUnsafeSlow = function(size) { + if (typeof size !== "number") { + throw new TypeError("Argument must be a number"); + } + return buffer.SlowBuffer(size); + }; + } +}); + +// node_modules/base-x/src/index.js +var require_src = __commonJS({ + "node_modules/base-x/src/index.js"(exports, module2) { + "use strict"; + init_shim(); + var _Buffer = require_safe_buffer().Buffer; + function base2(ALPHABET) { + if (ALPHABET.length >= 255) { + throw new TypeError("Alphabet too long"); + } + var BASE_MAP = new Uint8Array(256); + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255; + } + for (var i2 = 0; i2 < ALPHABET.length; i2++) { + var x = ALPHABET.charAt(i2); + var xc = x.charCodeAt(0); + if (BASE_MAP[xc] !== 255) { + throw new TypeError(x + " is ambiguous"); + } + BASE_MAP[xc] = i2; + } + var BASE = ALPHABET.length; + var LEADER = ALPHABET.charAt(0); + var FACTOR = Math.log(BASE) / Math.log(256); + var iFACTOR = Math.log(256) / Math.log(BASE); + function encode6(source) { + if (Array.isArray(source) || source instanceof Uint8Array) { + source = _Buffer.from(source); + } + if (!_Buffer.isBuffer(source)) { + throw new TypeError("Expected Buffer"); + } + if (source.length === 0) { + return ""; + } + var zeroes = 0; + var length = 0; + var pbegin = 0; + var pend = source.length; + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++; + zeroes++; + } + var size = (pend - pbegin) * iFACTOR + 1 >>> 0; + var b58 = new Uint8Array(size); + while (pbegin !== pend) { + var carry = source[pbegin]; + var i3 = 0; + for (var it1 = size - 1; (carry !== 0 || i3 < length) && it1 !== -1; it1--, i3++) { + carry += 256 * b58[it1] >>> 0; + b58[it1] = carry % BASE >>> 0; + carry = carry / BASE >>> 0; + } + if (carry !== 0) { + throw new Error("Non-zero carry"); + } + length = i3; + pbegin++; + } + var it2 = size - length; + while (it2 !== size && b58[it2] === 0) { + it2++; + } + var str = LEADER.repeat(zeroes); + for (; it2 < size; ++it2) { + str += ALPHABET.charAt(b58[it2]); + } + return str; + } + function decodeUnsafe(source) { + if (typeof source !== "string") { + throw new TypeError("Expected String"); + } + if (source.length === 0) { + return _Buffer.alloc(0); + } + var psz = 0; + var zeroes = 0; + var length = 0; + while (source[psz] === LEADER) { + zeroes++; + psz++; + } + var size = (source.length - psz) * FACTOR + 1 >>> 0; + var b256 = new Uint8Array(size); + while (psz < source.length) { + var carry = BASE_MAP[source.charCodeAt(psz)]; + if (carry === 255) { + return; + } + var i3 = 0; + for (var it3 = size - 1; (carry !== 0 || i3 < length) && it3 !== -1; it3--, i3++) { + carry += BASE * b256[it3] >>> 0; + b256[it3] = carry % 256 >>> 0; + carry = carry / 256 >>> 0; + } + if (carry !== 0) { + throw new Error("Non-zero carry"); + } + length = i3; + psz++; + } + var it4 = size - length; + while (it4 !== size && b256[it4] === 0) { + it4++; + } + var vch = _Buffer.allocUnsafe(zeroes + (size - it4)); + vch.fill(0, 0, zeroes); + var j2 = zeroes; + while (it4 !== size) { + vch[j2++] = b256[it4++]; + } + return vch; + } + function decode6(string) { + var buffer = decodeUnsafe(string); + if (buffer) { + return buffer; + } + throw new Error("Non-base" + BASE + " character"); + } + return { + encode: encode6, + decodeUnsafe, + decode: decode6 + }; + } + module2.exports = base2; + } +}); + +// node_modules/bs58/index.js +var require_bs58 = __commonJS({ + "node_modules/bs58/index.js"(exports, module2) { + init_shim(); + var basex = require_src(); + var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + module2.exports = basex(ALPHABET); + } +}); + +// local-tests/index.ts +init_shim(); + +// local-tests/setup/tinny-environment.ts +init_shim(); + +// packages/lit-node-client/src/index.ts +init_shim(); + +// packages/lit-node-client/src/lib/lit-node-client.ts +init_shim(); + +// packages/auth-browser/src/index.ts +init_shim(); + +// packages/auth-browser/src/lib/auth-browser.ts +init_shim(); + +// packages/constants/src/index.ts +init_shim(); + +// packages/constants/src/lib/version.ts +init_shim(); +var version = "7.0.0-alpha.9"; + +// packages/constants/src/lib/constants/constants.ts +init_shim(); +import depd from "depd"; +var deprecated = depd("lit-js-sdk:constants:constants"); +var LIT_AUTH_SIG_CHAIN_KEYS = [ + "ethereum", + "solana", + "cosmos", + "kyve" +]; +var AUTH_SIGNATURE_BODY = "I am creating an account to use Lit Protocol at {{timestamp}}"; +var yellowstoneChain = { + contractAddress: null, + chainId: 175188, + name: "Chronicle Yellowstone - Lit Protocol Testnet", + symbol: "tstLPX", + decimals: 18, + rpcUrls: ["https://yellowstone-rpc.litprotocol.com/"], + blockExplorerUrls: ["https://yellowstone-explorer.litprotocol.com/"], + type: null, + vmType: "EVM" +}; +var LIT_CHAINS = { + ethereum: { + contractAddress: "0xA54F7579fFb3F98bd8649fF02813F575f9b3d353", + chainId: 1, + name: "Ethereum", + symbol: "ETH", + decimals: 18, + type: "ERC1155", + rpcUrls: [ + "https://eth-mainnet.alchemyapi.io/v2/EuGnkVlzVoEkzdg0lpCarhm8YHOxWVxE" + ], + blockExplorerUrls: ["https://etherscan.io"], + vmType: "EVM" + }, + polygon: { + contractAddress: "0x7C7757a9675f06F3BE4618bB68732c4aB25D2e88", + chainId: 137, + name: "Polygon", + symbol: "MATIC", + decimals: 18, + rpcUrls: ["https://polygon-rpc.com"], + blockExplorerUrls: ["https://explorer.matic.network"], + type: "ERC1155", + vmType: "EVM" + }, + fantom: { + contractAddress: "0x5bD3Fe8Ab542f0AaBF7552FAAf376Fd8Aa9b3869", + chainId: 250, + name: "Fantom", + symbol: "FTM", + decimals: 18, + rpcUrls: ["https://rpcapi.fantom.network"], + blockExplorerUrls: ["https://ftmscan.com"], + type: "ERC1155", + vmType: "EVM" + }, + xdai: { + contractAddress: "0xDFc2Fd83dFfD0Dafb216F412aB3B18f2777406aF", + chainId: 100, + name: "xDai", + symbol: "xDai", + decimals: 18, + rpcUrls: ["https://rpc.gnosischain.com"], + blockExplorerUrls: [" https://blockscout.com/xdai/mainnet"], + type: "ERC1155", + vmType: "EVM" + }, + bsc: { + contractAddress: "0xc716950e5DEae248160109F562e1C9bF8E0CA25B", + chainId: 56, + name: "Binance Smart Chain", + symbol: "BNB", + decimals: 18, + rpcUrls: ["https://bsc-dataseed.binance.org/"], + blockExplorerUrls: [" https://bscscan.com/"], + type: "ERC1155", + vmType: "EVM" + }, + arbitrum: { + contractAddress: "0xc716950e5DEae248160109F562e1C9bF8E0CA25B", + chainId: 42161, + name: "Arbitrum", + symbol: "AETH", + decimals: 18, + type: "ERC1155", + rpcUrls: ["https://arb1.arbitrum.io/rpc"], + blockExplorerUrls: ["https://arbiscan.io/"], + vmType: "EVM" + }, + arbitrumSepolia: { + contractAddress: null, + chainId: 421614, + name: "Arbitrum Sepolia", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://arbitrum-sepolia.blockpi.network/v1/rpc/public"], + blockExplorerUrls: ["https://sepolia.arbiscan.io/"], + type: null, + vmType: "EVM" + }, + avalanche: { + contractAddress: "0xBB118507E802D17ECDD4343797066dDc13Cde7C6", + chainId: 43114, + name: "Avalanche", + symbol: "AVAX", + decimals: 18, + type: "ERC1155", + rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"], + blockExplorerUrls: ["https://snowtrace.io/"], + vmType: "EVM" + }, + fuji: { + contractAddress: "0xc716950e5DEae248160109F562e1C9bF8E0CA25B", + chainId: 43113, + name: "Avalanche FUJI Testnet", + symbol: "AVAX", + decimals: 18, + type: "ERC1155", + rpcUrls: ["https://api.avax-test.network/ext/bc/C/rpc"], + blockExplorerUrls: ["https://testnet.snowtrace.io/"], + vmType: "EVM" + }, + harmony: { + contractAddress: "0xBB118507E802D17ECDD4343797066dDc13Cde7C6", + chainId: 16666e5, + name: "Harmony", + symbol: "ONE", + decimals: 18, + type: "ERC1155", + rpcUrls: ["https://api.harmony.one"], + blockExplorerUrls: ["https://explorer.harmony.one/"], + vmType: "EVM" + }, + mumbai: { + contractAddress: "0xc716950e5DEae248160109F562e1C9bF8E0CA25B", + chainId: 80001, + name: "Mumbai", + symbol: "MATIC", + decimals: 18, + rpcUrls: [ + "https://rpc-mumbai.maticvigil.com/v1/96bf5fa6e03d272fbd09de48d03927b95633726c" + ], + blockExplorerUrls: ["https://mumbai.polygonscan.com"], + type: "ERC1155", + vmType: "EVM" + }, + goerli: { + contractAddress: "0xc716950e5DEae248160109F562e1C9bF8E0CA25B", + chainId: 5, + name: "Goerli", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://goerli.infura.io/v3/96dffb3d8c084dec952c61bd6230af34"], + blockExplorerUrls: ["https://goerli.etherscan.io"], + type: "ERC1155", + vmType: "EVM" + }, + cronos: { + contractAddress: "0xc716950e5DEae248160109F562e1C9bF8E0CA25B", + chainId: 25, + name: "Cronos", + symbol: "CRO", + decimals: 18, + rpcUrls: ["https://evm-cronos.org"], + blockExplorerUrls: ["https://cronos.org/explorer/"], + type: "ERC1155", + vmType: "EVM" + }, + optimism: { + contractAddress: "0xbF68B4c9aCbed79278465007f20a08Fa045281E0", + chainId: 10, + name: "Optimism", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://mainnet.optimism.io"], + blockExplorerUrls: ["https://optimistic.etherscan.io"], + type: "ERC1155", + vmType: "EVM" + }, + celo: { + contractAddress: "0xBB118507E802D17ECDD4343797066dDc13Cde7C6", + chainId: 42220, + name: "Celo", + symbol: "CELO", + decimals: 18, + rpcUrls: ["https://forno.celo.org"], + blockExplorerUrls: ["https://explorer.celo.org"], + type: "ERC1155", + vmType: "EVM" + }, + aurora: { + contractAddress: null, + chainId: 1313161554, + name: "Aurora", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://mainnet.aurora.dev"], + blockExplorerUrls: ["https://aurorascan.dev"], + type: null, + vmType: "EVM" + }, + eluvio: { + contractAddress: null, + chainId: 955305, + name: "Eluvio", + symbol: "ELV", + decimals: 18, + rpcUrls: ["https://host-76-74-28-226.contentfabric.io/eth"], + blockExplorerUrls: ["https://explorer.eluv.io"], + type: null, + vmType: "EVM" + }, + alfajores: { + contractAddress: null, + chainId: 44787, + name: "Alfajores", + symbol: "CELO", + decimals: 18, + rpcUrls: ["https://alfajores-forno.celo-testnet.org"], + blockExplorerUrls: ["https://alfajores-blockscout.celo-testnet.org"], + type: null, + vmType: "EVM" + }, + xdc: { + contractAddress: null, + chainId: 50, + name: "XDC Blockchain", + symbol: "XDC", + decimals: 18, + rpcUrls: ["https://rpc.xinfin.network"], + blockExplorerUrls: ["https://explorer.xinfin.network"], + type: null, + vmType: "EVM" + }, + evmos: { + contractAddress: null, + chainId: 9001, + name: "EVMOS", + symbol: "EVMOS", + decimals: 18, + rpcUrls: ["https://eth.bd.evmos.org:8545"], + blockExplorerUrls: ["https://evm.evmos.org"], + type: null, + vmType: "EVM" + }, + evmosTestnet: { + contractAddress: null, + chainId: 9e3, + name: "EVMOS Testnet", + symbol: "EVMOS", + decimals: 18, + rpcUrls: ["https://eth.bd.evmos.dev:8545"], + blockExplorerUrls: ["https://evm.evmos.dev"], + type: null, + vmType: "EVM" + }, + bscTestnet: { + contractAddress: null, + chainId: 97, + name: "BSC Testnet", + symbol: "BNB", + decimals: 18, + rpcUrls: ["https://data-seed-prebsc-1-s1.binance.org:8545"], + blockExplorerUrls: ["https://testnet.bscscan.com/"], + type: null, + vmType: "EVM" + }, + baseGoerli: { + contractAddress: null, + chainId: 84531, + name: "Base Goerli", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://goerli.base.org"], + blockExplorerUrls: ["https://goerli.basescan.org"], + type: null, + vmType: "EVM" + }, + baseSepolia: { + contractAddress: null, + chainId: 84532, + name: "Base Sepolia", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://sepolia.base.org"], + blockExplorerUrls: ["https://sepolia.basescan.org"], + type: null, + vmType: "EVM" + }, + moonbeam: { + contractAddress: null, + chainId: 1284, + name: "Moonbeam", + symbol: "GLMR", + decimals: 18, + rpcUrls: ["https://rpc.api.moonbeam.network"], + blockExplorerUrls: ["https://moonscan.io"], + type: null, + vmType: "EVM" + }, + moonriver: { + contractAddress: null, + chainId: 1285, + name: "Moonriver", + symbol: "MOVR", + decimals: 18, + rpcUrls: ["https://rpc.api.moonriver.moonbeam.network"], + blockExplorerUrls: ["https://moonriver.moonscan.io"], + type: null, + vmType: "EVM" + }, + moonbaseAlpha: { + contractAddress: null, + chainId: 1287, + name: "Moonbase Alpha", + symbol: "DEV", + decimals: 18, + rpcUrls: ["https://rpc.api.moonbase.moonbeam.network"], + blockExplorerUrls: ["https://moonbase.moonscan.io/"], + type: null, + vmType: "EVM" + }, + filecoin: { + contractAddress: null, + chainId: 314, + name: "Filecoin", + symbol: "FIL", + decimals: 18, + rpcUrls: ["https://api.node.glif.io/rpc/v1"], + blockExplorerUrls: ["https://filfox.info/"], + type: null, + vmType: "EVM" + }, + hyperspace: { + contractAddress: null, + chainId: 3141, + name: "Filecoin Hyperspace testnet", + symbol: "tFIL", + decimals: 18, + rpcUrls: ["https://api.hyperspace.node.glif.io/rpc/v1"], + blockExplorerUrls: ["https://hyperspace.filscan.io/"], + type: null, + vmType: "EVM" + }, + sepolia: { + contractAddress: null, + chainId: 11155111, + name: "Sepolia Testnet", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://ethereum-sepolia-rpc.publicnode.com"], + blockExplorerUrls: ["https://sepolia.etherscan.io/"], + type: null, + vmType: "EVM" + }, + scrollAlphaTestnet: { + contractAddress: null, + chainId: 534353, + name: "Scroll Alpha Testnet", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://alpha-rpc.scroll.io/l2"], + blockExplorerUrls: ["https://blockscout.scroll.io/"], + type: null, + vmType: "EVM" + }, + scroll: { + contractAddress: null, + chainId: 534352, + name: "Scroll", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://rpc.scroll.io"], + blockExplorerUrls: ["https://scrollscan.com/"], + type: null, + vmType: "EVM" + }, + zksync: { + contractAddress: null, + chainId: 324, + name: "zkSync Era Mainnet", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://mainnet.era.zksync.io"], + blockExplorerUrls: ["https://explorer.zksync.io/"], + type: null, + vmType: "EVM" + }, + base: { + contractAddress: null, + chainId: 8453, + name: "Base Mainnet", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://mainnet.base.org"], + blockExplorerUrls: ["https://basescan.org"], + type: null, + vmType: "EVM" + }, + lukso: { + contractAddress: null, + chainId: 42, + name: "Lukso", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://rpc.lukso.gateway.fm"], + blockExplorerUrls: ["https://explorer.execution.mainnet.lukso.network/"], + type: null, + vmType: "EVM" + }, + luksoTestnet: { + contractAddress: null, + chainId: 4201, + name: "Lukso Testnet", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://rpc.testnet.lukso.network"], + blockExplorerUrls: ["https://explorer.execution.testnet.lukso.network"], + type: null, + vmType: "EVM" + }, + zora: { + contractAddress: null, + chainId: 7777777, + name: " Zora", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://rpc.zora.energy/"], + blockExplorerUrls: ["https://explorer.zora.energy"], + type: null, + vmType: "EVM" + }, + zoraGoerli: { + contractAddress: null, + chainId: 999, + name: "Zora Goerli", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://testnet.rpc.zora.energy"], + blockExplorerUrls: ["https://testnet.explorer.zora.energy"], + type: null, + vmType: "EVM" + }, + zksyncTestnet: { + contractAddress: null, + chainId: 280, + name: "zkSync Era Testnet", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://testnet.era.zksync.dev"], + blockExplorerUrls: ["https://goerli.explorer.zksync.io/"], + type: null, + vmType: "EVM" + }, + lineaGoerli: { + contractAddress: null, + chainId: 59140, + name: "Linea Testnet", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://rpc.goerli.linea.build"], + blockExplorerUrls: ["https://explorer.goerli.linea.build"], + type: null, + vmType: "EVM" + }, + lineaSepolia: { + contractAddress: null, + chainId: 59141, + name: "Linea Sepolia Testnet", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://rpc.sepolia.linea.build"], + blockExplorerUrls: ["https://explorer.sepolia.linea.build"], + type: null, + vmType: "EVM" + }, + /** + * Use this for `>= Datil` network. + * Chainlist entry for the Chronicle Yellowstone Testnet. + * https://chainlist.org/chain/175188 + */ + yellowstone: yellowstoneChain, + chiado: { + contractAddress: null, + chainId: 10200, + name: "Chiado", + symbol: "XDAI", + decimals: 18, + rpcUrls: ["https://rpc.chiadochain.net"], + blockExplorerUrls: ["https://blockscout.chiadochain.net"], + type: null, + vmType: "EVM" + }, + zkEvm: { + contractAddress: null, + chainId: 1101, + name: "zkEvm", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://zkevm-rpc.com"], + blockExplorerUrls: ["https://zkevm.polygonscan.com/"], + type: null, + vmType: "EVM" + }, + mantleTestnet: { + contractAddress: null, + chainId: 5001, + name: "Mantle Testnet", + symbol: "MNT", + decimals: 18, + rpcUrls: ["https://rpc.testnet.mantle.xyz"], + blockExplorerUrls: ["https://explorer.testnet.mantle.xyz/"], + type: null, + vmType: "EVM" + }, + mantle: { + contractAddress: null, + chainId: 5e3, + name: "Mantle", + symbol: "MNT", + decimals: 18, + rpcUrls: ["https://rpc.mantle.xyz"], + blockExplorerUrls: ["http://explorer.mantle.xyz/"], + type: null, + vmType: "EVM" + }, + klaytn: { + contractAddress: null, + chainId: 8217, + name: "Klaytn", + symbol: "KLAY", + decimals: 18, + rpcUrls: ["https://klaytn.blockpi.network/v1/rpc/public"], + blockExplorerUrls: ["https://www.klaytnfinder.io/"], + type: null, + vmType: "EVM" + }, + publicGoodsNetwork: { + contractAddress: null, + chainId: 424, + name: "Public Goods Network", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://rpc.publicgoods.network"], + blockExplorerUrls: ["https://explorer.publicgoods.network/"], + type: null, + vmType: "EVM" + }, + optimismGoerli: { + contractAddress: null, + chainId: 420, + name: "Optimism Goerli", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://optimism-goerli.publicnode.com"], + blockExplorerUrls: ["https://goerli-optimism.etherscan.io/"], + type: null, + vmType: "EVM" + }, + waevEclipseTestnet: { + contractAddress: null, + chainId: 91006, + name: "Waev Eclipse Testnet", + symbol: "ecWAEV", + decimals: 18, + rpcUrls: ["https://api.evm.waev.eclipsenetwork.xyz"], + blockExplorerUrls: ["http://waev.explorer.modular.cloud/"], + type: null, + vmType: "EVM" + }, + waevEclipseDevnet: { + contractAddress: null, + chainId: 91006, + name: "Waev Eclipse Devnet", + symbol: "ecWAEV", + decimals: 18, + rpcUrls: ["https://api.evm.waev.dev.eclipsenetwork.xyz"], + blockExplorerUrls: ["http://waev.explorer.modular.cloud/"], + type: null, + vmType: "EVM" + }, + verifyTestnet: { + contractAddress: null, + chainId: 1833, + name: "Verify Testnet", + symbol: "MATIC", + decimals: 18, + rpcUrls: ["https://rpc.verify-testnet.gelato.digital"], + blockExplorerUrls: ["https://verify-testnet.blockscout.com/"], + type: null, + vmType: "EVM" + }, + fuse: { + contractAddress: null, + chainId: 122, + name: "Fuse", + symbol: "FUSE", + decimals: 18, + rpcUrls: ["https://rpc.fuse.io/"], + blockExplorerUrls: ["https://explorer.fuse.io/"], + type: null, + vmType: "EVM" + }, + campNetwork: { + contractAddress: null, + chainId: 325e3, + name: "Camp Network", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://rpc.camp-network-testnet.gelato.digital"], + blockExplorerUrls: [ + "https://explorer.camp-network-testnet.gelato.digital/" + ], + type: null, + vmType: "EVM" + }, + vanar: { + contractAddress: null, + chainId: 78600, + name: "Vanar Vanguard", + symbol: "VANRY", + decimals: 18, + rpcUrls: ["https://rpc-vanguard.vanarchain.com"], + blockExplorerUrls: ["https://explorer-vanguard.vanarchain.com"], + type: null, + vmType: "EVM" + }, + lisk: { + contractAddress: null, + chainId: 1135, + name: "Lisk", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://lisk.drpc.org"], + blockExplorerUrls: ["https://blockscout.lisk.com/"], + type: null, + vmType: "EVM" + }, + chilizMainnet: { + contractAddress: null, + chainId: 88888, + name: "Chiliz Mainnet", + symbol: "CHZ", + decimals: 18, + rpcUrls: ["https://rpc.ankr.com/chiliz"], + blockExplorerUrls: ["https://chiliscan.com/"], + type: null, + vmType: "EVM" + }, + chilizTestnet: { + contractAddress: null, + chainId: 88882, + name: "Chiliz Spicy Testnet", + symbol: "CHZ", + decimals: 18, + rpcUrls: ["https://spicy-rpc.chiliz.com/"], + blockExplorerUrls: ["https://testnet.chiliscan.com/"], + type: null, + vmType: "EVM" + }, + skaleTestnet: { + contractAddress: null, + chainId: 37084624, + name: "SKALE Nebula Hub Testnet", + symbol: "sFUEL", + decimals: 18, + rpcUrls: ["https://testnet.skalenodes.com/v1/lanky-ill-funny-testnet"], + blockExplorerUrls: [ + "https://lanky-ill-funny-testnet.explorer.testnet.skalenodes.com" + ], + type: null, + vmType: "EVM" + }, + skale: { + contractAddress: null, + chainId: 1482601649, + name: "SKALE Nebula Hub Mainnet", + symbol: "sFUEL", + decimals: 18, + rpcUrls: ["https://mainnet.skalenodes.com/v1/green-giddy-denebola"], + blockExplorerUrls: [ + "https://green-giddy-denebola.explorer.mainnet.skalenodes.com" + ], + type: null, + vmType: "EVM" + }, + skaleCalypso: { + contractAddress: null, + chainId: 1564830818, + name: "SKALE Calypso Hub Mainnet", + symbol: "sFUEL", + decimals: 18, + rpcUrls: ["https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague"], + blockExplorerUrls: [ + "https://giant-half-dual-testnet.explorer.testnet.skalenodes.com/" + ], + type: null, + vmType: "EVM" + }, + fhenixHelium: { + contractAddress: null, + chainId: 8008135, + name: "Fhenix Helium", + symbol: "tFHE", + decimals: 18, + rpcUrls: ["https://api.helium.fhenix.zone"], + blockExplorerUrls: ["https://explorer.helium.fhenix.zone"], + type: null, + vmType: "EVM" + }, + hederaTestnet: { + contractAddress: null, + chainId: 296, + name: "Hedera Testnet", + symbol: "HBAR", + decimals: 8, + rpcUrls: ["https://testnet.hashio.io/api"], + blockExplorerUrls: ["https://hashscan.io/testnet/dashboard"], + type: null, + vmType: "EVM" + }, + bitTorrentTestnet: { + contractAddress: null, + chainId: 1028, + name: "BitTorrent Testnet", + symbol: "BTT", + decimals: 18, + rpcUrls: ["https://test-rpc.bittorrentchain.io"], + blockExplorerUrls: ["https://testnet.bttcscan.com"], + type: null, + vmType: "EVM" + }, + storyIlaid: { + contractAddress: null, + chainId: 1513, + name: "Story Iliad Testnet", + symbol: "IP", + decimals: 18, + rpcUrls: ["https://testnet.storyrpc.io"], + blockExplorerUrls: ["https://testnet.storyscan.xyz"], + type: null, + vmType: "EVM" + }, + campTestnet: { + contractAddress: null, + chainId: 325e3, + name: "Camp Testnet", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://rpc.camp-network-testnet.gelato.digital"], + blockExplorerUrls: ["https://camp-network-testnet.blockscout.com"], + type: null, + vmType: "EVM" + }, + hushedNorthstar: { + contractAddress: null, + chainId: 42161, + name: "Hushed Northstar Devnet", + symbol: "ETH", + decimals: 18, + rpcUrls: ["https://rpc.buildbear.io/yielddev"], + blockExplorerUrls: ["https://explorer.buildbear.io/yielddev/transactions"], + type: null, + vmType: "EVM" + } +}; +var METAMASK_CHAIN_INFO = { + /** + * Information about the "chronicleYellowstone" chain. + */ + yellowstone: { + chainId: LIT_CHAINS["yellowstone"].chainId, + chainName: LIT_CHAINS["yellowstone"].name, + nativeCurrency: { + name: LIT_CHAINS["yellowstone"].symbol, + symbol: LIT_CHAINS["yellowstone"].symbol, + decimals: LIT_CHAINS["yellowstone"].decimals + }, + rpcUrls: LIT_CHAINS["yellowstone"].rpcUrls, + blockExplorerUrls: LIT_CHAINS["yellowstone"].blockExplorerUrls, + iconUrls: ["future"] + } +}; +var metamaskChainInfo = new Proxy(METAMASK_CHAIN_INFO, { + get(target, prop, receiver) { + deprecated( + "metamaskChainInfo is deprecated and will be removed in a future version. Use METAMASK_CHAIN_INFO instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var LIT_RPC = { + /** + * Local Anvil RPC endpoint. + */ + LOCAL_ANVIL: "http://127.0.0.1:8545", + /** + * Chronicle Yellowstone RPC endpoint - used for >= Datil-test + * More info: https://app.conduit.xyz/published/view/chronicle-yellowstone-testnet-9qgmzfcohk + */ + CHRONICLE_YELLOWSTONE: "https://yellowstone-rpc.litprotocol.com" +}; +var LIT_NETWORK = { + DatilDev: "datil-dev", + DatilTest: "datil-test", + Datil: "datil", + Custom: "custom" +}; +var LitNetwork = new Proxy(LIT_NETWORK, { + get(target, prop, receiver) { + deprecated( + "LitNetwork is deprecated and will be removed in a future version. Use LIT_NETWORK instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var RPC_URL_BY_NETWORK = { + "datil-dev": LIT_RPC.CHRONICLE_YELLOWSTONE, + "datil-test": LIT_RPC.CHRONICLE_YELLOWSTONE, + datil: LIT_RPC.CHRONICLE_YELLOWSTONE, + custom: LIT_RPC.LOCAL_ANVIL +}; +var RELAYER_URL_BY_NETWORK = { + "datil-dev": "https://datil-dev-relayer.getlit.dev", + "datil-test": "https://datil-test-relayer.getlit.dev", + datil: "https://datil-relayer.getlit.dev", + custom: "http://localhost:3000" +}; +var METAMASK_CHAIN_INFO_BY_NETWORK = { + "datil-dev": METAMASK_CHAIN_INFO.yellowstone, + "datil-test": METAMASK_CHAIN_INFO.yellowstone, + datil: METAMASK_CHAIN_INFO.yellowstone, + custom: METAMASK_CHAIN_INFO.yellowstone +}; +var HTTP = "http://"; +var HTTPS = "https://"; +var HTTP_BY_NETWORK = { + "datil-dev": HTTPS, + "datil-test": HTTPS, + datil: HTTPS, + custom: HTTP + // default, can be changed by config +}; +var CENTRALISATION_BY_NETWORK = { + "datil-dev": "centralised", + "datil-test": "decentralised", + datil: "decentralised", + custom: "unknown" +}; +var LIT_SVM_CHAINS = { + solana: { + name: "Solana", + symbol: "SOL", + decimals: 9, + rpcUrls: ["https://api.mainnet-beta.solana.com"], + blockExplorerUrls: ["https://explorer.solana.com/"], + vmType: "SVM" + }, + solanaDevnet: { + name: "Solana Devnet", + symbol: "SOL", + decimals: 9, + rpcUrls: ["https://api.devnet.solana.com"], + blockExplorerUrls: ["https://explorer.solana.com/"], + vmType: "SVM" + }, + solanaTestnet: { + name: "Solana Testnet", + symbol: "SOL", + decimals: 9, + rpcUrls: ["https://api.testnet.solana.com"], + blockExplorerUrls: ["https://explorer.solana.com/"], + vmType: "SVM" + } +}; +var LIT_COSMOS_CHAINS = { + cosmos: { + name: "Cosmos", + symbol: "ATOM", + decimals: 6, + chainId: "cosmoshub-4", + rpcUrls: ["https://lcd-cosmoshub.keplr.app"], + blockExplorerUrls: ["https://atomscan.com/"], + vmType: "CVM" + }, + kyve: { + name: "Kyve", + symbol: "KYVE", + decimals: 6, + chainId: "korellia", + rpcUrls: ["https://api.korellia.kyve.network"], + blockExplorerUrls: ["https://explorer.kyve.network/"], + vmType: "CVM" + }, + evmosCosmos: { + name: "EVMOS Cosmos", + symbol: "EVMOS", + decimals: 18, + chainId: "evmos_9001-2", + rpcUrls: ["https://rest.bd.evmos.org:1317"], + blockExplorerUrls: ["https://evmos.bigdipper.live"], + vmType: "CVM" + }, + evmosCosmosTestnet: { + name: "Evmos Cosmos Testnet", + symbol: "EVMOS", + decimals: 18, + chainId: "evmos_9000-4", + rpcUrls: ["https://rest.bd.evmos.dev:1317"], + blockExplorerUrls: ["https://testnet.bigdipper.live"], + vmType: "CVM" + }, + cheqdMainnet: { + name: "Cheqd Mainnet", + symbol: "CHEQ", + decimals: 9, + chainId: "cheqd-mainnet-1", + rpcUrls: ["https://api.cheqd.net"], + blockExplorerUrls: ["https://explorer.cheqd.io"], + vmType: "CVM" + }, + cheqdTestnet: { + name: "Cheqd Testnet", + symbol: "CHEQ", + decimals: 9, + chainId: "cheqd-testnet-6", + rpcUrls: ["https://api.cheqd.network"], + blockExplorerUrls: ["https://testnet-explorer.cheqd.io"], + vmType: "CVM" + }, + juno: { + name: "Juno", + symbol: "JUNO", + decimals: 6, + chainId: "juno-1", + rpcUrls: ["https://rest.cosmos.directory/juno"], + blockExplorerUrls: ["https://www.mintscan.io/juno"], + vmType: "CVM" + } +}; +var ALL_LIT_CHAINS = { + ...LIT_CHAINS, + ...LIT_SVM_CHAINS, + ...LIT_COSMOS_CHAINS +}; +var LOCAL_STORAGE_KEYS = { + AUTH_COSMOS_SIGNATURE: "lit-auth-cosmos-signature", + AUTH_SIGNATURE: "lit-auth-signature", + AUTH_SOL_SIGNATURE: "lit-auth-sol-signature", + WEB3_PROVIDER: "lit-web3-provider", + KEY_PAIR: "lit-comms-keypair", + SESSION_KEY: "lit-session-key", + WALLET_SIGNATURE: "lit-wallet-sig" +}; +var LIT_NETWORKS = { + "datil-dev": [], + "datil-test": [], + datil: [], + custom: [] +}; +var LIT_SESSION_KEY_URI = "lit:session:"; +var LIT_ACTION_IPFS_HASH = "QmUjX8MW6StQ7NKNdaS6g4RMkvN5hcgtKmEi8Mca6oX4t3"; +var VMTYPE = { + EVM: "EVM", + SVM: "SVM", + CVM: "CVM" +}; +var LIT_CURVE = { + BLS: "BLS", + EcdsaK256: "K256", + EcdsaCaitSith: "ECDSA_CAIT_SITH", + // Legacy alias of K256 + EcdsaCAITSITHP256: "EcdsaCaitSithP256" +}; +var EITHER_TYPE = { + ERROR: "ERROR", + SUCCESS: "SUCCESS" +}; +var AUTH_METHOD_TYPE = { + EthWallet: 1, + LitAction: 2, + WebAuthn: 3, + Discord: 4, + Google: 5, + GoogleJwt: 6, + AppleJwt: 8, + StytchOtp: 9, + StytchEmailFactorOtp: 10, + StytchSmsFactorOtp: 11, + StytchWhatsAppFactorOtp: 12, + StytchTotpFactorOtp: 13 +}; +var AuthMethodType = new Proxy(AUTH_METHOD_TYPE, { + get(target, prop, receiver) { + deprecated( + "AuthMethodType is deprecated and will be removed in a future version. Use AUTH_METHOD_TYPE instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var AUTH_METHOD_SCOPE = { + NoPermissions: 0, + SignAnything: 1, + PersonalSign: 2 +}; +var AuthMethodScope = new Proxy(AUTH_METHOD_SCOPE, { + get(target, prop, receiver) { + deprecated( + "AuthMethodScope is deprecated and will be removed in a future version. Use AUTH_METHOD_SCOPE instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var PROVIDER_TYPE = { + Discord: "discord", + Google: "google", + EthWallet: "ethwallet", + WebAuthn: "webauthn", + Apple: "apple", + StytchOtp: "stytchOtp", + StytchEmailFactorOtp: "stytchEmailFactorOtp", + StytchSmsFactorOtp: "stytchSmsFactorOtp", + StytchWhatsAppFactorOtp: "stytchWhatsAppFactorOtp", + StytchTotpFactor: "stytchTotpFactor" +}; +var ProviderType = new Proxy(PROVIDER_TYPE, { + get(target, prop, receiver) { + deprecated( + "ProviderType is deprecated and will be removed in a future version. Use PROVIDER_TYPE instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var STAKING_STATES = { + Active: 0, + NextValidatorSetLocked: 1, + ReadyForNextEpoch: 2, + Unlocked: 3, + Paused: 4, + Restore: 5 +}; +var StakingStates = new Proxy(STAKING_STATES, { + get(target, prop, receiver) { + deprecated( + "StakingStates is deprecated and will be removed in a future version. Use STAKING_STATES instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var RELAY_AUTH_STATUS = { + InProgress: "InProgress", + Succeeded: "Succeeded", + Failed: "Failed" +}; +var RelayAuthStatus = new Proxy(RELAY_AUTH_STATUS, { + get(target, prop, receiver) { + deprecated( + "RelayAuthStatus is deprecated and will be removed in a future version. Use RELAY_AUTH_STATUS instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var LIT_RESOURCE_PREFIX = { + AccessControlCondition: "lit-accesscontrolcondition", + PKP: "lit-pkp", + RLI: "lit-ratelimitincrease", + LitAction: "lit-litaction" +}; +var LitResourcePrefix = new Proxy(LIT_RESOURCE_PREFIX, { + get(target, prop, receiver) { + deprecated( + "LitResourcePrefix is deprecated and will be removed in a future version. Use LIT_RESOURCE_PREFIX instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var LIT_ABILITY = { + /** + * This is the ability to process an encryption access control condition. + * The resource will specify the corresponding hashed key value of the + * access control condition. + */ + AccessControlConditionDecryption: "access-control-condition-decryption", + /** + * This is the ability to process a signing access control condition. + * The resource will specify the corresponding hashed key value of the + * access control condition. + */ + AccessControlConditionSigning: "access-control-condition-signing", + /** + * This is the ability to use a PKP for signing purposes. The resource will specify + * the corresponding PKP token ID. + */ + PKPSigning: "pkp-signing", + /** + * This is the ability to use a Rate Limit Increase (Capacity Credits NFT) token during + * authentication with the nodes. The resource will specify the corresponding + * Capacity Credits NFT token ID. + */ + RateLimitIncreaseAuth: "rate-limit-increase-auth", + /** + * This is the ability to execute a Lit Action. The resource will specify the + * corresponding Lit Action IPFS CID. + */ + LitActionExecution: "lit-action-execution" +}; +var LitAbility = new Proxy(LIT_ABILITY, { + get(target, prop, receiver) { + deprecated( + "LitAbility is deprecated and will be removed in a future version. Use LIT_ABILITY instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var LIT_RECAP_ABILITY = { + Decryption: "Decryption", + Signing: "Signing", + Auth: "Auth", + Execution: "Execution" +}; +var LitRecapAbility = new Proxy(LIT_RECAP_ABILITY, { + get(target, prop, receiver) { + deprecated( + "LitRecapAbility is deprecated and will be removed in a future version. Use LIT_RECAP_ABILITY instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var LIT_NAMESPACE = { + Auth: "Auth", + Threshold: "Threshold" +}; +var LitNamespace = new Proxy(LIT_NAMESPACE, { + get(target, prop, receiver) { + deprecated( + "LitNamespace is deprecated and will be removed in a future version. Use LIT_NAMESPACE instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var LOG_LEVEL = { + INFO: 0, + DEBUG: 1, + WARN: 2, + ERROR: 3, + FATAL: 4, + TIMING_START: 5, + TIMING_END: 6, + OFF: -1 +}; +var LogLevel = new Proxy(LOG_LEVEL, { + get(target, prop, receiver) { + deprecated( + "LogLevel is deprecated and will be removed in a future version. Use LOG_LEVEL instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var FALLBACK_IPFS_GATEWAYS = [ + "https://flk-ipfs.io/ipfs/", + "https://litprotocol.mypinata.cloud/ipfs/" +]; + +// packages/constants/src/lib/constants/mappers.ts +init_shim(); +import depd2 from "depd"; + +// node_modules/@lit-protocol/contracts/dist/index.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/dev/datil.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/dev/datil-dev.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/dev/datil-test.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/dev/cayenne.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/dev/habanero.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/dev/internalDev.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/dev/manzano.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/prod/datil.js +init_shim(); +var datil = { + "config": { + "chainId": "175188", + "rpcUrl": "https://yellowstone-rpc.litprotocol.com", + "chainName": "yellowstone", + "litNodeDomainName": "127.0.0.1", + "litNodePort": 7470, + "rocketPort": 7470 + }, + "data": [ + { + "name": "StakingBalances", + "contracts": [ + { + "network": "datil", + "address_hash": "0x9c9D147dad75D8B9Bd327405098D65C727296B54", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "AliasNotOwnedBySender", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "CannotRemoveAliasOfActiveValidator", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "aliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountReached", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "OnlyStakingContract", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeGreaterThanMinimumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maximumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeLessThanMaximumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "MaximumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "MinimumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "permittedStakersOn", + "type": "bool" + } + ], + "name": "PermittedStakersOnChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + } + ], + "name": "TokenRewardPerTokenPerEpochSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "ValidatorNotRewardedBecauseAlias", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorRewarded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorTokensPenalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "addAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "addPermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "stakers", + "type": "address[]" + } + ], + "name": "addPermittedStakers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "checkStakingAmounts", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "isPermittedStaker", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "penalizeTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "permittedStakersOn", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "removeAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "removePermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "restakePenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "setMaxAliasCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "setMaximumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "setMinimumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "permitted", + "type": "bool" + } + ], + "name": "setPermittedStakersOn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "transferPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "withdrawPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "Staking", + "contracts": [ + { + "network": "datil", + "address_hash": "0x21d636d95eE71150c0c3Ffa79268c989a329d1CE", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [], + "name": "CannotKickBelowCurrentValidatorThreshold", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingAddress", + "type": "address" + } + ], + "name": "CannotRejoinUntilNextEpochBecauseKicked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "CannotReuseCommsKeys", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "CannotVoteTwice", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "CouldNotMapNodeAddressToStakerAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedOrPausedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "MustBeValidatorInNextEpochToKick", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsInNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCountToBeReady", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsReadyForNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentEpochNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receivedEpochNumber", + "type": "uint256" + } + ], + "name": "SignaledReadyForWrongEpochNumber", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "internalType": "address[]", + "name": "validatorsInNextEpoch", + "type": "address[]" + } + ], + "name": "ValidatorIsNotInNextEpoch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "ComplaintConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "newKeyTypes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumValidatorCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxConcurrentRequests", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPeerCheckingIntervalSecs", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleConcurrency", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "newRpcHealthcheckEnabled", + "type": "bool" + } + ], + "name": "ConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "EpochEndTimeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "EpochLengthSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "EpochTimeoutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "KickPenaltyPercentSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "ReadyForNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToJoin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToLeave", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverContractAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newDuration", + "type": "uint256" + } + ], + "name": "RewardsDurationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newStakingTokenAddress", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "StateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountBurned", + "type": "uint256" + } + ], + "name": "ValidatorKickedFromNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "ValidatorRejoinedNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reporter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "VotedToKickValidatorInNextEpoch", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + } + ], + "name": "adminKickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "adminRejoinValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "adminResetEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToPenalize", + "type": "uint256" + } + ], + "name": "adminSlashValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "advanceEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "kickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lockValidatorsForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "requestToJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeave", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeaveAsNode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "setComplaintConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "rpcHealthcheckEnabled", + "type": "bool" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "newConfig", + "type": "tuple" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "setEpochEndTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "setEpochLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "setEpochState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "setEpochTimeout", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "setIpPortNodeAddressAndCommunicationPubKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "setKickPenaltyPercent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "signalReadyForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "stakeAndJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "VersionRequirementsUpdated", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "checkVersion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMaxVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMinVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "complaintConfig", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "config", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "rpcHealthcheckEnabled", + "type": "bool" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfCurrentValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfNextValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "retries", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveUnkickedValidatorStructs", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveUnkickedValidatorStructsAndCounts", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "retries", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Epoch", + "name": "", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveUnkickedValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKeyTypes", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKickedValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getNodeStakerAddressMappings", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "internalType": "struct LibStakingStorage.AddressMapping[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingBalancesAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpochLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInNextEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getValidatorsStructs", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInCurrentEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInNextEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + }, + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "voterStakerAddress", + "type": "address" + } + ], + "name": "getVotingStatusToKickValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidatorByNodeAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isReadyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "kickPenaltyPercentByReason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "nodeAddressToStakerAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "readyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "shouldKickValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "state", + "outputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "validators", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "Multisender", + "contracts": [ + { + "network": "datil", + "address_hash": "0xB87CcFf487B84b60c09DBE15337a46bf5a9e0680", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + } + ], + "name": "sendEth", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + }, + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "sendTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "withdrawTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "LITToken", + "contracts": [ + { + "network": "datil", + "address_hash": "0xd78089bAAe410f5d0eae31D0D56157c73a3Ff98B", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CLOCK_MODE", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAUSER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "cap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint224", + "name": "votes", + "type": "uint224" + } + ], + "internalType": "struct ERC20Votes.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "clock", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PubkeyRouter", + "contracts": [ + { + "network": "datil", + "address_hash": "0xF182d6bEf16Ba77e69372dD096D8B70Bc3d5B475", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "PubkeyRoutingDataSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct IPubkeyRouter.RootKey", + "name": "rootKey", + "type": "tuple" + } + ], + "name": "RootKeySet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "adminResetRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "signedMessage", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + } + ], + "name": "checkNodeSignatures", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "deriveEthAddressFromPubkey", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "ethAddressToPkpId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "getDerivedPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "getRootKeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getRoutingData", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isRouted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "pubkeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingDataAsAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "newRootKeys", + "type": "tuple[]" + } + ], + "name": "voteForRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPNFT", + "contracts": [ + { + "network": "datil", + "address_hash": "0x487A9D096BB4B7Ac1520Cb12370e31e677B175EA", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "MintCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "PKPMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "claimAndMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextDerivedKeyId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftMetadataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mintCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "mintGrantAndBurnNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "name": "mintNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "redeemedFreeMintIds", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "setMintCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "RateLimitNFT", + "contracts": [ + { + "network": "datil", + "address_hash": "0x01205d94Fee4d9F59A4aB24bf80D11d4DdAf6Eed", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "AdditionalRequestsPerKilosecondCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "FreeRequestsPerRateLimitWindowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RLIHolderRateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "setAdditionalRequestsPerKilosecondCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "setFreeRequestsPerRateLimitWindow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxExpirationSeconds", + "type": "uint256" + } + ], + "name": "setMaxExpirationSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "setMaxRequestsPerKilosecond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRLIHolderRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "RLIHolderRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "additionalRequestsPerKilosecondCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "payingAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "capacity", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "internalType": "struct LibRateLimitNFTStorage.RateLimit", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestedRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "checkBelowMaxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentSoldRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMintSigTest", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeRequestsPerRateLimitWindow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isExpired", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxExpirationSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + } + ], + "name": "redeemedFreeMints", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tokenIdCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenSVG", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "totalSoldRequestsPerKilosecondByExpirationTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPHelper", + "contracts": [ + { + "network": "datil", + "address_hash": "0x5B55ee57C459a31072145F2Fc00b35de20520adD", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainWalletRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPKPNftMetdataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddDomainWalletMetadata", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removePkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + } + ], + "name": "setPkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPPermissions", + "contracts": [ + { + "network": "datil", + "address_hash": "0x213Db6E1446928E19588269bEF7dFc9187c4829A", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "RootHashUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod", + "name": "authMethod", + "type": "tuple" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "addPermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToAdd", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToAdd", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeysToAdd", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopesToAdd", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToRemove", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToRemove", + "type": "bytes[]" + } + ], + "name": "batchAddRemoveAuthMethods", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getAuthMethodId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedActions", + "outputs": [ + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxScopeId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethodScopes", + "outputs": [ + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethods", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getTokenIdsForAuthMethod", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getUserPubkeyForAuthMethod", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "isPermittedAction", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "isPermittedAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "isPermittedAuthMethod", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "isPermittedAuthMethodScopePresent", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "removePermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "removePermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "removePermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "removePermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "setRootHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bytes32", + "name": "leaf", + "type": "bytes32" + } + ], + "name": "verifyState", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bool[]", + "name": "proofFlags", + "type": "bool[]" + }, + { + "internalType": "bytes32[]", + "name": "leaves", + "type": "bytes32[]" + } + ], + "name": "verifyStates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPNFTMetadata", + "contracts": [ + { + "network": "datil", + "address_hash": "0x4BB8681d3a24F130cC746C7DC31167C93D72d32b", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "buffer", + "type": "bytes" + } + ], + "name": "bytesToHex", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeProfileForPkp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "imgUrl", + "type": "string" + } + ], + "name": "setProfileForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "url", + "type": "string" + } + ], + "name": "setUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubKey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "Allowlist", + "contracts": [ + { + "network": "datil", + "address_hash": "0xE393BCD2a9099C903D28949Bac2C4cEd21E55415", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemNotAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "allowAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "allowedItems", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "isAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_allowAll", + "type": "bool" + } + ], + "name": "setAllowAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setNotAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PaymentDelegation", + "contracts": [ + { + "network": "datil", + "address_hash": "0xF19ea8634969730cB51BFEe2E2A5353062053C14", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibPaymentDelegationStorage.Restriction", + "name": "restriction", + "type": "tuple" + } + ], + "name": "RestrictionSet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "delegatePayments", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + } + ], + "name": "delegatePaymentsBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getPayers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + } + ], + "name": "getPayersAndRestrictions", + "outputs": [ + { + "internalType": "address[][]", + "name": "", + "type": "address[][]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "internalType": "struct LibPaymentDelegationStorage.Restriction[][]", + "name": "", + "type": "tuple[][]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "payer", + "type": "address" + } + ], + "name": "getRestriction", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "internalType": "struct LibPaymentDelegationStorage.Restriction", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "payer", + "type": "address" + } + ], + "name": "getUsers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "setDefaultRestriction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "internalType": "struct LibPaymentDelegationStorage.Restriction", + "name": "r", + "type": "tuple" + } + ], + "name": "setRestriction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "undelegatePayments", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + } + ], + "name": "undelegatePaymentsBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + } + ] +}; + +// node_modules/@lit-protocol/contracts/dist/prod/cayenne.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/prod/datil-dev.js +init_shim(); +var datilDev = { + "config": { + "chainId": "175188", + "rpcUrl": "https://yellowstone-rpc.litprotocol.com", + "chainName": "yellowstone", + "litNodeDomainName": "127.0.0.1", + "litNodePort": 7470, + "rocketPort": 7470 + }, + "data": [ + { + "name": "StakingBalances", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0x77F277D4858Ae589b2263FEfd50CaD7838fE4741", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "AliasNotOwnedBySender", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "CannotRemoveAliasOfActiveValidator", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "aliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountReached", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "OnlyStakingContract", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeGreaterThanMinimumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maximumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeLessThanMaximumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "MaximumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "MinimumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "permittedStakersOn", + "type": "bool" + } + ], + "name": "PermittedStakersOnChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + } + ], + "name": "TokenRewardPerTokenPerEpochSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "ValidatorNotRewardedBecauseAlias", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorRewarded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorTokensPenalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "addAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "addPermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "stakers", + "type": "address[]" + } + ], + "name": "addPermittedStakers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "checkStakingAmounts", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "isPermittedStaker", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "penalizeTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "permittedStakersOn", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "removeAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "removePermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "restakePenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "setMaxAliasCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "setMaximumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "setMinimumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "permitted", + "type": "bool" + } + ], + "name": "setPermittedStakersOn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "transferPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "withdrawPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "Staking", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0xD4507CD392Af2c80919219d7896508728f6A623F", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [], + "name": "CannotKickBelowCurrentValidatorThreshold", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingAddress", + "type": "address" + } + ], + "name": "CannotRejoinUntilNextEpochBecauseKicked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "CannotReuseCommsKeys", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "CannotVoteTwice", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "CouldNotMapNodeAddressToStakerAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedOrPausedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "MustBeValidatorInNextEpochToKick", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsInNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCountToBeReady", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsReadyForNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentEpochNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receivedEpochNumber", + "type": "uint256" + } + ], + "name": "SignaledReadyForWrongEpochNumber", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "internalType": "address[]", + "name": "validatorsInNextEpoch", + "type": "address[]" + } + ], + "name": "ValidatorIsNotInNextEpoch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "ComplaintConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "newKeyTypes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumValidatorCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxConcurrentRequests", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPeerCheckingIntervalSecs", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleConcurrency", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "newRpcHealthcheckEnabled", + "type": "bool" + } + ], + "name": "ConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "EpochEndTimeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "EpochLengthSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "EpochTimeoutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "KickPenaltyPercentSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "ReadyForNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToJoin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToLeave", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverContractAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newDuration", + "type": "uint256" + } + ], + "name": "RewardsDurationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newStakingTokenAddress", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "StateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountBurned", + "type": "uint256" + } + ], + "name": "ValidatorKickedFromNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "ValidatorRejoinedNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reporter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "VotedToKickValidatorInNextEpoch", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + } + ], + "name": "adminKickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "adminRejoinValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "adminResetEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToPenalize", + "type": "uint256" + } + ], + "name": "adminSlashValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "advanceEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "kickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lockValidatorsForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "requestToJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeave", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeaveAsNode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "setComplaintConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "rpcHealthcheckEnabled", + "type": "bool" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "newConfig", + "type": "tuple" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "setEpochEndTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "setEpochLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "setEpochState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "setEpochTimeout", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "setIpPortNodeAddressAndCommunicationPubKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "setKickPenaltyPercent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "signalReadyForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "stakeAndJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "VersionRequirementsUpdated", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "checkVersion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMaxVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMinVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "complaintConfig", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "config", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "rpcHealthcheckEnabled", + "type": "bool" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfCurrentValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfNextValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "retries", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveUnkickedValidatorStructs", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveUnkickedValidatorStructsAndCounts", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "retries", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Epoch", + "name": "", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveUnkickedValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKeyTypes", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKickedValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getNodeStakerAddressMappings", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "internalType": "struct LibStakingStorage.AddressMapping[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingBalancesAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpochLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInNextEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getValidatorsStructs", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInCurrentEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInNextEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + }, + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "voterStakerAddress", + "type": "address" + } + ], + "name": "getVotingStatusToKickValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidatorByNodeAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isReadyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "kickPenaltyPercentByReason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "nodeAddressToStakerAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "readyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "shouldKickValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "state", + "outputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "validators", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "Multisender", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0x116eBFb474C6aa13e1B8b19253fd0E3f226A982f", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + } + ], + "name": "sendEth", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + }, + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "sendTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "withdrawTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "LITToken", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0x81d8f0e945E3Bdc735dA3E19C4Df77a8B91046Cd", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CLOCK_MODE", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAUSER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "cap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint224", + "name": "votes", + "type": "uint224" + } + ], + "internalType": "struct ERC20Votes.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "clock", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PubkeyRouter", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0xbc01f21C58Ca83f25b09338401D53D4c2344D1d9", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "PubkeyRoutingDataSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct IPubkeyRouter.RootKey", + "name": "rootKey", + "type": "tuple" + } + ], + "name": "RootKeySet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "adminResetRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "signedMessage", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + } + ], + "name": "checkNodeSignatures", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "deriveEthAddressFromPubkey", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "ethAddressToPkpId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "getDerivedPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "getRootKeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getRoutingData", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isRouted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "pubkeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingDataAsAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "newRootKeys", + "type": "tuple[]" + } + ], + "name": "voteForRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPNFT", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0x02C4242F72d62c8fEF2b2DB088A35a9F4ec741C7", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "MintCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "PKPMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "claimAndMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextDerivedKeyId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftMetadataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mintCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "mintGrantAndBurnNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "name": "mintNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "redeemedFreeMintIds", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "setMintCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "RateLimitNFT", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0x1A12D5B3D6A52B3bDe0468900795D35ce994ac2b", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "AdditionalRequestsPerKilosecondCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "FreeRequestsPerRateLimitWindowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RLIHolderRateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "setAdditionalRequestsPerKilosecondCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "setFreeRequestsPerRateLimitWindow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxExpirationSeconds", + "type": "uint256" + } + ], + "name": "setMaxExpirationSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "setMaxRequestsPerKilosecond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRLIHolderRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "RLIHolderRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "additionalRequestsPerKilosecondCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "payingAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "capacity", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "internalType": "struct LibRateLimitNFTStorage.RateLimit", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestedRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "checkBelowMaxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentSoldRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMintSigTest", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeRequestsPerRateLimitWindow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isExpired", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxExpirationSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + } + ], + "name": "redeemedFreeMints", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tokenIdCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenSVG", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "totalSoldRequestsPerKilosecondByExpirationTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPHelper", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0xCa9C62fB4ceA8831eBb6fD9fE747Cc372515CF7f", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainWalletRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPKPNftMetdataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddDomainWalletMetadata", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removePkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + } + ], + "name": "setPkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPPermissions", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0xf64638F1eb3b064f5443F7c9e2Dc050ed535D891", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "RootHashUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod", + "name": "authMethod", + "type": "tuple" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "addPermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToAdd", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToAdd", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeysToAdd", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopesToAdd", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToRemove", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToRemove", + "type": "bytes[]" + } + ], + "name": "batchAddRemoveAuthMethods", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getAuthMethodId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedActions", + "outputs": [ + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxScopeId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethodScopes", + "outputs": [ + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethods", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getTokenIdsForAuthMethod", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getUserPubkeyForAuthMethod", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "isPermittedAction", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "isPermittedAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "isPermittedAuthMethod", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "isPermittedAuthMethodScopePresent", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "removePermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "removePermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "removePermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "removePermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "setRootHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bytes32", + "name": "leaf", + "type": "bytes32" + } + ], + "name": "verifyState", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bool[]", + "name": "proofFlags", + "type": "bool[]" + }, + { + "internalType": "bytes32[]", + "name": "leaves", + "type": "bytes32[]" + } + ], + "name": "verifyStates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPNFTMetadata", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0x784A743bBBB5f5225CeC7979A3304179be17D66d", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "buffer", + "type": "bytes" + } + ], + "name": "bytesToHex", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeProfileForPkp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "imgUrl", + "type": "string" + } + ], + "name": "setProfileForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "url", + "type": "string" + } + ], + "name": "setUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubKey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "Allowlist", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0xC60051658E346554C1F572ef3Aa4bD8596E026b6", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemNotAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "allowAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "allowedItems", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "isAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_allowAll", + "type": "bool" + } + ], + "name": "setAllowAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setNotAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PaymentDelegation", + "contracts": [ + { + "network": "datil-dev", + "address_hash": "0xbB23168855efe735cE9e6fD6877bAf13E02c410f", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibPaymentDelegationStorage.Restriction", + "name": "restriction", + "type": "tuple" + } + ], + "name": "RestrictionSet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "delegatePayments", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + } + ], + "name": "delegatePaymentsBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getPayers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + } + ], + "name": "getPayersAndRestrictions", + "outputs": [ + { + "internalType": "address[][]", + "name": "", + "type": "address[][]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "internalType": "struct LibPaymentDelegationStorage.Restriction[][]", + "name": "", + "type": "tuple[][]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "payer", + "type": "address" + } + ], + "name": "getRestriction", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "internalType": "struct LibPaymentDelegationStorage.Restriction", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "payer", + "type": "address" + } + ], + "name": "getUsers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "setDefaultRestriction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "internalType": "struct LibPaymentDelegationStorage.Restriction", + "name": "r", + "type": "tuple" + } + ], + "name": "setRestriction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "undelegatePayments", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + } + ], + "name": "undelegatePaymentsBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + } + ] +}; + +// node_modules/@lit-protocol/contracts/dist/prod/datil-test.js +init_shim(); +var datilTest = { + "config": { + "chainId": "175188", + "rpcUrl": "https://yellowstone-rpc.litprotocol.com", + "chainName": "yellowstone", + "litNodeDomainName": "127.0.0.1", + "litNodePort": 7470, + "rocketPort": 7470 + }, + "data": [ + { + "name": "StakingBalances", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0xCa3c64e7D8cA743aeD2B2d20DCA3233f400710E2", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "AliasNotOwnedBySender", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "CannotRemoveAliasOfActiveValidator", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "aliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountReached", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "OnlyStakingContract", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeGreaterThanMinimumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maximumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeLessThanMaximumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "MaximumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "MinimumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "permittedStakersOn", + "type": "bool" + } + ], + "name": "PermittedStakersOnChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + } + ], + "name": "TokenRewardPerTokenPerEpochSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "ValidatorNotRewardedBecauseAlias", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorRewarded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorTokensPenalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "addAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "addPermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "stakers", + "type": "address[]" + } + ], + "name": "addPermittedStakers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "checkStakingAmounts", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "isPermittedStaker", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "penalizeTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "permittedStakersOn", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "removeAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "removePermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "restakePenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "setMaxAliasCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "setMaximumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "setMinimumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "permitted", + "type": "bool" + } + ], + "name": "setPermittedStakersOn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "transferPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "withdrawPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "Staking", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0xdec37933239846834b3BfD408913Ed3dbEf6588F", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [], + "name": "CannotKickBelowCurrentValidatorThreshold", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingAddress", + "type": "address" + } + ], + "name": "CannotRejoinUntilNextEpochBecauseKicked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "CannotReuseCommsKeys", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "CannotVoteTwice", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "CouldNotMapNodeAddressToStakerAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedOrPausedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "MustBeValidatorInNextEpochToKick", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsInNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCountToBeReady", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsReadyForNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentEpochNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receivedEpochNumber", + "type": "uint256" + } + ], + "name": "SignaledReadyForWrongEpochNumber", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "internalType": "address[]", + "name": "validatorsInNextEpoch", + "type": "address[]" + } + ], + "name": "ValidatorIsNotInNextEpoch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "ComplaintConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "newKeyTypes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumValidatorCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxConcurrentRequests", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPeerCheckingIntervalSecs", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleConcurrency", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "newRpcHealthcheckEnabled", + "type": "bool" + } + ], + "name": "ConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "EpochEndTimeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "EpochLengthSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "EpochTimeoutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "KickPenaltyPercentSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "ReadyForNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToJoin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToLeave", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverContractAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newDuration", + "type": "uint256" + } + ], + "name": "RewardsDurationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newStakingTokenAddress", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "StateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountBurned", + "type": "uint256" + } + ], + "name": "ValidatorKickedFromNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "ValidatorRejoinedNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reporter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "VotedToKickValidatorInNextEpoch", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + } + ], + "name": "adminKickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "adminRejoinValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "adminResetEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToPenalize", + "type": "uint256" + } + ], + "name": "adminSlashValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "advanceEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "kickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lockValidatorsForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "requestToJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeave", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeaveAsNode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "setComplaintConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "rpcHealthcheckEnabled", + "type": "bool" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "newConfig", + "type": "tuple" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "setEpochEndTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "setEpochLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "setEpochState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "setEpochTimeout", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "setIpPortNodeAddressAndCommunicationPubKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "setKickPenaltyPercent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "signalReadyForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "stakeAndJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "VersionRequirementsUpdated", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "checkVersion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMaxVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMinVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "complaintConfig", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "config", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "rpcHealthcheckEnabled", + "type": "bool" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfCurrentValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfNextValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "retries", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveUnkickedValidatorStructs", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveUnkickedValidatorStructsAndCounts", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "retries", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Epoch", + "name": "", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveUnkickedValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKeyTypes", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKickedValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getNodeStakerAddressMappings", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "internalType": "struct LibStakingStorage.AddressMapping[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingBalancesAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpochLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInNextEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getValidatorsStructs", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInCurrentEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInNextEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + }, + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "voterStakerAddress", + "type": "address" + } + ], + "name": "getVotingStatusToKickValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidatorByNodeAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isReadyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "kickPenaltyPercentByReason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "nodeAddressToStakerAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "readyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "shouldKickValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "state", + "outputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "validators", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "Multisender", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0x8281f3A62f7de320B3a634e6814BeC36a1AA92bd", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + } + ], + "name": "sendEth", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + }, + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "sendTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "withdrawTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "LITToken", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0xFA1208f5275a01Be1b4A6F6764d388FDcF5Bf85e", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CLOCK_MODE", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAUSER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "cap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint224", + "name": "votes", + "type": "uint224" + } + ], + "internalType": "struct ERC20Votes.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "clock", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PubkeyRouter", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0x65C3d057aef28175AfaC61a74cc6b27E88405583", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "PubkeyRoutingDataSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct IPubkeyRouter.RootKey", + "name": "rootKey", + "type": "tuple" + } + ], + "name": "RootKeySet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "adminResetRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "signedMessage", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + } + ], + "name": "checkNodeSignatures", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "deriveEthAddressFromPubkey", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "ethAddressToPkpId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "getDerivedPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "getRootKeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getRoutingData", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isRouted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "pubkeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingDataAsAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "newRootKeys", + "type": "tuple[]" + } + ], + "name": "voteForRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPNFT", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0x6a0f439f064B7167A8Ea6B22AcC07ae5360ee0d1", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "MintCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "PKPMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "claimAndMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextDerivedKeyId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftMetadataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mintCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "mintGrantAndBurnNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "name": "mintNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "redeemedFreeMintIds", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "setMintCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "RateLimitNFT", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0xa17f11B7f828EEc97926E56D98D5AB63A0231b77", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "AdditionalRequestsPerKilosecondCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "FreeRequestsPerRateLimitWindowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RLIHolderRateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "setAdditionalRequestsPerKilosecondCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "setFreeRequestsPerRateLimitWindow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxExpirationSeconds", + "type": "uint256" + } + ], + "name": "setMaxExpirationSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "setMaxRequestsPerKilosecond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRLIHolderRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "RLIHolderRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "additionalRequestsPerKilosecondCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "payingAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "capacity", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "internalType": "struct LibRateLimitNFTStorage.RateLimit", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestedRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "checkBelowMaxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentSoldRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMintSigTest", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeRequestsPerRateLimitWindow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isExpired", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxExpirationSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + } + ], + "name": "redeemedFreeMints", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tokenIdCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenSVG", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "totalSoldRequestsPerKilosecondByExpirationTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPHelper", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0x341E5273E2E2ea3c4aDa4101F008b1261E58510D", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainWalletRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPKPNftMetdataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddDomainWalletMetadata", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removePkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + } + ], + "name": "setPkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPPermissions", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0x60C1ddC8b9e38F730F0e7B70A2F84C1A98A69167", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "RootHashUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod", + "name": "authMethod", + "type": "tuple" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "addPermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToAdd", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToAdd", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeysToAdd", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopesToAdd", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToRemove", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToRemove", + "type": "bytes[]" + } + ], + "name": "batchAddRemoveAuthMethods", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getAuthMethodId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedActions", + "outputs": [ + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxScopeId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethodScopes", + "outputs": [ + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethods", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getTokenIdsForAuthMethod", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getUserPubkeyForAuthMethod", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "isPermittedAction", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "isPermittedAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "isPermittedAuthMethod", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "isPermittedAuthMethodScopePresent", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "removePermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "removePermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "removePermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "removePermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "setRootHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bytes32", + "name": "leaf", + "type": "bytes32" + } + ], + "name": "verifyState", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bool[]", + "name": "proofFlags", + "type": "bool[]" + }, + { + "internalType": "bytes32[]", + "name": "leaves", + "type": "bytes32[]" + } + ], + "name": "verifyStates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "PKPNFTMetadata", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0xaC1d01692EBA0E457134Eb7EB8bb96ee9D91FcdD", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "buffer", + "type": "bytes" + } + ], + "name": "bytesToHex", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeProfileForPkp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "imgUrl", + "type": "string" + } + ], + "name": "setProfileForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "url", + "type": "string" + } + ], + "name": "setUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubKey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + } + ] + }, + { + "name": "Allowlist", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0x5DD7a0FD581aB11a5720bE7E388e63346bC266fe", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemNotAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "allowAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "allowedItems", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "isAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_allowAll", + "type": "bool" + } + ], + "name": "setAllowAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setNotAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + }, + { + "name": "PaymentDelegation", + "contracts": [ + { + "network": "datil-test", + "address_hash": "0xd7188e0348F1dA8c9b3d6e614844cbA22329B99E", + "inserted_at": "2024-08-11T20:01:44Z", + "ABI": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibPaymentDelegationStorage.Restriction", + "name": "restriction", + "type": "tuple" + } + ], + "name": "RestrictionSet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "delegatePayments", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + } + ], + "name": "delegatePaymentsBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getPayers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + } + ], + "name": "getPayersAndRestrictions", + "outputs": [ + { + "internalType": "address[][]", + "name": "", + "type": "address[][]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "internalType": "struct LibPaymentDelegationStorage.Restriction[][]", + "name": "", + "type": "tuple[][]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "payer", + "type": "address" + } + ], + "name": "getRestriction", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "internalType": "struct LibPaymentDelegationStorage.Restriction", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "payer", + "type": "address" + } + ], + "name": "getUsers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "setDefaultRestriction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "periodSeconds", + "type": "uint256" + } + ], + "internalType": "struct LibPaymentDelegationStorage.Restriction", + "name": "r", + "type": "tuple" + } + ], + "name": "setRestriction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "undelegatePayments", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "users", + "type": "address[]" + } + ], + "name": "undelegatePaymentsBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] + } + ] + } + ] +}; + +// node_modules/@lit-protocol/contracts/dist/prod/habanero.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/prod/internalDev.js +init_shim(); + +// node_modules/@lit-protocol/contracts/dist/prod/manzano.js +init_shim(); + +// packages/constants/src/lib/constants/mappers.ts +var deprecated2 = depd2("lit-js-sdk:constants:mappers"); +var NETWORK_CONTEXT_BY_NETWORK = { + "datil-dev": datilDev, + "datil-test": datilTest, + datil, + // just use datil dev abis for custom + custom: datilDev +}; +var GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK = { + "datil-dev": false, + "datil-test": false, + datil: false, + custom: false +}; + +// packages/constants/src/lib/constants/endpoints.ts +init_shim(); +var LIT_ENDPOINT_VERSION = { + V0: "/", + V1: "/v1" +}; +var LIT_ENDPOINT = { + HANDSHAKE: { + path: "/web/handshake", + version: LIT_ENDPOINT_VERSION.V0 + }, + SIGN_SESSION_KEY: { + path: "/web/sign_session_key", + version: LIT_ENDPOINT_VERSION.V1 + }, + EXECUTE_JS: { + path: "/web/execute", + version: LIT_ENDPOINT_VERSION.V1 + }, + PKP_SIGN: { + path: "/web/pkp/sign", + version: LIT_ENDPOINT_VERSION.V1 + }, + PKP_CLAIM: { + path: "/web/pkp/claim", + version: LIT_ENDPOINT_VERSION.V0 + }, + SIGN_ACCS: { + path: "/web/signing/access_control_condition", + version: LIT_ENDPOINT_VERSION.V0 + }, + ENCRYPTION_SIGN: { + path: "/web/encryption/sign", + version: LIT_ENDPOINT_VERSION.V0 + } +}; + +// packages/constants/src/lib/interfaces/i-errors.ts +init_shim(); + +// packages/constants/src/lib/errors.ts +init_shim(); +import { VError } from "@openagenda/verror"; +import depd3 from "depd"; +var deprecated3 = depd3("lit-js-sdk:constants:errors"); +var LIT_ERROR_KIND = { + Unknown: "Unknown", + Unexpected: "Unexpected", + Generic: "Generic", + Config: "Config", + Validation: "Validation", + Conversion: "Conversion", + Parser: "Parser", + Serializer: "Serializer", + Timeout: "Timeout" +}; +var LitErrorKind = new Proxy(LIT_ERROR_KIND, { + get(target, prop, receiver) { + deprecated3( + "LitErrorKind is deprecated and will be removed in a future version. Use LIT_ERROR_KIND instead." + ); + return Reflect.get(target, prop, receiver); + } +}); +var LIT_ERROR = { + INVALID_PARAM_TYPE: { + name: "InvalidParamType", + code: "invalid_param_type", + kind: LIT_ERROR_KIND.Validation + }, + INVALID_ACCESS_CONTROL_CONDITIONS: { + name: "InvalidAccessControlConditions", + code: "invalid_access_control_conditions", + kind: LIT_ERROR_KIND.Validation + }, + WRONG_NETWORK_EXCEPTION: { + name: "WrongNetworkException", + code: "wrong_network_exception", + kind: LIT_ERROR_KIND.Validation + }, + MINTING_NOT_SUPPORTED: { + name: "MintingNotSupported", + code: "minting_not_supported", + kind: LIT_ERROR_KIND.Validation + }, + UNSUPPORTED_CHAIN_EXCEPTION: { + name: "UnsupportedChainException", + code: "unsupported_chain_exception", + kind: LIT_ERROR_KIND.Validation + }, + INVALID_UNIFIED_CONDITION_TYPE: { + name: "InvalidUnifiedConditionType", + code: "invalid_unified_condition_type", + kind: LIT_ERROR_KIND.Validation + }, + LIT_NODE_CLIENT_NOT_READY_ERROR: { + name: "LitNodeClientNotReadyError", + code: "lit_node_client_not_ready_error", + kind: LIT_ERROR_KIND.Unexpected + }, + UNAUTHORIZED_EXCEPTION: { + name: "UnauthorizedException", + code: "unauthorized_exception", + kind: LIT_ERROR_KIND.Validation + }, + INVALID_ARGUMENT_EXCEPTION: { + name: "InvalidArgumentException", + code: "invalid_argument_exception", + kind: LIT_ERROR_KIND.Validation + }, + INVALID_BOOLEAN_EXCEPTION: { + name: "InvalidBooleanException", + code: "invalid_boolean_exception", + kind: LIT_ERROR_KIND.Validation + }, + UNKNOWN_ERROR: { + name: "UnknownError", + code: "unknown_error", + kind: LIT_ERROR_KIND.Unknown + }, + NO_WALLET_EXCEPTION: { + name: "NoWalletException", + code: "no_wallet_exception", + kind: LIT_ERROR_KIND.Validation + }, + WRONG_PARAM_FORMAT: { + name: "WrongParamFormat", + code: "wrong_param_format", + kind: LIT_ERROR_KIND.Validation + }, + LOCAL_STORAGE_ITEM_NOT_FOUND_EXCEPTION: { + name: "LocalStorageItemNotFoundException", + code: "local_storage_item_not_found_exception", + kind: LIT_ERROR_KIND.Unexpected + }, + LOCAL_STORAGE_ITEM_NOT_SET_EXCEPTION: { + name: "LocalStorageItemNotSetException", + code: "local_storage_item_not_set_exception", + kind: LIT_ERROR_KIND.Unexpected + }, + LOCAL_STORAGE_ITEM_NOT_REMOVED_EXCEPTION: { + name: "LocalStorageItemNotRemovedException", + code: "local_storage_item_not_removed_exception", + kind: LIT_ERROR_KIND.Unexpected + }, + REMOVED_FUNCTION_ERROR: { + name: "RemovedFunctionError", + code: "removed_function_error", + kind: LIT_ERROR_KIND.Validation + }, + UNSUPPORTED_METHOD_ERROR: { + name: "UnsupportedMethodError", + code: "unsupported_method_error", + kind: LIT_ERROR_KIND.Validation + }, + LIT_NODE_CLIENT_BAD_CONFIG_ERROR: { + name: "LitNodeClientBadConfigError", + code: "lit_node_client_bad_config_error", + kind: LIT_ERROR_KIND.Config + }, + PARAMS_MISSING_ERROR: { + name: "ParamsMissingError", + code: "params_missing_error", + kind: LIT_ERROR_KIND.Validation + }, + UNKNOWN_SIGNATURE_TYPE: { + name: "UnknownSignatureType", + code: "unknown_signature_type", + kind: LIT_ERROR_KIND.Validation + }, + UNKNOWN_SIGNATURE_ERROR: { + name: "UnknownSignatureError", + code: "unknown_signature_error", + kind: LIT_ERROR_KIND.Validation + }, + INVALID_SIGNATURE_ERROR: { + name: "InvalidSignatureError", + code: "invalid_signature_error", + kind: LIT_ERROR_KIND.Validation + }, + PARAM_NULL_ERROR: { + name: "ParamNullError", + code: "param_null_error", + kind: LIT_ERROR_KIND.Validation + }, + UNKNOWN_DECRYPTION_ALGORITHM_TYPE_ERROR: { + name: "UnknownDecryptionAlgorithmTypeError", + code: "unknown_decryption_algorithm_type_error", + kind: LIT_ERROR_KIND.Validation + }, + WASM_INIT_ERROR: { + name: "WasmInitError", + code: "wasm_init_error", + kind: LIT_ERROR_KIND.Unexpected + }, + NODEJS_EXCEPTION: { + name: "NodejsException", + code: "nodejs_exception", + kind: LIT_ERROR_KIND.Unexpected + }, + NODE_ERROR: { + name: "NodeError", + code: "node_error", + kind: LitErrorKind.Unknown + }, + WALLET_SIGNATURE_NOT_FOUND_ERROR: { + name: "WalletSignatureNotFoundError", + code: "wallet_signature_not_found_error", + kind: LIT_ERROR_KIND.Validation + }, + NO_VALID_SHARES: { + name: "NoValidShares", + code: "no_valid_shares", + kind: LIT_ERROR_KIND.Unexpected + }, + INVALID_NODE_ATTESTATION: { + name: "InvalidNodeAttestation", + code: "invalid_node_attestation", + kind: LIT_ERROR_KIND.Unexpected + }, + INVALID_ETH_BLOCKHASH: { + name: "InvalidEthBlockhash", + code: "invalid_eth_blockhash", + kind: LIT_ERROR_KIND.Unexpected + }, + INVALID_SESSION_SIGS: { + name: "InvalidSessionSigs", + code: "invalid_session_sigs", + kind: LIT_ERROR_KIND.Validation + }, + INIT_ERROR: { + name: "InitError", + code: "init_error", + kind: LIT_ERROR_KIND.Unexpected + }, + NETWORK_ERROR: { + name: "NetworkError", + code: "network_error", + kind: LitErrorKind.Unexpected + }, + TRANSACTION_ERROR: { + name: "TransactionError", + code: "transaction_error", + kind: LitErrorKind.Unexpected + } +}; +var LIT_ERROR_CODE = { + NODE_NOT_AUTHORIZED: "NodeNotAuthorized" +}; +var LitError = class extends VError { + constructor(options, message, ...params) { + super(options, message, ...params); + } +}; +function createErrorClass({ + name, + code: code9, + kind +}) { + return class extends LitError { + // VError has optional options parameter, but we make it required so thrower remembers to pass all the useful info + constructor(options, message, ...params) { + if (options instanceof Error) { + options = { + cause: options + }; + } + if (!(options.cause instanceof Error)) { + options.cause = new Error(options.cause); + } + super( + { + name, + ...options, + meta: { + code: code9, + kind, + ...options.meta + } + }, + message, + ...params + ); + } + }; +} +var errorClasses = {}; +for (const key2 in LIT_ERROR) { + if (key2 in LIT_ERROR) { + const errorDef = LIT_ERROR[key2]; + errorClasses[errorDef.name] = createErrorClass(errorDef); + } +} +var MultiError = VError.MultiError; +var { + InitError, + InvalidAccessControlConditions, + InvalidArgumentException, + InvalidBooleanException, + InvalidEthBlockhash, + InvalidSessionSigs, + InvalidNodeAttestation, + InvalidParamType, + InvalidSignatureError, + InvalidUnifiedConditionType, + LitNodeClientBadConfigError, + LitNodeClientNotReadyError, + LocalStorageItemNotFoundException, + LocalStorageItemNotRemovedException, + LocalStorageItemNotSetException, + MintingNotSupported, + NetworkError, + NoValidShares, + NoWalletException, + NodeError, + NodejsException, + ParamNullError, + ParamsMissingError, + RemovedFunctionError, + TransactionError, + UnauthorizedException, + UnknownDecryptionAlgorithmTypeError, + UnknownError, + UnknownSignatureError, + UnknownSignatureType, + UnsupportedChainException, + UnsupportedMethodError, + WalletSignatureNotFoundError, + WasmInitError, + WrongNetworkException, + WrongParamFormat +} = errorClasses; + +// packages/constants/src/lib/utils/utils.ts +init_shim(); +function ELeft(error) { + return { + type: EITHER_TYPE.ERROR, + result: error + }; +} +function ERight(result) { + return { + type: EITHER_TYPE.SUCCESS, + result + }; +} + +// packages/auth-browser/src/lib/chains/cosmos.ts +init_shim(); + +// packages/misc/src/index.ts +init_shim(); + +// packages/misc/src/lib/addresses.ts +init_shim(); +import { bech32 as bech322 } from "bech32"; +import { createHash } from "crypto"; + +// node_modules/ethers/lib.esm/index.js +init_shim(); + +// node_modules/ethers/lib.esm/ethers.js +var ethers_exports = {}; +__export(ethers_exports, { + BaseContract: () => BaseContract, + BigNumber: () => BigNumber, + Contract: () => Contract, + ContractFactory: () => ContractFactory, + FixedNumber: () => FixedNumber, + Signer: () => Signer, + VoidSigner: () => VoidSigner, + Wallet: () => Wallet, + Wordlist: () => Wordlist, + constants: () => lib_exports7, + errors: () => ErrorCode, + getDefaultProvider: () => getDefaultProvider, + logger: () => logger46, + providers: () => lib_exports21, + utils: () => utils_exports, + version: () => version27, + wordlists: () => wordlists +}); +init_shim(); + +// node_modules/@ethersproject/contracts/lib.esm/index.js +init_shim(); +init_lib13(); +init_lib14(); +init_lib15(); +init_lib7(); +init_lib3(); +init_lib2(); +init_lib4(); +init_lib17(); +init_lib(); + +// node_modules/@ethersproject/contracts/lib.esm/_version.js +init_shim(); +var version15 = "contracts/5.7.0"; + +// node_modules/@ethersproject/contracts/lib.esm/index.js +var __awaiter5 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var logger19 = new Logger(version15); +var allowedTransactionKeys3 = { + chainId: true, + data: true, + from: true, + gasLimit: true, + gasPrice: true, + nonce: true, + to: true, + value: true, + type: true, + accessList: true, + maxFeePerGas: true, + maxPriorityFeePerGas: true, + customData: true, + ccipReadEnabled: true +}; +function resolveName(resolver, nameOrPromise) { + return __awaiter5(this, void 0, void 0, function* () { + const name = yield nameOrPromise; + if (typeof name !== "string") { + logger19.throwArgumentError("invalid address or ENS name", "name", name); + } + try { + return getAddress(name); + } catch (error) { + } + if (!resolver) { + logger19.throwError("a provider or signer is needed to resolve ENS names", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName" + }); + } + const address = yield resolver.resolveName(name); + if (address == null) { + logger19.throwArgumentError("resolver or addr is not configured for ENS name", "name", name); + } + return address; + }); +} +function resolveAddresses(resolver, value, paramType) { + return __awaiter5(this, void 0, void 0, function* () { + if (Array.isArray(paramType)) { + return yield Promise.all(paramType.map((paramType2, index) => { + return resolveAddresses(resolver, Array.isArray(value) ? value[index] : value[paramType2.name], paramType2); + })); + } + if (paramType.type === "address") { + return yield resolveName(resolver, value); + } + if (paramType.type === "tuple") { + return yield resolveAddresses(resolver, value, paramType.components); + } + if (paramType.baseType === "array") { + if (!Array.isArray(value)) { + return Promise.reject(logger19.makeError("invalid value for array", Logger.errors.INVALID_ARGUMENT, { + argument: "value", + value + })); + } + return yield Promise.all(value.map((v) => resolveAddresses(resolver, v, paramType.arrayChildren))); + } + return value; + }); +} +function populateTransaction(contract, fragment, args) { + return __awaiter5(this, void 0, void 0, function* () { + let overrides = {}; + if (args.length === fragment.inputs.length + 1 && typeof args[args.length - 1] === "object") { + overrides = shallowCopy(args.pop()); + } + logger19.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); + if (contract.signer) { + if (overrides.from) { + overrides.from = resolveProperties({ + override: resolveName(contract.signer, overrides.from), + signer: contract.signer.getAddress() + }).then((check) => __awaiter5(this, void 0, void 0, function* () { + if (getAddress(check.signer) !== check.override) { + logger19.throwError("Contract with a Signer cannot override from", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.from" + }); + } + return check.override; + })); + } else { + overrides.from = contract.signer.getAddress(); + } + } else if (overrides.from) { + overrides.from = resolveName(contract.provider, overrides.from); + } + const resolved = yield resolveProperties({ + args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs), + address: contract.resolvedAddress, + overrides: resolveProperties(overrides) || {} + }); + const data = contract.interface.encodeFunctionData(fragment, resolved.args); + const tx = { + data, + to: resolved.address + }; + const ro = resolved.overrides; + if (ro.nonce != null) { + tx.nonce = BigNumber.from(ro.nonce).toNumber(); + } + if (ro.gasLimit != null) { + tx.gasLimit = BigNumber.from(ro.gasLimit); + } + if (ro.gasPrice != null) { + tx.gasPrice = BigNumber.from(ro.gasPrice); + } + if (ro.maxFeePerGas != null) { + tx.maxFeePerGas = BigNumber.from(ro.maxFeePerGas); + } + if (ro.maxPriorityFeePerGas != null) { + tx.maxPriorityFeePerGas = BigNumber.from(ro.maxPriorityFeePerGas); + } + if (ro.from != null) { + tx.from = ro.from; + } + if (ro.type != null) { + tx.type = ro.type; + } + if (ro.accessList != null) { + tx.accessList = accessListify(ro.accessList); + } + if (tx.gasLimit == null && fragment.gas != null) { + let intrinsic = 21e3; + const bytes = arrayify(data); + for (let i2 = 0; i2 < bytes.length; i2++) { + intrinsic += 4; + if (bytes[i2]) { + intrinsic += 64; + } + } + tx.gasLimit = BigNumber.from(fragment.gas).add(intrinsic); + } + if (ro.value) { + const roValue = BigNumber.from(ro.value); + if (!roValue.isZero() && !fragment.payable) { + logger19.throwError("non-payable method cannot override value", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.value", + value: overrides.value + }); + } + tx.value = roValue; + } + if (ro.customData) { + tx.customData = shallowCopy(ro.customData); + } + if (ro.ccipReadEnabled) { + tx.ccipReadEnabled = !!ro.ccipReadEnabled; + } + delete overrides.nonce; + delete overrides.gasLimit; + delete overrides.gasPrice; + delete overrides.from; + delete overrides.value; + delete overrides.type; + delete overrides.accessList; + delete overrides.maxFeePerGas; + delete overrides.maxPriorityFeePerGas; + delete overrides.customData; + delete overrides.ccipReadEnabled; + const leftovers = Object.keys(overrides).filter((key2) => overrides[key2] != null); + if (leftovers.length) { + logger19.throwError(`cannot override ${leftovers.map((l2) => JSON.stringify(l2)).join(",")}`, Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides", + overrides: leftovers + }); + } + return tx; + }); +} +function buildPopulate(contract, fragment) { + return function(...args) { + return populateTransaction(contract, fragment, args); + }; +} +function buildEstimate(contract, fragment) { + const signerOrProvider = contract.signer || contract.provider; + return function(...args) { + return __awaiter5(this, void 0, void 0, function* () { + if (!signerOrProvider) { + logger19.throwError("estimate require a provider or signer", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "estimateGas" + }); + } + const tx = yield populateTransaction(contract, fragment, args); + return yield signerOrProvider.estimateGas(tx); + }); + }; +} +function addContractWait(contract, tx) { + const wait = tx.wait.bind(tx); + tx.wait = (confirmations) => { + return wait(confirmations).then((receipt) => { + receipt.events = receipt.logs.map((log3) => { + let event = deepCopy(log3); + let parsed = null; + try { + parsed = contract.interface.parseLog(log3); + } catch (e2) { + } + if (parsed) { + event.args = parsed.args; + event.decode = (data, topics) => { + return contract.interface.decodeEventLog(parsed.eventFragment, data, topics); + }; + event.event = parsed.name; + event.eventSignature = parsed.signature; + } + event.removeListener = () => { + return contract.provider; + }; + event.getBlock = () => { + return contract.provider.getBlock(receipt.blockHash); + }; + event.getTransaction = () => { + return contract.provider.getTransaction(receipt.transactionHash); + }; + event.getTransactionReceipt = () => { + return Promise.resolve(receipt); + }; + return event; + }); + return receipt; + }); + }; +} +function buildCall(contract, fragment, collapseSimple) { + const signerOrProvider = contract.signer || contract.provider; + return function(...args) { + return __awaiter5(this, void 0, void 0, function* () { + let blockTag = void 0; + if (args.length === fragment.inputs.length + 1 && typeof args[args.length - 1] === "object") { + const overrides = shallowCopy(args.pop()); + if (overrides.blockTag != null) { + blockTag = yield overrides.blockTag; + } + delete overrides.blockTag; + args.push(overrides); + } + if (contract.deployTransaction != null) { + yield contract._deployed(blockTag); + } + const tx = yield populateTransaction(contract, fragment, args); + const result = yield signerOrProvider.call(tx, blockTag); + try { + let value = contract.interface.decodeFunctionResult(fragment, result); + if (collapseSimple && fragment.outputs.length === 1) { + value = value[0]; + } + return value; + } catch (error) { + if (error.code === Logger.errors.CALL_EXCEPTION) { + error.address = contract.address; + error.args = args; + error.transaction = tx; + } + throw error; + } + }); + }; +} +function buildSend(contract, fragment) { + return function(...args) { + return __awaiter5(this, void 0, void 0, function* () { + if (!contract.signer) { + logger19.throwError("sending a transaction requires a signer", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "sendTransaction" + }); + } + if (contract.deployTransaction != null) { + yield contract._deployed(); + } + const txRequest = yield populateTransaction(contract, fragment, args); + const tx = yield contract.signer.sendTransaction(txRequest); + addContractWait(contract, tx); + return tx; + }); + }; +} +function buildDefault(contract, fragment, collapseSimple) { + if (fragment.constant) { + return buildCall(contract, fragment, collapseSimple); + } + return buildSend(contract, fragment); +} +function getEventTag(filter) { + if (filter.address && (filter.topics == null || filter.topics.length === 0)) { + return "*"; + } + return (filter.address || "*") + "@" + (filter.topics ? filter.topics.map((topic) => { + if (Array.isArray(topic)) { + return topic.join("|"); + } + return topic; + }).join(":") : ""); +} +var RunningEvent = class { + constructor(tag, filter) { + defineReadOnly(this, "tag", tag); + defineReadOnly(this, "filter", filter); + this._listeners = []; + } + addListener(listener, once) { + this._listeners.push({ listener, once }); + } + removeListener(listener) { + let done = false; + this._listeners = this._listeners.filter((item) => { + if (done || item.listener !== listener) { + return true; + } + done = true; + return false; + }); + } + removeAllListeners() { + this._listeners = []; + } + listeners() { + return this._listeners.map((i2) => i2.listener); + } + listenerCount() { + return this._listeners.length; + } + run(args) { + const listenerCount = this.listenerCount(); + this._listeners = this._listeners.filter((item) => { + const argsCopy = args.slice(); + setTimeout(() => { + item.listener.apply(this, argsCopy); + }, 0); + return !item.once; + }); + return listenerCount; + } + prepareEvent(event) { + } + // Returns the array that will be applied to an emit + getEmit(event) { + return [event]; + } +}; +var ErrorRunningEvent = class extends RunningEvent { + constructor() { + super("error", null); + } +}; +var FragmentRunningEvent = class extends RunningEvent { + constructor(address, contractInterface, fragment, topics) { + const filter = { + address + }; + let topic = contractInterface.getEventTopic(fragment); + if (topics) { + if (topic !== topics[0]) { + logger19.throwArgumentError("topic mismatch", "topics", topics); + } + filter.topics = topics.slice(); + } else { + filter.topics = [topic]; + } + super(getEventTag(filter), filter); + defineReadOnly(this, "address", address); + defineReadOnly(this, "interface", contractInterface); + defineReadOnly(this, "fragment", fragment); + } + prepareEvent(event) { + super.prepareEvent(event); + event.event = this.fragment.name; + event.eventSignature = this.fragment.format(); + event.decode = (data, topics) => { + return this.interface.decodeEventLog(this.fragment, data, topics); + }; + try { + event.args = this.interface.decodeEventLog(this.fragment, event.data, event.topics); + } catch (error) { + event.args = null; + event.decodeError = error; + } + } + getEmit(event) { + const errors = checkResultErrors(event.args); + if (errors.length) { + throw errors[0].error; + } + const args = (event.args || []).slice(); + args.push(event); + return args; + } +}; +var WildcardRunningEvent = class extends RunningEvent { + constructor(address, contractInterface) { + super("*", { address }); + defineReadOnly(this, "address", address); + defineReadOnly(this, "interface", contractInterface); + } + prepareEvent(event) { + super.prepareEvent(event); + try { + const parsed = this.interface.parseLog(event); + event.event = parsed.name; + event.eventSignature = parsed.signature; + event.decode = (data, topics) => { + return this.interface.decodeEventLog(parsed.eventFragment, data, topics); + }; + event.args = parsed.args; + } catch (error) { + } + } +}; +var BaseContract = class { + constructor(addressOrName, contractInterface, signerOrProvider) { + defineReadOnly(this, "interface", getStatic(new.target, "getInterface")(contractInterface)); + if (signerOrProvider == null) { + defineReadOnly(this, "provider", null); + defineReadOnly(this, "signer", null); + } else if (Signer.isSigner(signerOrProvider)) { + defineReadOnly(this, "provider", signerOrProvider.provider || null); + defineReadOnly(this, "signer", signerOrProvider); + } else if (Provider.isProvider(signerOrProvider)) { + defineReadOnly(this, "provider", signerOrProvider); + defineReadOnly(this, "signer", null); + } else { + logger19.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider); + } + defineReadOnly(this, "callStatic", {}); + defineReadOnly(this, "estimateGas", {}); + defineReadOnly(this, "functions", {}); + defineReadOnly(this, "populateTransaction", {}); + defineReadOnly(this, "filters", {}); + { + const uniqueFilters = {}; + Object.keys(this.interface.events).forEach((eventSignature) => { + const event = this.interface.events[eventSignature]; + defineReadOnly(this.filters, eventSignature, (...args) => { + return { + address: this.address, + topics: this.interface.encodeFilterTopics(event, args) + }; + }); + if (!uniqueFilters[event.name]) { + uniqueFilters[event.name] = []; + } + uniqueFilters[event.name].push(eventSignature); + }); + Object.keys(uniqueFilters).forEach((name) => { + const filters = uniqueFilters[name]; + if (filters.length === 1) { + defineReadOnly(this.filters, name, this.filters[filters[0]]); + } else { + logger19.warn(`Duplicate definition of ${name} (${filters.join(", ")})`); + } + }); + } + defineReadOnly(this, "_runningEvents", {}); + defineReadOnly(this, "_wrappedEmits", {}); + if (addressOrName == null) { + logger19.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName); + } + defineReadOnly(this, "address", addressOrName); + if (this.provider) { + defineReadOnly(this, "resolvedAddress", resolveName(this.provider, addressOrName)); + } else { + try { + defineReadOnly(this, "resolvedAddress", Promise.resolve(getAddress(addressOrName))); + } catch (error) { + logger19.throwError("provider is required to use ENS name as contract address", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new Contract" + }); + } + } + this.resolvedAddress.catch((e2) => { + }); + const uniqueNames = {}; + const uniqueSignatures = {}; + Object.keys(this.interface.functions).forEach((signature2) => { + const fragment = this.interface.functions[signature2]; + if (uniqueSignatures[signature2]) { + logger19.warn(`Duplicate ABI entry for ${JSON.stringify(signature2)}`); + return; + } + uniqueSignatures[signature2] = true; + { + const name = fragment.name; + if (!uniqueNames[`%${name}`]) { + uniqueNames[`%${name}`] = []; + } + uniqueNames[`%${name}`].push(signature2); + } + if (this[signature2] == null) { + defineReadOnly(this, signature2, buildDefault(this, fragment, true)); + } + if (this.functions[signature2] == null) { + defineReadOnly(this.functions, signature2, buildDefault(this, fragment, false)); + } + if (this.callStatic[signature2] == null) { + defineReadOnly(this.callStatic, signature2, buildCall(this, fragment, true)); + } + if (this.populateTransaction[signature2] == null) { + defineReadOnly(this.populateTransaction, signature2, buildPopulate(this, fragment)); + } + if (this.estimateGas[signature2] == null) { + defineReadOnly(this.estimateGas, signature2, buildEstimate(this, fragment)); + } + }); + Object.keys(uniqueNames).forEach((name) => { + const signatures = uniqueNames[name]; + if (signatures.length > 1) { + return; + } + name = name.substring(1); + const signature2 = signatures[0]; + try { + if (this[name] == null) { + defineReadOnly(this, name, this[signature2]); + } + } catch (e2) { + } + if (this.functions[name] == null) { + defineReadOnly(this.functions, name, this.functions[signature2]); + } + if (this.callStatic[name] == null) { + defineReadOnly(this.callStatic, name, this.callStatic[signature2]); + } + if (this.populateTransaction[name] == null) { + defineReadOnly(this.populateTransaction, name, this.populateTransaction[signature2]); + } + if (this.estimateGas[name] == null) { + defineReadOnly(this.estimateGas, name, this.estimateGas[signature2]); + } + }); + } + static getContractAddress(transaction) { + return getContractAddress(transaction); + } + static getInterface(contractInterface) { + if (Interface.isInterface(contractInterface)) { + return contractInterface; + } + return new Interface(contractInterface); + } + // @TODO: Allow timeout? + deployed() { + return this._deployed(); + } + _deployed(blockTag) { + if (!this._deployedPromise) { + if (this.deployTransaction) { + this._deployedPromise = this.deployTransaction.wait().then(() => { + return this; + }); + } else { + this._deployedPromise = this.provider.getCode(this.address, blockTag).then((code9) => { + if (code9 === "0x") { + logger19.throwError("contract not deployed", Logger.errors.UNSUPPORTED_OPERATION, { + contractAddress: this.address, + operation: "getDeployed" + }); + } + return this; + }); + } + } + return this._deployedPromise; + } + // @TODO: + // estimateFallback(overrides?: TransactionRequest): Promise + // @TODO: + // estimateDeploy(bytecode: string, ...args): Promise + fallback(overrides) { + if (!this.signer) { + logger19.throwError("sending a transactions require a signer", Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); + } + const tx = shallowCopy(overrides || {}); + ["from", "to"].forEach(function(key2) { + if (tx[key2] == null) { + return; + } + logger19.throwError("cannot override " + key2, Logger.errors.UNSUPPORTED_OPERATION, { operation: key2 }); + }); + tx.to = this.resolvedAddress; + return this.deployed().then(() => { + return this.signer.sendTransaction(tx); + }); + } + // Reconnect to a different signer or provider + connect(signerOrProvider) { + if (typeof signerOrProvider === "string") { + signerOrProvider = new VoidSigner(signerOrProvider, this.provider); + } + const contract = new this.constructor(this.address, this.interface, signerOrProvider); + if (this.deployTransaction) { + defineReadOnly(contract, "deployTransaction", this.deployTransaction); + } + return contract; + } + // Re-attach to a different on-chain instance of this contract + attach(addressOrName) { + return new this.constructor(addressOrName, this.interface, this.signer || this.provider); + } + static isIndexed(value) { + return Indexed.isIndexed(value); + } + _normalizeRunningEvent(runningEvent) { + if (this._runningEvents[runningEvent.tag]) { + return this._runningEvents[runningEvent.tag]; + } + return runningEvent; + } + _getRunningEvent(eventName) { + if (typeof eventName === "string") { + if (eventName === "error") { + return this._normalizeRunningEvent(new ErrorRunningEvent()); + } + if (eventName === "event") { + return this._normalizeRunningEvent(new RunningEvent("event", null)); + } + if (eventName === "*") { + return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface)); + } + const fragment = this.interface.getEvent(eventName); + return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment)); + } + if (eventName.topics && eventName.topics.length > 0) { + try { + const topic = eventName.topics[0]; + if (typeof topic !== "string") { + throw new Error("invalid topic"); + } + const fragment = this.interface.getEvent(topic); + return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics)); + } catch (error) { + } + const filter = { + address: this.address, + topics: eventName.topics + }; + return this._normalizeRunningEvent(new RunningEvent(getEventTag(filter), filter)); + } + return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface)); + } + _checkRunningEvents(runningEvent) { + if (runningEvent.listenerCount() === 0) { + delete this._runningEvents[runningEvent.tag]; + const emit = this._wrappedEmits[runningEvent.tag]; + if (emit && runningEvent.filter) { + this.provider.off(runningEvent.filter, emit); + delete this._wrappedEmits[runningEvent.tag]; + } + } + } + // Subclasses can override this to gracefully recover + // from parse errors if they wish + _wrapEvent(runningEvent, log3, listener) { + const event = deepCopy(log3); + event.removeListener = () => { + if (!listener) { + return; + } + runningEvent.removeListener(listener); + this._checkRunningEvents(runningEvent); + }; + event.getBlock = () => { + return this.provider.getBlock(log3.blockHash); + }; + event.getTransaction = () => { + return this.provider.getTransaction(log3.transactionHash); + }; + event.getTransactionReceipt = () => { + return this.provider.getTransactionReceipt(log3.transactionHash); + }; + runningEvent.prepareEvent(event); + return event; + } + _addEventListener(runningEvent, listener, once) { + if (!this.provider) { + logger19.throwError("events require a provider or a signer with a provider", Logger.errors.UNSUPPORTED_OPERATION, { operation: "once" }); + } + runningEvent.addListener(listener, once); + this._runningEvents[runningEvent.tag] = runningEvent; + if (!this._wrappedEmits[runningEvent.tag]) { + const wrappedEmit = (log3) => { + let event = this._wrapEvent(runningEvent, log3, listener); + if (event.decodeError == null) { + try { + const args = runningEvent.getEmit(event); + this.emit(runningEvent.filter, ...args); + } catch (error) { + event.decodeError = error.error; + } + } + if (runningEvent.filter != null) { + this.emit("event", event); + } + if (event.decodeError != null) { + this.emit("error", event.decodeError, event); + } + }; + this._wrappedEmits[runningEvent.tag] = wrappedEmit; + if (runningEvent.filter != null) { + this.provider.on(runningEvent.filter, wrappedEmit); + } + } + } + queryFilter(event, fromBlockOrBlockhash, toBlock) { + const runningEvent = this._getRunningEvent(event); + const filter = shallowCopy(runningEvent.filter); + if (typeof fromBlockOrBlockhash === "string" && isHexString(fromBlockOrBlockhash, 32)) { + if (toBlock != null) { + logger19.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock); + } + filter.blockHash = fromBlockOrBlockhash; + } else { + filter.fromBlock = fromBlockOrBlockhash != null ? fromBlockOrBlockhash : 0; + filter.toBlock = toBlock != null ? toBlock : "latest"; + } + return this.provider.getLogs(filter).then((logs) => { + return logs.map((log3) => this._wrapEvent(runningEvent, log3, null)); + }); + } + on(event, listener) { + this._addEventListener(this._getRunningEvent(event), listener, false); + return this; + } + once(event, listener) { + this._addEventListener(this._getRunningEvent(event), listener, true); + return this; + } + emit(eventName, ...args) { + if (!this.provider) { + return false; + } + const runningEvent = this._getRunningEvent(eventName); + const result = runningEvent.run(args) > 0; + this._checkRunningEvents(runningEvent); + return result; + } + listenerCount(eventName) { + if (!this.provider) { + return 0; + } + if (eventName == null) { + return Object.keys(this._runningEvents).reduce((accum, key2) => { + return accum + this._runningEvents[key2].listenerCount(); + }, 0); + } + return this._getRunningEvent(eventName).listenerCount(); + } + listeners(eventName) { + if (!this.provider) { + return []; + } + if (eventName == null) { + const result = []; + for (let tag in this._runningEvents) { + this._runningEvents[tag].listeners().forEach((listener) => { + result.push(listener); + }); + } + return result; + } + return this._getRunningEvent(eventName).listeners(); + } + removeAllListeners(eventName) { + if (!this.provider) { + return this; + } + if (eventName == null) { + for (const tag in this._runningEvents) { + const runningEvent2 = this._runningEvents[tag]; + runningEvent2.removeAllListeners(); + this._checkRunningEvents(runningEvent2); + } + return this; + } + const runningEvent = this._getRunningEvent(eventName); + runningEvent.removeAllListeners(); + this._checkRunningEvents(runningEvent); + return this; + } + off(eventName, listener) { + if (!this.provider) { + return this; + } + const runningEvent = this._getRunningEvent(eventName); + runningEvent.removeListener(listener); + this._checkRunningEvents(runningEvent); + return this; + } + removeListener(eventName, listener) { + return this.off(eventName, listener); + } +}; +var Contract = class extends BaseContract { +}; +var ContractFactory = class { + constructor(contractInterface, bytecode, signer) { + let bytecodeHex = null; + if (typeof bytecode === "string") { + bytecodeHex = bytecode; + } else if (isBytes(bytecode)) { + bytecodeHex = hexlify(bytecode); + } else if (bytecode && typeof bytecode.object === "string") { + bytecodeHex = bytecode.object; + } else { + bytecodeHex = "!"; + } + if (bytecodeHex.substring(0, 2) !== "0x") { + bytecodeHex = "0x" + bytecodeHex; + } + if (!isHexString(bytecodeHex) || bytecodeHex.length % 2) { + logger19.throwArgumentError("invalid bytecode", "bytecode", bytecode); + } + if (signer && !Signer.isSigner(signer)) { + logger19.throwArgumentError("invalid signer", "signer", signer); + } + defineReadOnly(this, "bytecode", bytecodeHex); + defineReadOnly(this, "interface", getStatic(new.target, "getInterface")(contractInterface)); + defineReadOnly(this, "signer", signer || null); + } + // @TODO: Future; rename to populateTransaction? + getDeployTransaction(...args) { + let tx = {}; + if (args.length === this.interface.deploy.inputs.length + 1 && typeof args[args.length - 1] === "object") { + tx = shallowCopy(args.pop()); + for (const key2 in tx) { + if (!allowedTransactionKeys3[key2]) { + throw new Error("unknown transaction override " + key2); + } + } + } + ["data", "from", "to"].forEach((key2) => { + if (tx[key2] == null) { + return; + } + logger19.throwError("cannot override " + key2, Logger.errors.UNSUPPORTED_OPERATION, { operation: key2 }); + }); + if (tx.value) { + const value = BigNumber.from(tx.value); + if (!value.isZero() && !this.interface.deploy.payable) { + logger19.throwError("non-payable constructor cannot override value", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.value", + value: tx.value + }); + } + } + logger19.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor"); + tx.data = hexlify(concat([ + this.bytecode, + this.interface.encodeDeploy(args) + ])); + return tx; + } + deploy(...args) { + return __awaiter5(this, void 0, void 0, function* () { + let overrides = {}; + if (args.length === this.interface.deploy.inputs.length + 1) { + overrides = args.pop(); + } + logger19.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor"); + const params = yield resolveAddresses(this.signer, args, this.interface.deploy.inputs); + params.push(overrides); + const unsignedTx = this.getDeployTransaction(...params); + const tx = yield this.signer.sendTransaction(unsignedTx); + const address = getStatic(this.constructor, "getContractAddress")(tx); + const contract = getStatic(this.constructor, "getContract")(address, this.interface, this.signer); + addContractWait(contract, tx); + defineReadOnly(contract, "deployTransaction", tx); + return contract; + }); + } + attach(address) { + return this.constructor.getContract(address, this.interface, this.signer); + } + connect(signer) { + return new this.constructor(this.interface, this.bytecode, signer); + } + static fromSolidity(compilerOutput, signer) { + if (compilerOutput == null) { + logger19.throwError("missing compiler output", Logger.errors.MISSING_ARGUMENT, { argument: "compilerOutput" }); + } + if (typeof compilerOutput === "string") { + compilerOutput = JSON.parse(compilerOutput); + } + const abi = compilerOutput.abi; + let bytecode = null; + if (compilerOutput.bytecode) { + bytecode = compilerOutput.bytecode; + } else if (compilerOutput.evm && compilerOutput.evm.bytecode) { + bytecode = compilerOutput.evm.bytecode; + } + return new this(abi, bytecode, signer); + } + static getInterface(contractInterface) { + return Contract.getInterface(contractInterface); + } + static getContractAddress(tx) { + return getContractAddress(tx); + } + static getContract(address, contractInterface, signer) { + return new Contract(address, contractInterface, signer); + } +}; + +// node_modules/ethers/lib.esm/ethers.js +init_lib3(); +init_lib15(); +init_lib25(); +init_lib8(); + +// node_modules/@ethersproject/providers/lib.esm/index.js +var lib_exports21 = {}; +__export(lib_exports21, { + AlchemyProvider: () => AlchemyProvider, + AlchemyWebSocketProvider: () => AlchemyWebSocketProvider, + AnkrProvider: () => AnkrProvider, + BaseProvider: () => BaseProvider, + CloudflareProvider: () => CloudflareProvider, + EtherscanProvider: () => EtherscanProvider, + FallbackProvider: () => FallbackProvider, + Formatter: () => Formatter, + InfuraProvider: () => InfuraProvider, + InfuraWebSocketProvider: () => InfuraWebSocketProvider, + IpcProvider: () => IpcProvider, + JsonRpcBatchProvider: () => JsonRpcBatchProvider, + JsonRpcProvider: () => JsonRpcProvider, + JsonRpcSigner: () => JsonRpcSigner, + NodesmithProvider: () => NodesmithProvider, + PocketProvider: () => PocketProvider, + Provider: () => Provider, + Resolver: () => Resolver, + StaticJsonRpcProvider: () => StaticJsonRpcProvider, + UrlJsonRpcProvider: () => UrlJsonRpcProvider, + Web3Provider: () => Web3Provider, + WebSocketProvider: () => WebSocketProvider, + getDefaultProvider: () => getDefaultProvider, + getNetwork: () => getNetwork, + isCommunityResourcable: () => isCommunityResourcable, + isCommunityResource: () => isCommunityResource, + showThrottleMessage: () => showThrottleMessage +}); +init_shim(); +init_lib14(); + +// node_modules/@ethersproject/networks/lib.esm/index.js +init_shim(); +init_lib(); + +// node_modules/@ethersproject/networks/lib.esm/_version.js +init_shim(); +var version22 = "networks/5.7.1"; + +// node_modules/@ethersproject/networks/lib.esm/index.js +var logger27 = new Logger(version22); +function isRenetworkable(value) { + return value && typeof value.renetwork === "function"; +} +function ethDefaultProvider(network) { + const func = function(providers, options) { + if (options == null) { + options = {}; + } + const providerList = []; + if (providers.InfuraProvider && options.infura !== "-") { + try { + providerList.push(new providers.InfuraProvider(network, options.infura)); + } catch (error) { + } + } + if (providers.EtherscanProvider && options.etherscan !== "-") { + try { + providerList.push(new providers.EtherscanProvider(network, options.etherscan)); + } catch (error) { + } + } + if (providers.AlchemyProvider && options.alchemy !== "-") { + try { + providerList.push(new providers.AlchemyProvider(network, options.alchemy)); + } catch (error) { + } + } + if (providers.PocketProvider && options.pocket !== "-") { + const skip = ["goerli", "ropsten", "rinkeby", "sepolia"]; + try { + const provider = new providers.PocketProvider(network, options.pocket); + if (provider.network && skip.indexOf(provider.network.name) === -1) { + providerList.push(provider); + } + } catch (error) { + } + } + if (providers.CloudflareProvider && options.cloudflare !== "-") { + try { + providerList.push(new providers.CloudflareProvider(network)); + } catch (error) { + } + } + if (providers.AnkrProvider && options.ankr !== "-") { + try { + const skip = ["ropsten"]; + const provider = new providers.AnkrProvider(network, options.ankr); + if (provider.network && skip.indexOf(provider.network.name) === -1) { + providerList.push(provider); + } + } catch (error) { + } + } + if (providerList.length === 0) { + return null; + } + if (providers.FallbackProvider) { + let quorum = 1; + if (options.quorum != null) { + quorum = options.quorum; + } else if (network === "homestead") { + quorum = 2; + } + return new providers.FallbackProvider(providerList, quorum); + } + return providerList[0]; + }; + func.renetwork = function(network2) { + return ethDefaultProvider(network2); + }; + return func; +} +function etcDefaultProvider(url, network) { + const func = function(providers, options) { + if (providers.JsonRpcProvider) { + return new providers.JsonRpcProvider(url, network); + } + return null; + }; + func.renetwork = function(network2) { + return etcDefaultProvider(url, network2); + }; + return func; +} +var homestead = { + chainId: 1, + ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + name: "homestead", + _defaultProvider: ethDefaultProvider("homestead") +}; +var ropsten = { + chainId: 3, + ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + name: "ropsten", + _defaultProvider: ethDefaultProvider("ropsten") +}; +var classicMordor = { + chainId: 63, + name: "classicMordor", + _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/mordor", "classicMordor") +}; +var networks = { + unspecified: { chainId: 0, name: "unspecified" }, + homestead, + mainnet: homestead, + morden: { chainId: 2, name: "morden" }, + ropsten, + testnet: ropsten, + rinkeby: { + chainId: 4, + ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + name: "rinkeby", + _defaultProvider: ethDefaultProvider("rinkeby") + }, + kovan: { + chainId: 42, + name: "kovan", + _defaultProvider: ethDefaultProvider("kovan") + }, + goerli: { + chainId: 5, + ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + name: "goerli", + _defaultProvider: ethDefaultProvider("goerli") + }, + kintsugi: { chainId: 1337702, name: "kintsugi" }, + sepolia: { + chainId: 11155111, + name: "sepolia", + _defaultProvider: ethDefaultProvider("sepolia") + }, + // ETC (See: #351) + classic: { + chainId: 61, + name: "classic", + _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/etc", "classic") + }, + classicMorden: { chainId: 62, name: "classicMorden" }, + classicMordor, + classicTestnet: classicMordor, + classicKotti: { + chainId: 6, + name: "classicKotti", + _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/kotti", "classicKotti") + }, + xdai: { chainId: 100, name: "xdai" }, + matic: { + chainId: 137, + name: "matic", + _defaultProvider: ethDefaultProvider("matic") + }, + maticmum: { chainId: 80001, name: "maticmum" }, + optimism: { + chainId: 10, + name: "optimism", + _defaultProvider: ethDefaultProvider("optimism") + }, + "optimism-kovan": { chainId: 69, name: "optimism-kovan" }, + "optimism-goerli": { chainId: 420, name: "optimism-goerli" }, + arbitrum: { chainId: 42161, name: "arbitrum" }, + "arbitrum-rinkeby": { chainId: 421611, name: "arbitrum-rinkeby" }, + "arbitrum-goerli": { chainId: 421613, name: "arbitrum-goerli" }, + bnb: { chainId: 56, name: "bnb" }, + bnbt: { chainId: 97, name: "bnbt" } +}; +function getNetwork(network) { + if (network == null) { + return null; + } + if (typeof network === "number") { + for (const name in networks) { + const standard2 = networks[name]; + if (standard2.chainId === network) { + return { + name: standard2.name, + chainId: standard2.chainId, + ensAddress: standard2.ensAddress || null, + _defaultProvider: standard2._defaultProvider || null + }; + } + } + return { + chainId: network, + name: "unknown" + }; + } + if (typeof network === "string") { + const standard2 = networks[network]; + if (standard2 == null) { + return null; + } + return { + name: standard2.name, + chainId: standard2.chainId, + ensAddress: standard2.ensAddress, + _defaultProvider: standard2._defaultProvider || null + }; + } + const standard = networks[network.name]; + if (!standard) { + if (typeof network.chainId !== "number") { + logger27.throwArgumentError("invalid network chainId", "network", network); + } + return network; + } + if (network.chainId !== 0 && network.chainId !== standard.chainId) { + logger27.throwArgumentError("network chainId mismatch", "network", network); + } + let defaultProvider = network._defaultProvider || null; + if (defaultProvider == null && standard._defaultProvider) { + if (isRenetworkable(standard._defaultProvider)) { + defaultProvider = standard._defaultProvider.renetwork(network); + } else { + defaultProvider = standard._defaultProvider; + } + } + return { + name: network.name, + chainId: standard.chainId, + ensAddress: network.ensAddress || standard.ensAddress || null, + _defaultProvider: defaultProvider + }; +} + +// node_modules/@ethersproject/providers/lib.esm/base-provider.js +init_shim(); +init_lib14(); +init_lib10(); +init_lib18(); +init_lib3(); +init_lib2(); +init_lib8(); +init_lib12(); +init_lib4(); +init_lib19(); +init_lib9(); +init_lib26(); +init_lib(); +import bech32 from "bech32"; + +// node_modules/@ethersproject/providers/lib.esm/_version.js +init_shim(); +var version24 = "providers/5.7.2"; + +// node_modules/@ethersproject/providers/lib.esm/formatter.js +init_shim(); +init_lib7(); +init_lib3(); +init_lib2(); +init_lib8(); +init_lib4(); +init_lib17(); +init_lib(); +var logger29 = new Logger(version24); +var Formatter = class { + constructor() { + this.formats = this.getDefaultFormats(); + } + getDefaultFormats() { + const formats = {}; + const address = this.address.bind(this); + const bigNumber = this.bigNumber.bind(this); + const blockTag = this.blockTag.bind(this); + const data = this.data.bind(this); + const hash3 = this.hash.bind(this); + const hex = this.hex.bind(this); + const number = this.number.bind(this); + const type = this.type.bind(this); + const strictData = (v) => { + return this.data(v, true); + }; + formats.transaction = { + hash: hash3, + type, + accessList: Formatter.allowNull(this.accessList.bind(this), null), + blockHash: Formatter.allowNull(hash3, null), + blockNumber: Formatter.allowNull(number, null), + transactionIndex: Formatter.allowNull(number, null), + confirmations: Formatter.allowNull(number, null), + from: address, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) + // must be set + gasPrice: Formatter.allowNull(bigNumber), + maxPriorityFeePerGas: Formatter.allowNull(bigNumber), + maxFeePerGas: Formatter.allowNull(bigNumber), + gasLimit: bigNumber, + to: Formatter.allowNull(address, null), + value: bigNumber, + nonce: number, + data, + r: Formatter.allowNull(this.uint256), + s: Formatter.allowNull(this.uint256), + v: Formatter.allowNull(number), + creates: Formatter.allowNull(address, null), + raw: Formatter.allowNull(data) + }; + formats.transactionRequest = { + from: Formatter.allowNull(address), + nonce: Formatter.allowNull(number), + gasLimit: Formatter.allowNull(bigNumber), + gasPrice: Formatter.allowNull(bigNumber), + maxPriorityFeePerGas: Formatter.allowNull(bigNumber), + maxFeePerGas: Formatter.allowNull(bigNumber), + to: Formatter.allowNull(address), + value: Formatter.allowNull(bigNumber), + data: Formatter.allowNull(strictData), + type: Formatter.allowNull(number), + accessList: Formatter.allowNull(this.accessList.bind(this), null) + }; + formats.receiptLog = { + transactionIndex: number, + blockNumber: number, + transactionHash: hash3, + address, + topics: Formatter.arrayOf(hash3), + data, + logIndex: number, + blockHash: hash3 + }; + formats.receipt = { + to: Formatter.allowNull(this.address, null), + from: Formatter.allowNull(this.address, null), + contractAddress: Formatter.allowNull(address, null), + transactionIndex: number, + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + root: Formatter.allowNull(hex), + gasUsed: bigNumber, + logsBloom: Formatter.allowNull(data), + blockHash: hash3, + transactionHash: hash3, + logs: Formatter.arrayOf(this.receiptLog.bind(this)), + blockNumber: number, + confirmations: Formatter.allowNull(number, null), + cumulativeGasUsed: bigNumber, + effectiveGasPrice: Formatter.allowNull(bigNumber), + status: Formatter.allowNull(number), + type + }; + formats.block = { + hash: Formatter.allowNull(hash3), + parentHash: hash3, + number, + timestamp: number, + nonce: Formatter.allowNull(hex), + difficulty: this.difficulty.bind(this), + gasLimit: bigNumber, + gasUsed: bigNumber, + miner: Formatter.allowNull(address), + extraData: data, + transactions: Formatter.allowNull(Formatter.arrayOf(hash3)), + baseFeePerGas: Formatter.allowNull(bigNumber) + }; + formats.blockWithTransactions = shallowCopy(formats.block); + formats.blockWithTransactions.transactions = Formatter.allowNull(Formatter.arrayOf(this.transactionResponse.bind(this))); + formats.filter = { + fromBlock: Formatter.allowNull(blockTag, void 0), + toBlock: Formatter.allowNull(blockTag, void 0), + blockHash: Formatter.allowNull(hash3, void 0), + address: Formatter.allowNull(address, void 0), + topics: Formatter.allowNull(this.topics.bind(this), void 0) + }; + formats.filterLog = { + blockNumber: Formatter.allowNull(number), + blockHash: Formatter.allowNull(hash3), + transactionIndex: number, + removed: Formatter.allowNull(this.boolean.bind(this)), + address, + data: Formatter.allowFalsish(data, "0x"), + topics: Formatter.arrayOf(hash3), + transactionHash: hash3, + logIndex: number + }; + return formats; + } + accessList(accessList) { + return accessListify(accessList || []); + } + // Requires a BigNumberish that is within the IEEE754 safe integer range; returns a number + // Strict! Used on input. + number(number) { + if (number === "0x") { + return 0; + } + return BigNumber.from(number).toNumber(); + } + type(number) { + if (number === "0x" || number == null) { + return 0; + } + return BigNumber.from(number).toNumber(); + } + // Strict! Used on input. + bigNumber(value) { + return BigNumber.from(value); + } + // Requires a boolean, "true" or "false"; returns a boolean + boolean(value) { + if (typeof value === "boolean") { + return value; + } + if (typeof value === "string") { + value = value.toLowerCase(); + if (value === "true") { + return true; + } + if (value === "false") { + return false; + } + } + throw new Error("invalid boolean - " + value); + } + hex(value, strict) { + if (typeof value === "string") { + if (!strict && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if (isHexString(value)) { + return value.toLowerCase(); + } + } + return logger29.throwArgumentError("invalid hash", "value", value); + } + data(value, strict) { + const result = this.hex(value, strict); + if (result.length % 2 !== 0) { + throw new Error("invalid data; odd-length - " + value); + } + return result; + } + // Requires an address + // Strict! Used on input. + address(value) { + return getAddress(value); + } + callAddress(value) { + if (!isHexString(value, 32)) { + return null; + } + const address = getAddress(hexDataSlice(value, 12)); + return address === AddressZero ? null : address; + } + contractAddress(value) { + return getContractAddress(value); + } + // Strict! Used on input. + blockTag(blockTag) { + if (blockTag == null) { + return "latest"; + } + if (blockTag === "earliest") { + return "0x0"; + } + switch (blockTag) { + case "earliest": + return "0x0"; + case "latest": + case "pending": + case "safe": + case "finalized": + return blockTag; + } + if (typeof blockTag === "number" || isHexString(blockTag)) { + return hexValue(blockTag); + } + throw new Error("invalid blockTag"); + } + // Requires a hash, optionally requires 0x prefix; returns prefixed lowercase hash. + hash(value, strict) { + const result = this.hex(value, strict); + if (hexDataLength(result) !== 32) { + return logger29.throwArgumentError("invalid hash", "value", value); + } + return result; + } + // Returns the difficulty as a number, or if too large (i.e. PoA network) null + difficulty(value) { + if (value == null) { + return null; + } + const v = BigNumber.from(value); + try { + return v.toNumber(); + } catch (error) { + } + return null; + } + uint256(value) { + if (!isHexString(value)) { + throw new Error("invalid uint256"); + } + return hexZeroPad(value, 32); + } + _block(value, format) { + if (value.author != null && value.miner == null) { + value.miner = value.author; + } + const difficulty = value._difficulty != null ? value._difficulty : value.difficulty; + const result = Formatter.check(format, value); + result._difficulty = difficulty == null ? null : BigNumber.from(difficulty); + return result; + } + block(value) { + return this._block(value, this.formats.block); + } + blockWithTransactions(value) { + return this._block(value, this.formats.blockWithTransactions); + } + // Strict! Used on input. + transactionRequest(value) { + return Formatter.check(this.formats.transactionRequest, value); + } + transactionResponse(transaction) { + if (transaction.gas != null && transaction.gasLimit == null) { + transaction.gasLimit = transaction.gas; + } + if (transaction.to && BigNumber.from(transaction.to).isZero()) { + transaction.to = "0x0000000000000000000000000000000000000000"; + } + if (transaction.input != null && transaction.data == null) { + transaction.data = transaction.input; + } + if (transaction.to == null && transaction.creates == null) { + transaction.creates = this.contractAddress(transaction); + } + if ((transaction.type === 1 || transaction.type === 2) && transaction.accessList == null) { + transaction.accessList = []; + } + const result = Formatter.check(this.formats.transaction, transaction); + if (transaction.chainId != null) { + let chainId = transaction.chainId; + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + result.chainId = chainId; + } else { + let chainId = transaction.networkId; + if (chainId == null && result.v == null) { + chainId = transaction.chainId; + } + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + if (typeof chainId !== "number" && result.v != null) { + chainId = (result.v - 35) / 2; + if (chainId < 0) { + chainId = 0; + } + chainId = parseInt(chainId); + } + if (typeof chainId !== "number") { + chainId = 0; + } + result.chainId = chainId; + } + if (result.blockHash && result.blockHash.replace(/0/g, "") === "x") { + result.blockHash = null; + } + return result; + } + transaction(value) { + return parse(value); + } + receiptLog(value) { + return Formatter.check(this.formats.receiptLog, value); + } + receipt(value) { + const result = Formatter.check(this.formats.receipt, value); + if (result.root != null) { + if (result.root.length <= 4) { + const value2 = BigNumber.from(result.root).toNumber(); + if (value2 === 0 || value2 === 1) { + if (result.status != null && result.status !== value2) { + logger29.throwArgumentError("alt-root-status/status mismatch", "value", { root: result.root, status: result.status }); + } + result.status = value2; + delete result.root; + } else { + logger29.throwArgumentError("invalid alt-root-status", "value.root", result.root); + } + } else if (result.root.length !== 66) { + logger29.throwArgumentError("invalid root hash", "value.root", result.root); + } + } + if (result.status != null) { + result.byzantium = true; + } + return result; + } + topics(value) { + if (Array.isArray(value)) { + return value.map((v) => this.topics(v)); + } else if (value != null) { + return this.hash(value, true); + } + return null; + } + filter(value) { + return Formatter.check(this.formats.filter, value); + } + filterLog(value) { + return Formatter.check(this.formats.filterLog, value); + } + static check(format, object) { + const result = {}; + for (const key2 in format) { + try { + const value = format[key2](object[key2]); + if (value !== void 0) { + result[key2] = value; + } + } catch (error) { + error.checkKey = key2; + error.checkValue = object[key2]; + throw error; + } + } + return result; + } + // if value is null-ish, nullValue is returned + static allowNull(format, nullValue) { + return function(value) { + if (value == null) { + return nullValue; + } + return format(value); + }; + } + // If value is false-ish, replaceValue is returned + static allowFalsish(format, replaceValue) { + return function(value) { + if (!value) { + return replaceValue; + } + return format(value); + }; + } + // Requires an Array satisfying check + static arrayOf(format) { + return function(array) { + if (!Array.isArray(array)) { + throw new Error("not an array"); + } + const result = []; + array.forEach(function(value) { + result.push(format(value)); + }); + return result; + }; + } +}; +function isCommunityResourcable(value) { + return value && typeof value.isCommunityResource === "function"; +} +function isCommunityResource(value) { + return isCommunityResourcable(value) && value.isCommunityResource(); +} +var throttleMessage = false; +function showThrottleMessage() { + if (throttleMessage) { + return; + } + throttleMessage = true; + console.log("========= NOTICE ========="); + console.log("Request-Rate Exceeded (this message will not be repeated)"); + console.log(""); + console.log("The default API keys for each service are provided as a highly-throttled,"); + console.log("community resource for low-traffic projects and early prototyping."); + console.log(""); + console.log("While your application will continue to function, we highly recommended"); + console.log("signing up for your own API keys to improve performance, increase your"); + console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); + console.log(""); + console.log("For more details: https://docs.ethers.io/api-keys/"); + console.log("=========================="); +} + +// node_modules/@ethersproject/providers/lib.esm/base-provider.js +var __awaiter10 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var logger30 = new Logger(version24); +var MAX_CCIP_REDIRECTS = 10; +function checkTopic(topic) { + if (topic == null) { + return "null"; + } + if (hexDataLength(topic) !== 32) { + logger30.throwArgumentError("invalid topic", "topic", topic); + } + return topic.toLowerCase(); +} +function serializeTopics(topics) { + topics = topics.slice(); + while (topics.length > 0 && topics[topics.length - 1] == null) { + topics.pop(); + } + return topics.map((topic) => { + if (Array.isArray(topic)) { + const unique = {}; + topic.forEach((topic2) => { + unique[checkTopic(topic2)] = true; + }); + const sorted = Object.keys(unique); + sorted.sort(); + return sorted.join("|"); + } else { + return checkTopic(topic); + } + }).join("&"); +} +function deserializeTopics(data) { + if (data === "") { + return []; + } + return data.split(/&/g).map((topic) => { + if (topic === "") { + return []; + } + const comps = topic.split("|").map((topic2) => { + return topic2 === "null" ? null : topic2; + }); + return comps.length === 1 ? comps[0] : comps; + }); +} +function getEventTag2(eventName) { + if (typeof eventName === "string") { + eventName = eventName.toLowerCase(); + if (hexDataLength(eventName) === 32) { + return "tx:" + eventName; + } + if (eventName.indexOf(":") === -1) { + return eventName; + } + } else if (Array.isArray(eventName)) { + return "filter:*:" + serializeTopics(eventName); + } else if (ForkEvent.isForkEvent(eventName)) { + logger30.warn("not implemented"); + throw new Error("not implemented"); + } else if (eventName && typeof eventName === "object") { + return "filter:" + (eventName.address || "*") + ":" + serializeTopics(eventName.topics || []); + } + throw new Error("invalid event - " + eventName); +} +function getTime() { + return (/* @__PURE__ */ new Date()).getTime(); +} +function stall(duration) { + return new Promise((resolve) => { + setTimeout(resolve, duration); + }); +} +var PollableEvents = ["block", "network", "pending", "poll"]; +var Event2 = class { + constructor(tag, listener, once) { + defineReadOnly(this, "tag", tag); + defineReadOnly(this, "listener", listener); + defineReadOnly(this, "once", once); + this._lastBlockNumber = -2; + this._inflight = false; + } + 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 comps = this.tag.split(":"); + if (comps[0] !== "tx") { + return null; + } + return comps[1]; + } + get filter() { + const comps = this.tag.split(":"); + if (comps[0] !== "filter") { + return null; + } + const address = comps[1]; + const topics = deserializeTopics(comps[2]); + const filter = {}; + if (topics.length > 0) { + filter.topics = topics; + } + if (address && address !== "*") { + filter.address = address; + } + return filter; + } + pollable() { + return this.tag.indexOf(":") >= 0 || PollableEvents.indexOf(this.tag) >= 0; + } +}; +var coinInfos = { + "0": { symbol: "btc", p2pkh: 0, p2sh: 5, prefix: "bc" }, + "2": { symbol: "ltc", p2pkh: 48, p2sh: 50, prefix: "ltc" }, + "3": { symbol: "doge", p2pkh: 30, p2sh: 22 }, + "60": { symbol: "eth", ilk: "eth" }, + "61": { symbol: "etc", ilk: "eth" }, + "700": { symbol: "xdai", ilk: "eth" } +}; +function bytes32ify(value) { + return hexZeroPad(BigNumber.from(value).toHexString(), 32); +} +function base58Encode(data) { + return Base58.encode(concat([data, hexDataSlice(sha256(sha256(data)), 0, 4)])); +} +var matcherIpfs = new RegExp("^(ipfs)://(.*)$", "i"); +var matchers = [ + new RegExp("^(https)://(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i") +]; +function _parseString(result, start) { + try { + return toUtf8String(_parseBytes(result, start)); + } catch (error) { + } + return null; +} +function _parseBytes(result, start) { + if (result === "0x") { + return null; + } + const offset = BigNumber.from(hexDataSlice(result, start, start + 32)).toNumber(); + const length = BigNumber.from(hexDataSlice(result, offset, offset + 32)).toNumber(); + return hexDataSlice(result, offset + 32, offset + 32 + length); +} +function getIpfsLink(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } else { + logger30.throwArgumentError("unsupported IPFS format", "link", link); + } + return `https://gateway.ipfs.io/ipfs/${link}`; +} +function numPad(value) { + const result = arrayify(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; +} +function bytesPad(value) { + if (value.length % 32 === 0) { + return value; + } + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; +} +function encodeBytes(datas) { + const result = []; + let byteCount = 0; + for (let i2 = 0; i2 < datas.length; i2++) { + result.push(null); + byteCount += 32; + } + for (let i2 = 0; i2 < datas.length; i2++) { + const data = arrayify(datas[i2]); + result[i2] = numPad(byteCount); + result.push(numPad(data.length)); + result.push(bytesPad(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + return hexConcat(result); +} +var Resolver = class { + // The resolvedAddress is only for creating a ReverseLookup resolver + constructor(provider, address, name, resolvedAddress) { + defineReadOnly(this, "provider", provider); + defineReadOnly(this, "name", name); + defineReadOnly(this, "address", provider.formatter.address(address)); + defineReadOnly(this, "_resolvedAddress", resolvedAddress); + } + supportsWildcard() { + if (!this._supportsEip2544) { + this._supportsEip2544 = this.provider.call({ + to: this.address, + data: "0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000" + }).then((result) => { + return BigNumber.from(result).eq(1); + }).catch((error) => { + if (error.code === Logger.errors.CALL_EXCEPTION) { + return false; + } + this._supportsEip2544 = null; + throw error; + }); + } + return this._supportsEip2544; + } + _fetch(selector, parameters) { + return __awaiter10(this, void 0, void 0, function* () { + const tx = { + to: this.address, + ccipReadEnabled: true, + data: hexConcat([selector, namehash(this.name), parameters || "0x"]) + }; + let parseBytes = false; + if (yield this.supportsWildcard()) { + parseBytes = true; + tx.data = hexConcat(["0x9061b923", encodeBytes([dnsEncode(this.name), tx.data])]); + } + try { + let result = yield this.provider.call(tx); + if (arrayify(result).length % 32 === 4) { + logger30.throwError("resolver threw error", Logger.errors.CALL_EXCEPTION, { + transaction: tx, + data: result + }); + } + if (parseBytes) { + result = _parseBytes(result, 0); + } + return result; + } catch (error) { + if (error.code === Logger.errors.CALL_EXCEPTION) { + return null; + } + throw error; + } + }); + } + _fetchBytes(selector, parameters) { + return __awaiter10(this, void 0, void 0, function* () { + const result = yield this._fetch(selector, parameters); + if (result != null) { + return _parseBytes(result, 0); + } + return null; + }); + } + _getAddress(coinType, hexBytes) { + const coinInfo = coinInfos[String(coinType)]; + if (coinInfo == null) { + logger30.throwError(`unsupported coin type: ${coinType}`, Logger.errors.UNSUPPORTED_OPERATION, { + operation: `getAddress(${coinType})` + }); + } + if (coinInfo.ilk === "eth") { + return this.provider.formatter.address(hexBytes); + } + const bytes = arrayify(hexBytes); + if (coinInfo.p2pkh != null) { + const p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/); + if (p2pkh) { + const length = parseInt(p2pkh[1], 16); + if (p2pkh[2].length === length * 2 && length >= 1 && length <= 75) { + return base58Encode(concat([[coinInfo.p2pkh], "0x" + p2pkh[2]])); + } + } + } + if (coinInfo.p2sh != null) { + const p2sh = hexBytes.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/); + if (p2sh) { + const length = parseInt(p2sh[1], 16); + if (p2sh[2].length === length * 2 && length >= 1 && length <= 75) { + return base58Encode(concat([[coinInfo.p2sh], "0x" + p2sh[2]])); + } + } + } + if (coinInfo.prefix != null) { + const length = bytes[1]; + let version28 = bytes[0]; + if (version28 === 0) { + if (length !== 20 && length !== 32) { + version28 = -1; + } + } else { + version28 = -1; + } + if (version28 >= 0 && bytes.length === 2 + length && length >= 1 && length <= 75) { + const words2 = bech32.toWords(bytes.slice(2)); + words2.unshift(version28); + return bech32.encode(coinInfo.prefix, words2); + } + } + return null; + } + getAddress(coinType) { + return __awaiter10(this, void 0, void 0, function* () { + if (coinType == null) { + coinType = 60; + } + if (coinType === 60) { + try { + const result = yield this._fetch("0x3b3b57de"); + if (result === "0x" || result === HashZero) { + return null; + } + return this.provider.formatter.callAddress(result); + } catch (error) { + if (error.code === Logger.errors.CALL_EXCEPTION) { + return null; + } + throw error; + } + } + const hexBytes = yield this._fetchBytes("0xf1cb7e06", bytes32ify(coinType)); + if (hexBytes == null || hexBytes === "0x") { + return null; + } + const address = this._getAddress(coinType, hexBytes); + if (address == null) { + logger30.throwError(`invalid or unsupported coin data`, Logger.errors.UNSUPPORTED_OPERATION, { + operation: `getAddress(${coinType})`, + coinType, + data: hexBytes + }); + } + return address; + }); + } + getAvatar() { + return __awaiter10(this, void 0, void 0, function* () { + const linkage = [{ type: "name", content: this.name }]; + try { + const avatar = yield this.getText("avatar"); + if (avatar == null) { + return null; + } + for (let i2 = 0; i2 < matchers.length; i2++) { + const match = avatar.match(matchers[i2]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + linkage.push({ type: "url", content: avatar }); + return { linkage, url: avatar }; + case "data": + linkage.push({ type: "data", content: avatar }); + return { linkage, url: avatar }; + case "ipfs": + linkage.push({ type: "ipfs", content: avatar }); + return { linkage, url: getIpfsLink(avatar) }; + case "erc721": + case "erc1155": { + const selector = scheme === "erc721" ? "0xc87b56dd" : "0x0e89341c"; + linkage.push({ type: scheme, content: avatar }); + const owner = this._resolvedAddress || (yield this.getAddress()); + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + return null; + } + const addr = yield this.provider.formatter.address(comps[0]); + const tokenId = hexZeroPad(BigNumber.from(comps[1]).toHexString(), 32); + if (scheme === "erc721") { + const tokenOwner = this.provider.formatter.callAddress(yield this.provider.call({ + to: addr, + data: hexConcat(["0x6352211e", tokenId]) + })); + if (owner !== tokenOwner) { + return null; + } + linkage.push({ type: "owner", content: tokenOwner }); + } else if (scheme === "erc1155") { + const balance = BigNumber.from(yield this.provider.call({ + to: addr, + data: hexConcat(["0x00fdd58e", hexZeroPad(owner, 32), tokenId]) + })); + if (balance.isZero()) { + return null; + } + linkage.push({ type: "balance", content: balance.toString() }); + } + const tx = { + to: this.provider.formatter.address(comps[0]), + data: hexConcat([selector, tokenId]) + }; + let metadataUrl = _parseString(yield this.provider.call(tx), 0); + if (metadataUrl == null) { + return null; + } + linkage.push({ type: "metadata-url-base", content: metadataUrl }); + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2)); + linkage.push({ type: "metadata-url-expanded", content: metadataUrl }); + } + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + linkage.push({ type: "metadata-url", content: metadataUrl }); + const metadata = yield fetchJson(metadataUrl); + if (!metadata) { + return null; + } + linkage.push({ type: "metadata", content: JSON.stringify(metadata) }); + let imageUrl = metadata.image; + if (typeof imageUrl !== "string") { + return null; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + } else { + const ipfs = imageUrl.match(matcherIpfs); + if (ipfs == null) { + return null; + } + linkage.push({ type: "url-ipfs", content: imageUrl }); + imageUrl = getIpfsLink(imageUrl); + } + linkage.push({ type: "url", content: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } catch (error) { + } + return null; + }); + } + getContentHash() { + return __awaiter10(this, void 0, void 0, function* () { + const hexBytes = yield this._fetchBytes("0xbc1c58d1"); + if (hexBytes == null || hexBytes === "0x") { + return null; + } + const ipfs = hexBytes.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + const length = parseInt(ipfs[3], 16); + if (ipfs[4].length === length * 2) { + return "ipfs://" + Base58.encode("0x" + ipfs[1]); + } + } + const ipns = hexBytes.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipns) { + const length = parseInt(ipns[3], 16); + if (ipns[4].length === length * 2) { + return "ipns://" + Base58.encode("0x" + ipns[1]); + } + } + const swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/); + if (swarm) { + if (swarm[1].length === 32 * 2) { + return "bzz://" + swarm[1]; + } + } + const skynet = hexBytes.match(/^0x90b2c605([0-9a-f]*)$/); + if (skynet) { + if (skynet[1].length === 34 * 2) { + const urlSafe = { "=": "", "+": "-", "/": "_" }; + const hash3 = encode2("0x" + skynet[1]).replace(/[=+\/]/g, (a2) => urlSafe[a2]); + return "sia://" + hash3; + } + } + return logger30.throwError(`invalid or unsupported content hash data`, Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getContentHash()", + data: hexBytes + }); + }); + } + getText(key2) { + return __awaiter10(this, void 0, void 0, function* () { + let keyBytes = toUtf8Bytes(key2); + keyBytes = concat([bytes32ify(64), bytes32ify(keyBytes.length), keyBytes]); + if (keyBytes.length % 32 !== 0) { + keyBytes = concat([keyBytes, hexZeroPad("0x", 32 - key2.length % 32)]); + } + const hexBytes = yield this._fetchBytes("0x59d1d43c", hexlify(keyBytes)); + if (hexBytes == null || hexBytes === "0x") { + return null; + } + return toUtf8String(hexBytes); + }); + } +}; +var defaultFormatter = null; +var nextPollId = 1; +var BaseProvider = class extends Provider { + /** + * ready + * + * A Promise that resolves only once the provider is ready. + * + * Sub-classes that call the super with a network without a chainId + * MUST set this. Standard named networks have a known chainId. + * + */ + constructor(network) { + super(); + this._events = []; + this._emitted = { block: -2 }; + this.disableCcipRead = false; + this.formatter = new.target.getFormatter(); + defineReadOnly(this, "anyNetwork", network === "any"); + if (this.anyNetwork) { + network = this.detectNetwork(); + } + if (network instanceof Promise) { + this._networkPromise = network; + network.catch((error) => { + }); + this._ready().catch((error) => { + }); + } else { + const knownNetwork = getStatic(new.target, "getNetwork")(network); + if (knownNetwork) { + defineReadOnly(this, "_network", knownNetwork); + this.emit("network", knownNetwork, null); + } else { + logger30.throwArgumentError("invalid network", "network", network); + } + } + this._maxInternalBlockNumber = -1024; + this._lastBlockNumber = -2; + this._maxFilterBlockRange = 10; + this._pollingInterval = 4e3; + this._fastQueryDate = 0; + } + _ready() { + return __awaiter10(this, void 0, void 0, function* () { + if (this._network == null) { + let network = null; + if (this._networkPromise) { + try { + network = yield this._networkPromise; + } catch (error) { + } + } + if (network == null) { + network = yield this.detectNetwork(); + } + if (!network) { + logger30.throwError("no network detected", Logger.errors.UNKNOWN_ERROR, {}); + } + if (this._network == null) { + if (this.anyNetwork) { + this._network = network; + } else { + defineReadOnly(this, "_network", network); + } + this.emit("network", network, null); + } + } + return this._network; + }); + } + // This will always return the most recently established network. + // For "any", this can change (a "network" event is emitted before + // any change is reflected); otherwise this cannot change + get ready() { + return poll(() => { + return this._ready().then((network) => { + return network; + }, (error) => { + if (error.code === Logger.errors.NETWORK_ERROR && error.event === "noNetwork") { + return void 0; + } + throw error; + }); + }); + } + // @TODO: Remove this and just create a singleton formatter + static getFormatter() { + if (defaultFormatter == null) { + defaultFormatter = new Formatter(); + } + return defaultFormatter; + } + // @TODO: Remove this and just use getNetwork + static getNetwork(network) { + return getNetwork(network == null ? "homestead" : network); + } + ccipReadFetch(tx, calldata, urls) { + return __awaiter10(this, void 0, void 0, function* () { + if (this.disableCcipRead || urls.length === 0) { + return null; + } + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + const errorMessages = []; + for (let i2 = 0; i2 < urls.length; i2++) { + const url = urls[i2]; + const href = url.replace("{sender}", sender).replace("{data}", data); + const json = url.indexOf("{data}") >= 0 ? null : JSON.stringify({ data, sender }); + const result = yield fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { + value.status = response.statusCode; + return value; + }); + if (result.data) { + return result.data; + } + const errorMessage = result.message || "unknown error"; + if (result.status >= 400 && result.status < 500) { + return logger30.throwError(`response not found during CCIP fetch: ${errorMessage}`, Logger.errors.SERVER_ERROR, { url, errorMessage }); + } + errorMessages.push(errorMessage); + } + return logger30.throwError(`error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, Logger.errors.SERVER_ERROR, { + urls, + errorMessages + }); + }); + } + // Fetches the blockNumber, but will reuse any result that is less + // than maxAge old or has been requested since the last request + _getInternalBlockNumber(maxAge) { + return __awaiter10(this, void 0, void 0, function* () { + yield this._ready(); + if (maxAge > 0) { + while (this._internalBlockNumber) { + const internalBlockNumber = this._internalBlockNumber; + try { + const result = yield internalBlockNumber; + if (getTime() - result.respTime <= maxAge) { + return result.blockNumber; + } + break; + } catch (error) { + if (this._internalBlockNumber === internalBlockNumber) { + break; + } + } + } + } + const reqTime = getTime(); + const checkInternalBlockNumber = resolveProperties({ + blockNumber: this.perform("getBlockNumber", {}), + networkError: this.getNetwork().then((network) => null, (error) => error) + }).then(({ blockNumber, networkError }) => { + if (networkError) { + if (this._internalBlockNumber === checkInternalBlockNumber) { + this._internalBlockNumber = null; + } + throw networkError; + } + const respTime = getTime(); + blockNumber = BigNumber.from(blockNumber).toNumber(); + if (blockNumber < this._maxInternalBlockNumber) { + blockNumber = this._maxInternalBlockNumber; + } + this._maxInternalBlockNumber = blockNumber; + this._setFastBlockNumber(blockNumber); + return { blockNumber, reqTime, respTime }; + }); + this._internalBlockNumber = checkInternalBlockNumber; + checkInternalBlockNumber.catch((error) => { + if (this._internalBlockNumber === checkInternalBlockNumber) { + this._internalBlockNumber = null; + } + }); + return (yield checkInternalBlockNumber).blockNumber; + }); + } + poll() { + return __awaiter10(this, void 0, void 0, function* () { + const pollId = nextPollId++; + const runners = []; + let blockNumber = null; + try { + blockNumber = yield this._getInternalBlockNumber(100 + this.pollingInterval / 2); + } catch (error) { + this.emit("error", error); + return; + } + this._setFastBlockNumber(blockNumber); + this.emit("poll", pollId, blockNumber); + if (blockNumber === this._lastBlockNumber) { + this.emit("didPoll", pollId); + return; + } + if (this._emitted.block === -2) { + this._emitted.block = blockNumber - 1; + } + if (Math.abs(this._emitted.block - blockNumber) > 1e3) { + logger30.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${blockNumber})`); + this.emit("error", logger30.makeError("network block skew detected", Logger.errors.NETWORK_ERROR, { + blockNumber, + event: "blockSkew", + previousBlockNumber: this._emitted.block + })); + this.emit("block", blockNumber); + } else { + for (let i2 = this._emitted.block + 1; i2 <= blockNumber; i2++) { + this.emit("block", i2); + } + } + if (this._emitted.block !== blockNumber) { + this._emitted.block = blockNumber; + Object.keys(this._emitted).forEach((key2) => { + if (key2 === "block") { + return; + } + const eventBlockNumber = this._emitted[key2]; + if (eventBlockNumber === "pending") { + return; + } + if (blockNumber - eventBlockNumber > 12) { + delete this._emitted[key2]; + } + }); + } + if (this._lastBlockNumber === -2) { + this._lastBlockNumber = blockNumber - 1; + } + this._events.forEach((event) => { + switch (event.type) { + case "tx": { + const hash3 = event.hash; + let runner = this.getTransactionReceipt(hash3).then((receipt) => { + if (!receipt || receipt.blockNumber == null) { + return null; + } + this._emitted["t:" + hash3] = receipt.blockNumber; + this.emit(hash3, receipt); + return null; + }).catch((error) => { + this.emit("error", error); + }); + runners.push(runner); + break; + } + case "filter": { + if (!event._inflight) { + event._inflight = true; + if (event._lastBlockNumber === -2) { + event._lastBlockNumber = blockNumber - 1; + } + const filter = event.filter; + filter.fromBlock = event._lastBlockNumber + 1; + filter.toBlock = blockNumber; + const minFromBlock = filter.toBlock - this._maxFilterBlockRange; + if (minFromBlock > filter.fromBlock) { + filter.fromBlock = minFromBlock; + } + if (filter.fromBlock < 0) { + filter.fromBlock = 0; + } + const runner = this.getLogs(filter).then((logs) => { + event._inflight = false; + if (logs.length === 0) { + return; + } + logs.forEach((log3) => { + if (log3.blockNumber > event._lastBlockNumber) { + event._lastBlockNumber = log3.blockNumber; + } + this._emitted["b:" + log3.blockHash] = log3.blockNumber; + this._emitted["t:" + log3.transactionHash] = log3.blockNumber; + this.emit(filter, log3); + }); + }).catch((error) => { + this.emit("error", error); + event._inflight = false; + }); + runners.push(runner); + } + break; + } + } + }); + this._lastBlockNumber = blockNumber; + Promise.all(runners).then(() => { + this.emit("didPoll", pollId); + }).catch((error) => { + this.emit("error", error); + }); + return; + }); + } + // Deprecated; do not use this + resetEventsBlock(blockNumber) { + this._lastBlockNumber = blockNumber - 1; + if (this.polling) { + this.poll(); + } + } + get network() { + return this._network; + } + // This method should query the network if the underlying network + // can change, such as when connected to a JSON-RPC backend + detectNetwork() { + return __awaiter10(this, void 0, void 0, function* () { + return logger30.throwError("provider does not support network detection", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "provider.detectNetwork" + }); + }); + } + getNetwork() { + return __awaiter10(this, void 0, void 0, function* () { + const network = yield this._ready(); + const currentNetwork = yield this.detectNetwork(); + if (network.chainId !== currentNetwork.chainId) { + if (this.anyNetwork) { + this._network = currentNetwork; + this._lastBlockNumber = -2; + this._fastBlockNumber = null; + this._fastBlockNumberPromise = null; + this._fastQueryDate = 0; + this._emitted.block = -2; + this._maxInternalBlockNumber = -1024; + this._internalBlockNumber = null; + this.emit("network", currentNetwork, network); + yield stall(0); + return this._network; + } + const error = logger30.makeError("underlying network changed", Logger.errors.NETWORK_ERROR, { + event: "changed", + network, + detectedNetwork: currentNetwork + }); + this.emit("error", error); + throw error; + } + return network; + }); + } + get blockNumber() { + this._getInternalBlockNumber(100 + this.pollingInterval / 2).then((blockNumber) => { + this._setFastBlockNumber(blockNumber); + }, (error) => { + }); + return this._fastBlockNumber != null ? this._fastBlockNumber : -1; + } + get polling() { + return this._poller != null; + } + set polling(value) { + if (value && !this._poller) { + this._poller = setInterval(() => { + this.poll(); + }, this.pollingInterval); + if (!this._bootstrapPoll) { + this._bootstrapPoll = setTimeout(() => { + this.poll(); + this._bootstrapPoll = setTimeout(() => { + if (!this._poller) { + this.poll(); + } + this._bootstrapPoll = null; + }, this.pollingInterval); + }, 0); + } + } else if (!value && this._poller) { + clearInterval(this._poller); + this._poller = null; + } + } + get pollingInterval() { + return this._pollingInterval; + } + set pollingInterval(value) { + if (typeof value !== "number" || value <= 0 || parseInt(String(value)) != value) { + throw new Error("invalid polling interval"); + } + this._pollingInterval = value; + if (this._poller) { + clearInterval(this._poller); + this._poller = setInterval(() => { + this.poll(); + }, this._pollingInterval); + } + } + _getFastBlockNumber() { + const now2 = getTime(); + if (now2 - this._fastQueryDate > 2 * this._pollingInterval) { + this._fastQueryDate = now2; + this._fastBlockNumberPromise = this.getBlockNumber().then((blockNumber) => { + if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) { + this._fastBlockNumber = blockNumber; + } + return this._fastBlockNumber; + }); + } + return this._fastBlockNumberPromise; + } + _setFastBlockNumber(blockNumber) { + if (this._fastBlockNumber != null && blockNumber < this._fastBlockNumber) { + return; + } + this._fastQueryDate = getTime(); + if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) { + this._fastBlockNumber = blockNumber; + this._fastBlockNumberPromise = Promise.resolve(blockNumber); + } + } + waitForTransaction(transactionHash, confirmations, timeout) { + return __awaiter10(this, void 0, void 0, function* () { + return this._waitForTransaction(transactionHash, confirmations == null ? 1 : confirmations, timeout || 0, null); + }); + } + _waitForTransaction(transactionHash, confirmations, timeout, replaceable) { + return __awaiter10(this, void 0, void 0, function* () { + const receipt = yield this.getTransactionReceipt(transactionHash); + if ((receipt ? receipt.confirmations : 0) >= confirmations) { + return receipt; + } + return new Promise((resolve, reject) => { + const cancelFuncs = []; + let done = false; + const alreadyDone = function() { + if (done) { + return true; + } + done = true; + cancelFuncs.forEach((func) => { + func(); + }); + return false; + }; + const minedHandler = (receipt2) => { + if (receipt2.confirmations < confirmations) { + return; + } + if (alreadyDone()) { + return; + } + resolve(receipt2); + }; + this.on(transactionHash, minedHandler); + cancelFuncs.push(() => { + this.removeListener(transactionHash, minedHandler); + }); + if (replaceable) { + let lastBlockNumber = replaceable.startBlock; + let scannedBlock = null; + const replaceHandler = (blockNumber) => __awaiter10(this, void 0, void 0, function* () { + if (done) { + return; + } + yield stall(1e3); + this.getTransactionCount(replaceable.from).then((nonce) => __awaiter10(this, void 0, void 0, function* () { + if (done) { + return; + } + if (nonce <= replaceable.nonce) { + lastBlockNumber = blockNumber; + } else { + { + const mined = yield this.getTransaction(transactionHash); + if (mined && mined.blockNumber != null) { + return; + } + } + if (scannedBlock == null) { + scannedBlock = lastBlockNumber - 3; + if (scannedBlock < replaceable.startBlock) { + scannedBlock = replaceable.startBlock; + } + } + while (scannedBlock <= blockNumber) { + if (done) { + return; + } + const block = yield this.getBlockWithTransactions(scannedBlock); + for (let ti = 0; ti < block.transactions.length; ti++) { + const tx = block.transactions[ti]; + if (tx.hash === transactionHash) { + return; + } + if (tx.from === replaceable.from && tx.nonce === replaceable.nonce) { + if (done) { + return; + } + const receipt2 = yield this.waitForTransaction(tx.hash, confirmations); + if (alreadyDone()) { + return; + } + let reason = "replaced"; + if (tx.data === replaceable.data && tx.to === replaceable.to && tx.value.eq(replaceable.value)) { + reason = "repriced"; + } else if (tx.data === "0x" && tx.from === tx.to && tx.value.isZero()) { + reason = "cancelled"; + } + reject(logger30.makeError("transaction was replaced", Logger.errors.TRANSACTION_REPLACED, { + cancelled: reason === "replaced" || reason === "cancelled", + reason, + replacement: this._wrapTransaction(tx), + hash: transactionHash, + receipt: receipt2 + })); + return; + } + } + scannedBlock++; + } + } + if (done) { + return; + } + this.once("block", replaceHandler); + }), (error) => { + if (done) { + return; + } + this.once("block", replaceHandler); + }); + }); + if (done) { + return; + } + this.once("block", replaceHandler); + cancelFuncs.push(() => { + this.removeListener("block", replaceHandler); + }); + } + if (typeof timeout === "number" && timeout > 0) { + const timer2 = setTimeout(() => { + if (alreadyDone()) { + return; + } + reject(logger30.makeError("timeout exceeded", Logger.errors.TIMEOUT, { timeout })); + }, timeout); + if (timer2.unref) { + timer2.unref(); + } + cancelFuncs.push(() => { + clearTimeout(timer2); + }); + } + }); + }); + } + getBlockNumber() { + return __awaiter10(this, void 0, void 0, function* () { + return this._getInternalBlockNumber(0); + }); + } + getGasPrice() { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + const result = yield this.perform("getGasPrice", {}); + try { + return BigNumber.from(result); + } catch (error) { + return logger30.throwError("bad result from backend", Logger.errors.SERVER_ERROR, { + method: "getGasPrice", + result, + error + }); + } + }); + } + getBalance(addressOrName, blockTag) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + const params = yield resolveProperties({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + }); + const result = yield this.perform("getBalance", params); + try { + return BigNumber.from(result); + } catch (error) { + return logger30.throwError("bad result from backend", Logger.errors.SERVER_ERROR, { + method: "getBalance", + params, + result, + error + }); + } + }); + } + getTransactionCount(addressOrName, blockTag) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + const params = yield resolveProperties({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + }); + const result = yield this.perform("getTransactionCount", params); + try { + return BigNumber.from(result).toNumber(); + } catch (error) { + return logger30.throwError("bad result from backend", Logger.errors.SERVER_ERROR, { + method: "getTransactionCount", + params, + result, + error + }); + } + }); + } + getCode(addressOrName, blockTag) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + const params = yield resolveProperties({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + }); + const result = yield this.perform("getCode", params); + try { + return hexlify(result); + } catch (error) { + return logger30.throwError("bad result from backend", Logger.errors.SERVER_ERROR, { + method: "getCode", + params, + result, + error + }); + } + }); + } + getStorageAt(addressOrName, position, blockTag) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + const params = yield resolveProperties({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag), + position: Promise.resolve(position).then((p) => hexValue(p)) + }); + const result = yield this.perform("getStorageAt", params); + try { + return hexlify(result); + } catch (error) { + return logger30.throwError("bad result from backend", Logger.errors.SERVER_ERROR, { + method: "getStorageAt", + params, + result, + error + }); + } + }); + } + // This should be called by any subclass wrapping a TransactionResponse + _wrapTransaction(tx, hash3, startBlock) { + if (hash3 != null && hexDataLength(hash3) !== 32) { + throw new Error("invalid response - sendTransaction"); + } + const result = tx; + if (hash3 != null && tx.hash !== hash3) { + logger30.throwError("Transaction hash mismatch from Provider.sendTransaction.", Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash3 }); + } + result.wait = (confirms, timeout) => __awaiter10(this, void 0, void 0, function* () { + if (confirms == null) { + confirms = 1; + } + if (timeout == null) { + timeout = 0; + } + let replacement = void 0; + if (confirms !== 0 && startBlock != null) { + replacement = { + data: tx.data, + from: tx.from, + nonce: tx.nonce, + to: tx.to, + value: tx.value, + startBlock + }; + } + const receipt = yield this._waitForTransaction(tx.hash, confirms, timeout, replacement); + if (receipt == null && confirms === 0) { + return null; + } + this._emitted["t:" + tx.hash] = receipt.blockNumber; + if (receipt.status === 0) { + logger30.throwError("transaction failed", Logger.errors.CALL_EXCEPTION, { + transactionHash: tx.hash, + transaction: tx, + receipt + }); + } + return receipt; + }); + return result; + } + sendTransaction(signedTransaction) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + const hexTx = yield Promise.resolve(signedTransaction).then((t2) => hexlify(t2)); + const tx = this.formatter.transaction(signedTransaction); + if (tx.confirmations == null) { + tx.confirmations = 0; + } + const blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval); + try { + const hash3 = yield this.perform("sendTransaction", { signedTransaction: hexTx }); + return this._wrapTransaction(tx, hash3, blockNumber); + } catch (error) { + error.transaction = tx; + error.transactionHash = tx.hash; + throw error; + } + }); + } + _getTransactionRequest(transaction) { + return __awaiter10(this, void 0, void 0, function* () { + const values = yield transaction; + const tx = {}; + ["from", "to"].forEach((key2) => { + if (values[key2] == null) { + return; + } + tx[key2] = Promise.resolve(values[key2]).then((v) => v ? this._getAddress(v) : null); + }); + ["gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "value"].forEach((key2) => { + if (values[key2] == null) { + return; + } + tx[key2] = Promise.resolve(values[key2]).then((v) => v ? BigNumber.from(v) : null); + }); + ["type"].forEach((key2) => { + if (values[key2] == null) { + return; + } + tx[key2] = Promise.resolve(values[key2]).then((v) => v != null ? v : null); + }); + if (values.accessList) { + tx.accessList = this.formatter.accessList(values.accessList); + } + ["data"].forEach((key2) => { + if (values[key2] == null) { + return; + } + tx[key2] = Promise.resolve(values[key2]).then((v) => v ? hexlify(v) : null); + }); + return this.formatter.transactionRequest(yield resolveProperties(tx)); + }); + } + _getFilter(filter) { + return __awaiter10(this, void 0, void 0, function* () { + filter = yield filter; + const result = {}; + if (filter.address != null) { + result.address = this._getAddress(filter.address); + } + ["blockHash", "topics"].forEach((key2) => { + if (filter[key2] == null) { + return; + } + result[key2] = filter[key2]; + }); + ["fromBlock", "toBlock"].forEach((key2) => { + if (filter[key2] == null) { + return; + } + result[key2] = this._getBlockTag(filter[key2]); + }); + return this.formatter.filter(yield resolveProperties(result)); + }); + } + _call(transaction, blockTag, attempt) { + return __awaiter10(this, void 0, void 0, function* () { + if (attempt >= MAX_CCIP_REDIRECTS) { + logger30.throwError("CCIP read exceeded maximum redirections", Logger.errors.SERVER_ERROR, { + redirects: attempt, + transaction + }); + } + const txSender = transaction.to; + const result = yield this.perform("call", { transaction, blockTag }); + if (attempt >= 0 && blockTag === "latest" && txSender != null && result.substring(0, 10) === "0x556f1830" && hexDataLength(result) % 32 === 4) { + try { + const data = hexDataSlice(result, 4); + const sender = hexDataSlice(data, 0, 32); + if (!BigNumber.from(sender).eq(txSender)) { + logger30.throwError("CCIP Read sender did not match", Logger.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, + data: result + }); + } + const urls = []; + const urlsOffset = BigNumber.from(hexDataSlice(data, 32, 64)).toNumber(); + const urlsLength = BigNumber.from(hexDataSlice(data, urlsOffset, urlsOffset + 32)).toNumber(); + const urlsData = hexDataSlice(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString(urlsData, u * 32); + if (url == null) { + logger30.throwError("CCIP Read contained corrupt URL string", Logger.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, + data: result + }); + } + urls.push(url); + } + const calldata = _parseBytes(data, 64); + if (!BigNumber.from(hexDataSlice(data, 100, 128)).isZero()) { + logger30.throwError("CCIP Read callback selector included junk", Logger.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, + data: result + }); + } + const callbackSelector = hexDataSlice(data, 96, 100); + const extraData = _parseBytes(data, 128); + const ccipResult = yield this.ccipReadFetch(transaction, calldata, urls); + if (ccipResult == null) { + logger30.throwError("CCIP Read disabled or provided no URLs", Logger.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, + data: result + }); + } + const tx = { + to: txSender, + data: hexConcat([callbackSelector, encodeBytes([ccipResult, extraData])]) + }; + return this._call(tx, blockTag, attempt + 1); + } catch (error) { + if (error.code === Logger.errors.SERVER_ERROR) { + throw error; + } + } + } + try { + return hexlify(result); + } catch (error) { + return logger30.throwError("bad result from backend", Logger.errors.SERVER_ERROR, { + method: "call", + params: { transaction, blockTag }, + result, + error + }); + } + }); + } + call(transaction, blockTag) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + const resolved = yield resolveProperties({ + transaction: this._getTransactionRequest(transaction), + blockTag: this._getBlockTag(blockTag), + ccipReadEnabled: Promise.resolve(transaction.ccipReadEnabled) + }); + return this._call(resolved.transaction, resolved.blockTag, resolved.ccipReadEnabled ? 0 : -1); + }); + } + estimateGas(transaction) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + const params = yield resolveProperties({ + transaction: this._getTransactionRequest(transaction) + }); + const result = yield this.perform("estimateGas", params); + try { + return BigNumber.from(result); + } catch (error) { + return logger30.throwError("bad result from backend", Logger.errors.SERVER_ERROR, { + method: "estimateGas", + params, + result, + error + }); + } + }); + } + _getAddress(addressOrName) { + return __awaiter10(this, void 0, void 0, function* () { + addressOrName = yield addressOrName; + if (typeof addressOrName !== "string") { + logger30.throwArgumentError("invalid address or ENS name", "name", addressOrName); + } + const address = yield this.resolveName(addressOrName); + if (address == null) { + logger30.throwError("ENS name not configured", Logger.errors.UNSUPPORTED_OPERATION, { + operation: `resolveName(${JSON.stringify(addressOrName)})` + }); + } + return address; + }); + } + _getBlock(blockHashOrBlockTag, includeTransactions) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + blockHashOrBlockTag = yield blockHashOrBlockTag; + let blockNumber = -128; + const params = { + includeTransactions: !!includeTransactions + }; + if (isHexString(blockHashOrBlockTag, 32)) { + params.blockHash = blockHashOrBlockTag; + } else { + try { + params.blockTag = yield this._getBlockTag(blockHashOrBlockTag); + if (isHexString(params.blockTag)) { + blockNumber = parseInt(params.blockTag.substring(2), 16); + } + } catch (error) { + logger30.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag); + } + } + return poll(() => __awaiter10(this, void 0, void 0, function* () { + const block = yield this.perform("getBlock", params); + if (block == null) { + if (params.blockHash != null) { + if (this._emitted["b:" + params.blockHash] == null) { + return null; + } + } + if (params.blockTag != null) { + if (blockNumber > this._emitted.block) { + return null; + } + } + return void 0; + } + if (includeTransactions) { + let blockNumber2 = null; + for (let i2 = 0; i2 < block.transactions.length; i2++) { + const tx = block.transactions[i2]; + if (tx.blockNumber == null) { + tx.confirmations = 0; + } else if (tx.confirmations == null) { + if (blockNumber2 == null) { + blockNumber2 = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval); + } + let confirmations = blockNumber2 - tx.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + tx.confirmations = confirmations; + } + } + const blockWithTxs = this.formatter.blockWithTransactions(block); + blockWithTxs.transactions = blockWithTxs.transactions.map((tx) => this._wrapTransaction(tx)); + return blockWithTxs; + } + return this.formatter.block(block); + }), { oncePoll: this }); + }); + } + getBlock(blockHashOrBlockTag) { + return this._getBlock(blockHashOrBlockTag, false); + } + getBlockWithTransactions(blockHashOrBlockTag) { + return this._getBlock(blockHashOrBlockTag, true); + } + getTransaction(transactionHash) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + transactionHash = yield transactionHash; + const params = { transactionHash: this.formatter.hash(transactionHash, true) }; + return poll(() => __awaiter10(this, void 0, void 0, function* () { + const result = yield this.perform("getTransaction", params); + if (result == null) { + if (this._emitted["t:" + transactionHash] == null) { + return null; + } + return void 0; + } + const tx = this.formatter.transactionResponse(result); + if (tx.blockNumber == null) { + tx.confirmations = 0; + } else if (tx.confirmations == null) { + const blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval); + let confirmations = blockNumber - tx.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + tx.confirmations = confirmations; + } + return this._wrapTransaction(tx); + }), { oncePoll: this }); + }); + } + getTransactionReceipt(transactionHash) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + transactionHash = yield transactionHash; + const params = { transactionHash: this.formatter.hash(transactionHash, true) }; + return poll(() => __awaiter10(this, void 0, void 0, function* () { + const result = yield this.perform("getTransactionReceipt", params); + if (result == null) { + if (this._emitted["t:" + transactionHash] == null) { + return null; + } + return void 0; + } + if (result.blockHash == null) { + return void 0; + } + const receipt = this.formatter.receipt(result); + if (receipt.blockNumber == null) { + receipt.confirmations = 0; + } else if (receipt.confirmations == null) { + const blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval); + let confirmations = blockNumber - receipt.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + receipt.confirmations = confirmations; + } + return receipt; + }), { oncePoll: this }); + }); + } + getLogs(filter) { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + const params = yield resolveProperties({ filter: this._getFilter(filter) }); + const logs = yield this.perform("getLogs", params); + logs.forEach((log3) => { + if (log3.removed == null) { + log3.removed = false; + } + }); + return Formatter.arrayOf(this.formatter.filterLog.bind(this.formatter))(logs); + }); + } + getEtherPrice() { + return __awaiter10(this, void 0, void 0, function* () { + yield this.getNetwork(); + return this.perform("getEtherPrice", {}); + }); + } + _getBlockTag(blockTag) { + return __awaiter10(this, void 0, void 0, function* () { + blockTag = yield blockTag; + if (typeof blockTag === "number" && blockTag < 0) { + if (blockTag % 1) { + logger30.throwArgumentError("invalid BlockTag", "blockTag", blockTag); + } + let blockNumber = yield this._getInternalBlockNumber(100 + 2 * this.pollingInterval); + blockNumber += blockTag; + if (blockNumber < 0) { + blockNumber = 0; + } + return this.formatter.blockTag(blockNumber); + } + return this.formatter.blockTag(blockTag); + }); + } + getResolver(name) { + return __awaiter10(this, void 0, void 0, function* () { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { + return null; + } + if (name !== "eth" && currentName === "eth") { + return null; + } + const addr = yield this._getResolver(currentName, "getResolver"); + if (addr != null) { + const resolver = new Resolver(this, addr, name); + if (currentName !== name && !(yield resolver.supportsWildcard())) { + return null; + } + return resolver; + } + currentName = currentName.split(".").slice(1).join("."); + } + }); + } + _getResolver(name, operation) { + return __awaiter10(this, void 0, void 0, function* () { + if (operation == null) { + operation = "ENS"; + } + const network = yield this.getNetwork(); + if (!network.ensAddress) { + logger30.throwError("network does not support ENS", Logger.errors.UNSUPPORTED_OPERATION, { operation, network: network.name }); + } + try { + const addrData = yield this.call({ + to: network.ensAddress, + data: "0x0178b8bf" + namehash(name).substring(2) + }); + return this.formatter.callAddress(addrData); + } catch (error) { + } + return null; + }); + } + resolveName(name) { + return __awaiter10(this, void 0, void 0, function* () { + name = yield name; + try { + return Promise.resolve(this.formatter.address(name)); + } catch (error) { + if (isHexString(name)) { + throw error; + } + } + if (typeof name !== "string") { + logger30.throwArgumentError("invalid ENS name", "name", name); + } + const resolver = yield this.getResolver(name); + if (!resolver) { + return null; + } + return yield resolver.getAddress(); + }); + } + lookupAddress(address) { + return __awaiter10(this, void 0, void 0, function* () { + address = yield address; + address = this.formatter.address(address); + const node = address.substring(2).toLowerCase() + ".addr.reverse"; + const resolverAddr = yield this._getResolver(node, "lookupAddress"); + if (resolverAddr == null) { + return null; + } + const name = _parseString(yield this.call({ + to: resolverAddr, + data: "0x691f3431" + namehash(node).substring(2) + }), 0); + const addr = yield this.resolveName(name); + if (addr != address) { + return null; + } + return name; + }); + } + getAvatar(nameOrAddress) { + return __awaiter10(this, void 0, void 0, function* () { + let resolver = null; + if (isHexString(nameOrAddress)) { + const address = this.formatter.address(nameOrAddress); + const node = address.substring(2).toLowerCase() + ".addr.reverse"; + const resolverAddress = yield this._getResolver(node, "getAvatar"); + if (!resolverAddress) { + return null; + } + resolver = new Resolver(this, resolverAddress, node); + try { + const avatar2 = yield resolver.getAvatar(); + if (avatar2) { + return avatar2.url; + } + } catch (error) { + if (error.code !== Logger.errors.CALL_EXCEPTION) { + throw error; + } + } + try { + const name = _parseString(yield this.call({ + to: resolverAddress, + data: "0x691f3431" + namehash(node).substring(2) + }), 0); + resolver = yield this.getResolver(name); + } catch (error) { + if (error.code !== Logger.errors.CALL_EXCEPTION) { + throw error; + } + return null; + } + } else { + resolver = yield this.getResolver(nameOrAddress); + if (!resolver) { + return null; + } + } + const avatar = yield resolver.getAvatar(); + if (avatar == null) { + return null; + } + return avatar.url; + }); + } + perform(method, params) { + return logger30.throwError(method + " not implemented", Logger.errors.NOT_IMPLEMENTED, { operation: method }); + } + _startEvent(event) { + this.polling = this._events.filter((e2) => e2.pollable()).length > 0; + } + _stopEvent(event) { + this.polling = this._events.filter((e2) => e2.pollable()).length > 0; + } + _addEventListener(eventName, listener, once) { + const event = new Event2(getEventTag2(eventName), listener, once); + this._events.push(event); + this._startEvent(event); + return this; + } + on(eventName, listener) { + return this._addEventListener(eventName, listener, false); + } + once(eventName, listener) { + return this._addEventListener(eventName, listener, true); + } + emit(eventName, ...args) { + let result = false; + let stopped = []; + let eventTag = getEventTag2(eventName); + this._events = this._events.filter((event) => { + if (event.tag !== eventTag) { + return true; + } + setTimeout(() => { + event.listener.apply(this, args); + }, 0); + result = true; + if (event.once) { + stopped.push(event); + return false; + } + return true; + }); + stopped.forEach((event) => { + this._stopEvent(event); + }); + return result; + } + listenerCount(eventName) { + if (!eventName) { + return this._events.length; + } + let eventTag = getEventTag2(eventName); + return this._events.filter((event) => { + return event.tag === eventTag; + }).length; + } + listeners(eventName) { + if (eventName == null) { + return this._events.map((event) => event.listener); + } + let eventTag = getEventTag2(eventName); + return this._events.filter((event) => event.tag === eventTag).map((event) => event.listener); + } + off(eventName, listener) { + if (listener == null) { + return this.removeAllListeners(eventName); + } + const stopped = []; + let found = false; + let eventTag = getEventTag2(eventName); + this._events = this._events.filter((event) => { + if (event.tag !== eventTag || event.listener != listener) { + return true; + } + if (found) { + return true; + } + found = true; + stopped.push(event); + return false; + }); + stopped.forEach((event) => { + this._stopEvent(event); + }); + return this; + } + removeAllListeners(eventName) { + let stopped = []; + if (eventName == null) { + stopped = this._events; + this._events = []; + } else { + const eventTag = getEventTag2(eventName); + this._events = this._events.filter((event) => { + if (event.tag !== eventTag) { + return true; + } + stopped.push(event); + return false; + }); + } + stopped.forEach((event) => { + this._stopEvent(event); + }); + return this; + } +}; + +// node_modules/@ethersproject/providers/lib.esm/alchemy-provider.js +init_shim(); +init_lib4(); + +// node_modules/@ethersproject/providers/lib.esm/websocket-provider.js +init_shim(); +init_lib3(); +init_lib4(); + +// node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js +init_shim(); +init_lib15(); +init_lib3(); +init_lib2(); +init_lib12(); +init_lib4(); +init_lib9(); +init_lib17(); +init_lib26(); +init_lib(); +var __awaiter11 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var logger31 = new Logger(version24); +var errorGas = ["call", "estimateGas"]; +function spelunk(value, requireData) { + if (value == null) { + return null; + } + if (typeof value.message === "string" && value.message.match("reverted")) { + const data = isHexString(value.data) ? value.data : null; + if (!requireData || data) { + return { message: value.message, data }; + } + } + if (typeof value === "object") { + for (const key2 in value) { + const result = spelunk(value[key2], requireData); + if (result) { + return result; + } + } + return null; + } + if (typeof value === "string") { + try { + return spelunk(JSON.parse(value), requireData); + } catch (error) { + } + } + return null; +} +function checkError(method, error, params) { + const transaction = params.transaction || params.signedTransaction; + if (method === "call") { + const result = spelunk(error, true); + if (result) { + return result.data; + } + logger31.throwError("missing revert data in call exception; Transaction reverted without a reason string", Logger.errors.CALL_EXCEPTION, { + data: "0x", + transaction, + error + }); + } + if (method === "estimateGas") { + let result = spelunk(error.body, false); + if (result == null) { + result = spelunk(error, false); + } + if (result) { + logger31.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + reason: result.message, + method, + transaction, + error + }); + } + } + let message = error.message; + if (error.code === Logger.errors.SERVER_ERROR && error.error && typeof error.error.message === "string") { + message = error.error.message; + } else if (typeof error.body === "string") { + message = error.body; + } else if (typeof error.responseText === "string") { + message = error.responseText; + } + message = (message || "").toLowerCase(); + if (message.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)) { + logger31.throwError("insufficient funds for intrinsic transaction cost", Logger.errors.INSUFFICIENT_FUNDS, { + error, + method, + transaction + }); + } + if (message.match(/nonce (is )?too low/i)) { + logger31.throwError("nonce has already been used", Logger.errors.NONCE_EXPIRED, { + error, + method, + transaction + }); + } + if (message.match(/replacement transaction underpriced|transaction gas price.*too low/i)) { + logger31.throwError("replacement fee too low", Logger.errors.REPLACEMENT_UNDERPRICED, { + error, + method, + transaction + }); + } + if (message.match(/only replay-protected/i)) { + logger31.throwError("legacy pre-eip-155 transactions not supported", Logger.errors.UNSUPPORTED_OPERATION, { + error, + method, + transaction + }); + } + if (errorGas.indexOf(method) >= 0 && message.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)) { + logger31.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + method, + transaction + }); + } + throw error; +} +function timer(timeout) { + return new Promise(function(resolve) { + setTimeout(resolve, timeout); + }); +} +function getResult(payload) { + if (payload.error) { + const error = new Error(payload.error.message); + error.code = payload.error.code; + error.data = payload.error.data; + throw error; + } + return payload.result; +} +function getLowerCase(value) { + if (value) { + return value.toLowerCase(); + } + return value; +} +var _constructorGuard5 = {}; +var JsonRpcSigner = class extends Signer { + constructor(constructorGuard, provider, addressOrIndex) { + super(); + if (constructorGuard !== _constructorGuard5) { + throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner"); + } + defineReadOnly(this, "provider", provider); + if (addressOrIndex == null) { + addressOrIndex = 0; + } + if (typeof addressOrIndex === "string") { + defineReadOnly(this, "_address", this.provider.formatter.address(addressOrIndex)); + defineReadOnly(this, "_index", null); + } else if (typeof addressOrIndex === "number") { + defineReadOnly(this, "_index", addressOrIndex); + defineReadOnly(this, "_address", null); + } else { + logger31.throwArgumentError("invalid address or index", "addressOrIndex", addressOrIndex); + } + } + connect(provider) { + return logger31.throwError("cannot alter JSON-RPC Signer connection", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "connect" + }); + } + connectUnchecked() { + return new UncheckedJsonRpcSigner(_constructorGuard5, this.provider, this._address || this._index); + } + getAddress() { + if (this._address) { + return Promise.resolve(this._address); + } + return this.provider.send("eth_accounts", []).then((accounts) => { + if (accounts.length <= this._index) { + logger31.throwError("unknown account #" + this._index, Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getAddress" + }); + } + return this.provider.formatter.address(accounts[this._index]); + }); + } + sendUncheckedTransaction(transaction) { + transaction = shallowCopy(transaction); + const fromAddress = this.getAddress().then((address) => { + if (address) { + address = address.toLowerCase(); + } + return address; + }); + if (transaction.gasLimit == null) { + const estimate = shallowCopy(transaction); + estimate.from = fromAddress; + transaction.gasLimit = this.provider.estimateGas(estimate); + } + if (transaction.to != null) { + transaction.to = Promise.resolve(transaction.to).then((to) => __awaiter11(this, void 0, void 0, function* () { + if (to == null) { + return null; + } + const address = yield this.provider.resolveName(to); + if (address == null) { + logger31.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + return address; + })); + } + return resolveProperties({ + tx: resolveProperties(transaction), + sender: fromAddress + }).then(({ tx, sender }) => { + if (tx.from != null) { + if (tx.from.toLowerCase() !== sender) { + logger31.throwArgumentError("from address mismatch", "transaction", transaction); + } + } else { + tx.from = sender; + } + const hexTx = this.provider.constructor.hexlifyTransaction(tx, { from: true }); + return this.provider.send("eth_sendTransaction", [hexTx]).then((hash3) => { + return hash3; + }, (error) => { + if (typeof error.message === "string" && error.message.match(/user denied/i)) { + logger31.throwError("user rejected transaction", Logger.errors.ACTION_REJECTED, { + action: "sendTransaction", + transaction: tx + }); + } + return checkError("sendTransaction", error, hexTx); + }); + }); + } + signTransaction(transaction) { + return logger31.throwError("signing transactions is unsupported", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "signTransaction" + }); + } + sendTransaction(transaction) { + return __awaiter11(this, void 0, void 0, function* () { + const blockNumber = yield this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval); + const hash3 = yield this.sendUncheckedTransaction(transaction); + try { + return yield poll(() => __awaiter11(this, void 0, void 0, function* () { + const tx = yield this.provider.getTransaction(hash3); + if (tx === null) { + return void 0; + } + return this.provider._wrapTransaction(tx, hash3, blockNumber); + }), { oncePoll: this.provider }); + } catch (error) { + error.transactionHash = hash3; + throw error; + } + }); + } + signMessage(message) { + return __awaiter11(this, void 0, void 0, function* () { + const data = typeof message === "string" ? toUtf8Bytes(message) : message; + const address = yield this.getAddress(); + try { + return yield this.provider.send("personal_sign", [hexlify(data), address.toLowerCase()]); + } catch (error) { + if (typeof error.message === "string" && error.message.match(/user denied/i)) { + logger31.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, { + action: "signMessage", + from: address, + messageData: message + }); + } + throw error; + } + }); + } + _legacySignMessage(message) { + return __awaiter11(this, void 0, void 0, function* () { + const data = typeof message === "string" ? toUtf8Bytes(message) : message; + const address = yield this.getAddress(); + try { + return yield this.provider.send("eth_sign", [address.toLowerCase(), hexlify(data)]); + } catch (error) { + if (typeof error.message === "string" && error.message.match(/user denied/i)) { + logger31.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, { + action: "_legacySignMessage", + from: address, + messageData: message + }); + } + throw error; + } + }); + } + _signTypedData(domain, types, value) { + return __awaiter11(this, void 0, void 0, function* () { + const populated = yield TypedDataEncoder.resolveNames(domain, types, value, (name) => { + return this.provider.resolveName(name); + }); + const address = yield this.getAddress(); + try { + return yield this.provider.send("eth_signTypedData_v4", [ + address.toLowerCase(), + JSON.stringify(TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + ]); + } catch (error) { + if (typeof error.message === "string" && error.message.match(/user denied/i)) { + logger31.throwError("user rejected signing", Logger.errors.ACTION_REJECTED, { + action: "_signTypedData", + from: address, + messageData: { domain: populated.domain, types, value: populated.value } + }); + } + throw error; + } + }); + } + unlock(password) { + return __awaiter11(this, void 0, void 0, function* () { + const provider = this.provider; + const address = yield this.getAddress(); + return provider.send("personal_unlockAccount", [address.toLowerCase(), password, null]); + }); + } +}; +var UncheckedJsonRpcSigner = class extends JsonRpcSigner { + sendTransaction(transaction) { + return this.sendUncheckedTransaction(transaction).then((hash3) => { + return { + hash: hash3, + nonce: null, + gasLimit: null, + gasPrice: null, + data: null, + value: null, + chainId: null, + confirmations: 0, + from: null, + wait: (confirmations) => { + return this.provider.waitForTransaction(hash3, confirmations); + } + }; + }); + } +}; +var allowedTransactionKeys4 = { + chainId: true, + data: true, + gasLimit: true, + gasPrice: true, + nonce: true, + to: true, + value: true, + type: true, + accessList: true, + maxFeePerGas: true, + maxPriorityFeePerGas: true +}; +var JsonRpcProvider = class extends BaseProvider { + constructor(url, network) { + let networkOrReady = network; + if (networkOrReady == null) { + networkOrReady = new Promise((resolve, reject) => { + setTimeout(() => { + this.detectNetwork().then((network2) => { + resolve(network2); + }, (error) => { + reject(error); + }); + }, 0); + }); + } + super(networkOrReady); + if (!url) { + url = getStatic(this.constructor, "defaultUrl")(); + } + if (typeof url === "string") { + defineReadOnly(this, "connection", Object.freeze({ + url + })); + } else { + defineReadOnly(this, "connection", Object.freeze(shallowCopy(url))); + } + this._nextId = 42; + } + get _cache() { + if (this._eventLoopCache == null) { + this._eventLoopCache = {}; + } + return this._eventLoopCache; + } + static defaultUrl() { + return "http://localhost:8545"; + } + detectNetwork() { + if (!this._cache["detectNetwork"]) { + this._cache["detectNetwork"] = this._uncachedDetectNetwork(); + setTimeout(() => { + this._cache["detectNetwork"] = null; + }, 0); + } + return this._cache["detectNetwork"]; + } + _uncachedDetectNetwork() { + return __awaiter11(this, void 0, void 0, function* () { + yield timer(0); + let chainId = null; + try { + chainId = yield this.send("eth_chainId", []); + } catch (error) { + try { + chainId = yield this.send("net_version", []); + } catch (error2) { + } + } + if (chainId != null) { + const getNetwork2 = getStatic(this.constructor, "getNetwork"); + try { + return getNetwork2(BigNumber.from(chainId).toNumber()); + } catch (error) { + return logger31.throwError("could not detect network", Logger.errors.NETWORK_ERROR, { + chainId, + event: "invalidNetwork", + serverError: error + }); + } + } + return logger31.throwError("could not detect network", Logger.errors.NETWORK_ERROR, { + event: "noNetwork" + }); + }); + } + getSigner(addressOrIndex) { + return new JsonRpcSigner(_constructorGuard5, this, addressOrIndex); + } + getUncheckedSigner(addressOrIndex) { + return this.getSigner(addressOrIndex).connectUnchecked(); + } + listAccounts() { + return this.send("eth_accounts", []).then((accounts) => { + return accounts.map((a2) => this.formatter.address(a2)); + }); + } + send(method, params) { + const request = { + method, + params, + id: this._nextId++, + jsonrpc: "2.0" + }; + this.emit("debug", { + action: "request", + request: deepCopy(request), + provider: this + }); + const cache = ["eth_chainId", "eth_blockNumber"].indexOf(method) >= 0; + if (cache && this._cache[method]) { + return this._cache[method]; + } + const result = fetchJson(this.connection, JSON.stringify(request), getResult).then((result2) => { + this.emit("debug", { + action: "response", + request, + response: result2, + provider: this + }); + return result2; + }, (error) => { + this.emit("debug", { + action: "response", + error, + request, + provider: this + }); + throw error; + }); + if (cache) { + this._cache[method] = result; + setTimeout(() => { + this._cache[method] = null; + }, 0); + } + return result; + } + prepareRequest(method, params) { + switch (method) { + case "getBlockNumber": + return ["eth_blockNumber", []]; + case "getGasPrice": + return ["eth_gasPrice", []]; + case "getBalance": + return ["eth_getBalance", [getLowerCase(params.address), params.blockTag]]; + case "getTransactionCount": + return ["eth_getTransactionCount", [getLowerCase(params.address), params.blockTag]]; + case "getCode": + return ["eth_getCode", [getLowerCase(params.address), params.blockTag]]; + case "getStorageAt": + return ["eth_getStorageAt", [getLowerCase(params.address), hexZeroPad(params.position, 32), params.blockTag]]; + case "sendTransaction": + return ["eth_sendRawTransaction", [params.signedTransaction]]; + case "getBlock": + if (params.blockTag) { + return ["eth_getBlockByNumber", [params.blockTag, !!params.includeTransactions]]; + } else if (params.blockHash) { + return ["eth_getBlockByHash", [params.blockHash, !!params.includeTransactions]]; + } + return null; + case "getTransaction": + return ["eth_getTransactionByHash", [params.transactionHash]]; + case "getTransactionReceipt": + return ["eth_getTransactionReceipt", [params.transactionHash]]; + case "call": { + const hexlifyTransaction = getStatic(this.constructor, "hexlifyTransaction"); + return ["eth_call", [hexlifyTransaction(params.transaction, { from: true }), params.blockTag]]; + } + case "estimateGas": { + const hexlifyTransaction = getStatic(this.constructor, "hexlifyTransaction"); + return ["eth_estimateGas", [hexlifyTransaction(params.transaction, { from: true })]]; + } + case "getLogs": + if (params.filter && params.filter.address != null) { + params.filter.address = getLowerCase(params.filter.address); + } + return ["eth_getLogs", [params.filter]]; + default: + break; + } + return null; + } + perform(method, params) { + return __awaiter11(this, void 0, void 0, function* () { + if (method === "call" || method === "estimateGas") { + const tx = params.transaction; + if (tx && tx.type != null && BigNumber.from(tx.type).isZero()) { + if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { + const feeData = yield this.getFeeData(); + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + params = shallowCopy(params); + params.transaction = shallowCopy(tx); + delete params.transaction.type; + } + } + } + } + const args = this.prepareRequest(method, params); + if (args == null) { + logger31.throwError(method + " not implemented", Logger.errors.NOT_IMPLEMENTED, { operation: method }); + } + try { + return yield this.send(args[0], args[1]); + } catch (error) { + return checkError(method, error, params); + } + }); + } + _startEvent(event) { + if (event.tag === "pending") { + this._startPending(); + } + super._startEvent(event); + } + _startPending() { + if (this._pendingFilter != null) { + return; + } + const self2 = this; + const pendingFilter = this.send("eth_newPendingTransactionFilter", []); + this._pendingFilter = pendingFilter; + pendingFilter.then(function(filterId) { + function poll2() { + self2.send("eth_getFilterChanges", [filterId]).then(function(hashes) { + if (self2._pendingFilter != pendingFilter) { + return null; + } + let seq = Promise.resolve(); + hashes.forEach(function(hash3) { + self2._emitted["t:" + hash3.toLowerCase()] = "pending"; + seq = seq.then(function() { + return self2.getTransaction(hash3).then(function(tx) { + self2.emit("pending", tx); + return null; + }); + }); + }); + return seq.then(function() { + return timer(1e3); + }); + }).then(function() { + if (self2._pendingFilter != pendingFilter) { + self2.send("eth_uninstallFilter", [filterId]); + return; + } + setTimeout(function() { + poll2(); + }, 0); + return null; + }).catch((error) => { + }); + } + poll2(); + return filterId; + }).catch((error) => { + }); + } + _stopEvent(event) { + if (event.tag === "pending" && this.listenerCount("pending") === 0) { + this._pendingFilter = null; + } + super._stopEvent(event); + } + // Convert an ethers.js transaction into a JSON-RPC transaction + // - gasLimit => gas + // - All values hexlified + // - All numeric values zero-striped + // - All addresses are lowercased + // NOTE: This allows a TransactionRequest, but all values should be resolved + // before this is called + // @TODO: This will likely be removed in future versions and prepareRequest + // will be the preferred method for this. + static hexlifyTransaction(transaction, allowExtra) { + const allowed = shallowCopy(allowedTransactionKeys4); + if (allowExtra) { + for (const key2 in allowExtra) { + if (allowExtra[key2]) { + allowed[key2] = true; + } + } + } + checkProperties(transaction, allowed); + const result = {}; + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function(key2) { + if (transaction[key2] == null) { + return; + } + const value = hexValue(BigNumber.from(transaction[key2])); + if (key2 === "gasLimit") { + key2 = "gas"; + } + result[key2] = value; + }); + ["from", "to", "data"].forEach(function(key2) { + if (transaction[key2] == null) { + return; + } + result[key2] = hexlify(transaction[key2]); + }); + if (transaction.accessList) { + result["accessList"] = accessListify(transaction.accessList); + } + return result; + } +}; + +// node_modules/@ethersproject/providers/lib.esm/ws.js +init_shim(); +init_lib(); +var WS = null; +try { + WS = WebSocket; + if (WS == null) { + throw new Error("inject please"); + } +} catch (error) { + const logger48 = new Logger(version24); + WS = function() { + logger48.throwError("WebSockets not supported in this environment", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new WebSocket()" + }); + }; +} + +// node_modules/@ethersproject/providers/lib.esm/websocket-provider.js +init_lib(); +var __awaiter12 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var logger32 = new Logger(version24); +var NextId = 1; +var WebSocketProvider = class extends JsonRpcProvider { + constructor(url, network) { + if (network === "any") { + logger32.throwError("WebSocketProvider does not support 'any' network yet", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "network:any" + }); + } + if (typeof url === "string") { + super(url, network); + } else { + super("_websocket", network); + } + this._pollingInterval = -1; + this._wsReady = false; + if (typeof url === "string") { + defineReadOnly(this, "_websocket", new WS(this.connection.url)); + } else { + defineReadOnly(this, "_websocket", url); + } + defineReadOnly(this, "_requests", {}); + defineReadOnly(this, "_subs", {}); + defineReadOnly(this, "_subIds", {}); + defineReadOnly(this, "_detectNetwork", super.detectNetwork()); + this.websocket.onopen = () => { + this._wsReady = true; + Object.keys(this._requests).forEach((id2) => { + this.websocket.send(this._requests[id2].payload); + }); + }; + this.websocket.onmessage = (messageEvent) => { + const data = messageEvent.data; + const result = JSON.parse(data); + if (result.id != null) { + const id2 = String(result.id); + const request = this._requests[id2]; + delete this._requests[id2]; + if (result.result !== void 0) { + request.callback(null, result.result); + this.emit("debug", { + action: "response", + request: JSON.parse(request.payload), + response: result.result, + provider: this + }); + } else { + let error = null; + if (result.error) { + error = new Error(result.error.message || "unknown error"); + defineReadOnly(error, "code", result.error.code || null); + defineReadOnly(error, "response", data); + } else { + error = new Error("unknown error"); + } + request.callback(error, void 0); + this.emit("debug", { + action: "response", + error, + request: JSON.parse(request.payload), + provider: this + }); + } + } else if (result.method === "eth_subscription") { + const sub = this._subs[result.params.subscription]; + if (sub) { + sub.processFunc(result.params.result); + } + } else { + console.warn("this should not happen"); + } + }; + const fauxPoll = setInterval(() => { + this.emit("poll"); + }, 1e3); + if (fauxPoll.unref) { + fauxPoll.unref(); + } + } + // Cannot narrow the type of _websocket, as that is not backwards compatible + // so we add a getter and let the WebSocket be a public API. + get websocket() { + return this._websocket; + } + detectNetwork() { + return this._detectNetwork; + } + get pollingInterval() { + return 0; + } + resetEventsBlock(blockNumber) { + logger32.throwError("cannot reset events block on WebSocketProvider", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resetEventBlock" + }); + } + set pollingInterval(value) { + logger32.throwError("cannot set polling interval on WebSocketProvider", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setPollingInterval" + }); + } + poll() { + return __awaiter12(this, void 0, void 0, function* () { + return null; + }); + } + set polling(value) { + if (!value) { + return; + } + logger32.throwError("cannot set polling on WebSocketProvider", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setPolling" + }); + } + send(method, params) { + const rid = NextId++; + return new Promise((resolve, reject) => { + function callback(error, result) { + if (error) { + return reject(error); + } + return resolve(result); + } + const payload = JSON.stringify({ + method, + params, + id: rid, + jsonrpc: "2.0" + }); + this.emit("debug", { + action: "request", + request: JSON.parse(payload), + provider: this + }); + this._requests[String(rid)] = { callback, payload }; + if (this._wsReady) { + this.websocket.send(payload); + } + }); + } + static defaultUrl() { + return "ws://localhost:8546"; + } + _subscribe(tag, param, processFunc) { + return __awaiter12(this, void 0, void 0, function* () { + let subIdPromise = this._subIds[tag]; + if (subIdPromise == null) { + subIdPromise = Promise.all(param).then((param2) => { + return this.send("eth_subscribe", param2); + }); + this._subIds[tag] = subIdPromise; + } + const subId = yield subIdPromise; + this._subs[subId] = { tag, processFunc }; + }); + } + _startEvent(event) { + switch (event.type) { + case "block": + this._subscribe("block", ["newHeads"], (result) => { + const blockNumber = BigNumber.from(result.number).toNumber(); + this._emitted.block = blockNumber; + this.emit("block", blockNumber); + }); + break; + case "pending": + this._subscribe("pending", ["newPendingTransactions"], (result) => { + this.emit("pending", result); + }); + break; + case "filter": + this._subscribe(event.tag, ["logs", this._getFilter(event.filter)], (result) => { + if (result.removed == null) { + result.removed = false; + } + this.emit(event.filter, this.formatter.filterLog(result)); + }); + break; + case "tx": { + const emitReceipt = (event2) => { + const hash3 = event2.hash; + this.getTransactionReceipt(hash3).then((receipt) => { + if (!receipt) { + return; + } + this.emit(hash3, receipt); + }); + }; + emitReceipt(event); + this._subscribe("tx", ["newHeads"], (result) => { + this._events.filter((e2) => e2.type === "tx").forEach(emitReceipt); + }); + break; + } + case "debug": + case "poll": + case "willPoll": + case "didPoll": + case "error": + break; + default: + console.log("unhandled:", event); + break; + } + } + _stopEvent(event) { + let tag = event.tag; + if (event.type === "tx") { + if (this._events.filter((e2) => e2.type === "tx").length) { + return; + } + tag = "tx"; + } else if (this.listenerCount(event.event)) { + return; + } + const subId = this._subIds[tag]; + if (!subId) { + return; + } + delete this._subIds[tag]; + subId.then((subId2) => { + if (!this._subs[subId2]) { + return; + } + delete this._subs[subId2]; + this.send("eth_unsubscribe", [subId2]); + }); + } + destroy() { + return __awaiter12(this, void 0, void 0, function* () { + if (this.websocket.readyState === WS.CONNECTING) { + yield new Promise((resolve) => { + this.websocket.onopen = function() { + resolve(true); + }; + this.websocket.onerror = function() { + resolve(false); + }; + }); + } + this.websocket.close(1e3); + }); + } +}; + +// node_modules/@ethersproject/providers/lib.esm/alchemy-provider.js +init_lib(); + +// node_modules/@ethersproject/providers/lib.esm/url-json-rpc-provider.js +init_shim(); +init_lib4(); +init_lib(); +var __awaiter13 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var logger33 = new Logger(version24); +var StaticJsonRpcProvider = class extends JsonRpcProvider { + detectNetwork() { + const _super = Object.create(null, { + detectNetwork: { get: () => super.detectNetwork } + }); + return __awaiter13(this, void 0, void 0, function* () { + let network = this.network; + if (network == null) { + network = yield _super.detectNetwork.call(this); + if (!network) { + logger33.throwError("no network detected", Logger.errors.UNKNOWN_ERROR, {}); + } + if (this._network == null) { + defineReadOnly(this, "_network", network); + this.emit("network", network, null); + } + } + return network; + }); + } +}; +var UrlJsonRpcProvider = class extends StaticJsonRpcProvider { + constructor(network, apiKey) { + logger33.checkAbstract(new.target, UrlJsonRpcProvider); + network = getStatic(new.target, "getNetwork")(network); + apiKey = getStatic(new.target, "getApiKey")(apiKey); + const connection = getStatic(new.target, "getUrl")(network, apiKey); + super(connection, network); + if (typeof apiKey === "string") { + defineReadOnly(this, "apiKey", apiKey); + } else if (apiKey != null) { + Object.keys(apiKey).forEach((key2) => { + defineReadOnly(this, key2, apiKey[key2]); + }); + } + } + _startPending() { + logger33.warn("WARNING: API provider does not support pending filters"); + } + isCommunityResource() { + return false; + } + getSigner(address) { + return logger33.throwError("API provider does not support signing", Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" }); + } + listAccounts() { + return Promise.resolve([]); + } + // Return a defaultApiKey if null, otherwise validate the API key + static getApiKey(apiKey) { + return apiKey; + } + // Returns the url or connection for the given network and API key. The + // API key will have been sanitized by the getApiKey first, so any validation + // or transformations can be done there. + static getUrl(network, apiKey) { + return logger33.throwError("not implemented; sub-classes must override getUrl", Logger.errors.NOT_IMPLEMENTED, { + operation: "getUrl" + }); + } +}; + +// node_modules/@ethersproject/providers/lib.esm/alchemy-provider.js +var logger34 = new Logger(version24); +var defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; +var AlchemyWebSocketProvider = class extends WebSocketProvider { + constructor(network, apiKey) { + const provider = new AlchemyProvider(network, apiKey); + const url = provider.connection.url.replace(/^http/i, "ws").replace(".alchemyapi.", ".ws.alchemyapi."); + super(url, provider.network); + defineReadOnly(this, "apiKey", provider.apiKey); + } + isCommunityResource() { + return this.apiKey === defaultApiKey; + } +}; +var AlchemyProvider = class extends UrlJsonRpcProvider { + static getWebSocketProvider(network, apiKey) { + return new AlchemyWebSocketProvider(network, apiKey); + } + static getApiKey(apiKey) { + if (apiKey == null) { + return defaultApiKey; + } + if (apiKey && typeof apiKey !== "string") { + logger34.throwArgumentError("invalid apiKey", "apiKey", apiKey); + } + return apiKey; + } + static getUrl(network, apiKey) { + let host = null; + switch (network.name) { + case "homestead": + host = "eth-mainnet.alchemyapi.io/v2/"; + break; + case "goerli": + host = "eth-goerli.g.alchemy.com/v2/"; + break; + case "matic": + host = "polygon-mainnet.g.alchemy.com/v2/"; + break; + case "maticmum": + host = "polygon-mumbai.g.alchemy.com/v2/"; + break; + case "arbitrum": + host = "arb-mainnet.g.alchemy.com/v2/"; + break; + case "arbitrum-goerli": + host = "arb-goerli.g.alchemy.com/v2/"; + break; + case "optimism": + host = "opt-mainnet.g.alchemy.com/v2/"; + break; + case "optimism-goerli": + host = "opt-goerli.g.alchemy.com/v2/"; + break; + default: + logger34.throwArgumentError("unsupported network", "network", arguments[0]); + } + return { + allowGzip: true, + url: "https://" + host + apiKey, + throttleCallback: (attempt, url) => { + if (apiKey === defaultApiKey) { + showThrottleMessage(); + } + return Promise.resolve(true); + } + }; + } + isCommunityResource() { + return this.apiKey === defaultApiKey; + } +}; + +// node_modules/@ethersproject/providers/lib.esm/ankr-provider.js +init_shim(); +init_lib(); +var logger35 = new Logger(version24); +var defaultApiKey2 = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; +function getHost(name) { + switch (name) { + case "homestead": + return "rpc.ankr.com/eth/"; + case "ropsten": + return "rpc.ankr.com/eth_ropsten/"; + case "rinkeby": + return "rpc.ankr.com/eth_rinkeby/"; + case "goerli": + return "rpc.ankr.com/eth_goerli/"; + case "matic": + return "rpc.ankr.com/polygon/"; + case "arbitrum": + return "rpc.ankr.com/arbitrum/"; + } + return logger35.throwArgumentError("unsupported network", "name", name); +} +var AnkrProvider = class extends UrlJsonRpcProvider { + isCommunityResource() { + return this.apiKey === defaultApiKey2; + } + static getApiKey(apiKey) { + if (apiKey == null) { + return defaultApiKey2; + } + return apiKey; + } + static getUrl(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey2; + } + const connection = { + allowGzip: true, + url: "https://" + getHost(network.name) + apiKey, + throttleCallback: (attempt, url) => { + if (apiKey.apiKey === defaultApiKey2) { + showThrottleMessage(); + } + return Promise.resolve(true); + } + }; + if (apiKey.projectSecret != null) { + connection.user = ""; + connection.password = apiKey.projectSecret; + } + return connection; + } +}; + +// node_modules/@ethersproject/providers/lib.esm/cloudflare-provider.js +init_shim(); +init_lib(); +var __awaiter14 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var logger36 = new Logger(version24); +var CloudflareProvider = class extends UrlJsonRpcProvider { + static getApiKey(apiKey) { + if (apiKey != null) { + logger36.throwArgumentError("apiKey not supported for cloudflare", "apiKey", apiKey); + } + return null; + } + static getUrl(network, apiKey) { + let host = null; + switch (network.name) { + case "homestead": + host = "https://cloudflare-eth.com/"; + break; + default: + logger36.throwArgumentError("unsupported network", "network", arguments[0]); + } + return host; + } + perform(method, params) { + const _super = Object.create(null, { + perform: { get: () => super.perform } + }); + return __awaiter14(this, void 0, void 0, function* () { + if (method === "getBlockNumber") { + const block = yield _super.perform.call(this, "getBlock", { blockTag: "latest" }); + return block.number; + } + return _super.perform.call(this, method, params); + }); + } +}; + +// node_modules/@ethersproject/providers/lib.esm/etherscan-provider.js +init_shim(); +init_lib2(); +init_lib4(); +init_lib17(); +init_lib26(); +init_lib(); +var __awaiter15 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var logger37 = new Logger(version24); +function getTransactionPostData(transaction) { + const result = {}; + for (let key2 in transaction) { + if (transaction[key2] == null) { + continue; + } + let value = transaction[key2]; + if (key2 === "type" && value === 0) { + continue; + } + if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key2]) { + value = hexValue(hexlify(value)); + } else if (key2 === "accessList") { + value = "[" + accessListify(value).map((set) => { + return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`; + }).join(",") + "]"; + } else { + value = hexlify(value); + } + result[key2] = value; + } + return result; +} +function getResult2(result) { + if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) { + return result.result; + } + if (result.status != 1 || typeof result.message !== "string" || !result.message.match(/^OK/)) { + const error = new Error("invalid response"); + error.result = JSON.stringify(result); + if ((result.result || "").toLowerCase().indexOf("rate limit") >= 0) { + error.throttleRetry = true; + } + throw error; + } + return result.result; +} +function getJsonResult(result) { + if (result && result.status == 0 && result.message == "NOTOK" && (result.result || "").toLowerCase().indexOf("rate limit") >= 0) { + const error = new Error("throttled response"); + error.result = JSON.stringify(result); + error.throttleRetry = true; + throw error; + } + if (result.jsonrpc != "2.0") { + const error = new Error("invalid response"); + error.result = JSON.stringify(result); + throw error; + } + if (result.error) { + const error = new Error(result.error.message || "unknown error"); + if (result.error.code) { + error.code = result.error.code; + } + if (result.error.data) { + error.data = result.error.data; + } + throw error; + } + return result.result; +} +function checkLogTag(blockTag) { + if (blockTag === "pending") { + throw new Error("pending not supported"); + } + if (blockTag === "latest") { + return blockTag; + } + return parseInt(blockTag.substring(2), 16); +} +function checkError2(method, error, transaction) { + if (method === "call" && error.code === Logger.errors.SERVER_ERROR) { + const e2 = error.error; + if (e2 && (e2.message.match(/reverted/i) || e2.message.match(/VM execution error/i))) { + let data = e2.data; + if (data) { + data = "0x" + data.replace(/^.*0x/i, ""); + } + if (isHexString(data)) { + return data; + } + logger37.throwError("missing revert data in call exception", Logger.errors.CALL_EXCEPTION, { + error, + data: "0x" + }); + } + } + let message = error.message; + if (error.code === Logger.errors.SERVER_ERROR) { + if (error.error && typeof error.error.message === "string") { + message = error.error.message; + } else if (typeof error.body === "string") { + message = error.body; + } else if (typeof error.responseText === "string") { + message = error.responseText; + } + } + message = (message || "").toLowerCase(); + if (message.match(/insufficient funds/)) { + logger37.throwError("insufficient funds for intrinsic transaction cost", Logger.errors.INSUFFICIENT_FUNDS, { + error, + method, + transaction + }); + } + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + logger37.throwError("nonce has already been used", Logger.errors.NONCE_EXPIRED, { + error, + method, + transaction + }); + } + if (message.match(/another transaction with same nonce/)) { + logger37.throwError("replacement fee too low", Logger.errors.REPLACEMENT_UNDERPRICED, { + error, + method, + transaction + }); + } + if (message.match(/execution failed due to an exception|execution reverted/)) { + logger37.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + method, + transaction + }); + } + throw error; +} +var EtherscanProvider = class extends BaseProvider { + constructor(network, apiKey) { + super(network); + defineReadOnly(this, "baseUrl", this.getBaseUrl()); + defineReadOnly(this, "apiKey", apiKey || null); + } + getBaseUrl() { + switch (this.network ? this.network.name : "invalid") { + case "homestead": + return "https://api.etherscan.io"; + case "goerli": + return "https://api-goerli.etherscan.io"; + case "sepolia": + return "https://api-sepolia.etherscan.io"; + case "matic": + return "https://api.polygonscan.com"; + case "maticmum": + return "https://api-testnet.polygonscan.com"; + case "arbitrum": + return "https://api.arbiscan.io"; + case "arbitrum-goerli": + return "https://api-goerli.arbiscan.io"; + case "optimism": + return "https://api-optimistic.etherscan.io"; + case "optimism-goerli": + return "https://api-goerli-optimistic.etherscan.io"; + default: + } + return logger37.throwArgumentError("unsupported network", "network", this.network.name); + } + getUrl(module2, params) { + const query = Object.keys(params).reduce((accum, key2) => { + const value = params[key2]; + if (value != null) { + accum += `&${key2}=${value}`; + } + return accum; + }, ""); + const apiKey = this.apiKey ? `&apikey=${this.apiKey}` : ""; + return `${this.baseUrl}/api?module=${module2}${query}${apiKey}`; + } + getPostUrl() { + return `${this.baseUrl}/api`; + } + getPostData(module2, params) { + params.module = module2; + params.apikey = this.apiKey; + return params; + } + fetch(module2, params, post) { + return __awaiter15(this, void 0, void 0, function* () { + const url = post ? this.getPostUrl() : this.getUrl(module2, params); + const payload = post ? this.getPostData(module2, params) : null; + const procFunc = module2 === "proxy" ? getJsonResult : getResult2; + this.emit("debug", { + action: "request", + request: url, + provider: this + }); + const connection = { + url, + throttleSlotInterval: 1e3, + throttleCallback: (attempt, url2) => { + if (this.isCommunityResource()) { + showThrottleMessage(); + } + return Promise.resolve(true); + } + }; + let payloadStr = null; + if (payload) { + connection.headers = { "content-type": "application/x-www-form-urlencoded; charset=UTF-8" }; + payloadStr = Object.keys(payload).map((key2) => { + return `${key2}=${payload[key2]}`; + }).join("&"); + } + const result = yield fetchJson(connection, payloadStr, procFunc || getJsonResult); + this.emit("debug", { + action: "response", + request: url, + response: deepCopy(result), + provider: this + }); + return result; + }); + } + detectNetwork() { + return __awaiter15(this, void 0, void 0, function* () { + return this.network; + }); + } + perform(method, params) { + const _super = Object.create(null, { + perform: { get: () => super.perform } + }); + return __awaiter15(this, void 0, void 0, function* () { + switch (method) { + case "getBlockNumber": + return this.fetch("proxy", { action: "eth_blockNumber" }); + case "getGasPrice": + return this.fetch("proxy", { action: "eth_gasPrice" }); + case "getBalance": + return this.fetch("account", { + action: "balance", + address: params.address, + tag: params.blockTag + }); + case "getTransactionCount": + return this.fetch("proxy", { + action: "eth_getTransactionCount", + address: params.address, + tag: params.blockTag + }); + case "getCode": + return this.fetch("proxy", { + action: "eth_getCode", + address: params.address, + tag: params.blockTag + }); + case "getStorageAt": + return this.fetch("proxy", { + action: "eth_getStorageAt", + address: params.address, + position: params.position, + tag: params.blockTag + }); + case "sendTransaction": + return this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: params.signedTransaction + }, true).catch((error) => { + return checkError2("sendTransaction", error, params.signedTransaction); + }); + case "getBlock": + if (params.blockTag) { + return this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: params.blockTag, + boolean: params.includeTransactions ? "true" : "false" + }); + } + throw new Error("getBlock by blockHash not implemented"); + case "getTransaction": + return this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: params.transactionHash + }); + case "getTransactionReceipt": + return this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: params.transactionHash + }); + case "call": { + if (params.blockTag !== "latest") { + throw new Error("EtherscanProvider does not support blockTag for call"); + } + const postData = getTransactionPostData(params.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + try { + return yield this.fetch("proxy", postData, true); + } catch (error) { + return checkError2("call", error, params.transaction); + } + } + case "estimateGas": { + const postData = getTransactionPostData(params.transaction); + postData.module = "proxy"; + postData.action = "eth_estimateGas"; + try { + return yield this.fetch("proxy", postData, true); + } catch (error) { + return checkError2("estimateGas", error, params.transaction); + } + } + case "getLogs": { + const args = { action: "getLogs" }; + if (params.filter.fromBlock) { + args.fromBlock = checkLogTag(params.filter.fromBlock); + } + if (params.filter.toBlock) { + args.toBlock = checkLogTag(params.filter.toBlock); + } + if (params.filter.address) { + args.address = params.filter.address; + } + if (params.filter.topics && params.filter.topics.length > 0) { + if (params.filter.topics.length > 1) { + logger37.throwError("unsupported topic count", Logger.errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics }); + } + if (params.filter.topics.length === 1) { + const topic0 = params.filter.topics[0]; + if (typeof topic0 !== "string" || topic0.length !== 66) { + logger37.throwError("unsupported topic format", Logger.errors.UNSUPPORTED_OPERATION, { topic0 }); + } + args.topic0 = topic0; + } + } + const logs = yield this.fetch("logs", args); + let blocks = {}; + for (let i2 = 0; i2 < logs.length; i2++) { + const log3 = logs[i2]; + if (log3.blockHash != null) { + continue; + } + if (blocks[log3.blockNumber] == null) { + const block = yield this.getBlock(log3.blockNumber); + if (block) { + blocks[log3.blockNumber] = block.hash; + } + } + log3.blockHash = blocks[log3.blockNumber]; + } + return logs; + } + case "getEtherPrice": + if (this.network.name !== "homestead") { + return 0; + } + return parseFloat((yield this.fetch("stats", { action: "ethprice" })).ethusd); + default: + break; + } + return _super.perform.call(this, method, params); + }); + } + // Note: The `page` page parameter only allows pagination within the + // 10,000 window available without a page and offset parameter + // Error: Result window is too large, PageNo x Offset size must + // be less than or equal to 10000 + getHistory(addressOrName, startBlock, endBlock) { + return __awaiter15(this, void 0, void 0, function* () { + const params = { + action: "txlist", + address: yield this.resolveName(addressOrName), + startblock: startBlock == null ? 0 : startBlock, + endblock: endBlock == null ? 99999999 : endBlock, + sort: "asc" + }; + const result = yield this.fetch("account", params); + return result.map((tx) => { + ["contractAddress", "to"].forEach(function(key2) { + if (tx[key2] == "") { + delete tx[key2]; + } + }); + if (tx.creates == null && tx.contractAddress != null) { + tx.creates = tx.contractAddress; + } + const item = this.formatter.transactionResponse(tx); + if (tx.timeStamp) { + item.timestamp = parseInt(tx.timeStamp); + } + return item; + }); + }); + } + isCommunityResource() { + return this.apiKey == null; + } +}; + +// node_modules/@ethersproject/providers/lib.esm/fallback-provider.js +init_shim(); +init_lib14(); +init_lib3(); +init_lib2(); +init_lib4(); +init_lib23(); +init_lib26(); +init_lib(); +var __awaiter16 = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var logger38 = new Logger(version24); +function now() { + return (/* @__PURE__ */ new Date()).getTime(); +} +function checkNetworks(networks2) { + let result = null; + for (let i2 = 0; i2 < networks2.length; i2++) { + const network = networks2[i2]; + if (network == null) { + return null; + } + if (result) { + if (!(result.name === network.name && result.chainId === network.chainId && (result.ensAddress === network.ensAddress || result.ensAddress == null && network.ensAddress == null))) { + logger38.throwArgumentError("provider mismatch", "networks", networks2); + } + } else { + result = network; + } + } + return result; +} +function median(values, maxDelta) { + values = values.slice().sort(); + const middle = Math.floor(values.length / 2); + if (values.length % 2) { + return values[middle]; + } + const a2 = values[middle - 1], b = values[middle]; + if (maxDelta != null && Math.abs(a2 - b) > maxDelta) { + return null; + } + return (a2 + b) / 2; +} +function serialize2(value) { + if (value === null) { + return "null"; + } else if (typeof value === "number" || typeof value === "boolean") { + return JSON.stringify(value); + } else if (typeof value === "string") { + return value; + } else if (BigNumber.isBigNumber(value)) { + return value.toString(); + } else if (Array.isArray(value)) { + return JSON.stringify(value.map((i2) => serialize2(i2))); + } else if (typeof value === "object") { + const keys = Object.keys(value); + keys.sort(); + return "{" + keys.map((key2) => { + let v = value[key2]; + if (typeof v === "function") { + v = "[function]"; + } else { + v = serialize2(v); + } + return JSON.stringify(key2) + ":" + v; + }).join(",") + "}"; + } + throw new Error("unknown value type: " + typeof value); +} +var nextRid = 1; +function stall2(duration) { + let cancel = null; + let timer2 = null; + let promise = new Promise((resolve) => { + cancel = function() { + if (timer2) { + clearTimeout(timer2); + timer2 = null; + } + resolve(); + }; + timer2 = setTimeout(cancel, duration); + }); + const wait = (func) => { + promise = promise.then(func); + return promise; + }; + function getPromise() { + return promise; + } + return { cancel, getPromise, wait }; +} +var ForwardErrors = [ + Logger.errors.CALL_EXCEPTION, + Logger.errors.INSUFFICIENT_FUNDS, + Logger.errors.NONCE_EXPIRED, + Logger.errors.REPLACEMENT_UNDERPRICED, + Logger.errors.UNPREDICTABLE_GAS_LIMIT +]; +var ForwardProperties = [ + "address", + "args", + "errorArgs", + "errorSignature", + "method", + "transaction" +]; +function exposeDebugConfig(config2, now2) { + const result = { + weight: config2.weight + }; + Object.defineProperty(result, "provider", { get: () => config2.provider }); + if (config2.start) { + result.start = config2.start; + } + if (now2) { + result.duration = now2 - config2.start; + } + if (config2.done) { + if (config2.error) { + result.error = config2.error; + } else { + result.result = config2.result || null; + } + } + return result; +} +function normalizedTally(normalize2, quorum) { + return function(configs) { + const tally = {}; + configs.forEach((c) => { + const value = normalize2(c.result); + if (!tally[value]) { + tally[value] = { count: 0, result: c.result }; + } + tally[value].count++; + }); + const keys = Object.keys(tally); + for (let i2 = 0; i2 < keys.length; i2++) { + const check = tally[keys[i2]]; + if (check.count >= quorum) { + return check.result; + } + } + return void 0; + }; +} +function getProcessFunc(provider, method, params) { + let normalize2 = serialize2; + switch (method) { + case "getBlockNumber": + return function(configs) { + const values = configs.map((c) => c.result); + let blockNumber = median(configs.map((c) => c.result), 2); + if (blockNumber == null) { + return void 0; + } + blockNumber = Math.ceil(blockNumber); + if (values.indexOf(blockNumber + 1) >= 0) { + blockNumber++; + } + if (blockNumber >= provider._highestBlockNumber) { + provider._highestBlockNumber = blockNumber; + } + return provider._highestBlockNumber; + }; + case "getGasPrice": + return function(configs) { + const values = configs.map((c) => c.result); + values.sort(); + return values[Math.floor(values.length / 2)]; + }; + case "getEtherPrice": + return function(configs) { + return median(configs.map((c) => c.result)); + }; + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorageAt": + case "call": + case "estimateGas": + case "getLogs": + break; + case "getTransaction": + case "getTransactionReceipt": + normalize2 = function(tx) { + if (tx == null) { + return null; + } + tx = shallowCopy(tx); + tx.confirmations = -1; + return serialize2(tx); + }; + break; + case "getBlock": + if (params.includeTransactions) { + normalize2 = function(block) { + if (block == null) { + return null; + } + block = shallowCopy(block); + block.transactions = block.transactions.map((tx) => { + tx = shallowCopy(tx); + tx.confirmations = -1; + return tx; + }); + return serialize2(block); + }; + } else { + normalize2 = function(block) { + if (block == null) { + return null; + } + return serialize2(block); + }; + } + break; + default: + throw new Error("unknown method: " + method); + } + return normalizedTally(normalize2, provider.quorum); +} +function waitForSync(config2, blockNumber) { + return __awaiter16(this, void 0, void 0, function* () { + const provider = config2.provider; + if (provider.blockNumber != null && provider.blockNumber >= blockNumber || blockNumber === -1) { + return provider; + } + return poll(() => { + return new Promise((resolve, reject) => { + setTimeout(function() { + if (provider.blockNumber >= blockNumber) { + return resolve(provider); + } + if (config2.cancelled) { + return resolve(null); + } + return resolve(void 0); + }, 0); + }); + }, { oncePoll: provider }); + }); +} +function getRunner(config2, currentBlockNumber, method, params) { + return __awaiter16(this, void 0, void 0, function* () { + let provider = config2.provider; + switch (method) { + case "getBlockNumber": + case "getGasPrice": + return provider[method](); + case "getEtherPrice": + if (provider.getEtherPrice) { + return provider.getEtherPrice(); + } + break; + case "getBalance": + case "getTransactionCount": + case "getCode": + if (params.blockTag && isHexString(params.blockTag)) { + provider = yield waitForSync(config2, currentBlockNumber); + } + return provider[method](params.address, params.blockTag || "latest"); + case "getStorageAt": + if (params.blockTag && isHexString(params.blockTag)) { + provider = yield waitForSync(config2, currentBlockNumber); + } + return provider.getStorageAt(params.address, params.position, params.blockTag || "latest"); + case "getBlock": + if (params.blockTag && isHexString(params.blockTag)) { + provider = yield waitForSync(config2, currentBlockNumber); + } + return provider[params.includeTransactions ? "getBlockWithTransactions" : "getBlock"](params.blockTag || params.blockHash); + case "call": + case "estimateGas": + if (params.blockTag && isHexString(params.blockTag)) { + provider = yield waitForSync(config2, currentBlockNumber); + } + if (method === "call" && params.blockTag) { + return provider[method](params.transaction, params.blockTag); + } + return provider[method](params.transaction); + case "getTransaction": + case "getTransactionReceipt": + return provider[method](params.transactionHash); + case "getLogs": { + let filter = params.filter; + if (filter.fromBlock && isHexString(filter.fromBlock) || filter.toBlock && isHexString(filter.toBlock)) { + provider = yield waitForSync(config2, currentBlockNumber); + } + return provider.getLogs(filter); + } + } + return logger38.throwError("unknown method error", Logger.errors.UNKNOWN_ERROR, { + method, + params + }); + }); +} +var FallbackProvider = class extends BaseProvider { + constructor(providers, quorum) { + if (providers.length === 0) { + logger38.throwArgumentError("missing providers", "providers", providers); + } + const providerConfigs = providers.map((configOrProvider, index) => { + if (Provider.isProvider(configOrProvider)) { + const stallTimeout = isCommunityResource(configOrProvider) ? 2e3 : 750; + const priority = 1; + return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority }); + } + const config2 = shallowCopy(configOrProvider); + if (config2.priority == null) { + config2.priority = 1; + } + if (config2.stallTimeout == null) { + config2.stallTimeout = isCommunityResource(configOrProvider) ? 2e3 : 750; + } + if (config2.weight == null) { + config2.weight = 1; + } + const weight = config2.weight; + if (weight % 1 || weight > 512 || weight < 1) { + logger38.throwArgumentError("invalid weight; must be integer in [1, 512]", `providers[${index}].weight`, weight); + } + return Object.freeze(config2); + }); + const total = providerConfigs.reduce((accum, c) => accum + c.weight, 0); + if (quorum == null) { + quorum = total / 2; + } else if (quorum > total) { + logger38.throwArgumentError("quorum will always fail; larger than total weight", "quorum", quorum); + } + let networkOrReady = checkNetworks(providerConfigs.map((c) => c.provider.network)); + if (networkOrReady == null) { + networkOrReady = new Promise((resolve, reject) => { + setTimeout(() => { + this.detectNetwork().then(resolve, reject); + }, 0); + }); + } + super(networkOrReady); + defineReadOnly(this, "providerConfigs", Object.freeze(providerConfigs)); + defineReadOnly(this, "quorum", quorum); + this._highestBlockNumber = -1; + } + detectNetwork() { + return __awaiter16(this, void 0, void 0, function* () { + const networks2 = yield Promise.all(this.providerConfigs.map((c) => c.provider.getNetwork())); + return checkNetworks(networks2); + }); + } + perform(method, params) { + return __awaiter16(this, void 0, void 0, function* () { + if (method === "sendTransaction") { + const results = yield Promise.all(this.providerConfigs.map((c) => { + return c.provider.sendTransaction(params.signedTransaction).then((result) => { + return result.hash; + }, (error) => { + return error; + }); + })); + for (let i3 = 0; i3 < results.length; i3++) { + const result = results[i3]; + if (typeof result === "string") { + return result; + } + } + throw results[0]; + } + if (this._highestBlockNumber === -1 && method !== "getBlockNumber") { + yield this.getBlockNumber(); + } + const processFunc = getProcessFunc(this, method, params); + const configs = shuffled(this.providerConfigs.map(shallowCopy)); + configs.sort((a2, b) => a2.priority - b.priority); + const currentBlockNumber = this._highestBlockNumber; + let i2 = 0; + let first = true; + while (true) { + const t0 = now(); + let inflightWeight = configs.filter((c) => c.runner && t0 - c.start < c.stallTimeout).reduce((accum, c) => accum + c.weight, 0); + while (inflightWeight < this.quorum && i2 < configs.length) { + const config2 = configs[i2++]; + const rid = nextRid++; + config2.start = now(); + config2.staller = stall2(config2.stallTimeout); + config2.staller.wait(() => { + config2.staller = null; + }); + config2.runner = getRunner(config2, currentBlockNumber, method, params).then((result) => { + config2.done = true; + config2.result = result; + if (this.listenerCount("debug")) { + this.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config2, now()), + request: { method, params: deepCopy(params) }, + provider: this + }); + } + }, (error) => { + config2.done = true; + config2.error = error; + if (this.listenerCount("debug")) { + this.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config2, now()), + request: { method, params: deepCopy(params) }, + provider: this + }); + } + }); + if (this.listenerCount("debug")) { + this.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config2, null), + request: { method, params: deepCopy(params) }, + provider: this + }); + } + inflightWeight += config2.weight; + } + const waiting = []; + configs.forEach((c) => { + if (c.done || !c.runner) { + return; + } + waiting.push(c.runner); + if (c.staller) { + waiting.push(c.staller.getPromise()); + } + }); + if (waiting.length) { + yield Promise.race(waiting); + } + const results = configs.filter((c) => c.done && c.error == null); + if (results.length >= this.quorum) { + const result = processFunc(results); + if (result !== void 0) { + configs.forEach((c) => { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + return result; + } + if (!first) { + yield stall2(100).getPromise(); + } + first = false; + } + const errors = configs.reduce((accum, c) => { + if (!c.done || c.error == null) { + return accum; + } + const code9 = c.error.code; + if (ForwardErrors.indexOf(code9) >= 0) { + if (!accum[code9]) { + accum[code9] = { error: c.error, weight: 0 }; + } + accum[code9].weight += c.weight; + } + return accum; + }, {}); + Object.keys(errors).forEach((errorCode) => { + const tally = errors[errorCode]; + if (tally.weight < this.quorum) { + return; + } + configs.forEach((c) => { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + const e2 = tally.error; + const props = {}; + ForwardProperties.forEach((name) => { + if (e2[name] == null) { + return; + } + props[name] = e2[name]; + }); + logger38.throwError(e2.reason || e2.message, errorCode, props); + }); + if (configs.filter((c) => !c.done).length === 0) { + break; + } + } + configs.forEach((c) => { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + return logger38.throwError("failed to meet quorum", Logger.errors.SERVER_ERROR, { + method, + params, + //results: configs.map((c) => c.result), + //errors: configs.map((c) => c.error), + results: configs.map((c) => exposeDebugConfig(c)), + provider: this + }); + }); + } +}; + +// node_modules/@ethersproject/providers/lib.esm/ipc-provider.js +init_shim(); +var IpcProvider = null; + +// node_modules/@ethersproject/providers/lib.esm/infura-provider.js +init_shim(); +init_lib4(); +init_lib(); +var logger39 = new Logger(version24); +var defaultProjectId = "84842078b09946638c03157f83405213"; +var InfuraWebSocketProvider = class extends WebSocketProvider { + constructor(network, apiKey) { + const provider = new InfuraProvider(network, apiKey); + const connection = provider.connection; + if (connection.password) { + logger39.throwError("INFURA WebSocket project secrets unsupported", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "InfuraProvider.getWebSocketProvider()" + }); + } + const url = connection.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); + super(url, network); + defineReadOnly(this, "apiKey", provider.projectId); + defineReadOnly(this, "projectId", provider.projectId); + defineReadOnly(this, "projectSecret", provider.projectSecret); + } + isCommunityResource() { + return this.projectId === defaultProjectId; + } +}; +var InfuraProvider = class extends UrlJsonRpcProvider { + static getWebSocketProvider(network, apiKey) { + return new InfuraWebSocketProvider(network, apiKey); + } + static getApiKey(apiKey) { + const apiKeyObj = { + apiKey: defaultProjectId, + projectId: defaultProjectId, + projectSecret: null + }; + if (apiKey == null) { + return apiKeyObj; + } + if (typeof apiKey === "string") { + apiKeyObj.projectId = apiKey; + } else if (apiKey.projectSecret != null) { + logger39.assertArgument(typeof apiKey.projectId === "string", "projectSecret requires a projectId", "projectId", apiKey.projectId); + logger39.assertArgument(typeof apiKey.projectSecret === "string", "invalid projectSecret", "projectSecret", "[REDACTED]"); + apiKeyObj.projectId = apiKey.projectId; + apiKeyObj.projectSecret = apiKey.projectSecret; + } else if (apiKey.projectId) { + apiKeyObj.projectId = apiKey.projectId; + } + apiKeyObj.apiKey = apiKeyObj.projectId; + return apiKeyObj; + } + static getUrl(network, apiKey) { + let host = null; + switch (network ? network.name : "unknown") { + case "homestead": + host = "mainnet.infura.io"; + break; + case "goerli": + host = "goerli.infura.io"; + break; + case "sepolia": + host = "sepolia.infura.io"; + break; + case "matic": + host = "polygon-mainnet.infura.io"; + break; + case "maticmum": + host = "polygon-mumbai.infura.io"; + break; + case "optimism": + host = "optimism-mainnet.infura.io"; + break; + case "optimism-goerli": + host = "optimism-goerli.infura.io"; + break; + case "arbitrum": + host = "arbitrum-mainnet.infura.io"; + break; + case "arbitrum-goerli": + host = "arbitrum-goerli.infura.io"; + break; + default: + logger39.throwError("unsupported network", Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + const connection = { + allowGzip: true, + url: "https://" + host + "/v3/" + apiKey.projectId, + throttleCallback: (attempt, url) => { + if (apiKey.projectId === defaultProjectId) { + showThrottleMessage(); + } + return Promise.resolve(true); + } + }; + if (apiKey.projectSecret != null) { + connection.user = ""; + connection.password = apiKey.projectSecret; + } + return connection; + } + isCommunityResource() { + return this.projectId === defaultProjectId; + } +}; + +// node_modules/@ethersproject/providers/lib.esm/json-rpc-batch-provider.js +init_shim(); +init_lib4(); +init_lib26(); +var JsonRpcBatchProvider = class extends JsonRpcProvider { + send(method, params) { + const request = { + method, + params, + id: this._nextId++, + jsonrpc: "2.0" + }; + if (this._pendingBatch == null) { + this._pendingBatch = []; + } + const inflightRequest = { request, resolve: null, reject: null }; + const promise = new Promise((resolve, reject) => { + inflightRequest.resolve = resolve; + inflightRequest.reject = reject; + }); + this._pendingBatch.push(inflightRequest); + if (!this._pendingBatchAggregator) { + this._pendingBatchAggregator = setTimeout(() => { + const batch = this._pendingBatch; + this._pendingBatch = null; + this._pendingBatchAggregator = null; + const request2 = batch.map((inflight) => inflight.request); + this.emit("debug", { + action: "requestBatch", + request: deepCopy(request2), + provider: this + }); + return fetchJson(this.connection, JSON.stringify(request2)).then((result) => { + this.emit("debug", { + action: "response", + request: request2, + response: result, + provider: this + }); + batch.forEach((inflightRequest2, index) => { + const payload = result[index]; + if (payload.error) { + const error = new Error(payload.error.message); + error.code = payload.error.code; + error.data = payload.error.data; + inflightRequest2.reject(error); + } else { + inflightRequest2.resolve(payload.result); + } + }); + }, (error) => { + this.emit("debug", { + action: "response", + error, + request: request2, + provider: this + }); + batch.forEach((inflightRequest2) => { + inflightRequest2.reject(error); + }); + }); + }, 10); + } + return promise; + } +}; + +// node_modules/@ethersproject/providers/lib.esm/nodesmith-provider.js +init_shim(); +init_lib(); +var logger40 = new Logger(version24); +var defaultApiKey3 = "ETHERS_JS_SHARED"; +var NodesmithProvider = class extends UrlJsonRpcProvider { + static getApiKey(apiKey) { + if (apiKey && typeof apiKey !== "string") { + logger40.throwArgumentError("invalid apiKey", "apiKey", apiKey); + } + return apiKey || defaultApiKey3; + } + static getUrl(network, apiKey) { + logger40.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform."); + let host = null; + switch (network.name) { + case "homestead": + host = "https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc"; + break; + case "ropsten": + host = "https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc"; + break; + case "rinkeby": + host = "https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc"; + break; + case "goerli": + host = "https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc"; + break; + case "kovan": + host = "https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc"; + break; + default: + logger40.throwArgumentError("unsupported network", "network", arguments[0]); + } + return host + "?apiKey=" + apiKey; + } +}; + +// node_modules/@ethersproject/providers/lib.esm/pocket-provider.js +init_shim(); +init_lib(); +var logger41 = new Logger(version24); +var defaultApplicationId = "62e1ad51b37b8e00394bda3b"; +var PocketProvider = class extends UrlJsonRpcProvider { + static getApiKey(apiKey) { + const apiKeyObj = { + applicationId: null, + loadBalancer: true, + applicationSecretKey: null + }; + if (apiKey == null) { + apiKeyObj.applicationId = defaultApplicationId; + } else if (typeof apiKey === "string") { + apiKeyObj.applicationId = apiKey; + } else if (apiKey.applicationSecretKey != null) { + apiKeyObj.applicationId = apiKey.applicationId; + apiKeyObj.applicationSecretKey = apiKey.applicationSecretKey; + } else if (apiKey.applicationId) { + apiKeyObj.applicationId = apiKey.applicationId; + } else { + logger41.throwArgumentError("unsupported PocketProvider apiKey", "apiKey", apiKey); + } + return apiKeyObj; + } + static getUrl(network, apiKey) { + let host = null; + switch (network ? network.name : "unknown") { + case "goerli": + host = "eth-goerli.gateway.pokt.network"; + break; + case "homestead": + host = "eth-mainnet.gateway.pokt.network"; + break; + case "kovan": + host = "poa-kovan.gateway.pokt.network"; + break; + case "matic": + host = "poly-mainnet.gateway.pokt.network"; + break; + case "maticmum": + host = "polygon-mumbai-rpc.gateway.pokt.network"; + break; + case "rinkeby": + host = "eth-rinkeby.gateway.pokt.network"; + break; + case "ropsten": + host = "eth-ropsten.gateway.pokt.network"; + break; + default: + logger41.throwError("unsupported network", Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + const url = `https://${host}/v1/lb/${apiKey.applicationId}`; + const connection = { headers: {}, url }; + if (apiKey.applicationSecretKey != null) { + connection.user = ""; + connection.password = apiKey.applicationSecretKey; + } + return connection; + } + isCommunityResource() { + return this.applicationId === defaultApplicationId; + } +}; + +// node_modules/@ethersproject/providers/lib.esm/web3-provider.js +init_shim(); +init_lib4(); +init_lib(); +var logger42 = new Logger(version24); +var _nextId = 1; +function buildWeb3LegacyFetcher(provider, sendFunc) { + const fetcher = "Web3LegacyFetcher"; + return function(method, params) { + const request = { + method, + params, + id: _nextId++, + jsonrpc: "2.0" + }; + return new Promise((resolve, reject) => { + this.emit("debug", { + action: "request", + fetcher, + request: deepCopy(request), + provider: this + }); + sendFunc(request, (error, response) => { + if (error) { + this.emit("debug", { + action: "response", + fetcher, + error, + request, + provider: this + }); + return reject(error); + } + this.emit("debug", { + action: "response", + fetcher, + request, + response, + provider: this + }); + if (response.error) { + const error2 = new Error(response.error.message); + error2.code = response.error.code; + error2.data = response.error.data; + return reject(error2); + } + resolve(response.result); + }); + }); + }; +} +function buildEip1193Fetcher(provider) { + return function(method, params) { + if (params == null) { + params = []; + } + const request = { method, params }; + this.emit("debug", { + action: "request", + fetcher: "Eip1193Fetcher", + request: deepCopy(request), + provider: this + }); + return provider.request(request).then((response) => { + this.emit("debug", { + action: "response", + fetcher: "Eip1193Fetcher", + request, + response, + provider: this + }); + return response; + }, (error) => { + this.emit("debug", { + action: "response", + fetcher: "Eip1193Fetcher", + request, + error, + provider: this + }); + throw error; + }); + }; +} +var Web3Provider = class extends JsonRpcProvider { + constructor(provider, network) { + if (provider == null) { + logger42.throwArgumentError("missing provider", "provider", provider); + } + let path = null; + let jsonRpcFetchFunc = null; + let subprovider = null; + if (typeof provider === "function") { + path = "unknown:"; + jsonRpcFetchFunc = provider; + } else { + path = provider.host || provider.path || ""; + if (!path && provider.isMetaMask) { + path = "metamask"; + } + subprovider = provider; + if (provider.request) { + if (path === "") { + path = "eip-1193:"; + } + jsonRpcFetchFunc = buildEip1193Fetcher(provider); + } else if (provider.sendAsync) { + jsonRpcFetchFunc = buildWeb3LegacyFetcher(provider, provider.sendAsync.bind(provider)); + } else if (provider.send) { + jsonRpcFetchFunc = buildWeb3LegacyFetcher(provider, provider.send.bind(provider)); + } else { + logger42.throwArgumentError("unsupported provider", "provider", provider); + } + if (!path) { + path = "unknown:"; + } + } + super(path, network); + defineReadOnly(this, "jsonRpcFetchFunc", jsonRpcFetchFunc); + defineReadOnly(this, "provider", subprovider); + } + send(method, params) { + return this.jsonRpcFetchFunc(method, params); + } +}; + +// node_modules/@ethersproject/providers/lib.esm/index.js +init_lib(); +var logger43 = new Logger(version24); +function getDefaultProvider(network, options) { + if (network == null) { + network = "homestead"; + } + if (typeof network === "string") { + const match = network.match(/^(ws|http)s?:/i); + if (match) { + switch (match[1].toLowerCase()) { + case "http": + case "https": + return new JsonRpcProvider(network); + case "ws": + case "wss": + return new WebSocketProvider(network); + default: + logger43.throwArgumentError("unsupported URL scheme", "network", network); + } + } + } + const n2 = getNetwork(network); + if (!n2 || !n2._defaultProvider) { + logger43.throwError("unsupported getDefaultProvider network", Logger.errors.NETWORK_ERROR, { + operation: "getDefaultProvider", + network + }); + } + return n2._defaultProvider({ + FallbackProvider, + AlchemyProvider, + AnkrProvider, + CloudflareProvider, + EtherscanProvider, + InfuraProvider, + JsonRpcProvider, + NodesmithProvider, + PocketProvider, + Web3Provider, + IpcProvider + }, options); +} + +// node_modules/ethers/lib.esm/ethers.js +init_lib21(); + +// node_modules/ethers/lib.esm/utils.js +var utils_exports = {}; +__export(utils_exports, { + AbiCoder: () => AbiCoder, + ConstructorFragment: () => ConstructorFragment, + ErrorFragment: () => ErrorFragment, + EventFragment: () => EventFragment, + FormatTypes: () => FormatTypes, + Fragment: () => Fragment, + FunctionFragment: () => FunctionFragment, + HDNode: () => HDNode, + Indexed: () => Indexed, + Interface: () => Interface, + LogDescription: () => LogDescription, + Logger: () => Logger, + ParamType: () => ParamType, + RLP: () => lib_exports5, + SigningKey: () => SigningKey, + SupportedAlgorithm: () => SupportedAlgorithm, + TransactionDescription: () => TransactionDescription, + TransactionTypes: () => TransactionTypes, + UnicodeNormalizationForm: () => UnicodeNormalizationForm, + Utf8ErrorFuncs: () => Utf8ErrorFuncs, + Utf8ErrorReason: () => Utf8ErrorReason, + _TypedDataEncoder: () => TypedDataEncoder, + _fetchData: () => _fetchData, + _toEscapedUtf8String: () => _toEscapedUtf8String, + accessListify: () => accessListify, + arrayify: () => arrayify, + base58: () => Base58, + base64: () => lib_exports9, + checkProperties: () => checkProperties, + checkResultErrors: () => checkResultErrors, + commify: () => commify, + computeAddress: () => computeAddress, + computeHmac: () => computeHmac, + computePublicKey: () => computePublicKey, + concat: () => concat, + deepCopy: () => deepCopy, + defaultAbiCoder: () => defaultAbiCoder, + defaultPath: () => defaultPath, + defineReadOnly: () => defineReadOnly, + dnsEncode: () => dnsEncode, + entropyToMnemonic: () => entropyToMnemonic, + fetchJson: () => fetchJson, + formatBytes32String: () => formatBytes32String, + formatEther: () => formatEther, + formatUnits: () => formatUnits, + getAccountPath: () => getAccountPath, + getAddress: () => getAddress, + getContractAddress: () => getContractAddress, + getCreate2Address: () => getCreate2Address, + getIcapAddress: () => getIcapAddress, + getJsonWalletAddress: () => getJsonWalletAddress, + getStatic: () => getStatic, + hashMessage: () => hashMessage, + hexConcat: () => hexConcat, + hexDataLength: () => hexDataLength, + hexDataSlice: () => hexDataSlice, + hexStripZeros: () => hexStripZeros, + hexValue: () => hexValue, + hexZeroPad: () => hexZeroPad, + hexlify: () => hexlify, + id: () => id, + isAddress: () => isAddress, + isBytes: () => isBytes, + isBytesLike: () => isBytesLike, + isHexString: () => isHexString, + isValidMnemonic: () => isValidMnemonic, + isValidName: () => isValidName, + joinSignature: () => joinSignature, + keccak256: () => keccak256, + mnemonicToEntropy: () => mnemonicToEntropy, + mnemonicToSeed: () => mnemonicToSeed, + namehash: () => namehash, + nameprep: () => nameprep, + parseBytes32String: () => parseBytes32String, + parseEther: () => parseEther, + parseTransaction: () => parse, + parseUnits: () => parseUnits, + poll: () => poll, + randomBytes: () => randomBytes, + recoverAddress: () => recoverAddress, + recoverPublicKey: () => recoverPublicKey, + resolveProperties: () => resolveProperties, + ripemd160: () => ripemd160, + serializeTransaction: () => serialize, + sha256: () => sha256, + sha512: () => sha512, + shallowCopy: () => shallowCopy, + shuffled: () => shuffled, + solidityKeccak256: () => keccak2562, + solidityPack: () => pack2, + soliditySha256: () => sha2562, + splitSignature: () => splitSignature, + stripZeros: () => stripZeros, + toUtf8Bytes: () => toUtf8Bytes, + toUtf8CodePoints: () => toUtf8CodePoints, + toUtf8String: () => toUtf8String, + verifyMessage: () => verifyMessage, + verifyTypedData: () => verifyTypedData, + zeroPad: () => zeroPad +}); +init_shim(); +init_lib13(); +init_lib7(); +init_lib10(); +init_lib18(); +init_lib2(); +init_lib12(); +init_lib22(); +init_lib24(); +init_lib5(); +init_lib(); +init_lib19(); +init_lib27(); +init_lib23(); +init_lib4(); +init_lib6(); +init_lib16(); +init_lib9(); +init_lib17(); +init_lib28(); +init_lib25(); +init_lib26(); +init_lib19(); +init_lib9(); + +// node_modules/ethers/lib.esm/ethers.js +init_lib(); + +// node_modules/ethers/lib.esm/_version.js +init_shim(); +var version27 = "ethers/5.7.2"; + +// node_modules/ethers/lib.esm/ethers.js +var logger46 = new Logger(version27); + +// node_modules/ethers/lib.esm/index.js +try { + const anyGlobal2 = window; + if (anyGlobal2._ethers == null) { + anyGlobal2._ethers = ethers_exports; + } +} catch (error) { +} + +// packages/misc/src/lib/addresses.ts +var import_utils3 = __toESM(require_utils2()); +function publicKeyConvert(publicKey, compressed = true) { + if (compressed) { + if (publicKey.length === 65 && publicKey[0] === 4) { + const x = publicKey.subarray(1, 33); + const y = publicKey.subarray(33, 65); + const prefix = y[y.length - 1] % 2 === 0 ? 2 : 3; + return Buffer.concat([Buffer.from([prefix]), x]); + } + } else { + if (publicKey.length === 33 && (publicKey[0] === 2 || publicKey[0] === 3)) { + const x = publicKey.subarray(1); + const y = decompressY(publicKey[0], x); + return Buffer.concat([Buffer.from([4]), x, y]); + } + } + return publicKey; +} +function decompressY(prefix, x) { + const p = BigInt( + "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F" + ); + const a2 = BigInt("0"); + const b = BigInt("7"); + const xBigInt = BigInt("0x" + x.toString("hex")); + const rhs = (xBigInt ** 3n + a2 * xBigInt + b) % p; + const yBigInt = modSqrt(rhs, p); + const isEven = yBigInt % 2n === 0n; + const y = isEven === (prefix === 2) ? yBigInt : p - yBigInt; + return Buffer.from(y.toString(16).padStart(64, "0"), "hex"); +} +function modSqrt(a2, p) { + return a2 ** ((p + 1n) / 4n) % p; +} +function deriveBitcoinAddress(ethPubKey) { + if (ethPubKey.startsWith("0x")) { + ethPubKey = ethPubKey.slice(2); + } + const pubkeyBuffer = Buffer.from(ethPubKey, "hex"); + const sha256Hash = createHash("sha256").update(pubkeyBuffer).digest(); + const ripemd160Hash = createHash("ripemd160").update(sha256Hash).digest(); + const versionedPayload = Buffer.concat([Buffer.from([0]), ripemd160Hash]); + const checksum = createHash("sha256").update(createHash("sha256").update(versionedPayload).digest()).digest().subarray(0, 4); + const binaryBitcoinAddress = Buffer.concat([versionedPayload, checksum]); + return ethers_exports.utils.base58.encode(binaryBitcoinAddress); +} +function deriveCosmosAddress(ethPubKey, prefix = "cosmos") { + let pubKeyBuffer = Buffer.from(ethPubKey, "hex"); + if (pubKeyBuffer.length === 65 && pubKeyBuffer[0] === 4) { + pubKeyBuffer = Buffer.from(publicKeyConvert(pubKeyBuffer, true)); + } + const sha256Hash = createHash("sha256").update(pubKeyBuffer).digest(); + const ripemd160Hash = createHash("ripemd160").update(sha256Hash).digest(); + return bech322.encode(prefix, bech322.toWords(ripemd160Hash)); +} +var derivedAddresses = async ({ + publicKey, + pkpTokenId, + pkpContractAddress, + defaultRPCUrl, + options = { + cacheContractCall: false + } +}) => { + if (!publicKey && !pkpTokenId) { + throw new ParamsMissingError( + { + info: { + publicKey, + pkpTokenId + } + }, + "publicKey or pkpTokenId must be provided" + ); + } + let isNewPKP = false; + if (pkpTokenId) { + const CACHE_KEY = "lit-cached-pkps"; + let cachedPkpJSON; + try { + const cachedPkp = localStorage.getItem(CACHE_KEY); + if (cachedPkp) { + cachedPkpJSON = JSON.parse(cachedPkp); + publicKey = cachedPkpJSON[pkpTokenId]; + } + } catch (e2) { + console.error(e2); + } + if (!publicKey) { + if (!defaultRPCUrl || !pkpContractAddress) { + throw new NoWalletException( + { + info: { + publicKey, + pkpTokenId, + pkpContractAddress, + defaultRPCUrl + } + }, + "defaultRPCUrl or pkpContractAddress was not provided" + ); + } + const provider = new ethers_exports.providers.StaticJsonRpcProvider( + defaultRPCUrl + ); + const contract = new Contract( + pkpContractAddress, + ["function getPubkey(uint256 tokenId) view returns (bytes memory)"], + provider + ); + publicKey = await contract["getPubkey"](pkpTokenId); + isNewPKP = true; + } + if (options.cacheContractCall) { + try { + const cachedPkp = localStorage.getItem(CACHE_KEY); + if (cachedPkp) { + const cachedPkpJSON2 = JSON.parse(cachedPkp); + cachedPkpJSON2[pkpTokenId] = publicKey; + localStorage.setItem(CACHE_KEY, JSON.stringify(cachedPkpJSON2)); + } else { + const cachedPkpJSON2 = {}; + cachedPkpJSON2[pkpTokenId] = publicKey; + localStorage.setItem(CACHE_KEY, JSON.stringify(cachedPkpJSON2)); + } + } catch (e2) { + console.error(e2); + } + } + } + if (!publicKey) { + throw new NoWalletException( + { + info: { + publicKey, + pkpTokenId, + pkpContractAddress, + defaultRPCUrl + } + }, + "publicKey was not provided or could not be obtained from the pkpTokenId" + ); + } + if (publicKey.startsWith("0x")) { + publicKey = publicKey.slice(2); + } + const pubkeyBuffer = Buffer.from(publicKey, "hex"); + const ethAddress = (0, import_utils3.computeAddress)(pubkeyBuffer); + const btcAddress = deriveBitcoinAddress(publicKey); + const cosmosAddress = deriveCosmosAddress(publicKey); + if (!btcAddress || !ethAddress || !cosmosAddress) { + const errors = []; + if (!btcAddress) { + errors.push( + new NoWalletException( + { + info: { + publicKey + } + }, + "btcAddress is undefined" + ) + ); + } + if (!ethAddress) { + errors.push( + new NoWalletException( + { + info: { + publicKey + } + }, + "ethAddress is undefined" + ) + ); + } + if (!cosmosAddress) { + errors.push( + new NoWalletException( + { + info: { + publicKey + } + }, + "cosmosAddress is undefined" + ) + ); + } + throw new MultiError(errors); + } + return { + tokenId: pkpTokenId, + publicKey: `0x${publicKey}`, + publicKeyBuffer: pubkeyBuffer, + ethAddress, + btcAddress, + cosmosAddress, + isNewPKP + }; +}; + +// packages/misc/src/lib/misc.ts +init_shim(); +import Ajv from "ajv"; + +// packages/logger/src/index.ts +init_shim(); + +// packages/logger/src/lib/logger.ts +init_shim(); +var import_utils4 = __toESM(require_utils2()); +var colours = { + reset: "\x1B[0m", + bright: "\x1B[1m", + dim: "\x1B[2m", + underscore: "\x1B[4m", + blink: "\x1B[5m", + reverse: "\x1B[7m", + hidden: "\x1B[8m", + fg: { + black: "\x1B[30m", + red: "\x1B[31m", + green: "\x1B[32m", + yellow: "\x1B[33m", + blue: "\x1B[34m", + magenta: "\x1B[35m", + cyan: "\x1B[36m", + white: "\x1B[37m", + gray: "\x1B[90m", + crimson: "\x1B[38m" + // Scarlet + }, + bg: { + black: "\x1B[40m", + red: "\x1B[41m", + green: "\x1B[42m", + yellow: "\x1B[43m", + blue: "\x1B[44m", + magenta: "\x1B[45m", + cyan: "\x1B[46m", + white: "\x1B[47m", + gray: "\x1B[100m", + crimson: "\x1B[48m" + } +}; +function _convertLoggingLevel(level) { + switch (level) { + case LOG_LEVEL.INFO: + return `${colours.fg.green}[INFO]${colours.reset}`; + case LOG_LEVEL.DEBUG: + return `${colours.fg.cyan}[DEBUG]${colours.reset}`; + case LOG_LEVEL.WARN: + return `${colours.fg.yellow}[WARN]${colours.reset}`; + case LOG_LEVEL.ERROR: + return `${colours.fg.red}[ERROR]${colours.reset}`; + case LOG_LEVEL.FATAL: + return `${colours.fg.red}[FATAL]${colours.reset}`; + case LOG_LEVEL.TIMING_START: + return `${colours.fg.green}[TIME_START]${colours.reset}`; + case LOG_LEVEL.TIMING_END: + return `${colours.fg.green}[TIME_END]${colours.reset}`; + } + return "[UNKNOWN]"; +} +function _resolveLoggingHandler(level) { + switch (level) { + case LOG_LEVEL.DEBUG: + return console.debug; + case LOG_LEVEL.INFO: + return console.info; + case LOG_LEVEL.ERROR: + return console.error; + case LOG_LEVEL.WARN: + return console.warn; + case LOG_LEVEL.FATAL: + return console.error; + case LOG_LEVEL.TIMING_END: + return console.timeLog; + case LOG_LEVEL.TIMING_START: + return console.time; + } +} +function _safeStringify(obj, indent = 2) { + let cache = []; + const retVal = JSON.stringify( + obj, + (_key, value) => typeof value === "object" && value !== null ? cache?.includes(value) ? void 0 : cache?.push(value) && value : value, + indent + ); + cache = null; + return retVal; +} +var Log = class { + timestamp; + message; + args; + id; + category; + level; + error; + constructor(timestamp, message, args, id2, category, level) { + this.timestamp = timestamp; + this.message = message; + this.args = args; + this.id = id2; + this.category = category; + this.level = level; + } + toString() { + let fmtStr = `[Lit-JS-SDK v${version}]${_convertLoggingLevel( + this.level + )} [${this.category}] [id: ${this.id}] ${this.message}`; + for (let i2 = 0; i2 < this.args.length; i2++) { + if (typeof this.args[i2] === "object") { + fmtStr = `${fmtStr} ${_safeStringify(this.args[i2])}`; + } else { + fmtStr = `${fmtStr} ${this.args[i2]}`; + } + } + return fmtStr; + } + toArray() { + const args = []; + args.push(`[Lit-JS-SDK v${version}]`); + args.push(`[${this.timestamp}]`); + args.push(_convertLoggingLevel(this.level)); + args.push(`[${this.category}]`); + this.id && args.push(`${colours.fg.cyan}[id: ${this.id}]${colours.reset}`); + this.message && args.push(this.message); + for (let i2 = 0; i2 < this.args.length; i2++) { + args.push(this.args[i2]); + } + return args; + } + toJSON() { + return { + timestamp: this.timestamp, + message: this.message, + args: this.args, + id: this.id, + category: this.category, + level: this.level + }; + } +}; +var Logger2 = class { + _category; + _level; + _id; + _handler; + _consoleHandler; + _logs = []; + _logHashes = /* @__PURE__ */ new Map(); + _config; + _isParent; + _children; + _timestamp; + static createLogger(category, level, id2, isParent, config2) { + return new Logger2(category, level, id2, isParent, config2); + } + constructor(category, level, id2, isParent, config2) { + this._category = category; + this._level = level; + this._id = id2; + this._consoleHandler = _resolveLoggingHandler(this._level); + this._config = config2; + this._children = /* @__PURE__ */ new Map(); + this._isParent = isParent; + this._timestamp = Date.now(); + } + get id() { + return this._id; + } + get category() { + return this._category; + } + get timestamp() { + return this._timestamp; + } + get Logs() { + return this._logs; + } + set Config(value) { + this._config = value; + } + get Config() { + return this._config; + } + get Children() { + return this._children; + } + setLevel(level) { + this._level = level; + } + setHandler(handler) { + this._handler = handler; + } + info(message = "", ...args) { + this._log(LOG_LEVEL.INFO, message, ...args); + } + debug(message = "", ...args) { + this._log(LOG_LEVEL.DEBUG, message, ...args); + } + warn(message = "", ...args) { + this._log(LOG_LEVEL.WARN, message, args); + } + error(message = "", ...args) { + this._log(LOG_LEVEL.ERROR, message, ...args); + } + fatal(message = "", ...args) { + this._log(LOG_LEVEL.FATAL, message, ...args); + } + trace(message = "", ...args) { + this._log(LOG_LEVEL.FATAL, message, ...args); + } + timeStart(message = "", ...args) { + this._log(LOG_LEVEL.TIMING_START, message, ...args); + } + timeEnd(message = "", ...args) { + this._level < LOG_LEVEL.OFF && this._log(LOG_LEVEL.TIMING_END, message, ...args); + } + _log(level, message = "", ...args) { + const log3 = new Log( + (/* @__PURE__ */ new Date()).toISOString(), + message, + args, + this._id, + this._category, + level + ); + const arrayLog = log3.toArray(); + if (this._config?.["condenseLogs"] && !this._checkHash(log3)) { + (this._level >= level || level === 0 /* ERROR */) && this._consoleHandler && this._consoleHandler(...arrayLog); + (this._level >= level || level === LOG_LEVEL.ERROR) && this._handler && this._handler(log3); + (this._level >= level || level === 0 /* ERROR */) && this._addLog(log3); + } else if (!this._config?.["condenseLogs"]) { + (this._level >= level || level === 0 /* ERROR */) && this._consoleHandler && this._consoleHandler(...arrayLog); + (this._level >= level || level === LOG_LEVEL.ERROR) && this._handler && this._handler(log3); + (this._level >= level || level === LOG_LEVEL.ERROR) && this._addLog(log3); + } + } + _checkHash(log3) { + const strippedMessage = this._cleanString(log3.message); + const digest = (0, import_utils4.hashMessage)(strippedMessage); + const hash3 = digest.toString(); + const item = this._logHashes.get(hash3); + if (item) { + return true; + } else { + this._logHashes.set(hash3, true); + return false; + } + } + _addLog(log3) { + this._logs.push(log3); + } + _addToLocalStorage(log3) { + if (globalThis.localStorage) { + let bucket = globalThis.localStorage.getItem(log3.category); + if (bucket) { + bucket = JSON.parse(bucket); + if (!bucket[log3.id]) { + bucket[log3.id] = []; + } + bucket[log3.id].push(log3.toString()); + globalThis.localStorage.setItem(log3.category, _safeStringify(bucket)); + } else { + const bucket2 = {}; + bucket2[log3.id] = [log3.toString()]; + globalThis.localStorage.setItem(log3.category, _safeStringify(bucket2)); + } + } + } + /** + * + * @param input string which will be cleaned of non utf-8 characters + * @returns {string} input cleaned of non utf-8 characters + */ + _cleanString(input) { + let output = ""; + for (let i2 = 0; i2 < input.length; i2++) { + if (input.charCodeAt(i2) <= 127) { + output += input.charAt(i2); + } + } + return output; + } +}; +var _LogManager = class { + _loggers; + _level = LOG_LEVEL.DEBUG; + _config; + static get Instance() { + if (!_LogManager._instance) { + _LogManager._instance = new _LogManager(); + } + return _LogManager._instance; + } + static clearInstance() { + _LogManager._instance = void 0; + } + constructor() { + this._loggers = /* @__PURE__ */ new Map(); + } + withConfig(config2) { + this._config = config2; + for (const logger48 of this._loggers) { + logger48[1].Config = config2; + } + } + setLevel(level) { + this._level = level; + for (const logger48 of this._loggers) { + logger48[1].setLevel(level); + } + } + setHandler(handler) { + for (const logger48 of this._loggers) { + logger48[1].setHandler(handler); + } + } + get LoggerIds() { + const keys = []; + for (const category of this._loggers.entries()) { + for (const child of category[1].Children) { + keys.push([child[0], child[1].timestamp]); + } + } + return keys.sort((a2, b) => { + return a2[1] - b[1]; + }).map((value) => { + return value[0]; + }); + } + // if a logger is given an id it will persist logs under its logger instance + get(category, id2) { + let instance = this._loggers.get(category); + if (!instance && !id2) { + this._loggers.set( + category, + Logger2.createLogger(category, this._level ?? LOG_LEVEL.INFO, "", true) + ); + instance = this._loggers.get(category); + instance.Config = this._config; + return instance; + } + if (id2) { + if (!instance) { + this._loggers.set( + category, + Logger2.createLogger(category, this._level ?? LOG_LEVEL.INFO, "", true) + ); + instance = this._loggers.get(category); + instance.Config = this._config; + } + const children = instance?.Children; + let child = children?.get(id2); + if (child) { + return child; + } + children?.set( + id2, + Logger2.createLogger( + category, + this._level ?? LOG_LEVEL.INFO, + id2 ?? "", + true + ) + ); + child = children?.get(id2); + child.Config = this._config; + return children?.get(id2); + } else if (!instance) { + this._loggers.set( + category, + Logger2.createLogger(category, this._level ?? LOG_LEVEL.INFO, "", true) + ); + instance = this._loggers.get(category); + instance.Config = this._config; + } + return instance; + } + getById(id2) { + let logStrs = []; + for (const category of this._loggers.entries()) { + const logger48 = category[1].Children.get(id2); + if (logger48) { + const logStr = []; + for (const log3 of logger48.Logs) { + logStr.push(log3.toString()); + } + logStrs = logStrs.concat(logStr); + } + } + return logStrs; + } + getLogsForId(id2) { + let logsForRequest = this.getById(id2); + if (logsForRequest.length < 1 && globalThis.localStorage) { + for (const category of this._loggers.keys()) { + const bucketStr = globalThis.localStorage.getItem(category); + const bucket = JSON.parse( + bucketStr + ); + if (bucket && bucket[id2]) { + const logsForId = bucket[id2].filter( + (log3) => log3.includes(id2) + ); + logsForRequest = logsForId.concat(logsForRequest); + } + } + } + return logsForRequest; + } +}; +var LogManager = _LogManager; +__publicField(LogManager, "_instance"); + +// packages/misc/src/lib/misc.ts +var logBuffer = []; +var ajv = new Ajv(); +var litConfig; +var setMiscLitConfig = (config2) => { + litConfig = config2; +}; +var mostCommonString = (arr) => { + return arr.sort( + (a2, b) => arr.filter((v) => v === a2).length - arr.filter((v) => v === b).length + ).pop(); +}; +var findMostCommonResponse = (responses) => { + const result = {}; + const keys = new Set(responses.flatMap(Object.keys)); + for (const key2 of keys) { + const values = responses.map( + (response) => response[key2] + ); + const filteredValues = values.filter( + (value) => value !== void 0 && value !== "" + ); + if (filteredValues.length === 0) { + result[key2] = void 0; + } else if (typeof filteredValues[0] === "object" && !Array.isArray(filteredValues[0])) { + result[key2] = findMostCommonResponse(filteredValues); + } else { + result[key2] = mostCommonString(filteredValues); + } + } + return result; +}; +var bootstrapLogManager = (id2, level = LOG_LEVEL.DEBUG) => { + if (!globalThis.logManager) { + globalThis.logManager = LogManager.Instance; + globalThis.logManager.withConfig({ + condenseLogs: true + }); + globalThis.logManager.setLevel(level); + } + globalThis.logger = globalThis.logManager.get(id2); +}; +var getLoggerbyId = (id2) => { + return globalThis.logManager.get(id2); +}; +var log = (...args) => { + if (!globalThis) { + console.log(...args); + return; + } + if (!litConfig) { + logBuffer.push(args); + return; + } + while (logBuffer.length > 0) { + const log3 = logBuffer.shift() ?? ""; + globalThis?.logger && globalThis?.logger.debug(...log3); + } + globalThis?.logger && globalThis?.logger.debug(...args); +}; +var logWithRequestId = (id2, ...args) => { + if (!globalThis) { + console.log(...args); + return; + } + if (!litConfig) { + logBuffer.push(args); + return; + } + while (logBuffer.length > 0) { + const log3 = logBuffer.shift() ?? ""; + globalThis?.logger && globalThis.logManager.get(globalThis.logger.category, id2).debug(...log3); + } + globalThis?.logger && globalThis.logManager.get(globalThis.logger.category, id2).debug(...args); +}; +var logErrorWithRequestId = (id2, ...args) => { + if (!globalThis) { + console.log(...args); + return; + } + if (!litConfig) { + logBuffer.push(args); + return; + } + while (logBuffer.length > 0) { + const log3 = logBuffer.shift() ?? ""; + globalThis?.logger && globalThis.logManager.get(globalThis.logger.category, id2).error(...log3); + } + globalThis?.logger && globalThis.logManager.get(globalThis.logger.category, id2).error(...args); +}; +var logError = (...args) => { + if (!globalThis) { + console.log(...args); + return; + } + if (!litConfig) { + logBuffer.push(args); + return; + } + while (logBuffer.length > 0) { + const log3 = logBuffer.shift() ?? ""; + globalThis?.logger && globalThis.logManager.get(globalThis.logger.category).error(...log3); + } + globalThis?.logger && globalThis.logManager.get(globalThis.logger.category).error(...args); +}; +var getVarType = (value) => { + return Object.prototype.toString.call(value).slice(8, -1); +}; +var checkType = ({ + value, + allowedTypes, + paramName, + functionName, + throwOnError = true +}) => { + if (!allowedTypes.includes(getVarType(value))) { + const message = `Expecting ${allowedTypes.join( + " or " + )} type for parameter named ${paramName} in Lit-JS-SDK function ${functionName}(), but received "${getVarType( + value + )}" type instead. value: ${value instanceof Object ? JSON.stringify(value) : value}`; + if (throwOnError) { + throw new InvalidParamType( + { + info: { + allowedTypes, + value, + paramName, + functionName + } + }, + message + ); + } + return false; + } + return true; +}; +var checkSchema = (value, schema, paramName, functionName, throwOnError = true) => { + let validate5 = schema.$id ? ajv.getSchema(schema.$id) : void 0; + if (!validate5) { + validate5 = ajv.compile(schema); + } + const validates = validate5(value); + const message = `FAILED schema validation for parameter named ${paramName} in Lit-JS-SDK function ${functionName}(). Value: ${value instanceof Object ? JSON.stringify(value) : value}. Errors: ${JSON.stringify(validate5.errors)}`; + if (!validates) { + if (throwOnError) { + throw new InvalidParamType( + { + info: { + value, + paramName, + functionName + } + }, + message + ); + } + return false; + } + return true; +}; +var checkIfAuthSigRequiresChainParam = (authSig, chain, functionName) => { + log("checkIfAuthSigRequiresChainParam"); + for (const key2 of LIT_AUTH_SIG_CHAIN_KEYS) { + if (key2 in authSig) { + return true; + } + } + if (!checkType({ + value: chain, + allowedTypes: ["String"], + paramName: "chain", + functionName + })) { + return false; + } + return true; +}; +var sortedObject = (obj) => { + if (typeof obj !== "object" || obj === null) { + return obj; + } + if (Array.isArray(obj)) { + return obj.map(sortedObject); + } + const sortedKeys = Object.keys(obj).sort(); + const result = {}; + sortedKeys.forEach((key2) => { + result[key2] = sortedObject(obj[key2]); + }); + return result; +}; +var numberToHex = (v) => { + return "0x" + v.toString(16); +}; +var is = (value, type, paramName, functionName, throwOnError = true) => { + if (getVarType(value) !== type) { + const message = `Expecting "${type}" type for parameter named ${paramName} in Lit-JS-SDK function ${functionName}(), but received "${getVarType( + value + )}" type instead. value: ${value instanceof Object ? JSON.stringify(value) : value}`; + if (throwOnError) { + throw new InvalidParamType( + { + info: { + value, + paramName, + functionName + } + }, + message + ); + } + return false; + } + return true; +}; +var isNode = () => { + let isNode2 = false; + if (typeof process === "object") { + if (typeof process.versions === "object") { + if (typeof process.versions.node !== "undefined") { + isNode2 = true; + } + } + } + return isNode2; +}; +var isBrowser = () => { + return isNode() === false; +}; +function isSupportedLitNetwork(litNetwork) { + const supportedNetworks2 = Object.values(LIT_NETWORK); + if (!supportedNetworks2.includes(litNetwork)) { + throw new WrongNetworkException( + { + info: { + litNetwork, + supportedNetworks: supportedNetworks2 + } + }, + `Unsupported LitNetwork! (${supportedNetworks2.join("|")}) are supported.` + ); + } +} +var defaultMintClaimCallback = async (params, network = LIT_NETWORK.DatilDev) => { + isSupportedLitNetwork(network); + const AUTH_CLAIM_PATH = "/auth/claim"; + const relayUrl = params.relayUrl || RELAYER_URL_BY_NETWORK[network]; + if (!relayUrl) { + throw new InvalidArgumentException( + { + info: { + network, + relayUrl + } + }, + "No relayUrl provided and no default relayUrl found for network" + ); + } + const relayUrlWithPath = relayUrl + AUTH_CLAIM_PATH; + const response = await fetch(relayUrlWithPath, { + method: "POST", + body: JSON.stringify(params), + headers: { + "api-key": params.relayApiKey ? params.relayApiKey : "67e55044-10b1-426f-9247-bb680e5fe0c8_relayer", + "Content-Type": "application/json" + } + }); + if (response.status < 200 || response.status >= 400) { + const errResp = await response.json() ?? ""; + const errStmt = `An error occurred requesting "/auth/claim" endpoint ${JSON.stringify( + errResp + )}`; + console.warn(errStmt); + throw new NetworkError( + { + info: { + response, + errResp + } + }, + `An error occurred requesting "/auth/claim" endpoint` + ); + } + const body = await response.json(); + return body.requestId; +}; +var hexPrefixed = (str) => { + if (str.startsWith("0x")) { + return str; + } + return "0x" + str; +}; +var removeHexPrefix = (str) => { + if (str.startsWith("0x")) { + return str.slice(2); + } + return str; +}; +function sendRequest(url, req, requestId) { + return fetch(url, req).then(async (response) => { + const isJson = response.headers.get("content-type")?.includes("application/json"); + const data = isJson ? await response.json() : null; + if (!response.ok) { + const error = data || response.status; + return Promise.reject(error); + } + return data; + }).catch((error) => { + logErrorWithRequestId( + requestId, + `Something went wrong, internal id for request: lit_${requestId}. Please provide this identifier with any support requests. ${error?.message || error?.details ? `Error is ${error.message} - ${error.details}` : ""}` + ); + return Promise.reject(error); + }); +} +function normalizeAndStringify(input) { + try { + if (!input.startsWith("{") && !input.startsWith("[")) { + return input; + } + const parsed = JSON.parse(input); + return JSON.stringify(parsed); + } catch (error) { + const unescaped = input.replace(/\\(.)/g, "$1"); + if (input === unescaped) { + return input; + } + return normalizeAndStringify(unescaped); + } +} + +// packages/misc/src/lib/params-validators.ts +init_shim(); +var import_utils5 = __toESM(require_utils2()); + +// packages/misc/src/lib/utils.ts +init_shim(); +function isTokenOperator(token) { + const OPERATORS = ["and", "or"]; + return token.hasOwnProperty("operator") && OPERATORS.includes(token.operator); +} +function isValidBooleanExpression(expression) { + const STATES = { + START: "start", + CONDITION: "condition", + OPERATOR: "operator" + }; + let currentState = STATES.START; + for (const token of expression) { + switch (currentState) { + case STATES.START: + case STATES.OPERATOR: + if (isTokenOperator(token)) { + return false; + } + if (Array.isArray(token) && !isValidBooleanExpression(token)) { + return false; + } + currentState = STATES.CONDITION; + break; + default: + if (!isTokenOperator(token)) { + return false; + } + currentState = STATES.OPERATOR; + } + } + return currentState === STATES.CONDITION; +} + +// packages/misc/src/lib/params-validators.ts +var safeParams = ({ + functionName, + params +}) => { + if (!paramsValidators[functionName]) { + log(`This function ${functionName} is skipping params safe guarding.`); + return ERight(void 0); + } + const paramValidators = paramsValidators[functionName](params); + for (const validator of paramValidators) { + const validationResponse = validator.validate(); + if (validationResponse.type === EITHER_TYPE.ERROR) { + return validationResponse; + } + } + return ERight(void 0); +}; +var paramsValidators = { + // ========== NO AUTH MATERIAL NEEDED FOR CLIENT SIDE ENCRYPTION ========== + encrypt: (params) => [ + new AccessControlConditionsValidator("encrypt", params) + ], + encryptUint8Array: (params) => [ + new AccessControlConditionsValidator("encryptUint8Array", params), + new Uint8ArrayValidator("encryptUint8Array", params.dataToEncrypt) + ], + encryptFile: (params) => [ + new AccessControlConditionsValidator("encryptFile", params), + new FileValidator("encryptFile", params.file) + ], + encryptString: (params) => [ + new AccessControlConditionsValidator("encryptString", params), + new StringValidator("encryptString", params.dataToEncrypt, "dataToEncrypt") + ], + encryptToJson: (params) => [ + new AccessControlConditionsValidator("encryptToJson", params), + new EncryptToJsonValidator("encryptToJson", params) + ], + // ========== REQUIRED AUTH MATERIAL VALIDATORS ========== + executeJs: (params) => [ + new AuthMaterialValidator("executeJs", params), + new ExecuteJsValidator("executeJs", params) + ], + decrypt: (params) => [ + new AccessControlConditionsValidator("decrypt", params), + new AuthMaterialValidator("decrypt", params, true), + new StringValidator("decrypt", params.ciphertext, "ciphertext") + ], + decryptFromJson: (params) => [ + new AuthMaterialValidator("decryptFromJson", params), + new DecryptFromJsonValidator("decryptFromJson", params.parsedJsonData) + ] +}; +var EncryptToJsonValidator = class { + fnName; + params; + constructor(fnName, params) { + this.fnName = fnName; + this.params = params; + } + validate() { + const { file, string } = this.params; + if (string === void 0 && file === void 0) + return ELeft( + new InvalidParamType( + { + info: { + param: "string", + value: string, + functionName: this.fnName + } + }, + "Either string or file must be provided" + ) + ); + if (string !== void 0 && file !== void 0) + return ELeft( + new InvalidParamType( + { + info: { + param: "string", + value: string, + functionName: this.fnName + } + }, + 'Provide only a "string" or "file" to encrypt; you cannot provide both' + ) + ); + return ERight(void 0); + } +}; +var DecryptFromJsonValidator = class { + fnName; + params; + constructor(fnName, params) { + this.fnName = fnName; + this.params = params; + } + validate() { + const validators = [new StringValidator(this.fnName, this.params.dataType)]; + for (const validator of validators) { + const validationResponse = validator.validate(); + if (validationResponse.type === EITHER_TYPE.ERROR) { + return validationResponse; + } + } + const { dataType } = this.params; + if (dataType !== "string" && dataType !== "file") + return ELeft( + new InvalidArgumentException( + { + info: { + functionName: this.fnName, + dataType + } + }, + `dataType of %s is not valid. Must be 'string' or 'file'.`, + dataType + ) + ); + return ERight(void 0); + } +}; +var Uint8ArrayValidator = class { + fnName; + paramName; + uint8array; + constructor(fnName, uint8array, paramName = "uint8array") { + this.fnName = fnName; + this.paramName = paramName; + this.uint8array = uint8array; + } + validate() { + if (!this.uint8array) { + return ELeft(new InvalidParamType({}, "uint8array is undefined")); + } + if (!checkType({ + value: this.uint8array, + allowedTypes: ["Uint8Array"], + paramName: this.paramName, + functionName: this.fnName + })) + return ELeft( + new InvalidParamType( + { + info: { + param: this.paramName, + value: this.uint8array, + functionName: this.fnName + } + }, + "%s is not a Uint8Array", + this.paramName + ) + ); + return ERight(void 0); + } +}; +var StringValidator = class { + fnName; + paramName; + checkIsHex; + str; + constructor(fnName, str, paramName = "string", checkIsHex = false) { + this.fnName = fnName; + this.paramName = paramName; + this.checkIsHex = checkIsHex; + this.str = str; + } + validate() { + if (!this.str) { + return ELeft(new InvalidParamType({}, "str is undefined")); + } + if (!checkType({ + value: this.str, + allowedTypes: ["String"], + paramName: this.paramName, + functionName: this.fnName + })) + return ELeft( + new InvalidParamType( + { + info: { + param: this.paramName, + value: this.str, + functionName: this.fnName + } + }, + "%s is not a string", + this.paramName + ) + ); + if (this.checkIsHex && !(0, import_utils5.isHexString)(this.str)) { + return ELeft( + new InvalidParamType( + { + info: { + param: this.paramName, + value: this.str, + functionName: this.fnName + } + }, + "%s is not a valid hex string", + this.paramName + ) + ); + } + return ERight(void 0); + } +}; +var ExecuteJsValidator = class { + fnName; + params; + constructor(fnName, params) { + this.fnName = fnName; + this.params = params; + } + validate() { + const { code: code9, ipfsId } = this.params; + if (!code9 && !ipfsId) { + return ELeft( + new ParamsMissingError( + { + info: { + functionName: this.fnName, + params: this.params + } + }, + "You must pass either code or ipfsId" + ) + ); + } + if (code9 && ipfsId) { + return ELeft( + new ParamsMissingError( + { + info: { + functionName: this.fnName, + params: this.params + } + }, + "You cannot have both 'code' and 'ipfs' at the same time" + ) + ); + } + return ERight(void 0); + } +}; +var FileValidator = class { + fnName; + file; + constructor(fnName, file) { + this.fnName = fnName; + this.file = file; + } + validate() { + if (!this.file) { + return ELeft( + new InvalidArgumentException( + { + info: { + functionName: this.fnName, + file: this.file + } + }, + "You must pass file param" + ) + ); + } + const allowedTypes = ["Blob", "File", "Uint8Array"]; + if (!checkType({ + value: this.file, + allowedTypes, + paramName: "file", + functionName: this.fnName + })) + return ELeft( + new InvalidArgumentException( + { + info: { + functionName: this.fnName, + file: this.file, + allowedTypes + } + }, + "File param is not a valid Blob or File object" + ) + ); + return ERight(void 0); + } +}; +var AuthMaterialValidator = class { + fnName; + authMaterial; + checkIfAuthSigRequiresChainParam; + constructor(fnName, params, checkIfAuthSigRequiresChainParam2 = false) { + this.fnName = fnName; + this.authMaterial = params; + this.checkIfAuthSigRequiresChainParam = checkIfAuthSigRequiresChainParam2; + } + validate() { + const { authSig, sessionSigs } = this.authMaterial; + if (authSig && !is(authSig, "Object", "authSig", this.fnName)) + return ELeft( + new InvalidParamType( + { + info: { + param: "authSig", + value: authSig, + functionName: this.fnName + } + }, + "authSig is not an object" + ) + ); + if (this.checkIfAuthSigRequiresChainParam) { + if (!this.authMaterial.chain) + return ELeft( + new InvalidArgumentException( + { + info: { + functionName: this.fnName, + chain: this.authMaterial.chain + } + }, + "You must pass chain param" + ) + ); + if (authSig && !checkIfAuthSigRequiresChainParam( + authSig, + this.authMaterial.chain, + this.fnName + )) + return ELeft( + new InvalidParamType( + { + info: { + param: "authSig", + value: authSig, + functionName: this.fnName + } + }, + "authSig is not valid" + ) + ); + } + if (sessionSigs && !is(sessionSigs, "Object", "sessionSigs", this.fnName)) + return ELeft( + new InvalidParamType( + { + info: { + param: "sessionSigs", + value: sessionSigs, + functionName: this.fnName + } + }, + "sessionSigs is not an object" + ) + ); + if (!sessionSigs && !authSig) + return ELeft( + new InvalidArgumentException( + { + info: { + functionName: this.fnName, + sessionSigs, + authSig + } + }, + "You must pass either authSig or sessionSigs" + ) + ); + if (sessionSigs && authSig) + return ELeft( + new InvalidArgumentException( + { + info: { + functionName: this.fnName, + sessionSigs, + authSig + } + }, + "You cannot have both authSig and sessionSigs" + ) + ); + return ERight(void 0); + } +}; +var AccessControlConditionsValidator = class { + fnName; + conditions; + constructor(fnName, params) { + this.fnName = fnName; + this.conditions = params; + } + validate() { + const { + accessControlConditions, + evmContractConditions, + solRpcConditions, + unifiedAccessControlConditions + } = this.conditions; + if (accessControlConditions && !is( + accessControlConditions, + "Array", + "accessControlConditions", + this.fnName + )) + return ELeft( + new InvalidParamType( + { + info: { + param: "accessControlConditions", + value: accessControlConditions, + functionName: this.fnName + } + }, + "%s is not an array", + "accessControlConditions" + ) + ); + if (evmContractConditions && !is(evmContractConditions, "Array", "evmContractConditions", this.fnName)) + return ELeft( + new InvalidParamType( + { + info: { + param: "evmContractConditions", + value: evmContractConditions, + functionName: this.fnName + } + }, + "%s is not an array", + "evmContractConditions" + ) + ); + if (solRpcConditions && !is(solRpcConditions, "Array", "solRpcConditions", this.fnName)) + return ELeft( + new InvalidParamType( + { + info: { + param: "solRpcConditions", + value: solRpcConditions, + functionName: this.fnName + } + }, + "%s is not an array", + "solRpcConditions" + ) + ); + if (unifiedAccessControlConditions && !is( + unifiedAccessControlConditions, + "Array", + "unifiedAccessControlConditions", + this.fnName + )) + return ELeft( + new InvalidParamType( + { + info: { + param: "unifiedAccessControlConditions", + value: unifiedAccessControlConditions, + functionName: this.fnName + } + }, + "%s is not an array", + "unifiedAccessControlConditions" + ) + ); + if (!accessControlConditions && !evmContractConditions && !solRpcConditions && !unifiedAccessControlConditions) + return ELeft( + new InvalidArgumentException( + { + info: { + functionName: this.fnName, + conditions: this.conditions + } + }, + "You must pass either accessControlConditions, evmContractConditions, solRpcConditions or unifiedAccessControlConditions" + ) + ); + if (accessControlConditions && !isValidBooleanExpression(accessControlConditions)) + return ELeft( + new InvalidBooleanException( + { + info: { + functionName: this.fnName, + accessControlConditions + } + }, + "Invalid boolean Access Control Conditions" + ) + ); + if (evmContractConditions && !isValidBooleanExpression(evmContractConditions)) + return ELeft( + new InvalidBooleanException( + { + info: { + functionName: this.fnName, + evmContractConditions + } + }, + "Invalid boolean EVM Access Control Conditions" + ) + ); + if (solRpcConditions && !isValidBooleanExpression(solRpcConditions)) + return ELeft( + new InvalidBooleanException( + { + info: { + functionName: this.fnName, + solRpcConditions + } + }, + "Invalid boolean Solana Access Control Conditions" + ) + ); + if (unifiedAccessControlConditions && !isValidBooleanExpression(unifiedAccessControlConditions)) + return ELeft( + new InvalidBooleanException( + { + info: { + functionName: this.fnName, + unifiedAccessControlConditions + } + }, + "Invalid boolean Unified Access Control Conditions" + ) + ); + return ERight(void 0); + } +}; + +// packages/misc/src/lib/helper/session-sigs-validator.ts +init_shim(); +function parseSignedMessage(signedMessage) { + const lines = signedMessage.split("\n"); + const parsedData = {}; + let currentKey = null; + let currentValue = ""; + lines.forEach((line) => { + const keyValueMatch = line.match(/^([^:]+):\s*(.*)$/); + if (keyValueMatch) { + if (currentKey !== null) { + parsedData[currentKey.trim()] = currentValue.trim(); + } + currentKey = keyValueMatch[1]; + currentValue = keyValueMatch[2]; + } else if (line.startsWith("- ")) { + const item = line.substring(2).trim(); + if (!parsedData[currentKey]) { + parsedData[currentKey] = []; + } + parsedData[currentKey].push(item); + } else if (line.trim() === "") { + } else { + currentValue += "\n" + line; + } + }); + if (currentKey !== null) { + parsedData[currentKey.trim()] = currentValue.trim(); + } + return parsedData; +} +function validateExpiration(expirationTimeStr, context) { + const errors = []; + const expirationTime = new Date(expirationTimeStr); + const currentTime = /* @__PURE__ */ new Date(); + if (isNaN(expirationTime.getTime())) { + errors.push( + `Invalid Expiration Time format in ${context}: ${expirationTimeStr}` + ); + } else if (expirationTime < currentTime) { + errors.push( + `Expired ${context}. Expiration Time: ${expirationTime.toISOString()}` + ); + } + return { + isValid: errors.length === 0, + errors + }; +} +function parseCapabilities(capabilities) { + const errors = []; + capabilities.forEach((capability, index) => { + const { signedMessage } = capability; + const parsedCapabilityMessage = parseSignedMessage(signedMessage); + capability.parsedSignedMessage = parsedCapabilityMessage; + const expirationTimeStr = parsedCapabilityMessage["Expiration Time"]; + if (expirationTimeStr) { + const validationResult = validateExpiration( + expirationTimeStr, + `capability ${index}` + ); + if (!validationResult.isValid) { + errors.push(...validationResult.errors); + } + } else { + errors.push( + `Expiration Time not found in capability ${index}'s signedMessage.` + ); + } + }); + return { + isValid: errors.length === 0, + errors + }; +} +function validateSessionSig(sessionSig) { + const errors = []; + let parsedSignedMessage; + try { + parsedSignedMessage = JSON.parse(sessionSig.signedMessage); + } catch (error) { + errors.push("Main signedMessage is not valid JSON."); + return { isValid: false, errors }; + } + const capabilities = parsedSignedMessage.capabilities; + if (!capabilities) { + errors.push("Capabilities not found in main signedMessage."); + } else if (capabilities.length === 0) { + errors.push("No capabilities found in main signedMessage."); + } else { + const capabilitiesValidationResult = parseCapabilities(capabilities); + if (!capabilitiesValidationResult.isValid) { + errors.push(...capabilitiesValidationResult.errors); + } + } + const outerExpirationTimeStr = parsedSignedMessage["expiration"]; + if (outerExpirationTimeStr) { + const validationResult = validateExpiration( + outerExpirationTimeStr, + "main signedMessage" + ); + if (!validationResult.isValid) { + errors.push(...validationResult.errors); + } + } else { + errors.push("Expiration Time not found in outer signedMessage."); + } + return { + isValid: errors.length === 0, + errors + }; +} +function validateSessionSigs(sessionSigs) { + const errors = []; + Object.entries(sessionSigs).forEach(([key2, sessionSig]) => { + const validationResult = validateSessionSig(sessionSig); + if (!validationResult.isValid) { + errors.push( + `Session Sig '${key2}': ${validationResult.errors.join(", ")}` + ); + } + }); + return { + isValid: errors.length === 0, + errors + }; +} + +// packages/misc/src/lib/helper/session-sigs-reader.ts +init_shim(); +function formatDuration(start, end) { + const diff = end.getTime() - start.getTime(); + const days = Math.floor(diff / (1e3 * 60 * 60 * 24)); + const hours = Math.floor(diff % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)); + const minutes = Math.floor(diff % (1e3 * 60 * 60) / (1e3 * 60)); + const seconds = (diff % (1e3 * 60) / 1e3).toFixed(3); + let elapsedTime; + if (days > 0) { + elapsedTime = `${days} days`; + } else if (hours > 0) { + elapsedTime = `${hours} hours, ${minutes} minutes, ${seconds} seconds`; + } else { + elapsedTime = `${minutes} minutes, ${seconds} seconds`; + } + return elapsedTime; +} +function formatStatus(expirationDate, currentDate) { + if (expirationDate > currentDate) { + const timeLeft = formatDuration(currentDate, expirationDate); + return `\u2705 Not expired (valid for ${timeLeft})`; + } else { + const timeAgo = formatDuration(expirationDate, currentDate); + return `\u274C Expired (expired ${timeAgo} ago)`; + } +} +function humanReadableAtt(obj, indentLevel = 0) { + const indent = " ".repeat(indentLevel * 2); + let result = ""; + for (const key2 in obj) { + result += `${indent}* ${key2} +`; + if (typeof obj[key2] === "object" && !Array.isArray(obj[key2])) { + result += humanReadableAtt(obj[key2], indentLevel + 1); + } else if (Array.isArray(obj[key2])) { + obj[key2].forEach((item) => { + if (typeof item === "object") { + result += humanReadableAtt(item, indentLevel + 1); + } else { + result += `${indent} * ${item} +`; + } + }); + } else { + result += `${indent} * ${obj[key2]} +`; + } + } + return result; +} +function formatSessionSigs(sessionSigs, currentTime = /* @__PURE__ */ new Date()) { + const parsedSigs = JSON.parse(sessionSigs); + const firstNodeKey = Object.keys(parsedSigs)[0]; + const firstNode = parsedSigs[firstNodeKey]; + let signedMessage; + try { + signedMessage = JSON.parse(firstNode.signedMessage); + } catch (error) { + const errorMessage = error instanceof Error ? error.message : "Unknown error"; + throw new Error(`Invalid JSON format for signedMessage: ${errorMessage}`); + } + const currentDate = new Date(currentTime); + let result = `The request time is at: ${currentDate.toISOString()} +`; + let issuedAt, expiration; + try { + issuedAt = new Date(signedMessage.issuedAt); + expiration = new Date(signedMessage.expiration); + } catch (error) { + const errorMessage = error instanceof Error ? error.message : "Unknown error"; + throw new Error(`Error parsing issuedAt or expiration: ${errorMessage}`); + } + result += "* Outer expiration:\n"; + result += ` * Issued at: ${issuedAt.toISOString()} +`; + result += ` * Expiration: ${expiration.toISOString()} +`; + result += ` * Duration: ${formatDuration(issuedAt, expiration)} +`; + result += ` * Status: ${formatStatus(expiration, currentDate)} +`; + result += "* Capabilities:\n"; + signedMessage.capabilities.forEach((cap, index) => { + const capType = cap.derivedVia; + const parsedCapMessage = parseSignedMessage(cap.signedMessage); + let attenuation = ""; + try { + const encodedRecap = parsedCapMessage["- urn"]?.split(":")[1]; + const decodedRecap = atob(encodedRecap); + const jsonRecap = JSON.parse(decodedRecap); + attenuation = humanReadableAtt(jsonRecap.att, 6); + } catch (e2) { + console.log("Error parsing attenuation::", e2); + } + const capIssuedAt = new Date(parsedCapMessage["Issued At"] || ""); + const capExpiration = new Date(parsedCapMessage["Expiration Time"] || ""); + result += ` * Capability ${index + 1} (${capType}): +`; + result += ` * Issued at: ${capIssuedAt.toISOString()} +`; + result += ` * Expiration: ${capExpiration.toISOString()} +`; + result += ` * Duration: ${formatDuration( + capIssuedAt, + capExpiration + )} +`; + result += ` * Status: ${formatStatus(capExpiration, currentDate)} +`; + result += ` * Attenuation: +`; + result += attenuation; + }); + return result; +} + +// packages/uint8arrays/src/index.ts +init_shim(); + +// packages/uint8arrays/src/lib/uint8arrays.ts +init_shim(); +function utf8Encode(str) { + let utf8Array = []; + for (let i2 = 0; i2 < str.length; i2++) { + let charCode = str.charCodeAt(i2); + if (charCode < 128) { + utf8Array.push(charCode); + } else if (charCode < 2048) { + utf8Array.push(192 | charCode >> 6, 128 | charCode & 63); + } else if ( + // Check if the character is a high surrogate (UTF-16) + (charCode & 64512) === 55296 && i2 + 1 < str.length && (str.charCodeAt(i2 + 1) & 64512) === 56320 + ) { + charCode = 65536 + ((charCode & 1023) << 10) + (str.charCodeAt(++i2) & 1023); + utf8Array.push( + 240 | charCode >> 18, + 128 | charCode >> 12 & 63, + 128 | charCode >> 6 & 63, + 128 | charCode & 63 + ); + } else { + utf8Array.push( + 224 | charCode >> 12, + 128 | charCode >> 6 & 63, + 128 | charCode & 63 + ); + } + } + return new Uint8Array(utf8Array); +} +function utf8Decode(utf8Array) { + let str = ""; + let i2 = 0; + while (i2 < utf8Array.length) { + let charCode = utf8Array[i2++]; + if (charCode < 128) { + str += String.fromCharCode(charCode); + } else if (charCode > 191 && charCode < 224) { + str += String.fromCharCode( + (charCode & 31) << 6 | utf8Array[i2++] & 63 + ); + } else if (charCode > 239 && charCode < 365) { + charCode = (charCode & 7) << 18 | (utf8Array[i2++] & 63) << 12 | (utf8Array[i2++] & 63) << 6 | utf8Array[i2++] & 63; + charCode -= 65536; + str += String.fromCharCode( + 55296 + (charCode >> 10), + 56320 + (charCode & 1023) + ); + } else { + str += String.fromCharCode( + (charCode & 15) << 12 | (utf8Array[i2++] & 63) << 6 | utf8Array[i2++] & 63 + ); + } + } + return str; +} +function base64ToUint8Array(base64Str) { + const binaryStr = atob(base64Str); + const len = binaryStr.length; + const bytes = new Uint8Array(len); + for (let i2 = 0; i2 < len; i2++) { + bytes[i2] = binaryStr.charCodeAt(i2); + } + return bytes; +} +function uint8ArrayToBase64(uint8Array) { + let binaryStr = ""; + for (let i2 = 0; i2 < uint8Array.length; i2++) { + binaryStr += String.fromCharCode(uint8Array[i2]); + } + return btoa(binaryStr); +} +function base64UrlPadToBase64(base64UrlPadStr) { + return base64UrlPadStr.replace("-", "+").replace("_", "/") + "=".repeat((4 - base64UrlPadStr.length % 4) % 4); +} +function base64ToBase64UrlPad(base64Str) { + return base64Str.replace("+", "-").replace("/", "_").replace(/=+$/, ""); +} +function uint8arrayFromString(str, encoding = "utf8") { + switch (encoding) { + case "utf8": + return utf8Encode(str); + case "base16": + const arr = []; + for (let i2 = 0; i2 < str.length; i2 += 2) { + arr.push(parseInt(str.slice(i2, i2 + 2), 16)); + } + return new Uint8Array(arr); + case "base64": + return base64ToUint8Array(str); + case "base64url": + case "base64urlpad": + return base64ToUint8Array(base64UrlPadToBase64(str)); + default: + throw new InvalidParamType( + { + info: { + encoding, + str + } + }, + `Unsupported encoding "${encoding}"` + ); + } +} +function uint8arrayToString(uint8array, encoding = "utf8") { + let _uint8array = new Uint8Array(uint8array); + switch (encoding) { + case "utf8": + return utf8Decode(_uint8array); + case "base16": + return Array.from(_uint8array).map((byte) => byte.toString(16).padStart(2, "0")).join(""); + case "base64": + return uint8ArrayToBase64(_uint8array); + case "base64url": + case "base64urlpad": + return base64ToBase64UrlPad(uint8ArrayToBase64(_uint8array)); + default: + throw new InvalidParamType( + { + info: { + encoding, + _uint8array + } + }, + `Unsupported encoding "${encoding}"` + ); + } +} + +// packages/auth-browser/src/lib/chains/cosmos.ts +var getProvider = (walletType) => { + switch (walletType) { + case "keplr": + if ("keplr" in window) { + return window?.keplr; + } + break; + case "leap": + if ("leap" in window) { + return window?.leap; + } + } + throw new NoWalletException( + { + info: { + walletType + } + }, + "No web3 wallet was found that works with Cosmos. Install a Cosmos wallet or choose another chain" + ); +}; +var connectCosmosProvider = async ({ + chain, + walletType +}) => { + const chainId = LIT_COSMOS_CHAINS[chain].chainId; + const wallet = getProvider(walletType); + await wallet.enable(chainId); + const offlineSigner = wallet.getOfflineSigner(chainId); + const accounts = await offlineSigner.getAccounts(); + return { provider: wallet, account: accounts[0].address, chainId }; +}; +var checkAndSignCosmosAuthMessage = async ({ + chain, + walletType +}) => { + const connectedCosmosProvider = await connectCosmosProvider({ + chain, + walletType + }); + const storageKey = LOCAL_STORAGE_KEYS.AUTH_COSMOS_SIGNATURE; + let authSigString = localStorage.getItem(storageKey); + if (!authSigString) { + log("signing auth message because sig is not in local storage"); + await signAndSaveAuthMessage(connectedCosmosProvider); + authSigString = localStorage.getItem(storageKey); + } + let authSig = JSON.parse(authSigString); + if (connectedCosmosProvider.account != authSig.address) { + log( + "signing auth message because account is not the same as the address in the auth sig" + ); + await signAndSaveAuthMessage(connectedCosmosProvider); + authSigString = localStorage.getItem(storageKey); + authSig = JSON.parse(authSigString); + } + log("authSig", authSig); + return authSig; +}; +var signAndSaveAuthMessage = async (connectedCosmosProvider) => { + const { provider, account, chainId } = connectedCosmosProvider; + const now2 = (/* @__PURE__ */ new Date()).toISOString(); + const body = AUTH_SIGNATURE_BODY.replace("{{timestamp}}", now2); + const signed2 = await provider.signArbitrary(chainId, account, body); + const data = uint8arrayToString(uint8arrayFromString(body, "utf8"), "base64"); + const signDoc = { + chain_id: "", + account_number: "0", + sequence: "0", + fee: { + gas: "0", + amount: [] + }, + msgs: [ + { + type: "sign/MsgSignData", + value: { + signer: account, + data + } + } + ], + memo: "" + }; + const encodedSignedMsg = serializeSignDoc(signDoc); + const digest = await crypto.subtle.digest("SHA-256", encodedSignedMsg); + const digest_hex = uint8arrayToString(new Uint8Array(digest), "base16"); + const authSig = { + sig: signed2.signature, + derivedVia: "cosmos.signArbitrary", + signedMessage: digest_hex, + address: account + }; + localStorage.setItem( + LOCAL_STORAGE_KEYS.AUTH_COSMOS_SIGNATURE, + JSON.stringify(authSig) + ); +}; +var serializeSignDoc = (signDoc) => { + const sorted = JSON.stringify(sortedObject(signDoc)); + return uint8arrayFromString(sorted, "utf8"); +}; + +// packages/auth-browser/src/lib/chains/eth.ts +init_shim(); +init_lib2(); +import { Buffer as BufferPolyfill } from "buffer"; +import depd4 from "depd"; +init_lib9(); +init_lib25(); +import { + EthereumProvider +} from "@walletconnect/ethereum-provider"; +var import_utils7 = __toESM(require_utils2()); +import { SiweMessage } from "siwe"; +import * as nacl from "tweetnacl"; +import * as naclUtil from "tweetnacl-util"; + +// packages/misc-browser/src/index.ts +init_shim(); + +// packages/misc-browser/src/lib/misc-browser.ts +init_shim(); +var getStorageItem = (key2) => { + let item; + try { + item = localStorage.getItem(key2); + } catch (e2) { + } + if (!item) { + return ELeft( + new LocalStorageItemNotFoundException( + { + info: { + storageKey: key2 + } + }, + `Failed to get %s from local storage`, + key2 + ) + ); + } + return ERight(item); +}; +var setStorageItem = (key2, value) => { + try { + localStorage.setItem(key2, value); + return ERight(value); + } catch (e2) { + return ELeft( + new LocalStorageItemNotSetException( + { + info: { + storageKey: key2 + } + }, + `Failed to set %s in local storage`, + key2 + ) + ); + } +}; +var removeStorageItem = (key2) => { + try { + localStorage.removeItem(key2); + return ERight(key2); + } catch (e2) { + return ELeft( + new LocalStorageItemNotRemovedException( + { + info: { + storageKey: key2 + } + }, + `Failed to remove %s from local storage`, + key2 + ) + ); + } +}; + +// packages/auth-browser/src/lib/connect-modal/modal.ts +init_shim(); +function e(e2, t2) { + for (var o2 = 0; o2 < t2.length; o2++) { + var n2 = t2[o2]; + n2.enumerable = n2.enumerable || false, n2.configurable = true, "value" in n2 && (n2.writable = true), Object.defineProperty(e2, n2.key, n2); + } +} +function t(e2) { + return function(e3) { + if (Array.isArray(e3)) + return o(e3); + }(e2) || function(e3) { + if ("undefined" != typeof Symbol && Symbol.iterator in Object(e3)) + return Array.from(e3); + }(e2) || function(e3, t2) { + if (!e3) + return; + if ("string" == typeof e3) + return o(e3, t2); + var n2 = Object.prototype.toString.call(e3).slice(8, -1); + "Object" === n2 && e3.constructor && (n2 = e3.constructor.name); + if ("Map" === n2 || "Set" === n2) + return Array.from(e3); + if ("Arguments" === n2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) + return o(e3, t2); + }(e2) || function() { + throw new TypeError( + "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." + ); + }(); +} +function o(e2, t2) { + (null == t2 || t2 > e2.length) && (t2 = e2.length); + for (var o2 = 0, n2 = new Array(t2); o2 < t2; o2++) + n2[o2] = e2[o2]; + return n2; +} +var n; +var i; +var a; +var r2; +var s; +var l = (n = [ + "a[href]", + "area[href]", + 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', + "select:not([disabled]):not([aria-hidden])", + "textarea:not([disabled]):not([aria-hidden])", + "button:not([disabled]):not([aria-hidden])", + "iframe", + "object", + "embed", + "[contenteditable]", + '[tabindex]:not([tabindex^="-"])' +], i = function() { + function o2(e2) { + var n2 = e2.targetModal, i3 = e2.triggers, a3 = void 0 === i3 ? [] : i3, r3 = e2.onShow, s2 = void 0 === r3 ? function() { + } : r3, l2 = e2.onClose, c = void 0 === l2 ? function() { + } : l2, d = e2.openTrigger, u = void 0 === d ? "data-micromodal-trigger" : d, f = e2.closeTrigger, h = void 0 === f ? "data-micromodal-close" : f, v = e2.openClass, g = void 0 === v ? "is-open" : v, m = e2.disableScroll, b = void 0 !== m && m, y = e2.disableFocus, p = void 0 !== y && y, w = e2.awaitCloseAnimation, E = void 0 !== w && w, k = e2.awaitOpenAnimation, M2 = void 0 !== k && k, A2 = e2.debugMode, C = void 0 !== A2 && A2; + !function(e3, t2) { + if (!(e3 instanceof t2)) + throw new TypeError("Cannot call a class as a function"); + }(this, o2), this.modal = document.getElementById(n2), this.config = { + debugMode: C, + disableScroll: b, + openTrigger: u, + closeTrigger: h, + openClass: g, + onShow: s2, + onClose: c, + awaitCloseAnimation: E, + awaitOpenAnimation: M2, + disableFocus: p + }, a3.length > 0 && this.registerTriggers.apply(this, t(a3)), this.onClick = this.onClick.bind(this), this.onKeydown = this.onKeydown.bind(this); + } + var i2, a2, r22; + return i2 = o2, (a2 = [ + { + key: "registerTriggers", + value: function() { + for (var e2 = this, t2 = arguments.length, o3 = new Array(t2), n2 = 0; n2 < t2; n2++) + o3[n2] = arguments[n2]; + o3.filter(Boolean).forEach(function(t3) { + t3.addEventListener("click", function(t4) { + return e2.showModal(t4); + }); + }); + } + }, + { + key: "showModal", + value: function() { + var e2 = this, t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null; + if (this.activeElement = document.activeElement, this.modal.setAttribute("aria-hidden", "false"), this.modal.classList.add(this.config.openClass), this.scrollBehaviour("disable"), this.addEventListeners(), this.config.awaitOpenAnimation) { + var o3 = function t3() { + e2.modal.removeEventListener("animationend", t3, false), e2.setFocusToFirstNode(); + }; + this.modal.addEventListener("animationend", o3, false); + } else + this.setFocusToFirstNode(); + this.config.onShow(this.modal, this.activeElement, t2); + } + }, + { + key: "closeModal", + value: function() { + var e2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, t2 = this.modal; + if (this.modal.setAttribute("aria-hidden", "true"), this.removeEventListeners(), this.scrollBehaviour("enable"), this.activeElement && this.activeElement.focus && this.activeElement.focus(), this.config.onClose(this.modal, this.activeElement, e2), this.config.awaitCloseAnimation) { + var o3 = this.config.openClass; + this.modal.addEventListener( + "animationend", + function e3() { + t2.classList.remove(o3), t2.removeEventListener("animationend", e3, false); + }, + false + ); + } else + t2.classList.remove(this.config.openClass); + } + }, + { + key: "closeModalById", + value: function(e2) { + this.modal = document.getElementById(e2), this.modal && this.closeModal(); + } + }, + { + key: "scrollBehaviour", + value: function(e2) { + if (this.config.disableScroll) { + var t2 = document.querySelector("body"); + switch (e2) { + case "enable": + Object.assign(t2.style, { overflow: "" }); + break; + case "disable": + Object.assign(t2.style, { overflow: "hidden" }); + } + } + } + }, + { + key: "addEventListeners", + value: function() { + this.modal.addEventListener("touchstart", this.onClick), this.modal.addEventListener("click", this.onClick), document.addEventListener("keydown", this.onKeydown); + } + }, + { + key: "removeEventListeners", + value: function() { + this.modal.removeEventListener("touchstart", this.onClick), this.modal.removeEventListener("click", this.onClick), document.removeEventListener("keydown", this.onKeydown); + } + }, + { + key: "onClick", + value: function(e2) { + (e2.target.hasAttribute(this.config.closeTrigger) || e2.target.parentNode.hasAttribute(this.config.closeTrigger)) && (e2.preventDefault(), e2.stopPropagation(), this.closeModal(e2)); + } + }, + { + key: "onKeydown", + value: function(e2) { + 27 === e2.keyCode && this.closeModal(e2), 9 === e2.keyCode && this.retainFocus(e2); + } + }, + { + key: "getFocusableNodes", + value: function() { + var e2 = this.modal.querySelectorAll(n); + return Array.apply(void 0, t(e2)); + } + }, + { + key: "setFocusToFirstNode", + value: function() { + var e2 = this; + if (!this.config.disableFocus) { + var t2 = this.getFocusableNodes(); + if (0 !== t2.length) { + var o3 = t2.filter(function(t3) { + return !t3.hasAttribute(e2.config.closeTrigger); + }); + o3.length > 0 && o3[0].focus(), 0 === o3.length && t2[0].focus(); + } + } + } + }, + { + key: "retainFocus", + value: function(e2) { + var t2 = this.getFocusableNodes(); + if (0 !== t2.length) + if (t2 = t2.filter(function(e3) { + return null !== e3.offsetParent; + }), this.modal.contains(document.activeElement)) { + var o3 = t2.indexOf(document.activeElement); + e2.shiftKey && 0 === o3 && (t2[t2.length - 1].focus(), e2.preventDefault()), !e2.shiftKey && t2.length > 0 && o3 === t2.length - 1 && (t2[0].focus(), e2.preventDefault()); + } else + t2[0].focus(); + } + } + ]) && e(i2.prototype, a2), r22 && e(i2, r22), o2; +}(), a = null, r2 = function(e2) { + if (!document.getElementById(e2)) + return console.warn( + "MicroModal: \u2757Seems like you have missed %c'".concat(e2, "'"), + "background-color: #f8f9fa;color: #50596c;font-weight: bold;", + "ID somewhere in your code. Refer example below to resolve it." + ), console.warn( + "%cExample:", + "background-color: #f8f9fa;color: #50596c;font-weight: bold;", + '') + ), false; +}, s = function(e2, t2) { + if (function(e3) { + e3.length <= 0 && (console.warn( + "MicroModal: \u2757Please specify at least one %c'micromodal-trigger'", + "background-color: #f8f9fa;color: #50596c;font-weight: bold;", + "data attribute." + ), console.warn( + "%cExample:", + "background-color: #f8f9fa;color: #50596c;font-weight: bold;", + '' + )); + }(e2), !t2) + return true; + for (var o2 in t2) + r2(o2); + return true; +}, { + init: function(e2) { + var o2 = Object.assign( + {}, + { openTrigger: "data-micromodal-trigger" }, + e2 + ), n2 = t(document.querySelectorAll("[".concat(o2.openTrigger, "]"))), r22 = function(e3, t2) { + var o3 = []; + return e3.forEach(function(e4) { + var n3 = e4.attributes[t2].value; + void 0 === o3[n3] && (o3[n3] = []), o3[n3].push(e4); + }), o3; + }(n2, o2.openTrigger); + if (true !== o2.debugMode || false !== s(n2, r22)) + for (var l2 in r22) { + var c = r22[l2]; + o2.targetModal = l2, o2.triggers = t(c), a = new i(o2); + } + }, + show: function(e2, t2) { + var o2 = t2 || {}; + o2.targetModal = e2, true === o2.debugMode && false === r2(e2) || (a && a.removeEventListeners(), (a = new i(o2)).showModal()); + }, + close: function(e2) { + e2 ? a.closeModalById(e2) : a.closeModal(); + } +}); +"undefined" != typeof window && (window.MicroModal = l); +var micromodal_es_default = l; +var modal_default = '.modal {\n font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;\n}\n\n.lcm-modal-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0,0.6);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 12;\n}\n\n.lcm-modal-container {\n border: 1px solid rgba(129, 89, 217, 1);\n background-color: #fff;\n padding: 0 1.5rem;\n max-width: 500px;\n max-height: 100vh;\n border-radius: 0.25rem;\n overflow-y: auto;\n box-sizing: border-box;\n}\n\n.lcm-modal-content {\n margin-top: 2rem;\n margin-bottom: 2rem;\n line-height: 1.5;\n color: rgba(0,0,0,.8);\n}\n\n.lcm-wallet-container {\n display: flex;\n align-items: center;\n margin: 2rem 0.5rem;\n transition-duration: 0.2s;\n border-radius: 0.25rem;\n padding: 2rem;\n cursor: pointer;\n}\n\n.lcm-wallet-container:hover {\n background-color: #d4d4d4;\n}\n\n.lcm-wallet-logo {\n height: 2.5rem;\n width: 3.75rem;\n margin-right: 1.5rem;\n}\n\n.lcm-text-column {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n}\n\n.lcm-wallet-name {\n font-weight: bold;\n font-size: 1.2rem;\n margin: 0;\n}\n\n.lcm-wallet-synopsis {\n color: #777;\n font-size: 0.9rem;\n margin: 0;\n}\n\n\n@keyframes mmfadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes mmfadeOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n@keyframes mmslideIn {\n from { transform: translateY(15%); }\n to { transform: translateY(0); }\n}\n\n@keyframes mmslideOut {\n from { transform: translateY(0); }\n to { transform: translateY(-10%); }\n}\n\n.micromodal-slide {\n display: none;\n}\n\n.micromodal-slide.is-open {\n display: block;\n}\n\n.micromodal-slide[aria-hidden="false"] .lcm-modal-overlay {\n animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden="false"] .lcm-modal-container {\n animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);\n}\n\n.micromodal-slide[aria-hidden="true"] .lcm-modal-overlay {\n animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden="true"] .lcm-modal-container {\n animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);\n}\n\n.micromodal-slide .lcm-modal-container,\n.micromodal-slide .lcm-modal-overlay {\n will-change: transform;\n}\n'; +var metamask_default = 'data:image/svg+xml,'; +var coinbase_default = 'data:image/svg+xml,%0A%0A%0A%0A%0A%0A'; +var walletconnect_default = 'data:image/svg+xml,'; +var metaMaskSingle = { + htmlId: "lcm-metaMask", + id: "metamask", + logo: metamask_default, + name: "MetaMask", + provider: globalThis.ethereum, + synopsis: "Connect your MetaMask Wallet", + checkIfPresent: () => { + if (typeof globalThis.ethereum !== "undefined" && globalThis.ethereum.isMetaMask) { + return true; + } else { + return false; + } + } +}; +var coinbaseSingle = { + htmlId: "lcm-coinbase", + id: "coinbase", + logo: coinbase_default, + name: "Coinbase", + provider: globalThis.ethereum, + synopsis: "Connect your Coinbase Wallet", + checkIfPresent: () => { + if (typeof globalThis.ethereum !== "undefined" && globalThis.ethereum.isCoinbaseWallet) { + return true; + } else { + return false; + } + } +}; +var rawListOfWalletsArray = [ + { + htmlId: "lcm-metaMask", + id: "metamask", + logo: metamask_default, + name: "MetaMask", + provider: globalThis.ethereum?.providers?.find((p) => p.isMetaMask), + synopsis: "Connect your MetaMask Wallet", + checkIfPresent: () => { + return !!globalThis.ethereum?.providers?.find((p) => p.isMetaMask); + } + }, + { + htmlId: "lcm-coinbase", + id: "coinbase", + logo: coinbase_default, + name: "Coinbase", + provider: globalThis.ethereum?.providers?.find((p) => p.isCoinbaseWallet), + synopsis: "Connect your Coinbase Wallet", + checkIfPresent: () => { + return !!globalThis.ethereum?.providers?.find((p) => p.isCoinbaseWallet); + } + }, + { + htmlId: "lcm-walletConnect", + id: "walletconnect", + logo: walletconnect_default, + name: "WalletConnect", + provider: null, + synopsis: "Scan with WalletConnect to connect" + } +]; +var providerMethods = { + walletconnect: (providerOptions, id2) => { + const walletConnectData = providerOptions.walletconnect; + const walletConnectProvider = walletConnectData.provider; + return walletConnectProvider; + } +}; +var providerMethods_default = providerMethods; +var LitConnectModal = class { + constructor({ providerOptions }) { + this.dialog = micromodal_es_default; + this.closeAction = void 0; + this.parent = document.body; + this.filteredListOfWalletsArray = []; + this.providerOptions = providerOptions; + this._filterListOfWallets(); + this._instantiateLitConnectModal(); + var style = document.createElement("style"); + style.innerHTML = modal_default; + document.head.appendChild(style); + } + getWalletProvider() { + const currentProvider = localStorage.getItem("lit-web3-provider"); + this.dialog.show("lit-connect-modal"); + return new Promise((resolve, reject) => { + if (!!currentProvider) { + const foundProvider = this.filteredListOfWalletsArray.find( + (w) => w.id === currentProvider + ); + resolve(foundProvider.provider); + this._destroy(); + return; + } + this.filteredListOfWalletsArray.forEach((w) => { + let walletEntry = document.getElementById(w.id); + walletEntry.addEventListener("click", () => { + localStorage.setItem("lit-web3-provider", w.id); + resolve(w.provider); + this._destroy(); + return; + }); + }); + this.closeAction.addEventListener("click", () => { + resolve(false); + this._destroy(); + return; + }); + }); + } + _filterListOfWallets() { + const filteredListOfWalletsArray = []; + rawListOfWalletsArray.forEach((w) => { + if (!!w["checkIfPresent"] && w["checkIfPresent"]() === true) { + filteredListOfWalletsArray.push(w); + } + }); + if (filteredListOfWalletsArray.length === 0) { + if (globalThis.ethereum) { + if (globalThis.ethereum.isMetaMask) { + filteredListOfWalletsArray.push(metaMaskSingle); + } + if (globalThis.ethereum.isCoinbaseWallet) { + filteredListOfWalletsArray.push(coinbaseSingle); + } + } + } + if (!!this.providerOptions["walletconnect"]) { + const cloneWalletInfo = rawListOfWalletsArray.find( + (w) => w.id === "walletconnect" + ); + cloneWalletInfo["provider"] = providerMethods_default["walletconnect"]( + this.providerOptions, + "walletconnect" + ); + filteredListOfWalletsArray.push(cloneWalletInfo); + } + if (filteredListOfWalletsArray.length === 0) { + const message = "No wallets installed or provided."; + alert(message); + throw new NoWalletException({}, message); + } + this.filteredListOfWalletsArray = filteredListOfWalletsArray; + } + _instantiateLitConnectModal() { + const connectModal = document.createElement("div"); + connectModal.setAttribute("id", "lit-connect-modal-container"); + connectModal.innerHTML = ` + + `; + this.parent.appendChild(connectModal); + Object.assign(this, { + trueButton: document.getElementById("lcm-continue-button"), + closeAction: document.getElementById("lcm-modal-overlay") + }); + this._buildListOfWallets(); + this.dialog.init({ + disableScroll: true, + disableFocus: false, + awaitOpenAnimation: false, + awaitCloseAnimation: false, + debugMode: false + }); + } + _buildListOfWallets() { + const contentContainer = document.getElementById( + "lit-connect-modal-content" + ); + let walletListHtml = ``; + this.filteredListOfWalletsArray.forEach((w) => { + walletListHtml += ` +
+ +
+

${w.name}

+

${w.synopsis}

+
+
+ `; + }); + contentContainer.innerHTML = walletListHtml; + } + _destroy() { + const dialog = document.getElementById("lit-connect-modal-container"); + if (!!dialog) { + dialog.remove(); + } + } +}; + +// packages/auth-browser/src/lib/chains/eth.ts +var deprecated4 = depd4("lit-js-sdk:auth-browser:index"); +if (globalThis && typeof globalThis.Buffer === "undefined") { + globalThis.Buffer = BufferPolyfill; +} +var WALLET_ERROR = { + REQUESTED_CHAIN_HAS_NOT_BEEN_ADDED: 4902, + NO_SUCH_METHOD: -32601 +}; +var litWCProvider; +var getChainId = async (chain, web3) => { + let resultOrError; + try { + const resp = await web3.getNetwork(); + resultOrError = ERight(resp.chainId); + } catch (e2) { + log("getNetwork threw an exception", e2); + resultOrError = ELeft( + new WrongNetworkException( + { + info: { + chain + } + }, + `Incorrect network selected. Please switch to the %s network in your wallet and try again.`, + chain + ) + ); + } + return resultOrError; +}; +function isSignedMessageExpired(signedMessage) { + const dateStr = signedMessage.split("\n")[9]?.replace("Expiration Time: ", ""); + const expirationTime = new Date(dateStr); + const currentTime = /* @__PURE__ */ new Date(); + return currentTime > expirationTime; +} +var getMustResign = (authSig, resources) => { + let mustResign; + if (!isSignedMessageExpired(authSig.signedMessage)) { + return false; + } + try { + const parsedSiwe = new SiweMessage(authSig.signedMessage); + log("parsedSiwe.resources", parsedSiwe.resources); + if (JSON.stringify(parsedSiwe.resources) !== JSON.stringify(resources)) { + log( + "signing auth message because resources differ from the resources in the auth sig" + ); + mustResign = true; + } + if (parsedSiwe.address !== (0, import_utils7.getAddress)(parsedSiwe.address)) { + log( + "signing auth message because parsedSig.address is not equal to the same address but checksummed. This usually means the user had a non-checksummed address saved and so they need to re-sign." + ); + mustResign = true; + } + } catch (e2) { + log("error parsing siwe sig. making the user sign again: ", e2); + mustResign = true; + } + return mustResign; +}; +var getRPCUrls = () => { + const rpcUrls = {}; + const keys = Object.keys(LIT_CHAINS); + for (const chainName of keys) { + const chainId = LIT_CHAINS[chainName].chainId; + const rpcUrl = LIT_CHAINS[chainName].rpcUrls[0]; + rpcUrls[chainId.toString()] = rpcUrl; + } + return rpcUrls; +}; +var encodeCallData = deprecated4.function( + ({ abi, functionName, functionParams }) => { + throw new RemovedFunctionError({}, "encodeCallData has been removed."); + }, + "encodeCallData has been removed." +); +var decodeCallResult = deprecated4.function( + ({ abi, functionName, data }) => { + const _interface = new ethers_exports.utils.Interface(abi); + const decoded = _interface.decodeFunctionResult(functionName, data); + return decoded; + }, + "decodeCallResult will be removed." +); +var connectWeb3 = async ({ + chainId = 1, + walletConnectProjectId +}) => { + if (isNode()) { + log("connectWeb3 is not supported in nodejs."); + return { web3: null, account: null }; + } + const rpcUrls = getRPCUrls(); + let providerOptions = {}; + if (walletConnectProjectId) { + const wcProvider = await EthereumProvider.init({ + projectId: walletConnectProjectId, + chains: [chainId], + showQrModal: true, + optionalMethods: ["eth_sign"], + rpcMap: rpcUrls + }); + providerOptions = { + walletconnect: { + provider: wcProvider + } + }; + if (isBrowser()) { + litWCProvider = wcProvider; + } + } + log("getting provider via lit connect modal"); + const dialog = new LitConnectModal({ providerOptions }); + const provider = await dialog.getWalletProvider(); + log("got provider"); + const web3 = new Web3Provider(provider); + try { + deprecated4( + "@deprecated soon to be removed. - trying to enable provider. this will trigger the metamask popup." + ); + await provider.enable(); + } catch (e2) { + log( + "error enabling provider but swallowed it because it's not important. most wallets use a different function now to enable the wallet so you can ignore this error, because those other methods will be tried.", + e2 + ); + } + log("listing accounts"); + const accounts = await web3.listAccounts(); + log("accounts", accounts); + const account = ethers_exports.utils.getAddress(accounts[0]); + return { web3, account }; +}; +var checkAndSignEVMAuthMessage = async ({ + chain, + resources, + switchChain, + expiration, + uri, + walletConnectProjectId, + nonce +}) => { + if (isNode()) { + log( + "checkAndSignEVMAuthMessage is not supported in nodejs. You can create a SIWE on your own using the SIWE package." + ); + return { + sig: "", + derivedVia: "", + signedMessage: "", + address: "" + }; + } + const _throwIncorrectNetworkError = (error) => { + if (error.code === WALLET_ERROR.NO_SUCH_METHOD) { + throw new WrongNetworkException( + { + info: { + chain + } + }, + `Incorrect network selected. Please switch to the ${chain} network in your wallet and try again.` + ); + } else { + throw error; + } + }; + const selectedChain = LIT_CHAINS[chain]; + const expirationString = expiration ?? getDefaultExpiration(); + const { web3, account } = await connectWeb3({ + chainId: selectedChain.chainId, + walletConnectProjectId + }); + log(`got web3 and account: ${account}`); + const currentChainIdOrError = await getChainId(chain, web3); + const selectedChainId = selectedChain.chainId; + const selectedChainIdHex = numberToHex(selectedChainId); + let authSigOrError = getStorageItem(LOCAL_STORAGE_KEYS.AUTH_SIGNATURE); + log("currentChainIdOrError:", currentChainIdOrError); + log("selectedChainId:", selectedChainId); + log("selectedChainIdHex:", selectedChainIdHex); + log("authSigOrError:", authSigOrError); + if (currentChainIdOrError.type === EITHER_TYPE.ERROR) { + throw new UnknownError( + { + info: { + chainId: chain + }, + cause: currentChainIdOrError.result + }, + "Unknown error when getting chain id" + ); + } + log("chainId from web3", currentChainIdOrError); + log( + `checkAndSignAuthMessage with chainId ${currentChainIdOrError} and chain set to ${chain} and selectedChain is `, + selectedChain + ); + if (currentChainIdOrError.result !== selectedChainId && switchChain) { + const provider = web3.provider; + try { + log("trying to switch to chainId", selectedChainIdHex); + await provider.request({ + method: "wallet_switchEthereumChain", + params: [{ chainId: selectedChainIdHex }] + }); + } catch (switchError) { + log("error switching to chainId", switchError); + if (switchError.code === WALLET_ERROR.REQUESTED_CHAIN_HAS_NOT_BEEN_ADDED) { + try { + const data = [ + { + chainId: selectedChainIdHex, + chainName: selectedChain.name, + nativeCurrency: { + name: selectedChain.name, + symbol: selectedChain.symbol, + decimals: selectedChain.decimals + }, + rpcUrls: selectedChain.rpcUrls, + blockExplorerUrls: selectedChain.blockExplorerUrls + } + ]; + await provider.request({ + method: "wallet_addEthereumChain", + params: data + }); + } catch (addError) { + _throwIncorrectNetworkError(addError); + } + } else { + _throwIncorrectNetworkError(switchError); + } + } + currentChainIdOrError.result = selectedChain.chainId; + } + log("checking if sig is in local storage"); + if (authSigOrError.type === EITHER_TYPE.ERROR) { + log("signing auth message because sig is not in local storage"); + try { + const authSig2 = await _signAndGetAuth({ + web3, + account, + chainId: selectedChain.chainId, + resources, + expiration: expirationString, + uri, + nonce + }); + authSigOrError = { + type: EITHER_TYPE.SUCCESS, + result: JSON.stringify(authSig2) + }; + } catch (e2) { + throw new UnknownError( + { + info: { + account, + chainId: selectedChain.chainId, + resources, + expiration: expirationString, + uri, + nonce + }, + cause: e2 + }, + "Could not get authenticated message" + ); + } + log("5. authSigOrError:", authSigOrError); + } + const authSigString = authSigOrError.result; + let authSig = JSON.parse(authSigString); + log("6. authSig:", authSig); + if (account.toLowerCase() !== authSig.address.toLowerCase()) { + log( + "signing auth message because account is not the same as the address in the auth sig" + ); + authSig = await _signAndGetAuth({ + web3, + account, + chainId: selectedChain.chainId, + resources, + expiration: expirationString, + uri, + nonce + }); + log("7. authSig:", authSig); + } else { + const mustResign = getMustResign(authSig, resources); + if (mustResign) { + authSig = await _signAndGetAuth({ + web3, + account, + chainId: selectedChain.chainId, + resources, + expiration: expirationString, + uri, + nonce + }); + } + log("8. mustResign:", mustResign); + } + const checkAuthSig = validateSessionSig(authSig); + if (isSignedMessageExpired(authSig.signedMessage) || !checkAuthSig.isValid) { + if (!checkAuthSig.isValid) { + log(`Invalid AuthSig: ${checkAuthSig.errors.join(", ")}`); + } + log("9. authSig expired!, resigning.."); + authSig = await _signAndGetAuth({ + web3, + account, + chainId: selectedChain.chainId, + resources, + expiration: expirationString, + uri, + nonce + }); + } + return authSig; +}; +var getDefaultExpiration = () => { + return new Date(Date.now() + 1e3 * 60 * 60 * 24).toISOString(); +}; +var _signAndGetAuth = async ({ + web3, + account, + chainId, + resources, + expiration, + uri, + nonce +}) => { + await signAndSaveAuthMessage2({ + web3, + account, + chainId, + resources, + expiration, + uri, + nonce + }); + const authSigOrError = getStorageItem(LOCAL_STORAGE_KEYS.AUTH_SIGNATURE); + if (authSigOrError.type === "ERROR") { + throw new LocalStorageItemNotFoundException( + { + info: { + storageKey: LOCAL_STORAGE_KEYS.AUTH_SIGNATURE + } + }, + "Failed to get authSig from local storage" + ); + } + const authSig = typeof authSigOrError.result === "string" ? JSON.parse(authSigOrError.result) : authSigOrError.result; + return authSig; +}; +var signAndSaveAuthMessage2 = async ({ + web3, + account, + chainId, + resources, + expiration, + uri, + nonce +}) => { + if (isNode()) { + log("checkAndSignEVMAuthMessage is not supported in nodejs."); + return { + sig: "", + derivedVia: "", + signedMessage: "", + address: "" + }; + } + const preparedMessage = { + domain: globalThis.location.host, + address: (0, import_utils7.getAddress)(account), + // convert to EIP-55 format or else SIWE complains + version: "1", + chainId, + expirationTime: expiration, + nonce + }; + if (resources && resources.length > 0) { + preparedMessage.resources = resources; + } + if (uri) { + preparedMessage.uri = uri; + } else { + preparedMessage.uri = globalThis.location.href; + } + const message = new SiweMessage(preparedMessage); + const body = message.prepareMessage(); + const formattedAccount = (0, import_utils7.getAddress)(account); + const signedResult = await signMessage({ + body, + web3, + account: formattedAccount + }); + const authSig = { + sig: signedResult.signature, + derivedVia: "web3.eth.personal.sign", + signedMessage: body, + address: signedResult.address + }; + if (isBrowser()) { + localStorage.setItem( + LOCAL_STORAGE_KEYS.AUTH_SIGNATURE, + JSON.stringify(authSig) + ); + } + const commsKeyPair = nacl.box.keyPair(); + if (isBrowser()) { + localStorage.setItem( + LOCAL_STORAGE_KEYS.KEY_PAIR, + JSON.stringify({ + publicKey: naclUtil.encodeBase64(commsKeyPair.publicKey), + secretKey: naclUtil.encodeBase64(commsKeyPair.secretKey) + }) + ); + } + log(`generated and saved ${LOCAL_STORAGE_KEYS.KEY_PAIR}`); + return authSig; +}; +var signMessage = async ({ + body, + web3, + account +}) => { + if (isNode()) { + log("signMessage is not supported in nodejs."); + return { + signature: "", + address: "" + }; + } + if (!web3 || !account) { + log(`web3: ${web3} OR ${account} not found. Connecting web3..`); + const res = await connectWeb3({ chainId: 1 }); + web3 = res.web3; + account = res.account; + } + log("pausing..."); + await new Promise((resolve) => setTimeout(resolve, 500)); + log("signing with ", account); + const signature2 = await signMessageAsync(web3.getSigner(), account, body); + const address = verifyMessage(body, signature2).toLowerCase(); + log("Signature: ", signature2); + log("recovered address: ", address); + if (address.toLowerCase() !== account.toLowerCase()) { + const msg = `ruh roh, the user signed with a different address (${address}) then they're using with web3 (${account}). This will lead to confusion.`; + alert( + "Something seems to be wrong with your wallets message signing. maybe restart your browser or your wallet. Your recovered sig address does not match your web3 account address" + ); + throw new InvalidSignatureError( + { + info: { + address, + account + } + }, + msg + ); + } + return { signature: signature2, address }; +}; +var signMessageAsync = async (signer, address, message) => { + if (isNode()) { + log("signMessageAsync is not supported in nodejs."); + return null; + } + const messageBytes = toUtf8Bytes(message); + if (signer instanceof JsonRpcSigner) { + try { + log("Signing with personal_sign"); + const signature2 = await signer.provider.send("personal_sign", [ + hexlify(messageBytes), + address.toLowerCase() + ]); + return signature2; + } catch (e2) { + log( + "Signing with personal_sign failed, trying signMessage as a fallback" + ); + if (e2.message.includes("personal_sign")) { + return await signer.signMessage(messageBytes); + } + throw e2; + } + } else { + log("signing with signMessage"); + return await signer.signMessage(messageBytes); + } +}; + +// packages/auth-browser/src/lib/chains/sol.ts +init_shim(); +var getProvider2 = () => { + let resultOrError; + if ("solana" in window || "backpack" in window) { + resultOrError = ERight(window?.solana ?? window?.backpack); + } else { + resultOrError = ELeft( + new NoWalletException( + {}, + "No web3 wallet was found that works with Solana. Install a Solana wallet or choose another chain" + ) + ); + } + return resultOrError; +}; +var connectSolProvider = async () => { + const providerOrError = getProvider2(); + if (providerOrError.type === "ERROR") { + throw new UnknownError( + { + info: { + provider: providerOrError.result + } + }, + "Failed to get provider" + ); + } + const provider = providerOrError.result; + if (!provider.isConnected) { + await provider.connect(); + } + const account = provider.publicKey.toBase58(); + return { provider, account }; +}; +var checkAndSignSolAuthMessage = async () => { + const res = await connectSolProvider(); + if (!res) { + log("Failed to connect sol provider"); + } + const provider = res?.provider; + const account = res?.account; + const key2 = LOCAL_STORAGE_KEYS.AUTH_SOL_SIGNATURE; + let authSigOrError = getStorageItem(key2); + if (authSigOrError.type === EITHER_TYPE.ERROR) { + log("signing auth message because sig is not in local storage"); + await signAndSaveAuthMessage3({ provider }); + authSigOrError = getStorageItem(key2); + } + window.test = authSigOrError; + let authSig = JSON.parse(authSigOrError.result); + if (account !== authSig.address) { + log( + "signing auth message because account is not the same as the address in the auth sig" + ); + await signAndSaveAuthMessage3({ provider }); + authSigOrError = getStorageItem(key2); + authSig = JSON.parse(authSigOrError.result); + } + log("authSig", authSig); + return authSig; +}; +var signAndSaveAuthMessage3 = async ({ + provider +}) => { + const now2 = (/* @__PURE__ */ new Date()).toISOString(); + const body = AUTH_SIGNATURE_BODY.replace("{{timestamp}}", now2); + const data = uint8arrayFromString(body, "utf8"); + let payload; + let derivedVia = "solana.signMessage"; + if (provider?.isBackpack) { + const result = await provider.signMessage(data); + payload = { signature: result }; + derivedVia = "backpack.signMessage"; + } else { + payload = await provider.signMessage(data, "utf8"); + } + const hexSig = uint8arrayToString(payload.signature, "base16"); + const authSig = { + sig: hexSig, + derivedVia, + signedMessage: body, + address: provider.publicKey.toBase58() + }; + localStorage.setItem( + LOCAL_STORAGE_KEYS.AUTH_SOL_SIGNATURE, + JSON.stringify(authSig) + ); + return authSig; +}; + +// packages/auth-browser/src/lib/auth-browser.ts +var checkAndSignAuthMessage = ({ + chain, + resources, + switchChain, + expiration, + uri, + cosmosWalletType, + walletConnectProjectId, + nonce +}) => { + const chainInfo = ALL_LIT_CHAINS[chain]; + if (!chainInfo) { + throw new UnsupportedChainException( + { + info: { + chain + } + }, + `Unsupported chain selected. Please select one of: %s`, + Object.keys(ALL_LIT_CHAINS) + ); + } + if (!expiration) { + expiration = new Date(Date.now() + 1e3 * 60 * 60 * 24 * 7).toISOString(); + } + if (chainInfo.vmType === VMTYPE.EVM) { + return checkAndSignEVMAuthMessage({ + chain, + resources, + switchChain, + expiration, + uri, + walletConnectProjectId, + nonce + }); + } else if (chainInfo.vmType === VMTYPE.SVM) { + return checkAndSignSolAuthMessage(); + } else if (chainInfo.vmType === VMTYPE.CVM) { + return checkAndSignCosmosAuthMessage({ + chain, + walletType: cosmosWalletType || "keplr" + }); + } + throw new UnsupportedChainException( + { + info: { + chain + } + }, + `vmType not found for this chain: %s. This should not happen. Unsupported chain selected. Please select one of: %s`, + chain, + Object.keys(ALL_LIT_CHAINS) + ); +}; + +// packages/lit-node-client-nodejs/src/index.ts +init_shim(); +import "cross-fetch/dist/node-polyfill.js"; + +// packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +init_shim(); +init_lib17(); +var import_utils14 = __toESM(require_utils2()); +import { SiweMessage as SiweMessage4 } from "siwe"; + +// packages/auth-helpers/src/index.ts +init_shim(); + +// packages/auth-helpers/src/lib/models.ts +init_shim(); + +// packages/auth-helpers/src/lib/session-capability-object.ts +init_shim(); + +// packages/auth-helpers/src/lib/recap/recap-session-capability-object.ts +init_shim(); +import depd5 from "depd"; +import { Recap } from "siwe-recap"; + +// packages/auth-helpers/src/lib/recap/utils.ts +init_shim(); +function getRecapNamespaceAndAbility(litAbility) { + switch (litAbility) { + case LIT_ABILITY.AccessControlConditionDecryption: + return { + recapNamespace: LIT_NAMESPACE.Threshold, + recapAbility: LIT_RECAP_ABILITY.Decryption + }; + case LIT_ABILITY.AccessControlConditionSigning: + return { + recapNamespace: LIT_NAMESPACE.Threshold, + recapAbility: LIT_RECAP_ABILITY.Signing + }; + case LIT_ABILITY.PKPSigning: + return { + recapNamespace: LIT_NAMESPACE.Threshold, + recapAbility: LIT_RECAP_ABILITY.Signing + }; + case LIT_ABILITY.RateLimitIncreaseAuth: + return { + recapNamespace: LIT_NAMESPACE.Auth, + recapAbility: LIT_RECAP_ABILITY.Auth + }; + case LIT_ABILITY.LitActionExecution: + return { + recapNamespace: LIT_NAMESPACE.Threshold, + recapAbility: LIT_RECAP_ABILITY.Execution + }; + default: + throw new InvalidArgumentException( + { + info: { + litAbility + } + }, + `Unknown LitAbility` + ); + } +} + +// packages/auth-helpers/src/lib/siwe/siwe-helper.ts +init_shim(); +function sanitizeSiweMessage(message) { + let sanitizedMessage = message.replace(/\\\\n/g, "\\n"); + sanitizedMessage = sanitizedMessage.replace(/\\"/g, "'"); + return sanitizedMessage; +} +var createCapacityCreditsResourceData = (params) => { + return { + ...params.capacityTokenId ? { nft_id: [params.capacityTokenId] } : {}, + // Conditionally include nft_id + ...params.delegateeAddresses ? { + delegate_to: params.delegateeAddresses.map( + (address) => address.startsWith("0x") ? address.slice(2) : address + ) + } : {}, + ...params.uses !== void 0 ? { uses: params.uses.toString() } : {} + }; +}; +var addRecapToSiweMessage = async ({ + siweMessage, + resources, + litNodeClient +}) => { + if (!resources || resources.length < 1) { + throw new Error("resources is required"); + } + if (!litNodeClient) { + throw new Error("litNodeClient is required"); + } + for (const request of resources) { + const recapObject = await litNodeClient.generateSessionCapabilityObjectWithWildcards([ + request.resource + ]); + recapObject.addCapabilityForResource( + request.resource, + request.ability, + request.data || null + ); + const verified = recapObject.verifyCapabilitiesForResource( + request.resource, + request.ability + ); + if (!verified) { + throw new Error( + `Failed to verify capabilities for resource: "${request.resource}" and ability: "${request.ability}` + ); + } + siweMessage = recapObject.addToSiweMessage(siweMessage); + } + return siweMessage; +}; + +// packages/auth-helpers/src/lib/recap/recap-session-capability-object.ts +var deprecated5 = depd5("lit-js-sdk:auth-recap:session-capability-object"); +var RecapSessionCapabilityObject = class { + _inner; + constructor(att = {}, prf = []) { + this._inner = new Recap(att, prf); + } + static decode(encoded) { + const recap = Recap.decode_urn(encoded); + return new this( + recap.attenuations, + recap.proofs.map((cid) => cid.toString()) + ); + } + static extract(siwe) { + const recap = Recap.extract_and_verify(siwe); + return new this( + recap.attenuations, + recap.proofs.map((cid) => cid.toString()) + ); + } + get attenuations() { + return this._inner.attenuations; + } + get proofs() { + return this._inner.proofs.map((cid) => cid.toString()); + } + get statement() { + return sanitizeSiweMessage(this._inner.statement); + } + addProof(proof) { + return this._inner.addProof(proof); + } + addAttenuation(resource, namespace = "*", name = "*", restriction = {}) { + return this._inner.addAttenuation(resource, namespace, name, restriction); + } + addToSiweMessage(siwe) { + return this._inner.add_to_siwe_message(siwe); + } + encodeAsSiweResource() { + return this._inner.encode(); + } + /** LIT specific methods */ + addCapabilityForResource(litResource, ability, data = {}) { + if (!litResource.isValidLitAbility(ability)) { + throw new InvalidArgumentException( + { + info: { + litResource, + ability + } + }, + `The specified Lit resource does not support the specified ability.` + ); + } + const { recapNamespace, recapAbility } = getRecapNamespaceAndAbility(ability); + if (!data) { + return this.addAttenuation( + litResource.getResourceKey(), + recapNamespace, + recapAbility + ); + } + return this.addAttenuation( + litResource.getResourceKey(), + recapNamespace, + recapAbility, + data + ); + } + verifyCapabilitiesForResource(litResource, ability) { + if (!litResource.isValidLitAbility(ability)) { + return false; + } + const attenuations = this.attenuations; + const { recapNamespace, recapAbility } = getRecapNamespaceAndAbility(ability); + const recapAbilityToCheckFor = `${recapNamespace}/${recapAbility}`; + const attenuatedResourceKey = this._getResourceKeyToMatchAgainst(litResource); + if (!attenuations[attenuatedResourceKey]) { + return false; + } + const attenuatedRecapAbilities = Object.keys( + attenuations[attenuatedResourceKey] + ); + for (const attenuatedRecapAbility of attenuatedRecapAbilities) { + if (attenuatedRecapAbility === "*/*") { + return true; + } + if (attenuatedRecapAbility === recapAbilityToCheckFor) { + return true; + } + } + return false; + } + /** + * Returns the attenuated resource key to match against. This supports matching + * against a wildcard resource key too. + * + * @example If the attenuations object contains the following: + * + * ``` + * { + * 'lit-acc://*': { + * '*\/*': {} + * } + * } + * ``` + * + * Then, if the provided litResource is 'lit-acc://123', the method will return 'lit-acc://*'. + */ + _getResourceKeyToMatchAgainst(litResource) { + const attenuatedResourceKeysToMatchAgainst = [ + `${litResource.resourcePrefix}://*`, + litResource.getResourceKey() + ]; + for (const attenuatedResourceKeyToMatchAgainst of attenuatedResourceKeysToMatchAgainst) { + if (this.attenuations[attenuatedResourceKeyToMatchAgainst]) { + return attenuatedResourceKeyToMatchAgainst; + } + } + return ""; + } + addAllCapabilitiesForResource(litResource) { + return this.addAttenuation(litResource.getResourceKey(), "*", "*"); + } +}; + +// packages/auth-helpers/src/lib/session-capability-object.ts +function decode3(encoded) { + return RecapSessionCapabilityObject.decode(encoded); +} + +// packages/auth-helpers/src/lib/resources.ts +init_shim(); + +// packages/access-control-conditions/src/index.ts +init_shim(); + +// packages/access-control-conditions/src/lib/canonicalFormatter.ts +init_shim(); +var getOperatorParam = (cond) => { + const _cond = cond; + return { + operator: _cond.operator + }; +}; +var canonicalAbiParamss = (params) => { + return params.map((param) => ({ + name: param.name, + type: param.type + })); +}; +var canonicalUnifiedAccessControlConditionFormatter = (cond) => { + if (Array.isArray(cond)) { + return cond.map((c) => canonicalUnifiedAccessControlConditionFormatter(c)); + } + if ("operator" in cond) { + return getOperatorParam(cond); + } + if ("returnValueTest" in cond) { + const _cond = cond; + const _conditionType = _cond.conditionType; + switch (_conditionType) { + case "solRpc": + return canonicalSolRpcConditionFormatter(cond, true); + case "evmBasic": + return canonicalAccessControlConditionFormatter( + cond + ); + case "evmContract": + return canonicalEVMContractConditionFormatter(cond); + case "cosmos": + return canonicalCosmosConditionFormatter(cond); + default: + throw new InvalidAccessControlConditions( + { + info: { + cond + } + }, + 'You passed an invalid access control condition that is missing or has a wrong "conditionType"' + ); + } + } + throw new InvalidAccessControlConditions( + { + info: { + cond + } + }, + "You passed an invalid access control condition" + ); +}; +var canonicalSolRpcConditionFormatter = (cond, requireV2Conditions = false) => { + if (Array.isArray(cond)) { + return cond.map( + (c) => canonicalSolRpcConditionFormatter(c, requireV2Conditions) + ); + } + if ("operator" in cond) { + return getOperatorParam(cond); + } + if ("returnValueTest" in cond) { + const { returnValueTest } = cond; + const canonicalReturnValueTest = { + // @ts-ignore + key: returnValueTest.key, + comparator: returnValueTest.comparator, + value: returnValueTest.value + }; + if ("pdaParams" in cond || requireV2Conditions) { + const _assumedV2Cond = cond; + if (!("pdaInterface" in _assumedV2Cond) || !("pdaKey" in _assumedV2Cond) || !("offset" in _assumedV2Cond.pdaInterface) || !("fields" in _assumedV2Cond.pdaInterface)) { + throw new InvalidAccessControlConditions( + { + info: { + cond + } + }, + "Solana RPC Conditions have changed and there are some new fields you must include in your condition. Check the docs here: https://developer.litprotocol.com/AccessControlConditions/solRpcConditions" + ); + } + const canonicalPdaInterface = { + offset: _assumedV2Cond.pdaInterface.offset, + fields: _assumedV2Cond.pdaInterface.fields + }; + const _solV2Cond = cond; + const _requiredParams = { + method: _solV2Cond.method, + params: _solV2Cond.params, + pdaParams: _solV2Cond.pdaParams, + pdaInterface: canonicalPdaInterface, + pdaKey: _solV2Cond.pdaKey, + chain: _solV2Cond.chain, + returnValueTest: canonicalReturnValueTest + }; + return _requiredParams; + } else { + const _solV1Cond = cond; + const _requiredParams = { + // @ts-ignore + method: _solV1Cond.method, + // @ts-ignore + params: _solV1Cond.params, + chain: _solV1Cond.chain, + returnValueTest: canonicalReturnValueTest + }; + return _requiredParams; + } + } + throw new InvalidAccessControlConditions( + { + info: { + cond + } + }, + "You passed an invalid access control condition" + ); +}; +var canonicalAccessControlConditionFormatter = (cond) => { + if (Array.isArray(cond)) { + return cond.map((c) => canonicalAccessControlConditionFormatter(c)); + } + if ("operator" in cond) { + return getOperatorParam(cond); + } + if ("returnValueTest" in cond) { + const _cond = cond; + const _return = { + contractAddress: _cond.contractAddress, + chain: _cond.chain, + standardContractType: _cond.standardContractType, + method: _cond.method, + parameters: _cond.parameters, + returnValueTest: { + comparator: _cond.returnValueTest.comparator, + value: _cond.returnValueTest.value + } + }; + return _return; + } + throw new InvalidAccessControlConditions( + { + info: { + cond + } + }, + "You passed an invalid access control condition" + ); +}; +var canonicalEVMContractConditionFormatter = (cond) => { + if (Array.isArray(cond)) { + return cond.map((c) => canonicalEVMContractConditionFormatter(c)); + } + if ("operator" in cond) { + const _cond = cond; + return { + operator: _cond.operator + }; + } + if ("returnValueTest" in cond) { + const evmCond = cond; + const { functionAbi, returnValueTest } = evmCond; + const canonicalAbi = { + name: functionAbi.name, + inputs: canonicalAbiParamss(functionAbi.inputs), + outputs: canonicalAbiParamss(functionAbi.outputs), + constant: typeof functionAbi.constant === "undefined" ? false : functionAbi.constant, + stateMutability: functionAbi.stateMutability + }; + const canonicalReturnValueTest = { + key: returnValueTest.key, + comparator: returnValueTest.comparator, + value: returnValueTest.value + }; + const _return = { + contractAddress: evmCond.contractAddress, + functionName: evmCond.functionName, + functionParams: evmCond.functionParams, + functionAbi: canonicalAbi, + chain: evmCond.chain, + returnValueTest: canonicalReturnValueTest + }; + return _return; + } + throw new InvalidAccessControlConditions( + { + info: { + cond + } + }, + "You passed an invalid access control condition" + ); +}; +var canonicalCosmosConditionFormatter = (cond) => { + if (Array.isArray(cond)) { + return cond.map((c) => canonicalCosmosConditionFormatter(c)); + } + if ("operator" in cond) { + const _cond = cond; + return { + operator: _cond.operator + }; + } + if ("returnValueTest" in cond) { + const _cosmosCond = cond; + const { returnValueTest } = _cosmosCond; + const canonicalReturnValueTest = { + key: returnValueTest.key, + comparator: returnValueTest.comparator, + value: returnValueTest.value + }; + return { + path: _cosmosCond.path, + chain: _cosmosCond.chain, + method: _cosmosCond?.method, + parameters: _cosmosCond?.parameters, + returnValueTest: canonicalReturnValueTest + }; + } + throw new InvalidAccessControlConditions( + { + info: { + cond + } + }, + "You passed an invalid access control condition" + ); +}; + +// packages/access-control-conditions/src/lib/hashing.ts +init_shim(); +var hashUnifiedAccessControlConditions = (unifiedAccessControlConditions) => { + log("unifiedAccessControlConditions:", unifiedAccessControlConditions); + const conditions = unifiedAccessControlConditions.map((condition) => { + return canonicalUnifiedAccessControlConditionFormatter(condition); + }); + log("conditions:", conditions); + const hasUndefined = conditions.some((c) => c === void 0); + if (hasUndefined) { + throw new InvalidAccessControlConditions( + { + info: { + conditions + } + }, + "Invalid access control conditions" + ); + } + if (conditions.length === 0) { + throw new InvalidAccessControlConditions( + { + info: { + conditions + } + }, + "No conditions provided" + ); + } + const toHash = JSON.stringify(conditions); + log("Hashing unified access control conditions: ", toHash); + const encoder = new TextEncoder(); + const data = encoder.encode(toHash); + return crypto.subtle.digest("SHA-256", data); +}; +var hashAccessControlConditions = (accessControlConditions) => { + const conds = accessControlConditions.map( + (c) => canonicalAccessControlConditionFormatter(c) + ); + const toHash = JSON.stringify(conds); + log("Hashing access control conditions: ", toHash); + const encoder = new TextEncoder(); + const data = encoder.encode(toHash); + return crypto.subtle.digest("SHA-256", data); +}; +var hashEVMContractConditions = (evmContractConditions) => { + const conds = evmContractConditions.map( + (c) => canonicalEVMContractConditionFormatter(c) + ); + const toHash = JSON.stringify(conds); + log("Hashing evm contract conditions: ", toHash); + const encoder = new TextEncoder(); + const data = encoder.encode(toHash); + return crypto.subtle.digest("SHA-256", data); +}; +var hashSolRpcConditions = (solRpcConditions) => { + const conds = solRpcConditions.map( + (c) => canonicalSolRpcConditionFormatter(c) + ); + const toHash = JSON.stringify(conds); + log("Hashing sol rpc conditions: ", toHash); + const encoder = new TextEncoder(); + const data = encoder.encode(toHash); + return crypto.subtle.digest("SHA-256", data); +}; + +// packages/access-control-conditions/src/lib/humanizer.ts +init_shim(); + +// packages/access-control-conditions/src/lib/validator.ts +init_shim(); + +// node_modules/@lit-protocol/accs-schemas/esm/index.js +init_shim(); + +// node_modules/@lit-protocol/accs-schemas/esm/generated/index.js +init_shim(); + +// node_modules/@lit-protocol/accs-schemas/esm/generated/LPACC_EVM_ATOM.js +init_shim(); + +// node_modules/@lit-protocol/accs-schemas/esm/generated/LPACC_EVM_BASIC.js +init_shim(); + +// node_modules/@lit-protocol/accs-schemas/esm/generated/LPACC_EVM_CONTRACT.js +init_shim(); + +// node_modules/@lit-protocol/accs-schemas/esm/generated/LPACC_SOL.js +init_shim(); + +// node_modules/@lit-protocol/accs-schemas/esm/schemas/index.js +init_shim(); +async function loadSchema(schemaName) { + switch (schemaName) { + case "LPACC_ATOM": + return Promise.resolve().then(() => __toESM(require_LPACC_ATOM())); + case "LPACC_EVM_BASIC": + return Promise.resolve().then(() => __toESM(require_LPACC_EVM_BASIC())); + case "LPACC_EVM_CONTRACT": + return Promise.resolve().then(() => __toESM(require_LPACC_EVM_CONTRACT())); + case "LPACC_SOL": + return Promise.resolve().then(() => __toESM(require_LPACC_SOL())); + default: + throw new Error(`Unknown schema: ${schemaName}`); + } +} + +// packages/access-control-conditions/src/lib/validator.ts +var SCHEMA_NAME_MAP = { + cosmos: "LPACC_ATOM", + evmBasic: "LPACC_EVM_BASIC", + evmContract: "LPACC_EVM_CONTRACT", + solRpc: "LPACC_SOL" +}; +async function getSchema(accType) { + try { + const schemaName = SCHEMA_NAME_MAP[accType]; + return loadSchema(schemaName); + } catch (err) { + throw new InvalidArgumentException( + { + info: { + accType + } + }, + `No schema found for condition type %s`, + accType + ); + } +} +var validateAccessControlConditionsSchema = async (accs) => { + for (const acc of accs) { + if (Array.isArray(acc)) { + await validateAccessControlConditionsSchema(acc); + continue; + } + if ("operator" in acc) { + continue; + } + checkSchema( + acc, + await getSchema("evmBasic"), + "accessControlConditions", + "validateAccessControlConditionsSchema" + ); + } + return true; +}; +var validateEVMContractConditionsSchema = async (accs) => { + for (const acc of accs) { + if (Array.isArray(acc)) { + await validateEVMContractConditionsSchema(acc); + continue; + } + if ("operator" in acc) { + continue; + } + checkSchema( + acc, + await getSchema("evmContract"), + "evmContractConditions", + "validateEVMContractConditionsSchema" + ); + } + return true; +}; +var validateSolRpcConditionsSchema = async (accs) => { + for (const acc of accs) { + if (Array.isArray(acc)) { + await validateSolRpcConditionsSchema(acc); + continue; + } + if ("operator" in acc) { + continue; + } + checkSchema( + acc, + await getSchema("solRpc"), + "solRpcConditions", + "validateSolRpcConditionsSchema" + ); + } + return true; +}; +var validateUnifiedAccessControlConditionsSchema = async (accs) => { + for (const acc of accs) { + if (Array.isArray(acc)) { + await validateUnifiedAccessControlConditionsSchema(acc); + continue; + } + if ("operator" in acc) { + continue; + } + let schema; + switch (acc.conditionType) { + case "evmBasic": + schema = await getSchema("evmBasic"); + break; + case "evmContract": + schema = await getSchema("evmContract"); + break; + case "solRpc": + schema = await getSchema("solRpc"); + break; + case "cosmos": + schema = await getSchema("cosmos"); + break; + } + if (schema) { + checkSchema( + acc, + schema, + "accessControlConditions", + "validateUnifiedAccessControlConditionsSchema" + ); + } else { + throw new InvalidArgumentException( + { + info: { + acc + } + }, + `Missing schema to validate condition type %s`, + acc.conditionType + ); + } + } + return true; +}; + +// packages/auth-helpers/src/lib/utils.ts +init_shim(); +function formatPKPResource(resource) { + let fixedResource = resource.startsWith("0x") ? resource.slice(2) : resource; + if (fixedResource.length > 64) { + throw new Error("Resource ID exceeds 64 characters (32 bytes) in length."); + } + const hexRegex = /^[0-9A-Fa-f]+$/; + if (fixedResource !== "*" && hexRegex.test(fixedResource)) { + fixedResource = fixedResource.padStart(64, "0"); + } + return fixedResource; +} + +// packages/auth-helpers/src/lib/resources.ts +var LitResourceBase = class { + resource; + constructor(resource) { + this.resource = resource; + } + getResourceKey() { + return `${this.resourcePrefix}://${this.resource}`; + } + toString() { + return this.getResourceKey(); + } +}; +var LitAccessControlConditionResource = class extends LitResourceBase { + resourcePrefix = LIT_RESOURCE_PREFIX.AccessControlCondition; + /** + * Creates a new LitAccessControlConditionResource. + * @param resource The identifier for the resource. This should be the + * hashed key value of the access control condition. + */ + constructor(resource) { + super(resource); + } + isValidLitAbility(litAbility) { + return litAbility === LIT_ABILITY.AccessControlConditionDecryption || litAbility === LIT_ABILITY.AccessControlConditionSigning; + } + /** + * Composes a resource string by hashing access control conditions and appending a data hash. + * + * @param {AccessControlConditions} accs - The access control conditions to hash. + * @param {string} dataToEncryptHash - The hash of the data to encrypt. + * @returns {Promise} The composed resource string in the format 'hashedAccs/dataToEncryptHash'. + */ + static async generateResourceString(accs, dataToEncryptHash) { + if (!accs || !dataToEncryptHash) { + throw new InvalidArgumentException( + { + info: { + accs, + dataToEncryptHash + } + }, + "Invalid input: Access control conditions and data hash are required." + ); + } + const hashedAccs = await hashAccessControlConditions(accs); + const hashedAccsStr = uint8arrayToString( + new Uint8Array(hashedAccs), + "base16" + ); + const resourceString = `${hashedAccsStr}/${dataToEncryptHash}`; + return resourceString; + } +}; +var LitPKPResource = class extends LitResourceBase { + resourcePrefix = LIT_RESOURCE_PREFIX.PKP; + /** + * Creates a new LitPKPResource. + * @param resource The identifier for the resource. This should be the + * PKP token ID. + */ + constructor(resource) { + const fixedResource = formatPKPResource(resource); + super(fixedResource); + } + isValidLitAbility(litAbility) { + return litAbility === LIT_ABILITY.PKPSigning; + } +}; +var LitRLIResource = class extends LitResourceBase { + resourcePrefix = LIT_RESOURCE_PREFIX.RLI; + /** + * Creates a new LitRLIResource. + * @param resource The identifier for the resource. This should be the + * RLI token ID. + */ + constructor(resource) { + super(resource); + } + isValidLitAbility(litAbility) { + return litAbility === LIT_ABILITY.RateLimitIncreaseAuth; + } +}; +var LitActionResource = class extends LitResourceBase { + resourcePrefix = LIT_RESOURCE_PREFIX.LitAction; + /** + * Creates a new LitActionResource. + * @param resource The identifier for the resource. This should be the + * Lit Action IPFS CID. + */ + constructor(resource) { + super(resource); + } + isValidLitAbility(litAbility) { + return litAbility === LIT_ABILITY.LitActionExecution; + } +}; + +// packages/auth-helpers/src/lib/recap/resource-builder.ts +init_shim(); + +// packages/auth-helpers/src/lib/siwe/create-siwe-message.ts +init_shim(); +import { SiweMessage as SiweMessage2 } from "siwe"; +var createSiweMessage = async (params) => { + if (!params.walletAddress) { + throw new Error("walletAddress is required"); + } + const ONE_WEEK_FROM_NOW = new Date( + Date.now() + 1e3 * 60 * 60 * 24 * 7 + ).toISOString(); + const siweParams = { + domain: params?.domain ?? "localhost", + address: params.walletAddress, + statement: params?.statement ?? "This is a test statement. You can put anything you want here.", + uri: params?.uri ?? "https://localhost/login", + version: params?.version ?? "1", + chainId: params?.chainId ?? 1, + nonce: params.nonce, + expirationTime: params?.expiration ?? ONE_WEEK_FROM_NOW + }; + let siweMessage = new SiweMessage2(siweParams); + if ("dAppOwnerWallet" in params || // required param + "uses" in params || // optional + "delegateeAddresses" in params || // optional + "capacityTokenId" in params) { + const ccParams = params; + const capabilities = createCapacityCreditsResourceData(ccParams); + params.resources = [ + { + resource: new LitRLIResource(ccParams.capacityTokenId ?? "*"), + ability: LIT_ABILITY.RateLimitIncreaseAuth, + data: capabilities + } + ]; + } + if (params.resources) { + siweMessage = await addRecapToSiweMessage({ + siweMessage, + resources: params.resources, + litNodeClient: params.litNodeClient + }); + } + return siweMessage.prepareMessage(); +}; +var createSiweMessageWithRecaps = async (params) => { + return createSiweMessage({ + ...params + }); +}; +var createSiweMessageWithCapacityDelegation = async (params) => { + if (!params.litNodeClient) { + throw new Error("litNodeClient is required"); + } + return createSiweMessage({ + ...params + }); +}; + +// packages/auth-helpers/src/lib/generate-auth-sig.ts +init_shim(); +var generateAuthSig = async ({ + signer, + toSign, + address, + algo +}) => { + if (!signer?.signMessage) { + throw new Error("signer does not have a signMessage method"); + } + const signature2 = await signer.signMessage(toSign); + if (!address) { + address = await signer.getAddress(); + } + address = ethers_exports.utils.getAddress(address); + if (!address) { + throw new Error("address is required"); + } + return { + sig: signature2, + derivedVia: "web3.eth.personal.sign", + signedMessage: toSign, + address, + ...algo && { algo } + }; +}; + +// packages/core/src/index.ts +init_shim(); + +// packages/core/src/lib/lit-core.ts +init_shim(); + +// packages/contracts-sdk/src/index.ts +init_shim(); + +// packages/contracts-sdk/src/lib/contracts-sdk.ts +init_shim(); + +// packages/contracts-sdk/src/lib/hex2dec.ts +init_shim(); +function add3(x, y, base2) { + var z = []; + var n2 = Math.max(x.length, y.length); + var carry = 0; + var i2 = 0; + while (i2 < n2 || carry) { + var xi = i2 < x.length ? x[i2] : 0; + var yi = i2 < y.length ? y[i2] : 0; + var zi = carry + xi + yi; + z.push(zi % base2); + carry = Math.floor(zi / base2); + i2++; + } + return z; +} +function multiplyByNumber(num, x, base2) { + if (num < 0) + return null; + if (num == 0) + return []; + var result = []; + var power = x; + while (true) { + if (num & 1) { + result = add3(result, power, base2); + } + num = num >> 1; + if (num === 0) + break; + power = add3(power, power, base2); + } + return result; +} +function parseToDigitsArray(str, base2) { + var digits = str.split(""); + var ary = []; + for (var i2 = digits.length - 1; i2 >= 0; i2--) { + var n2 = parseInt(digits[i2], base2); + if (isNaN(n2)) + return null; + ary.push(n2); + } + return ary; +} +function convertBase(str, fromBase, toBase) { + var digits = parseToDigitsArray(str, fromBase); + if (digits === null) + return null; + var outArray = []; + var power = [1]; + for (var i2 = 0; i2 < digits.length; i2++) { + if (digits[i2]) { + outArray = add3( + outArray, + multiplyByNumber(digits[i2], power, toBase), + toBase + ); + } + power = multiplyByNumber(fromBase, power, toBase); + } + var out = ""; + for (var i2 = outArray.length - 1; i2 >= 0; i2--) { + out += outArray[i2].toString(toBase); + } + if (out === "") { + out = "0"; + } + return out; +} +function decToHex(decStr, opts) { + var hidePrefix = opts && opts.prefix === false; + var hex = convertBase(decStr, 10, 16); + return hex ? hidePrefix ? hex : "0x" + hex : null; +} +function hexToDec(hexStr) { + if (hexStr.substring(0, 2) === "0x") + hexStr = hexStr.substring(2); + hexStr = hexStr.toLowerCase(); + return convertBase(hexStr, 16, 10); +} +var intToIP = (ip) => { + const binaryString = ip.toString(2).padStart(32, "0"); + const ipArray = []; + for (let i2 = 0; i2 < 32; i2 += 8) { + ipArray.push(parseInt(binaryString.substring(i2, i2 + 8), 2)); + } + return ipArray.join("."); +}; + +// packages/contracts-sdk/src/abis/Allowlist.sol/AllowlistData.ts +init_shim(); +var AllowlistData = { + date: "2023-11-14T15:45:41Z", + address: "0xfc7Bebd150b36921549595A776D7723fBC4Bb2D9", + contractName: "Allowlist", + abi: [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "AdminRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "ItemAllowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "ItemNotAllowed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "addAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "allowAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "allowedItems", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "isAllowed", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newAdmin", + type: "address" + } + ], + name: "removeAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bool", + name: "_allowAll", + type: "bool" + } + ], + name: "setAllowAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "setAllowed", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "key", + type: "bytes32" + } + ], + name: "setNotAllowed", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/abis/LITToken.sol/LITTokenData.ts +init_shim(); +var LITTokenData = { + date: "2023-10-02T18:22:38.000Z", + address: "0x53695556f8a1a064EdFf91767f15652BbfaFaD04", + contractName: "LITToken", + abi: [ + { + inputs: [ + { + internalType: "uint256", + name: "cap", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "InvalidShortString", + type: "error" + }, + { + inputs: [ + { + internalType: "string", + name: "str", + type: "string" + } + ], + name: "StringTooLong", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "delegator", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "fromDelegate", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "toDelegate", + type: "address" + } + ], + name: "DelegateChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "delegate", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "previousBalance", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newBalance", + type: "uint256" + } + ], + name: "DelegateVotesChanged", + type: "event" + }, + { + anonymous: false, + inputs: [], + name: "EIP712DomainChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Paused", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "previousAdminRole", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "newAdminRole", + type: "bytes32" + } + ], + name: "RoleAdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleGranted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleRevoked", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address" + } + ], + name: "Unpaused", + type: "event" + }, + { + inputs: [], + name: "ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "CLOCK_MODE", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "MINTER_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PAUSER_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + } + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "burnFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "cap", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint32", + name: "pos", + type: "uint32" + } + ], + name: "checkpoints", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "fromBlock", + type: "uint32" + }, + { + internalType: "uint224", + name: "votes", + type: "uint224" + } + ], + internalType: "struct ERC20Votes.Checkpoint", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "clock", + outputs: [ + { + internalType: "uint48", + name: "", + type: "uint48" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "subtractedValue", + type: "uint256" + } + ], + name: "decreaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "delegatee", + type: "address" + } + ], + name: "delegate", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "delegatee", + type: "address" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiry", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "delegateBySig", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "delegates", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "eip712Domain", + outputs: [ + { + internalType: "bytes1", + name: "fields", + type: "bytes1" + }, + { + internalType: "string", + name: "name", + type: "string" + }, + { + internalType: "string", + name: "version", + type: "string" + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256" + }, + { + internalType: "address", + name: "verifyingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32" + }, + { + internalType: "uint256[]", + name: "extensions", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "timepoint", + type: "uint256" + } + ], + name: "getPastTotalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + }, + { + internalType: "uint256", + name: "timepoint", + type: "uint256" + } + ], + name: "getPastVotes", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + } + ], + name: "getRoleAdmin", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "getVotes", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "grantRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasRole", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "addedValue", + type: "uint256" + } + ], + name: "increaseAllowance", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_recipient", + type: "address" + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256" + } + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "numCheckpoints", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "renounceRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "revokeRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/abis/Multisender.sol/MultisenderData.ts +init_shim(); +var MultisenderData = { + date: "2023-11-14T15:45:41Z", + address: "0xD4e3D27d21D6D6d596b6524610C486F8A9c70958", + contractName: "Multisender", + abi: [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "_recipients", + type: "address[]" + } + ], + name: "sendEth", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "_recipients", + type: "address[]" + }, + { + internalType: "address", + name: "tokenContract", + type: "address" + } + ], + name: "sendTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "tokenContract", + type: "address" + } + ], + name: "withdrawTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/abis/PKPHelper.sol/PKPHelperData.ts +init_shim(); +var PKPHelperData = { + date: "2023-11-14T15:45:41Z", + address: "0xF02b6D6b0970DB3810963300a6Ad38D8429c4cdb", + contractName: "PKPHelper", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_resolver", + type: "address" + }, + { + internalType: "enum ContractResolver.Env", + name: "_env", + type: "uint8" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "ContractResolverAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "previousAdminRole", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "newAdminRole", + type: "bytes32" + } + ], + name: "RoleAdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleGranted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleRevoked", + type: "event" + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + }, + { + components: [ + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + } + ], + internalType: "struct IPubkeyRouter.Signature[]", + name: "signatures", + type: "tuple[]" + } + ], + internalType: "struct LibPKPNFTStorage.ClaimMaterial", + name: "claimMaterial", + type: "tuple" + }, + { + components: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes[]", + name: "permittedIpfsCIDs", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedIpfsCIDScopes", + type: "uint256[][]" + }, + { + internalType: "address[]", + name: "permittedAddresses", + type: "address[]" + }, + { + internalType: "uint256[][]", + name: "permittedAddressScopes", + type: "uint256[][]" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypes", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIds", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeys", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopes", + type: "uint256[][]" + }, + { + internalType: "bool", + name: "addPkpEthAddressAsPermittedAddress", + type: "bool" + }, + { + internalType: "bool", + name: "sendPkpToItself", + type: "bool" + } + ], + internalType: "struct PKPHelper.AuthMethodData", + name: "authMethodData", + type: "tuple" + } + ], + name: "claimAndMintNextAndAddAuthMethods", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + }, + { + components: [ + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + } + ], + internalType: "struct IPubkeyRouter.Signature[]", + name: "signatures", + type: "tuple[]" + } + ], + internalType: "struct LibPKPNFTStorage.ClaimMaterial", + name: "claimMaterial", + type: "tuple" + }, + { + components: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes[]", + name: "permittedIpfsCIDs", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedIpfsCIDScopes", + type: "uint256[][]" + }, + { + internalType: "address[]", + name: "permittedAddresses", + type: "address[]" + }, + { + internalType: "uint256[][]", + name: "permittedAddressScopes", + type: "uint256[][]" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypes", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIds", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeys", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopes", + type: "uint256[][]" + }, + { + internalType: "bool", + name: "addPkpEthAddressAsPermittedAddress", + type: "bool" + }, + { + internalType: "bool", + name: "sendPkpToItself", + type: "bool" + } + ], + internalType: "struct PKPHelper.AuthMethodData", + name: "authMethodData", + type: "tuple" + } + ], + name: "claimAndMintNextAndAddAuthMethodsWithTypes", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "contractResolver", + outputs: [ + { + internalType: "contract ContractResolver", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "env", + outputs: [ + { + internalType: "enum ContractResolver.Env", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getDomainWalletRegistry", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPKPNftMetdataAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpNftAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpPermissionsAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + } + ], + name: "getRoleAdmin", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "grantRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasRole", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypes", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIds", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeys", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopes", + type: "uint256[][]" + }, + { + internalType: "bool", + name: "addPkpEthAddressAsPermittedAddress", + type: "bool" + }, + { + internalType: "bool", + name: "sendPkpToItself", + type: "bool" + } + ], + name: "mintNextAndAddAuthMethods", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes[]", + name: "permittedIpfsCIDs", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedIpfsCIDScopes", + type: "uint256[][]" + }, + { + internalType: "address[]", + name: "permittedAddresses", + type: "address[]" + }, + { + internalType: "uint256[][]", + name: "permittedAddressScopes", + type: "uint256[][]" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypes", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIds", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeys", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopes", + type: "uint256[][]" + }, + { + internalType: "bool", + name: "addPkpEthAddressAsPermittedAddress", + type: "bool" + }, + { + internalType: "bool", + name: "sendPkpToItself", + type: "bool" + } + ], + name: "mintNextAndAddAuthMethodsWithTypes", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypes", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIds", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeys", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopes", + type: "uint256[][]" + }, + { + internalType: "string[]", + name: "nftMetadata", + type: "string[]" + }, + { + internalType: "bool", + name: "addPkpEthAddressAsPermittedAddress", + type: "bool" + }, + { + internalType: "bool", + name: "sendPkpToItself", + type: "bool" + } + ], + name: "mintNextAndAddDomainWalletMetadata", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + name: "onERC721Received", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "removePkpMetadata", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "renounceRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "revokeRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "string[]", + name: "nftMetadata", + type: "string[]" + } + ], + name: "setPkpMetadata", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/abis/PKPNFT.sol/PKPNFTData.ts +init_shim(); +var PKPNFTData = { + date: "2023-11-14T15:45:41Z", + address: "0x58582b93d978F30b4c4E812A16a7b31C035A69f7", + contractName: "PKPNFT", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "ContractResolverAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "newFreeMintSigner", + type: "address" + } + ], + name: "FreeMintSignerSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8" + } + ], + name: "Initialized", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newMintCost", + type: "uint256" + } + ], + name: "MintCostSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "pubkey", + type: "bytes" + } + ], + name: "PKPMinted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Withdrew", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + }, + { + components: [ + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + } + ], + internalType: "struct IPubkeyRouter.Signature[]", + name: "signatures", + type: "tuple[]" + } + ], + name: "claimAndMint", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "exists", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "freeMintSigner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getEthAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getNextDerivedKeyId", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpNftMetadataAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpPermissionsAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPubkey", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getRouterAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getStakingAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "mintCost", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes", + name: "ipfsCID", + type: "bytes" + } + ], + name: "mintGrantAndBurnNext", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "keyType", + type: "uint256" + } + ], + name: "mintNext", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "hash", + type: "bytes32" + } + ], + name: "prefixed", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "redeemedFreeMintIds", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newFreeMintSigner", + type: "address" + } + ], + name: "setFreeMintSigner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMintCost", + type: "uint256" + } + ], + name: "setMintCost", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "tokenByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "tokenOfOwnerByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "tokenURI", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/abis/PKPNFTMetadata.sol/PKPNFTMetadataData.ts +init_shim(); +var PKPNFTMetadataData = { + date: "2023-11-14T15:45:41Z", + address: "0xeD46dDcbFF662ad89b0987E0DFE2949901498Da6", + contractName: "PKPNFTMetadata", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_resolver", + type: "address" + }, + { + internalType: "enum ContractResolver.Env", + name: "_env", + type: "uint8" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "previousAdminRole", + type: "bytes32" + }, + { + indexed: true, + internalType: "bytes32", + name: "newAdminRole", + type: "bytes32" + } + ], + name: "RoleAdminChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleGranted", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "RoleRevoked", + type: "event" + }, + { + inputs: [], + name: "ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "WRITER_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "buffer", + type: "bytes" + } + ], + name: "bytesToHex", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [], + name: "contractResolver", + outputs: [ + { + internalType: "contract ContractResolver", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "env", + outputs: [ + { + internalType: "enum ContractResolver.Env", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + } + ], + name: "getRoleAdmin", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "grantRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "hasRole", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "removeProfileForPkp", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "removeUrlForPKP", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "renounceRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "revokeRole", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "pkpHelperWriterAddress", + type: "address" + } + ], + name: "setPKPHelperWriterAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "string", + name: "imgUrl", + type: "string" + } + ], + name: "setProfileForPKP", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "string", + name: "url", + type: "string" + } + ], + name: "setUrlForPKP", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "pubKey", + type: "bytes" + }, + { + internalType: "address", + name: "ethAddress", + type: "address" + } + ], + name: "tokenURI", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/abis/PKPPermissions.sol/PKPPermissionsData.ts +init_shim(); +var PKPPermissionsData = { + date: "2023-11-14T15:45:41Z", + address: "0xD01c9C30f8F6fa443721629775e1CC7DD9c9e209", + contractName: "PKPPermissions", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "ContractResolverAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + indexed: false, + internalType: "bytes", + name: "userPubkey", + type: "bytes" + } + ], + name: "PermittedAuthMethodAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "PermittedAuthMethodRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + indexed: false, + internalType: "uint256", + name: "scopeId", + type: "uint256" + } + ], + name: "PermittedAuthMethodScopeAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + indexed: false, + internalType: "uint256", + name: "scopeId", + type: "uint256" + } + ], + name: "PermittedAuthMethodScopeRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: true, + internalType: "uint256", + name: "group", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes32", + name: "root", + type: "bytes32" + } + ], + name: "RootHashUpdated", + type: "event" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "ipfsCID", + type: "bytes" + }, + { + internalType: "uint256[]", + name: "scopes", + type: "uint256[]" + } + ], + name: "addPermittedAction", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "user", + type: "address" + }, + { + internalType: "uint256[]", + name: "scopes", + type: "uint256[]" + } + ], + name: "addPermittedAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + components: [ + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "bytes", + name: "userPubkey", + type: "bytes" + } + ], + internalType: "struct LibPKPPermissionsStorage.AuthMethod", + name: "authMethod", + type: "tuple" + }, + { + internalType: "uint256[]", + name: "scopes", + type: "uint256[]" + } + ], + name: "addPermittedAuthMethod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "uint256", + name: "scopeId", + type: "uint256" + } + ], + name: "addPermittedAuthMethodScope", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypesToAdd", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIdsToAdd", + type: "bytes[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodPubkeysToAdd", + type: "bytes[]" + }, + { + internalType: "uint256[][]", + name: "permittedAuthMethodScopesToAdd", + type: "uint256[][]" + }, + { + internalType: "uint256[]", + name: "permittedAuthMethodTypesToRemove", + type: "uint256[]" + }, + { + internalType: "bytes[]", + name: "permittedAuthMethodIdsToRemove", + type: "bytes[]" + } + ], + name: "batchAddRemoveAuthMethods", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "getAuthMethodId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getEthAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPermittedActions", + outputs: [ + { + internalType: "bytes[]", + name: "", + type: "bytes[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPermittedAddresses", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "uint256", + name: "maxScopeId", + type: "uint256" + } + ], + name: "getPermittedAuthMethodScopes", + outputs: [ + { + internalType: "bool[]", + name: "", + type: "bool[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPermittedAuthMethods", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "bytes", + name: "userPubkey", + type: "bytes" + } + ], + internalType: "struct LibPKPPermissionsStorage.AuthMethod[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpNftAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPubkey", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getRouterAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "getTokenIdsForAuthMethod", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "getUserPubkeyForAuthMethod", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "ipfsCID", + type: "bytes" + } + ], + name: "isPermittedAction", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "user", + type: "address" + } + ], + name: "isPermittedAddress", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "isPermittedAuthMethod", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "uint256", + name: "scopeId", + type: "uint256" + } + ], + name: "isPermittedAuthMethodScopePresent", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "ipfsCID", + type: "bytes" + } + ], + name: "removePermittedAction", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "user", + type: "address" + } + ], + name: "removePermittedAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + } + ], + name: "removePermittedAuthMethod", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "authMethodType", + type: "uint256" + }, + { + internalType: "bytes", + name: "id", + type: "bytes" + }, + { + internalType: "uint256", + name: "scopeId", + type: "uint256" + } + ], + name: "removePermittedAuthMethodScope", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "group", + type: "uint256" + }, + { + internalType: "bytes32", + name: "root", + type: "bytes32" + } + ], + name: "setRootHash", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "group", + type: "uint256" + }, + { + internalType: "bytes32[]", + name: "proof", + type: "bytes32[]" + }, + { + internalType: "bytes32", + name: "leaf", + type: "bytes32" + } + ], + name: "verifyState", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "group", + type: "uint256" + }, + { + internalType: "bytes32[]", + name: "proof", + type: "bytes32[]" + }, + { + internalType: "bool[]", + name: "proofFlags", + type: "bool[]" + }, + { + internalType: "bytes32[]", + name: "leaves", + type: "bytes32[]" + } + ], + name: "verifyStates", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/abis/PubkeyRouter.sol/PubkeyRouterData.ts +init_shim(); +var PubkeyRouterData = { + date: "2023-11-14T15:45:41Z", + address: "0x4B5E97F2D811520e031A8F924e698B329ad83E29", + contractName: "PubkeyRouter", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "ContractResolverAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + indexed: false, + internalType: "address", + name: "stakingContract", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + name: "PubkeyRoutingDataSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "stakingContract", + type: "address" + }, + { + components: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + } + ], + indexed: false, + internalType: "struct IPubkeyRouter.RootKey", + name: "rootKey", + type: "tuple" + } + ], + name: "RootKeySet", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + } + ], + internalType: "struct IPubkeyRouter.Signature[]", + name: "signatures", + type: "tuple[]" + }, + { + internalType: "bytes", + name: "signedMessage", + type: "bytes" + }, + { + internalType: "address", + name: "stakingContractAddress", + type: "address" + } + ], + name: "checkNodeSignatures", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + } + ], + name: "deriveEthAddressFromPubkey", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "ethAddress", + type: "address" + } + ], + name: "ethAddressToPkpId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakingContract", + type: "address" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + name: "getDerivedPubkey", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getEthAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getPkpNftAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getPubkey", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakingContract", + type: "address" + } + ], + name: "getRootKeys", + outputs: [ + { + components: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + } + ], + internalType: "struct IPubkeyRouter.RootKey[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getRoutingData", + outputs: [ + { + components: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + internalType: "struct LibPubkeyRouterStorage.PubkeyRoutingData", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "isRouted", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "pubkeys", + outputs: [ + { + components: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + internalType: "struct LibPubkeyRouterStorage.PubkeyRoutingData", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "address", + name: "stakingContractAddress", + type: "address" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + name: "setRoutingData", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "address", + name: "stakingContract", + type: "address" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + }, + { + internalType: "bytes32", + name: "derivedKeyId", + type: "bytes32" + } + ], + name: "setRoutingDataAsAdmin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakingContractAddress", + type: "address" + }, + { + components: [ + { + internalType: "bytes", + name: "pubkey", + type: "bytes" + }, + { + internalType: "uint256", + name: "keyType", + type: "uint256" + } + ], + internalType: "struct IPubkeyRouter.RootKey[]", + name: "newRootKeys", + type: "tuple[]" + } + ], + name: "voteForRootKeys", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/abis/RateLimitNFT.sol/RateLimitNFTData.ts +init_shim(); +var RateLimitNFTData = { + date: "2023-11-14T15:45:41Z", + address: "0x19593CbBC56Ddd339Fde26278A544a25166C2388", + contractName: "RateLimitNFT", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newAdditionalRequestsPerKilosecondCost", + type: "uint256" + } + ], + name: "AdditionalRequestsPerKilosecondCostSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "newFreeMintSigner", + type: "address" + } + ], + name: "FreeMintSignerSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newFreeRequestsPerRateLimitWindow", + type: "uint256" + } + ], + name: "FreeRequestsPerRateLimitWindowSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8" + } + ], + name: "Initialized", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newRLIHolderRateLimitWindowSeconds", + type: "uint256" + } + ], + name: "RLIHolderRateLimitWindowSecondsSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newRateLimitWindowSeconds", + type: "uint256" + } + ], + name: "RateLimitWindowSecondsSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Withdrew", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + }, + { + internalType: "uint256", + name: "requestsPerKilosecond", + type: "uint256" + }, + { + internalType: "bytes32", + name: "msgHash", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "sVal", + type: "bytes32" + } + ], + name: "freeMint", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + } + ], + name: "mint", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newAdditionalRequestsPerKilosecondCost", + type: "uint256" + } + ], + name: "setAdditionalRequestsPerKilosecondCost", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newFreeMintSigner", + type: "address" + } + ], + name: "setFreeMintSigner", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newFreeRequestsPerRateLimitWindow", + type: "uint256" + } + ], + name: "setFreeRequestsPerRateLimitWindow", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMaxExpirationSeconds", + type: "uint256" + } + ], + name: "setMaxExpirationSeconds", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMaxRequestsPerKilosecond", + type: "uint256" + } + ], + name: "setMaxRequestsPerKilosecond", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newRLIHolderRateLimitWindowSeconds", + type: "uint256" + } + ], + name: "setRLIHolderRateLimitWindowSeconds", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newRateLimitWindowSeconds", + type: "uint256" + } + ], + name: "setRateLimitWindowSeconds", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "tokenByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "tokenOfOwnerByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "tokenURI", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "RLIHolderRateLimitWindowSeconds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "additionalRequestsPerKilosecondCost", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "requestsPerKilosecond", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + } + ], + name: "calculateCost", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "payingAmount", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + } + ], + name: "calculateRequestsPerKilosecond", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "capacity", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "requestsPerKilosecond", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + } + ], + internalType: "struct LibRateLimitNFTStorage.RateLimit", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "requestedRequestsPerKilosecond", + type: "uint256" + } + ], + name: "checkBelowMaxRequestsPerKilosecond", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentSoldRequestsPerKilosecond", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "defaultRateLimitWindowSeconds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + }, + { + internalType: "uint256", + name: "requestsPerKilosecond", + type: "uint256" + }, + { + internalType: "bytes32", + name: "msgHash", + type: "bytes32" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "sVal", + type: "bytes32" + } + ], + name: "freeMintSigTest", + outputs: [], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "freeMintSigner", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "freeRequestsPerRateLimitWindow", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "isExpired", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maxExpirationSeconds", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maxRequestsPerKilosecond", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "hash", + type: "bytes32" + } + ], + name: "prefixed", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "msgHash", + type: "bytes32" + } + ], + name: "redeemedFreeMints", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "tokenIdCounter", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "tokenSVG", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "expiresAt", + type: "uint256" + } + ], + name: "totalSoldRequestsPerKilosecondByExpirationTime", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/abis/Staking.sol/StakingData.ts +init_shim(); +var StakingData = { + date: "2023-11-14T15:45:41Z", + address: "0x5bFa704aF947b3b0f966e4248DED7bfa6edeF952", + contractName: "Staking", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "ActiveValidatorsCannotLeave", + type: "error" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "stakingAddress", + type: "address" + } + ], + name: "CannotRejoinUntilNextEpochBecauseKicked", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + name: "CannotReuseCommsKeys", + type: "error" + }, + { + inputs: [], + name: "CannotStakeZero", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "CannotVoteTwice", + type: "error" + }, + { + inputs: [], + name: "CannotWithdrawZero", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "nodeAddress", + type: "address" + } + ], + name: "CouldNotMapNodeAddressToStakerAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInActiveOrUnlockedOrPausedState", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInActiveOrUnlockedState", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInNextValidatorSetLockedState", + type: "error" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "state", + type: "uint8" + } + ], + name: "MustBeInReadyForNextEpochState", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "MustBeValidatorInNextEpochToKick", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "currentTimestamp", + type: "uint256" + }, + { + internalType: "uint256", + name: "epochEndTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "timeout", + type: "uint256" + } + ], + name: "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "currentTimestamp", + type: "uint256" + }, + { + internalType: "uint256", + name: "epochEndTime", + type: "uint256" + } + ], + name: "NotEnoughTimeElapsedSinceLastEpoch", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "validatorCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "minimumValidatorCount", + type: "uint256" + } + ], + name: "NotEnoughValidatorsInNextEpoch", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "currentReadyValidatorCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "nextReadyValidatorCount", + type: "uint256" + }, + { + internalType: "uint256", + name: "minimumValidatorCountToBeReady", + type: "uint256" + } + ], + name: "NotEnoughValidatorsReadyForNextEpoch", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "currentEpochNumber", + type: "uint256" + }, + { + internalType: "uint256", + name: "receivedEpochNumber", + type: "uint256" + } + ], + name: "SignaledReadyForWrongEpochNumber", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "StakerNotPermitted", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "yourBalance", + type: "uint256" + }, + { + internalType: "uint256", + name: "requestedWithdrawlAmount", + type: "uint256" + } + ], + name: "TryingToWithdrawMoreThanStaked", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "validator", + type: "address" + }, + { + internalType: "address[]", + name: "validatorsInNextEpoch", + type: "address[]" + } + ], + name: "ValidatorIsNotInNextEpoch", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newTokenRewardPerTokenPerEpoch", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newComplaintTolerance", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newComplaintIntervalSecs", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256[]", + name: "newKeyTypes", + type: "uint256[]" + }, + { + indexed: false, + internalType: "uint256", + name: "newMinimumValidatorCount", + type: "uint256" + } + ], + name: "ConfigSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newEpochEndTime", + type: "uint256" + } + ], + name: "EpochEndTimeSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newEpochLength", + type: "uint256" + } + ], + name: "EpochLengthSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newEpochTimeout", + type: "uint256" + } + ], + name: "EpochTimeoutSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "reason", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "newKickPenaltyPercent", + type: "uint256" + } + ], + name: "KickPenaltyPercentSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "epochNumber", + type: "uint256" + } + ], + name: "ReadyForNextEpoch", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "token", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Recovered", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "RequestToJoin", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "RequestToLeave", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverContractAddress", + type: "address" + } + ], + name: "ResolverContractAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newDuration", + type: "uint256" + } + ], + name: "RewardsDurationUpdated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newStakingTokenAddress", + type: "address" + } + ], + name: "StakingTokenSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "enum LibStakingStorage.States", + name: "newState", + type: "uint8" + } + ], + name: "StateChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amountBurned", + type: "uint256" + } + ], + name: "ValidatorKickedFromNextEpoch", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "ValidatorRejoinedNextEpoch", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "reporter", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "validatorStakerAddress", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "reason", + type: "uint256" + }, + { + indexed: false, + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "VotedToKickValidatorInNextEpoch", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "validatorStakerAddress", + type: "address" + } + ], + name: "adminKickValidatorInNextEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "adminRejoinValidator", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "validatorStakerAddress", + type: "address" + }, + { + internalType: "uint256", + name: "amountToPenalize", + type: "uint256" + } + ], + name: "adminSlashValidator", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "advanceEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "exit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "getReward", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "validatorStakerAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reason", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "kickValidatorInNextEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "lockValidatorsForNextEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + name: "requestToJoin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "requestToLeave", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newTokenRewardPerTokenPerEpoch", + type: "uint256" + }, + { + internalType: "uint256", + name: "newComplaintTolerance", + type: "uint256" + }, + { + internalType: "uint256", + name: "newComplaintIntervalSecs", + type: "uint256" + }, + { + internalType: "uint256[]", + name: "newKeyTypes", + type: "uint256[]" + }, + { + internalType: "uint256", + name: "newMinimumValidatorCount", + type: "uint256" + } + ], + name: "setConfig", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newEpochEndTime", + type: "uint256" + } + ], + name: "setEpochEndTime", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newEpochLength", + type: "uint256" + } + ], + name: "setEpochLength", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "newState", + type: "uint8" + } + ], + name: "setEpochState", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newEpochTimeout", + type: "uint256" + } + ], + name: "setEpochTimeout", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + name: "setIpPortNodeAddressAndCommunicationPubKeys", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "reason", + type: "uint256" + }, + { + internalType: "uint256", + name: "newKickPenaltyPercent", + type: "uint256" + } + ], + name: "setKickPenaltyPercent", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "epochNumber", + type: "uint256" + } + ], + name: "signalReadyForNextEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "stake", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + name: "stakeAndJoin", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "unlockValidatorsForNextEpoch", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Version", + name: "version", + type: "tuple" + } + ], + name: "checkVersion", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getMaxVersion", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Version", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getMaxVersionString", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getMinVersion", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Version", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getMinVersionString", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Version", + name: "version", + type: "tuple" + } + ], + name: "setMaxVersion", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "major", + type: "uint256" + }, + { + internalType: "uint256", + name: "minor", + type: "uint256" + }, + { + internalType: "uint256", + name: "patch", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Version", + name: "version", + type: "tuple" + } + ], + name: "setMinVersion", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "config", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "tokenRewardPerTokenPerEpoch", + type: "uint256" + }, + { + internalType: "uint256", + name: "complaintTolerance", + type: "uint256" + }, + { + internalType: "uint256", + name: "complaintIntervalSecs", + type: "uint256" + }, + { + internalType: "uint256[]", + name: "keyTypes", + type: "uint256[]" + }, + { + internalType: "uint256", + name: "minimumValidatorCount", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Config", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "contractResolver", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "countOfCurrentValidatorsReadyForNextEpoch", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "countOfNextValidatorsReadyForNextEpoch", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "currentValidatorCountForConsensus", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "epoch", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "epochLength", + type: "uint256" + }, + { + internalType: "uint256", + name: "number", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "retries", + type: "uint256" + }, + { + internalType: "uint256", + name: "timeout", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Epoch", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getKeyTypes", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getKickedValidators", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "addresses", + type: "address[]" + } + ], + name: "getNodeStakerAddressMappings", + outputs: [ + { + components: [ + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + internalType: "struct LibStakingStorage.AddressMapping[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getStakingBalancesAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getTokenAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getValidatorsInCurrentEpoch", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getValidatorsInCurrentEpochLength", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getValidatorsInNextEpoch", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "addresses", + type: "address[]" + } + ], + name: "getValidatorsStructs", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Validator[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getValidatorsStructsInCurrentEpoch", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Validator[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getValidatorsStructsInNextEpoch", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Validator[]", + name: "", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "epochNumber", + type: "uint256" + }, + { + internalType: "address", + name: "validatorStakerAddress", + type: "address" + }, + { + internalType: "address", + name: "voterStakerAddress", + type: "address" + } + ], + name: "getVotingStatusToKickValidator", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + }, + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "isActiveValidator", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "isActiveValidatorByNodeAddress", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "isReadyForNextEpoch", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "reason", + type: "uint256" + } + ], + name: "kickPenaltyPercentByReason", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "nextValidatorCountForConsensus", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "nodeAddress", + type: "address" + } + ], + name: "nodeAddressToStakerAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "readyForNextEpoch", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "shouldKickValidator", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "state", + outputs: [ + { + internalType: "enum LibStakingStorage.States", + name: "", + type: "uint8" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "validators", + outputs: [ + { + components: [ + { + internalType: "uint32", + name: "ip", + type: "uint32" + }, + { + internalType: "uint128", + name: "ipv6", + type: "uint128" + }, + { + internalType: "uint32", + name: "port", + type: "uint32" + }, + { + internalType: "address", + name: "nodeAddress", + type: "address" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint256", + name: "senderPubKey", + type: "uint256" + }, + { + internalType: "uint256", + name: "receiverPubKey", + type: "uint256" + } + ], + internalType: "struct LibStakingStorage.Validator", + name: "", + type: "tuple" + } + ], + stateMutability: "view", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/abis/StakingBalances.sol/StakingBalancesData.ts +init_shim(); +var StakingBalancesData = { + date: "2023-11-14T15:45:41Z", + address: "0x095251de2aD2A78aDe96F2a11F7feAA7CF93e6B5", + contractName: "StakingBalances", + abi: [ + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotAddFunctionToDiamondThatAlreadyExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotAddSelectorsToZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveFunctionThatDoesNotExist", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotRemoveImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionThatDoesNotExists", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4[]", + name: "_selectors", + type: "bytes4[]" + } + ], + name: "CannotReplaceFunctionsFromFacetWithZeroAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4" + } + ], + name: "CannotReplaceImmutableFunction", + type: "error" + }, + { + inputs: [ + { + internalType: "uint8", + name: "_action", + type: "uint8" + } + ], + name: "IncorrectFacetCutAction", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_initializationContractAddress", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "InitializationFunctionReverted", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_contractAddress", + type: "address" + }, + { + internalType: "string", + name: "_message", + type: "string" + } + ], + name: "NoBytecodeAtAddress", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "NoSelectorsProvidedForFacetForCut", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_user", + type: "address" + }, + { + internalType: "address", + name: "_contractOwner", + type: "address" + } + ], + name: "NotContractOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "_facetAddress", + type: "address" + } + ], + name: "RemoveFacetAddressMustBeZeroAddress", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + indexed: false, + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + indexed: false, + internalType: "address", + name: "_init", + type: "address" + }, + { + indexed: false, + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "DiamondCut", + type: "event" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "enum IDiamond.FacetCutAction", + name: "action", + type: "uint8" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamond.FacetCut[]", + name: "_diamondCut", + type: "tuple[]" + }, + { + internalType: "address", + name: "_init", + type: "address" + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes" + } + ], + name: "diamondCut", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_functionSelector", + type: "bytes4" + } + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facetAddress_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facetAddresses_", + type: "address[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address" + } + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "_facetFunctionSelectors", + type: "bytes4[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address" + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]" + } + ], + internalType: "struct IDiamondLoupe.Facet[]", + name: "facets_", + type: "tuple[]" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "OwnershipTransferred", + type: "event" + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "owner_", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "_newOwner", + type: "address" + } + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "ActiveValidatorsCannotLeave", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "aliasAccount", + type: "address" + }, + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "AliasNotOwnedBySender", + type: "error" + }, + { + inputs: [], + name: "CallerNotOwner", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "CannotRemoveAliasOfActiveValidator", + type: "error" + }, + { + inputs: [], + name: "CannotStakeZero", + type: "error" + }, + { + inputs: [], + name: "CannotWithdrawZero", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "aliasCount", + type: "uint256" + } + ], + name: "MaxAliasCountReached", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address" + } + ], + name: "OnlyStakingContract", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountStaked", + type: "uint256" + }, + { + internalType: "uint256", + name: "minimumStake", + type: "uint256" + } + ], + name: "StakeMustBeGreaterThanMinimumStake", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountStaked", + type: "uint256" + }, + { + internalType: "uint256", + name: "maximumStake", + type: "uint256" + } + ], + name: "StakeMustBeLessThanMaximumStake", + type: "error" + }, + { + inputs: [ + { + internalType: "address", + name: "stakerAddress", + type: "address" + } + ], + name: "StakerNotPermitted", + type: "error" + }, + { + inputs: [ + { + internalType: "uint256", + name: "yourBalance", + type: "uint256" + }, + { + internalType: "uint256", + name: "requestedWithdrawlAmount", + type: "uint256" + } + ], + name: "TryingToWithdrawMoreThanStaked", + type: "error" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "AliasAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "AliasRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newMaxAliasCount", + type: "uint256" + } + ], + name: "MaxAliasCountSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newMaximumStake", + type: "uint256" + } + ], + name: "MaximumStakeSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newMinimumStake", + type: "uint256" + } + ], + name: "MinimumStakeSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "PermittedStakerAdded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "PermittedStakerRemoved", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bool", + name: "permittedStakersOn", + type: "bool" + } + ], + name: "PermittedStakersOnChanged", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "ResolverContractAddressSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "reward", + type: "uint256" + } + ], + name: "RewardPaid", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Staked", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "newTokenRewardPerTokenPerEpoch", + type: "uint256" + } + ], + name: "TokenRewardPerTokenPerEpochSet", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "ValidatorNotRewardedBecauseAlias", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "ValidatorRewarded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "ValidatorTokensPenalized", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "staker", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256" + } + ], + name: "Withdrawn", + type: "event" + }, + { + inputs: [ + { + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "addAlias", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "addPermittedStaker", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address[]", + name: "stakers", + type: "address[]" + } + ], + name: "addPermittedStakers", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "checkStakingAmounts", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "getReward", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "getStakingAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "getTokenAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "isPermittedStaker", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maximumStake", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "minimumStake", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "penalizeTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "permittedStakersOn", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "aliasAccount", + type: "address" + } + ], + name: "removeAlias", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "staker", + type: "address" + } + ], + name: "removePermittedStaker", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "staker", + type: "address" + }, + { + internalType: "uint256", + name: "balance", + type: "uint256" + } + ], + name: "restakePenaltyTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "rewardOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "rewardValidator", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "newResolverAddress", + type: "address" + } + ], + name: "setContractResolver", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMaxAliasCount", + type: "uint256" + } + ], + name: "setMaxAliasCount", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMaximumStake", + type: "uint256" + } + ], + name: "setMaximumStake", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "newMinimumStake", + type: "uint256" + } + ], + name: "setMinimumStake", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bool", + name: "permitted", + type: "bool" + } + ], + name: "setPermittedStakersOn", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "stake", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "totalStaked", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + } + ], + name: "transferPenaltyTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "address", + name: "account", + type: "address" + } + ], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "balance", + type: "uint256" + } + ], + name: "withdrawPenaltyTokens", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ] +}; + +// packages/contracts-sdk/src/lib/contracts-sdk.ts +var import_utils10 = __toESM(require_utils2()); + +// packages/contracts-sdk/src/lib/auth-utils.ts +init_shim(); +import * as jose from "jose"; +async function getAuthIdByAuthMethod(authMethod) { + let authMethodId; + switch (authMethod.authMethodType) { + case 1: + authMethodId = getEthAuthMethodId(authMethod); + break; + case 4: + authMethodId = await getDiscordAuthId(authMethod); + break; + case 3: + authMethodId = await getWebauthnAuthId(authMethod); + break; + case 6: + authMethodId = await getGoogleJwtAuthId(authMethod); + break; + case 9: + authMethodId = await getStytchAuthId(authMethod); + break; + case 10: + case 11: + case 12: + case 13: + authMethodId = await getStytchFactorAuthMethodId(authMethod); + break; + default: + throw new InvalidArgumentException( + { + info: { + authMethod + } + }, + `Unsupported auth method type: ${authMethod.authMethodType}` + ); + } + return authMethodId; +} +function getEthAuthMethodId(authMethod) { + let accessToken; + try { + accessToken = JSON.parse(authMethod.accessToken); + } catch (err) { + throw new InvalidArgumentException( + { + info: { + authMethod + }, + cause: err + }, + "Unable to parse access token as JSON object" + ); + } + const address = accessToken.address; + if (!address) { + throw new NoWalletException( + { + info: { + authMethod + } + }, + "No address found in access token" + ); + } + return ethers_exports.utils.keccak256(ethers_exports.utils.toUtf8Bytes(`${address}:lit`)); +} +async function getDiscordAuthId(authMethod) { + const _clientId = "1052874239658692668"; + let userId; + const meResponse = await fetch("https://discord.com/api/users/@me", { + method: "GET", + headers: { + authorization: `Bearer ${authMethod.accessToken}` + } + }); + if (meResponse.ok) { + const user = await meResponse.json(); + userId = user.id; + } else { + throw new NetworkError( + { + info: { + authMethod + } + }, + "Unable to verify Discord account" + ); + } + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${userId}:${_clientId}`) + ); + return authMethodId; +} +async function getWebauthnAuthId(authMethod) { + let credentialId; + const rpNameToUse = "lit"; + try { + credentialId = JSON.parse(authMethod.accessToken).rawId; + } catch (err) { + throw new InvalidArgumentException( + { + info: { + authMethod + }, + cause: err + }, + `Error when parsing auth method to generate auth method ID for WebAuthn` + ); + } + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${credentialId}:${rpNameToUse}`) + ); + return authMethodId; +} +async function getStytchAuthId(authMethod) { + try { + const tokenBody = _parseJWT(authMethod.accessToken); + const userId = tokenBody["sub"]; + const orgId = tokenBody["aud"][0]; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${userId.toLowerCase()}:${orgId.toLowerCase()}`) + ); + return authMethodId; + } catch (err) { + throw new InvalidArgumentException( + { + info: { + authMethod + }, + cause: err + }, + `Error while parsing auth method to generate auth method id for Stytch OTP` + ); + } +} +function getStytchFactorAuthMethodId(authMethod) { + return new Promise((resolve, reject) => { + const accessToken = authMethod.accessToken; + const parsedToken = _parseJWT(accessToken); + let factor = "email"; + switch (authMethod.authMethodType) { + case 10: + factor = "email"; + break; + case 11: + factor = "sms"; + break; + case 12: + factor = "whatsApp"; + break; + case 13: + factor = "totp"; + break; + default: + throw new InvalidArgumentException( + { + info: { + authMethod + } + }, + `Unsupport stytch auth type` + ); + } + const factorParser = _resolveAuthFactor(factor).parser; + try { + resolve(factorParser(parsedToken, "https://stytch.com/session")); + } catch (e2) { + reject(e2); + } + }); +} +async function getGoogleJwtAuthId(authMethod) { + const tokenPayload = jose.decodeJwt(authMethod.accessToken); + const userId = tokenPayload["sub"]; + const audience = tokenPayload["aud"]; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${userId}:${audience}`) + ); + return authMethodId; +} +function _parseJWT(jwt) { + const parts = jwt.split("."); + if (parts.length !== 3) { + throw new WrongParamFormat( + { + info: { + jwt + } + }, + "Invalid token length" + ); + } + const body = Buffer.from(parts[1], "base64"); + const parsedBody = JSON.parse(body.toString("ascii")); + console.log("JWT body: ", parsedBody); + return parsedBody; +} +var emailOtpAuthFactorParser = (parsedToken, provider) => { + const session = parsedToken[provider]; + const authFactors = session["authentication_factors"]; + const authFactor = authFactors.find((value, _index, _obj) => { + if (value.email_factor) + return value; + }); + if (!authFactor) { + throw new InvalidArgumentException( + { + info: { + parsedToken, + provider + } + }, + "Could not find email authentication info in session" + ); + } + const audience = parsedToken["aud"][0]; + if (!audience) { + throw new InvalidArgumentException( + { + info: { + parsedToken, + provider + } + }, + "Token does not contain an audience (project identifier), aborting" + ); + } + const userId = authFactor.email_factor.email_address; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes( + `${userId.toLowerCase()}:${audience.toLowerCase()}` + ) + ); + return authMethodId; +}; +var smsOtpAuthFactorParser = (parsedToken, provider) => { + const session = parsedToken[provider]; + const authFactors = session["authentication_factors"]; + let authFactor = authFactors.find((value, _index, _obj) => { + if (value.phone_number_factor) + return value; + }); + if (!authFactor) { + throw new InvalidArgumentException( + { + info: { + parsedToken, + provider + } + }, + "Could not find email authentication info in session" + ); + } + const audience = parsedToken["aud"][0]; + if (!audience) { + throw new InvalidArgumentException( + { + info: { + parsedToken, + provider + } + }, + "Token does not contain an audience (project identifier), aborting" + ); + } + const userId = authFactor.phone_number_factor.phone_number; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes( + `${userId.toLowerCase()}:${audience.toLowerCase()}` + ) + ); + return authMethodId; +}; +var whatsAppOtpAuthFactorParser = (parsedToken, provider) => { + const session = parsedToken[provider]; + const authFactors = session["authentication_factors"]; + let authFactor = authFactors.find((value, _index, _obj) => { + if (value.phone_number_factor) + return value; + }); + if (!authFactor) { + throw new InvalidArgumentException( + { + info: { + parsedToken, + provider + } + }, + "Could not find email authentication info in session" + ); + } + const audience = parsedToken["aud"][0]; + if (!audience) { + throw new InvalidArgumentException( + { + info: { + parsedToken, + provider + } + }, + "Token does not contain an audience (project identifier), aborting" + ); + } + const userId = authFactor.phone_number_factor.phone_number; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes( + `${userId.toLowerCase()}:${audience.toLowerCase()}` + ) + ); + return authMethodId; +}; +var totpAuthFactorParser = (parsedToken, provider) => { + const session = parsedToken[provider]; + const authFactors = session["authentication_factors"]; + let authFactor = authFactors.find((value, _index, _obj) => { + if (value.phone_number_factor) + return value; + }); + if (!authFactor) { + throw new InvalidArgumentException( + { + info: { + parsedToken, + provider + } + }, + "Could not find email authentication info in session" + ); + } + const audience = parsedToken["aud"][0]; + if (!audience) { + throw new InvalidArgumentException( + { + info: { + parsedToken, + provider + } + }, + "Token does not contain an audience (project identifier), aborting" + ); + } + const userId = authFactor.authenticator_app_factor.totp_id; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes( + `${userId.toLowerCase()}:${audience.toLowerCase()}` + ) + ); + return authMethodId; +}; +function _resolveAuthFactor(factor) { + switch (factor) { + case "email": + return { + parser: emailOtpAuthFactorParser, + authMethodType: 10 + }; + case "sms": + return { + parser: smsOtpAuthFactorParser, + authMethodType: 11 + }; + case "whatsApp": + return { + parser: whatsAppOtpAuthFactorParser, + authMethodType: 12 + }; + case "totp": + return { + parser: totpAuthFactorParser, + authMethodType: 13 + }; + } + throw new InvalidArgumentException( + { + info: { + factor + } + }, + `Error could not find auth with factor ${factor}` + ); +} +var stringToArrayify = (str) => { + try { + const encoder = new TextEncoder(); + return encoder.encode(str); + } catch (e2) { + throw new InvalidParamType( + { + info: { + str + } + }, + `Error converting string to arrayify` + ); + } +}; + +// packages/contracts-sdk/src/lib/helpers/getBytes32FromMultihash.ts +init_shim(); +var getBytes32FromMultihash = (ipfsId, CID) => { + if (!CID) { + throw new ParamsMissingError( + { + info: { + ipfsId, + CID + } + }, + 'CID is required. Please import from "multiformats/cid" package, and pass the CID object to the function.' + ); + } + if (!ipfsId) { + throw new ParamsMissingError( + { + info: { + ipfsId + } + }, + "ipfsId is required" + ); + } + let cid; + try { + cid = CID.parse(ipfsId); + } catch (e2) { + throw new InvalidArgumentException( + { + info: { + ipfsId, + CID + } + }, + "Error parsing CID" + ); + } + const hashFunction = cid.multihash.code; + const size = cid.multihash.size; + const digest = "0x" + Buffer.from(cid.multihash.digest).toString("hex"); + const ipfsHash = { + digest, + hashFunction, + size + }; + return ipfsHash; +}; + +// packages/contracts-sdk/src/lib/utils.ts +init_shim(); +function calculateUTCMidnightExpiration(daysFromNow) { + const now2 = /* @__PURE__ */ new Date(); + const utcNow = Date.UTC( + now2.getUTCFullYear(), + now2.getUTCMonth(), + now2.getUTCDate() + ); + const futureDate = new Date(utcNow); + futureDate.setUTCDate(futureDate.getUTCDate() + daysFromNow); + futureDate.setUTCHours(0, 0, 0, 0); + return Math.floor(futureDate.getTime() / 1e3); +} +function requestsToKilosecond({ + period, + requests +}) { + const secondsPerDay = 86400; + const kilosecondsPerDay = secondsPerDay / 1e3; + switch (period) { + case "day": + return Math.round(requests / kilosecondsPerDay); + case "second": + return Math.round(requests * 1e3); + default: + throw new InvalidArgumentException( + { + info: { + period, + requests + } + }, + "Invalid period" + ); + } +} + +// packages/contracts-sdk/src/lib/contracts-sdk.ts +var asyncForEachReturn = async (array, callback) => { + const list = []; + for (let index = 0; index < array.length; index++) { + const item = await callback(array[index], index, array); + list.push(item); + } + return list; +}; +var GAS_LIMIT_INCREASE_PERCENTAGE = 10; +var GAS_LIMIT_ADJUSTMENT = ethers_exports.BigNumber.from(100).add( + GAS_LIMIT_INCREASE_PERCENTAGE +); +var _LitContracts = class { + provider; + rpc; + rpcs; + signer; + privateKey; + options; + randomPrivateKey = false; + connected = false; + isPKP = false; + debug = false; + network; + customContext; + // ----- autogen:declares:start ----- + // Generated at 2023-11-07T01:50:52.460Z + allowlistContract; + litTokenContract; + multisenderContract; + pkpHelperContract; + pkpNftContract; + pkpNftMetadataContract; + pkpPermissionsContract; + pubkeyRouterContract; + rateLimitNftContract; + stakingContract; + stakingBalancesContract; + // ----- autogen:declares:end ----- + // make the constructor args optional + constructor(args) { + this.customContext = args?.customContext; + this.rpc = args?.rpc; + this.rpcs = args?.rpcs; + this.signer = args?.signer; + this.privateKey = args?.privateKey; + this.provider = args?.provider; + this.randomPrivateKey = args?.randomPrivatekey ?? false; + this.options = args?.options; + this.debug = args?.debug ?? false; + this.network = args?.network || LIT_NETWORK.DatilDev; + if (!this.rpc) { + this.rpc = RPC_URL_BY_NETWORK[this.network]; + } + if (!this.rpcs) { + this.rpcs = [this.rpc]; + } + this.allowlistContract = {}; + this.litTokenContract = {}; + this.multisenderContract = {}; + this.pkpHelperContract = {}; + this.pkpNftContract = {}; + this.pkpNftMetadataContract = {}; + this.pkpPermissionsContract = {}; + this.pubkeyRouterContract = {}; + this.rateLimitNftContract = {}; + this.stakingContract = {}; + this.stakingBalancesContract = {}; + } + /** + * Logs a message to the console. + * + * @param {any} [args] An optional value to log with the message. + */ + log = (...args) => { + if (this.debug) { + _LitContracts.logger.debug(...args); + } + }; + connect = async () => { + let wallet; + let SETUP_DONE = false; + if (this.provider) { + this.log("Using provided provider"); + } else if (isBrowser() && !this.signer) { + let _decimalToHex2 = function(decimal) { + return "0x" + decimal.toString(16); + }; + var _decimalToHex = _decimalToHex2; + this.log("----- We're in the browser! -----"); + const web3Provider = window.ethereum; + if (!web3Provider) { + const msg = "No web3 provider found. Please install Brave, MetaMask or another web3 provider."; + alert(msg); + throw new InitError( + { + info: { + web3Provider + } + }, + msg + ); + } + const chainInfo = METAMASK_CHAIN_INFO_BY_NETWORK[this.network]; + const metamaskChainInfo2 = { + ...chainInfo, + chainId: _decimalToHex2(chainInfo.chainId) + }; + try { + await web3Provider.send("wallet_switchEthereumChain", [ + { chainId: metamaskChainInfo2.chainId } + ]); + } catch (e2) { + await web3Provider.request({ + method: "wallet_addEthereumChain", + params: [metamaskChainInfo2] + }); + } + wallet = new ethers_exports.providers.Web3Provider(web3Provider); + await wallet.send("eth_requestAccounts", []); + this.provider = wallet; + } else if (isNode()) { + this.log("----- We're in node! -----"); + this.provider = new ethers_exports.providers.StaticJsonRpcProvider({ + url: this.rpc, + skipFetchSetup: true + }); + } + if (this.privateKey) { + this.log("Using your own private key"); + this.signer = new ethers_exports.Wallet(this.privateKey, this.provider); + this.provider = this.signer.provider; + SETUP_DONE = true; + } + if (!this.privateKey && this.randomPrivateKey || this.options?.storeOrUseStorageKey) { + this.log("THIS.SIGNER:", this.signer); + const STORAGE_KEY = "lit-contracts-sdk-private-key"; + this.log("Let's see if you have a private key in your local storage!"); + let storagePrivateKey; + try { + storagePrivateKey = localStorage.getItem(STORAGE_KEY); + } catch (e2) { + } + if (!storagePrivateKey) { + this.log("Not a problem, we will generate a random private key"); + storagePrivateKey = ethers_exports.utils.hexlify(ethers_exports.utils.randomBytes(32)); + } else { + this.log("Found your private key in local storage. Let's use it!"); + } + this.signer = new ethers_exports.Wallet(storagePrivateKey, this.provider); + this.log("- Your private key:", storagePrivateKey); + this.log("- Your address:", await this.signer.getAddress()); + this.log("- this.signer:", this.signer); + this.log("- this.provider.getSigner():", this.provider.getSigner()); + if (this.options?.storeOrUseStorageKey) { + this.log( + "You've set the option to store your private key in local storage." + ); + localStorage.setItem(STORAGE_KEY, storagePrivateKey); + } + } else { + if (isBrowser() && wallet && !SETUP_DONE) { + this.log("this.signer:", this.signer); + this.signer = wallet.getSigner(); + } + } + if (this.signer !== void 0 && this.signer !== null) { + if ("litNodeClient" in this.signer && "rpcProvider" in this.signer) { + this.log(` + // *********************************************************************************************** + // THIS IS A PKP WALLET, USING IT AS A SIGNER AND ITS RPC PROVIDER AS PROVIDER + // *********************************************************************************************** + `); + this.provider = this.signer.rpcProvider; + this.isPKP = true; + } + } + this.log("Your Signer:", this.signer); + this.log("Your Provider:", this.provider?.connection); + if (!this.provider) { + this.log("No provider found. Will try to use the one from the signer."); + this.provider = this.signer.provider; + this.log("Your Provider(from signer):", this.provider?.connection); + } + const addresses = await _LitContracts.getContractAddresses( + this.network, + this.customContext?.provider ?? this.provider, + this.customContext + ); + const logAddresses = Object.entries(addresses).reduce( + (output, [key2, val]) => { + output[key2] = val.address; + return output; + }, + {} + ); + this.log("resolved contract addresses for: ", this.network, logAddresses); + if (addresses.Allowlist.abi) { + this.allowlistContract = { + read: new ethers_exports.Contract( + addresses.Allowlist.address, + addresses.Allowlist.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.Allowlist.address, + addresses.Allowlist.abi, + this.signer + ) + }; + } + if (addresses.LITToken.abi) { + this.litTokenContract = { + read: new ethers_exports.Contract( + addresses.LITToken.address, + addresses.LITToken.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.LITToken.address, + addresses.LITToken.abi, + this.signer + ) + }; + } + if (addresses.Multisender.abi) { + this.multisenderContract = { + read: new ethers_exports.Contract( + addresses.Multisender.address, + addresses.Multisender.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.Multisender.address, + addresses.Multisender.abi, + this.signer + ) + }; + } + if (addresses.PKPHelper.abi) { + this.pkpHelperContract = { + read: new ethers_exports.Contract( + addresses.PKPHelper.address, + addresses.PKPHelper.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.PKPHelper.address, + addresses.PKPHelper.abi, + this.signer + ) + }; + } + if (addresses.PKPNFT.abi) { + this.pkpNftContract = { + read: new ethers_exports.Contract( + addresses.PKPNFT.address, + addresses.PKPNFT.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.PKPNFT.address, + addresses.PKPNFT.abi, + this.signer + ) + }; + } + if (addresses.PKPNFTMetadata.abi) { + this.pkpNftMetadataContract = { + read: new ethers_exports.Contract( + addresses.PKPNFTMetadata.address, + addresses.PKPNFTMetadata.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.PKPNFTMetadata.address, + addresses.PKPNFTMetadata.abi, + this.signer + ) + }; + } + if (addresses.PKPPermissions.abi) { + this.pkpPermissionsContract = { + read: new ethers_exports.Contract( + addresses.PKPPermissions.address, + addresses.PKPPermissions.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.PKPPermissions.address, + addresses.PKPPermissions.abi, + this.signer + ) + }; + } + if (addresses.PubkeyRouter.abi) { + this.pubkeyRouterContract = { + read: new ethers_exports.Contract( + addresses.PubkeyRouter.address, + addresses.PubkeyRouter.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.PubkeyRouter.address, + addresses.PubkeyRouter.abi, + this.signer + ) + }; + } + if (addresses.RateLimitNFT.abi) { + this.rateLimitNftContract = { + read: new ethers_exports.Contract( + addresses.RateLimitNFT.address, + addresses.RateLimitNFT.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.RateLimitNFT.address, + addresses.RateLimitNFT.abi, + this.signer + ) + }; + } + if (addresses.Staking.abi) { + this.stakingContract = { + read: new ethers_exports.Contract( + addresses.Staking.address, + addresses.Staking.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.Staking.address, + addresses.Staking.abi, + this.signer + ) + }; + } + if (addresses.StakingBalances.abi) { + this.stakingBalancesContract = { + read: new ethers_exports.Contract( + addresses.StakingBalances.address, + addresses.StakingBalances.abi, + this.provider + ), + write: new ethers_exports.Contract( + addresses.StakingBalances.address, + addresses.StakingBalances.abi, + this.signer + ) + }; + } + this.connected = true; + }; + /** + * Retrieves the Staking contract instance based on the provided network, context, and RPC URL. + * If a context is provided, it determines if a contract resolver is used for bootstrapping contracts. + * If a resolver address is present in the context, it retrieves the Staking contract from the contract resolver instance. + * Otherwise, it retrieves the Staking contract using the contract address and ABI from the contract context. + * Throws an error if required contract data is missing or if the Staking contract cannot be obtained. + * + * @param network - The network key. + * @param context - The contract context or contract resolver context. + * @param rpcUrl - The RPC URL. + * @returns The Staking contract instance. + * @throws Error if required contract data is missing or if the Staking contract cannot be obtained. + */ + static async getStakingContract(network, context, rpcUrl) { + let provider; + const _rpcUrl = rpcUrl || RPC_URL_BY_NETWORK[network]; + if (context && "provider" in context) { + provider = context.provider; + } else { + provider = new ethers_exports.providers.StaticJsonRpcProvider({ + url: _rpcUrl, + skipFetchSetup: true + }); + } + if (!context) { + const contractData = await _LitContracts._resolveContractContext( + network + //context + ); + const stakingContract = contractData.find( + (item) => item.name === "Staking" + ); + const { address, abi } = stakingContract; + if (!address || !abi) { + throw new InitError( + { + info: { + address, + abi, + network + } + }, + "\u274C Required contract data is missing" + ); + } + return new ethers_exports.Contract(address, abi, provider); + } else { + if (!context.resolverAddress) { + const stakingContract = context.Staking; + if (!stakingContract.address) { + throw new InitError( + { + info: { + stakingContract, + context + } + }, + "\u274C Could not get staking contract address from contract context" + ); + } + return new ethers_exports.Contract( + stakingContract.address, + stakingContract.abi ?? StakingData.abi, + provider + ); + } else { + const contractContext = await _LitContracts._getContractsFromResolver( + context, + provider, + ["Staking"] + ); + if (!contractContext.Staking.address) { + throw new InitError( + { + info: { + contractContext, + context + } + }, + "\u274C Could not get Staking Contract from contract resolver instance" + ); + } + const stakingABI = NETWORK_CONTEXT_BY_NETWORK[network].data.find( + (data) => { + return data.name === "Staking"; + } + ); + return new ethers_exports.Contract( + contractContext.Staking.address, + contractContext.Staking.abi ?? stakingABI?.contracts[0].ABI, + provider + ); + } + } + } + static async _getContractsFromResolver(context, provider, contractNames) { + const resolverContract = new ethers_exports.Contract( + context.resolverAddress, + context.abi, + provider + ); + const getContract = async function(contract, environment) { + let address = ""; + switch (contract) { + case "Allowlist": + address = await resolverContract["getContract"]( + await resolverContract["ALLOWLIST_CONTRACT"](), + environment + ); + break; + case "LITToken": + address = await resolverContract["getContract"]( + await resolverContract["LIT_TOKEN_CONTRACT"](), + environment + ); + break; + case "Multisender": + address = await resolverContract["getContract"]( + await resolverContract["MULTI_SENDER_CONTRACT"](), + environment + ); + break; + case "PKPNFT": + address = await resolverContract["getContract"]( + await resolverContract["PKP_NFT_CONTRACT"](), + environment + ); + break; + case "PKPNFTMetadata": + address = await resolverContract["getContract"]( + await resolverContract["PKP_NFT_METADATA_CONTRACT"](), + environment + ); + break; + case "PKPPermissions": + address = await resolverContract["getContract"]( + await resolverContract["PKP_PERMISSIONS_CONTRACT"](), + environment + ); + break; + case "PKPHelper": + address = await resolverContract["getContract"]( + await resolverContract["PKP_HELPER_CONTRACT"](), + environment + ); + break; + case "PubkeyRouter": + address = await resolverContract["getContract"]( + await resolverContract["PUB_KEY_ROUTER_CONTRACT"](), + environment + ); + break; + case "RateLimitNFT": + address = await resolverContract["getContract"]( + await resolverContract["RATE_LIMIT_NFT_CONTRACT"](), + environment + ); + break; + case "Staking": + address = await resolverContract["getContract"]( + await resolverContract["STAKING_CONTRACT"](), + environment + ); + break; + case "StakingBalances": + address = await resolverContract["getContract"]( + await resolverContract["STAKING_BALANCES_CONTRACT"](), + environment + ); + break; + } + return address; + }; + const names2 = contractNames ?? _LitContracts.contractNames; + const contractContext = {}; + await Promise.all( + names2.map(async (contractName) => { + const contracts = context?.contractContext; + contractContext[contractName] = { + address: await getContract(contractName, context.environment), + abi: contracts?.[contractName]?.abi ?? void 0 + }; + }) + ); + return contractContext; + } + static async getContractAddresses(network, provider, context) { + let contractData; + if (context) { + if (context?.resolverAddress) { + context = await _LitContracts._getContractsFromResolver( + context, + provider + ); + } + const flatten2 = []; + const keys = Object.keys(context); + for (const key2 of keys) { + context[key2].name = key2; + flatten2.push(context[key2]); + } + contractData = flatten2; + } else { + contractData = await _LitContracts._resolveContractContext(network); + } + const addresses = {}; + for (const contract of contractData) { + switch (contract.name) { + case "Allowlist": + addresses.Allowlist = {}; + addresses.Allowlist.address = contract.address; + addresses.Allowlist.abi = contract.abi ?? AllowlistData.abi; + break; + case "PKPHelper": + addresses.PKPHelper = {}; + addresses.PKPHelper.address = contract.address; + addresses.PKPHelper.abi = contract?.abi ?? PKPHelperData.abi; + break; + case "PKPNFT": + addresses.PKPNFT = {}; + addresses.PKPNFT.address = contract.address; + addresses.PKPNFT.abi = contract?.abi ?? PKPNFTData.abi; + break; + case "Staking": + addresses.Staking = {}; + addresses.Staking.address = contract.address; + addresses.Staking.abi = contract.abi ?? StakingData.abi; + break; + case "RateLimitNFT": + addresses.RateLimitNFT = {}; + addresses.RateLimitNFT.address = contract.address; + addresses.RateLimitNFT.abi = contract.abi ?? RateLimitNFTData.abi; + break; + case "PKPPermissions": + addresses.PKPPermissions = {}; + addresses.PKPPermissions.address = contract.address; + addresses.PKPPermissions.abi = contract.abi ?? PKPPermissionsData.abi; + break; + case "PKPNFTMetadata": + addresses.PKPNFTMetadata = {}; + addresses.PKPNFTMetadata.address = contract.address; + addresses.PKPNFTMetadata.abi = contract.abi ?? PKPNFTMetadataData.abi; + break; + case "PubkeyRouter": + addresses.PubkeyRouter = {}; + addresses.PubkeyRouter.address = contract.address; + addresses.PubkeyRouter.abi = contract?.abi ?? PubkeyRouterData.abi; + break; + case "LITToken": + addresses.LITToken = {}; + addresses.LITToken.address = contract.address; + addresses.LITToken.abi = contract?.abi ?? LITTokenData.abi; + break; + case "StakingBalances": + addresses.StakingBalances = {}; + addresses.StakingBalances.address = contract.address; + addresses.StakingBalances.abi = contract.abi ?? StakingBalancesData.abi; + break; + case "Multisender": + addresses.Multisender = {}; + addresses.Multisender.address = contract.address; + addresses.Multisender.abi = contract?.abi ?? MultisenderData.abi; + break; + } + } + if (Object.keys(addresses).length < 5) { + throw new InitError( + { + info: { + network, + addresses, + context + } + }, + "\u274C Required contract data is missing" + ); + } + return addresses; + } + static async _resolveContractContext(network) { + if (!NETWORK_CONTEXT_BY_NETWORK[network]) { + throw new WrongNetworkException( + { + info: { + network + } + }, + `[_resolveContractContext] Unsupported network: ${network}` + ); + } + const data = NETWORK_CONTEXT_BY_NETWORK[network]; + if (!data) { + throw new WrongNetworkException( + { + info: { + network + } + }, + "[_resolveContractContext] No data found" + ); + } + return data.data.map((c) => ({ + address: c.contracts[0].address_hash, + abi: c.contracts[0].ABI, + name: c.name + })); + } + /** + * Mints a new token with authentication. + * + * @param authMethod - The authentication method. + * @param scopes - The permission scopes. + * @param pubkey - The public key. + * @param authMethodId - (optional) The authentication ID. + * @param gasLimit - (optional) The gas limit. + * @returns An object containing the PKP information and the transaction receipt. + * @throws Error if the contracts are not connected, the contract is not available, authMethodType or accessToken is missing, or permission scopes are required. + */ + mintWithAuth = async ({ + authMethod, + scopes, + pubkey, + authMethodId, + gasLimit + }) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpNftContract) { + throw new InitError( + { + info: { + pkpNftContract: this.pkpNftContract + } + }, + "Contract is not available" + ); + } + if (authMethod && !authMethod?.authMethodType) { + throw new ParamsMissingError( + { + info: { + authMethod + } + }, + "authMethodType is required" + ); + } + if (authMethod && !authMethod?.accessToken && authMethod?.accessToken !== "custom-auth") { + throw new ParamsMissingError( + { + info: { + authMethod + } + }, + "accessToken is required" + ); + } + if (scopes.length <= 0) { + throw new InvalidArgumentException( + { + info: { + scopes + } + }, + `\u274C Permission scopes are required! +[0] No Permissions +[1] Sign Anything +[2] Only Sign Messages +Read more here: +https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scopes + ` + ); + } + const _pubkey = pubkey ?? "0x"; + const _scopes = scopes.map((scope) => { + if (typeof scope === "string") { + return ethers_exports.BigNumber.from(scope); + } + if (typeof scope === "number") { + return ethers_exports.BigNumber.from(scope.toString()); + } + return scope; + }); + const _authMethodId = authMethodId ?? await getAuthIdByAuthMethod(authMethod); + const mintCost = await this.pkpNftContract.read.mintCost(); + const tx = await this._callWithAdjustedOverrides( + this.pkpHelperContract.write, + "mintNextAndAddAuthMethods", + [ + 2, + // key type + [authMethod.authMethodType], + [_authMethodId], + [_pubkey], + [[..._scopes]], + true, + true + ], + { value: mintCost, gasLimit } + ); + const receipt = await tx.wait(); + const events = "events" in receipt ? receipt.events : receipt.logs; + if (!events || events.length <= 0) { + throw new TransactionError( + { + info: { + events, + receipt + } + }, + "No events found in receipt" + ); + } + if (!events[0].topics || events[0].topics.length < 1) { + throw new TransactionError( + { + info: { + events, + receipt + } + }, + `No topics found in events, cannot derive pkp information. Transaction hash: ${receipt.transactionHash} If you are using your own contracts please use ethers directly` + ); + } + const tokenId = events[0].topics[1]; + this.log("tokenId:", tokenId); + let tries = 0; + const maxAttempts = 10; + let publicKey = ""; + while (tries < maxAttempts) { + publicKey = await this.pkpNftContract.read.getPubkey(tokenId); + this.log("pkp pub key: ", publicKey); + if (publicKey !== "0x") { + break; + } + tries++; + await new Promise((resolve) => { + setTimeout(resolve, 1e4); + }); + } + if (publicKey.startsWith("0x")) { + publicKey = publicKey.slice(2); + } + const pubkeyBuffer = Buffer.from(publicKey, "hex"); + const ethAddress = (0, import_utils10.computeAddress)(pubkeyBuffer); + return { + pkp: { + tokenId, + publicKey, + ethAddress + }, + tx: receipt + }; + }; + /** + * Mints a new token with customer authentication. + * + * @param { Object } params - The parameters for minting a new token with customer authentication. + * @param { string } params.authMethodId - The authentication method id. + * @param { string[] | number[] } params.scopes - The permission scopes. + * @param { string } params.authMethodType - The authentication method type. + * @returns { Promise> } - An object containing the PKP information and the transaction receipt. + * @throws { Error } - If the contracts are not connected, the contract is not available, authMethodType, or permission scopes are required. + * + */ + mintWithCustomAuth = async (params) => { + const authMethodId = typeof params.authMethodId === "string" ? stringToArrayify(params.authMethodId) : params.authMethodId; + return this.mintWithAuth({ + ...params, + authMethodId, + authMethod: { + authMethodType: params.authMethodType, + accessToken: "custom-auth" + } + }); + }; + /** + * Adds a permitted authentication method for a given PKP token. + * + * @param {Object} params - The parameters for adding the permitted authentication method. + * @param {string} params.pkpTokenId - The ID of the PKP token. + * @param {AUTH_METHOD_TYPE_VALUES | number} params.authMethodType - The type of the authentication method. + * @param {string | Uint8Array} params.authMethodId - The ID of the authentication method. + * @param {AuthMethodScope[]} params.authMethodScopes - The scopes of the authentication method. + * @param {string} [params.webAuthnPubkey] - The public key for WebAuthn. + * @returns {Promise} - A promise that resolves with the result of adding the permitted authentication method. + * @throws {Error} - If an error occurs while adding the permitted authentication method. + */ + addPermittedAuthMethod = async ({ + pkpTokenId, + authMethodType, + authMethodId, + authMethodScopes, + webAuthnPubkey + }) => { + const _authMethodId = typeof authMethodId === "string" ? stringToArrayify(authMethodId) : authMethodId; + const _webAuthnPubkey = webAuthnPubkey ?? "0x"; + try { + const res = await this._callWithAdjustedOverrides( + this.pkpPermissionsContract.write, + "addPermittedAuthMethod", + [ + pkpTokenId, + { + authMethodType, + id: _authMethodId, + userPubkey: _webAuthnPubkey + }, + authMethodScopes + ] + ); + const receipt = await res.wait(); + return receipt; + } catch (e2) { + throw new TransactionError( + { + info: { + pkpTokenId, + authMethodType, + authMethodId, + authMethodScopes, + webAuthnPubkey + }, + cause: e2 + }, + "Adding permitted action failed" + ); + } + }; + /** + * Adds a permitted action to the PKP permissions contract. + * + * @param ipfsId - The IPFS ID of the action. + * @param pkpTokenId - The PKP token ID. + * @param authMethodScopes - Optional array of authentication method scopes. + * @returns A promise that resolves to the result of the write operation. + * @throws If an error occurs during the write operation. + */ + addPermittedAction = async ({ + ipfsId, + pkpTokenId, + authMethodScopes + }) => { + const ipfsIdBytes = this.utils.getBytesFromMultihash(ipfsId); + const scopes = authMethodScopes ?? []; + try { + const res = await this._callWithAdjustedOverrides( + this.pkpPermissionsContract.write, + "addPermittedAction", + [pkpTokenId, ipfsIdBytes, scopes] + ); + const receipt = await res.wait(); + return receipt; + } catch (e2) { + throw new TransactionError( + { + info: { + pkpTokenId, + ipfsIdBytes, + scopes + }, + cause: e2 + }, + "Adding permitted action failed" + ); + } + }; + /** + * Mint a Capacity Credits NFT (RLI) token with the specified daily request rate and expiration period. The expiration date is calculated to be at midnight UTC, a specific number of days from now. + * + * @param {MintCapacityCreditsContext} context - The minting context. + * @returns {Promise} - A promise that resolves to the minted capacity credits NFT response. + * @throws {Error} - If the input parameters are invalid or an error occurs during the minting process. + */ + mintCapacityCreditsNFT = async ({ + requestsPerDay, + requestsPerSecond, + requestsPerKilosecond, + daysUntilUTCMidnightExpiration, + gasLimit + }) => { + this.log("Minting Capacity Credits NFT..."); + if ((requestsPerDay === null || requestsPerDay === void 0 || requestsPerDay <= 0) && (requestsPerSecond === null || requestsPerSecond === void 0 || requestsPerSecond <= 0) && (requestsPerKilosecond === null || requestsPerKilosecond === void 0 || requestsPerKilosecond <= 0)) { + throw new InvalidArgumentException( + { + info: { + requestsPerDay, + requestsPerSecond, + requestsPerKilosecond + } + }, + `At least one of requestsPerDay, requestsPerSecond, or requestsPerKilosecond is required and must be more than 0` + ); + } + let effectiveRequestsPerKilosecond; + if (requestsPerDay !== void 0) { + effectiveRequestsPerKilosecond = requestsToKilosecond({ + period: "day", + requests: requestsPerDay + }); + } else if (requestsPerSecond !== void 0) { + effectiveRequestsPerKilosecond = requestsToKilosecond({ + period: "second", + requests: requestsPerSecond + }); + } else if (requestsPerKilosecond !== void 0) { + effectiveRequestsPerKilosecond = requestsPerKilosecond; + } + if (effectiveRequestsPerKilosecond === void 0 || effectiveRequestsPerKilosecond <= 0) { + throw new InvalidArgumentException( + { + info: { + effectiveRequestsPerKilosecond + } + }, + `Effective requests per kilosecond is required and must be more than 0` + ); + } + const expiresAt = calculateUTCMidnightExpiration( + daysUntilUTCMidnightExpiration + ); + let mintCost; + try { + mintCost = await this.rateLimitNftContract.read.calculateCost( + effectiveRequestsPerKilosecond, + expiresAt + ); + } catch (e2) { + this.log("Error calculating mint cost:", e2); + throw e2; + } + this.log("Capacity Credits NFT mint cost:", mintCost.toString()); + if (requestsPerDay) + this.log("Requests per day:", requestsPerDay); + if (requestsPerSecond) + this.log("Requests per second:", requestsPerSecond); + this.log( + "Effective requests per kilosecond:", + effectiveRequestsPerKilosecond + ); + this.log(`Expires at (Unix Timestamp): ${expiresAt}`); + const expirationDate = new Date(expiresAt * 1e3); + this.log("Expiration Date (UTC):", expirationDate.toUTCString()); + try { + const res = await this._callWithAdjustedOverrides( + this.rateLimitNftContract.write, + "mint", + [expiresAt], + { value: mintCost, gasLimit } + ); + const txHash = res.hash; + const tx = await res.wait(); + this.log("xx Transaction:", tx); + const tokenId = ethers_exports.BigNumber.from(tx.logs[0].topics[3]); + return { + rliTxHash: txHash, + capacityTokenId: tokenId, + capacityTokenIdStr: tokenId.toString() + }; + } catch (e2) { + throw new TransactionError( + { + info: { + requestsPerDay, + requestsPerSecond, + requestsPerKilosecond, + expiresAt + }, + cause: e2 + }, + "Minting capacity credits NFT failed" + ); + } + }; + // getRandomPrivateKeySignerProvider = () => { + // const privateKey = ethers.utils.hexlify(ethers.utils.randomBytes(32)); + // let provider; + // if (isBrowser()) { + // provider = new ethers.providers.Web3Provider(window.ethereum, 'any'); + // } else { + // provider = new ethers.providers.StaticJsonRpcProvider({ + // url: this.rpc, + // skipFetchSetup: true, + // }); + // } + // const signer = new ethers.Wallet(privateKey, provider); + // return { privateKey, signer, provider }; + // }; + // getPrivateKeySignerProvider = (privateKey: string) => { + // let provider; + // if (isBrowser()) { + // provider = new ethers.providers.Web3Provider(window.ethereum, 'any'); + // } else { + // provider = new ethers.providers.StaticJsonRpcProvider({ + // url: this.rpc, + // skipFetchSetup: true, + // }); + // } + // const signer = new ethers.Wallet(privateKey, provider); + // return { privateKey, signer, provider }; + // }; + utils = { + hexToDec, + decToHex, + /** + * Partition multihash string into object representing multihash + * + * @param {string} multihash A base58 encoded multihash string + * @returns {string} + */ + getBytesFromMultihash: (multihash) => { + const decoded = ethers_exports.utils.base58.decode(multihash); + return `0x${Buffer.from(decoded).toString("hex")}`; + }, + /** + * + * Convert bytes32 to IPFS ID + * @param { string } byte32 0x1220baa0d1e91f2a22fef53659418ddc3ac92da2a76d994041b86ed62c0c999de477 + * @returns { string } QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW + */ + getMultihashFromBytes: (byte32) => { + const text = byte32.replace("0x", ""); + const digestSize = parseInt(text.slice(2, 4), 16); + const digest = text.slice(4, 4 + digestSize * 2); + const multihash = ethers_exports.utils.base58.encode( + Buffer.from(`1220${digest}`, "hex") + ); + return multihash; + }, + /** + * NOTE: This function requires the "multiformats/cid" package in order to work + * + * Partition multihash string into object representing multihash + * + * @param {string} ipfsId A base58 encoded multihash string + * @param {CIDParser} CID The CID object from the "multiformats/cid" package + * + * @example + * const CID = require('multiformats/cid') + * const ipfsId = 'QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW' + * const bytes32 = getBytes32FromMultihash(ipfsId, CID) + * console.log(bytes32) + * + * @returns {IPFSHash} + */ + getBytes32FromMultihash: (ipfsId, CID) => { + return getBytes32FromMultihash(ipfsId, CID); + }, + // convert timestamp to YYYY/MM/DD format + timestamp2Date: (timestamp) => { + const date = __require("date-and-time"); + const format = "YYYY/MM/DD HH:mm:ss"; + const timestampFormatted = new Date(parseInt(timestamp) * 1e3); + return date.format(timestampFormatted, format); + } + }; + pkpNftContractUtils = { + read: { + /** + * (IERC721Enumerable) + * + * Get all PKPs by a given address + * + * @param { string } ownerAddress + * @retu + * */ + getTokensByAddress: async (ownerAddress) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpNftContract) { + throw new InitError( + { + info: { + pkpNftContract: this.pkpNftContract + } + }, + "Contract is not available" + ); + } + if (!ethers_exports.utils.isAddress(ownerAddress)) { + throw new InvalidArgumentException( + { + info: { + ownerAddress + } + }, + `Given string is not a valid address "${ownerAddress}"` + ); + } + const tokens = []; + for (let i2 = 0; ; i2++) { + let token; + try { + token = await this.pkpNftContract.read.tokenOfOwnerByIndex( + ownerAddress, + i2 + ); + token = this.utils.hexToDec(token.toHexString()); + tokens.push(token); + } catch (e2) { + this.log(`[getTokensByAddress] Ended search on index: ${i2}`); + break; + } + } + return tokens; + }, + /** + * (IERC721Enumerable) + * + * Get the x latest number of tokens + * + * @param { number } latestNumberOfTokens + * + * @returns { Array } a list of PKP NFTs + * + */ + getTokens: async (latestNumberOfTokens) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpNftContract) { + throw new InitError( + { + info: { + pkpNftContract: this.pkpNftContract + } + }, + "Contract is not available" + ); + } + const tokens = []; + for (let i2 = 0; ; i2++) { + if (i2 >= latestNumberOfTokens) { + break; + } + let token; + try { + token = await this.pkpNftContract.read.tokenByIndex(i2); + token = this.utils.hexToDec(token.toHexString()); + tokens.push(token); + } catch (e2) { + this.log(`[getTokensByAddress] Ended search on index: ${i2}`); + break; + } + } + return tokens; + }, + /** + * Get info of all PKPs by a given address + */ + getTokensInfoByAddress: async (ownerAddress) => { + const tokenIds = await this.pkpNftContractUtils.read.getTokensByAddress( + ownerAddress + ); + const arr = []; + for (let i2 = 0; i2 < tokenIds.length; i2++) { + const tokenId = tokenIds[i2]; + const pubKey = await this.pkpNftContract.read.getPubkey(tokenId); + const addrs = await derivedAddresses({ + publicKey: pubKey + }); + arr.push(addrs); + } + return arr; + } + }, + write: { + mint: async (param) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpNftContract) { + throw new InitError( + { + info: { + pkpNftContract: this.pkpNftContract + } + }, + "Contract is not available" + ); + } + let mintCost; + try { + mintCost = await this.pkpNftContract.read.mintCost(); + } catch (e2) { + throw new TransactionError( + { + info: { + mintCost + }, + cause: e2 + }, + "Could not get mint cost" + ); + } + if (this.isPKP) { + this.log( + "This is a PKP wallet, so we'll use the PKP wallet to sign the tx" + ); + } + this.log("...signing and sending tx"); + const sentTx = await this._callWithAdjustedOverrides( + this.pkpNftContract.write, + "mintNext", + [2], + { value: mintCost, ...param } + ); + this.log("sentTx:", sentTx); + const res = await sentTx.wait(); + this.log("res:", res); + const events = "events" in res ? res.events : res.logs; + const tokenIdFromEvent = events[0].topics[1]; + this.log("tokenIdFromEvent:", tokenIdFromEvent); + let tries = 0; + const maxAttempts = 10; + let publicKey = ""; + while (tries < maxAttempts) { + publicKey = await this.pkpNftContract.read.getPubkey( + tokenIdFromEvent + ); + this.log("pkp pub key: ", publicKey); + if (publicKey !== "0x") { + break; + } + tries++; + await new Promise((resolve) => { + setTimeout(resolve, 1e4); + }); + } + this.log("public key from token id", publicKey); + if (publicKey.startsWith("0x")) { + publicKey = publicKey.slice(2); + } + const pubkeyBuffer = Buffer.from(publicKey, "hex"); + const ethAddress = (0, import_utils10.computeAddress)(pubkeyBuffer); + return { + pkp: { + tokenId: tokenIdFromEvent, + publicKey, + ethAddress + }, + tx: sentTx, + tokenId: tokenIdFromEvent, + res + }; + }, + claimAndMint: async (derivedKeyId, signatures, txOpts = {}) => { + try { + const tx = await this._callWithAdjustedOverrides( + this.pkpNftContract.write, + "claimAndMint", + [2, derivedKeyId, signatures], + { + ...txOpts, + value: txOpts.value ?? await this.pkpNftContract.read.mintCost() + } + ); + const txRec = await tx.wait(); + const events = "events" in txRec ? txRec.events : txRec.logs; + const tokenId = events[1].topics[1]; + return { tx, res: txRec, tokenId }; + } catch (e2) { + this.log(`[claimAndMint] error: ${e2.message}`); + throw new TransactionError( + { + info: { + derivedKeyId, + signatures, + txOpts + }, + cause: e2 + }, + "claimAndMint failed" + ); + } + } + } + }; + pkpPermissionsContractUtils = { + read: { + /** + * + * Check if an address is permitted + * + * @param { string } tokenId + * @param { string } address + * + * @returns { Promise } + */ + isPermittedAddress: async (tokenId, address) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpPermissionsContract) { + throw new InitError( + { + info: { + pkpPermissionsContract: this.pkpPermissionsContract + } + }, + "Contract is not available" + ); + } + const pkpIdHex = this.utils.decToHex(tokenId, null); + const bool = await this.pkpPermissionsContract.read.isPermittedAddress( + pkpIdHex, + address + ); + return bool; + }, + /** + * Get permitted addresses + * + * @param { string } tokenId + * + * @returns { Promise> } + * + */ + getPermittedAddresses: async (tokenId) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpPermissionsContract) { + throw new InitError( + { + info: { + pkpPermissionsContract: this.pkpPermissionsContract + } + }, + "Contract is not available" + ); + } + this.log("[getPermittedAddresses] input:", tokenId); + let addresses = []; + const maxTries = 5; + let tries = 0; + while (tries < maxTries) { + try { + addresses = await this.pkpPermissionsContract.read.getPermittedAddresses( + tokenId + ); + if (addresses.length <= 0) { + await new Promise((resolve) => setTimeout(resolve, 1e3)); + tries++; + continue; + } else { + break; + } + } catch (e2) { + this.log( + `[getPermittedAddresses] error:`, + e2.message + ); + tries++; + } + } + return addresses; + }, + /** + * + * Get permitted action + * + * @param { any } tokenId + * + * @returns { Promise> } + * + */ + getPermittedActions: async (tokenId) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpPermissionsContract) { + throw new InitError( + { + info: { + pkpPermissionsContract: this.pkpPermissionsContract + } + }, + "Contract is not available" + ); + } + let actions = []; + const maxTries = 5; + let tries = 0; + while (tries < maxTries) { + try { + actions = await this.pkpPermissionsContract.read.getPermittedActions( + tokenId + ); + if (actions.length <= 0) { + await new Promise((resolve) => setTimeout(resolve, 1e3)); + tries++; + continue; + } else { + break; + } + } catch (e2) { + this.log( + `[getPermittedActions] error:`, + e2.message + ); + tries++; + } + } + return actions; + }, + /** + * + * Check if an action is permitted given the pkpid and ipfsId + * + * @param { string } pkpId 103309008291725705563022469659474510532358692659842796086905702509072063991354 + * @param { string } ipfsId QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW + * + * @return { object } transaction + */ + isPermittedAction: async (pkpId, ipfsId) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpPermissionsContract) { + throw new InitError( + { + info: { + pkpPermissionsContract: this.pkpPermissionsContract + } + }, + "Contract is not available" + ); + } + this.log("[isPermittedAction] input:", pkpId); + this.log("[isPermittedAction] input:", ipfsId); + const ipfsHash = this.utils.getBytesFromMultihash(ipfsId); + this.log("[isPermittedAction] converted:", ipfsHash); + const bool = await this.pkpPermissionsContract.read.isPermittedAction( + pkpId, + ipfsHash + ); + return bool; + } + }, + write: { + /** + * + * Add permitted action to a given PKP id & ipfsId + * + * @param { string } pkpId 103309008291725705563022469659474510532358692659842796086905702509072063991354 + * @param { string } ipfsId QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW + * + * @return { object } transaction + */ + addPermittedAction: async (pkpId, ipfsId) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpPermissionsContract || !this.pubkeyRouterContract) { + throw new InitError( + { + info: { + pkpPermissionsContract: this.pkpPermissionsContract, + pubkeyRouterContract: this.pubkeyRouterContract + } + }, + "Contract is not available" + ); + } + this.log("[addPermittedAction] input:", pkpId); + const pubKey = await this.pubkeyRouterContract.read.getPubkey(pkpId); + this.log("[addPermittedAction] converted:", pubKey); + const pubKeyHash = ethers_exports.utils.keccak256(pubKey); + this.log("[addPermittedAction] converted:", pubKeyHash); + const tokenId = ethers_exports.BigNumber.from(pubKeyHash); + this.log("[addPermittedAction] converted:", tokenId); + this.log("[addPermittedAction] input:", ipfsId); + const ipfsIdBytes = this.utils.getBytesFromMultihash(ipfsId); + this.log("[addPermittedAction] converted:", ipfsIdBytes); + const tx = await this._callWithAdjustedOverrides( + this.pkpPermissionsContract.write, + "addPermittedAction", + [tokenId, ipfsIdBytes, [1]] + ); + this.log("[addPermittedAction] output:", tx); + return tx; + }, + /** + * TODO: add transaction type + * Add permitted action to a given PKP id & ipfsId + * + * @param { string } pkpId 103309008291725705563022469659474510532358692659842796086905702509072063991354 + * @param { string } ownerAddress 0x3B5dD2605.....22aDC499A1 + * + * @return { object } transaction + */ + addPermittedAddress: async (pkpId, ownerAddress) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpPermissionsContract) { + throw new InitError( + { + info: { + pkpPermissionsContract: this.pkpPermissionsContract + } + }, + "Contract is not available" + ); + } + this.log("[addPermittedAddress] input:", pkpId); + this.log("[addPermittedAddress] input:", ownerAddress); + this.log("[addPermittedAddress] input:", pkpId); + const tx = await this._callWithAdjustedOverrides( + this.pkpPermissionsContract.write, + "addPermittedAddress", + [pkpId, ownerAddress, [1]] + ); + this.log("[addPermittedAddress] output:", tx); + return tx; + }, + /** + * Revoke permitted action of a given PKP id & ipfsId + * + * @param { string } pkpId 103309008291725705563022469659474510532358692659842796086905702509072063991354 + * @param { string } ipfsId QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW + * + * @return { object } transaction + */ + revokePermittedAction: async (pkpId, ipfsId) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.pkpPermissionsContract) { + throw new InitError( + { + info: { + pkpPermissionsContract: this.pkpPermissionsContract + } + }, + "Contract is not available" + ); + } + this.log("[revokePermittedAction] input:", pkpId); + this.log("[revokePermittedAction] input:", ipfsId); + const ipfsHash = this.utils.getBytesFromMultihash(ipfsId); + this.log("[revokePermittedAction] converted:", ipfsHash); + const tx = await this._callWithAdjustedOverrides( + this.pkpPermissionsContract.write, + "removePermittedAction", + [pkpId, ipfsHash] + ); + this.log("[revokePermittedAction] output:", tx); + return tx; + } + } + }; + rateLimitNftContractUtils = { + read: { + /** + * getCapacityByIndex: async (index: number): Promise => { + * + * This function takes a token index as a parameter and returns the capacity of the token + * with the given index. The capacity is an object that contains the number of requests + * per millisecond that the token allows, and an object with the expiration timestamp and + * formatted expiration date of the token. + * + * @param {number} index - The index of the token. + * @returns {Promise} - A promise that resolves to the capacity of the token. + * + * Example: + * + * const capacity = await getCapacityByIndex(1); + * this.log(capacity); + * // Output: { + * // requestsPerMillisecond: 100, + * // expiresAt: { + * // timestamp: 1623472800, + * // formatted: '2022-12-31', + * // }, + * // } + * + * } + */ + getCapacityByIndex: async (index) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.rateLimitNftContract) { + throw new InitError( + { + info: { + rateLimitNftContract: this.rateLimitNftContract + } + }, + "Contract is not available" + ); + } + const capacity = await this.rateLimitNftContract.read.capacity(index); + return { + requestsPerMillisecond: parseInt(capacity[0].toString()), + expiresAt: { + timestamp: parseInt(capacity[1].toString()), + formatted: this.utils.timestamp2Date(capacity[1].toString()) + } + }; + }, + /** + * getTokenURIByIndex: async (index: number): Promise => { + * + * This function takes a token index as a parameter and returns the URI of the token + * with the given index. + * + * @param {number} index - The index of the token. + * @returns {Promise} - A promise that resolves to the URI of the token. + * + * Example: + * + * const URI = await getTokenURIByIndex(1); + * this.log(URI); + * // Output: 'https://tokens.com/1' + * + * } + */ + getTokenURIByIndex: async (index) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.rateLimitNftContract) { + throw new InitError( + { + info: { + rateLimitNftContract: this.rateLimitNftContract + } + }, + "Contract is not available" + ); + } + const base64 = await this.rateLimitNftContract.read.tokenURI(index); + const data = base64.split("data:application/json;base64,")[1]; + const dataToString = Buffer.from(data, "base64").toString("binary"); + return JSON.parse(dataToString); + }, + /** + * getTokensByOwnerAddress: async (ownerAddress: string): Promise => { + * + * This function takes an owner address as a parameter and returns an array of tokens + * that are owned by the given address. + * + * @param {string} ownerAddress - The address of the owner. + * @returns {Promise} - A promise that resolves to an array of token objects. + * + * Example: + * + * const tokens = await getTokensByOwnerAddress('0x1234...5678'); + * this.log(tokens); + * // Output: [ + * // { + * // tokenId: 1, + * // URI: 'https://tokens.com/1', + * // capacity: 100, + * // isExpired: false, + * // }, + * // { + * // tokenId: 2, + * // URI: 'https://tokens.com/2', + * // capacity: 200, + * // isExpired: true, + * // }, + * // ... + * // ] + * + * } + */ + getTokensByOwnerAddress: async (ownerAddress) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.rateLimitNftContract) { + throw new InitError( + { + info: { + rateLimitNftContract: this.rateLimitNftContract + } + }, + "Contract is not available" + ); + } + if (!ethers_exports.utils.isAddress(ownerAddress)) { + throw Error(`Given string is not a valid address "${ownerAddress}"`); + } + let total = await this.rateLimitNftContract.read.balanceOf( + ownerAddress + ); + total = parseInt(total.toString()); + const tokens = await asyncForEachReturn( + [...new Array(total)], + async (_, i2) => { + if (!this.rateLimitNftContract) { + throw new InitError( + { + info: { + rateLimitNftContract: this.rateLimitNftContract + } + }, + "Contract is not available" + ); + } + const token = await this.rateLimitNftContract.read.tokenOfOwnerByIndex( + ownerAddress, + i2 + ); + const tokenIndex = parseInt(token.toString()); + const URI = await this.rateLimitNftContractUtils.read.getTokenURIByIndex( + tokenIndex + ); + const capacity = await this.rateLimitNftContractUtils.read.getCapacityByIndex( + tokenIndex + ); + const isExpired = await this.rateLimitNftContract.read.isExpired( + tokenIndex + ); + return { + tokenId: parseInt(token.toString()), + URI, + capacity, + isExpired + }; + } + ); + return tokens; + }, + /** + * getTokens: async (): Promise => { + * + * This function returns an array of all tokens that have been minted. + * + * @returns {Promise} - A promise that resolves to an array of token objects. + * + * Example: + * + * const tokens = await getTokens(); + * this.log(tokens); + * // Output: [ + * // { + * // tokenId: 1, + * // URI: 'https://tokens.com/1', + * // capacity: 100, + * // isExpired: false, + * // }, + * // { + * // tokenId: 2, + * // URI: 'https://tokens.com/2', + * // capacity: 200, + * // isExpired: true, + * // }, + * // ... + * // ] + * + * } + */ + getTokens: async () => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.rateLimitNftContract) { + throw new InitError( + { + info: { + rateLimitNftContract: this.rateLimitNftContract + } + }, + "Contract is not available" + ); + } + const bigTotal = await this.rateLimitNftContract.read.totalSupply(); + const total = parseInt(bigTotal.toString()); + const tokens = await asyncForEachReturn( + [...new Array(total)], + async (_, i2) => { + if (!this.rateLimitNftContract) { + throw new InitError( + { + info: { + rateLimitNftContract: this.rateLimitNftContract + } + }, + "Contract is not available" + ); + } + const token = await this.rateLimitNftContract.read.tokenByIndex(i2); + const tokenIndex = parseInt(token.toString()); + const URI = await this.rateLimitNftContractUtils.read.getTokenURIByIndex( + tokenIndex + ); + const capacity = await this.rateLimitNftContractUtils.read.getCapacityByIndex( + tokenIndex + ); + const isExpired = await this.rateLimitNftContract.read.isExpired( + tokenIndex + ); + return { + tokenId: parseInt(token.toString()), + URI, + capacity, + isExpired + }; + } + ); + return tokens; + } + }, + write: { + mint: async ({ + txOpts, + timestamp + }) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.rateLimitNftContract) { + throw new InitError( + { + info: { + rateLimitNftContract: this.rateLimitNftContract + } + }, + "Contract is not available" + ); + } + const tx = await this._callWithAdjustedOverrides( + this.rateLimitNftContract.write, + "mint", + [timestamp], + txOpts + ); + const res = await tx.wait(); + const tokenIdFromEvent = res.events?.[0].topics[1]; + return { tx, tokenId: tokenIdFromEvent }; + }, + /** + * Transfer RLI token from one address to another + * + * @property { string } fromAddress + * @property { string } toAddress + * @property { string } RLITokenAddress + * + * @return { > } void + */ + transfer: async ({ + fromAddress, + toAddress, + RLITokenAddress + }) => { + if (!this.connected) { + throw new InitError( + { + info: { + connected: this.connected + } + }, + "Contracts are not connected. Please call connect() first" + ); + } + if (!this.rateLimitNftContract) { + throw new InitError( + { + info: { + rateLimitNftContract: this.rateLimitNftContract + } + }, + "Contract is not available" + ); + } + const tx = await this._callWithAdjustedOverrides( + this.rateLimitNftContract.write, + "transferFrom", + [fromAddress, toAddress, RLITokenAddress] + ); + this.log("tx:", tx); + return tx; + } + } + }; + routerContractUtils = { + read: { + /** + * + * Convert IPFS response from Solidity to IPFS ID + * From: "0xb4200a696794b8742fab705a8c065ea6788a76bc6d270c0bc9ad900b6ed74ebc" + * To: "QmUnwHVcaymJWiYGQ6uAHvebGtmZ8S1r9E6BVmJMtuK5WY" + * + * @param { string } solidityIpfsId + * + * @return { Promise } + */ + // getIpfsIds: async (solidityIpfsId: string): Promise => { + // this.log('[getIpfsIds] input:', solidityIpfsId); + // const ipfsId = this.utils.getMultihashFromBytes(solidityIpfsId); + // this.log('[getIpfsIds] output:', ipfsId); + // return ipfsId; + // }, + }, + write: {} + }; + pkpHelperContractUtil = { + read: {}, + write: { + /** + * + * @param param0 + * @returns + */ + mintNextAndAddAuthMethods: async ({ + keyType, + permittedAuthMethodTypes, + permittedAuthMethodIds, + permittedAuthMethodPubkeys, + permittedAuthMethodScopes, + addPkpEthAddressAsPermittedAddress, + sendPkpToItself, + gasLimit + }) => { + const mintCost = await this.pkpNftContract.read.mintCost(); + const tx = await this._callWithAdjustedOverrides( + this.pkpHelperContract.write, + "mintNextAndAddAuthMethods", + [ + keyType, + permittedAuthMethodTypes, + permittedAuthMethodIds, + permittedAuthMethodPubkeys, + permittedAuthMethodScopes, + addPkpEthAddressAsPermittedAddress, + sendPkpToItself + ], + { value: mintCost, gasLimit } + ); + return tx; + } + // claimAndMintNextAndAddAuthMethods: async ( + // keyType: number, + // derivedKeyId: string, + // signatures: pkpHelperContract.IPubkeyRouter.SignatureStruct[], + // permittedAuthMethodTypes: string[], + // permittedAuthMethodIds: string[], + // permittedAuthMethodPubkeys: string[], + // permittedAuthMethodScopes: string[][], + // addPkpEthAddressAsPermittedAddress: boolean, + // sendPkpToItself: boolean + // ): Promise => { + // const mintCost = await this.pkpNftContract.read.mintCost(); + // this.pkpHelperContract.write.claimAndMintNextAndAddAuthMethods( + // keyType, + // `0x${derivedKeyId}` as BytesLike, + // signatures, + // permittedAuthMethodTypes, + // permittedAuthMethodIds as BytesLike[], + // permittedAuthMethodPubkeys as BytesLike[], + // permittedAuthMethodScopes, + // addPkpEthAddressAsPermittedAddress, + // sendPkpToItself, + // { value: mintCost } + // ); + // }, + } + }; + _getAdjustedGasLimit = async (contract, method, args, overrides = {}, gasLimitAdjustment = GAS_LIMIT_ADJUSTMENT) => { + const gasLimit = await contract.estimateGas[method]( + ...args, + overrides + ); + return gasLimit.mul(gasLimitAdjustment).div(100); + }; + async _callWithAdjustedOverrides(contract, method, args, overrides = {}, gasLimitAdjustment = GAS_LIMIT_ADJUSTMENT) { + if (!(method in contract.functions)) { + throw new Error( + `Method ${String(method)} does not exist on the contract` + ); + } + const gasLimit = overrides.gasLimit ?? await this._getAdjustedGasLimit( + contract, + method, + args, + overrides, + gasLimitAdjustment + ); + return contract.functions[method](...args, { + ...overrides, + gasLimit + }); + } +}; +var LitContracts = _LitContracts; +__publicField(LitContracts, "contractNames", [ + "Allowlist", + "Staking", + "RateLimitNFT", + "PubkeyRouter", + "PKPHelper", + "PKPPermissions", + "PKPNFTMetadata", + "PKPNFT", + "Multisender", + "LITToken", + "StakingBalances" +]); +__publicField(LitContracts, "logger", LogManager.Instance.get("contract-sdk")); +/** + * @deprecated - Use {@link getConnectionInfo } instead, which provides more information. + */ +__publicField(LitContracts, "getMinNodeCount", async (network, context, rpcUrl) => { + const contract = await _LitContracts.getStakingContract( + network, + context, + rpcUrl + ); + const minNodeCount = await contract["currentValidatorCountForConsensus"](); + if (!minNodeCount) { + throw new InitError( + { + info: { + minNodeCount + } + }, + "\u274C Minimum validator count is not set" + ); + } + return minNodeCount; +}); +/** + * @deprecated - Use {@link getConnectionInfo } instead, which provides more information. + */ +__publicField(LitContracts, "getValidators", async (network, context, rpcUrl, nodeProtocol) => { + const contract = await _LitContracts.getStakingContract( + network, + context, + rpcUrl + ); + const [activeValidators, currentValidatorsCount, kickedValidators] = await Promise.all([ + contract["getValidatorsInCurrentEpoch"](), + contract["currentValidatorCountForConsensus"](), + contract["getKickedValidators"]() + ]); + const validators = []; + if (activeValidators.length - kickedValidators.length >= currentValidatorsCount) { + for (const validator of activeValidators) { + validators.push(validator); + } + } else { + _LitContracts.logger.error( + "\u274C Active validator set does not meet the threshold" + ); + } + const cleanedActiveValidators = activeValidators.filter( + (av) => !kickedValidators.some((kv) => kv === av) + ); + const activeValidatorStructs = (await contract["getValidatorsStructs"](cleanedActiveValidators)).map((item) => { + return { + ip: item[0], + ipv6: item[1], + port: item[2], + nodeAddress: item[3], + reward: item[4], + seconderPubkey: item[5], + receiverPubkey: item[6] + }; + }); + const networks2 = activeValidatorStructs.map((item) => { + const centralisation = CENTRALISATION_BY_NETWORK[network]; + const ip = intToIP(item.ip); + const port = item.port; + const protocol = ( + // If nodeProtocol is defined, use it + nodeProtocol || // If port is 443, use HTTPS, otherwise use network-specific HTTP + (port === 443 ? HTTPS : HTTP_BY_NETWORK[network]) || // Fallback to HTTP if no other conditions are met + HTTP + ); + const url = `${protocol}${ip}:${port}`; + _LitContracts.logger.debug("Validator's URL:", url); + return url; + }); + return networks2; +}); +/** + * Retrieves the connection information for a given network. + * + * @param params + * @param params.litNetwork - The key representing the network. + * @param [params.networkContext] - Optional network context for the contract. + * @param [params.rpcUrl] - Optional RPC URL for the network. + * @param [params.nodeProtocol] - Optional protocol for the network node. + * + * @returns An object containing the staking contract, epoch number, minimum node count and an array of bootstrap URLs. + * + * @throws Error if the minimum validator count is not set or if the active validator set does not meet the threshold. + */ +__publicField(LitContracts, "getConnectionInfo", async ({ + litNetwork, + networkContext, + rpcUrl, + nodeProtocol +}) => { + const stakingContract = await _LitContracts.getStakingContract( + litNetwork, + networkContext, + rpcUrl + ); + const [epochInfo, minNodeCount, activeUnkickedValidatorStructs] = await stakingContract["getActiveUnkickedValidatorStructsAndCounts"](); + const typedEpochInfo = { + epochLength: ethers_exports.BigNumber.from(epochInfo[0]).toNumber(), + number: ethers_exports.BigNumber.from(epochInfo[1]).toNumber(), + endTime: ethers_exports.BigNumber.from(epochInfo[2]).toNumber(), + retries: ethers_exports.BigNumber.from(epochInfo[3]).toNumber(), + timeout: ethers_exports.BigNumber.from(epochInfo[4]).toNumber() + }; + const minNodeCountInt = ethers_exports.BigNumber.from(minNodeCount).toNumber(); + if (!minNodeCountInt) { + throw new Error("\u274C Minimum validator count is not set"); + } + if (activeUnkickedValidatorStructs.length < minNodeCountInt) { + throw new Error( + `\u274C Active validator set does not meet the threshold. Required: ${minNodeCountInt} but got: ${activeUnkickedValidatorStructs.length}` + ); + } + const activeValidatorStructs = activeUnkickedValidatorStructs.map((item) => { + return { + ip: item[0], + ipv6: item[1], + port: item[2], + nodeAddress: item[3], + reward: item[4], + seconderPubkey: item[5], + receiverPubkey: item[6] + }; + }); + const networks2 = activeValidatorStructs.map((item) => { + const centralisation = CENTRALISATION_BY_NETWORK[litNetwork]; + const ip = intToIP(item.ip); + const port = item.port; + const protocol = ( + // If nodeProtocol is defined, use it + nodeProtocol || // If port is 443, use HTTPS, otherwise use network-specific HTTP + (port === 443 ? HTTPS : HTTP_BY_NETWORK[litNetwork]) || // Fallback to HTTP if no other conditions are met + HTTP + ); + const url = `${protocol}${ip}:${port}`; + _LitContracts.logger.debug("Validator's URL:", url); + return url; + }); + return { + stakingContract, + epochInfo: typedEpochInfo, + minNodeCount: minNodeCountInt, + bootstrapUrls: networks2 + }; +}); + +// packages/crypto/src/index.ts +init_shim(); + +// packages/crypto/src/lib/crypto.ts +init_shim(); +var import_utils12 = __toESM(require_utils2()); + +// packages/nacl/src/index.ts +init_shim(); + +// packages/nacl/src/lib/nacl.ts +init_shim(); +var u64 = function(h, l2) { + this.hi = h | 0 >>> 0; + this.lo = l2 | 0 >>> 0; +}; +var gf = function(init2) { + var i2, r3 = new Float64Array(16); + if (init2) + for (i2 = 0; i2 < init2.length; i2++) + r3[i2] = init2[i2]; + return r3; +}; +var randombytes = function() { + throw new Error("no PRNG"); +}; +var _0 = new Uint8Array(16); +var _9 = new Uint8Array(32); +_9[0] = 9; +var gf0 = gf(); +var gf1 = gf([1]); +var _121665 = gf([56129, 1]); +var D = gf([ + 30883, + 4953, + 19914, + 30187, + 55467, + 16705, + 2637, + 112, + 59544, + 30585, + 16505, + 36039, + 65139, + 11119, + 27886, + 20995 +]); +var D2 = gf([ + 61785, + 9906, + 39828, + 60374, + 45398, + 33411, + 5274, + 224, + 53552, + 61171, + 33010, + 6542, + 64743, + 22239, + 55772, + 9222 +]); +var X = gf([ + 54554, + 36645, + 11616, + 51542, + 42930, + 38181, + 51040, + 26924, + 56412, + 64982, + 57905, + 49316, + 21502, + 52590, + 14035, + 8553 +]); +var Y = gf([ + 26200, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214, + 26214 +]); +var I = gf([ + 41136, + 18958, + 6951, + 50414, + 58488, + 44335, + 6150, + 12099, + 55207, + 15867, + 153, + 11085, + 57099, + 20417, + 9344, + 11139 +]); +function L32(x, c) { + return x << c | x >>> 32 - c; +} +function ld32(x, i2) { + var u = x[i2 + 3] & 255; + u = u << 8 | x[i2 + 2] & 255; + u = u << 8 | x[i2 + 1] & 255; + return u << 8 | x[i2 + 0] & 255; +} +function dl64(x, i2) { + var h = x[i2] << 24 | x[i2 + 1] << 16 | x[i2 + 2] << 8 | x[i2 + 3]; + var l2 = x[i2 + 4] << 24 | x[i2 + 5] << 16 | x[i2 + 6] << 8 | x[i2 + 7]; + return new u64(h, l2); +} +function st32(x, j, u) { + var i2; + for (i2 = 0; i2 < 4; i2++) { + x[j + i2] = u & 255; + u >>>= 8; + } +} +function ts64(x, i2, u) { + x[i2] = u.hi >> 24 & 255; + x[i2 + 1] = u.hi >> 16 & 255; + x[i2 + 2] = u.hi >> 8 & 255; + x[i2 + 3] = u.hi & 255; + x[i2 + 4] = u.lo >> 24 & 255; + x[i2 + 5] = u.lo >> 16 & 255; + x[i2 + 6] = u.lo >> 8 & 255; + x[i2 + 7] = u.lo & 255; +} +function vn(x, xi, y, yi, n2) { + var i2, d = 0; + for (i2 = 0; i2 < n2; i2++) + d |= x[xi + i2] ^ y[yi + i2]; + return (1 & d - 1 >>> 8) - 1; +} +function crypto_verify_16(x, xi, y, yi) { + return vn(x, xi, y, yi, 16); +} +function crypto_verify_32(x, xi, y, yi) { + return vn(x, xi, y, yi, 32); +} +function core(out, inp, k, c, h) { + var w = new Uint32Array(16), x = new Uint32Array(16), y = new Uint32Array(16), t2 = new Uint32Array(4); + var i2, j, m; + for (i2 = 0; i2 < 4; i2++) { + x[5 * i2] = ld32(c, 4 * i2); + x[1 + i2] = ld32(k, 4 * i2); + x[6 + i2] = ld32(inp, 4 * i2); + x[11 + i2] = ld32(k, 16 + 4 * i2); + } + for (i2 = 0; i2 < 16; i2++) + y[i2] = x[i2]; + for (i2 = 0; i2 < 20; i2++) { + for (j = 0; j < 4; j++) { + for (m = 0; m < 4; m++) + t2[m] = x[(5 * j + 4 * m) % 16]; + t2[1] ^= L32(t2[0] + t2[3] | 0, 7); + t2[2] ^= L32(t2[1] + t2[0] | 0, 9); + t2[3] ^= L32(t2[2] + t2[1] | 0, 13); + t2[0] ^= L32(t2[3] + t2[2] | 0, 18); + for (m = 0; m < 4; m++) + w[4 * j + (j + m) % 4] = t2[m]; + } + for (m = 0; m < 16; m++) + x[m] = w[m]; + } + if (h) { + for (i2 = 0; i2 < 16; i2++) + x[i2] = x[i2] + y[i2] | 0; + for (i2 = 0; i2 < 4; i2++) { + x[5 * i2] = x[5 * i2] - ld32(c, 4 * i2) | 0; + x[6 + i2] = x[6 + i2] - ld32(inp, 4 * i2) | 0; + } + for (i2 = 0; i2 < 4; i2++) { + st32(out, 4 * i2, x[5 * i2]); + st32(out, 16 + 4 * i2, x[6 + i2]); + } + } else { + for (i2 = 0; i2 < 16; i2++) + st32(out, 4 * i2, x[i2] + y[i2] | 0); + } +} +function crypto_core_salsa20(out, inp, k, c) { + core(out, inp, k, c, false); + return 0; +} +function crypto_core_hsalsa20(out, inp, k, c) { + core(out, inp, k, c, true); + return 0; +} +var sigma = new Uint8Array([ + 101, + 120, + 112, + 97, + 110, + 100, + 32, + 51, + 50, + 45, + 98, + 121, + 116, + 101, + 32, + 107 +]); +function crypto_stream_salsa20_xor(c, cpos, m, mpos, b, n2, k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i2; + if (!b) + return 0; + for (i2 = 0; i2 < 16; i2++) + z[i2] = 0; + for (i2 = 0; i2 < 8; i2++) + z[i2] = n2[i2]; + while (b >= 64) { + crypto_core_salsa20(x, z, k, sigma); + for (i2 = 0; i2 < 64; i2++) + c[cpos + i2] = (m ? m[mpos + i2] : 0) ^ x[i2]; + u = 1; + for (i2 = 8; i2 < 16; i2++) { + u = u + (z[i2] & 255) | 0; + z[i2] = u & 255; + u >>>= 8; + } + b -= 64; + cpos += 64; + if (m) + mpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x, z, k, sigma); + for (i2 = 0; i2 < b; i2++) + c[cpos + i2] = (m ? m[mpos + i2] : 0) ^ x[i2]; + } + return 0; +} +function crypto_stream_salsa20(c, cpos, d, n2, k) { + return crypto_stream_salsa20_xor(c, cpos, null, 0, d, n2, k); +} +function crypto_stream(c, cpos, d, n2, k) { + var s2 = new Uint8Array(32); + crypto_core_hsalsa20(s2, n2, k, sigma); + return crypto_stream_salsa20(c, cpos, d, n2.subarray(16), s2); +} +function crypto_stream_xor(c, cpos, m, mpos, d, n2, k) { + var s2 = new Uint8Array(32); + crypto_core_hsalsa20(s2, n2, k, sigma); + return crypto_stream_salsa20_xor(c, cpos, m, mpos, d, n2.subarray(16), s2); +} +function add1305(h, c) { + var j, u = 0; + for (j = 0; j < 17; j++) { + u = u + (h[j] + c[j] | 0) | 0; + h[j] = u & 255; + u >>>= 8; + } +} +var minusp = new Uint32Array([ + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 252 +]); +function crypto_onetimeauth(out, outpos, m, mpos, n2, k) { + var s2, i2, j, u; + var x = new Uint32Array(17), r3 = new Uint32Array(17), h = new Uint32Array(17), c = new Uint32Array(17), g = new Uint32Array(17); + for (j = 0; j < 17; j++) + r3[j] = h[j] = 0; + for (j = 0; j < 16; j++) + r3[j] = k[j]; + r3[3] &= 15; + r3[4] &= 252; + r3[7] &= 15; + r3[8] &= 252; + r3[11] &= 15; + r3[12] &= 252; + r3[15] &= 15; + while (n2 > 0) { + for (j = 0; j < 17; j++) + c[j] = 0; + for (j = 0; j < 16 && j < n2; ++j) + c[j] = m[mpos + j]; + c[j] = 1; + mpos += j; + n2 -= j; + add1305(h, c); + for (i2 = 0; i2 < 17; i2++) { + x[i2] = 0; + for (j = 0; j < 17; j++) + x[i2] = x[i2] + h[j] * (j <= i2 ? r3[i2 - j] : 320 * r3[i2 + 17 - j] | 0) | 0 | 0; + } + for (i2 = 0; i2 < 17; i2++) + h[i2] = x[i2]; + u = 0; + for (j = 0; j < 16; j++) { + u = u + h[j] | 0; + h[j] = u & 255; + u >>>= 8; + } + u = u + h[16] | 0; + h[16] = u & 3; + u = 5 * (u >>> 2) | 0; + for (j = 0; j < 16; j++) { + u = u + h[j] | 0; + h[j] = u & 255; + u >>>= 8; + } + u = u + h[16] | 0; + h[16] = u; + } + for (j = 0; j < 17; j++) + g[j] = h[j]; + add1305(h, minusp); + s2 = -(h[16] >>> 7) | 0; + for (j = 0; j < 17; j++) + h[j] ^= s2 & (g[j] ^ h[j]); + for (j = 0; j < 16; j++) + c[j] = k[j + 16]; + c[16] = 0; + add1305(h, c); + for (j = 0; j < 16; j++) + out[outpos + j] = h[j]; + return 0; +} +function crypto_onetimeauth_verify(h, hpos, m, mpos, n2, k) { + var x = new Uint8Array(16); + crypto_onetimeauth(x, 0, m, mpos, n2, k); + return crypto_verify_16(h, hpos, x, 0); +} +function crypto_secretbox(c, m, d, n2, k) { + var i2; + if (d < 32) + return -1; + crypto_stream_xor(c, 0, m, 0, d, n2, k); + crypto_onetimeauth(c, 16, c, 32, d - 32, c); + for (i2 = 0; i2 < 16; i2++) + c[i2] = 0; + return 0; +} +function crypto_secretbox_open(m, c, d, n2, k) { + var i2; + var x = new Uint8Array(32); + if (d < 32) + return -1; + crypto_stream(x, 0, 32, n2, k); + if (crypto_onetimeauth_verify(c, 16, c, 32, d - 32, x) !== 0) + return -1; + crypto_stream_xor(m, 0, c, 0, d, n2, k); + for (i2 = 0; i2 < 32; i2++) + m[i2] = 0; + return 0; +} +function set25519(r3, a2) { + var i2; + for (i2 = 0; i2 < 16; i2++) + r3[i2] = a2[i2] | 0; +} +function car25519(o2) { + var c; + var i2; + for (i2 = 0; i2 < 16; i2++) { + o2[i2] += 65536; + c = Math.floor(o2[i2] / 65536); + o2[(i2 + 1) * (i2 < 15 ? 1 : 0)] += c - 1 + 37 * (c - 1) * (i2 === 15 ? 1 : 0); + o2[i2] -= c * 65536; + } +} +function sel25519(p, q, b) { + var t2, c = ~(b - 1); + for (var i2 = 0; i2 < 16; i2++) { + t2 = c & (p[i2] ^ q[i2]); + p[i2] ^= t2; + q[i2] ^= t2; + } +} +function pack25519(o2, n2) { + var i2, j, b; + var m = gf(), t2 = gf(); + for (i2 = 0; i2 < 16; i2++) + t2[i2] = n2[i2]; + car25519(t2); + car25519(t2); + car25519(t2); + for (j = 0; j < 2; j++) { + m[0] = t2[0] - 65517; + for (i2 = 1; i2 < 15; i2++) { + m[i2] = t2[i2] - 65535 - (m[i2 - 1] >> 16 & 1); + m[i2 - 1] &= 65535; + } + m[15] = t2[15] - 32767 - (m[14] >> 16 & 1); + b = m[15] >> 16 & 1; + m[14] &= 65535; + sel25519(t2, m, 1 - b); + } + for (i2 = 0; i2 < 16; i2++) { + o2[2 * i2] = t2[i2] & 255; + o2[2 * i2 + 1] = t2[i2] >> 8; + } +} +function neq25519(a2, b) { + var c = new Uint8Array(32), d = new Uint8Array(32); + pack25519(c, a2); + pack25519(d, b); + return crypto_verify_32(c, 0, d, 0); +} +function par25519(a2) { + var d = new Uint8Array(32); + pack25519(d, a2); + return d[0] & 1; +} +function unpack25519(o2, n2) { + var i2; + for (i2 = 0; i2 < 16; i2++) + o2[i2] = n2[2 * i2] + (n2[2 * i2 + 1] << 8); + o2[15] &= 32767; +} +function A(o2, a2, b) { + var i2; + for (i2 = 0; i2 < 16; i2++) + o2[i2] = a2[i2] + b[i2] | 0; +} +function Z(o2, a2, b) { + var i2; + for (i2 = 0; i2 < 16; i2++) + o2[i2] = a2[i2] - b[i2] | 0; +} +function M(o2, a2, b) { + var i2, j, t2 = new Float64Array(31); + for (i2 = 0; i2 < 31; i2++) + t2[i2] = 0; + for (i2 = 0; i2 < 16; i2++) { + for (j = 0; j < 16; j++) { + t2[i2 + j] += a2[i2] * b[j]; + } + } + for (i2 = 0; i2 < 15; i2++) { + t2[i2] += 38 * t2[i2 + 16]; + } + for (i2 = 0; i2 < 16; i2++) + o2[i2] = t2[i2]; + car25519(o2); + car25519(o2); +} +function S(o2, a2) { + M(o2, a2, a2); +} +function inv25519(o2, i2) { + var c = gf(); + var a2; + for (a2 = 0; a2 < 16; a2++) + c[a2] = i2[a2]; + for (a2 = 253; a2 >= 0; a2--) { + S(c, c); + if (a2 !== 2 && a2 !== 4) + M(c, c, i2); + } + for (a2 = 0; a2 < 16; a2++) + o2[a2] = c[a2]; +} +function pow2523(o2, i2) { + var c = gf(); + var a2; + for (a2 = 0; a2 < 16; a2++) + c[a2] = i2[a2]; + for (a2 = 250; a2 >= 0; a2--) { + S(c, c); + if (a2 !== 1) + M(c, c, i2); + } + for (a2 = 0; a2 < 16; a2++) + o2[a2] = c[a2]; +} +function crypto_scalarmult(q, n2, p) { + var z = new Uint8Array(32); + var x = new Float64Array(80), r3, i2; + var a2 = gf(), b = gf(), c = gf(), d = gf(), e2 = gf(), f = gf(); + for (i2 = 0; i2 < 31; i2++) + z[i2] = n2[i2]; + z[31] = n2[31] & 127 | 64; + z[0] &= 248; + unpack25519(x, p); + for (i2 = 0; i2 < 16; i2++) { + b[i2] = x[i2]; + d[i2] = a2[i2] = c[i2] = 0; + } + a2[0] = d[0] = 1; + for (i2 = 254; i2 >= 0; --i2) { + r3 = z[i2 >>> 3] >>> (i2 & 7) & 1; + sel25519(a2, b, r3); + sel25519(c, d, r3); + A(e2, a2, c); + Z(a2, a2, c); + A(c, b, d); + Z(b, b, d); + S(d, e2); + S(f, a2); + M(a2, c, a2); + M(c, b, e2); + A(e2, a2, c); + Z(a2, a2, c); + S(b, a2); + Z(c, d, f); + M(a2, c, _121665); + A(a2, a2, d); + M(c, c, a2); + M(a2, d, f); + M(d, b, x); + S(b, e2); + sel25519(a2, b, r3); + sel25519(c, d, r3); + } + for (i2 = 0; i2 < 16; i2++) { + x[i2 + 16] = a2[i2]; + x[i2 + 32] = c[i2]; + x[i2 + 48] = b[i2]; + x[i2 + 64] = d[i2]; + } + var x32 = x.subarray(32); + var x16 = x.subarray(16); + inv25519(x32, x32); + M(x16, x16, x32); + pack25519(q, x16); + return 0; +} +function crypto_scalarmult_base(q, n2) { + return crypto_scalarmult(q, n2, _9); +} +function crypto_box_keypair(y, x) { + randombytes(x, 32); + return crypto_scalarmult_base(y, x); +} +function crypto_box_beforenm(k, y, x) { + var s2 = new Uint8Array(32); + crypto_scalarmult(s2, x, y); + return crypto_core_hsalsa20(k, _0, s2, sigma); +} +var crypto_box_afternm = crypto_secretbox; +var crypto_box_open_afternm = crypto_secretbox_open; +function crypto_box(c, m, d, n2, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_afternm(c, m, d, n2, k); +} +function crypto_box_open(m, c, d, n2, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_open_afternm(m, c, d, n2, k); +} +function add64() { + var a2 = 0, b = 0, c = 0, d = 0, m16 = 65535, l2, h, i2; + for (i2 = 0; i2 < arguments.length; i2++) { + l2 = arguments[i2].lo; + h = arguments[i2].hi; + a2 += l2 & m16; + b += l2 >>> 16; + c += h & m16; + d += h >>> 16; + } + b += a2 >>> 16; + c += b >>> 16; + d += c >>> 16; + return new u64(c & m16 | d << 16, a2 & m16 | b << 16); +} +function shr64(x, c) { + return new u64(x.hi >>> c, x.lo >>> c | x.hi << 32 - c); +} +function xor64() { + var l2 = 0, h = 0, i2; + for (i2 = 0; i2 < arguments.length; i2++) { + l2 ^= arguments[i2].lo; + h ^= arguments[i2].hi; + } + return new u64(h, l2); +} +function R(x, c) { + var h, l2, c1 = 32 - c; + if (c < 32) { + h = x.hi >>> c | x.lo << c1; + l2 = x.lo >>> c | x.hi << c1; + } else if (c < 64) { + h = x.lo >>> c | x.hi << c1; + l2 = x.hi >>> c | x.lo << c1; + } + return new u64(h, l2); +} +function Ch(x, y, z) { + var h = x.hi & y.hi ^ ~x.hi & z.hi, l2 = x.lo & y.lo ^ ~x.lo & z.lo; + return new u64(h, l2); +} +function Maj(x, y, z) { + var h = x.hi & y.hi ^ x.hi & z.hi ^ y.hi & z.hi, l2 = x.lo & y.lo ^ x.lo & z.lo ^ y.lo & z.lo; + return new u64(h, l2); +} +function Sigma0(x) { + return xor64(R(x, 28), R(x, 34), R(x, 39)); +} +function Sigma1(x) { + return xor64(R(x, 14), R(x, 18), R(x, 41)); +} +function sigma0(x) { + return xor64(R(x, 1), R(x, 8), shr64(x, 7)); +} +function sigma1(x) { + return xor64(R(x, 19), R(x, 61), shr64(x, 6)); +} +var K = [ + new u64(1116352408, 3609767458), + new u64(1899447441, 602891725), + new u64(3049323471, 3964484399), + new u64(3921009573, 2173295548), + new u64(961987163, 4081628472), + new u64(1508970993, 3053834265), + new u64(2453635748, 2937671579), + new u64(2870763221, 3664609560), + new u64(3624381080, 2734883394), + new u64(310598401, 1164996542), + new u64(607225278, 1323610764), + new u64(1426881987, 3590304994), + new u64(1925078388, 4068182383), + new u64(2162078206, 991336113), + new u64(2614888103, 633803317), + new u64(3248222580, 3479774868), + new u64(3835390401, 2666613458), + new u64(4022224774, 944711139), + new u64(264347078, 2341262773), + new u64(604807628, 2007800933), + new u64(770255983, 1495990901), + new u64(1249150122, 1856431235), + new u64(1555081692, 3175218132), + new u64(1996064986, 2198950837), + new u64(2554220882, 3999719339), + new u64(2821834349, 766784016), + new u64(2952996808, 2566594879), + new u64(3210313671, 3203337956), + new u64(3336571891, 1034457026), + new u64(3584528711, 2466948901), + new u64(113926993, 3758326383), + new u64(338241895, 168717936), + new u64(666307205, 1188179964), + new u64(773529912, 1546045734), + new u64(1294757372, 1522805485), + new u64(1396182291, 2643833823), + new u64(1695183700, 2343527390), + new u64(1986661051, 1014477480), + new u64(2177026350, 1206759142), + new u64(2456956037, 344077627), + new u64(2730485921, 1290863460), + new u64(2820302411, 3158454273), + new u64(3259730800, 3505952657), + new u64(3345764771, 106217008), + new u64(3516065817, 3606008344), + new u64(3600352804, 1432725776), + new u64(4094571909, 1467031594), + new u64(275423344, 851169720), + new u64(430227734, 3100823752), + new u64(506948616, 1363258195), + new u64(659060556, 3750685593), + new u64(883997877, 3785050280), + new u64(958139571, 3318307427), + new u64(1322822218, 3812723403), + new u64(1537002063, 2003034995), + new u64(1747873779, 3602036899), + new u64(1955562222, 1575990012), + new u64(2024104815, 1125592928), + new u64(2227730452, 2716904306), + new u64(2361852424, 442776044), + new u64(2428436474, 593698344), + new u64(2756734187, 3733110249), + new u64(3204031479, 2999351573), + new u64(3329325298, 3815920427), + new u64(3391569614, 3928383900), + new u64(3515267271, 566280711), + new u64(3940187606, 3454069534), + new u64(4118630271, 4000239992), + new u64(116418474, 1914138554), + new u64(174292421, 2731055270), + new u64(289380356, 3203993006), + new u64(460393269, 320620315), + new u64(685471733, 587496836), + new u64(852142971, 1086792851), + new u64(1017036298, 365543100), + new u64(1126000580, 2618297676), + new u64(1288033470, 3409855158), + new u64(1501505948, 4234509866), + new u64(1607167915, 987167468), + new u64(1816402316, 1246189591) +]; +function crypto_hashblocks(x, m, n2) { + var z = [], b = [], a2 = [], w = [], t2, i2, j; + for (i2 = 0; i2 < 8; i2++) + z[i2] = a2[i2] = dl64(x, 8 * i2); + var pos = 0; + while (n2 >= 128) { + for (i2 = 0; i2 < 16; i2++) + w[i2] = dl64(m, 8 * i2 + pos); + for (i2 = 0; i2 < 80; i2++) { + for (j = 0; j < 8; j++) + b[j] = a2[j]; + t2 = add64(a2[7], Sigma1(a2[4]), Ch(a2[4], a2[5], a2[6]), K[i2], w[i2 % 16]); + b[7] = add64(t2, Sigma0(a2[0]), Maj(a2[0], a2[1], a2[2])); + b[3] = add64(b[3], t2); + for (j = 0; j < 8; j++) + a2[(j + 1) % 8] = b[j]; + if (i2 % 16 === 15) { + for (j = 0; j < 16; j++) { + w[j] = add64( + w[j], + w[(j + 9) % 16], + sigma0(w[(j + 1) % 16]), + sigma1(w[(j + 14) % 16]) + ); + } + } + } + for (i2 = 0; i2 < 8; i2++) { + a2[i2] = add64(a2[i2], z[i2]); + z[i2] = a2[i2]; + } + pos += 128; + n2 -= 128; + } + for (i2 = 0; i2 < 8; i2++) + ts64(x, 8 * i2, z[i2]); + return n2; +} +var iv = new Uint8Array([ + 106, + 9, + 230, + 103, + 243, + 188, + 201, + 8, + 187, + 103, + 174, + 133, + 132, + 202, + 167, + 59, + 60, + 110, + 243, + 114, + 254, + 148, + 248, + 43, + 165, + 79, + 245, + 58, + 95, + 29, + 54, + 241, + 81, + 14, + 82, + 127, + 173, + 230, + 130, + 209, + 155, + 5, + 104, + 140, + 43, + 62, + 108, + 31, + 31, + 131, + 217, + 171, + 251, + 65, + 189, + 107, + 91, + 224, + 205, + 25, + 19, + 126, + 33, + 121 +]); +function crypto_hash(out, m, n2) { + var h = new Uint8Array(64), x = new Uint8Array(256); + var i2, b = n2; + for (i2 = 0; i2 < 64; i2++) + h[i2] = iv[i2]; + crypto_hashblocks(h, m, n2); + n2 %= 128; + for (i2 = 0; i2 < 256; i2++) + x[i2] = 0; + for (i2 = 0; i2 < n2; i2++) + x[i2] = m[b - n2 + i2]; + x[n2] = 128; + n2 = 256 - 128 * (n2 < 112 ? 1 : 0); + x[n2 - 9] = 0; + ts64(x, n2 - 8, new u64(b / 536870912 | 0, b << 3)); + crypto_hashblocks(h, x, n2); + for (i2 = 0; i2 < 64; i2++) + out[i2] = h[i2]; + return 0; +} +function add4(p, q) { + var a2 = gf(), b = gf(), c = gf(), d = gf(), e2 = gf(), f = gf(), g = gf(), h = gf(), t2 = gf(); + Z(a2, p[1], p[0]); + Z(t2, q[1], q[0]); + M(a2, a2, t2); + A(b, p[0], p[1]); + A(t2, q[0], q[1]); + M(b, b, t2); + M(c, p[3], q[3]); + M(c, c, D2); + M(d, p[2], q[2]); + A(d, d, d); + Z(e2, b, a2); + Z(f, d, c); + A(g, d, c); + A(h, b, a2); + M(p[0], e2, f); + M(p[1], h, g); + M(p[2], g, f); + M(p[3], e2, h); +} +function cswap(p, q, b) { + var i2; + for (i2 = 0; i2 < 4; i2++) { + sel25519(p[i2], q[i2], b); + } +} +function pack3(r3, p) { + var tx = gf(), ty = gf(), zi = gf(); + inv25519(zi, p[2]); + M(tx, p[0], zi); + M(ty, p[1], zi); + pack25519(r3, ty); + r3[31] ^= par25519(tx) << 7; +} +function scalarmult(p, q, s2) { + var b, i2; + set25519(p[0], gf0); + set25519(p[1], gf1); + set25519(p[2], gf1); + set25519(p[3], gf0); + for (i2 = 255; i2 >= 0; --i2) { + b = s2[i2 / 8 | 0] >> (i2 & 7) & 1; + cswap(p, q, b); + add4(q, p); + add4(p, p); + cswap(p, q, b); + } +} +function scalarbase(p, s2) { + var q = [gf(), gf(), gf(), gf()]; + set25519(q[0], X); + set25519(q[1], Y); + set25519(q[2], gf1); + M(q[3], X, Y); + scalarmult(p, q, s2); +} +function crypto_sign_keypair(pk, sk, seeded) { + var d = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()]; + var i2; + if (!seeded) + randombytes(sk, 32); + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + scalarbase(p, d); + pack3(pk, p); + for (i2 = 0; i2 < 32; i2++) + sk[i2 + 32] = pk[i2]; + return 0; +} +var L = new Float64Array([ + 237, + 211, + 245, + 92, + 26, + 99, + 18, + 88, + 214, + 156, + 247, + 162, + 222, + 249, + 222, + 20, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 16 +]); +function modL(r3, x) { + var carry, i2, j, k; + for (i2 = 63; i2 >= 32; --i2) { + carry = 0; + for (j = i2 - 32, k = i2 - 12; j < k; ++j) { + x[j] += carry - 16 * x[i2] * L[j - (i2 - 32)]; + carry = Math.floor((x[j] + 128) / 256); + x[j] -= carry * 256; + } + x[j] += carry; + x[i2] = 0; + } + carry = 0; + for (j = 0; j < 32; j++) { + x[j] += carry - (x[31] >> 4) * L[j]; + carry = x[j] >> 8; + x[j] &= 255; + } + for (j = 0; j < 32; j++) + x[j] -= carry * L[j]; + for (i2 = 0; i2 < 32; i2++) { + x[i2 + 1] += x[i2] >> 8; + r3[i2] = x[i2] & 255; + } +} +function reduce(r3) { + var x = new Float64Array(64), i2; + for (i2 = 0; i2 < 64; i2++) + x[i2] = r3[i2]; + for (i2 = 0; i2 < 64; i2++) + r3[i2] = 0; + modL(r3, x); +} +function crypto_sign(sm, m, n2, sk) { + var d = new Uint8Array(64), h = new Uint8Array(64), r3 = new Uint8Array(64); + var i2, j, x = new Float64Array(64); + var p = [gf(), gf(), gf(), gf()]; + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + var smlen = n2 + 64; + for (i2 = 0; i2 < n2; i2++) + sm[64 + i2] = m[i2]; + for (i2 = 0; i2 < 32; i2++) + sm[32 + i2] = d[32 + i2]; + crypto_hash(r3, sm.subarray(32), n2 + 32); + reduce(r3); + scalarbase(p, r3); + pack3(sm, p); + for (i2 = 32; i2 < 64; i2++) + sm[i2] = sk[i2]; + crypto_hash(h, sm, n2 + 64); + reduce(h); + for (i2 = 0; i2 < 64; i2++) + x[i2] = 0; + for (i2 = 0; i2 < 32; i2++) + x[i2] = r3[i2]; + for (i2 = 0; i2 < 32; i2++) { + for (j = 0; j < 32; j++) { + x[i2 + j] += h[i2] * d[j]; + } + } + modL(sm.subarray(32), x); + return smlen; +} +function unpackneg(r3, p) { + var t2 = gf(), chk = gf(), num = gf(), den = gf(), den2 = gf(), den4 = gf(), den6 = gf(); + set25519(r3[2], gf1); + unpack25519(r3[1], p); + S(num, r3[1]); + M(den, num, D); + Z(num, num, r3[2]); + A(den, r3[2], den); + S(den2, den); + S(den4, den2); + M(den6, den4, den2); + M(t2, den6, num); + M(t2, t2, den); + pow2523(t2, t2); + M(t2, t2, num); + M(t2, t2, den); + M(t2, t2, den); + M(r3[0], t2, den); + S(chk, r3[0]); + M(chk, chk, den); + if (neq25519(chk, num)) + M(r3[0], r3[0], I); + S(chk, r3[0]); + M(chk, chk, den); + if (neq25519(chk, num)) + return -1; + if (par25519(r3[0]) === p[31] >> 7) + Z(r3[0], gf0, r3[0]); + M(r3[3], r3[0], r3[1]); + return 0; +} +function crypto_sign_open(m, sm, n2, pk) { + var i2; + var t2 = new Uint8Array(32), h = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()], q = [gf(), gf(), gf(), gf()]; + if (n2 < 64) + return -1; + if (unpackneg(q, pk)) + return -1; + for (i2 = 0; i2 < n2; i2++) + m[i2] = sm[i2]; + for (i2 = 0; i2 < 32; i2++) + m[i2 + 32] = pk[i2]; + crypto_hash(h, m, n2); + reduce(h); + scalarmult(p, q, h); + scalarbase(q, sm.subarray(32)); + add4(p, q); + pack3(t2, p); + n2 -= 64; + if (crypto_verify_32(sm, 0, t2, 0)) { + for (i2 = 0; i2 < n2; i2++) + m[i2] = 0; + return -1; + } + for (i2 = 0; i2 < n2; i2++) + m[i2] = sm[i2 + 64]; + return n2; +} +var crypto_secretbox_KEYBYTES = 32; +var crypto_secretbox_NONCEBYTES = 24; +var crypto_secretbox_ZEROBYTES = 32; +var crypto_secretbox_BOXZEROBYTES = 16; +var crypto_scalarmult_BYTES = 32; +var crypto_scalarmult_SCALARBYTES = 32; +var crypto_box_PUBLICKEYBYTES = 32; +var crypto_box_SECRETKEYBYTES = 32; +var crypto_box_BEFORENMBYTES = 32; +var crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES; +var crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES; +var crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES; +var crypto_sign_BYTES = 64; +var crypto_sign_PUBLICKEYBYTES = 32; +var crypto_sign_SECRETKEYBYTES = 64; +var crypto_sign_SEEDBYTES = 32; +var crypto_hash_BYTES = 64; +var _nacl = { + lowlevel: {} +}; +_nacl.lowlevel = { + crypto_core_hsalsa20, + crypto_stream_xor, + crypto_stream, + crypto_stream_salsa20_xor, + crypto_stream_salsa20, + crypto_onetimeauth, + crypto_onetimeauth_verify, + crypto_verify_16, + crypto_verify_32, + crypto_secretbox, + crypto_secretbox_open, + crypto_scalarmult, + crypto_scalarmult_base, + crypto_box_beforenm, + crypto_box_afternm, + crypto_box, + crypto_box_open, + crypto_box_keypair, + crypto_hash, + crypto_sign, + crypto_sign_keypair, + crypto_sign_open, + crypto_secretbox_KEYBYTES, + crypto_secretbox_NONCEBYTES, + crypto_secretbox_ZEROBYTES, + crypto_secretbox_BOXZEROBYTES, + crypto_scalarmult_BYTES, + crypto_scalarmult_SCALARBYTES, + crypto_box_PUBLICKEYBYTES, + crypto_box_SECRETKEYBYTES, + crypto_box_BEFORENMBYTES, + crypto_box_NONCEBYTES, + crypto_box_ZEROBYTES, + crypto_box_BOXZEROBYTES, + crypto_sign_BYTES, + crypto_sign_PUBLICKEYBYTES, + crypto_sign_SECRETKEYBYTES, + crypto_sign_SEEDBYTES, + crypto_hash_BYTES, + gf, + D, + L, + pack25519, + unpack25519, + M, + A, + S, + Z, + pow2523, + add: add4, + set25519, + modL, + scalarmult, + scalarbase +}; +function checkLengths(k, n2) { + if (k.length !== crypto_secretbox_KEYBYTES) + throw new Error("bad key size"); + if (n2.length !== crypto_secretbox_NONCEBYTES) + throw new Error("bad nonce size"); +} +function checkBoxLengths(pk, sk) { + if (pk.length !== crypto_box_PUBLICKEYBYTES) + throw new Error("bad public key size"); + if (sk.length !== crypto_box_SECRETKEYBYTES) + throw new Error("bad secret key size"); +} +function checkArrayTypes() { + for (var i2 = 0; i2 < arguments.length; i2++) { + if (!(arguments[i2] instanceof Uint8Array)) + throw new TypeError("unexpected type, use Uint8Array"); + } +} +function cleanup(arr) { + for (var i2 = 0; i2 < arr.length; i2++) + arr[i2] = 0; +} +_nacl.randomBytes = function(n2) { + var b = new Uint8Array(n2); + randombytes(b, n2); + return b; +}; +_nacl.secretbox = function(msg, nonce, key2) { + checkArrayTypes(msg, nonce, key2); + checkLengths(key2, nonce); + var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); + var c = new Uint8Array(m.length); + for (var i2 = 0; i2 < msg.length; i2++) + m[i2 + crypto_secretbox_ZEROBYTES] = msg[i2]; + crypto_secretbox(c, m, m.length, nonce, key2); + return c.subarray(crypto_secretbox_BOXZEROBYTES); +}; +_nacl.secretbox.open = function(box2, nonce, key2) { + checkArrayTypes(box2, nonce, key2); + checkLengths(key2, nonce); + var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box2.length); + var m = new Uint8Array(c.length); + for (var i2 = 0; i2 < box2.length; i2++) + c[i2 + crypto_secretbox_BOXZEROBYTES] = box2[i2]; + if (c.length < 32) + return null; + if (crypto_secretbox_open(m, c, c.length, nonce, key2) !== 0) + return null; + return m.subarray(crypto_secretbox_ZEROBYTES); +}; +_nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; +_nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; +_nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; +_nacl.scalarMult = function(n2, p) { + checkArrayTypes(n2, p); + if (n2.length !== crypto_scalarmult_SCALARBYTES) + throw new Error("bad n size"); + if (p.length !== crypto_scalarmult_BYTES) + throw new Error("bad p size"); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult(q, n2, p); + return q; +}; +_nacl.scalarMult.base = function(n2) { + checkArrayTypes(n2); + if (n2.length !== crypto_scalarmult_SCALARBYTES) + throw new Error("bad n size"); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult_base(q, n2); + return q; +}; +_nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; +_nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; +_nacl.box = function(msg, nonce, publicKey, secretKey) { + var k = _nacl.box.before(publicKey, secretKey); + return _nacl.secretbox(msg, nonce, k); +}; +_nacl.box.before = function(publicKey, secretKey) { + checkArrayTypes(publicKey, secretKey); + checkBoxLengths(publicKey, secretKey); + var k = new Uint8Array(crypto_box_BEFORENMBYTES); + crypto_box_beforenm(k, publicKey, secretKey); + return k; +}; +_nacl.box.after = _nacl.secretbox; +_nacl.box.open = function(msg, nonce, publicKey, secretKey) { + var k = _nacl.box.before(publicKey, secretKey); + return _nacl.secretbox.open(msg, nonce, k); +}; +_nacl.box.open.after = _nacl.secretbox.open; +_nacl.box.keyPair = function() { + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); + crypto_box_keypair(pk, sk); + return { publicKey: pk, secretKey: sk }; +}; +_nacl.box.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_box_SECRETKEYBYTES) + throw new Error("bad secret key size"); + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + crypto_scalarmult_base(pk, secretKey); + return { publicKey: pk, secretKey: new Uint8Array(secretKey) }; +}; +_nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; +_nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; +_nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; +_nacl.box.nonceLength = crypto_box_NONCEBYTES; +_nacl.box.overheadLength = _nacl.secretbox.overheadLength; +_nacl.sign = function(msg, secretKey) { + checkArrayTypes(msg, secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error("bad secret key size"); + var signedMsg = new Uint8Array(crypto_sign_BYTES + msg.length); + crypto_sign(signedMsg, msg, msg.length, secretKey); + return signedMsg; +}; +_nacl.sign.open = function(signedMsg, publicKey) { + checkArrayTypes(signedMsg, publicKey); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error("bad public key size"); + var tmp = new Uint8Array(signedMsg.length); + var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); + if (mlen < 0) + return null; + var m = new Uint8Array(mlen); + for (var i2 = 0; i2 < m.length; i2++) + m[i2] = tmp[i2]; + return m; +}; +_nacl.sign.detached = function(msg, secretKey) { + var signedMsg = _nacl.sign(msg, secretKey); + var sig = new Uint8Array(crypto_sign_BYTES); + for (var i2 = 0; i2 < sig.length; i2++) + sig[i2] = signedMsg[i2]; + return sig; +}; +_nacl.sign.detached.verify = function(msg, sig, publicKey) { + checkArrayTypes(msg, sig, publicKey); + if (sig.length !== crypto_sign_BYTES) + throw new Error("bad signature size"); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error("bad public key size"); + var sm = new Uint8Array(crypto_sign_BYTES + msg.length); + var m = new Uint8Array(crypto_sign_BYTES + msg.length); + var i2; + for (i2 = 0; i2 < crypto_sign_BYTES; i2++) + sm[i2] = sig[i2]; + for (i2 = 0; i2 < msg.length; i2++) + sm[i2 + crypto_sign_BYTES] = msg[i2]; + return crypto_sign_open(m, sm, sm.length, publicKey) >= 0; +}; +_nacl.sign.keyPair = function() { + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + crypto_sign_keypair(pk, sk); + return { publicKey: pk, secretKey: sk }; +}; +_nacl.sign.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error("bad secret key size"); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + for (var i2 = 0; i2 < pk.length; i2++) + pk[i2] = secretKey[32 + i2]; + return { publicKey: pk, secretKey: new Uint8Array(secretKey) }; +}; +_nacl.sign.keyPair.fromSeed = function(seed) { + checkArrayTypes(seed); + if (seed.length !== crypto_sign_SEEDBYTES) + throw new Error("bad seed size"); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + for (var i2 = 0; i2 < 32; i2++) + sk[i2] = seed[i2]; + crypto_sign_keypair(pk, sk, true); + return { publicKey: pk, secretKey: sk }; +}; +_nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; +_nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; +_nacl.sign.seedLength = crypto_sign_SEEDBYTES; +_nacl.sign.signatureLength = crypto_sign_BYTES; +_nacl.hash = function(msg) { + checkArrayTypes(msg); + var h = new Uint8Array(crypto_hash_BYTES); + crypto_hash(h, msg, msg.length); + return h; +}; +_nacl.hash.hashLength = crypto_hash_BYTES; +_nacl.verify = function(x, y) { + checkArrayTypes(x, y); + if (x.length === 0 || y.length === 0) + return false; + if (x.length !== y.length) + return false; + return vn(x, 0, y, 0, x.length) === 0 ? true : false; +}; +_nacl.setPRNG = function(fn) { + randombytes = fn; +}; +(function() { + var crypto3 = typeof self !== "undefined" ? self.crypto || self.msCrypto : null; + if (crypto3 && crypto3.getRandomValues) { + var QUOTA = 65536; + _nacl.setPRNG(function(x, n2) { + var i2, v = new Uint8Array(n2); + for (i2 = 0; i2 < n2; i2 += QUOTA) { + crypto3.getRandomValues(v.subarray(i2, i2 + Math.min(n2 - i2, QUOTA))); + } + for (i2 = 0; i2 < n2; i2++) + x[i2] = v[i2]; + cleanup(v); + }); + } else if (typeof __require !== "undefined") { + crypto3 = __require("crypto"); + if (crypto3 && crypto3.randomBytes) { + _nacl.setPRNG(function(x, n2) { + var i2, v = crypto3.randomBytes(n2); + for (i2 = 0; i2 < n2; i2++) + x[i2] = v[i2]; + cleanup(v); + }); + } + } +})(); +var nacl2 = _nacl.default || _nacl; + +// packages/wasm/src/index.ts +init_shim(); + +// packages/wasm/src/pkg/wasm-internal.js +init_shim(); +import * as pako from "pako"; +var moduleBuffer = ""; +moduleBuffer += "eJzsvQmAXkWVL/7tS/fX3V/va5LbtztJJ+lOel9Ctu4khABhC6hgMHQn3UgDiSZxe69pgqAGFcyMqLiMgqLgNsO4DS5PEZdhXGZw"; +moduleBuffer += "+48LjLgz4xbF8e+C+OrUOXWqblV1p1kM8yRB+95b9373Vp3z+53azqmKjR+8Mh6LxeL3Jzddkrj66tglyavhrziNX31JHP9gojhN"; +moduleBuffer += "XS1vpq/GYwySL4nvj8s/+y+Jif9nrlY31fPimLh6v/qVuIqJl8sP7BfvnYWP7d8v/0DCfplObxEPZ69WL1Rn8r2z8LvUfvG0zIM4"; +moduleBuffer += "278fXhuTn5Qvk5mauSQ+I96X2H81vlx8KLlffimOKfshqzH8ILwzjx+ZnZ0VT87Kr2XgCq6xOLMgDXFVerX+J56SxZsVdzHvsyBD"; +moduleBuffer += "+Rv50xxklbMrPrIffwh5zuA9eUdcYwlkiWRSUv0qySlXXz0j5TkLcknhQVzO4OUMXV6Fl3BIvKdiOPmiiUtrdu9+0cRl+/ZeOrlv"; +moduleBuffer += "9+SBA/sP7N43+aJYFdyqNW4dPHTgsn2X7r508lCswv7ZZQfpdizvubV/YnpyzyG81Wjcmj74wvErdl+xf//Byd2Tz48thvt1xv2J"; +moduleBuffer += "/fuvmBzfJz+Zt7Oz7wVXTkwe8Gdn/CDdji2BW4vg1qW7d2IBJkb6e3qnhodGRqbGxyf6JvHnnleDFII5pMASir57eHi4p3vv1ORE"; +moduleBuffer += "f3dvz0h3L76bntlz4CXPO7R/d8/enqne3uHe/vHB8e7h7j2xEnhmMT7zvAP790wePLi7f3yod7h/aM+ege6+kZGBCXxoCT70wskD"; +moduleBuffer += "By/bv+/g7qnB4cGBwYHJgeHBvXtH+gbwqWZ8at/+vZO7e7r7x3unpob3Dk6Od/eN90Y+dmDy+S+47MDk7j17xke6J3rGR/rHu3sH"; +moduleBuffer += "xMdKjY9deXAz5ntyontgcrB3YqCve7xnoHsYX7WUXjW+b+/+K0+97Iordr5k357dA3tG9owMDIyPDwxODHb3j8Rq4Nll+KxQ2Xny"; +moduleBuffer += "8WeMX/GCyYO7++Cx8fHByb2Te4aH+vfgwyS0Kyb3XXroubunenuGJiYmpoYmhyf79071Ix6aqKSTL9rd3dc/NdLTNzk02Dc4OTI8"; +moduleBuffer += "hGUI+IF9+8cPXHpwd4/4SP/EVO/kxMT4+FR/HypRSWzyxYd29/RN9A8N7R3vmRwf7xseGcJi1kURPfWCfXsOCRVgNlpILVCc3b3j"; +moduleBuffer += "E8PjPSPDe4b7+vf0Do5HNHfZockD44cEwwZHBvYOjoyM9/fvHewVD2J2KR8HJ6+Y2j0hiiP+3793ZLK7v3u4H58gqbxIZGX/i3YP"; +moduleBuffer += "9Aq1T3UP7e3um9o7MDWMz7SSmK/YPzF+xfnPFdntHtjT0zsyMdU3NLVnqmdiMvIufG533+Qeke2Jie6RyZE9/ep79dFyv2Df3smp"; +moduleBuffer += "y/ZN7o3IXyh090B/z8ieqcGJkYH+8fGenr2xVuOBg+KB/t6ByaHuqaE9g/3je0YGe2OhUeKpA/uv3D3SMz44ND4w1d2/Z2R4fKA/"; +moduleBuffer += "gtXLDo4eODD+kt2DU6Cfqe6R8b0Tgz0TA5iRLnpo38FD4/v2TO6f2i2fHnvB1JQg8lD/SP/AwFD3hKBc7+SeIfwNfXrP+BVX7B4f"; +moduleBuffer += "mZzqHxwc6u2ZFMSc6o3V2k/0TUyN9/YPDwh8DfT2D/XE2mzgTHQPTvb0DOztmejumezpnoiQce/+fZO7R4b7JgampvaMC5zvGRju"; +moduleBuffer += "w3y0qwLuHJ+a3L7v0OSlIssTI3unpkSWp7oFLXu6u/FRksXkPmFtBHH2dPcK2O+d7Osb2ts3OUnkJrVOYNkFtyf3DgjJ9g3sHR7v"; +moduleBuffer += "3YvP9DAvXnTZoedOvOSQENmU0JKgJRFuaLJvcmJoeKi3e3h8aqivO1ZnEW5qUqC7p2dyYqRnuHtqhGxPp6OICy7bd2gYdbdXQHWw"; +moduleBuffer += "p1/YpJ7+yam+wUj5KS/q84P9g73jg4ODgMr+galYu8Gigy+YGJcvHBkaGO8enBrZO7G3R7BpADMZtRwjvQP9e/on9vZNjEz19u2J"; +moduleBuffer += "Wg4ApiiHYMVwz8SegSFBo5HYUgvak1PDvcODwlIP9u8d7+0hcJjM2Ds58YJLVQ0oTX7RuHvouQf2vygWg+RKI/nKySv3H3iJYWsV"; +moduleBuffer += "zfZdJr75YmEp9h2YnNp9aHziisnYsuSv8r/Mx2NxaJfF4smkOIsnC4VYQZ6I5EQc7sH/Mpl4FlLj2Xginc0kYvJn8fjydL24G2+I"; +moduleBuffer += "pVPiHZlYQv5Lw61MojotnknH0vF0IgvfyKRj1fFMWawjxv/EN8Rf8Z1MQyzWKM4L4v/xYiKeWBGLi79p+QTkYmVc/svEZDbj8UQC"; +moduleBuffer += "MpiAzCXkI4W4vLEqJj6YycIH4/EU/DITj4lreTMTp3+dkMFYKh6DJ+LwTfy1fHMWr0R6EbIoCp+IJ0VWxL9sMt4lpBET0kjCM8lG"; +moduleBuffer += "kVidkGVJyl/HpHBAYvofiCUpBZmREhUFi62Wr46noPDii7F4WhQpBUUpX5MQkoxnujPwC5GQEBkQD/TALzPZlPh8Rj6RFW9OphMJ"; +moduleBuffer += "Lc6klGlK/BcDAWQTqNSsEAcISBZf5DubyWaSCfikLFQyk87I8sZiTU0pWTwpNylawAUkybyI7MYykK0Uak+KP5mA21KRyZT4chIe"; +moduleBuffer += "zsL9lFJyDISQgqJI4UB6PJuWcsmkkkKLoEz4ThqS4ohI8cpsPFmelr+CK/EvK0QkSpONpcWvYplCBn6biKdS4stCkqm4/EY8BSpM"; +moduleBuffer += "JvDDotSxMhB2Qr5D5FL8NgElgfNYsTcF+ZaKjqf6EI7loIt++RR+WwgRdCNfn5DyiCWbmwcGhSTjWMyUxGZiaDiOrAF5xpMgrJYW"; +moduleBuffer += "IEQakpMkEiHcbEx8NFUQWU1J6Un5g3ak+OPpTErKXSajJJMgkfqRRKVkZjJRnl27rrghBaUACWbiiVRKaDyZFFJMJePJVDJZJpJE"; +moduleBuffer += "xgB9QnmpBCpVpJelykVmxCkwKZ0CWSWyZfCJtBQTvEkaBZETIa8YyDIhSy/eL14NQBJZTEpSiS+lhQrEy5JCbOJ/Kfibgr/qSv6T"; +moduleBuffer += "pYALyAk+gbATgonLZMiN+ALwTXKGfphISrmLP+l0jBPlDfiHuBd6jUmNwn8kZ/Eq+UQSnxTMKE08L/4L8d/+2GFRsnisKpMXPbTR"; +moduleBuffer += "w4fvjpVmX5+szaANTcTaJvfsPTi+ef+VwohOju7b+4zJA5dNveSZoj7ZIs5eOLn3jMmXxD6WqfU+FvtapmDeiD2cKZXXdPvN2XJ5"; +moduleBuffer += "ia+CN/0mUzw4+cKd+563bfLQM/ZMXn7BgSti/50pYBr96p8zJRNXHFSvPJLNiyu69ZYs3Nq6T3YIYr+VD26ZxKvrs+lLD0yKTs1P"; +moduleBuffer += "s5HKQrRB9u+JXZOuMhIPTGLqN9PVZhfuxc/bf+DQ7t54XFRRVj2yG3/w7nije2svve1DiQrjbVMiM7GP5iJ9xBdDN2j/gcnYXVmz"; +moduleBuffer += "nhNV/oFDsaH8d4WmRuOlP49/PfNA7u35b2TeWfIvuV/F35F/df6/8z/IPZL4Qu67OUj77/hr8m9P31JyT+5V8Vfkvx3/UvIX+Z/n"; +moduleBuffer += "4c5v46+TxzfkX59/OP+r/G/yv84fy/9UVIE/y/82f3P+88m3iftfyP0o90j+e7l35h/Jv6vklcnPJH+d/lX6x8mXx29Pfz/9rfzt"; +moduleBuffer += "mW9l/i3z4+xX859IfDj9rsyP0m/NP5D+Y+q29PuS30p+IXF/+tb8LeI9D+f+FH9P/r35V8Q/mvyPzEfSV345/kj+a7mv5+C1n01+"; +moduleBuffer += "Jf++/D+lf5D+UOYdmS9m/iH/gfz3M1/O/33ySPyH6e8kP5H8Yebj6U/n31bykdw9+c/kv554Z8m3c3+M/0v+XvHqP+e+IF58X/6B"; +moduleBuffer += "/O/S18d/kvlE+vbM1/JvS34394X0H9KvjP9n5pPp828u+Xb+m/l/F3k5nPv/8l/MvCt9f/47+QcT98Z/mrkp97rcq3Mvzf02+/9n"; +moduleBuffer += "/1v8/zfyv7enfpd9KPuF3L+nr8tdn/9s/IHEsfgDuTsy38lfm/lh6gaR8U8nb8x9L//93O0ZkPYHUjfnvpX+Rvz7+fsyf8j+KPdA"; +moduleBuffer += "7g25H+a+n/tB7hfpH+e+kf999j+Sr0z8IPFI/ubcL9Nfi/8g/8P8v8Vfkf147mO5e3I/yT2U+2rm3uQr8zfFv53+cb7k3/+u/Zf5"; +moduleBuffer += "f3p+/Mb4bBALEgMJ0ZgP4nBIzYaZsc/d9anPls+O/Vn8q7g2rBx7+Ks3/bgwG9ZQSpChk5mx4Aj8OhU2B+KHWX0/ODITVqmngsqx"; +moduleBuffer += "//rAnT8pnw1zY4/iEzXyiaJ6Isyrn8pspMLMbFjGN2usDFWrDJWqX9WYGcoEzbNhubpVJr9Upp8UlyJDf/jXez4nspxWGcrJ9KJ8"; +moduleBuffer += "OKceFkXLhTVQNJXTICufq5LPVXAB8/I6zzku8J1qVfRa9aVS+WwpP1sSKXouzM6GdXyzyip6vSp6g/pVlVn0LBS9Ud2qk1+q009C"; +moduleBuffer += "1qtV0deoDNXK9Gi2hBBrZsM2dVUuH7FEWSBRfuDND92dBonT+9IyXQpUyFeLshBWgSiVbFDYQcVxRLmY75TIOyV8p4Xv1CshL1J5"; +moduleBuffer += "aJDPNvCz3REhF8LcbNjON4uWkGuVkJforBpCzoGQA3WrXX6pPVqoeiXkpSpDi2R6NFtCXTWQZ7pqlI+g0liHLaQ0EnKLet8av9Kq"; +moduleBuffer += "QK901WYojTW5mJT23e/cf2vFLEuXNCxVp7kjlFYMi4HkSUTpfqUx6sNlcyptOd/plne6+U4H36lV6lyhSrtEPruEn10ZUWcxzM+G"; +moduleBuffer += "rXyzzFJnnVLnKm0TDHXmQZ2d6lar/FKrfhKKW6vUeaHK0AqZHs2WAEYN5JmuAvmIBY8OggepM1DvW2rAY6mGh1CnEgshqDEKj+Uy"; +moduleBuffer += "MRMUDRwhNKT2NRiWkd6vefMNHy/M2niQ2tdgEHqvCctA70qRROqKCKlnEA0aB5rb1QpgSt8EZARsy5zw6JkTHjv4zkp5ZyXf6eU7"; +moduleBuffer += "dQo4fUquq+Szq/jZ/ghwasLS2bCLb5ZbwGlQwBnQLDGAUwrAGVa3uuSXuvSTSGYCzojKUJ9Mj2ZLQLAG8kxXnfIRC4i9BEQCTqd6"; +moduleBuffer += "34V+IFYBVv9sYtUC4g6ZmAXgMGI7DIQx7HoIYWWzrByC4poowlR1IC+1mQ8XkSFaHDVEAmMNYSVgjGG3zLBB2oJYtoaBIDBGYFYA"; +moduleBuffer += "IDa0HAdjDMl6BdK1Uc5KMrKFd6G4lO/YUDyL7/TLO/185xS+06BAuk7pcEA+O8DPro+AtCEUzw7yzbQF0kYF0g2aqgZIywGkG9Wt"; +moduleBuffer += "QfmlQf0kWh0C6WaVoXUyPZotAfcayDNdDctHLNCfQqAnkA6r9434QV8FvPizyQsL9GdhSwJAyuy40IfmpYTmslltPRH2HVE0K3tZ"; +moduleBuffer += "aVimHgPNzAXkxyKJ6vDCGYVibeEEflvCNODXsqXLIrZU4ZfxrFlUraiiEB2eRTQ/HoIZ8PWKAgpewVr5gsCL4LX8Am4O1SoKbIla"; +moduleBuffer += "H6vCdYDeyXdsoJ/Nd9bLO+v5zla+06gocKpCyAb57AZ+dluEAi1h9Wy4iW9WWBRYoyhwmvoVWwugQDVQYLu6tUl+aZN+Em0eUeAc"; +moduleBuffer += "laFTZXo0W4JMNZBnutooH7EotZUoRRTYqN632U+pKmDdn03WWZQ6WybmgQLMvREfVzqJK2VGY6bPx5Vu4kqlQaqlBleYQIjFdJCZ"; +moduleBuffer += "tfkjqWUTCJgSLDIoJBgShBXAEIa8WRNohiyzGMLwPkvSMNwhAHtcTrAlqVe0UsY4PJsMk82KtRYrmES1ilYKssGWBbGCSVSnaHVu"; +moduleBuffer += "1F5azRGHPMN8xybPeXxnm7yzje/s5DtrFK1OV6g7TT57Gj97foRWQVg/G57BNwsWrdoUrS7QVbxBq3qg1UXq1hnyS2foJ9GmEq2e"; +moduleBuffer += "rTJ0ukyPZksQtAbyTFfb5SMWTXcSTYlW29X7zvHTtAqY/GeTyRZNz5OJpUAr5vNmH/+GiX9lRlNvnY9/W4h/lQZROw3+MSlPIVpl"; +moduleBuffer += "DavdZ7Q7mH8jVFdVGETFJtryKP96mZTAP+aq4F97WAD+MSV7DP7ppvac/APOBd0u60b4UTZeZ8vKOjxLGJrj8oxpUquoqiqN8Dwy"; +moduleBuffer += "oMg0XWPYTOOmbp2iqqJBcO6CmMbEbFBU3RW161ajzCHkRr5jE/JivnO+vHM+33kO32lTVH2GQvIF8tkL+NndEaq2h7Wz4TP5ZolF"; +moduleBuffer += "1cWKqpeoX7FhBBXWAlUn1a1nyi89Uz8ZyO4iUXVcZegZMj2araAmqIc809VF8hGL+s8h6hNVL1Lve7aP+lVBNViHP5vWwaL+xTKx"; +moduleBuffer += "HKjKNuIcH6c3EqfLjAbvqT5On0ucrjTIP+zj9BKias4hf2eU01uoTq0wyH+Kj9ObidMFh/xeTnd4ON0RlgCnmaTYzpXMZqK7nOYq"; +moduleBuffer += "WHG6jx8dmYvTwOOgXfPVZTIb2fNkQyU8WzATGTwPd5l6dYr+qnILLyZDfzz2MtkbFP0VtYJdC2Ivk71R0X8qWv9YDVKH5Nv5jk3y"; +moduleBuffer += "S/nObnlnN995Lt9ZrOg/odhxiXz2En72sgj9O8K62XAP3wws+rco+k9r1Rn0rwP6X65u7ZFf2mMqGTJE9N+nMjQh06PZEvSvhTzT"; +moduleBuffer += "1aR8xDInzyVzQvSfVO8b95mTKjAn4+rqGT5zcqlMLIKdYLvzbJ+dQL2VBeVGY/90n53YRXai0jAoG312YifRP+8YFMtOnEt1f4Vj"; +moduleBuffer += "UCw7cQ7ZiYJjUOawEyWOQbHsRI/fTqTAUnSGZttbtxLmsxNsVvqOayfYgG0hO7GZH52zxgfbECyZzzqwSblYNtLCc6HvfTx7oAxI"; +moduleBuffer += "0KBMirIQ4bOpQnoMFoFMiqrHg6kFWQS2QGsck3KRp+pzDcdFfMc2HNqkXCbvsCFhMwFjBmRS9ivGTctnp/nZ50VMSmfYMBteMadJ"; +moduleBuffer += "SSpBNqmUK4OkksyoLM8ov08V2EknI6DSH1XpZGycdCqCk07mTaaHz5d/D8i/B+XfQ/LvC+TfFwLCrgyaADtNM2FyJrwSUsTxRXR8"; +moduleBuffer += "MR1fQsf/BcemGcEZIZEkN4vgqklmRIkgKHjSKjxpaU9apSetzJNW9KRVedJqPGkNYOibZVqzSrtCSkUmhji/gCnyp+H/ln9n5N+r"; +moduleBuffer += "5N9Z+fdq+fdwXB6uiUtJyfemgrqIkMRVKG+EWkhuWoUnLe1Jq/SklXnSip60Kk9aDaThlC9PXl8uL7EWxGnoOqoR4a+8i68JX4rF"; +moduleBuffer += "vxYP1+HhZXh4eUQmtRGZiKvV8sZqLRM3rcKTlvakVXrSyjxpRU9aFaThvK+aJ6aKHWttnMeupRoc/sq7+JrwFVjUI3i4Hg+vjBS8"; +moduleBuffer += "PlJwcTUkbwzpgrtpFZ60tCet0pNW5kkrQhrOu/I0PbY2sCmBk/r1Y9isgL/yLr4mfBUW69V4uCFSuupI6cTVmLwxpkvnplV40tKe"; +moduleBuffer += "tEpPWhmk4ZQjz7JjowjbOjiXWy3/Yoq8i68Jb8QivCZShPJIEcTVmfLGmboIblo5NGSstLT3OdGEqpRpldFWGLa45K0Q5xYxRd7F"; +moduleBuffer += "14RHI/ksjeRTXD1L3niWSiuFNpOTVuGkpeG3cpYx4GlxbAVi4w4nIHGOCVPkXfkazkzeyEwe2mB75Y29Oq3gSROZkfPgATuzYKsS"; +moduleBuffer += "G4s4RY6TAZiy0fxkzvhkzvPJHHwSnVTYPQXbotjERHcLnI/tNF+cNV6chRejBwv76mA7FZuf8lZYYv48Y/wcW6rYAE3phy6kRqgx"; +moduleBuffer += "4ULNSnpJtAWqXke35ZtmuLkJrkPBDv0j/bz2OqKWqPlzdqLhcp3i+5h+Lf5Ofm5GtrahAZulo5TAWTPGF7kMJW6+spy01s4XvZ/b"; +moduleBuffer += "/zx7xDrcspBs6ozgC0mHqjGdo2OBjjL7Z88YGcu42U/ZeTJKlOOklf4SUQa4V8Q9ITXxojlwzuMpoM46YRKRD90A6Obk6VhBRzX1"; +moduleBuffer += "IAt+7oyR/6xb8Ixb8JSdfUMW7IlEnY45ZEE5ZDvEPUvuTbILDdul8yzR5B+PaHRhyQag8Xu27L2GaZFh6vpIYSVJWElFc9G7oiMU"; +moduleBuffer += "LEhrs2kYmqQrz0WuPOfFVt4V8frjy5NEIqoK+jXXPdzF5249ey1xXbTLkm/pkyFfDQgy6VgBkkeOtpZhOY1cbuAaR1SYUNqwQnZL"; +moduleBuffer += "yufQR6OpjwpdtRoyTLoqanRVtDDIs0uLxqX279m2UBWRbF/DirqRz7h1w8M3PGRTzQ0fdfIcS2VlfwmVaYhTcwBVuMajwjWqy4uu"; +moduleBuffer += "EsxhHBI4jVWLrbInquBSV8F5V8E5V8FZV8EZV8EpW+5GM1Pr/PwF67zM0PwNrO9X89mr+Izb6jzWx+N79eqE2+4XWRgo/kUwoN2L"; +moduleBuffer += "y+bBRJsHE21zYKJNDYNY6ThMeoGFFTLIhJj6hSOm/jiIYZVqxDCINGIYRBoxDCKNGAaRttoeELHmNIh2LwBExTmg9EqGzfV8doTP"; +moduleBuffer += "XsFn3MvlAWkehK5VJ9zrvdQCVdWTAirtwF58AiBb7AHZ4jlAtngOkC1WY20qncbO9snLS7zgw06xgmAhAsHa+SBYeFIgWLS1ZaBS"; +moduleBuffer += "Q5BRWc9JC0Nl2sbADM5NzInKqgVg8+WMvpfx2XV8di2fvZTPeCzKmIChE/bM57GpyyyU1jwulHKBCeV/GdS2eFDbMgdqW+ZAbcsc"; +moduleBuffer += "qG3R8RmR9P3ycnoeNJPxJEzXRjCtsFznw3TtE8A0x2toTHssrcY0WyWP8Z0X5txg0t1jliXHwATPmwPmNY8R7NcwiA/z2dXqRM0U"; +moduleBuffer += "BFepkxl18r/VCQ9Mq3mGgEMfeHw6sCB/vP4hDm9zYR0K1FgUsA13lUUBu3VQtChgtxjLiAIOLv6Xi4uXuLh4sYuLF7m4uNLFxQs5"; +moduleBuffer += "ia3FC1yoHOKkg7akZ4IDLnq4m8uTNubM8Uzw/KheCE7NjxtUgbQdYzEWqDgt06d5fVrUpzl9WqVPs/q0Rp9m9GmzPk3pU1VinFO6"; +moduleBuffer += "ShozAeH4tVfh7NNV0lxQirRCV0lTQynSXl0lzQ6lSMt2lTRBlCJt4FXSHFGK/ORV0jRFU2qdlBInpc5JaXBSGnVK7sjtow0vCONB"; +moduleBuffer += "6e3PD+KjVx8ME0Hj7c8/MJjoDGJBPCgTyYmgQaZ0yJS8TKmTKe0ypShTSmRKIFNyMqVWprTIlCqZUpApDTIlK1PqZUqNTKmRKRUy"; +moduleBuffer += "pShTMjKlWqYUZEqzTEnLlJxMScmUcpmSkilJmVIpU2Klbz2UeFd8NnF1W2y0+/Lwjnh7LLgjjnOaibFr7n/tD2OzITcIEmO3Pvrj"; +moduleBuffer += "byVmybAkdfofPvLpPyV1+qMq/XVfeeOnfc+/4W8/fEuZJ/1zH33fN1Ke9I8d/f33Sj3v/+evPvijCs/zP7r2t7/3pb/x3v/6ne+7"; +moduleBuffer += "t33k8/9p5PMRlf7u19735TjEAwDpZIeapvyulH9lizCUNWmINcV8E6oB2t94RyIWvjs+esP7f/rG5BXvFxynKVmW87vj7w/520nD"; +moduleBuffer += "iOicplUek2Q/tCmkid+skhLaGe3dyxWyjA5Nqe8UDPMUnb/Oqwxy/zKSp5TKU53KU4EaD382sigyRu2QKpUxrE5KyOjZOjJ6Qlhr"; +moduleBuffer += "Rctph37qFkFeSaBMfaiemjTq2UpDAjlRXJKAjouxA0NKlASqdaYMCSSVBGqUBKKBNlSEvJIAx69imzCaPSEoashx/quoXrYERSDn"; +moduleBuffer += "mq5oCKpoCYobCyklX241yClbS2cqjE23xtQElC1DUCDJmwMqq6k5qZ5dZMi7IIRL8ubWnxMmXarkza2eSJh0Wsm7XcnbCuXLELLs"; +moduleBuffer += "yFEVAWpmT6jFDgit9auF2t3cIS4z1FKm1UI2iUOxVCsJa3UltYaImoRaSJtGq06rRbc76iy1lEfUIpBI2mWnXmzD2UGmlVbLaxG1"; +moduleBuffer += "P2yNAXxIu8uUdNDboYmfDQztFoUqSbscnSogG9VuQWmXpzqypnYzSrudSruWn1aWmpGk3Z0qYxjzFs2eAAFpl/O/1AeCnOptsdtY"; +moduleBuffer += "LTVeLe1STcQUXkxt5Kh2i7Z2bVBI9QfKlSSq3WaNTIIcT3y0GMhsmRsEhCUe1VmyIBDUREAgWGZjSXrfW1xT2NGIQZf1dgcfAGbC"; +moduleBuffer += "UqikF3X+M5zuZERpVmFpDT9QN1cQP/vl15lYyiosdSssWZGWyvgRljjYFZ1fLN/EUoUlzv9OH+SojW04zp1PoHPQRO0dC3TKlWRO"; +moduleBuffer += "NBEI+6MgtAL1CV0GmgjiDEI5ae9EAzloIuwyCFfPgyaGXInCLseXL/PwzgM6wi5HSy9ZEOiswKyMg12MH4laEjeMCcO2OCLPCKTn"; +moduleBuffer += "dREqI3Hr2v1Th6LJQNOcwq4ON7UXoOBgevYrjSxAkVPYHVLYtZxvq8gYEHY5Pg7HlKLZExC3I0m9YaLn41znTmEXXLRSq90Kdav1"; +moduleBuffer += "opUhnVIg54Cp/oWhlUikPFPDEYL5cfFK7FisCtpl4JUj1BHFJl6JHRzAvHJheCV2WDCfH6/CkhA7GOahx5J4YE3s4JHQJQasdTCd"; +moduleBuffer += "DetOuwIldrAzBQYyRm2jHfCr/H518Lb2AObVAiqU0DGIggOjtG+5jEHNK3aM8gP2yiFVih3sGx1ZOSSv2DGm2IEeraP6aSgSrxrA"; +moduleBuffer += "YW4YpRrNnl5FguO2N/pIBIwIKiOcoB4uu2/0eTlhuaSnHCqdvxBOjEjqhOcLszsHC/SaDIp1HMuJ5EE/LR0vujrCCjXUqpsO4RYK"; +moduleBuffer += "g0YesBu6ywNi3VYlwJUL4wGxzqLPcXlArLPoYweVRnkgbCCxjunjC1Vy4gKyinUcZ9Bp0EWHb9t06Y42NXKKdRwxjs6XUavuetej"; +moduleBuffer += "d6Ka9tVMgnYCsa5aCV16aukFEnRQhgxRLVGs04Gq9jodRcU6Dr6IrNNRolh3pmKdFWJSTg0YYt0FkS6hlT29usEO9dh2HzkV69hP"; +moduleBuffer += "hcebnhFl63FZ5yfrcVgno7wqTK6h9xJzN6nYzOzDcFM7NtsKidkiyReuFrULebtxPIjLLmIzV05bF8YuYrOKGQm3Ei2Pyy9i88po"; +moduleBuffer += "38rPLyZhQbGZGedrRnv4RWy2aBkN+HHWn+AlR5iWmz0221lbJafYzLF53QYNuXJzaDgUbXzlFZvZHwMdkKO1kB1ZNYMOtKFy5NEM"; +moduleBuffer += "hXYTsfmsyMIJzEQjMExGsZYqNvMyEc5yTeWKzRwJFFmuqVSxebdis1wigV9IIxxFxeZLVMZwMZFo9gTpic2c/wt8pN/usplGlTmU"; +moduleBuffer += "7RkGm5/B8nHYTEZgPGoEHjOb+2w221aifyFsBsoH1UYgFXGY69+0shLs17h2IRzeKt1aw7XCGhyftWQlOERspZe10Tg1NXGq62Bh"; +moduleBuffer += "JQKDt7oZ6fCWrERrtNfs5y2TmxdaYSYPL4y3ZCUsulsrCtnrgvDyEUz3HZ46xglszCsrwUskDRn05srYofdYhP6iviQrwZ576Pcf"; +moduleBuffer += "rTWVVdC2AANIlIemZj6088hK8Ppp0iuYGT6jY0plsGtBWQkOiRMVZNRKlCkrwcHjXIUCqAvKSuxRVkJ6len1KnDQotwZ3cblhaLZ"; +moduleBuffer += "E8aErATn/xKfMfFYCZqN4gBatC4YtcGx/q6VIOPCHpPjT5KV8Fuf41iJfsdKoP8925q0sj5sN561ECsBliGomdc22NbHvwyLZRuw"; +moduleBuffer += "vRCuhOEAu1PpWAPb+rQa1kBX/mHEOuglZpR9ENanw7AHujnt2AOyPryy4fDC7AFZH8uMHNcekPWxzMjQvPZA1IlkfdiMnOWpE+1W"; +moduleBuffer += "gzAbZH3UujvUuDgj2nhwzMaZEbMi6neyPuzqLX0JrVreDjufwbC2UMfMTvCdMmV99kaWomDLATGj9Cm9AFW9ZW8SSuUwrRpOzvCj"; +moduleBuffer += "4QagOaoHA2Q4YDuhBOmkkzlR6Tw1TNbISecV46x0soEyXca3YnQrxrZiZKsZ4xlsCCZnwsSMLEQgjpN0vIqOs3SU4Z+q3TUrCi/K"; +moduleBuffer += "PAVNZTRnvDpXQVkqXNipTaeTpVHpj6p0shTO88R0J5346aQTj5z3E+Kd5wmbTjqBDdcr4tlfGQtKVUaBKg74izGiuBKcGRw7X6wo"; +moduleBuffer += "OtHPBAmGkhAsAUbeClicZQowTjoBRqXzVCwBRsUMUjrGjiHKywjr8Fem40sogDURTElATJHiXxGnkyPq5Hp1IgM/Z1TXmkBxKYyG"; +moduleBuffer += "ICjO1QwmUMio/WCVTidQqHReEJlA4TxPoHDSCRROOoHCeT+BwnmeQGGFC55p2BuciD6TbA/8xaUIPFGjVgDmuY7Wy5XWcbkIlle5"; +moduleBuffer += "XizMSueVlVHwkZlebKLgCBr2OjDlXFTrpVKtl5Lujiol/o06+Vt18lpUazGi1ufC0DKqlddFKFFqxTC+Xp1OalXpj6p0UqvzPKnV"; +moduleBuffer += "SSe1OumkVuf9pFZcwIgjALGywjZtCdU98Fem40vCm1BTr8PD6/HwBimSXY7eikpvGE/EAikqvVmxx9iExLYhzivg+YWomedKzTyX"; +moduleBuffer += "xL+LjjcrfbxRnbwJFVMVUcxlMCOGiuG1XvJKMTKgKliv00kxKv1RlU6KcZ4nxTjppBgnnRSjol4jSx1iIwP9//BcpuNLwjejyN+C"; +moduleBuffer += "h7+TZZ52JF+lJG+FsGMzBtsjOO94Csr2MinbHSTBy+g4Tce3KtG+DUVbFxFtHcyno2jZVTunRCsjfYLTdDqJVqXzKvIkWud5Eq2T"; +moduleBuffer += "TqK1InsxlBZbhehOiQ1LTMGwo1tQdrfKQl3uyA4blqqFKKVTJ6VTR0IYpuPldHy7ks47UDrQ5hXvySqhcF84q4SC8Yvn6XQSikpn"; +moduleBuffer += "lykSivM8CcWKSMZGPvbj0VEFz2U6viS8TWY2pFIHW0XJuMuOpeig41Y6vlMVLyFfv1L0LqhgPIyfUQXDwL2LdToVTKU/qtKpYOi6"; +moduleBuffer += "w0642PvBXgp6NuG5TJcvwUGOmaBS/ifX2apU8fLYZcHA23ehKtaKLhZllgdT0yqzt+Mzt8f1Hcqu5TyPA7zYKUPneTyXo0BrMUM1"; +moduleBuffer += "QQ33y3AsCMdvcNhnNSwBg/ngOcjkHP6V2GXFriX6+8E5zt3MBNXcq8Q5GpyeP190fdl/ExLYuxBH17ADjLd2Uh8ce9Q4Bo/9aHRT"; +moduleBuffer += "Ub3hCvolvUi7PjcbL/MEAPfp2/QO9ozTPeWUloJK6jJ+Z4lktfs7PUe70f6d/VU90M4vbHRfqEOwFjkvtIIv1rovbHJfqMMK2v0v"; +moduleBuffer += "tPOplz9Ma0I4X1rifkn7SS6b40sWz94Vdz+10v1U4H5K+w8tn+9T9uIWt+kPcibOc/Owxc1Dq5sHHZ3fOW8eLOuYcLPwTo8ctrp5"; +moduleBuffer += "6HDzEHISDlQkHktObvVI4xZPVk5zs9LtZkWPoaoSGmH8A489d+/w5O7tntxd7uZu2M1dnZs7e9hlAbmzq/m/0/nhfL/Fk+83e/K9"; +moduleBuffer += "3s33ZjffQ26+9YIGmx5vvt/myfdbPfmedrN9mZvtHW62T3Gzrf0URx9btu1FWd6gM8oFer2nQK/zFOgmjyJ63RKd5ZZozC2RDhE7"; +moduleBuffer += "/YmV6E2eEr3RU6KbPSXa5RbouW6BLnQLdKpbIO2/fcbjKZDdkXuNzi4X9UZPUW/wFPXVnqK+yqO8VW5Zz3bLeqZbVr1KxjOfjLK+"; +moduleBuffer += "1lPWv/WU9W88ZT3qKeulblHPdYt6jltU7YigdwHipN2Pv6j2IMvLdKZZCNd5hHCtRwgv9QjhGo8QDnsU3uZKYY8rBb0UIytcRxlM"; +moduleBuffer += "PHlSeKVHCtd7pHDEI4VXeKQw5Qrh5R4hbHOFsJeTeEJNN5UN1zGV9MInKgR7yFUHM7J0DrnCOejK5oArmue7knmeK5n9rmD2uYLR"; +moduleBuffer += "oZiMDl41M+A1P6V3uxbPkymYq13BzLqCucoVzKQrmA2uYGZcwfxvVzA6uFXFtBpdHhXTaiCGabNOS4juydK96MmTFEe7jMVYaNEA"; +moduleBuffer += "0xJ9agSYGlGlRiipET+a1qdJfWqEkqpCqlBSI1CTQkmrxuxQ0uKYHUpqhJtSKGnZmB1KagSpyk9Gwk0ppdpJqXFS3HDTDU7Kc4J6"; +moduleBuffer += "CWdRwOfom4cPH85de04Yb96Q6IRoyw1BIYCLDrioDUrlRTtc1AQl8iKAi+ogLy9a4KIiyMmLBrioDLLyogYuyoKMvCjCRXmQlhcF"; +moduleBuffer += "uCjCarXiIgcXVUFKXqTgoi5IyItYAOGfxZ9C4mj3dHus9IPjif2zcQoPPdAeCw7gFpdZ3OKyTIef6WVuQQthB25mGcIS8swZHGDU"; +moduleBuffer += "PlWqXgxLgyQunMrTSVkMT6yaNWLOoNcsMh4aoZLlBGcmC0T0lcNHuRONDW7s9vAyEW2Rrxk7R6oZc7UzG44nhkOa+WExSGNm2yOZ"; +moduleBuffer += "zcFOiHrnKbkeSA4yy0FGmIdmM7OFcAAyy55+OACAcUBcglK1BR07IsttOXj0OEVtWGS/tmfIcS4YXK4zhGlZk5Bd7uFj4QY9txfW"; +moduleBuffer += "BfmZiH3AEhfCNjO+Qa43GAZtxr6Utm9rLig3AujQKRQHj6oj+cTtEtsDM07RjGRjeXWoaGDtum0usm/5b1cFA8ZGNDgGj+Zy/Vxi"; +moduleBuffer += "K87gWo2G5FJacnCDfUT0bL2yfEqFOKIXnqrrwrA+qJgh42yKtBgmZ429NmF+UbA2NEZWbc+VchA4j4JjhWc5L+A0jhzFqwMdDBga"; +moduleBuffer += "whkwKxoupXRQE6ZAB6wxtWJERAelNE2Bg8rzCL99loVFDqw4g7HVEj7LcUiNuMKEo9KudiyzFaNXINehpZVaJ6a0DRch1YIL2fkd"; +moduleBuffer += "as1ws66yw+agBJW1LaKsmjA9awRCwlCbsLehsR+a7bGXDMqN3SXRPc/ayBSDaiSX6gUFQVkMkdN82sWBtQ1q0kg77Rp7g+B+qDnQ"; +moduleBuffer += "QGMUKtVU+0c4ITcUlBv1VEZx4mi+Q0idFF9rKV77YIGx4qAzDGG0N7Y4K0IlUVXhBHNnBA9K43oPSq17HbOltzbl0Uod32SvNM+e"; +moduleBuffer += "WcrlKeSt5KBdFG7RTcVwRVCNKFgWQUED7HzJ49EhjP4JwYSGn3801GgGFwBm93bcB8yKIcSYJUn/ZoDNgOEp4t3/Fp2tTg0qFAqW"; +moduleBuffer += "MwoYb+jV2QYoYA/tjA9SGFVURwA9LWqnMPhBLrPLRqmR2tkRLK1TWGoJK4Iyw0hVGlhiRzC5StZ6132f8So3OWQ8LjZgpDeRxKgY"; +moduleBuffer += "xloxGBIYIXBpFNk7mS5xcGIEiuk9UfX+DZ5txpzdH9iBT3msKdrgJHe4VU9zhy1BDSKLvduyGCdVnI3sqSYkVARksbugtTmEwF25"; +moduleBuffer += "3t2PHNutQDecupK2agVAccCIounxQRFnPzcL20zI6mZkMYbRRToJyOIgiG0GTBm7GHFRT6DHeRVro54UVGgWZhGfDNouwucGgVky"; +moduleBuffer += "7EzkVjJ1xj7GhGMLnksUPAPRvikzwHyaYXoYswqeuvax1hyoAHhyuClCHBGsZ0gWRw0j4DJYZ7qL2sj0YY+H1I39Q3S1pgPqdIwB"; +moduleBuffer += "b7Cj44GsUD/tM6iGi0PeUAzq5PAs3T8OG4JaRCv79GcpvmjWcFmWngMlgFYOJ0DfHz0CKDei4v2H0IE2imgc/ZS5DVoA3gPGptyb"; +moduleBuffer += "fPDGBcq3BNUKrRsZrdb2NmlAK/sXexcPQK/LZiJST9T4jxLmU4al72ezbZAjQ5g/VejJ9ppFNuYB8kwctO84d8080JvEBoMGE/oI"; +moduleBuffer += "7WZ8dquBdmvTY7mPXX1QZux5Zdp4Rnvn8dAud4hgb2ikkr2eAKKfKbH4uGj3IduHZ3Z4jey4qM70LjDaJ17vBccuYXaoHPtS8Bay"; +moduleBuffer += "SxUDoI0UbtNLxoUrg6XIAHbrzWJMjrGzEu4CIXrtoeF0jd7qOqZFbiPAXlC4QWmUJbSytbT9DbB504AREbvTRxl0fdsq6ldiwNnM"; +moduleBuffer += "AOYazvSXAgM46maNj0645PgKIuemaCV1PtnrtFEjbTd4xIQrEI82Cz3ZLuZnEI3yBhlNvjG3kNnAnyBjMAg5WgEMsqojy0d+lGkV"; +moduleBuffer += "YdAIMajOYCDWL1Zo/LBiUIfoD5QZfOs1GMS0WgCD6g0n9D4vg6y9yOdikK4bHjtvfGzh6Q29VareiVHvvMjbohuxIDsitNCO4bye"; +moduleBuffer += "rDKuuJdMeJpegy9cFTQhqzjOLYsxLDWzhjM6uKoENcAqXgDZ2uNJ1CvVxtZq6EIUZR5teybrqJVAwwHDRX+Xj4a4kvJZQa1i1bOY"; +moduleBuffer += "Vcxf9FYsAqt4x/hTfBTFpblbiPA7o5XpxcSqUqPmvMDHzfOIm1tEo9mOjjiXqri8U8Eih5mvSHDZHCwYjD2fWFlhrNuA1I7GVxB9"; +moduleBuffer += "FSut3eLqgJXc5ujxsXLMz8pRYmW9w2qLlUjfMtyjbYXDYfRRZaoqVuqJZuW3xaxs1osSEOWRldqT4bisjMYKmQzUvJuvbjoe73Qo"; +moduleBuffer += "l4674OkqvcOZb28z7epqBX1oR00VYKVMNLrEh+v13FXYGSxDpnIwVhbXDCwzt1ZU82DKVs/y4mVhY7Bc8QiX9IbJibAymGRSyWS5"; +moduleBuffer += "2F5QGTTOhFnafCyLq+7BcT8dn0fH59NRbj1SaczLqDksnrni+SqepeK5Kb2+Km/y2ihyUAYGh902rX0fMUZA7mjOm8ygz17UMtF+"; +moduleBuffer += "WbJdsAoc9wb0RrS0l5RlpqQfb7AtWKqktZQFxNYPFzouAavDNm+Hz4ThdpINZBB3RRswl5LVKRqtlQt9tmuKbNdWIWhqRPGwDVrV"; +moduleBuffer += "PJguNmdn+0wXWlPZrK81rNZzyGoZ2xhTG2dj1GpdzKYsYrVoFxCoy9nqne+zWmget9tWC81sPVgttnqn+6zWOX6rdQZZrWbH6llW"; +moduleBuffer += "C61eB5k0bECgwcJ4QA6NrQpWGCv8oVUcjti0BdsjvRbLwkY0jteaeOy2jB1kFtqawLXWtZHjPV0FJ5ejBYJBJtyplJ0sMAp5T6Qt"; +moduleBuffer += "RR6uANCgE3xzB4xR2r0GV7nBQhtNiqYsUa+Jqcf5Q4JURyr8Z/p4jMBeSYO7uGcaDwOoCr/EsQYWgXcRgc+aCUNqafH433lEvaLR"; +moduleBuffer += "kHmWj78I/RaylUxd1SOoMHoEp/ioe46fumcQdesc6lvUHfNTV/Wm643qd6ePuiMR6nLFjVV1M1CXG9Xn+6jb76eu6kivMKYrT/dR"; +moduleBuffer += "F8kqSTZEHXIMqcCo1SUR/qpOjF69hVlpjDrqscaFcnS+sR2TmXppiJ18plv8emXv+dv+7HOMW88Jug0Y8wjlRiOJOYjQWx8sU+yp"; +moduleBuffer += "ZPZwzw8hWwPs4c73cqap0cWjbeixV0mhhDxGcw6xp9pY5eJCg4Pc4a8iDm4TBaexCR7yO5/YU2KsxfdMHwURkjCoGYQG+xDpFcA+"; +moduleBuffer += "rrh2+Nh3hp99pxP76oyKw9vm3+5n3xixr95YaeAUg31Myf4I+7ix3EfsazYGdUZ97OvlSgrYx3MCWMm1AXt4Bn/Yx74uzb4NRBZJ"; +moduleBuffer += "MJqlRw4NMcVmmIwGpww26SBjH6/c+Z/jcc1X923kM17mwagPNf8063T3d4D40j6r59txrgQdF5hECJZOGjdeFq27ziCI18za5LFG"; +moduleBuffer += "E7cTUU4TTKQxmFVRdeaBJxZ3JL201cVh1ZXSsBkUwd5jSVBhDPYsNSjCvBnxUwThIHebZQN9tkERtuS9for0EEXMHuHpPop0RShi"; +moduleBuffer += "jYqmAeJWMwwbscwlnHHoJ4pY0wVJgDg7tPUZFIm0v2gC91TaskyyAH04XKAbg/fzQ1wvBMTrXhqw12DXC/TNX4mYM0suxHUVoynY"; +moduleBuffer += "RkAsMzxwfIvCUiE7oaudo6qhMyr0PKCZEb7MQDNDHIEoNyosN4B8CtnaanuenbzZGd1r/UDuJyCbA34IbmvtEL06WATIvQTkemMQ"; +moduleBuffer += "fZjNorFGSLcfyAEBudmYhe3xAVmv2AdAZh+MRQTkFbMh+xS2MuYNW4t7mso9XDYrIAKKaUH2jANEvXOIhqQeV18oODl0wmuTfZZY"; +moduleBuffer += "T0Np6Grr3E54KZtlPy9yUEHQpaJClEM8uRl7bcsKwBvj02tm1/jxhvakGvDC0PTO2bf68baE8FZv4LXfhze9im8Eb5sJb83G4iOI"; +moduleBuffer += "QezXLY7qW+GNl9LZQHhbMauX/g8MvCkdUrUrJzq3KGBIw4XBbiZqChZeOFTOixye0vdiiB2GDE8qbeDmr82zVL9WGP5+auvPCDb0"; +moduleBuffer += "WjSAjXxUDnJrc8YL1s+VUYO2xI+NRYSNeseWWdhoiWCDbcEWwkazsWzOcgMbK6O6UdjgNec6CBsrjP0SEC/YeuJxBHTfAYQEW0l9"; +moduleBuffer += "Ehi4PQDp1txpwafb0gVqeX6rwE4/hp9bSHqsm9UumhU+PWJAat7W41bSY72Bg07DRmyNCkfpkfl0Kumx2Vj4stLQI5Nxg+ZYlUGd"; +moduleBuffer += "WtLjilntObiFVW4Y7wKbW9wUWZlgWq7W1EPpAvRQnFcj87OtimReb2zsUeeT+Ra/zIdI5s2OztArhxWBIN1MMu+IiqIaZFYd1QP6"; +moduleBuffer += "jHDLK6PRuo2Wl0YrVfIEZVbikZ5GcTnJp9nwQa33yafWL58MyWeFI19rd5ASjYLTVPlkrV39BMvHkZYUdFgWwWezryx1uizrVV7k"; +moduleBuffer += "5pr1jyEvegewMv6GR1mWwzLuHSfzEw0TMDa1MgINyvWpsZNVqE+NSIR2fdqmTwf06aA+VS6FeLhKhlOg476xd5UMoIj6+pfqlEcx"; +moduleBuffer += "xY0rKDop7oZU7qZV7uZXbnxCs5NiRCzwNlZJvY1VDW1jdYC3sWqmbawO8BZV1bSNFaSUGxtSBTKlytjYqkWmhMbmVw0yBbexKtI2"; +moduleBuffer += "VpDSHtnGClLaZEopbWMFKQMyJU/bWEHKoLGxVUqmrJMpKdzGKogFB4rXlAQHMGjhTePx/bMiTUYq5DBSodIXqQAaCleoSIVKo4GJ"; +moduleBuffer += "kQp6mT5F1rDMiVTIcaSC3kDIE6mApNeBqjJSoQI+yq0ybLn0R2sMO1KBzaIbqQC/Dwd12FJY50Qq5DBSIT9r9ANlpEI+EqmAebAi"; +moduleBuffer += "Ffohs9r3l+2wsaVUmYpU4ApTusVx5BK220uixLcd86JLFxpr93GkAntqy0iF9UakQq3y1K6PlFhGKmgjL2cIZaQCt8Ts/aXy0Kbk"; +moduleBuffer += "sTRvpAIO7khV13HEQqUTsYB2kuW2QkcsDPCYqA43t9x6q4J+o2m4zmOyna2bDKfoRVpy8Ah7wOp2Lc/I8lrRMlJhayRSoRRFmo2I"; +moduleBuffer += "VEYq6PadHBCXkQrs62ktX4w+OtyixRZxVOzU9pZ+kbWgg35DQzhuYEUqYAN8UMcJLGKZnhWVmoxmSIN+GI3eaIYy0isusTRgKWaz"; +moduleBuffer += "VozpS7/FUMwWSzF6NFC3d7XPm66ty7VOTGlHOoikEl6yF74Yjul4yrA5KKCyFkeUVROmZg3fZOmukQJlcWvMcl9G1w/uvqAvr7VG"; +moduleBuffer += "K47+SS7JSIV+PcFPXoWWdrFFtV57Em9jZTEsaBtdkG4xChXUPEsJAwTqCAHo4s14b1AqbwhLQOUWFhyVrxDKcVb8RgRwXy8Nlox1"; +moduleBuffer += "gUi1Q15wUk5Hn2jda1LO36Pt1Mo21WgMZKpBBB2pIP0zNhv+GS0qUmF5BAUN4J9hRSqUzRupkAIU8HArNuQt/z0cHpH0l5EK/Uas"; +moduleBuffer += "R5MPNtgv2yrsIqGgg1FgDaXISAVjkzAPpLADX0sAXRm1U9hpl05QbJQQXzj6vjKKijqYEFxHMxYMvh0KSi2iOq10VnKtiVhWiaGg"; +moduleBuffer += "wdyOMOrkKvqIppv4UgNFOorBWuzXwEmnAwcDsN7hXt3z41F3axOk+SIVnBiYRU6kQg4jFUqdSAUZA8M9ZDtSoSwykTBPpIK0VS0A"; +moduleBuffer += "xX5jAK3HB0UchR0TdnfuSAXstcpIBR5FWeyDqYpUQNA3RY1qLyGrzbCgrQY+m0w8AD7XCz3ZOzh2kakrmbXikwjHjFlkDCAX/DoY"; +moduleBuffer += "tYFCZiCaPZWzNmTRJPIQc/nxkFkVGQVD7kRHKBUyfTPXjz1SwTebxusbaZ8cO1KB50c5UmGHQivUtxCpoJpCYWOww4pUyGGkQsHc"; +moduleBuffer += "AwXmr4JCJFLBXp9d+kXw9DIOAlkzuzgXJW3qIoB3vxGpsNEHb5ys26wjFTYwWpkXGIqSArSyb/5yH/Rxdi8aqcBk2USYTzt7zyDm"; +moduleBuffer += "nUiFrRCpgBUQkwTZWAKQZ4NhcsNazV82CwYMJvQR2s24AaRMNCaPuLXSRnuXQjsEMFQalEGLHkSt9gLQXmvMv3QaaNce29bi6F60"; +moduleBuffer += "a4zPPzusvTN0w077ZGivC+2dEXXD8UUqKK8EK1LhVCNSYbGKVGAPhtzji1QoAAPYyQknbq29f4xIhUagTL/hCnSOjzLo4bDFF6nA"; +moduleBuffer += "XEPPDDmDzi553kgF8msicm6MVlI7iUdpo0Y6zeAREy5LPBoD70Zrdv10olGJQUZvpAIyWw7yZgx2jVIro23WZpW1s80mplWEQcPE"; +moduleBuffer += "oFonbgAZxLSKMognKZlBEMBQ6QQMWbtMLoBB9QYLsTLqjNQ5LoN0+0XXCAvljY8t2t9wfi9D12PaDkZjR0QdqcD+zzJSYZsRqbBS"; +moduleBuffer += "+T+zv17u8UUqVBw/UgFdB2UdtRho2G8s53+hj4bohHtWsMONVGD+onOjjP9hZ0ZvpAL6Ji4iwp8TrUx3USuozKg5z/dx8zzi5uYZ"; +moduleBuffer += "0TWxIhUuIGqWOBUscpj5igSXzcGswdidxErT5xepbbkunc5UjbASyVobWUVhyGAlU3XUz8pNxMp6I/AWmWptGYJU77VZiVVPJQYw"; +moduleBuffer += "VBotsC6DlUxVxUodjYCsnCOAodWoG+dmpe59+ng3X910PN5p113t58trKS0wZsGJVOAQBo5U4AAD6PeHO/QateEq5SfMkQo5jFRo"; +moduleBuffer += "MCMVVOyDMsHaBzQsBh2KR+gmLJeDKQ/2MqlwJwAZqVAeFGfCHEUq5ChSIUeRCjmKVMhRpEIOp2WCcs9qW48tUoGDDooiBw2eSAUe"; +moduleBuffer += "NMEABOkLwdEL3kgFDDyQ7YKVconh40UqYBTCqfNGKmAAQiESqeDbD4mCERrJIF4YbcBMkdUpNVorF/ls1yTZri3ghISNKB4gQqta"; +moduleBuffer += "AqZr/kgFtKYUgKytlvLZrjNMH7ZxNkSt1i42ZRGrpSIVag2r53V3vsBvtdDMykgFy+pFd6Qhq+lYrdPJajUbVm+Tz2pt91stNCwr"; +moduleBuffer += "yHrp4GTlBMWrvlTCeIcVwLBwe+Qb7/D1KhfahlioLdOxCAtsTWCkgjZyOlJBGBAjUqEiaDBcFNDtoTza8MJIBQAoBAnVAPWYv3sM"; +moduleBuffer += "rnJzESG6TftaL2PqWdEM1ZEK3xupgMBe7I9UUBV+wbEGFoEvJALLSAVsafFY+XlEvVKjIeONVEDoLyJbydRVPYI6o0fgjVQ410/d"; +moduleBuffer += "04m6tQ71Lepu91PXF6lwjo+6m/zUxXZAc6QjvdNH3WE/ddWwkTldeZpB3UiwI1F3cMZoCpAnPG6MsCRCV2OtrgWOUx9v5Ecz0x3b"; +moduleBuffer += "MZmpIxV0LIJu8etIhfnb/jpSAQfeGoA93OpF7xRsUTEHEXo7dEBikdnDPT9fpAJOZnRE61eE7EryAcMwBh6jUTG51cag4UUGB61I"; +moduleBuffer += "hcWwYISKVOCRx53EnoITqWBRECEJA3bgMcbsQ6SXRiquM33s03FvEfZtJ/bVGuH63jb/aX72bSL2mc3lUwz2MSWHI+yzOrwLjlRQ"; +moduleBuffer += "7LNWL6oE9vEM/ojBPm5+t2r2racqC31x8wZ7Bg0Oaa8XH5v02mR6wbAnEqmgx/V1Laj97nTMgm9sVbNOd3/7iS9mpAJacXRc4FYK"; +moduleBuffer += "gmUVDbstj9ZdpxPEa2Zt8pRHiXIaEWUb7GWOYzAro+osAZ4wd3Ck8dxoxae3XARnPKYI9h4LAHG25UsNiliRCg5FhogitcY4zTyR"; +moduleBuffer += "Cg5FeogiZqTCdh9FjEiFFidSIRWJVEDaeCMVhoki1rRXEiqI+SMVcHpORipspbX40EUW/fwdoBuD9/NDXLt4arD7JrHmj1TQlYgv"; +moduleBuffer += "UsEXlqMp2EZAbDCc5NGRHMcwuObOE5x3iF9T1bAqKvQSQDMjfLkPzQhEOeBWYQAZ7Zr0HGc2LDOqDUb3Wj+QhwnItUaFgeD2Rio4"; +moduleBuffer += "QO4lIJuRCghub6SCA+ROAnKzMSrhjVQwrGOL4d3cRECunLUdsXEMiJs06L4rpwzGFBCdSAUTiL5IBT2uvlBw6hCXhVrihUQqlADo"; +moduleBuffer += "2MsSXR0xMiUdFaL0Qs4beEM1SG90rsbM+WoG4Ro/3lSkQq3RY/DOFrX68RYQ3sxIhQ4f3pb48TZGeGs2PKfMSIWOqL4V3qwFWcsA"; +moduleBuffer += "L7xMeqeBN17wFqtd6YW9WQFD1tToX2aiJmvhRbub+pCjIxB8GNI+7Do+YaG1OXrg1gE22FsaXWLTUWy0RrBREtVNDejWwos1br/E"; +moduleBuffer += "j40mwka94dVTbmCDAbMogg22BZsJG2YUihmpsDiqG4UNXlJyBWHD9HccM2whDxjo9UEhCgXnYwAYtBk96jalNezVbdkCtTy/VdC+"; +moduleBuffer += "8toXA7vstaBHdtGs8+kRHYRKbD1uIT3WGzhYZehxS1Q4So/Mp62kx2ZjIeMmw0YwGddrjlUZ1GkhPVYaawCbESNsvLNsbnWkAigx"; +moduleBuffer += "EjGCeihbgB58sSPzW2zNNuwP1YPM2a2z1ifzzX6ZD5LMmx2doecNKwJBOkYyXxEVRSU0SKujekB/CG55ZTRaTyXHT7RShScos4JH"; +moduleBuffer += "ehrFtC+bJ1LBkk+LXz4ZKl+NI9+6qHwKGgXbVPlkrV39BMunoy7ylJcGA5/NvrLU6rLsUHmR+zHWP4a86AiQSv6GR1klkU9TpILM"; +moduleBuffer += "TzRSoVKfGrsjVOhTf6SCEdXgj1To16dG0IIdqWCEJxhBC248gbEnAkUquFEIpU6Ku99BwUn5i0YqxIJ4UBmJVICUfCRSAVIqIpEK"; +moduleBuffer += "MY5UKFCkQowjFWopUiHGEQ+lFKkQ40iFOopUiHGkQhlFKkBKvxEDkZMpA0ZcQkqmrDNiF2Kltz478ZzZBG2ocEl7LLgE4xOyQRam"; +moduleBuffer += "r/4kNaqqbYpQWKx2Q2g3gxjII1nvUsgxCrlgJQ458yBXkjALljQUnfxAvulPNguEDaGtDBp0NR0WFPfYcRqHBHTlyb0LdhqPhlgs"; +moduleBuffer += "NTKXVgEU3Iwp4O4jksNhBY5B8Mc7DRfpoELtO1ChhwbCLrUsOHdHcmphea71OmlMDYmsPXxweTjOvr0gKc9bsEfZOlUuuSpun7Eq"; +moduleBuffer += "bkmwDsvFZqsLeg6iXNDACpeJzBs+h2HeGK7BkpeKkjdAHCmpxW7YYQlol4Aq7TwZVgfL3NjxYKUaz9zE45l6j8v1Ubuehy0mOueX"; +moduleBuffer += "Tdpdr3WlFo9ZcCMGTvWclCbIo3SZ4VFaGqxHufH4B+1kKnvV4Ub0tGcH94QO7ZjB2RTebKFMdm5hqw5rIB/rFImxEtm/MNpbLN6V"; +moduleBuffer += "Wrw14Uo9th5WBhsd8eZobADrfx6KoPqSBzYTsESQX648srRUx4M0sqb0Hom2zHUtpndIKtPiNpvyhoc7+4P1Kj1IX8kuw1eyEPSi"; +moduleBuffer += "HriJQ9voSvGFeWE0Vuq+Q9hsdHiEihp0oEZYK2vNMDVDYSfcpsB4GOnCUIpNyjAjdCi3jFGgt1SHjf4+wXCSURnLiAuHuxBnIGIE"; +moduleBuffer += "dco7JmEdnlfr9CcNrWaUTmu1TheD+/dGS6WboipNgZe7rVJr4iZNjX9EQ6OlSzMqU53pFgnHXPl2L4gGv8zoaX7V8FBAoTXmVxtr"; +moduleBuffer += "zBeDVahfvSMGbdlC+pU+0RxItdwY7BCGaaUekgg7ZIcjbHJWnsO+keRuYQYjvxh4oWx8hi0OKLC/u0ztqQ5jnkrDvDwHdn5D6rBa"; +moduleBuffer += "EMHWYQlBBf3xmRHYfmsJOmYCtTuWUrfmewvs3MP7fZeLtjHFtTHE5DTEunlg0RQsV7BosmDRrGGxFHbLsLz7rTa22czULfxaDyp4"; +moduleBuffer += "w1nDlb9DA8JUtdGPZ2vZqZCSJ6PJ1MgHndbWNOUYDS1FKFpkch8RNewVDhuTDAJEDXoTpHCFHEkO22Zspy8cZJDWpQhIWalX/Bf2"; +moduleBuffer += "FsY1wm4HXjgU1SUMqBM4wkPyyxmCYa8wSxKByrRYwEO0lhIAMeLRcmesFDaR4MauwirUv0/UjdSz4I4U9q9WBN1OXDUOAybUSvlp"; +moduleBuffer += "A29lTjzScdHWFgzbK0yo6ERGmxyBWe8CzQcqDaU2D6j0UKdvkUjddedxIXurHZ5T5P2+6hT4AAKw1VSl1n7dTKQWC8owjFyBTy7b"; +moduleBuffer += "r4ZDwlPM6KscgE+NioSDcpg17FGjrzzkj6PtaPoo0I1ZsVZGbIQDDmJxaGF1sMrdboojEnD4oArQrKQSrpJYDxc5aFaD+4hqa9lP"; +moduleBuffer += "nI1bRf1qBC5bw24C7jLRLqDVCXlIjfbVCNbaXjY0pyP7y70G0JEFA+Ah4F3WIKGWti8xIFs7J2T1LtgWZHuCUx4HZFssyM4PTz0q"; +moduleBuffer += "q8fkNVB1nJSeMfVNLPGQZXSSx9gdgePs6hWMpcHZaPjdVwf1M9GaSC7hpGFcYu4+EZ5qBpvIWSv27d8mx6MgyDMabEhTqNIuV9IW"; +moduleBuffer += "EMyv0+T4FITxWtjHobAhUVURjAcZxhzYhtNWSTCeHGNzFjXXHF4gmYrED9x9mQ0BTrACLURVsBJ4McLW2KLDANFBdJo6aUiYO1LD"; +moduleBuffer += "ZFbPUmaaeUKLwo1JXyl7B40MLKdhsQC502qzAGmzFUa1LBa0mSzogDA3ZkGbw4JwDhbozQpgXHCBLNAbu9ssWCjOtWnWONej23rE"; +moduleBuffer += "W/sDaB8BHdmtN8viKMeyCLS18w5veawMKvRphPI3QU+J7jSKdudYpOHdhtO1ihnSK135woTnGO49OLWmvILC8+WserjdcX3ByXpZ"; +moduleBuffer += "aVRby0mLTiI4MIRnOnTCcM4NopYkZpzletFhdF4OmMG7xtVJCoblDtVwLZs8UQ4jg9m2nEYcW6n9L8NTJfNElWZz7HTi2GrRXaWo"; +moduleBuffer += "ZKYYjkOfSlSzSIVzCLLj22k0kpCzdWCRrciTFdwWivBJLWNZ7vBp2M8n5OWZwfmKT+wIgdSk5eILRrMvGyQWwCd7wcvgnOPyqfu4"; +moduleBuffer += "fHrs3NG1hY9F2r9Ns8jcGEmdaU837Y3Kjpi1EZIYoSbcRStTHIOGXbgOGniMyTJ7O1XtG6dqCWM5/pTAMKEePdiySMULmAIyObxQ"; +moduleBuffer += "0jRIyeX4wXUN3ruLjhfT8Tl03D0W6OX4E8Zy/OxkziE3yrU24K00jCW26YTD4VIiB4swfwXTXUm0sXTM3LOojdSgncTDC6X/UHju"; +moduleBuffer += "DLokaVc+9J+TtXMjLXHKhuyZ0uMu3OkYGemzF2wUjTOSXD0Li3WIjnFy4QCl4fAiaZ7Csx0DhA57lWSI0HeQLe4OsjwrdQB6eI60"; +moduleBuffer += "RxCYZFmeM8nyDEEQGzpM8IgcWiUwP6KBnAySYH9UlWyZHQpQHZOdNG1x0BoNAvMsc4O2aMQ2N9ie2BZc5JibMb+5Qft0dvBMx9ys"; +moduleBuffer += "8JsbtE87gwtVKB6bG9q0B0KnsKWLY1BoRnjOelFwrjIjelv25qgtUmZE25mWiJ0xDYqva+5rpj45hkdPmS7MBDlLCuk97IUhQMMh"; +moduleBuffer += "5zALQB8OpUlJByqo6NAYcKWPtaKswusoVJpt1DbJRM05y41wk2hWEn0yTB/OJ2JVrpigShGeJ3kKPRCLj4jWapr+Q49a7usrv8SV"; +moduleBuffer += "en3tcLukJzDbIuIgEXHDTNhOUfQ8ZraV6u1cpKMJ7ISwI4uHCPw82UGm4BgRSHvIOu1ph3QI/O0w1eltOCvS8VpJCPzzgp0O6Rb5"; +moduleBuffer += "SYct41poAgeRqocax4p0zEXkUwqog6TjNjMOg0iHnKU47gYth8Waf8beFMgyXmHAGNV2h7FNbxsf7bS3zUIJ6Gs/awL6+ok+KmoC"; +moduleBuffer += "ordTwVyPVPTFZFSaaKbKdqkOdEecrQvK3LFtbieeQvWY2RfbwaNq50QrCQRWI83nY9gFj+GtJTKt1At1CA0CxSBg3CLTCJFpI6yL"; +moduleBuffer += "g8MPPC2wgiiQ1t4ConcHDAtHHC7pHZSCdoNG2D6UfdQeUavlIKJZ1UIWiRb5SYRwXRH0OAxaHmEQNxURriPgYGgxCAcAB4hBXKkg"; +moduleBuffer += "ik8FyiGD2DWmOcIgbmiiG04b9Dqx8caOVljpyNiLPnLUwUURtytaoH9yIkoOgxbaK1ZPFcxPlfmHjLXx17TQy4XqcT4fVXx1labK"; +moduleBuffer += "KqKAEfYVbpYzxjCGgZHq7LmEOKujsXtsqvCIiXIZM4fTRriPhIaZiTJA2N8EDuU4AMmuUD2E2BJjoK9HEgIG+hD6PEZJS/qCdhpm"; +moduleBuffer += "rBXxRA2S0yvnhYskNcJ6B/UdftSTmy2RAnHOjp7a5zqCc4RtvcY512k4RL2ccG6NTw8EIw7Oa7Qd7zQaNgjHU8CTEls0PPKKE2uA"; +moduleBuffer += "dphhTmmrPhaFbXQdaj9s9eJjPgDPb9c1lH0W3jcmqP10Nag1lDsJoiuNWYyV6BsxrFavtexPHXRDq2jgoy6q5ySEsvGYYAeOdy1S"; +moduleBuffer += "cOYaGZ125ehOhQFONFc5ACev7LWGR9sw4mBFFCQOOEM2SGEoMJqGBpgypwhNruZb/dBE1ITBGhUkwLV/ix+XaAMzMLFmzas0aWNX"; +moduleBuffer += "NObXEwT+lQqXPEub4oZB0EXuqDisOfxEYKadtn0uvwttXGinXg1Hn3vvSkJCQcdcCFXICYg1DtVRB9JZrcpAU0BIKNUL04StEnIw"; +moduleBuffer += "R4Sr03VE1eKgSS15VqIXGQtbJMbC5eQprecCm/1oQgW2ENj6fVWZgx80Iq0wC1obNSIZP37IMy8IFX649ajXPQhWKzjINuQaHxz0"; +moduleBuffer += "+omPHRh6KTxtieo9YCnzgEVDJEtqKxirBrRI14Mw6bCp2a/6GlJbqV5gNWyWgAgD1fzghkmZX/Uo6CXScIh2XgnYJGUEFkVrgnq/"; +moduleBuffer += "4pUjRbPdGUZXCda6FcDUEgTK+5h9eJZprQ+RqrDFk1SrShuqNJxaHrs6dSCcjv7R894pj2LbSdgFHRskJCbXdcg58K33K4z8QkFh"; +moduleBuffer += "7JpUL9UY1qgtw5gzlRGFMWfyVLWXseKc1dWVioaics0ENaqxyDEdKGNQFOyshBSR7mc55ctqyN2QeO4xy95HIB162ECSKeggmLBa"; +moduleBuffer += "zn+HacdJfUNEuuzSsZrxEq4WDcBSGOJUUG7yWYtKkm1XVBrVYEFwmXGOdULJyMWZNioUyu1v00pOOS0tr5zSC5SYxig6aJeCTNjv"; +moduleBuffer += "bbWciw1LlBOZpeINJJNl0XyvjizRb20dItW9SSkaRAD+bmah0gsoVImneOh7SG6KBShHgRUyFKmW6eNSouvI4VLmHVy+3KzMn4Ek"; +moduleBuffer += "I5acso2fOk7ZcjEV5ZRtuFQb/tmG+7XhlN2gTw33a2P5+JX6tFOfrtKnvfpUuZziIeKUrT2xPe7VhjM1OWWvc55xl49f7KQsdVL6"; +moduleBuffer += "nJRlTkqXk7J6zHXKzimn7PFgNTllXxKgr/Z40EVO2ZeQw/V4sIycsi8hp+zxoI+csiGlQaYsJafsS8jhejxYTE7Zl9Dy8eO8fDyk"; +moduleBuffer += "rJQp68gpG1I6ZUqBnLIhZZVMKSWnbEjplSkl5JQNKetlSpqXj7+k+FNxA5eP/+Sl8TPAQfvYPbHLw0R7LEiM5qbDpaLod6eKVzeJ"; +moduleBuffer += "y8MrpsMycd09XXwoLq7v65gO83BNt3unYdn50aNxdb9nOkyKhAdj0+qZuwenBZXio8fUM0dFQga+EednjuSnw5KwcTQmEm6Li5Sx"; +moduleBuffer += "T9944zu+8eojv2sYSj6YF9dfvfXTb33o/d99JDmU/CZcv/UNP73hwX+/9js3Xj2UvA8SXvdPN73lT984etc3Y0PJe+UvvviRR793"; +moduleBuffer += "773feEAk3A0Jv3rwnz947yd+fc2OoeRd4nr0WNd0WC5aso3FhxLi9sde+bfv/dXt3/l1zVDyTnj8oVt+8fpHr/8EXN8B17fdcstv"; +moduleBuffer += "/vlXn3/528UXb4GE9z3y8+t+8OqXfvY+8YGbIeEbX3z9TR/8wr2/XzmUPArXn3nVN+CDL79e/OIIfPGu/DQVEUS1ejpcLCo4/Pzo"; +moduleBuffer += "UZGbVJAXkiOxtU+HaXH8ZkKJTSRkhdhuSZDYyuCNSXkXVHI4SemlIv3mlEwHMT+o0ktOrHjvFNioEzk7QeKlwrVKUfVNi/4EiTYZ"; +moduleBuffer += "ZJVQx/7hz3/z2Tv++PFXVA4lHxoU19f/n2vf/8nfX/eW1UIMcH3fV97xstve8JMbRoUY4Pqm23/yvns+9s7bzhZSgOuf/f6d3//U"; +moduleBuffer += "DXfcKqUACZ9/3xt+8vVvvOmPHxB5uBsSfvrln7/ij58+8vuckAJcf/kt7/35O//0w1+1iGLD9S++duz17/3WT9//DvGDOyDhNZ+7"; +moduleBuffer += "/8iX3/ia37wByg0Jr335e+5476///UOnimLD9Y/u+MnN733PO6/LimIPAmwHAUR3x6Gwobi+o3Q6bBOlzBQvChqDlMAHlDUdxAEA"; +moduleBuffer += "2aCReSgABsK5uURCIyVOHxK0G8b7OXH5O7yTFKf3lkyHI3gn44eNlJ8BGyk/EzZSgCZspARN2EgJGrABAY7eKSxOhchdxoGNlKcB"; +moduleBuffer += "GylPEzZSniZspDwN2Eh5mrARAi3VjDy6clr0RZL46byGzejhYDqsAS6WKjO3BGxaGwoIWHpXYRrFLWxZYTpcq4V6cxkL9SFx55Sn"; +moduleBuffer += "QKjlIl8nSJyKhe3BYiXIlBCxh3939Eb5d0tvlH8390b5d7TX4t+RXot/h3uj/PtdT5R/x3os/j3UY/HvwZ4o/77ZE+XffT1BHXOv"; +moduleBuffer += "HsA6DDYuFSQF9zLCeCP3aoJ2UHmp0DIb6luGpsMVaKpDTAUcHRa/X6nYeJ94ZBneS/rhIWVmwEPKzISHFJoJDyk1Ex5SagY8QGij"; +moduleBuffer += "x0TVUiJylnRAImVogETK0ASJlKEJEilDAyRShiZIhBBzRi24dDrskRJ8CFzPSnX91zwdLhfHB4WIVlENKJIKQgPdKGTxzMh02Imi"; +moduleBuffer += "FnfFRZcW7S1rp8PVSrTHxL01T4FoK0TOTpBQFfMagmYlznxQ8NZ8XVbN12XVfF1Wzddl13xdds3XZdV8XVbN12XXfF12zddl1Xxd"; +moduleBuffer += "Vs3XFZQz85aARkUVH4gSpgTzoIZH5i0PGkDlBaFlNs0PinbIOjTO9ZqPd4vfr0c+tmJqag6T3GWZ5C7bJHfZJrnLNsldlknuAtMh"; +moduleBuffer += "6pRqkaeUa5i7LMPcZRvmLtswd1mGucs2zF2iIajruVZoCeTx06UaJKOH66fDInCnfzrcQDVdHbTwAxQR8PHwwHS4EYUs7ooHN2mh"; +moduleBuffer += "PijujaJQRQHFxdhTINoSkbMTJFTFufKgR4kzK4ybr7ZbYdV2K6zaboVV262wa7sVdm23wqrtOqzarsOu7Trs2q7Dqu06rNquI6hg"; +moduleBuffer += "znWARtdMh72ihHnBOajVkXPFoBxUnhNaZsN8y+ppNMtLNA8Pr6Em0mJMy89hiFdYhniFbYhX2IZ4hW2IV1iGeAUYDFF59Ikc5V1z"; +moduleBuffer += "3GGZ4w7bHHfY5rjDMscdtjnuCMqMOq5lOuyXcnsIPPlyuo6rmg5bgDdrVB+vChq/vSggYOLd2PGGhuTR7mktzFt6uL15TKWfUIFW"; +moduleBuffer += "izydIFEqlnXDOAl+tFQg01eztVs1W7tVs7VbNVu7XbO12zVbu1WztVs1W7tds7XbNVu7VbO1WzVbu+yYS5aBNkUfZECULys4BvU3"; +moduleBuffer += "cqwl6AZ1VwgdMzQeFB2lzQiODqNJJH6/BbnXjKnZOYxvu2V8223j224b33bb+LZbxrc96BO5ybrGt90yvu228W23jW+7ZXzbbePb"; +moduleBuffer += "HqQVw/qlvCS3KnRdVj4dbgWmrJoOT6W6rAwGswZQLMC7w53T4TYUrLgrHjzNEK+4t11x705xcfpTIM5qWAjgxIhTsWwQlojAj5YK"; +moduleBuffer += "I/ZXwzKDYw9lpolhidF7U2CCiWcwFNpweRhvj4nmUg7aZ0uL/xIX5/eloIO0FMbewjMpqQzG50qKX0mJiztFeqXQVrr4mQwMvYwe"; +moduleBuffer += "TcIP4qPHxLEWZClOM9OhHJeR0KwqfkkO5mWnwWu6+FoI96ss/gBedl92OhwSl03FY1lxqMXUO0V+Fsln5Q8fzJk/FPmQ3ziah2+I"; +moduleBuffer += "x+Cn4pPiskrcEy+Ahygj95XAm6rwoWrRXloE6eJD4ov4QB1kHkrzS3jLnaXTsNskZLyeM/5g6TT4q6rvD9H3CyCHWvxliSjQv0Hq"; +moduleBuffer += "nTXiBUL+AkvAG5GvAuRLvrMrdmd9WFn8CpS0Sr3mzvJpcUG5OVoBFzKPIktkEONB5drYHYkAXitS8LVQe8JrqwP5QvGdKtChuFE7"; +moduleBuffer += "Lf4+FJtWN+6rhiKJB+SNe+N0Ix0sFUW6SBbsbTCufWf9dFCNp0cbpoUA5ekxkaMzhVgvguzfkWgtCRpFxmDIPChZG7sbtHWsYVqA"; +moduleBuffer += "SDafUjJ3ScHkxiDRFbu3LIzDt2D4QOQvGA7kZStYoOrpYAQvM2B0aqaDNryEcT4oxFq8XAa/FZen4GWZ6O6gWBIybxl51VopeNwS"; +moduleBuffer += "lBV/kRBP5GhIfzAoYsMhh+asHExdPY8IigJjegPUJQ08dCVKr8YRjw5On8jBq44TOBaojGDgGQWUzdrGaTXaIBQcVqBIYNTycBO3"; +moduleBuffer += "x+5rNET4YBOL8M6mp0qES078+F/6r3X8r557RMXAN/KXjoz8dQfRMb/ygEb7liko3NczBxT+MgNSJ26Mr0FxyTO6tzxYhSMIPJZH"; +moduleBuffer += "o3hdSkw0crfmKRJTx4kftyv5ax23W2KMmLsjdjlRd2HNlBNV1Xuh5ssVD4oH64ofzoIJoefK+DnRgS4+LMetxHNQ+RWwhstCKtR3"; +moduleBuffer += "D4MEW/BQCq+ETr+4qgMjvGwa3pvh74tzem8GKkV4lWAv/KouqMBHc86jojqFJ0SFsB4mhrZi9+LYOtH4CuOi0axr1nJds5araVio"; +moduleBuffer += "WSt0zVrxVFULIscbp8MlJ7B+TRtjInfHoG1GdYQo+0ZoTsd19+0UGAkREi6qKbe1MBBZqXu6hyvlHXmvaMj2wUpd5VY+VbKtF/k6"; +moduleBuffer += "wVVurVnl+gch/9+scotsQKqMKlf1BCqgWwNd1gxPdAsoNWDFm/4fU/GKD66Hefr0CauASzTZ7twwHbar2iVuDkDeE4MOm5pfg6tF"; +moduleBuffer += "YVFVyxVYLef+x1TLS6C6ONHVcrUSXFog8a+nWq6PVMtpqpbjxCo5ohAPimoirSZYh8a2SvVt1iO/WtnAds1lYP9SE2iniL77CZs+"; +moduleBuffer += "Kzemz9ZNS3k9BOuDMSRGH/x0bDqgWbM7xXnYqqbNKoONKMxNSnijKLyxp0h4bSIvJ3yKrF0JLS5A4+PRRotHGy0ebbR4tNHm0Uab"; +moduleBuffer += "RxstHm20eLTR5tFGm0cbLR5ttHi00WjeFoNeUba0nBzLcbM1RW3GvGigijZjDY7kx9VIfnmwGW1qh2rBbMHWS/NT1HIpnsD2YK0i"; +moduleBuffer += "FTcE00ETYaMiOBUrnwFlgbah4E5TgtqOgjr9adPE+2tt4FUxhZo9Dbw8d7sKolcnKbQckVDQHa1bWqij1ac7AocXUUeg/6+fSg6R"; +moduleBuffer += "ZI8KO6VMKFFHLeLp5DsXTRuzhou5L3V0sdGXumUJ96WOLX4a9aUMqsnKGfuff0WUa1aUa2LGSb0ibrhrFY90reboVKGEnqqO1VPS"; +moduleBuffer += "peLOVBMbYupFLTpO5wmF9VR1oIonvAPVZPafFv019p+ajO5TEzGnYIxWylHNQpCHw1JxUgpjjAk1Fbg2JtpB8dH4ttQmAYfYYOII"; +moduleBuffer += "1Hcf/vU9saBx9C5xKH42EysNMDSHw3KOiZ56e6z0X05LNPAWC03tMQHHeEciFjaPfu6uT3129or3q7jWWY7FDDOiJNe8+YaPy5hQ"; +moduleBuffer += "jDGjeLbE2He/c/+tFZ70D7z5obvTOv1Rlf6Hf73ncylP+n994M6flHvSH/7qTT9W38VoYtwtCvdCCTHOTW5wgvskZGS4Y1g5A4vh"; +moduleBuffer += "y2VsE2qJXLVOM4YcwlFGTldCtCjlm/eE0Avs6ghiOuGVN3ldWV7imANUec9yXtet+f0snRkKHw6OYA5nFlw6LAmWg0oBW18EOkK7"; +moduleBuffer += "cgzUWD6rVMfKlPGixZn5Svj4CpZ2BFT5pJQMwjipECmNPwx6TDr4c9IJfyrdxp+TTvhz0gl/Mh0jPUNcaB7XasKAaFw8GqKhheEq"; +moduleBuffer += "SuilCGJFOjbQsdGAngd4ei1QVtAMx2CyqvTK9aw0LS5WHyweYClSL4PIKp0Jam3lwnoTlpr16r0axlrjSa16A+KB3pj4yQN77iTY"; +moduleBuffer += "T4L96QL2wkmwnwT70wXsxZNgPwn2pwvYa06C/STYny5gbzgJ9pNgf7qAveUk2E+C/ekC9uAk2E+C/ekC9vaTYD8J9qcL2DtOgv0k"; +moduleBuffer += "2J8uYO88CfaTYP9/AexPFBhjMRaKOC3TpwV9WqpPS/RpXp8aywcb6wCn9WlGn1bqU6UpBMRVEqK0iK6EzlVS45QiQRZZ1FfC8SoJ"; +moduleBuffer += "I0qRwL1KQopSJMSvkvCKLthb46TUOil1Tkq9k9LgpDSOuUsBl6ulgJuDRloKGJYfKBPJzbC0r1wKGFIKMqWelgKGlFKZUkdLAUNK"; +moduleBuffer += "iUyppaWAISUvU2poKWBIycmUaloKuIkWB26GpYblUsCQkpYpSVoKGFIyMqVISwHLBRJkSoqWApaL4smUCl4KuAmWAm7CpYB/P5C4"; +moduleBuffer += "iF2JdrXHgl1oS2XrQbaXZQ9RjonIUUA57i1neuTcppzNF39iap3qWYnsUO5/mdLkCDNBGn1mePeIXMQo52ntbDZ3ySCHP9Ar3CuA"; +moduleBuffer += "a3sO2ApLcOH9jLFFR4EMkm0owIjiW82lv+lem3qr3M6qANGqyosJNkBWW1fpzZutfUGi+9zT+upcr1SR7bTNWZgO2jBLensOXkO9"; +moduleBuffer += "QWVJLrxfDPKCuJShcs4QV2YZ2k67kQx0NJ/Nc+QzNWNtd2tl1dp+NCgl22RbyTAXNMxQpaAKwrtMNqqCSM+ueiFb3FCjgswalyAr"; +moduleBuffer += "TCMWwyhAM9WHkQJweUqEWSKhtLBQeDOc4xQurRbcX+wvn71jq7Vrqd7XPRE0zpB9V6XnDUqaVOnlhhd1ovR5QQRr/23cCyFjlrsi"; +moduleBuffer += "Wm5r39cU7ZGCe1+0zF9g3hOlELQpabWytPT+s4vnFUZO7W/X7pcHtXp4B4joBk2waY7iWtCE0tJ7zai1/pWsZ+Uy7mEVbpWT9Ahq"; +moduleBuffer += "+fyC6tCCKhFmxN4V15bToqic0rSLjdx6SG+EcxwBFQWvSbohS5d3EZMbTM4tvMTM/PKzNwvFvUV4P4ZAbaUQNgQ1KF29Q4Na4l/B"; +moduleBuffer += "Z1buYxZWu9JdfjzpWtsttsgGnyvYrjkFWxANH9pCZKFyzdEWULjBTzi/QHk3qXphCkkbnawN3tPjOMJuczZnjcob97HQ+1fIHZJY"; +moduleBuffer += "zjO8fULYGDSjNlaxNtT2XUr3syFsoxOW/SW00TWvNuRuaenjKqJPK0K07Ekbc+thRVQPiQB3JJPbnoSdlgJWz6GAOmGZSXs9rL1e"; +moduleBuffer += "/vH8ymmYmV8/waqISqw9FmFbI9JQU1CL2tP7CPL+eJVKe7B3VVjK2hs+nvZGjqO9tU+W9vqi2pP7jecei+LqoT7utPS2el69tdF+"; +moduleBuffer += "hHKvUL2t4nEUViVqFtJ2r7NN6PGU2Tgzvz5plyreoAz3/OJdIAO1h11YE1SitvUekLwtaYvStuoFheVBi8ozbmcEPbywIhjiAuDe"; +moduleBuffer += "MbDTSVAO+/ckaOfhBGwGhMeNdNxEx1E6wman4iewPZAw56J9IfKmvoYbLpWqhGtVXxEJtZnesIWOW+l4Kh230RH35y0T/zXB+wXS"; +moduleBuffer += "1ftr6U4tv7+Mqir4u51+fzodz6DjmXTcQUfc6Lta/NcI7xd2UL2fNmZTCdeq4QRsuTbT78+m4zl0PJeO59Fxp3xLlfivAd7fgIij"; +moduleBuffer += "bQmx2aMGHHrpOEjH8+l4AR1xs/M68V8bvAr3+62jm2107KHjM+n4rDFzFKNetF7xv05iPfbx64k88PdC+fci+TwE5eSoYgNOYv+/"; +moduleBuffer += "SIYV/sot0kWDLU2NEWA6jhhg/wYbKKL7I3dRBLuBuybhnkTDZIygXyXam2iLsnp4CPdUpj2IaJM3Hs9KRg2U9xk9nMJPc1+N7Bb+"; +moduleBuffer += "LuX7dcr51KLj/URbOf5xwc2DHplZ7Lww7Xtteu4s9S3sDc/mT/K7QjevRTeveqypfY4v5Xzfyy0g6yseywsv4nzwqy90y9Tplqne"; +moduleBuffer += "LRNvK0jVRObJLhkPuC157O9PuAV9llvQZ7oF7XELyvuy6hzpEYdgAXlLzJfDxyaKpY/3c8/gHPOHL3BldL4ro0FXRr2ujBpcGekh"; +moduleBuffer += "kGWPLdM4NqpH4Z+gyFY+sa/v5GJwPs5zZXmuK8tzXFme7cqy2ZVloytLPVSw6vGUhmoKd4LjCYp2zZORmbO4bJytHa7Mz3RlfoYr"; +moduleBuffer += "89NdmW93ZV7ryrzMlXmT2vP0cZUPq249y/Sky77/ycvbaVx4zuU2VymnukrZ6ipli6uUza5SKl2llLpKqTG0MfBEi4stLncq6cnX"; +moduleBuffer += "zClPdlbHWDSc6VFXZZtclW10VbbBVdl6V2XrXJUNuSorN3RVYbQHRHdp5smRgWxUj8W4+SFOi/rUmAjzz34ZU14JfWrMiRkTYSl9"; +moduleBuffer += "amy0ydNj8mBOPMneAp0a01r0nDH5RLtguhNdjU5KmZPS5KS4O266E2blTooxgcdTX/Vq6utimjTqhFkhmGQKLoZ5MTn1tYumvi6m"; +moduleBuffer += "Sax2mVIiU0pp6msXTXRdHDTR1Ncumta6GCbS5NTXLpqgupim2WpkSk6mVNPU1y6a+rqYJt4KMiUlU6po6msX7dN5cdBGU1+7aHrs"; +moduleBuffer += "YpqKg6mvXTD1tQunvj6wNr4MJr6OJi8Pk+1Cu6MFucMerVYeJEYzh6ZblwexjkRLaxscGlrb4VDTugQOxdYADoXWpXDItS6DQ6q1"; +moduleBuffer += "FQ6x1jC5SbxjOcT3J8cOi393x4YSz4Kl1gYTZ8IyAbHBxDly5bVNl4cdg4nzR2HRtS/FpotHciEsP1I8u3k0cai1cjTWmhDvSgSV"; +moduleBuffer += "p8K7OhKntcbhsKU1AYdNrRVwWNdaCYfh1io49LdWw6G7tQYOna21cOhorYNDe2s9HILWBji0tDbCoaG1CQ41rc1wKLa2wKHQukhk"; +moduleBuffer += "cNlg4hjsprh0MPEbOLYPJn4Hx7bBxCNwXDKYeHVSHIPBxBE4tg4mroNjOJg4DMdFozd/946bUtNhalCWv2X0b65/4PrsdJgWhZYL"; +moduleBuffer += "Xv3jkUe+kro8zKBAmka/c+8dH4hfHmZRUA8mYHOi5OixBOwCloT9LsMyFFVYXnwTZEH88gqYrRtMPFccxHf2ioN4/SVQigcTrSk4"; +moduleBuffer += "/jDRmobjQ4nWDBx/lmjNLiD7Wcx1BjObxjymIGuFoExYtCTseSqz0SHk1JqD428SrXk4/g7WiBfHRxKtpfiqRyi7UoJpkmiKJFxK"; +moduleBuffer += "WSmhrOQpKznKSuPod677zheSLMmG0V+947P/lmZJ1o/e/4drfpFhSdaNvveeG29PkySLmGGW2Azm6MWYgUOYn+ctQGLHy+bxJXbs"; +moduleBuffer += "REmsdvSh93zvU4nLlcRqRq/5yA03xVli1aOffNXnbxXAIolVjX7mj/94h5CoV2KvjmOWjsQxC9fFMUuH4ydEaofjJ0hqlaO/+djv"; +moduleBuffer += "X5dlnFWMvvQtL/t99nIltcTot379mls1zuKjr/67ow8n58DZW0hqN5PUbiKpHT0xUju6UKktGhQfBfs0mJC7xzYPikyBPRoUmQT2"; +moduleBuffer += "kVQbSKr1JNU6kmotZbWGslpNWa1SUiVhkgxJdGjj7kvAnsBKcjfK7N6XQJv89QQa5W8m0Crfn5Bm+YkqedHop973t9+JX67N8h+O"; +moduleBuffer += "vfyl8cu1Wf78x1/+aGxam+UvfeYDsA+KV8nvIyXfQUq+jZR8y4lR8i0LVXIjKbmBlFxPSq4jJdeSVGtIqtUk1SqSaiVltYKymqCs"; +moduleBuffer += "xpVUSZgkQxIdZNWj3jpSbz2pt4HU2/gkqLdx9JffvO2XCaOueM/1X/1ayqwrvnbPj9LTuq749t/8+J+yc6j3E6Teu0i9HyL13nli"; +moduleBuffer += "1HvnQtVbS+qtIfVWk3qrSL2VJNUKkmqCpBonqS6irLZQVpspq01KqiRMkiGJbg71VpF6q0m9NaTe2idBvbWjf//Ayz+ZMSq21z58"; +moduleBuffer += "1yfTl+uK7a47H/6zblRVjX708JtelprDRH+J1HsvqfezpN67T4x6716oeitJvRWk3gSpN07qXURSbSGpNpNUm0iqjZTVBspqPWW1"; +moduleBuffer += "TkmVhEkyJNHNod44qTdB6q0g9VY+CeqtHL3hoT/fm7xc18AffeB7X00YNfBXPv/uwWldAf/kq7fdGp+DvPeTdr9J2v06afe+E6Pd"; +moduleBuffer += "+/7nV8AnvOp92evu/z8Jo0d01z0/g+4NV72PfOcf/zNlVL2vfdODb5yrVfozUu9DpN4fknofPDHqffBk1etUvV//8bvvyBhV78df"; +moduleBuffer += "d8cHs0bV+9Wf/+ZXWaOb9sd3/dPPMnPY5kdIvb8j9f6G1HvsxKj32Mmq16l6v/v3h/8rbVS9H/7g6z9lVr1H//MrP08aVe8D9//r"; +moduleBuffer += "Z+fqHb06gVk6Qlm4jrJ0OHFi+pSJk1WvXfX+5B8+9HDCqHrvf/jNXzSr3j/e9M/fjRmd32N3v+faueret5B6b6Ys3ERZOnpi1Ht0"; +moduleBuffer += "oep9GtW9r3/pa78cN+reI9984Fdxo+790i9u/VjCqHs//Pt73pmcq9tL6r2DsnAbZemWE6PeWxaq3qdR3fvBNx671xwi/cLXv/9b"; +moduleBuffer += "s9v7bzc9fL/Z7X34ux/9dGaubi+p9y7KwocoS3eeGPXeuVD1Po3q3l+87JO36ZHJmtFffv51n8sa47k/e81/fCtr1L2/++MP3pid"; +moduleBuffer += "q9tL6r2XsvBZytLdJ0a9d5+se5269+WHr/uDaAmr6mL0de/65AOiaaXqjdHr73rjkdTloapARm+88WNfEk0rqkkM9SZIZnGSWSXJ"; +moduleBuffer += "rAJldtyiHDerc1ZolUHbdGtbUBG0T7e2B4lg6XTr0iAeLJtuXUaqL5LahayWTLcuQY0HwXRrgCAIWqdbWxEXQTjdGgYdrfFCMi0n"; +moduleBuffer += "KIME7H6UmO6IxcKK0YZDQkaHH00+fzR36IA4zb1QXomzhhcekFOeidHUdGuiEC+Nif9gPfE2mIaNwSxegzgsgQnXGEx+FcVhKUyt"; +moduleBuffer += "xmDGLycOrTCJGoOJMJgbPZqEOdNb1ySar1462xYbvS8lN8xObILpzsOJMDN6d2x7WSyIjd6cmBa2PDZ6hzg2ieMRcWwOYiuSdyTC"; +moduleBuffer += "YCw5I4QTjCVmWleKQ3ymddXoj459+lWZ1szoL+695o3J1rrRD3z7yBezrenR33zhmm/9X/beBsiO6zoPfP33Xr/X76ff/APzd7sx"; +moduleBuffer += "AAYkQAx+BwQoEA/iH0zRpB2GUVLaKm2VUmENWFsEzdCqWogcR5AWm9DlsZe2IZsVj9fMEnEIZezQu8hGKY1kysKW6XjKZnaxu4yN"; +moduleBuffer += "zTIWd8NNIWU6xm4Ucc93zr3dt2f6EQBFUnICSph+9/btc8+55+eee/r2udVktNegKYIeX3HTJNmpEhrOJJlCzVk3ncZr1x3ekpvO"; +moduleBuffer += "JLvUdHKHmkm203U3XWdx55ybTiaH8GvZTSeSO9VkMqcmkj103UvXfbqXUPda11g0NFaRvt/U91v6flvf7+j7sb7f1fcH9P1B75ga"; +moduleBuffer += "8/EqeNs8YUDXXfM0EHidzhLqQJL4cKQBllAH+ncF519fpFkMV7z/lAO6yOzFP1tFqvdVL4lxfc0jYaXrReoQ1695ZHYddYfuarvu"; +moduleBuffer += "qqm7aumu2rorUQbW0BxwUwNuacBtDbhDD+zWgGc14FADrmvADQ04KgMcasB1DbihAUf0wLQGPKMBj2rAgQY8ogFXywAPa8BDGnBN"; +moduleBuffer += "Aw4wqhfU4IXj6stnlPoS76p+uRf/JCpUyr/OpHfpruMLqistp76UTtktp3TLT2jk7pz3GKlD814BmR0edb4fV0LqCMb5guoIyNv7"; +moduleBuffer += "gDyqO29eUC1pubVPy6268z2687myzg/ozg+CFxdUJCBv6wNyh+48vKDq0nJnn5a36c736c73lnU+rztX2ONxQQUCcksfkLfrzocv"; +moduleBuffer += "qCFpmXyJN7RnLRPdcqfufEJ3PlnW+Rbd+WFomDrypXSCQTUF1AT/OpNOalDb1P4+LVKNVlcLYKwFcFAL4MAGAbyodfFrWhdXtS6+"; +moduleBuffer += "Jrq4XR3s05UxBHeoA31abNfItDQyTY1MRyPTLkOmqZFpaWTaGhnor1KzfboyGr1bzfdpMaeRqWtkQo1MpJFplCETamTqGpmGRgY6"; +moduleBuffer += "P6MO9+lqj0ZmGtJT2mKvRmZIIzOskQk0MrUyZIY1MkMamZpGpmgnPmG6DH/yQrpPd4rfd58xljuzFHfZbY9ZbafOaASPaKHdv0Fo"; +moduleBuffer += "CYFtuc2wbMVWG+hWC+gRg0BuLY7abe+y2k4bBA5qBA6UIXBAI7DBXuRAZyygnzAI5BZjh932qNU2MQgojcB8GQLzGoGizdhpA91h"; +moduleBuffer += "Ab3NIJBbjdvttrdbbXcaBA5rBLaUIbBFIwC7Mam2fSmdZGC1n7ygUjYS/Bs9wTSIHcpaTOY3zZQ7qAVyQAtkVwtkXDZxvd8cvgtW"; +moduleBuffer += "IUdGzEje3/b3Q8ZM0x2NTFsj09LING923p+FVciRUWqugMzs+yFj7EakkWloZOoamfBmfYUtao+NzF42I3l/e94PGWM3Ao1MTSMz"; +moduleBuffer += "pJEZ/uD+xRRkb98ZI45xZrB4Etu3wcu4G7eP9Ws/panYr4V3W5nwHtLCe2fBfkwDztZ+gLdu8DiO4PZd/dpPa0Te147Yhiy3Iwng"; +moduleBuffer += "zPQDPLPB+/gEbh/t1z7RiLyvPbENmmVPAGdHP8BqgydyG27f3q+9cSLe167M534JTfB39pnGDuuuU3XoOk7CTfkjg1pAB7QAd7UA"; +moduleBuffer += "xzzB93N97tbIbFPb+7Q4ppG5KX+ko5Fpa2RaGpkmnNi+ztERs9Lo6xzdpZG5KX8k0sg0NDJ1jUzIdmVvn64+oZHZ09c5OqqRuSl/"; +moduleBuffer += "pKqRGdHIBBoZHHzYvUCmwqxGrjMZDl4gM8Rt9/WbDDN/5JAW2jvLnOg7c7tCxoFMhNgTG+hOC2hqEOhcIPOz0Xe5w2q71SCwra9D"; +moduleBuffer += "RAjs0QjMga8XyDSYhUEOdLsFdLdBILpAZofbzthtZ8scogMagYNlCOzTCPCJvhfUqACdtIEmFtAZg0D1ghrJlpl520mr7YRBYL5g"; +moduleBuffer += "N6bENiVTxuqQL8RO384zyVZ8G/xldceZ5Hax6tvPJDvxcdWX1eyZ5DZMcbRMOpMkir20yTNkbu7EdJjPjrvYsmQTYLKrdF4kA75H"; +moduleBuffer += "3W0/N6eOFZ7bXv7cHWofFlv2bHxX4bnZ8ud2rxv4dAJ+d5o1ZS6kk/Bvp/OnZviLT+2d5dXTaqznnEzGmk6AcBQiRUkqAadkh+Jg"; +moduleBuffer += "wl2iixDskYMupqnqQXdOrMZOMSKzYjNmxIQoMW8TYu3GxLgNia2LxQ43xSyHYoV9McoVxUGMzyuOaTypOFbyuOLQyWcVh2Q+rThC"; +moduleBuffer += "84jiWNADohOIENEC9yIOY6UJZgVX8hnO4wqnBVfybM7hSh7VkiM6fNYRnV7ElWbIa44I1lVcaeHMh7vS6v0KrjT1X8aVlt5ruJKP"; +moduleBuffer += "ccmRGXWVrgjUpU013gsXdniVeQ+kjPOvRcShzrnYd7/JvruJfy3h7nl3QW3O722mazKpKmrHcc5Fos4excuyipo46rLCkDN9WV8v"; +moduleBuffer += "6etFvbhnJdlx3KPnjrprxpU76r4h9S7Xr+b1r0m9w/Uref2rbh5Fk88s+JUV9lGnfvwbQRZbw7nKDnahUfV3PJFMtHMX4l8JEN2V"; +moduleBuffer += "6Jvy4uWgVxGzveKl7Aa+4qVDJ1OqVoGqPTQO2z3rvoQ3E/7TCzLnLVEJ13OESsDVPCV+Fydj0vVMVh1KxVV3gYop/yYEZY7COZoL"; +moduleBuffer += "SYO6HyFZGUVEsXfWX1BVVV9IIwy8K0zpnePaxkI6bNee59pwIR2yay9ybWchrdm1l7i2DbTyWhXxr0XI+TD/XMLPIf65jJ81/rmC"; +moduleBuffer += "nwH/XKWfxxEW/fZXv7L0ryvzPCUeR1z0T376K0v75vM4J7OFehWOuDALIzT+97WYdTtocpSH8fuiNy9zaUWNEOLxt0gBe29j95Rq"; +moduleBuffer += "ZpJJ9mPRZfsK0EsEmoH2B1brxQsAFaiWDWQpB7J8I0AUA0HzFSZn1V+43iNz/MgoLNioqhIaCYg/djIZaTpRBHlrehH9eP2nVivx"; +moduleBuffer += "2TofClrtOQu8RwQ/3acXZmF3emv+rRD9rRD9rRC9uhWivxWivxWivxWivxWivxWivxWivxWivxWivxWivxWivxWivxWivxWivxWi"; +moduleBuffer += "vxWivxWivxWivxWi//hC9Jc+vBD9pQ8jRH/p5kP0l24kRH/5524sRP8ries8dx9C9FfqJ1N3Btv0V4EM0ZX6xyswjJXUi/8lPnlY"; +moduleBuffer += "kxthWkMGOqm7InVxGuR1V6VuLK3mdYsB16k0zOuWpG42red1y1RXQR8eEt5peFSHYk2Kq1UpBhpKTYpVjZAuhlJcCaVY10UBH9vg"; +moduleBuffer += "F6sF8GtF8MtF8FeL4FeL4FcF/JgNfqkI/koR/EoR/GJYAL9WBL8m4JUNfrkI/moR/GoR/FIR/JUi+CsCftYGv1IEv1grgF8rgl8u"; +moduleBuffer += "gr+6buyhEzRV+wT/P7z3p+/9/nvv/b//9XM4dKly/B/8c+Qg/Pp7//g5DYnaov69937/b//r997751MahCfVL73z27/1M2+8eu47"; +moduleBuffer += "FU2mK/Vf/3svvPj7V//gn7yl69ccqf9f/tev/tJb/+7/+unf1fVXKlL/S7/33u/+2j99bXGzHh5gCDtHQg9TTs6Bn/qnlf/oBZwT"; +moduleBuffer += "QuVlH6fl4EeQVnFd89OQnrnEz5xO66fTCAkjr0ffYjl9V/vQd8XrQ59XTt+qV0rfMlV7qvbYBfp93lAZEHGnabIGtZ6m7mqQNqjN"; +moduleBuffer += "ZWkTqvpjNABt3LlCA8CHphCEgO9WVfQYIPBwrASn0w5O5aDfi9S0Tu3OCRSqWaLRRN53n7u8/igteaWjtNhnlK72kYIrbvkorbml"; +moduleBuffer += "o7RC1TVVfxSjdNYegdNpzIPjgS5PhTyONCPJOLaYqC6LuMvj2Htbnm6qNgSoyQ/7enRWqyQqNINUGco1GctANQBFC9tilfnSu2gG"; +moduleBuffer += "upMP9KoM9MBpMIpG1mP+9M57ZqyXvZsb62W3dKyX3PKxXuwz1lf7aZxTOtbkR9FYt3mszwnuDdVmMgd5CJiuumrIKEmLuoqZqCEW"; +moduleBuffer += "SM2NAW5xydXc6ObcWHOEG9cML5vgxgCDD8z41cCfQEWMyaWqbsmSrRm2xgyrgs8QjKpmWOuxnGFLmmGXShi2Rl0Nn05HTqejxDnm"; +moduleBuffer += "kMsC1bvoGp6tuDfHsxWnlGfLTjnPlpxyni324dnVciu5VgHPYh6G84J7R8VM6RiPAtPVBvEYKOFZWw0yUZtYCVzh6ii3eNtwdSjn"; +moduleBuffer += "6prm6gi3uOwUuDqCFp8Vpp4NtNAMgKmj3H+gB/hKDRLA/IZ41XTLpnCM+b5c4PvlMr5fKfD9XBnflzXfLxu+D+d8vyJ833w6Hac1"; +moduleBuffer += "h5a7FYflu3fJMaxfdW6O9cdOlnF+rpzxqpzvcSnby1h+ltmcTDHzHFpDkzYx6okCA+VuAoKYl7SgJrHmkUq2oK38nEEtcyHZilr5"; +moduleBuffer += "uQ21vBZMtvNIhMks62ZI63GUa8ltXK4lt7NouMlOjLV0ugvYCaA70L/83I1agTmHWvm5hx8Pk70sJWGyj8u1ZD/zyUkOcDdOchBP"; +moduleBuffer += "C3nzkHH5OclPOckhSIFU3Qni5edhoCSdH0ED6fEu1MrPT3AnYXKUBSZM7sb1yeQYLnHSo4Zj3O44KlTySaqY5Yp7UDGX3EsVh7ji"; +moduleBuffer += "PlBU4Z/3Y1EAzcIYiiwNqEEWvge4HwenzcXaOJ4TZY3V2KOZsi5qZZ0QA+tqZd2UK+sVrazjooolyrrq6Yk+0MZgNNPFlRAS34Di"; +moduleBuffer += "YqxqukFXlIe19GpBS8+XaelKQUvfLtPSqwUtPV+mpStaS99er6We2iyGqKLNzIhMwmKuRXPZLTomWntZ2tVQ9UhKSlvjsZig9SwN"; +moduleBuffer += "g7pXHUJQgBCZVL56gO9Ngg/TNPQYxamcBaTqaqe6Xd2mdqhZGhiyYmo78XCUb4+CNzJ426xRy8drqzVQ+RDNWGOTj8oWeziEeKK9"; +moduleBuffer += "ziY2NQxlDxZfhmNEEiMIxGcejTaYOciycj++zxdog/PeRdD9SXVQHdAeTVVcxhG1X+1TezE/EAZ7iG4hLMaACmFzOWFVSIQQtruU"; +moduleBuffer += "sDtywrqgoqWGHkPUsm4ICyGINdCmFF3HBPkaBsGHW6HupOuk1PoglLVF3UeEDgiE9ry3CmJ66hh1SoJAf8PH2F+4Wx1FRgFq/wm6"; +moduleBuffer += "xjYhHWp3l5nvCTOMbBNkqSM5IU1IsziWh41HqVH2mbx5uqvJY5RbjPI9dFeT15r3LgE5nu0IBJxFgkk+vMhvqOVXcGN//WoIyasC"; +moduleBuffer += "B+hFqPWimqHkZb7utYrt62qlqYCUCAio4xZ6895anWNfhIL0T1OX7uSadOKz13v6NE5S5fpi3/PeZdiMxfpCigTnK/WF+JuOQmRi"; +moduleBuffer += "Ln5uMzzGOgIU/y0CFJ9CgGKlbpKjr8pCUgIUHKng5ajHAQoXwYPQLFE9DlDAxHIwQtddlboxDmToOgQoYHk5GKHrlqRuNm3kdcuB"; +moduleBuffer += "DoIEZpHscYAiMOtejwMUgVkVexygCMwS2uMARWBWxR4HKFBs6GJgxVM0+MVqAfxaEfxyEfzVIvjVIvjVQIdmLPBLRfBXiuBXiuAX"; +moduleBuffer += "wwL4tSL4NRPlscAvF8FfLYJfLYJfKoK/UgR/xQSMLPArRfCLtQL4tSL45SL4q+vGnsTC4wBFcB3/yysPUHh9AhRenwCF1ydA4ZUH"; +moduleBuffer += "KDwOUHgmQBEAWStAUUUZAQq+sRzQ1OJxgIIc6SxA0WClD69LX2mAwusToPD6BCi8PgEKrzxA4XGAgu0t/T5vqKzqAIUnAQqm7mpA"; +moduleBuffer += "9tEzAQpeH8LgeRKg6PBgmABFTQywDAcCFDGvLSRAQdbTBCg8HaAIjRd+/VEqDVB4fQIUXp8AhdcnQOGVByg4G5MYf/p91h4BOAae"; +moduleBuffer += "BCgaNHB1HkcdoAh0gGKARdzlcTQBCl6rYfL1JEDBo4MARVMbb88EKKqYqE6f1sImAQrPBChqehXIA70qAz2IicwzAQrPBCg8HaC4"; +moduleBuffer += "ibEuDVB4fQIUXp8AhdcnQOGVByg4IzCNdZvHWgcoIh2gGOIhYLoamBgxSiaEYRaqngQowI1BbqEDFAGvVzU3EKAAN64ZXnagzoMM"; +moduleBuffer += "PjDjVwN/quwceSZAUTeuBTNsjRlWY2fPMwGKqvEdmGFLmmGXShiGAMUou6TDcDs9CVB0wV7X8IwDFDfBs9IAhdcnQOH1CVB4fQIU"; +moduleBuffer += "XnmAwuMARcjOpWcCFLH4mLSi8SRA0UX2I+ZIFqCQFc1mVgJXuDrMLd42XB3JubqmuTrGLXSAwnB1DC0+K0zVAYqI4x/pMPcf6AFG"; +moduleBuffer += "gGJA+A3xqumW2otkvi8X+H65jO9XCnw/V8b3Zc33y4bvoznfrwjfJToxqeUOAYohCIpjWM8BiptgfVmAwisPUHjlAQqvPEDhlbFc"; +moduleBuffer += "xx2mIK0SbJiGQlV1jMIzcYcEtTUdo/BM3GELExgmM6xyYbKVy7VkG5dryXbmuJvMYggl7rADciE/bwOXBebtQEV+7kRtqGMUnglB"; +moduleBuffer += "3MGQwmQ3y0GYzHG5luxhTjjJXoCViMI+FkQn2Q+UpeoAYEqnB4FKTccoPBNvOITaUMcmPI43HGb+h8kRXJ9M7gK0io5IeBzuOAqo"; +moduleBuffer += "0sHdjJaTHANIqepBiRwdmvD0CiL5JPAMdXwCeIbJvbgiOuGJp5/cj4o4eYAqJLRxAhUq+RGqkNDGg6iYS3DuhIQ2HlJgpl5fe1hd"; +moduleBuffer += "ZzKX/igqjmE1E0JVwT0RzkGsAkkmH2ZKHQQEutra6ohHV8czxGJr7Z8Ui20iHpsfzezDFa39E6LbJdq/6mnPIdDWZThTbkQ8BkmJ"; +moduleBuffer += "BxhFHfGIzfKS1f5qQe3Pl6n9SkHt3y5T+6sFtT9fpvYrWu3fXq/2AcchPBPxCMxKWex/FqucnPcWEYX9FC2G96tZtV1tU1vVDJEz"; +moduleBuffer += "yAGFQaabJ4xAk5xatOZUJhZ5OWHKoiinZdomQlAmjBtsaacMG9iRNXGK2/I4RRuD32XqDtJVxzS6YH3I/DxO14cfNSvvEYQDZF6u"; +moduleBuffer += "6EXrj+qRmPfOgvQfoUX/Xu0F1cTNHFN71JzaTaOGCeQOumaj4OtR2JWPQgDsZRR2lo7C7fkoDIBkWfXvIEpb2dg0INHU9gDi6NnS"; +moduleBuffer += "vaU1oQdKHzP0x2qEA+sP0d0RHSyZ95ZAzAMcpCBem/jMoDqiDhPRgQ6NCCFDIITX+uoQdqpkhISIUD2GQIVNSFVCHGqf8UI5fFHX"; +moduleBuffer += "hNyNVINWJIdnYvWgTL86qHEOyN1HSA0yajVx5u/ViCEAInNzR7QfiH1Sx2UEhUC/IvoEghlZXKUqXasTeQymNu8to7OAXToBgeiL"; +moduleBuffer += "2AITuOjYgYv7sRXmUQlZnK8rBCAWJVjhIWoxU4mWsk0UJTGKwMQo/JIYhV8SozAxBTtGYQIBdozCrN7tGIVZcpsYhW/FPAKeTO0Y"; +moduleBuffer += "hV+MUfjFGIVfjFH4JTEKC/xitQB+rQh+uQj+ahH8ahF8FqOwwC8VwV8pgl8pgl8MC+DXiuCzGIUFfrkI/moR/GoR/FIR/JUi+CxG"; +moduleBuffer += "YYFfKYJfrBXArxXBLxfBX1039lmMwi+4YEGfGEVQHqMI+sQogj4xiqBPjCK4TozC1zGK4DTvM8hjFP5NxijK6Fssp+9qH/queH3o"; +moduleBuffer += "88rpW/VK6UOMwi/GKHwdo2ibGIXfN0bRMTGK1vcRowjgFAUljnjZKC15paO02GeUrvaRgitu+SituaWjdGMxCr8Yo9Ah4zxG4ass"; +moduleBuffer += "RtGSVXHrg8QoEHi4wRhFR62LUdzUWC+7pWO95JaP9WKfsb7aT+Oc0rGWGEWnGKPoFGMUnX4xiuE8RuEXYxT++hgFuJHFKFrlMYrW"; +moduleBuffer += "jcUo2sUYRXtdjAIM6xejGDFuav8YxU3xbMUp5dmyU86zJaecZ4t9eHa13EreWIyiU4xRdNbHKDraL7ZiFMM5V9c0V0ftGIXh6qiO"; +moduleBuffer += "UYCpxRjFWGmMolWMUbTWxShaNxajaBdjFDbflzXfsxjFSDFGMXJDMYqbYv2xk2WcnytnvCrne1zK9jKW65X7tF7XIyqh1/WISuhg"; +moduleBuffer += "AqISOpixRWXBjBmVBTO2qiyYsU1lwYztKgtmzOpgxg4dzLhNBzNu18GMnTqYgaiEDmbcobIIxm6VRTDmVBbB2KOyCMZeHcHYpyMY"; +moduleBuffer += "+3UE44COYBzUUQVEJXRUAVEJHUKY0gGGO1UWYDisspDHEZUFNRCnOGd2TmRBjaM6qHG3Dmock6BGTyINiE+MmfAEIg33KBNpuFci"; +moduleBuffer += "DQhOHDLBCbOJ4gHs5SsPKZwwIYWgX0hhUx5S6BRDCh0dUthsQgqdjSEFS1k3hBTGMl28iZBCqxhSsLV0paCl7xtSaBdDCraWrmgt"; +moduleBuffer += "fXu9lvrFkIIvb/qNuRbN9XUIB1p72bxt5jAPKW0oGyV0yOE+Xo+SItOaP1An+N4U+KBo6DGK0zkLsDDdlW2jkODELPEw22PR1YO3"; +moduleBuffer += "fUNwosVbK/KByodo64bgRJu3VljDIcRzcAImdothKHuwbRKAcd5aoQXB7CfpgJlDLCsPYGUr0IZ0vOEeWlwfLMYbRmnZj20UMU8X"; +moduleBuffer += "e4luIaybxxv25ITVIBFC2FwpYbvXxRvaHOW+w+y71PEGjh2ohK6bsmgJtmFgU99huk49aoICbdEWWid3TGyio+MNx1WPOh214w3H"; +moduleBuffer += "1N1ENKg7SteuTQi2iHzCzPe8G6RGXh/iDXflhLQgzeJYHsnjDXUJxoO8Q9hB8liOsuxDvBcr/myHB8cbeLYjEHAWeX9IVeTXBAEE"; +moduleBuffer += "N3knFkLyahxMMCFQHacQlPzM19WbKDLMWGkqIKXJ4ZBPWujpWIRs/uD+T8seHZXFIgITi6jpFUex734Rif9q2O08N4qIxLJrIhI0"; +moduleBuffer += "2Tnxb5iFm8s/D7ifwykpB9zPYLY54J7GTHPA/TQOOjrgfh6TzQH3URx3dMB9Gsb7gPsIJrAD7pOYvw64n8KZOQfcJzCFHXAfwMk5"; +moduleBuffer += "B9zHcW7SAfceHJuEH5+FhTvgHktHnk0Hj/Ih1WoQ3+alrhpQqHwZm0CG1fiz6dDLfKTKmayNcpR7At/rDOmS/+ACWo+ozfIgYJgH"; +moduleBuffer += "CcamZ9PRl/lUHT4c21HBCTIPGSh5WGC5AstVo1wkDqDoE+hEQAdqswFdpV406Br1MvZsmtLPuj6K21HhCYEuQEkaBzXMwO4xkC5M"; +moduleBuffer += "j8RG6ZG/ZUTsCsWAEFCCQFWNA5ch7nUTKAYCIeFiECBcpp9Nt9HPSA6yxoeJBVwEB9KEQRsFg5FGwWBEYmZjFBqMtnGRlAXFKiE4"; +moduleBuffer += "JQjWCEElCJKlAK6jjNUYcAWCDcLVIEi4Tj6bbqefLX34tqOaJbgKjjAsNooGY42iwVijaDAmxbMxbhiMt3ORzAiKZLjVViEgJAKm"; +moduleBuffer += "hIA6EaCEAPKqQUvKWG82BDSJFkMA0TLxbDpLPzv6QHFHtfvSIjSQYR60STAUaRIMRZoEQ5EmwVAUqaZNUdNQNMtFWiWjSNZbzTyb"; +moduleBuffer += "jjBV44bWBhGoaY2IQE1rk6ZSTWuLaJ0UWttE64TQ2iFatzybDtPPrj5E3VHxdWgVGhGMtkl09ABoEl09AJpEXw+AJjHQA6BJrOoB"; +moduleBuffer += "aKm2UCwD0DYUD3Oxo7oogmoagHFN9VZBH1RPybCAaq1kLTVplKxNAzAhw9KhASCqB4Tq5ZuhWqgl2sdtYh2NoSbW1SOjifX1yGhi"; +moduleBuffer += "jbnTxFb1yGhia2rAJhaaNyOoQvOI2E1M9xQEd5zpngSxw0z3BIgd0dwmCjeDbn1O+g3ztaMxyPi6qcjX8SJfh4t8HSnydXORr2OG"; +moduleBuffer += "mJB4RMSMMV2T4JzQNQFiNjNdCShIQJc+8d1RnetpYUvjnmnhWFELNxW1cHNRC5OiFk4bZGuEISE7zXhPAFnBWwFDBbz12fSOavW3"; +moduleBuffer += "eZHGLbN500WbV0DVV6po8yYNMlXCgJCZZLymgMEU8JJj0vF5btkMUdd9ZzPEZHGGmCrOEBOms4A8X+psQmbdV6WHenE+NBKbzYcT"; +moduleBuffer += "xflwiwHm66PdB/SEXTuxYAPCAfC9Cs7LQtSrV+mtVuKXnM34Ip5+3u8f0+EwZ0GHZBx87spf2uP4KQdfySodM8Ozz6XS3ov/rQ+4"; +moduleBuffer += "9A9fbbvucxKGo4dxEFrvXflZlTU7ftbo53flZ+geo2f8ZiXqVegPTkzDYv84fxnM0T/z81z287h8Kc/Her2oD9TlacTVU2Ogp/NQ"; +moduleBuffer += "uxg17dBUtXNErseiw3QrIRvBxPcnu4fvMXUYQvCJFwS/rGJsIVvicoWsbuXeO0KtI10Q07ze8ovfrMT/Hkd0yYfv08/E/yiM33El"; +moduleBuffer += "FEqO6NkZt/6cA0c0PpmGMxX3OfdY/j9V6f2Z87BPo0e/fu+9//LhVg05QCMSkN7nTxEnzl56rUJ9pvV7W35vOqnhy/mTiU9t3n3v"; +moduleBuffer += "vdpDRHfQq1K/4TN/I62cfKbnnKJbztMne0cXklqkaj336d47r71WAeKpcy96SipNFx9KE6TeJmrhPHOSoNZ60/ePP514HrByZl2f"; +moduleBuffer += "+ictCpCklC4n6bf/MP12EldVU79VAcOpVGn6nCVmiBqgJQZn8pmef2qBxpY7vX8cN8YTjKBDPSinVYmIH70zmja3FzPNvWsesI9O"; +moduleBuffer += "jKdBz3smrTxDo+Cd8hmj3nM/wcSRivW8p9NK77vfIqpSjx448zuGvlk3TH0IA62zkXGChSo0fSm396yq/uQpkgokxqr0vKfkWDXi"; +moduleBuffer += "ZQV5Wf2ewzU0nAtNGr2g97yg+FDLY27xABqWVO5tEcmPF0bYlYETHrmJw6NJlXFaobFzMUz4QYiOJTUBiUIzrdzHOQqGerEMZmVc"; +moduleBuffer += "4LUczTDFxLmqIufCuUIXHsGH8yTGlXEwTyFPjkvDQ9UVrgY0l+5REdBdA5jGoNqr8FjUSLgEkYmMGpDC5qTWi3tDqjaLPB73jS8o"; +moduleBuffer += "ViqiPQDjXV1seTwsZmxonAGMhxrNKtmwpMgeQf9OACcee8KINIosThPH4pEhIZhPk1EicTn5FNj09KnHhedOxnMn53nlJngOiTc8"; +moduleBuffer += "x7mjWBvR4lBzvcLGgxoarqc+oBLe0i/ZxhfkBqxjJr1Bj1ZkJK5Pp/4piAf3Slaej/xzmEeEYgRlYa6BfuDp4ohCXIBuxKBh2qR3"; +moduleBuffer += "xoM4RnIYAu8aJ1WBHLmEE7M/lsEf09rn3otswrgxZG6wfPm9+GFOqGtId0A6DZKmmn4tAIWc6uq9LYdEIyO70pfsKpNdzcmm2YzJ"; +moduleBuffer += "roDsCpNd1cJKpkGTXZFL1UgwBosUsJ82gpMvmCGRwfFFgzE6VYyO+5QYNpdkpwbbQM+T7NRPQUe9dTqaQBCIxMjjgTSySUMiRu5E"; +moduleBuffer += "WhunGa+CwYa+swYlDmSd902cIN1MIMVVhHHGoXc0qFBrmmGYC5nZSCsPKZa1kw+fEvU3Wu+ioLXeFb20tN7Jtd6FeDtG6x09Zi7U"; +moduleBuffer += "212n9c56rXdyrXcM4KLWu4KIpfXORq13ba332BQZrXfWa72bab0bWbNcPiLOgzxlLZkBepiL/3DRX+gtLp4+hbngmWOYm0Katknj"; +moduleBuffer += "K5wxqAc9xn0i57n7yHSIlYaGxE8rFMHzkDhJLGvVN+NnM6n2XoS0hGwh+Dd1ScKF1svAe9lMQIpV5wTgAN/eOXODxOodUoKkwhmH"; +moduleBuffer += "uM5jiUlrC0i3wtYHrMeUet4QBcSU89A4pBKV4Bu5Rq+gz/em0f21bxltv/otLdDcEbfsnSXjxsqHwhIKMHconLHvnEPheX3nebvZ"; +moduleBuffer += "Mgov6MILdrPzKLyoCy/azVZQeEkXXrKbXUThFV14xW62isKruvCq3ewSCl/Tha/ZzV6z76yh8JouvG4XLqPwui68YReuoPCGLrxp"; +moduleBuffer += "F95G4U1deMsuXEXhLV14xy5cQ+EdXXjXLix++zWpQeG7v2MVzuLOd3VhCYUz39b8se+cQ+F5fed5u9kyCi/owgt2s/MovKgLL9rN"; +moduleBuffer += "VlB4SRdesptdROEVXXjFbraKwqu68Krd7BIKX9OFr9nN1lB4TRdes5tdRuF1XXjdbnYFhTd04Q272dsovKkLb9rNrqLwli68ZTe7"; +moduleBuffer += "hsI7uvCO3WwRGvSuLrxrNzvHatbrLMCU07zJ5xITK75tPbDEc0dvFpmtSJlPLtAEwtYAs4Bx/ZS30JulX72X0Nfi4iI0EpMwufS8"; +moduleBuffer += "onvoqRZPT004DjDrdHlGVe9reWIBcjOg+Gs+tiqY5RYSTxsT2BgYbTEotftlkoEhcciORKXQaRY0lojnD7FFMJ+uACJzWTvR0vNu"; +moduleBuffer += "UuFsSBtHxSsORH3dQHjWQNRLBkKyNp2Ec0DA2GrSdEMOu9eDTWYUd9Ac2+ClVe9dKc4z5Ma8G17H8KE9r9LknOOJBTa8lV5NvCEf"; +moduleBuffer += "ngERWWFu3NfC2d8epu9nTwFlPmuasMo8G5mlaF0ow1SJ/8hhd4pWsJlPZ7k0NNRYFJBLU8ldGsJjvSdXMZ5cZZ0nh8kK6wahRokX"; +moduleBuffer += "Q4yX2Yq5wJKZ+WK1vBLoww06mQTEGj0BkVBR4QVTIFg8xdGiqOfcxy4vlompE3/LYb+Oc+zSKKEZXBbcl7GBV+Jkri/W1qiRkcEu"; +moduleBuffer += "PRqZKhY8/UcmWO/jEmrrR8YT1yCUsdceCy4eRiaIRPLgEKWO0dpssmWf3BUhc3JkjV8ovnDmi1Z47YQFRa9Dy2Cu71WMi9gT1hMc"; +moduleBuffer += "y6t0ZF2beZXsS7KZeEGjtcD6ATGy1wSuwNKYRIIKs5k4COauo0Prm5NZIVBtXB6wxwNc0TpnPb2l5sfTqlzZAC3QICoGROYu52Px"; +moduleBuffer += "fL+2Qh47J/x1Mvqp5L6ZCh5quZu/X5652fqF18EOC5wjaSFl/cKuryPrF0fSRur1i1m95BojSpKtXipm9UI1Rph9CDP16r+PMG9Y"; +moduleBuffer += "sN20MPOCYN3KxS2uXGRQI3JlY0SC/u1md/TZo8+pYNbdmRyAKu9MDqI0m8yjNJscQmkmuROlmeQwSio5gpJK7kJpIvkEShPJUZTG"; +moduleBuffer += "krtRGkuOoTSU9FAaSo6jFCefRClO7kGpmdyLUjO5D6UwuR+lMHkAJT85wWYl+RGUKjA/uDwItiDEAwOL1B+4TKEUIvsJLgqlJrKe"; +moduleBuffer += "4JKiFCPbCS4zKA0hywku21AaQ3YTXGZRmkBuE1xuQ0khswkuO1HC2TQuLnegNItkJrjMobQTSUxw2QtOzLpz6ad6/KOS7utBrdKH"; +moduleBuffer += "etPPnEr301x3Ci3n0h9V+3tU7556Kt1/0P0cx+r20D21l2oePuh+lmt2o2aOah456H6Ga3ah5g6q+bGD7qe55nbU7KSaHz/oPso1"; +moduleBuffer += "O1BzG9X8pYPuI1yzHTWzVPPoQfdTXLMVNduo5i8fdB/gmi2omaGaxw6693BNgpqUav7KQUQFqWYaNYpqPo18rKiZRM0U1fxVpGaF"; +moduleBuffer += "yvmnqHof1fw1ZGlFm4dOYXI6tcAZD+eo6q/2oBvP/cQFZPysvqwwKPwICekpUulTF9QUbqvqcXU2bzF56in+LsBRf+1USiZrkhbG"; +moduleBuffer += "2OnxMj03/bSaJK+ERPxx6kCVPD1NT9Ojnz5FMGp8hx6cxIO+PPgEPZiWPJjIg3+l8KDd45P04EzJg1vkwcf69vg0Pbit5MGt8uBf"; +moduleBuffer += "7tvj5+nB2ZIHt8uDj/bt8TQ9eFvJgzvkwb/Ut8dF+I07S568XZ788b5dnsGTd5Q8uUue/LG+fZ7Fk3MlT+6WJx/p2+fzeHJvyZN7"; +moduleBuffer += "5MmHC09OWX0u4cmafs2xH4986tQCA3lZ/SgBXCA4eNGCaXDx86dMh+fwGOM+JRUvOCz6BwDhIEk2gX+ayvMoH6Iy9fkMybvyLxyv"; +moduleBuffer += "4BncvBM3D9PNab65A7em5dYR3LqLbim+dRtuKbn1Cdw6SrcSvnU7biVy627cOka3Ur61E7dSudXDreN0awvf2oVbW+TWJ3HrHro1"; +moduleBuffer += "w7fuwK0ZuXUvbt1Ht7byrd24tVVu3Y9bD9CtbXxrDre2ya0TuPUjdGs739qDW9vlVoBbD9KtWb61F7dm6Va678LxP/2DF/6k+YUU"; +moduleBuffer += "Y/+F4+85X/zC8f/7N1e+0/5CWstr/r9/9s1v+V9Iw7zmN3/57dXgC2k9r/nj//3NX+18IW3kNT/1yz/9TwhylNe8R/9Rm+aGmtaG"; +moduleBuffer += "mvaGms6GmnhDTfdlkrDpZ8jwdSFLJ3vvkaWDEIVkysaRwbqCXXIvKxRmoaWqI4UZKtyu2lJQ0ELVksIEFXapphTGoGUqksIQFXar"; +moduleBuffer += "hhRiaJGqSwG+wh4VSgGrhb2qJgU4C/tUVQrkMhAnDhI76HJILoflcpdcjsrlmFyOy+Ueudwnlwfk8iNyefCCxbnTFs9OW9w6bfHp"; +moduleBuffer += "tMWh0xZvTltcOW3x47TFidMWD+h3N/udDnzheHj25d7Y32TlS6vED2bRF0+rWP9S1dOqY/1uW79b1m+/B0E6TbNVM4Ph9yBuz1Fd"; +moduleBuffer += "ZNWxUFJdw6pj0aW6ulUHAX+W6kKrDmqAPmqmLhWTJuYr5L91/tvgvxH/bfLfFv9t898O/8WoqIEvvLwg9vCA2MNJ2MNY28h5qZtC"; +moduleBuffer += "XUfX3Sl106hr67ojUqdQ19J1n5C6BHVNXXe31KWoi3RdT+q2oK6h6z4pdTOoq+u6e6VuK+pCXXe/1G1jG67rTqDOGPmA7AkfPHGK"; +moduleBuffer += "U4OfQOvtp7Bv8PsdORJjIyT0s5P/bOc/W/nPZv4zyn828p/1/GeY/6zlP6v5Ty+ziJk0ZxZxYINFHNxgEYc2WMThDRZxZIPdGt1Q"; +moduleBuffer += "M7ahZtOGms0basY31EzkNVohHRLBU/xWldg38fIpmkYvcbiKxBB8Heeq16SqzVWbuWpVqlpctYmrviZVTa4a46qLUhVx1ShXvSpV"; +moduleBuffer += "Da4a4aoVqapz1TBXvSJVIVcNcdV5qapx1SBXvSRVVa4a4KplqWKh7HLNi070M7eWXLeWXLeWXLeWXLeWXLeWXD8USy7HXmTZqys9"; +moduleBuffer += "U1urq+9JTX1Dm8aGmo9wdZWtpWJrLUUOxD6yZdZqqmOvptr2aqplr6aa9moqsldTDXs1VbdXU6G9mqrZq6lqvprCQlbtO9lzfuLW"; +moduleBuffer += "guqGFlRN6zdeoNmLqIZ1z7jNmdOcucx099by6D/V5ZEJteS2LF8X2Qsi3c5aEGmzNryhza0F0Ue/IHp33HWeO4rdyKu1dacdyYFD"; +moduleBuffer += "nKhHH2az5ltZbszhQr6VPtecCOTrfDK1vG7RJIEJ87plnYBHH3S0onMG6yKS3ljHKiFJjXVSkkkwbJ1YVMuLSI4T5sUVfdccAaTv"; +moduleBuffer += "6uIVXdQH+iB9UNUiUB+1ZE5j0olrNGSTeViDuqo7ss4GAmRz8pIkMFoK1mXT9coOH/G52w2Hj+jqDYeP6PoNh494Ur/h8BFdv/4g"; +moduleBuffer += "C28hy1qPBPacVic87nxZH90geWqyA4HkOCB82v8FmiU8/jz0+qSteqWkIW1KGWlI8VFKWqWUtDKykN+HD56QE2fW/BSvYk1ynRrR"; +moduleBuffer += "R2y6++wZfDZdRe7v00L8ki/pIgL7fCCd2sacOuPJiFzOjplZ8zAiNz4cy+XDseT14bTXZzjcPpx2SzmN1EZyJk5H8pvnxwDIcTD6"; +moduleBuffer += "/A5ff9TO3wRn5x2FcuATZiQau5qMXc0ccYT8+g05G8Qvfvtbl+Mq7FG95BVHdYQH1uS/4SOY7PH0rzueK27peC73Ea8lt3w8F/uM"; +moduleBuffer += "51WnXHOcBX1eTRcZ+eRkCLeQ5WdEDtWQ3GyRfZiSziJvH6bEmf/kaJRl/u47OzsplLOT2ubspIY5ZQoyfT5j4WOS8IPY0xT2DHIa"; +moduleBuffer += "u6Y5G6klQ66yE5Kq+sNqfJQPDlzKDuFZdbE//MY5sOqUcmDFKefAch8FX3LKObBYzgH+hpsznoziw3eRaJOFdiQ/3+NJYcDQdc5P"; +moduleBuffer += "qnF2i+zgjJpOEoPjiXTGn4YwIjs2qZadQoWMfHICiTmLJ7LO7rgKXlk2Z1AnbMgOd2px/oHs+KcsW2DTnJGU804n+anKt/kZ7y5n"; +moduleBuffer += "p+isOTfHu7VKKe+OnSxl3Vw551Q54+JSvkkeE5xvIHlyknFlDpNKJpQ5QkgfNlOVE3dWqgiAIolIsu64nWsmaUzhuJ1z2XE7yJCF"; +moduleBuffer += "kChSeySePr0HB+7oxDPb5QgYHLhj0tPsUOagGBy7o7M4yck7V6p88o5ORLNLn5aDY3d0opfd+ogcnLmjs7vskWNocOaOyQGzT5nD"; +moduleBuffer += "anDyjs5Eog/fqSUjciAOzuCRXC7zciAOjt2RXC53yoE4OHHnkE4bg7NZ+LCdSya1rSuHsxxFOpDHLqR3mxO8uio7M0qEPD1mTueK"; +moduleBuffer += "9UEebp56Sie5rJnT2DoqO6pNSzmtWEi2I5HtiFRrU8mZVnoqqEB9An1u3LV1qVcDczDWoJwXp7Kjs0KTuSI0p2vlSqNTRxWVBomR"; +moduleBuffer += "cqXR6ZGqJiHLkChNlqcFZ2mZMwRIpea9pRrCUWqvmlVKRZx0ZFx11d06bdS0mtLHf03S4B4zOVZ8PXoT1rBhxUaj05DRaeTJNjhR"; +moduleBuffer += "ttpMFQNZAg+caTPIGWQDk0eEmSKjcZs1DDIAMGn7Lcolw4kMi04uU1VHheaBee8cqDqs5tQ2nQlNIzOIeLlOSTJD1zGTArWqthhS"; +moduleBuffer += "yJIQGR0z8TfkgKNhSTrS5fy2dXOITV0SlGB8dkiKWE1JR1OybwMlA5y5NKdk3lsGsoc4KYskKdEnvcjRNruUJ/k/iOKdms+3E7FD"; +moduleBuffer += "JpuKB3R9QTcGJXJ8znbQLH34oENyxu2RrC4ay7rG8oiF5bx3Hvgc1I6OOC+EzYg6oORMNvGMPOnRI5JAtuSGDXA6ktotI2x1jTNn"; +moduleBuffer += "7pRDCrjreW8FndhdIEmLnCEn+Yz0wUw8xZ8+rSHPZ5DnvYs1vKRAMlMkQ+HTT2cq0e9ucpvP+eaM2+oMv8eQb5nC8aTGX+TRj4jT"; +moduleBuffer += "wtK/B8cT1/5KNfuOB/dDbPZOHuYvbn/KfZi/FTtfX+CEuR5vV0/D3qV/941K/HeJiFl3pZ40cX2lntRxPV9PWri+Wk/gFWIbZdi7"; +moduleBuffer += "XGgf6fZt3b5DXSClaUOeS2O8a0m78es0WkjQldbwUSo1xXc+wcP+cyicCROGdzYkw4Kt0E2IvYrjBwVa/C2PfswhVwE2xL4NDP6P"; +moduleBuffer += "Kp6Yw5/91wUY/zS6n8X3wt/Dh6sE5FoOZCfNNnSZVbUk0KBcgDomIKSSQLoy6q5AI7yoWSX+doBVe/wv3Rt4HE1bSLCs2jZt138Q"; +moduleBuffer += "4YGsZ2UG4uyfZzTMCA3q5miAMLg82oRV/HdJPnZVzhPrkZ6N/q5AVvQRR+AH42214nSvfD9+I0C4ueecbLu+h0563tP8dTo+eQvu"; +moduleBuffer += "bZE88BfdjPfFfOxDkbgmCRq+Ra9hQhw8XkkGSAPmTqb1mYqW58FH8FmeauE7ajchLzrxCXJIpToAN+hBWs4PwnHx1YDyeQYbUvUd"; +moduleBuffer += "XsgTRUUNsT2qk68D/RyQZFbJAIm0c5IANggMxBwXn79BbxENpJje06mPBiSWC9zpwCMtUgR8rpj3NIgewl7IDRmEHNeVDPC3stRt"; +moduleBuffer += "BSH3es9BSL3eO/PuN7BxWtWP+/PEtTr5D72rf0bD8ks1bj1HxgD7wxdpqHpbe+cxYv/Kr2Dff4jvDkh5F4jlON08qUkXVTgUNO/W"; +moduleBuffer += "eFO8919A8fijUXykHZ9lc3GSl3c0/T04jgxZSFDhPdiCduErebjWAdG7oJpoX4VvCTvu9S4ZSYMzlLJys2TdI+1o5UXgoGhnIeI+"; +moduleBuffer += "PtsxXddkG737YMuHxPFx5tjxjW5q8vihBU5xRfN81g1OS2fbcgh/7pJ25/jIe2JV/DNAec1DfgzqV4q0YsPSiwT5tyDbqz4yf7RU"; +moduleBuffer += "IEVaGdD8THIT/49ojIgW2RgpkBwDw94hSLrRiropQtF5TON/g1wGLanHPnfdgJQFp2dIgyrW6jKS8W+FVFyuLnDy9w768lTbPN6Q"; +moduleBuffer += "H0EOOYj/N49NLN+QLt/AjY55Jur3TNO+8QawII+dZYGxwKDV4z9BPc03fCCyF1/GXKKpBIyWNLiEY7J7rtxuGVxcssZ0O6d6V+Vy"; +moduleBuffer += "nUyMc38Lndbi8yG+SsEp79o4ncuNU4w/Q/hzJUxrPf8hWGlk0mar9LWQ5jW6roaR4h/n6mlgGl3Tjd7VJuwaNQriB7Gn//1NsF9m"; +moduleBuffer += "/XyYYF8j4pYg4hpEXI2IW4KIaxBxixPUmCH9fE76RFLBZUxjFdhY1TRWAX92QWSdZ6pIGuPFqsiV/FjkH01qh4+1LgL6y7AFkNnL"; +moduleBuffer += "prTBAyAWrYT4hIJscs2p8BfP/LUFrnr4RNrj/9mH9W67rmcwSF2RFbH+Rsb1vBe/BUlg4XOBVckTpuX/5OcPm8Py6NGT8qxv6P2j"; +moduleBuffer += "GhB7n54FWzd+2erZPFFs/1IdFa/VFmYrlYMVGn3qzz15uLJMMxYNeOUbtYOVX62LAIH2RRZb0wsjINIvhkAbC5JvdAxtq8oheUYD"; +moduleBuffer += "RQxFLWTUr9Uw6vfpj2FQT72VuGiiQwEzyKsQQh4YVONrVaMnClnCIH2D1M6zB45wWT9wUOjiwNnD7pQ+7WrwGfu8jH0wMtnoywD2"; +moduleBuffer += "AZI9qYGx1MjTUWZmjfWVUWYLxJw2Jo8f1cOrBBZc5j+BP+RJLb9OmXWRoN1o62Ig2vpdX7RskaS0Zvs8DNYYcAwnzVq96tPxLzgG"; +moduleBuffer += "HCl/rUT5a0b5NTimWtTUiAsGQGOPbwJrHw7UpVoB6qrzxIcClkbdBht+MGQFJs2xWp3kPMzfHHXd50b4rInAvMK6KG+gKtc9tpCj"; +moduleBuffer += "+mXnRp/zyw+OPuuXnxx9rfRYPw57lB0ffVneSJz3kXSEvceG4jdvEgGhWxf9PARxvYMNOIq+MXEzR6BLMjdzXLQkdTOHYEpyNyNG"; +moduleBuffer += "tzF9M8fogeklD68KdnjnfPJg8H4QcRlfvwFY8XXcwWT/lDj1FS+PtVz2bobS8+WUnitN3s8Ro3JKS5P3cyixjNRL8rrkvCch3LM4"; +moduleBuffer += "cQCvPSXZfsikLptgfmi97LjsymhIPHjN5KJvPWpGY1TeiGWjcbHvaNRKRuOiyy8c14/GeV29fjTO6fr1o3FW168fjWuO1K+XXnnZ"; +moduleBuffer += "cdEVxl/zhPEKIZ26PrZ6ychy02RcppZvO/aAXXF1NK9uhQTPeTJgoyI+Ji/0aBaPgaKsufmAXXL7DVi1TFEcfru7fsAu6ur1A3Ze"; +moduleBuffer += "168fsHO6fv2AndX16wbsbXk3ccmRVxBve6L2s4h2RTrEuugXQ6z8MujziAKaIb3qaOkxyYpZFD1E7AIjg15xSPmFxnkXGbWNRq66"; +moduleBuffer += "ekhbWcLiEcWvWXONdG5GBi9XSmXwUqVcBg+Vi+BsuQSOlQrgqgTLNyl+r4efUKNFyRLf4VcN+CUy5yYcAz7rJixg552Ew8YPJA15"; +moduleBuffer += "34GWLQmPf5oEWU5B5FfnVrJvedvL4cmuPjx+0dFpx7sWw65x4vNB/XppydNhgEGLY+dc4diwSLiwY0jOXtccu+gIx0bEakhHI1lg"; +moduleBuffer += "XDh21YpXP24xbN5bhBONjNUcu2R6opyQnIZOjvwY1E/QHs3x7UAXBdNNOYoRlNggd8Uc/a5P1qLueXne5mMY+L30hmG8pl+CdmSQ"; +moduleBuffer += "zGvSMdsMOBIUlXDniqPFWr+iZAYektfI0I1WrhTU/1LALqC81F40x4vKgTTc/1lHslfLe4dlR1OgdYZt2qxkcBeVOXZSem9kXZyT"; +moduleBuffer += "LlpCgLOxizH04HM8Fq/JpAOtcfT8MkcwOJs7XpdZj89757GKuYS9IvAwU0/SWFfI3X3J2SxyehWHHR1CRHvxe94Xj89++Qx+Ln63"; +moduleBuffer += "9sXjY1y7uHit88Xj4ZfP4EZ4VlfQ77Gz0g71s2f5cfp16OyZM2fmvWs4+iJU/IYT6Qp6Sz//25X4OzXp9O2PrFN+AdVDXqewt2x3"; +moduleBuffer += "eeUj7HIp63LF7vLyR9jluazLVbvLtY+wy+WsyzW7y0sfYZfnsy6v6C6Ru0Uvy2klQD77qzNu9znF284czoJJysWp2EPEnTkTe3jA"; +moduleBuffer += "nUmGcJlIhnG5KxnBZSwZw+VQMonLEM0BdNmfbMEF37zQZS7ZikszmcJlZ7INF3wyQ5fZROHiJ0jkTz9UuhmXSjr+bDp6lNbLoSQW"; +moduleBuffer += "RiZmZDof5UTsm5EhGOlcA3wsopsoycPu6cytjknkOm7ySAOEeU5yZqeSz/UBkKu8E2S/Mkh2ElhXQLk63TPZiROczXZcbRPInlIG"; +moduleBuffer += "sk+daMg16mRKMlRX8eELOrEyn0tGW+nQE5CmQ8/kfTcd1iR9riSUriLnLDrlvNmj3GkCVCa4U04bLZnNh7L+CZUZyQYe4ascoFIv"; +moduleBuffer += "oCIokLEdtTEwCPkmxa4gVDP5fA1CDUFoVhd1UuVx5PWVhPSJScDbIPy2CX5VNQVUt3MW4qEMP0kjv0NSJj/KqLZKUBUUycMdtTE0"; +moduleBuffer += "CNdMnufUxjBHmNMTG4TrBuEdx63UycgcP2myrXMaZ04gLCmfJbX9FEjZzkgrg3+LSNmk8Zcs87fRzxjfS4GUTl9ShATyVkZtCgxB"; +moduleBuffer += "moKcoLrNAU2BIUhnkTcENWkAmaDbdDHGXbweHZf021VJMC6Z8acNqRHRt9XkXZ8xpDYlCT0nlidSx4TUWA2DVJ2q+zNMavc6pAqJ"; +moduleBuffer += "RPC4TaGTHT2gs11P2BSalOuaQi9PMn+CCZ7VRZ2FXOjvGIIlUzZ5YCf0IQGJ5OZG8u5pk7Gbs1GPa6K3mhT0m4yCdSQxfcpEkw+m"; +moduleBuffer += "87Ljm7kbJ1qIJdITm1ZHI1g3CdjHbVoDPTCaVmPnNK0mGb+mtabTs2tawetpc04EJyqfZrI5q3WitW6rjECLCNwmI9AkripJDt7B"; +moduleBuffer += "Z4I3wdU4O75Bc3W6yNWkyNXNRa6OF7mqilwdMYcENCSh+BSTtQl8m85TzCt9osM2OS+ghW/zQEB8PQ1sZuc4aA2cKmrgdFEDVVED"; +moduleBuffer += "txU1kI85MMdjkDmZ0Yc3bDFoDwPXrXJUxxOMYLO/tYs0apm1mylauwKmgdpatHYjMExyDMkYcNmkzwohXLZI/vcnGYGobGao6q6z"; +moduleBuffer += "mWFTcWbYUpwZRmAZhnhu5EM1xmSqfZo7qBZnwVoGWs+CY8VZcBhHsAzJdP95nIR1fGPq9QCp109z5vUQS8GyzOuhzjxOP3DWTEkG"; +moduleBuffer += "ctzA20aGgOzrm7VP5Myg3dhC7/KL3+SUeV6F0zr31uxyuNC7ZJdX7QJ7UpzEHV+cOLPuZ9LqhXTo+Gtf/xdfCogDQtSs++m0cSEd"; +moduleBuffer += "Pv6V33nt132SF1QvEMl/+s3//qeoLCwdNk9NmaceTesX0hHzFAvhAh77+n/4777nkl7oxzQUkdkRAyXRzYdN8836vm4+bnp5JK0B"; +moduleBuffer += "N/3YqH5sxDw2UewlNY99Ko2AnH5s+/reZou97TCPPZC2LqRj5rHb1vd2O7cbM4/tNI/dkzYvpJPmsV36sTHz2B3cbtI8tts8dizt"; +moduleBuffer += "XEg3mcfm9GOT5rE93G6TeWyv8IWeUyTim0yrfexceifUPr5PmkYtZjihMyuxp/aglm3NXp5CqF5azdqt7sha+Wo3tIj1cA5nfRB0"; +moduleBuffer += "/cRO+4nbrSd2Zk94apfUp22q32TkA5o/QI+KErNxaGs4BHcuhzRrQdph9XCb1OOkNXyGbeBOchM5l6EA1VcdTJ1MrAZBHe3PgU9Y"; +moduleBuffer += "wFOr0+0W+mS2TEdj3EQMBdtZdOTz/oMmLDjGyICgjg7lwDdbwMetTkcLFGWaNCIUjZRQ1MJcuY6iu3Lg0xZwZXWaFCjKFH1YKBou"; +moduleBuffer += "oSiC4bcp2mqBnrJAb7Pqa0JOTW1hMaxpaJh/ZJauqbogQs63QUImKloZDIl4o1WDZgZuVV2A9mcGS4y0bauE7aqZW6tNRWslNs63"; +moduleBuffer += "DNXMekO1tWhCpoqGatt60zFdNB1i1zzLRhnT1s3txkixC7F1MeJqpsU4n7QTnBA/hOY+fqlKcxM1oqkNNezDbWYNrp7IW3CD6axB"; +moduleBuffer += "lTkvp6ckrLwylQ7Yzbdazaey5gFzE0euDGDXqC0mg5hAjaAEaoDhdBb4OAgG02M6ehxEO5EG48Q9glnH5l+rLwiGqZ/J6j3wGacD"; +moduleBuffer += "VfldoUh7j8cKh1uM58+PWZI3mT3v43laQKWsILBPlniJgAAgs0cDNCI7lAFs8C6mE3CVIgBpnLigAuy37DEk/RwMLZ9IF4i0Xzid"; +moduleBuffer += "GjlSbex/5aPcyOO7kEnkaR43vnUGt7q4JaJi3TqLW4MXMsStW8/j1pCqXzB1Q0fx1T55bRdYabjiBVT4VsU5VHhWxYtUwZ9IOHA1"; +moduleBuffer += "EGBx8HLjuPYVVvKfF7OfuCzzATAestLzqSoOf66Bg1Xkg4uFA5w4dvpvvnIarhGKXwDaeAtLXo4rYpME7O1UMhwAhJkT/6MQj+OU"; +moduleBuffer += "FDnRg348pY9McRDnR2xIrtEv/G3H3fVclQ/xC8whftiBtQldxy/hkJUr3kI6lSJg+rpv/C2c2eK+5s97l3FqR+G8lXWlbF/rrLvq"; +moduleBuffer += "Y4vGfbytNeR5N4NFcGh8CItjJDUzSIQQg1K/N7CQBALBO8Yb9JQX/1Kg/F2VELn1/V5zAYV6/BXi1m6HTMCuCjLWP5U41Cmyw6RV"; +moduleBuffer += "6dOJ3wxbDvZQbOrVsP9xcKG3CxG0Tb0qn+/xzOFKhRx854hDsywnUOZzV+I36tjDQZ2Znzi8gTv24v/Glz4c6gM5kzcpf4er5t0h"; +moduleBuffer += "+uVyWmaChab8UYakad7Um0D3s3l5hrdj5uWdKB/Kypw+VtKtNheSUEZplEZpVJD4DVpv73DjZA9RPGqwIYr3HJ8lOYnpOnc23fsy"; +moduleBuffer += "znbZg6jj4tXpL/J1zf0xpGcld5w9I9Cm4l74dG/xe96pp8i5wUDGL1XRN/pKWtjfXDGu9Kxsn9vzcvyrLjvH+A67tz/zyZWzw905"; +moduleBuffer += "7425fNrNbMYI4i3eSFjNvLF5T9MVEeiI+mJYITkc8au0mjHkRRZDI7UHOuVq5J34vCf3RcgE3CCBGwTqVSnLZobKESfMJDNClp1G"; +moduleBuffer += "z+UdqvJmvhG/gM8Xmgt8wiow5UxB8TlPMv90JB1QTY6YGO6595NItPGiMf5DArGrEkuTZlrDPZwB0TlM4tEmoNFCfK4mz7etNh4+"; +moduleBuffer += "fgJZRB2GpYonfNml5cR/WJPNP/yLNw6xTNFiZpa3wqiOnP9RQ6oGmmq0wFR7AZp1F3q7dTOCKc0qsvmHt+wMLfR2yv22PF/T+YqP"; +moduleBuffer += "ncTwgRwXW3mtwcc2qj+GCSJTQ30MZn3QDfQRsAJFdAMwmryHOiL9hHIFULiIVJtUFToXQB+jTB8DzgYtoJu4YagMiOFuDjoS9Jxd"; +moduleBuffer += "lZ04mgMS5hoJm6Mp0ZavcN6blZ3JLnYmqyD+8zokn/NGVbH2jP+fMD80hUgfBhUtNrncKn6P91y1hDstVaX7Eb+IEvJaGAant0sP"; +moduleBuffer += "gzQAAE1LCzssHdLq3gzfZwZqFFuiAi7aC21s1KHhGHtHtFoTF6r4cKWKNfjhSkCGvIJ+QkYLeITAYzRjBzfDybEGjxAdj2ZjGsqY"; +moduleBuffer += "hjpF9aiM6SYVxl9l7m4SeunC9Ppy39vtvIYXW7/jL2TmNrfwJPBFXTbKx28lRLfZaoVGrXGWSOob+jaqdVhQ6zWyQMEM5GZiIfG1"; +moduleBuffer += "SSK+SictuoPR5Y9u6MFK/C1oNS20RtVg/PcCusk04P04f5B7yBgsvMZx5+ZJx+2JC2m50kHBjY1Dy2ruqZSxHSUrSB3CSJDF+he+"; +moduleBuffer += "PBWLYlO/ZBhe9VR5b1kP97d81mkCVOxj3ovVKL+Cj78RcvYvvF3HU6NiekCmakm6enzZBpb6wjmeqAYFHHb6+mJDeDaJofx3aYnk"; +moduleBuffer += "hqZfX/oFGDWIJ4NIZl+X7LsYCxLWg3x/VBsLwu5nQgHMb1rn9HZCX8Va9m6mR+zS/ZkwktfhzGzephgQ1/QT5DNirvVYn2fdibSl"; +moduleBuffer += "TROGsJUpF5rhoDly8sV9ggEiXL9bk6e02LloFmO+1QbY5jXvvqXHlNkhKQnRA02zozdQByRlQlrVVu+qYMCWtcWkBdgkIXaDNFmb"; +moduleBuffer += "xSrMYpibxSrMYpiZxWqmwgw8tIz/HoEtZzaFLN56rhTaNvEEKr6IVmdtWDV5UHTWVM6EF389yKwruXmX/GQP6l/zJW+eUXKOhMy7"; +moduleBuffer += "b/EGxIPuFa30Y/TUGD5vaEu5NoOT73Klrxmlr1lKb7S9Dm2vFbR92TmZNghGA1t+cMizdjga0F+V4se7FSMTDdXY4T4hKvwsq29j"; +moduleBuffer += "1n3c9NJgCbaaQrUqRX/K2CpjRhKysMkg1V21jYyYnyYW9Y34yz5LP84Xj7+GLzHEvih3tzNEjgY7FSPC1YZtVuI0MGalvQCvoZEG"; +moduleBuffer += "YLwLQZBfgBGmwREHMxNd/GL30nmASSIy50Bh8DraQ1rtVX6UzENECxQ2Dj2Ciu9cKtq5jXpfwtGIVNNaf+O9yqmkQz53h6dJNiLx"; +moduleBuffer += "mZokYRzMeoHJgmbSzf/BR+/kl/t8qasIJ6qsA80GSOwStJz9G4sQQI0F9w6+7ukwbeREhDTDDPKCR4gFKdA3M83R0GOa06bG63+/"; +moduleBuffer += "o7U5in+xkVjIRHKugxi5IPOIBEv9XJSxFj5gICyEaNEQE/fG0qjXwolVbu/fYB3XGzeaDDZWNh1xnqDK1/jWhOguMA2h5m5vVKt5"; +moduleBuffer += "COZDFvBgyPyHcQj5PBFuj7rmERpTrjNzP10aCyxJ0imbLI1I1UbE8QkRnCzZqyYIl2Nkclhi2LiPJ44QE0PyVwWOBhGK50lkMAWR"; +moduleBuffer += "7JqCshi9blnOSksmc7PACKDerQ3qLeLMH61Vett5T07Qe6si5jf+oxCC8bj5XhKFz6Wh0ZxZOd5sbiH+A5bOQ2Th6bI/YXGaQ0Py"; +moduleBuffer += "RyIBmIYK+5vc+Jc9AROJe84nBsb/2IV0fQ4CTyZ7d+WvH6loq0zVf0M81W9VZBb6krOwo1KZ57pjOFom4M1r8qIgwI68gL++pqUF"; +moduleBuffer += "jwBPVk+me+e9Ofx6PJkjyDPYwihQqr3pBf4kTQqjCzRw+KX2zlc6dJmbr9T0zNTkr2EAZN475wBV7J2Mf0UvDFh+36lkLr0rLn2Y"; +moduleBuffer += "LQmaaHBXNnnokwN9qxlcb+C4x7S+Wlk/10RaH5adbB5r2fNYa9081uo3j7U2zmMuw26ZeWw0m8eG4ViM4pUNPzDcM5CGZSncMJOX"; +moduleBuffer += "dmNpLngeWQGo/qxDVouuZ7BVka6LDikwXU+TJ0WXzyejuDxNUkOXJ2lJQJcnSJR4+ogsn3aA4A5gXohtH5fXjF8JMOuKBeQlbB0l"; +moduleBuffer += "Dk1EuVWWx0bosRGQ08D6dmQHLUOgOyPsQAq1I9CdQ9rf7VD7DtNIjx1aSMehGb9Dy0q4RdvoYuZyWq92MNmzW9RBt01jULF9dJvV"; +moduleBuffer += "Cl7RMVVX42QT1LhYCfjy1PTYyfh3+ZwWfHZJ5Qnt19SBgoFRFxjEs7pqMs862q/hB6nlSMarujC3rg3piDAod1HizEWJxZzFxkWR"; +moduleBuffer += "KAhkO+ZR7e2H4YQJFxFL6rywTEbokcI6MoYc1iGBsRqBYMZi/Qm5rI/Rw5XY+Do0XgO5qKkBjY9IGV0In4EcH5a6gYLUDWipgzh1"; +moduleBuffer += "IHxPkgaxHMW5HBFsRY7IklNwWc46WAiwkRQRPKPldVHL62kS1z0vk1zSUlx1IK073Bc4mtXAnDdLl70A0eHPecewKHDxkTf8XXpq"; +moduleBuffer += "lKC26Kk9GMc2eNqAeRKmtm1ntS1uERHe7o0druynCl/PPA2EDz5HT36nApkY44BZgzcrN3K3vIEp81PYK4tdWQ3F+7sacHyPYdM5"; +moduleBuffer += "0v42APIQvjVHgt8GFH7O+GPuI/SLZOUz6K4XPnOk8tcJ+lXuI7THDNL7OFXOLSSBvbQXP9HXC3zfLPD90gV+Wxb4vizwDclB/BV2"; +moduleBuffer += "6tv6MzB7nY9xdmeESqVC+ELEoRasCTgSgeXYYq1HBHsWjK8J6x9TH7MLvAwg8HvxDXE2zkT1TroM4kvjNoZvDBggYWcb4xYLK7D9"; +moduleBuffer += "mEloi2lva1vcyG1xW9W0LW5DB2q5LW5DRWqZimRdG0PKolDLTLKNmq8lASdea3UZ21W5i2SNVxht88Ec/R7jOK2oBa01ACOiStaO"; +moduleBuffer += "KeX13vLNTOnha540xsHfeR0WHW9ybBm/3vDJghOwNZ/kt3Q5QjLu7aq865M7PYYT3LzeryGjV+/PfUO2x7m/ptha8RHpVIpNSXm7"; +moduleBuffer += "K3/mH6n8KhY0xJFFXGm8v+vKAuddvcC5yoffHXRx8rgOWbtn0Zac6mWPyPZiBEX6L5gCgXfeE3gveVm8+0bCI0HJSinc4EpJfBMa"; +moduleBuffer += "EGUrJWyH5u8483USBx+ekNisC9NUNf5UzOGuPPiAyKySY7bSVvzrhLnLZ9A+Du0iIGc47c4sJlp8ZEWGijOZfz7hPdtPkp9DUzme"; +moduleBuffer += "wzM+9/aCI+GLJQffC/CjgzYonptd2LyOgIoEFAN+QgCf4y9i+Q0+tdr7chLpJ1vyZEOeHJQn9wr4dJ+aO+7+WEv2fKNj7Ihy1T6Y"; +moduleBuffer += "GxdK+Wns8seWRRdq+AhdSGcfwNoLVszFBAIWRLBiLpi5XwzKHF3m5r1Z8YZ5GO1BDGGqEHBKIjFVAeuPMKqqTRVnVYBrV9WmKkA/"; +moduleBuffer += "eJfDpkqvTMhaVbW18o+7pC+8aqEpjLe6ROwKz7C5BjNkD4QM5/WGfeM4z2FsebAjUMoRnzls4UdKYl4azWIPBOYdHyM0IQulMVlP"; +moduleBuffer += "DdGFRgjfNbC9stCFgXTzCcjHocqBHQga2/BcJJ8ViIHzddCE2mDpbAVN/F7HDprIs8rPDnPnrvLYSYZhYPeUhVDgkB93f5wNnC8j"; +moduleBuffer += "LEFRTqBhGzn9pJ8budygwby9WzRvb2Xm7U1t3i6LefPWtPF43ZfzBS6xeeOskfshu1V8SW6MGVvQVWPMPOtd2gof2/ldP7m9aJjm"; +moduleBuffer += "1hmmAIYJKQvm5t01bZhe97TTOUGkTCBoNmKHdpr8YhcGagwGag4TgWWgfDWXG6ixPMaDXVjuSR0OOuvinTh2w8BA1Tg7Bc7qfME1"; +moduleBuffer += "elNDoOh5GtUVJ4uZ1MiPd00/NWaC1ZpaZtGcSeplEkGoYSmPU3lcMK/B4R43mI/3w3y8gDlMa51g1Flju9QfYf7LSMMwu5CmBLVu"; +moduleBuffer += "Gde6qq8LQtVhYnUvdRtvNLWCUHnQad3LMB/ZMfR7sDnzHiww78HmRMbn8jV2tAH7bI1dXbfGjuw1tm+vsXXQ2y9ZY/uyxq7KGnuw"; +moduleBuffer += "sMYeVPhi349/Ua+xO7LGHuRKa40dZmvscOMa29+4xq6+zxp7zlpj78vW2AcIMt6taigh1thVvcYOscae419k/ytIMHgAa+ywbI0d"; +moduleBuffer += "FtbY4bo1diiL51Ai5a5+x5Kvsfk+QixVq5lZY8+Z1tkaO4Quop2JOWVmL8xeoYXrXqGFxaWPhHGy1z2R9bpHww6sV2g6ZiPc7mKG"; +moduleBuffer += "aWXrtm62xu7KO6u6We3o1yh1XmPvQz2tsTu48hq7zrNxhOtpmmfqmF8CXJ4mqaljjd3C5QkSJdaO2Fpjbya4m6EGU1KW8C8Nej0+"; +moduleBuffer += "hzV2Q9bYjR7vE2voNXYjjx7KY0P02BDIYd0ZwhobujOENbaOMg5Bd8wauz1TYQc4UfQYrbETHBUzLbDiGVmSplvUNLQlRhx0mqDF"; +moduleBuffer += "6HXGLGKn47/jqS1IfoljiWOMFakBt5mWNopstewLULKwVBjVOFvbgM8xq7m5Y3inhHdKTfPaNX6Jk2EojEucBSz5LhrNMINjYVIb"; +moduleBuffer += "3huWHlmUoK3aWZSgDfSUoNfmKEFstZIoQVMliBIkVpSgnUcJmnAb21mUoMmIaxhNgeEiO5hipNp5lIBbDmXS1hQSmxzGjeiGWVBr"; +moduleBuffer += "4ZzCIotX5VMyeFO8AC9ECaZYLrIoQUNHCWhdiyiBokdqeMSoyhQ0qQ0dmlIKqjWVva7K+pAoQcMoy+ZcWdRmjY/oCV0In82FKEGX"; +moduleBuffer += "RTnXm81ab6AQDagPfGTWhHauCQQ7pZkijxLwnCJRAnHpqlrTOlrTQtG0CE5bS7URRYC+mShBHa/2Z+myDyAaeZTAT2JavZKrRU8F"; +moduleBuffer += "BHWQnprDOA6Dp/XcSeMAiJm3hmXe4vAILxGHs/h0XTUQJahzlKChowR1jhLU8ygBB4I+RReOEtThL95Dl0H413XAuguzCKIEdXid"; +moduleBuffer += "++niw/nUEya55nXIymfQnY4S1Nn1rudRAm7LUYJhmbg5P1f8ez7kAiNB63jGA+v4jopoDAdhsWQdP8fJvQzO6WA+XWOGiYlwWscP"; +moduleBuffer += "ymDswzo+G4k5rOOHAXiCLryOHxaHmEcJ39lU4d8Pg7KQLjx9DGuhr+f2fhihObb3w5DS8dzeD0OIxzMhzro2Zp+ZNZ6ZDhs1X/Mq"; +moduleBuffer += "ovtaoCezdfwANTXr+AH2oOB0sYs7oNfxkyK/NU4eFtMV6UFlTq4hu0GKAMGKVbfoYttwDYkVbN9umXy7tx2Af9EluaPrOZdkkK4v"; +moduleBuffer += "IE8cXZdckkW6Pu+SfLLvRxNJbVfla27awEofjuN3kE6h93XXDEyN00abtX2N8ypEWQmJzzs5Ersr/9Q9UvlXDtJX8cEDNXBkFdeQ"; +moduleBuffer += "jxioYaQu4urzYQI1MHzFEXfzbWce5xfUIO9vOTJNIPEjwtr4Fhp+ZtU4bMiVZ15aVJV2V8Rhc+GwVXOHrrDDoYl3FlW4aN8I5OVb"; +moduleBuffer += "lL/ma5kdE7V4Ub8GbFmv5uC31FSEMDG/PQ/51bj99jxmPPBAZN6dw/yH616dQy5a7ITFv+ZCxwfkbbex9xwGNQ8NZG+7BzgyBUEe"; +moduleBuffer += "KL5V4xu439LiOlB8W0c3sOIdyDyg7G35gKpqjRiARlRzjRiARlQzjRgQe8Swmwuc5EtUYUB0YIDfdOAdhEgzS2FHS2HcRwobegWi"; +moduleBuffer += "47g13nlZEGzJ3FAQ/zWusZTECP8DaEhO5VfI0+PAbotMtg9jbR7CqqiqNw56Gnoqew2yKkIBOWlzxtY4HUTvTSdvQ85zmy5vOQUF"; +moduleBuffer += "fMOBo1yDjFaATUNOpILcBHg1ypNBSyElZ0xD0Ek4ZdUIFtA1pD0R3iPEn00LI3oZRlZtRF4ojghQPTfUsFyqZns+aghMtUQ/GdEx"; +moduleBuffer += "sR6SQUKqXmIF5xzMosOvUEXbXvY9AGvMv4izL2plPS26+nnsycMnSzVY1ydFsZ8QvX4cqosAUE1yj2RIIUt6K+vvrG1B0AvN94sO"; +moduleBuffer += "miHDSz7b8D1C+qyLYZD8L1gPxd/g+cbwVDKOZOy0iIcwdWxgZGCILYN4S1vjZB5oks1FGDyBgaxMc2YAs+HDLGVGKD2AMRrp7dcz"; +moduleBuffer += "1gi2mM7N8y9aIO3jX7T+oQlrBKZwjC4tTFgjGK9YmNmkCy9kRkR9c9YCv1VXq+iIGmMVpXZ4Iz2Wq+gI3iWPZSqaPy+A+f07i9NY"; +moduleBuffer += "pq0jwLJEmEw4mSzhBHnaWnI5TjPSez2P05DzP1EMRucQJsSsKA8ZlRAu5eMATFz6og+D6eHkFTtwc8Wf985zMOWyDqa8wcGUHQjY"; +moduleBuffer += "7NMBm0AHWao6yNKSXu9rASAfQ4LsDGb7MyfG8pCYQm/49fjskSiLViNBVphHq3e41/x5d8mXoM1VHbR5B1di5FsckT7oXsGVWPmm"; +moduleBuffer += "J0Gh8/TMNfwmvl7maHXPif9OTUfY53SEPdBhon3rwkRVzCfkguUDTZ0fdV8MpLNzgXS+FESCzfOB7CPnjJQbevHX9VK1g1HIOFvs"; +moduleBuffer += "5aIvQF/1pZdX/EhoAyPQS5LK7CvxqniByJjAzvFqtnN8Its5PqF3jk9gWpjQS8cJ7Byvmq2MvkhVNl/72c7xFJPMRCbBKeYgX+8c"; +moduleBuffer += "T5WPeSmVV+jYK6m3i/e8B7FTPSthu8hEtn18wkRqsH08VRN6+3iK6Zln0VTCA9n28RTbxyfy7eMpNHgi3z6eQrcn8u3jqTiFbsSd"; +moduleBuffer += "JokM1fQMTgY028enjZsybe3JmuPt4zvoOnc23cfbx+dKt48n2pHB9vEd+fbxffb2cfSVbNHbqGR9P4vzN00IcDOmgu102b+Q7tSa"; +moduleBuffer += "sRmrK72BfDO292rENmOz1S613WpmbSCfmcFhgxwz2wyvJ4AfNmMInLH2MBfifTOFiNmSezLtzmA9Bwcy0NG+Lr7vSGfpmk+lXdXd"; +moduleBuffer += "4b7p4LOOLE7ZnXWR78kEVEj0Zq3W1BLmpIsdUY+rLg/lKrHqs1T1jrOQ3EFXclST2+j6Kl13k/x24z+vt4AArQ2SISF06wyOTmRC"; +moduleBuffer += "uwhwbDU0bu0X09ya09irJHXQ6ZxMmwSnya4FkhgRpb+IvLRjgNvEBJat45s73M/QPGLtjW3iU1fdU9OOa6Kxx95lWzXjNwjSblqh"; +moduleBuffer += "NbEmNFoWou4/p7r/M6+roe4/o7o/zuuq6IUWuFO4YoHbxMq5hcvTySZcniTHrIkF9CAuj5Mb19xV+Rx5cXT5bDKMy2eSEUF23Aoz"; +moduleBuffer += "BXpbKSetjk/yhydNGmj/uV4lkPh+E573Of7eBLnV8dlJlIyR91g/XHHoMkZaIa8d4oUs5bXZBMeKqy1MwN+myFwoRkb87ro46r58"; +moduleBuffer += "V4J3txJIaPOGa36ZC5sTWK9sLZvTFpvTVnUTUoSa6U2CEq9uItDejH/TwbpW5KOOjsd0NFrWIgNaTCoQE74/YAXSBoQ03lIvCVLZ"; +moduleBuffer += "qW7GZ8iRxqpjjHdOyODiu5sxajJGJN3HpFX05wvZjmRsWZdNerrC0bQO4FYHlyOVFlz8w5Um88D+P6FO7WN+t0A9M5+Aj9mxN8Y7"; +moduleBuffer += "9nrOQbPpOMD9fCfgmOwEHGcnYCD7PsFXdb208HnjiP1OqYZy9k5JDWSgEdixXibNyf7lMb2Q56VFkEWL2rxE420HWVS1zSzjaFW2"; +moduleBuffer += "vZDlNbDk1Su+fmHNtbYiQVHB4AHDYMMM5lTx7YAHBg8UbB0Wm/LNFXiKm5X42y6PazrO7+qyN3N+FjP0rZihz4vGcauV2VmE12Hx"; +moduleBuffer += "O162kcgvbiQyj9TlEd4fJCFCP1/y1dWA5ksdfBnI+VIHXwYyvtSz6Efd7NUxe4/mBLbNcv3WynBmTMfxMvVrihuab5Bu89iDKxLH"; +moduleBuffer += "0/sZNhq2eokRa4tJGsDjnyXdZxarnMU8iuEzMHb8Qnbu/YxeQ4zeoBi9jhi9MaUQ7yOzOpDE2FYb0kys4qfoxhQ+vDzufPG4+vIZ"; +moduleBuffer += "gtzGDfUU2e1svecn4/QYHm+rEUIvoo5rvK0lUsNkSDclLSjwENZ+TUTShIlD9tpvSEw+eetD4q0P5Us/erapakcqe+jpfViiiPlq"; +moduleBuffer += "quqRyi6q240VuqmrH6nsoLrboVqmbg4RvybWHZ9CShHEDJtqE2KGTazhEJ8eRMywidXeIbqMIWbYVMOHKzSUauRwZSdE+3Blli4+"; +moduleBuffer += "zs1tAkniAC+7mvkyjmcuEt9PU6WS3eBzrB/ohGfJwrdD2Dlqvh3y4fphqzO/r+c3D771+ZA1IKqqo/dDRLfsMPKz9/ZGAkaQ/pwY"; +moduleBuffer += "MozoF0lGh1g5iI1lxPlNSYPD5zc0q1bLBfIDC5o9u0IqVHik0gUpMNpDqo19w3ix4s4hexX2CgyBc7N0aWHoh8AyRRfe6TQkWwaG"; +moduleBuffer += "wLIhusSw7UPKh+kfUrxhfUiNFwWKfg7iNb6IxxDe+VezQoRXEVzA+4UlE0wdUlv1unQI69KtuR3hR7ZmdsTuJluXsqhvzUzKkKxL"; +moduleBuffer += "N0h6RG3YLHQRU0irajaXrK6a5ZXkkgMH8SWH2ErXZWx26eJlIi03d4teBWa96Knb4DAuOXDkb8NEV82AEWZvEiRgcNlRd+BVp7yw"; +moduleBuffer += "g0Cz3xovV+WEiUkg30WKYmkzCUNmXNJJ7ZISHZPZVr8um/QuVN32cz9LZp3fafCRFYFQabu2hCm8VTLzODmZX5HmWMW/jBkBKx0q"; +moduleBuffer += "j3E80n72GGIUjGrVQjO00YwtLBmNy4zlpQKWAPSI+NDsfNu3aPhpsCa1X9/FLBP/rA9ISyZ+Malm9HwziflmJpeTScw3M5mc5Hgw"; +moduleBuffer += "ojOZcEzKfDOpv+WbEYnYrjasa9atavCGYv2i5rNUP7egdtnV+JhRbSH4m3lUf5Zdpy0YuM3Z94Vb5EWUMtRvEXiE1pYM7bJHtvdp"; +moduleBuffer += "j/dWss9/Gn6BT5fML5jm9SO8jGlr5ZFQrUzqidpxmAxEAucupgvPsIn1Ogn4J0BmOvMP7NsFUCasyw2mszFPZMwTjey0jHmqkvif"; +moduleBuffer += "8XeM6fG/taj/e25eoj/W901mV0ygAxH6ow6PT+MrbFfEkSdlexVnN25VRB70eCVUc8kehU08QRPf6yNE5+HcX6GzginVfAlfMdsK"; +moduleBuffer += "cRA778uvyJ6pAUSnkHncQzZt+xv8K3R/DV/p8xGOvXdcnRXekyMje694eZzpda55wysAeMmb9y468vt16vo1kL3GLS97CxJLAxzu"; +moduleBuffer += "/EUravUS17xgRa0ucs2KNVqrXHMxTxvQm+PNQ/osUjOkaVW2MVmbmNzng3n3Rdlp6Z6nAV7Ruy5XPB5shAtC2czBQMYAxLd3Qc3C"; +moduleBuffer += "nPCGzs/Ifs5P8/ZLMg2e2gY/gjdzPkCX/bBZHjbw5GE2mC4BrwcKtudzOB4J6R6+917tFLlr9BMRHfe+8dTpVXTJu3/8cOVNl6Nz"; +moduleBuffer += "3iVXAmSv4Xo7wtIe56H1crvEwAntVYzLsZO8epvjT+yRNYGTMbja43DhcQScmUE8Dkf2rTnicVQ4qwJ/fKk9jore/ha/wEoAH3/Z"; +moduleBuffer += "ZXfDEXejG32fQm52u+6qfNtvdr5PaH7iNFsZjCsFGdm4xW2W20cfQp/1m+hzWyJHfXyffbJVCBIXX8RpWJLXP4MV2n2fZzhzBCNI"; +moduleBuffer += "4K6Pqn34OifhM0E2dr0BuRwXwED/gQXD/UAw5PkAx+pE+Py793wAexeJ5Yh/n3+9Tr9+msf3pewXGan4K3z3irvAH/k6vbFnIoSF"; +moduleBuffer += "xTrO5a80PD75VN7/yBsNUe50P9S7gjca/Paikr3RqJA+k5NZgeZP0GUU3mUFmh9ztpT33iPlxbL26acOrje0wGmZ0+n+6d9638Qo"; +moduleBuffer += "v/5DmRjlF354EqP83A9DYpRX3jcxSvfmEqN0P0hilJc/vMQoEqbNE6PE8VcdLOKEvKbF0GZJBoXmB0iMgsDb+yRGia3EKD+nE6PE"; +moduleBuffer += "/RKjxFlilHhdYpT4phOjxDeTGCW+scQo8Q8yMUrTTozSXJcYpdkvMUqzX2KU5seWGKX6Q5QVpfsXJSuKUeTSrCivfGxZUV77eLOi"; +moduleBuffer += "xFlWlG6eFSX+TzkrSjd7i3ArK8r6fV4fXVaUppUVpVmSFaW5LitKs5AVpfmRZEV55UPKivLyh54V5X1sVQP+x43YqqD8S8W+SR/C"; +moduleBuffer += "2X5JH1o3mvShVfggpaWTPvyc/iBlVFyP1n/8SR9ambvzvkkfzDbM6yV9GD24IenDR6+mnPShWZr0oVn4/L754SZ9aJYlfejaasH+"; +moduleBuffer += "8M/jg5SmvPFvStKHpl52Ndd/kGIlffjq+qQPcUnSB/PRSSHpw2+7/LVIuo0/DdFqG/M3I2L1Y2s/b1xI+hDrgEZp0od4XdKHuF/S"; +moduleBuffer += "hzh7VysfnsfXT/ogO9t10oectd3MAtufTzQLn3N0eVSzzzmaWdKHpiR96BZ95G6W9KErSR+62eccWR/yOUfzw0/6EBeSPnRzOfp+"; +moduleBuffer += "kz50SSjjYtKHrpX0IbaTPjQ/7KQPcZ70If4Ykj7E10/60JZpj5M/6M85fgjTMkhKlL/AaRm6P4i0DN2PIC3DNz+8tAwb1mc3m5ah"; +moduleBuffer += "mblq339ahqZJy/APPkBahqbi5z5IWoZYQDXfPy1DjLQMzY8lLUMsaRmaHzgtQ/M6aRmahbQMzdK0DM31ORmaH0ZOhvWDPIeBvcmc"; +moduleBuffer += "DLHkZGjeysmQWbPuR5+ToXudnAzf/PBzMrzyIeVkePljz8nw1e83J0NHcjL8/Y88J0MWh0dOhgs6BD9nQvBmM3RJTobmjedkaM5+"; +moduleBuffer += "RDkZfl4vgeNbORk+WE6GeP0SOMyi9+G66H1YXJmsy8nQ7PXJyZCtS/KcDJ1iToZOtgTu3EhOhnhdTobmDedk6N5YToZfXJ+TISrm"; +moduleBuffer += "ZOiW52S4sD4nQ/cmczLIBxp5ToauycnQtXIydNV076W3aZp4XhIzdJGYoYsBI13oFhIzdEsSM+QbyMDsrpWYodsnMUPXTszQ7ZeY"; +moduleBuffer += "oWslZujeeGKGrtVKVvLR+yZmiIqJGTjFs4ERZYkZoo2JGaJiYoZISIw4aP0DS8xgIubXT8zQyRIziLJI7sxiYobOzSZm6N5UYoa4"; +moduleBuffer += "mJihefOJGbo/mMQMcSExQ/MHlpghlpV8rJqcmKH5oSVmiAuJGZrXT8wgQv8XKjFDtyQxQ7MkMUP88SZmMKt7SczQLCRmiHMkPuLE"; +moduleBuffer += "DF/9SBIzNEsTM7znFRIzxHlihiZCuddNzND8SBIzNA/2SczQvLHEDMYN+pgSM8RaCrvXSczQ/LATM8QcfL2xxAzNjyUxQ7OQmKFL"; +moduleBuffer += "QxB/ZIkZmnZihuaHnpghlsQM3e8jMUNmQT78xAw58VcqBeOUJ2Zo/tAlZmj+x5eYofnDlpihmcWrP7rEDM9/LIkZNvTyA0vM8As/"; +moduleBuffer += "ZIkZfu6HITHDKz/wxAwvf7SJGb76wRIzyFkIWWKGv49TECQxQ8eaSvkchHWJGTp2YoaOnZiBz0OQxAwdSczQsRIzdHRiho5OzNDJ"; +moduleBuffer += "EjN0JDFDp09ihg6iHB80MYNkf5XEDB1Qet7lVJ44aMhKzBAhLey6xAyRlZghsoObaGwSM0TxHxIkfEIaFT8hjfAJaVRMzBDhE9Ko"; +moduleBuffer += "mJgh0p+ORrLAjeTT0UgSM0Ty6WiEBXQDl8fJjYvw6WgXFyRmiCQxQ3QjiRmiYmIGzlr7i3/hEzNE8T/8CBIzRPG/9z6GxAy+7m22"; +moduleBuffer += "mJ+BZg5X7wv+i5d7IZLcC9FN5F5gHn4YuRciyb3wzVu5F/rkXojW5V7YaLvqJXaqLVZnAI8j90IkuReijbkXIv1J/PvYtUGxaw2x"; +moduleBuffer += "a7HYNTv3QjfLvdD9YLkXmlnuhaYaJltp516I+uZeiN4v90IkuRciO/dCJLkXIjv3QiS5FyI790IkuRciLC0+hbMcEBaMJPdCJGHB"; +moduleBuffer += "CKu1u+gSIywYSe6FSHIvRJJ7IZLcC5HkXogk90LEK6soX6lFOhvep6lSZce6SO4FmQgLL+WRe6F6ndwL6xMvBFnihWBD4oWoT+IF"; +moduleBuffer += "mNEG8XqQ2L6Jj6G7wVmzWi6NH1jK7NnzRhMvNAuJFwYl8UJDEi/EhcQL3Q8z8UL0g0q80NmYeKGTJ17o6MQLHZ14ofM+iRc6pYkX"; +moduleBuffer += "OjrxQmd94oWOJHDcmHih0zfxQmdj4gU5patjJV5gP9YkXujoxAsdK/HC/8/euwfpdV11oufs8/zepx+S2u62fb6DmGkPNhGQSEJx"; +moduleBuffer += "Ep0uP+Jxgj1VrtzcKW7d3Jr8kft1anDLwpepakudWHEaENBVKKABwzRgsAZsaBKHKMQkbccEMXFIB5xEgIfpyTWgBA80FycoYKK7"; +moduleBuffer += "fr+1z+Prh60EzDywVe7v7H322Y+111577bXXo2d7Cm5UHS/0KscLvU2OF3rDjhf47Us5XuhtcbzQo4SkV3O8UFR0h/LIZK7rrwrH"; +moduleBuffer += "C8q3M05Y8pM+avqf1/HCT77ieOEVxwuvOF74X8XxgtnqeGEoihwcL/gv4XghqHldMKXXBfM/r9eFLUps/wheF7Zp8xWvC/8kvC48"; +moduleBuffer += "O2bc47sLpwtqTC8TlDrohz/zd5f+6tKnL1366vcfP5aZGWfmlz77Nan3Y5c+fDz5AsgDJPjIv3Tp0z/wZ5cuffZqzV6y2Q8+9/EP"; +moduleBuffer += "/sjTj57+U0fzF2z+x37+1AOf3vjdjzxr8zc8zf/87//yTzz7lS/+0Cdt/rrN/4lPXfrkz/3GkwtXavaaZLvCyfmZh47G8xkIw1ni"; +moduleBuffer += "lZxL5NWKnwkBMnc+Mj8v/a6Pwt9mFNAd9beOYs1o9uZRgNvytxuFo/mbRsG8TSNY0RGselkLv0u+cJgykmQ+gwV4fOcjUuaMjsdL"; +moduleBuffer += "47fIMOYzbz5rSPZ5Ll0pJd+teV/PMJe3H+aSt/0wF7wdhmm2HSaQfLuhYmPEZHmYpGu9BWE5MNSJ+ayJqwsO9bQOVQ6BOtSIgzMK"; +moduleBuffer += "jQaLnNNhN9LWnQU0dmHSa9BY2REawTbQWJF+BVuhsWyzN0NjyeZvhsaCzd8MjQ1X8zejrktorBid+A1PJz6dzzq4g+VQFwtEbio0"; +moduleBuffer += "Gii57tYBJgwSioRpdGcFsCVPAbZL0UchE6e7tBZfV8k5UwFs1ewEMG+7VQJOaSvAVmz2ZoAt2/zNAFuy+ZsBtmDzNwEMRzx01c12"; +moduleBuffer += "Ewyervnp+awNfSgO9aJn0aejQ+2i5F3z1FBWkF5wLfZYkCZERYHXCCQaioPeMEhHibWCg2PlijxrLEgtDgpIxzEZbm1Ful8PDuIe"; +moduleBuffer += "fBscPDy7LQru2x4D0+0RMNkW/86yr7KnudBbwCNW0UV97NDPCZ4U5aDmATiZPvFLzu8hfg/3iUi8Wu+31KvFHYLH7bT7FgLbs4Sr"; +moduleBuffer += "DWDLfMl7B/PVSxMWuMhP027aq83XhsGEjaSjLLKodSTpSG3CloxO2JgiuM7GaDr2lmrCVlydsHElGjoz4+nuoQm74FQT9rbafB3w"; +moduleBuffer += "NmT3SOm9JG3a8TSqgVRj6FSd343Vp93eVfW3g6WoPd1TdbGBNVx0TtUVBGvH9aU0fxHNt9PdCkazFYwbMjwfulkKJC0RFcNTKiBF"; +moduleBuffer += "hJCmDRY541qs7mgRTuA+kALDpdGq1oS0v0COO410llzbvl+1v8D2SaeBQa4dgV0yJGkpmi9WzEHbelw2sahNtHQA2zSRoAU5QvL7"; +moduleBuffer += "aduAXXDy/RK9saU+X0/UPz/gnQ5ApnycDDbkQPoEMRNGZzO/+Fkch5cXvolzPePem+H+X96eA6MgCWCAkJ9Llx76zS9fuvSLvXtT"; +moduleBuffer += "T3Kk4Mwb3luUXRsu++ff/9M/f/Gzf/yBp5z5bQqfHy78M//ty796/rd+7Auf2rbw+nDhP3v4x3/o/X/7/Ce+ebteXBgu+6k/ufTH"; +moduleBuffer += "n/npn13oaNmHcneQu3PJB+LkE1ilyuX9Rle4vIxcnl+41sLGZZTLc7hCswAkwuNOB1OtLJqB9JZ5y5qXZGGVt6J5E1lc5dnNPga1"; +moduleBuffer += "k6Mb8zZ0h0wjW5WnyVCTazYZ26RWkNQrWPCGKlgZrmB9uIJ1rWCiXsHScAWrwxVsDFeAjdsD0ZOxCrG+9D3KTL1L8Ocu24Tl/772"; +moduleBuffer += "oa9e+pWFL/7R7zm2GZv/npX3fmrhXV954Ds0W6g5cs/9zZefev+XvviVv7Kl17Qd2YMb+F0y1LHRJS1kAqvI020/kvyLxTr2QASE"; +moduleBuffer += "kGEFYD3v0MfVHfq4sn0fl2325k5iU+aOCHFMudq5WNvste3e6WJnBC0RVsbTrTNmdw05l4LzCMDQzdvhgcfrzisEVt15xoSx26nH"; +moduleBuffer += "zVR255caasF2bx7qurPtUNec7Ye6DyNtcaTnCm6hxZH2KIxh7yKSVa+gfFHaZtdGUOKwguJMAQpQXARaB7dnh7jMLSQg5fXsrmuB"; +moduleBuffer += "Nm+hBaakqSIwhVb3LSW01qWeUdnfLITvws7plUQU1Ply4JVuD65kO2htCyndU/rjqWeZJuEhCjlXf7cei5XJQJ+9/gRn1+tfgd87"; +moduleBuffer += "+pCx6d7XnwRa6eMU4K7fXZV6lofoX00E8vrXUHLUTylNwlOfcqp+xqM0Mr5JD8xphsuuDidJeR1J9giPb+YMcAPzClaukSblLK15"; +moduleBuffer += "mOEYU4pBFueNdsGEUyJXn79Fb5v5W7Lzd6GYv1E7fxGYAAzSsagzonvaCNFGGBEgWph2FTW0UEdnn2ukU4gHlAjsy2SiQw5sVDZu"; +moduleBuffer += "6INl6ZWwOdczkrAdLQ5ORodtX8e1uzYgjFaHsqs+hoAsjHRY+QDYr35zyT01wffIF1OI8mXPagBJh/yPZ/frTrpXv+jIfo+epVIr"; +moduleBuffer += "GAIf2zqw9hrLoFwNR3DsZA9NkrNOrypWHjsZWiZ+sjoQ8SjT5ix/E9ag7YgwB2hMYUi2fh7Uhh0rjwjEBajEoj993GLya2Ee/NTq"; +moduleBuffer += "G+Yrj686yXshal72sX2efWX7fGX7fGX7fGX7fGX7fGX7fGX7fIntM7mv2jmfaMvOOYWdc9UrfLIsFJucV+yc3EkMd05uXn6xuxju"; +moduleBuffer += "nOV+ZPNWVdCceppcsxukTRb7pa9JbLNh9S32N68qbGXcReFipwtsVS636BUjrVti4NWJgeFe5m2hBkZ3p83kwJQi1GGSYLitGLuo"; +moduleBuffer += "BJ0N9894xr2fAl3dxuCT025jhpuYJ1299z4VJ8zv2MPlnXrobNfDbXu3pGBYh8zacKuFG5xiq21IN9N45g2LJ4BWKj7VMaxRZC1I"; +moduleBuffer += "Kyhkiv1PEWveDmzZDuxsObAVDuylRrWww6g2th0V97LtRia8hSHd71qMNgXhsTJeOmY9XRA77FZCZUyxOxvwH0IHAIGGQqDBTBeL"; +moduleBuffer += "OuS6M8WGHBXLj7C5ow6aM5tAo9dAxS4JkA8Bxd8BKPu2h0m6LUiS7SGi28Mouq0yYToO2jCyXRlLsfsjyII2uSl2n93qx0Z3LVOI"; +moduleBuffer += "kyfYda/vkfeV/cvYzeZK+liV7csoxZPdi96B9mVXcT687GpApZiJXgl28Dvw33SunCTuDlgpaUsnoKW3Anqf0uYElPxIuRcZK5Bu"; +moduleBuffer += "UphrClHs8BTdpVMUso7FgoHs3lnsKJgiuxvRW8/hiq1MDgivImOaRBh6EtoR+b3aMjvjIOeSN1bQU1Bvv7aMgmIMsR3D6KZ9p0nJ"; +moduleBuffer += "9J5ah9HX0I6m2Oau0q62D3hn0JkrbLMxaDq32xQ+igjdDlr3tfUQexj3GZU1t+zGZ/eUAABsojvcxprl7rGCRvxio5JsQIsdOl1c"; +moduleBuffer += "CPB6L+1IO9xDcLN3pe4x3EPOeqq64XEPMThpyB6y2HXNcau5bQrLgq/nX+pAFdSd7e5xjecHYRQ3mq12p9tLRkb3jI3v2k23Sg5d"; +moduleBuffer += "WSGI4T704dGPO1DnNDM+nD659NycfCbue+09W0uf3bn07q2l13YuvQv+fZ3cH0Brx1DNBWqkJjf66ckPFp+aA+agZPy4i2t//U3o"; +moduleBuffer += "M7492E9nXCbfO4CaKZ6ecgaqQ1O1NK4tubZ+27UzZf2u1v+ks329w5WNbR3kUx/ccZCj2zb93Oamf2iHIQ03PTJcmYXTA7/2DVWW"; +moduleBuffer += "bB3HY7+24zh6245jfXPT772sprtbmz7xoR2b7mwt/eDOpdvbDGvn0q2tpZ/duXSzwtgaEC5+aBMQTl8WEBpbmz51dsem422wbufS"; +moduleBuffer += "0TbD2rl0uLX0wod3LB1UmCDLNv/3LlTA+WGqPzL0/AV+39aMiWpdAmzeIeeN2H3pXG8mPYB2aQ2X0rMe0Pq6VN3HQ5G8Wt0uIaq9"; +moduleBuffer += "8HciHp4Fzq//QxEPb9tJ3/jApkn/icuadLPtMjrxkW9oBbtDMOAM5i44kHKZ7DCLHQfbhJvvuYW+JbdQlLMf/vr700FvStS8nAq2"; +moduleBuffer += "who1WOPs1q825TR1NU5TS14hhyQLaxxKFl08+JWcRl4MiRLXNS+hyLEQL2reBMWVhcTQ1TOTi+/9SvJVr0qStVroAKCWrCpIigpW"; +moduleBuffer += "hyvYGK5gebiC5aqCiawQdbpDckccI+MquWIrCEtxjEeWbIvwBkIUSpqUd7OyIVxsw/VhiiPX8DfUDywv63m8aVmJQ1SIthqVICnQ"; +moduleBuffer += "I7FWu+QqY0amaCZdpIggZCvDPYMI4c5HVFaWzKsJfsGUtu58pBJZtQqxZldFgZWgJrJ8lPZq1faqvKNvVr3CqWtEuVt0LCw6tu3w"; +moduleBuffer += "9fgiR4JCiipHgkJiCSEWDkOQYFFPZHchxKBW+GJxDijEeirDWjEQYgm7TwHWwVJ+pedfyK+s7MqeRq4pwZNSRkWBUyHjaSmn3Fch"; +moduleBuffer += "sLL93brAtVUIgVoq/K1D7tx2kFuzkDtTQG7EQq5pZVuqddC2spCsvWWKfTvFvQNyPpTOT8KD6VseEdZ/tx4I7oRgqJP29YipfD46"; +moduleBuffer += "PVb1tq3ypQa5/7KDXe1HQgFVkqZ3Ftx/A+IdAAKT2ntLOamJVcy+Wpl6K34WPIMXPPDwV1hRq1VZYftyLmipaJb98FVHhOx+ozwE"; +moduleBuffer += "xHp6Iuu/Rs/AFG0p6w8QsPqr6qonesa+plgiUs0B77x+CoWSgOffA946xRAHPPgUVkw84MEXMfIuGmppXLoksIUf4pnjB7wLJq00"; +moduleBuffer += "8OX8nvyOq7cWcng413Anj+FU8RoDbVH3NaBox5B0BJKSbGfRsXmkY6jHoVRD020BpYtiLU0nsiglnWadYynf7M26+mZcwCnpqSzR"; +moduleBuffer += "9IRMtIufUU1PZWNIj2fjmk6huYgKd2t6byYnOXlsplJ1nKLWdoq6eilqkAOj/B1LUTpKd8lfP90jf2MU91i8yeJtFu+x+IgtPsbi"; +moduleBuffer += "+KjBjzx8FPCjmB81+VGbH/XsRyP8aIwf4dMWPs2umrlycT67kn8n+Zci8mvuy6ZmmvfLsS7tHYPOlHyQsIpRVjHOKnaz9XDos4mZ"; +moduleBuffer += "pb9x2KfGMeAN+wRoT9oCk6x3qizWQtcxPVfaAleywJUsAC2hY7Z/UgO/sf2c4t8rHoJO9DVzqg3tCcjlk90casyhNjnUtvydsAMa"; +moduleBuffer += "OQaBLQc0xgHt4oB2HsoVm1pK2NJutDRO0MZsr8n22myvV2tvDO2NsL1dbO/yWxpnS+NoaZSA1Klssr022+uxvZFae7vQ3hjbu/yW"; +moduleBuffer += "JtjSKFpK2NI40Ujba7O9HtsbYXtjtfb2oL1dl93SFFtK0FKHLY2ypXEirLbXY3sjbG+M7e0q2+uiPbSkBOO++cyzDfpDDQZlg6k0"; +moduleBuffer += "eJWWEVqOOjwpkVmKc5/9KuBXPr9y5/ZTCd+b6UKAsnsRjXxGUMuiaFEOtUNnf8rWblFcvgulFX+4k1L966Grn3rlt37r3bE7frx+"; +moduleBuffer += "BQ0uMfnZiFwNVCjxA5mU/LQ1//AslGbxoxHUso7mI4wiNA3D5OcildlTZa+tyVV5GzHIOguftt5/JgZZr7SZWPIH3COTQZaUmYuS"; +moduleBuffer += "2eSunY3UjSkcXrBAbbCrLazTP660kTyIhmTXQX5AB+nyUDYeK+OVhba2hvK1Wdumm8rFZaP11g7b1mSXt8NzB9l41ZpbtGa0Nd55"; +moduleBuffer += "Z2414IveIK1GiuvtaogX6GV6eGzr4E6qLlad26ZbOjS2KiwuAgumEbp12RX4+WN/97hTdFV4akxtMbRWsthUoJUezxrKONcB5g5Z"; +moduleBuffer += "uqy6ev0Fjj5rVd2Dq8IOXZY8GCl/LrtWV2Hnp7u1pcvsNPdm6sOy8kjHYHSKe2UdSVnHtugT6tdubSqL8V409fFumPp4L5hhr1XG"; +moduleBuffer += "dmnBK2adI/K0rsvsTX0ePcxjJIuJfdqVjmFcQu+le/LgsKR91dFXxr7iXXLRgU46rm/HFDIONR/KVnid9p6GCY57x0rBppvHtzPI"; +moduleBuffer += "YDSXGbhycmBlnXn5tbcjLBYM6RycgZddHNm93J0FPbnkzWVBDl/juTeHKAK5OZqv/IcnaVqcmnse6cM9oncrvlarKT9/geZE/QA5"; +moduleBuffer += "HoNTCmsku1kqvGf0enyWw3ov9YtssJ/Fm3jHN+2tbxp405BHxLTU2KtBLjQv6DgtGvdVQzRDQ+zBvqoYiVTZj4dG7GLEhiMm5Mrx"; +moduleBuffer += "8ZB+eeNzyRFuN74d3rS3vnmx8bXS0D+8uflG0byUtN+FMq4sxAeQbksuREXJv/aP4/gFc17QKnNUTsSvp4WnO5BzX0uBxPBVL3Mr"; +moduleBuffer += "AlNBG0XQOd8K4Yt5A9wxb7mjkqT6JBlMUlCgJaZoxpGeWDQMymkqcstRzPzXP9uzLTLaF9ui4zbv2tu9i/Eu3hElGQ+1BtGyL3EN"; +moduleBuffer += "pvFmmEoO4Xlnx1F4mq3whPhHngBSIHcyR2x/9OSTTm6So8hKNesxZHmatepo3jnkBZq34GreM8hr2jyjeSd+SPLGkOcIXfop98oe"; +moduleBuffer += "15n0KV9+7Eknech3WvJsU78gqbWG8Y93IYdaM8Wt/kU1bHKyqLidDIdvJy+oSGfL9eR5m7/pfvKczd58QXlWL6MvuGpOFvM6D7uV"; +moduleBuffer += "HuTl1UW30u0olXii4c6ccSkt2toZR/M3dSbW3M19Oa19OeNmvBI972ZNa8GAQG0NXhyqk0t76Vac1akJoJd08t3Z7TocD3d4UcVl"; +moduleBuffer += "Wzp80dH8TR2+YLM39/gcpX3eoqv3qecsFCcgcdKbPuo0XMt9z174dVDyrRCbFGNaKS5UR0r5A26Ml2tjOr3dmJrDYzo4SJvbDGla"; +moduleBuffer += "szeNaEJzNw9ooRBJYV3iiaFa3tGnpsJ0H6DeV1xaI+tg1rSqL1TS0KlRAxve58cKia5CYpMaESHxfQqJUZZY0ip6qqZESPRUYFtC"; +moduleBuffer += "4o01QNC23+Au1XYiqVqHVKuQApUttoAtIQUrYOB1XqzmkNR2FrVRTyml7oMOJ6mGMwGZlk7bSGU7GVIuZaxqIk4MunjiO2lGcw6S"; +moduleBuffer += "aDhtpfZM5ull7Dl59GfICFEFB4JlTZwF/2wT+OEYgWXCap2BLhCCGJ9BTXmcL/7tE07yp5GWWNISskugVH66/u60vgvsuzP1d8v6"; +moduleBuffer += "zrfvztp39DhRRHd0aAFXJmIlT0yoUg8eqT0kjNVC5F6Fw9V6u5Crr7UGigFZU2OtCg/GrCXwyTYLiyT5UUMhMYNetpKnwK1tNAe6"; +moduleBuffer += "xrOk+Hi1OaBWA12FF5nrjob1HtFKUHWPSdayEsIlGez+stHkAmVa0SCbUhvKbEyzNiL4jqS9aTauWQvhgLaxRSOMKY+mdiMLfYkG"; +moduleBuffer += "as+ZTSAHUtl8oa2xcrN2OVzuk6ZIrsUIoaEVLDTgUQafwp3FSgNuiJDiaaqByBlIYXKWmjR0l1TDnleugW/25O32THFl1U/ocY0W"; +moduleBuffer += "CShm7S4SUFkeK4fjwVeZTcDQfLwI72t7zh7DoZTtFOSOPdu92HYmhoZF2S3cRVzJTk2mhPRUSuhelVYQLfqpMLwiLSDnpxY/gpRY"; +moduleBuffer += "gUVfNtsum+2VzXYraPhAGoWGn1qcapa9b5fVmLKabllNr+q9/3X2/sqi+wBaUvR+pAgpbMcTFT2KCxxopBVuBGBsi4lcUdyx0xig"; +moduleBuffer += "O1fLCzjQWXeS45nDm6cOE/ADg6sg16ZkQttYgb8euSMQ1FJwKov8mApbPZWU+sdUwhqpIBVSNEpgGyrCbR6bh7KcdBXMbNo8hjMx"; +moduleBuffer += "RYYU+LYoHqJwt21LGhRSwV9EmaNnhWQU+XZYKhuloKcnf6HNiUpjllTxXUuryhIVIlnR0shM836V5FKUyMY8dMtQxutDfgllm2Do"; +moduleBuffer += "q64VLUEPB1J4CFLRn8S+TyiMGrGlBDeOpT37qsdXiX3VU1loBwIz9rzo34hK3IZkoC005KcUaBd97bK6CMONIZcVumTfbN/jcFO9"; +moduleBuffer += "kHiiDkodQRGtpLoAe+MYRa8vAoPNNUKy2cR0xajRZ42mrFH7K4ddTHzj2NfR04mip7GCocl628SITjlzrPIya5ziaR/XC6gxZo0q"; +moduleBuffer += "EvU29bcBOAR1qZ+xdXtDdftDosnRma9ZoSHqMBBNmmHRpM+vvCHRpIFo0qNo0lA02Zv5OxVNekOiyRErkrQ4J9+FVgBa62QpmjQ1"; +moduleBuffer += "0eRHW27nuHWhy9NA6l7vPCBnBNzAH3JwLnLzB8wAl/FOkJvWISdXP7P0O5siFLtqRjzjDOhzGm5C4d49vN4JrJPe5Mebfa/0k4pD"; +moduleBuffer += "EbzVqW9Q3bIR3CD5Q5zuvdLXJb12J8kfGw0Q6FXuRz16xWoxeDr6DFeVwbbqY/Lqu4V3sfXRFUSyFugXYfmWniUpbU1+176Mai8N"; +moduleBuffer += "Xwq7nvyefRvX3nqbxuEmX3W/rnFolY1alT4bPOFWDTZrb4PNDYKnSC6ab6DRllbro1q4n3CnzTNu4bccKOBSuUWaeAY6FTfmrqLA"; +moduleBuffer += "rTrfKZTMBsn7I62tXast0to2hmozh5w7WNsG1W2K2v5VWdtTtdo6tdpire2EqdfmHXLeytpOAD3vLNDzf1f0VDm7yZ92NuGnZ/Gz"; +moduleBuffer += "O4yfboWfbh0/1a+OgLmb/GdKn2ogdusgdisQuxY/vRp+uuVwGKOUAgT4M4TyiKqZwO3kdRqYcxpkiDos8D6Zgvaq7lCs6keRKviE"; +moduleBuffer += "qoWCqAa503chxaAUBP76PPjhuu5m6wWaIgmNdkk5BQKD+bnb6lPxE94hDZYl++rk7i1UUsOcsNt+shpsGQU8vZM3N3CvrSFRHMIO"; +moduleBuffer += "pBT+71ovVaC5XYFAC6A3UCrbWiCsFYi3KxDVCkTbFYhrBcLtCjRqBYLtCjRrBfztCrRqw/S2K9CuFTDbFejUCkB2qtipAGzpYUZw"; +moduleBuffer += "7GcCt0cN27DwjXxGjhBwF6KenjVijsxy8paUuTgU2Vf7cFmkx/asZd/zjqYogAucRmpNDrIOiyBMz1mc3xZ44kFkhEegBCM7uObD"; +moduleBuffer += "uXxS5cdF/pqrQZKZ7/OkA38QTbwFFra02PlgQDVmT1rzGYkJR/YeXlKNQ4u30g4eqoI4kFCNWgu6RUGzuSDOwkiPaHMbvEBqJP+F"; +moduleBuffer += "LhqSjzZQUB748jTvGYLkr5iXu9pzXLI1ZLyeFkLwZ5jHudpgE1X5vGUTBt5+uqleROWIinpjvPTzdf1Akqxm+BNPC8uJTWtfDOhX"; +moduleBuffer += "UCvo6nSF4Hg4RRFnG7ErbI9XggFlCQHqgjEov2vpd0H5XczvFFQoCHGObaNZtVFgSvlxlxlF7Wqdgq9kykOg6MmGGx/P034ING0U"; +moduleBuffer += "aHpQupQ7+TmXkTx9BlSNk3cBFBP7zYKBl/oVr09jrP3mJNwX+/lJqEWetQExBNPSYFZqSd8MP/UdV6874FMnjeVl/vB9q05yMaRn"; +moduleBuffer += "8DwFPeSfvfljePHhCIkJ/MG5PM2fQu6fyrzQnbJWhkC18k5A9oiPkk96wjbI76qHDWPaPOb1Wc1ZD3716eZH237u3bbtaQQcnmbo"; +moduleBuffer += "tyh/4d3ahFQcwjOwm3zMwAtPKJ/8WxnJGfedWTDoQ24UzOIkKTm30+U2yuPC8WPs1nTZzslqKNOk+Ig7lz+gQ+Gd4CEBo60AUJd1"; +moduleBuffer += "qIv7JK8+4vw/2jSsIK93Hm3Q1ZTU/EwJvUcbAx3tuA4+6Qey1YQMDkCXs5CMI5QqxN7w4thS7/iPNhDHkw0Fg/waeqhHGx9oCPE4"; +moduleBuffer += "ckh+hemls1PZB59s6M672iAN2W8eQwYClzXsPMjfxqAcyUI8SD7qV6yeB3avLOINkl/ihJ1tZO5NHYdz1chjMnMyfY1Mo4Kl7rWO"; +moduleBuffer += "8x6N6tzSuqGGNW0W4mSpqTUJlJol1LDyGoqmJxGMJX/qpIbLBLqGigynYoXTknrdlrE81SD6PtUYcDyhgBMuMiPc+2GO02g240Q3"; +moduleBuffer += "oUkFjvuE1PqwolyowF8NsRhkGGGfPTwbanAHIbz5wyj+13L+p/NN+rzPHztBHGCEAhZ6zhbyET5UcO7WjvpLgv9a6cXJ9yhuhmmE"; +moduleBuffer += "WfRa+VP3rzr5t2i/88eQePa9UuYCnBCiky+gQlwxWMBFJLwucRl/35k/9e76MAIdhs4SLqw5CDd5j1BszFGULEC8GuWaJZh5O6J4"; +moduleBuffer += "Ic5V/oyOhqvojKu+yInbIQ40JF5h8iNGpyV5EPOz1hDq08MpQbD5qaKv/92o0dlTO1Cjc6e2o0bnT70YNfqVr48aXfzR7ajR4qnN"; +moduleBuffer += "1Gj166RGq5uo0elT21GjM6f+/tTowqlXqNFlUKPnfvrloEZn3ie1/vJlU6Oz79tKjc69bxM1uvi+F6VGp39sMzU6/+M1anQOiY3T"; +moduleBuffer += "dWq0+GMvRY3O/2h9GDtRo/u3UqP7N1OjC+/7+1Gj8++zfX0+Mv5xj9expVlAMhBKJO+FEkGCkT/uYC6oNS0vHseLlCrm+cUPPwFn"; +moduleBuffer += "r6rftC4ZG/UM4d7zC7UM3O/chYJFHnxMq1aWHKmWvNQ6DGHsUBX402FbHt6TPAdJ9hvmqHpm8sNzROsP6dWNhygIZwGaMN+wgmHh"; +moduleBuffer += "smcq79rF49ny0d41UcWneLtePZ4fKggVZSjO447ieucM4qjSXfXz1D9+JItnXnt/Gs007he2PJ7x7j8hOQtf8+6bmb7/BK/qX4ju"; +moduleBuffer += "m5m4X2/tL/bum4nvP3FCPnDvtxny3FvUcsi/ZpGfp42Zg4snTpyg5jLOzRdcko4FF7QDwHoegoeTHvXmEP8HEY7OASr3RRTF9A1D"; +moduleBuffer += "9unJnMo+JFAGBAqCCyFQbtsNSCoOzuUHGSsOR5ncakblcX6+gHJ+EhbuyW/FesN/0p5NfivWWctMiTUp/UnU6rhg64DW4W/Rq7H0"; +moduleBuffer += "A9d7M8s2atcJDMLZb16g/3Kcivabi+z986bvptY/jeyEhVMZVs31lQ6S3/NI76T0wx4OMdNmxbu94+ihSb56uMQtWV/vilHAgdKT"; +moduleBuffer += "gycG0sPDgx6VgCiccfOJo9Bz+Jo3l8dHj+Ca8R6m4DnwniNH2DudFQxRlteHOUQSTlqU5Kn2WbbSc79WgPA0e67GCoppy8xZreWc"; +moduleBuffer += "Yc65KkftHg54S2qcwoplKFLx2tknLFFjAAuarhiukHV9QxUQfLNq18UaNdt/e9wdOW6jyEXbmcVCuoWgdGXKgASY/AZUDi0bM3u9"; +moduleBuffer += "42ThrCy5J7zBXIbo0bk7JwVk2+O7YFYe+S7Wd5lQucBujLNd4xraJzm39BnZrnET90pIvufy43frJ/0AoWXNPbn3Tvn1UJX3Tklz"; +moduleBuffer += "V7qt42qoTri2FWrwqY9z64+EgdEQsxOIQJv7sI9iwFJGac3n5zIPgqgIO9Fe/KQgOddpbFOEo/Xg7z6SXc67C0VvoENPUEdY2IHc"; +moduleBuffer += "jAwQOicCvn43lDsOmDtx6yHsxH5zB59gzPUmuwtrcFkQ8qccOKn/qIfOvS2j/pk8HcSfGzRK7nUawnlfX8rkX5DivdzGY3Ze675N"; +moduleBuffer += "fh5/93t+wId9WkQORQ66P8kvGHN3HOfj/DwAIdgWXe+8KfmKEfZJnt6MJx9P34WnMO3h+XZ5huuTPDx6hM0gDM9RglzS/xf3SXMU"; +moduleBuffer += "mUi/jXFaZUuKk/O4UERIa/xp5xdtk/Ci4qeNI0eO6PxBAnDzkTQ4kkNDqyMrvC88Ur9XSkiBW2nzCDS6jM4/1AX85EthNnZrNt7h"; +moduleBuffer += "7U3uIe3fSmUnR+MHjQx4fdwe9GOpsCX/d3AFrwGfLdYKjgh7repht4HpgYaf929zWTqqC5Y1ch8vEL0OMdRlGS/+jmIRYpH1W/iJ"; +moduleBuffer += "EQwaOLE3hUhBcCKGRBSceCzVQx4aQCQ4zqyQNpYBhGf7oOgFRMHtrjcHFMOT4B9REqU7FIkGGNSbYJ92QBBMODFhaIGJAWM9CwJ6"; +moduleBuffer += "hzV4s/y9AVGVPurVVqp08Y7MBy7J06szBsQ7mMW3djiItN/Gz1S/a3usTUvWPmxWAwaDvwll89dDqZPYFgDbbkj1Ivk8IPITIYPQ"; +moduleBuffer += "4A+0o9v5hd/RGQ+ud25AmOx7slHhDDApwvk5/V35XQjNd73zun5Xeu+DsxM+9tMfdwavcjETD+FRSiIUtSR/wSYFZyZnH8/j750T"; +moduleBuffer += "SKIyKMD5Gp5H2r4zC2/q4Hzg3tzBdYMg6m068O/uM0zOWzW6oIvAyyBCm3tm+l307B+oS7nQxfz0Zz6umm3Sn5ihAEPAMJGFlO+b"; +moduleBuffer += "E1DJ2pF+sAsv3XZy2W078u9Mve3cvaVo3pVmBddvmEOcQ2m+fbnNty+7edlY87NF89K4ua3jEx7nXhwe3f8+8OhaeOwStnKOMOle"; +moduleBuffer += "bhe63zhM3gy6VoeJZHrQ1mzkrzvkePjhGnNvnjzkmHago7i4ZkuzwsXi29yTf+fLmjgwIwMTrnjT/PKI/A1PLziYoptow9Pl5+mV"; +moduleBuffer += "AiMfg0SsM+ygu7lbZK18XGrJxjo2SMcnNVwQzlgmHZul3YK5dZI8qUueVJhRF7TC4Zq9O+0d6ffs6ZlMre1Tj8E9c/coN4rcBXNg"; +moduleBuffer += "L7gCvBKejRep5eXICG4uOi1sUW8XCtlh/Pl36g77DmgYSWvYDDto5eZOiAxXd0xB5Td3yO0bZOBI5zHu9PWOhwwvFUKE83wH+2ND"; +moduleBuffer += "90dHCRNMARrYRlu6jYJeSW1gbSDz5lYL0HaOpK0jqVdslcERKyygSjovWhDOs1llaMDPxuaMuJbBTyJFo8UhNDpdpoCQZ9bqSHW2"; +moduleBuffer += "TOG7c0PfnR/67kKRQgh2IEDr/aE7ClZyISjv75P3NtWUqKmGRT3NODwL20b8JJqBGwdYIvVgsqD6cqNqS4HcRHMXGB+OuSa/yDsK"; +moduleBuffer += "qtpmLWtZYaDEBK87Q+Y9BlHIocdII59OkQtz9cMHvHXopjFkkJqTeNrWMk+cfmGOEaBRV/WGbQWR1WDVVKzawPXKEZRYa7d1ebDB"; +moduleBuffer += "oGIsXd/QnIM6x1mXSb7F5dEY4s9qP1b5tpGOIim8jvajVfahXba/7cBgk9SoNe2BYec4Q1ToUiM2a9WGlFSAi1XJfahihxXDlNdW"; +moduleBuffer += "CfsXXNMURlgFoOCsp6p1yasDatEbAtSCZ3u77Kl5j6emLOYyB6t9qkF4Vc+jAkMYHdFCTRHIH6RjWsiDB3471fZ6jMgWFuY2Xcmx"; +moduleBuffer += "XzcV9iyh5jT6dBC3pKf9IpyXAyGnwW1bmTGNjMUqg6P1D9CdxwJdqv+577awZlbCujneIVUFjVVrU7WPs4jZWBptq4jZtEulxTdr"; +moduleBuffer += "gZrjNZLvsdqbMBGKmFoOCsOpQ7yMs1p7gfDv32M1RjvYEJIll5PblGyIl1ryW33XLr4TBovfrRKVy+9c+53hd569eNSv/aJVVSRU"; +moduleBuffer += "GZFVFfRtdRvWli1EdVvK+fmDX1x1WJkqfUY0WWPLUbIAAWFUUwK1xoffo1qgWZO3xax3hbekMUHjp218uqUxtW6MbRWhNq0ToyWH"; +moduleBuffer += "IOHWYKA9KdVRV0sYfA9xqNbY5tH7ehsca0W4VgbQG1LlIWv/ZV80+cLoC2BdUX1TJh+vOuyq6ksW1a/wAvSZ0ATHYwj5NlxiHJiE"; +moduleBuffer += "PLiNwdLkKbwVkhTZ4o4O+nKc7ffy9XtLTkLddwjQQUWWKZWAr400GthUFld+NwLrrKHy6bvE3JVNuQvMPbspd4NHnNVNuevMPTeU"; +moduleBuffer += "20tLHxfwpiFz1oGKPZTQob+Yli4e4PgCHiuhms+37RT+MYYct8Zpi+5H8Rrhd0vHF3TCAWcFcI3A102aBZ4pXy/jdQOK9nzdoA3h"; +moduleBuffer += "2fL1Cl53ofRP9fiMdhyZetNQ93OqwM/YM8L04MrEcjvqhaU7FAYm3hIGhj5c4s1RYOh3JN4SBYYuTOItUWAoNYq3RIHxmDcUAqaX"; +moduleBuffer += "Wrca9LKxCeiFbws4IdkE8cI5KZ3EDkO7cKxKt6rDkC79tdIZyzCYS6cqXfXJ0p1X53rYNhXS9GiB2tQXo/VJAX+p+O13CjCnnQMe"; +moduleBuffer += "NJ3Ttmwo+G0x9qmXNg94a/htHPDO4bd7wFtVszUhgIgPQtL1Da2u5ePbry61GSlWl6aGV9cFZ7vVteFst7ouOtutLjV62by6Ft1X"; +moduleBuffer += "Vtcrq+t/xNX1lVB5peUriuupJQYxNcnrOT+Zn3xZDlYzK/Yi4YVduYNrD5yInt+VWsTfbzbgKPviLjLlGmN1Y9cg+cGYERVP78HW"; +moduleBuffer += "vLC7CsC6tAcGQKaIa5qvTkgdJ/aoHffGrgNmEU6K2vvNg/zlQm/fPgnR3jJKhfvNAt0Y7ZGTNcXAssb1SsLwSuKBPTgVL8DlaaEO"; +moduleBuffer += "yfmHDYi9oojLK4o2ztDot4zCkJeTzud+/uxzeg0oRZb39Kly+8AemiXbywBAiCxHbg1e84VRveSB769B/rRwOEJE1PRFiEn5rXxW"; +moduleBuffer += "e6cOtNwyJSeMvhyRUWV5Q5DczHpXRwfDX8rWz8iXGxMD2visjA9o3SMQpQnKgqSb+QsGYNJOh7l3D8UV0uzYUG1h7s/dk/fmEDms"; +moduleBuffer += "L3BUMlo0DcQw2gU52BXtL+xRnpiVJf8GrFFR200dn9wknIQY+UuwShUBn9fH+WFyrP5J7s/iviKwzbW1Wrr6XXdgc9+6GybJPNIn"; +moduleBuffer += "H4izIHkeFjdg2vfNpkxBdG70UaUbsrzbWybB0SsdGeTcTYyxrGiPcc3Wx8bDy7+hBqeFfvFy+Qq98NViOuO5e4+8f+cgOcaqYVzs"; +moduleBuffer += "awF+xtZVmLUSu22su9Wg0LR3KeOmxR4O5D/vQeD6mOl75nglij5rKIlGzNEAt6h2QQUIPRqQQ2/bVRXkey1fp4dNZGHJrZoDlKB7"; +moduleBuffer += "lKwzDLCpwgAH9uy3Cp8OLrhFHPOTuaIv2oeOh466vIPnadrkLzgaMv6GgRwYnrGJFR5lAoRttmfLgOqjwswjcHOZt0z/FgHsEIo8"; +moduleBuffer += "9O+g9viUOeCdxmkggBqPl7wbn+txNEyeQRcmBsl9TYqvCBzZACUtMPyF6IggCV50wNhrmY7Ha5x128c1aqA27GVgAOPmrJc2yzQt"; +moduleBuffer += "BeW8bNPQ4zjtMlh1wOMMaouSsw3ZKQKGB9AB4FJjrXYkDxgCwJSVmFWPNqIxz/fQ0sgXH1l1ym6dDTB7+yoYrTBjugZIZqRDlU4c"; +moduleBuffer += "8JZxxASs5HjKenko+1DDXt+4ex3Ve1e9qAmQg4NFHb6Sh31VGgSzatSHV5FU36RYyX7ykYaGOTTJDzQ1cJ58gO1NUU7jKIa0ui1y"; +moduleBuffer += "zjHnXJWDWg8fgO69ei1hKbYcV1+xZ0mVZs8nirSvRg+ULST/mx7lkRYUsHiRXwB4R5Jfivte7kItXNeaS7QCUlVYUM3/TjMPk1Vd"; +moduleBuffer += "A8n/6+ltFn9iCJm/ipZ2syW640x+sMGrpuTnYiEk9Y5A0PoLvyLJcSZb0Nh3Ve/cV1VwoiClGr90wjUTx30wwgv+bNYs7+HM9c6y"; +moduleBuffer += "yRu3dCCW+xnZdU796uNOcl8Dm1sT8cSzOAul+awhMynk5LC1Uo2Q14ZyeHC90873KJXfc8hpDxlHBK9ygdpdirSTo0f6vALzsw5t"; +moduleBuffer += "NahHJOz3a12otV0NNYnkHshqXQiyJ6ASoV4zBZeO5uERIXL5n/70x528pQYVz/6UPD8vGaro46GmtkrBY/0BAe1W9RLMpFWFFQZs"; +moduleBuffer += "H6GsbC/c1aAjxsqMrnd4cevzLjV5hkYmcW5uoVz8hkEGmg6TjvyJX5ZujMrp/vQj8vD0L3+8Ujy61rQPUGUpwRY9VVDKUMOcj1cY"; +moduleBuffer += "SYGtQFyO7bwtXTUFS7UOWXsF0RiADzNI4/Onnn4cLrBv9o9zt8o/9TTnLsidFiJ70twj9wcsV6jth7ms8UnpROFqZhqu8vJQjVbC"; +moduleBuffer += "651XS2oPjGhk4IcEBFy30wcMXfW8ynnNa50R8FO61u14/HwM6QOYZoFzHsLahmC+3rkawUWvd65Cj653phCCFNf/bfyMg1mAll5X"; +moduleBuffer += "+5HkIc2tck6kj+mH90pXV2l3oFegDVQ0cQtuGe0gGvn4bNdzqLbA1q68BTcKeLpCnrADF9m+zb6549K/h832ytIebPjRNyjgdVN2"; +moduleBuffer += "sK3WPH9FLbggD63hRpAzJmUyKPTdZb4PHuBdcmRNN5iXHuDuPDXQyJe1Pda19LLYhl1LT7mbSn+uOeTAm3x4yBlFpYcE9kHawLQE"; +moduleBuffer += "MBJB0JUWYBSkXSB7kCbWIoTX205hbWSsBs66m7k61fT75aax4Dc+lJWGZ/kjWD9JNhsX01TXmciEGrjWUXsEwigj6ccgJW6hIrsP"; +moduleBuffer += "fAcEY78RKHnHrcwNlb8w6IHKTunDJCzbVWBN6l9rXn3Am4COEy69XWs7hQU4WhJPbCzZeNqtfeXJXmW3ooa031B/PH7yIVfIsKDT"; +moduleBuffer += "JHACCGWtsdx0ciZdfChvJGc8faFNYV9zi1Wvtil+OvlQ8ktGBb2Q6z4Km/yCamA2HxY6Pl25apo2Z9ysZ9vBum7XCnvTuhG4yW/6"; +moduleBuffer += "SjnTLXUtulUlwLmy9DI7tKX86Vp5eOtxwdAxAnC+F2jYTpN6D7DtTNM5kBKhslyIRVx0NtTOGrBuPYveNGskDKTfJd08IWPY3ICZ"; +moduleBuffer += "J7zSNg7HkxgyEJn+aSgnmWIWCi+62VXSH718aqf6AriYpPpdehUC3TOWL6vTApCEJEWKvlgOeG9NNUi1W3GgrvqC8M64yk70E5nh"; +moduleBuffer += "fbNZm9osOsVjyV83wOqNQX0kEWiNJf8txlJqY/HI8T3fdcihm1OsbpRKLkF1DDeFCil6EAOkhBSnScVXEKBJyXe0IJ7HPSz0pjfN"; +moduleBuffer += "EaE1BFcFjoBG9w3v8AHqek9YGlHBNbVUogBrqHREJQbaDRKStTJDETEjYNnnqbK3k3wSmJcTj76uu7bbsqZf5SavdTHWcCDrbNRS"; +moduleBuffer += "eElHSMsR8HoVmruW8LDaBtTYrVHQpNbdZt0NZbVape+1brqr5A8tNdhECyAaq0gB/OJ0i5SlBO8gB5eOl5uRoN5ovYw87ZNsQal+"; +moduleBuffer += "QxHCJULIbpcAFcLk3USJEKxYg/cd3x8r59EASriKEngQlGgAHwx1CNBcDJJDfMDWLCMs8SFWUBT40KavJ7dWE9qTylqcYoV4DCi8"; +moduleBuffer += "CXMfYxp92FmW1e1FxtO1jPEBKaudZ7bnq9cXphU+hu3Z6WH9bzwgzFXMewqsLAu3GLdjfo3/junHrsZ+s8FuWbxtJ2abpkD+F4BF"; +moduleBuffer += "edx3qZqGkCPVYQAacnAcXB0XojTS44Gh4t1UFisCyK7HNnxywcKLeHa3bFuXMHa/w+cHcZGHg49UXB0RcPCRjMOzZXqiXk9S1lO2"; +moduleBuffer += "hf0UZqC532fVZKWjwl07BFtWBlb6j8RFNvVNywVNYdQFWdAHsYc+ixDrugHHeawb8HUDddKkciwQCL/2rSeD2avCqrSQF6WD5LMN"; +moduleBuffer += "lSFnasONP+PJ/2e1jGN9vaLX8tAAhHxKXs84/Um7X5ccLiQc+5QWHSQzB6ck3NLi5D0ye+ltcu5pUVio/Gk/BsJOg6V8s7CH4GED"; +moduleBuffer += "5EBHV35i8JyQpPcbKvzRusyxtMF1jHP0jMVBIWXxjNtSYwYskVloQkKqOTnfn8whbwPO9FVlV2D0fZLb6dOo+i5YIPPgt9+8k0rG"; +moduleBuffer += "0JS7K4e00M2fIzrDpwp+YlVmDPdaljtKPhjqKo/YZV7ufRCuWEJaFsCa+T953CkFdeXslxtoNrogSKEOG+xeQJ4QfK1MQQuyKo1E"; +moduleBuffer += "M3eTFn5bVfjwLAvfoIUPt/IGoDX0weSMuVNA3SaoOUo6kb10zVs65AKl43qyVzwH7NJA7bIDJUEokqzF6hCOOApM06NKh+pA+Fq4"; +moduleBuffer += "3c7Mu1UU6znqoe8F2GPmp0wlXH2eOSdNsXo8gFT+nqjl4KDu1m0LhjDXvCAMwdsLJPbukC7EuX8z3QsyrhoWkr1rFTaVmkudnBYq"; +moduleBuffer += "8lpfdDgwEET75tnhN1KnNcTXp7bk87BQGyHGtwovUFA3nTZyzCVBaVIhXk6YuX+E5zfJkRqehR3rC3L43W/W5RFnjueQ9Z37zaJH"; +moduleBuffer += "TdcTUEW+gGcpfgLv1qzFzbo3SB4J5GFVeukfEf7t/SG6xgw91FnZjPRj1VVlKEoFm9eaJ3G6wUjZjbb8PMNexNqJcck4tF9KUU65"; +moduleBuffer += "bNQCo6l1w8Sf1bMbMXvhVM2j8v6kvBlHL54SsrBHtg/rjWi/eYdUI7tzW0cUa5X9sTpfzX5YB5GYe3DaPJ+ClOhZ4ClHDwN1dwgm"; +moduleBuffer += "+e4hbwhx3RtCvNUbAij+HX1XKMbxmvasZL6p8M/BLWSXDO2PVK25z7N5bEEJt67JasSfz0dp4pP9j2G8LUtajo2SD9sH7O2JQC2G"; +moduleBuffer += "jpQD9xVUFIfmuGziPsKzRHJs6bt2hMI3ChOHEfqb/GrICEmA4VqEVFaWvGVYGmmQfJYco6+4O27N9n11X+CDcjmlr432tTJ0HFja"; +moduleBuffer += "teG2sczlhyw6mBs3+R0fJdq2hHaHhA0yHDplCTGkG+ioik5ZDhZeL16nZHBESo9QZAc8C6FRCIHOiPV54Rc+L6RnRtkFCwbKmAmG"; +moduleBuffer += "rrbboiBQquzthcDLf5XLA3vP0gG4xcIRDhW68DKxsCBn+dxN/jCeDJBopfIOQp0j+a4j/VEpTlXBFjf15A/DtAXQ9qRzLQx5XLvV"; +moduleBuffer += "TaWkBW2X2u4laLvgXaH9PE7QthS0QQHaAKBtFQwFQUsGIihBCymcLaEj6+4Fc1qMrFuMTCrrFmO7iWWrQzAA1CsBpKMZTc40dDTj"; +moduleBuffer += "xWh2az96uZuO29H0hkfTwzB8uO2vj8YvRuPXRuPraHxl/YrR+NVo4NJdMjcgPZSJ9SkMK3RqIDxw1GSobXk/Zds9Zdu1QMnMsaSt"; +moduleBuffer += "DlOQWKaV1QY7VRvsWG2g1cppgFVtY+qCHdm6RdkCaitmVOSkp7IlA4XGx6ltnvS7OvHtbEQB0RKAdy3AWwB4UAK8peKTFtVSW0SL"; +moduleBuffer += "LQAPXhLgQQ19tFfSSI88GQS+4DfQn2TDs86Jtp2S4KWmJKhPSQkhyM1s6Es3uc+r5dPTBQ9ObvLe+gvvpUGafNXdBMxeAczGSwKz"; +moduleBuffer += "9w8CzFp/6BPdTU54RWe6tjNUaeWben5u+t2t6KmwrecAqbsqLUdX/2FnxSf0ITTZBP3AQl9JRY246nS0C5+UQXLRqClzT6FXInRX"; +moduleBuffer += "5mCIHvpb6eGI7ZYeu4s5aGEO/AJ4nANSq1Y5B6RUfm0OSOnVjTIPYkAyqalXgduOh4ST4xnVL7ntkBAkfxmmIwUtHKnRwtHclLRw"; +moduleBuffer += "FCMZKUcyqrRw1NLCER1JtxhJFyMp4KEj6dIhUzmSbg1ikJC6ycd9tZj3B6RhhebgiJ1iX78vp9jXKfYtLLt2ins7IFpvC6L1tiBa"; +moduleBuffer += "bxjRWjVE8+uI1toG0Xy7J9QQzVMXXfRZVnfRFULaoAwBXXQdLJxqvY67P1kBgcdyVKsm0mo2hqoxRTUbl1tNrNXUnXKFcMql1Zz4"; +moduleBuffer += "H5E9aVwme/Kf/5diTx7akT1p/COyJ3/5D8ue/OXLwZ4odlu5pAr/YAES6xKIB4VXVdc6J9vywrdOybZ/Ee30ItzpRbDTC3+nF942"; +moduleBuffer += "Lzx70N7+hbvDCwh6CxrGAu0SvvUveXwp4RsrfIsa2paG8ZzHg5ynprMRronqcsEbIPPYRWt5QbBduHF27blyPwWvrkokhdzRAn4X"; +moduleBuffer += "rm3dW7cp0bElYj3yljJcvZPyW7XO+CnPmHdmLnirjhwhT0SYJUokIshhdTmoKAJ6gHa2eCZmcT3XelqpbwUyWz739HN/6HO3/Nwv"; +moduleBuffer += "+3SzAGjT57lPuY5mJmWViVbpWmzoYIaiSu5i3wg6RFy1UqCNAuVMdXSmbDmIYdBLSFmEhsOq180TyRyovl7HynwjndDi8s0ulbFS"; +moduleBuffer += "QD5WCMRVWkTZH2iPJ29g5VtSmDGFSSN5UNbRmMpfG+VNphoQQ5KiEC0kIGM1cc4pyGdW3g9BypIV5zyArNfuNy+oOOcixDmnrTjn"; +moduleBuffer += "oqdiHMpRlgpxztP0SVDIcs5Lao+VczVVuII7mTWhGg9lxXaJ0KAU6zztWcl0U1NSVAVJVniUMhJ78vMNe+kfY0ROP8CP3/fsdatb"; +moduleBuffer += "Kmp4BeXXsAw+BAsOrMCSTxrstBB/whujLgw+t/PFZx53kp+NHbrybNN3GzxPu7yGpZpUrAbSfmpVL42SOl5kuoq17j0ZdR/eyChU"; +moduleBuffer += "z/yBVPmrkUpAKduM+7RbooF1aqDI9pwtY+jLguJcF6OiDNTpd2B8Ly+P30zXqsHNVPULb2W/o0HWgJVyO23AP5+m9Na/XfOPUbM9"; +moduleBuffer += "hF+ak3/4eGlcym6rR42Eg3ijnGM+66kcOxkk7+N9HHyT/vvGUGasd/l0hQ7ba1cl/ip2DfIX/qBqoy5PxPw+aA6Yc15Nkrj2/i2S"; +moduleBuffer += "xG8dRr0L+nwOSGcRcI0hh7bKE43gIO7W481CxYMvJlNUkSWXUFMFxJVQcEqyHvCsVFDXXBPXgqcshi7Z9dAf57cyw5MP9X1dG30D"; +moduleBuffer += "ZZlgNoupjiJLXhDxXXCO1Q94qyR9ufjhxx3r1yKGl5bv05+7lO5uYA+IYV+z3yzCVpy388I4XnLezL01hcguyM99UCD+1VAyJgbQ"; +moduleBuffer += "yoZXrBhesc7jxYcp5J/Anyl1wYJcuvmQLxDnAJnRPcn9od5tof456mwtuPmZqopp/LlOlS2Pz/GeVmtKXQRqke3qkLNgtE76odo3"; +moduleBuffer += "yM9TkTPOnxUIfxmDOeVXnnkkuWZs+NP4Wu+cEQrLgT/tQ8HivNcHACZn9i9mV80cvD+9KkWkxezqE5IsfdNcVfmmuWrIN83UjCl9"; +moduleBuffer += "00zNdEvfNFMzV1vfNFcXvmnOox3/kWwKTnAQdTFDU3CCM1U1NFU1NDXU0GStoclaQ5NlQ1cVDdEEMQZFq5zgACpPY4qfw6ukdIJz"; +moduleBuffer += "sZhV6P9wVhMaHHuVExyEDup7m5zgbDhz8v8tRBC4sEnQoEA9yRd/Tacrzp8Dp5d8Urd4pOgG55MW2zKQzAXXTtF6UK/jtK0Dhoef"; +moduleBuffer += "JJMmPTkPU4BV6/brWQxDFvUzfjU0AHhaphVeshQJZNH72ppWzRuqw7PJZ9QNjpQ+GajizVIAnfPYusE5ibWDOzx+Sk84MUTYHq6I"; +moduleBuffer += "YhBbNitHKlwJeUdVJQDYM1lN5WQ1lZObpjJerKZyojaV03YqJ2s44+lk+nQP9OHHS985RHdZ3fssvu/Lzz5aQH6DkZmslR2WSL+L"; +moduleBuffer += "TWcfrn/hHBjXCgtmNusI0eio0ucHw7Qjq1kmugNnGIHkT+gdXf0igG5EO1jo8mcq+U9edS8XJb8r4MNtYAd2LbgTQMM4Fy4bXvsV"; +moduleBuffer += "9wjT0uvgdjmEQqFPANjypYXiBa/qIl5n4rX2OG7BSl6Af6Xe1LWoApVwS8793E8+Fgk6uXr95qqygKfKAmQHQ17xJ38XclPBeavW"; +moduleBuffer += "i1bZC2rR0Sp0XQ7wvEtrJb+NR2gr0CyA9yIUhS4izhYrCGEl7+Ln7YjNxXvH6kZR6wmTz/nUX6VXDobulrakcnjEo5mqW5ZRfwyJ"; +moduleBuffer += "lrPXwslCqF/gV/7g6MLvkvvpzcul/jLpvRT+NHRE1LBa+N3ks7FWAGqr0Tu0u5c/BNRvO54Vppml3zH269O+tuHh4l5aVF8IX3fP"; +moduleBuffer += "ijERxRN+V39RjN6zLyHZgWoMSMECeA+Z7ufRo+X/ii1/Qx4Rgv6iqz3Jz0h28hOR07J+3IICK0GLviTvPhHosFXZQXIfu8BcavjM"; +moduleBuffer += "uPcxIPLUQ9bYQHLu7QtlTqfu7U/lbr/hQf3xDdg3G/C/0Egn08ljQhnc+XTqWH+KoyKitwH3w4ri7ZZKp03y6751OCNz0dCZgbAB"; +moduleBuffer += "2Jm26cBFL84X6LJmX7/RGi4m6fatRbF28mvUjT4okE/eC6YJAeSVKOCGK4+OqmulwIZXtPSChgDSmSe4eUvFpwx1//G1pJYMxc6T"; +moduleBuffer += "mSnXEL33q3oGowR6+nvOs1WPYDnm4T3ZroGQ1+QSlNrVnbONh+Kmu5Iv0N8F6jRKBIo22RoJwlBOhttExNEDechg8mZAiZPfN3YE"; +moduleBuffer += "rhXzsQ+al7zAwAXAaY6EztG1UsGqVtmtAiIkBAZYF6gKnQIISgVuCfcbdHoU7gcruAvNyAwAb5hlKxUCJFglNBlHhQC+1FTffNnT"; +moduleBuffer += "ZU/IPeiq66EzjEqnNhQPuNbmwkveRWfgOrUN+NUS/MsmpZV7CGg7iw+46l58GXj9s2j/PCzI8bVJrScnYSXtZ0VoGejx6Qe5UIm8"; +moduleBuffer += "qzjNjgE25edF7e5svoHyPwOTJTl4/Zk+FxXroHtV9b186c+0Pw3wFY2Kr9B5IPQfIBu7qvViVbgFCDk/6IPNaSnCEAlbRIgWqBtc"; +moduleBuffer += "ptxUdtotsJeKjOWYk9/0VJ/opFEl4WXeZUDfQvudvM8nJRQ8+G1/c9EdCi5EJRqh/qRaVYpkBehwVDPqVa9wOmhPU0oQsXe61sYM"; +moduleBuffer += "2PIHkXa/QEb9je0vvdVBHkKttlmh0WtfKuiWUCanoEygIZ7Ua2Qx3YRZv3muAlPPzsBIOlICaSTtwQOaTfXSHd+1tlTCgQqJvGHx"; +moduleBuffer += "oXz9S9uhxa5i/Y9opCVIM3fZMEiQODfka/9+kk2n/Kd2A2e8fOlL9jydLwtG5XvzJ4FYJ0KnJEPKIzh74Wxi9U8fdzQgT6BOE+Pc"; +moduleBuffer += "pS///Gn5TJ7a9oldyx8G2V91GS0UpzsySjjrdWj1woBONoST8D1UPBCO6IJb0AVJPOkqVyG9SFXVizUo3fRqdNODTEhObogsAm2v"; +moduleBuffer += "aJB79/Tbm9Sl2vnKuvTpJwOoy8X9SZosyD5CGXrbKo/WBAaGjLsUWMVnZ1U6gCULWQRMrFtWK8xLWwx0IS2srZdIMykIM3kHrK1w"; +moduleBuffer += "wTQ5c8m9T6YR7/9LSA62P2ndHbG0oJiyMvHtm77ZGPoGW/SgH+qnDWhRj6sqSzxkkwHN2r1WLUpOvF7pNgqcnj2XEGZA9+QXY0BQ"; +moduleBuffer += "DjUd8jQw3oNOkbDnboaltHRCRSAdPeR0cMhpqJwOshK4SJ4FobTF1NESrWM7qlrWwWptU1LiqqREoAsBoKuSEtmFBlkLkpIEKzBt"; +moduleBuffer += "awq9FEaFRjTqvElNCVWRDozQCSvFkM5cJHItuupVUyV5nWuNHHa8DTcfBWFIg9uyEOtV+vO8yyGoBfvGux+nM2EdP6nabCZcuadA"; +moduleBuffer += "SA1O7GYWAM+X7tNTQgc3AEWDQ80dzMf7VPYSjgkucYm2ZL3YNnhkfIx+esWHUC6bRmvX9Rs4LtT4fOVyMtNxQaCEiw9hk0oeHwwG"; +moduleBuffer += "2Xvdu/MYwRf/3UN0uTp0QsjDo9J/CNm72hgvcCgu5g2j7Y8VxHf1PsBv0SJ5pQQylsQChv/zdOEECy2f5jxLfqFABRXvLNQlKJ0I"; +moduleBuffer += "8ZvtmaWt96mvqGfriDYVUJJU2xk60tS9sD+iq93IucSeFewaG8u/faCOGaWUDx4E4rY2bbEew7FJP/Sp0/RtswjMcRs1mBwYX/l6"; +moduleBuffer += "qvHzZz/7uLXDEbY2oVJTvv45y9Sqg6KeCpx71PKGsXyazOLjHpTqB/yYqwvEZ1wFlQkiAvFSAakJ/JnKNz6ny4Ee39ro5/EUYUG8"; +moduleBuffer += "o9hf4sHRHF39f26bnOs4KvR0U8ZGakMTrqGagA1IMmHYiygqglduS9841BLQKwvc96197vGaZ62FzxdTRh+fo+rxs0ekUmWzvX2v"; +moduleBuffer += "UkxLBdHGVTFtw6kEYCNpK1/86moh+4L/Ue8d+vM2SM3tybRUrpO1S6W73fK7Jge+XZJ9QtIT8itbWv8KyRfi378SZCBNbuV9fS8d"; +moduleBuffer += "TRag8wbhObk18OTLkBUyH9aCX4afsyedmkyqgVstWZhCJdawGBpQ3j6c1aVQV+qR42URRS1ypv4RRFFLoJS7CiFUQwFKXrahYXSE"; +moduleBuffer += "fO3KH/gNFULhogKyZgrQoXGnCwCftrFs2qWkOaAlfSWE2p0LxoGWCXf98G8ogWuQ/9hlBVBMCUuPtE4QnHgWAqgrat8/Zr+HUSyE"; +moduleBuffer += "Ty30YE16XAqfTrmKMCcBxon9ZpGqjSd0IjnT+82Sq61otfTWWgmepPRjsk/hd9WF4KlhnR085rIGfEfnBg1etoO35GmnrXj2qKv0"; +moduleBuffer += "8uWSOi2SNFmAxPnTH62kTsBnAdw+i9D78sc+otBq5Rc+asXMmcESe6PGqT2cOyQuFoYcWqHrnnoDnef8VbfprmnS5PYj6g+GKQPv"; +moduleBuffer += "BvoRSeXdFhcG/bbtTgIHC16/zWqO31J86lr5hTzV0MeFeAVCKl5VCB+s/qC5YsnjJTdRQwsOD6WocIjhbB7N3TNHx5zp2Cy5stRK"; +moduleBuffer += "syRnT47Y3IibKlBRX/zCj3wgBiuX+nQggfsWyo78/FdB1v5cMHNOi1ivBuD7ZXt0yBQk0jnSwOWSBoa6B4S6B4TlHhDqHsDb4KXP"; +moduleBuffer += "F3sAoJqvbGopVIovQ+B+jIm56NJn/kVMcfLXSEAEwwdPIJiO4TmCdgjoV5Q/amr0K7Jub/pTsBR4m/B1ESja8waWuhsubln/MUTq"; +moduleBuffer += "Fw0Mxf8R6Bi8qacjBR2D4+rCo3yk1iAu1KQW5Pz7ZcsjYG81dDh9GU7lvRopi6h4D+kp/KUn+dKX1XVJRLfyI5acRdatPNKSKNzK"; +moduleBuffer += "W3IWwZlfrY5lWwe8532y0LfekOktSdoJT7WvXzDV6C6y/3QrHykC0K08W9OqN8nTI+tWPircykdp6VY+0lvx0rN8VLptidTmnhfs"; +moduleBuffer += "9Cz/MlI2+qL3LFzi/PmLqyVlI6pTns6hCjj35ct/VcA+HbwYK+FXEOVUeJWYbTTfR3t+troqo+/hrDtI/oTy7XNGwfWkybxZzCCm"; +moduleBuffer += "6PZJxZzHDAgk3z/KR886cjFgHl06fgFNzAJc0M0eWc2d75LlnvpzlqiUWEYEtaco4Y7Hc+xtUpLkATRxUvllvhcuMX8UrC64ZJTG"; +moduleBuffer += "vL3a6iJ001EwStShgqoTrTS7qiHQLTUPlnzr8haE7EHUZQ8503oF2oFfT6FH47hD2ZePQyNNb/Tgp/cGdQFgxfs3ULwPl/rJcQ4I"; +moduleBuffer += "DgHyE6SB1OfkeVFjONC0IVYlEqOm1IltR+3WoCzntFT7ZIPOGOwF8joloU7uywotFQWe9Q7oXbCM60HcBZ/6AFpdNnqR/DCybthv"; +moduleBuffer += "ntbL4zVcJJ8xxaUyznBrnt4Q8yJZdhg1CSlvkFtWv2EhLK+Hi9thvFoAFFufCN34uFo3S/+Ets/PSXXOLDyXA13iWRg43UoxvTfX"; +moduleBuffer += "j8DZSmFp5uas0XH0Ee7d52FD5vD0aZ0cwUEFIsZfJ7vdx47/S6VjtYSpJ7wywXMs3DFyy5I2WE3fY41erZRiHbe5zGdhgbucf0Eq"; +moduleBuffer += "buKiQJSBQebYbxDaBo6BYWklea7Wg0xTZhqbqfEO+rw6UC7C9B0Yc8GjbBryluH2SVkagAlss47SAT6uInzsgcSAaA5CFw3I6TLU"; +moduleBuffer += "BSIqRPekCKVyJH/Xu0/Ec6lHvQV/u3cDFars9Ka97RseFRMGM7yFQGHQptDCBgKPe/JL73ohQlAA/g7ydy3478yTe1K4nSboWuY4"; +moduleBuffer += "JVkv4PbtqEBQQ3FoY27VGKgLIQpuy1GVuS2FBixlWMrBeBxbxqlBwR20Mle7NoXYHlt61mtR5JrDk5ILqBtaeftyTFLFjvk5xn9i"; +moduleBuffer += "NE5pskQtt450bh3p3DrS+XTnhXtjhRr3DocUkrW6tZKW6tUYK7/1qdDtHi9lakJJ24byt/GskWc89mYQDGXdEeNw2eho7HpJhZr2"; +moduleBuffer += "Utgyujx5HtfYUaDqg36CYqpHA5WZJqN65JecWd7m/Yx7q8xUhvAO+TPOzUesbQCoAkYCXYoBZBVNdDoCOZKRZNLmd1G1X6qgexlw"; +moduleBuffer += "Vk7+BklI5jVzUE4SWPXBef+fDGQGGYl3ZKgsbl2OShZCQ2jRu26lmmeQt4/aokE+ejRfWBAGZPgr/UwwLmqpZrGHyU7m9f4TKrkL"; +moduleBuffer += "XKry2MOfro6WeVAhQvSu2zqQqFvZuH8bl51fTGnHhaxG8m/p+KDCgRYLtBhOh7bkmzqBqv30BlJSjkCoBLoU8MxGEV0WjAROx611"; +moduleBuffer += "TB3aw8oD8yn7JWSJDfYz8zmegfZcKuHHRpZUTr+6rtDSK3PKihI+CtYhseDfOtnSfvX9yy4Nz2hQKEsQq8u7qQOYtxiqNqW+VX7+"; +moduleBuffer += "zJNO8nGqhQkla8EXk9QDUrUJdL6wFU4JEo1lDE6Dam6mQFbGhTO32ZOHUwLxX+oXPI6kcFVR9MDkF8oeNLigwKzMEq4ADM5fGaGI"; +moduleBuffer += "i0orYW63Ph2q27OlsOb2DO6F1q3bswcpp392k9uzdev2jF7OFrzK7Rl9nAlXpu62mTU1sHcKpSc0aGlfMHTgApYjSekci07ltjg+"; +moduleBuffer += "Ox1Yx2enA1xbHSl6o72g47Nzrt4NXYAb8fyUq/c0dA7xvPXehc07lt+na07OzlpnaE/V8lasM7Qnhx2f7dM+P2boBgM3NftwgffD"; +moduleBuffer += "KLpAb+xh8ocR9aGTH6w5PjvjIi1Q/Fij5vgssmWs47OLto/rvIqLS0dn5+nPrXKEtjbsCA3ur864dCcZ0L13Qtd4P+zzCGg9dnsO"; +moduleBuffer += "3aAtlamupBb9anABfXV764ZIFOLzl3ZtBvvniaE6Ep2ofOnhVTBGP+yn6uJ6tbHZRB4ez38Kc5oI7/p/lNbVoYDoRRyDrdvrP+G4"; +moduleBuffer += "fxgezAsoRdu4CBuCDFFHECT5EjHGV8RxdvYK1v6GvYIt0ff0D0buoeOM6t3vq2qm6pD2M9XXDFTG+k2q5UmDjnZ/r3K+kQpxv1n9"; +moduleBuffer += "N8Uq2f1n6tSJItmJ/j9XT08MTz/Vn0ZqSqPKp/1rkUo1Kvze/r9Aaq9GdZ/ufwtS06o/dF3/OqQgiaU20fU0xu8nSL26/61Ivbo/"; +moduleBuffer += "gtTB/quQOtgfReqG/j61ux9D6nD/22h+3x9H6sb+tyN1Y38XUm/sfweVRPu7kXpT/9VUIO3vQeqO/muQuqNP+fSd/f1I3dm/Aqm3"; +moduleBuffer += "9g8g9db+lQx73j+I1Hf3JzUW+nfSD0B/Cqm39w8h9fb+VUi9o/9apN7Rvxqpd/ZvQOqd/WuQuqv/Oro46KcIG5FS1WlWL9COZlRV"; +moduleBuffer += "OHq3cEJ37zdHZS7x3+vuTr05Sd8l6Wvk3w02/U5JXy3/XmvT75D0VfLvkE2/XdJT8u87bfptkp6Ufwdt+rslfaX8O2DTb5X0FfJv"; +moduleBuffer += "v03fKekJ+fcam75D0nvk36tt+k2S3i3/vsOm3yjpXfLv2236xhRHpPH022wa+++Y/Ntn0zekiPUzmr7Kpg+mDi+Cv9WmX51CtJSk"; +moduleBuffer += "19v0vtTh1fB1Nn1dCvrRTb/FpqdTXhql/8Km96YOHSJfa9MCcHpAnrbpqZRK3uk/t+mJlLLk9J/Z9HhKBcf0m206SSmjSffaNG59"; +moduleBuffer += "YZH1TTYdp1zsaWbTjN4u//o27bS+P3bd4+qdxux16obwL/4P/LODqG1jrvH8IIziRrPV7nR7ycjoGC9oHAzf4EQ5hVgMa49Ttmdm"; +moduleBuffer += "GPdAI04kn4nbY1vLnt+p7OjWss/vVHZka9mTn9mhbLK17Jmdyva2ln1yp7LdrWVP/O4OZTtbyy7vVLa9tezZncq2tpZd26lsc2vZ"; +moduleBuffer += "53Yq29hadvH3digbby378E5lo236u1PZEKykk/s03avQpyzuwpmNyT/vYOUYXhpizeGpTS8WVVXB5VV1/jKq8reOYGOnEXjbQPHp"; +moduleBuffer += "HcqabbB0p7LuNli6Q1mUhB+o1sdDEx4riAG17Bn8NzMQT5pKPGkq8aQZEk+amnjS1MSTphRPGhVPZh7u0Fl9/HJUL+xaqtUnL0f1"; +moduleBuffer += "AdyFsfqJl6P6EB7TWH36clQfwaqN1U+/HNUbRubJ10993El+Wdi1mc/+4rvgG2fhE858au58ZMa9F9ddaTQPtUN4lzeVM/17UWJe"; +moduleBuffer += "isy84b0sFaJUqKUq5/pbigUoFmixytn+lmI+ivlarHK+v6WYh2KeFiv98Wuph+DwlH68yd7GNNtxDzn7qHwui+jHQmOO7zmmi0gj"; +moduleBuffer += "+ZjXCF/gyp95PE7jcZqPe/G4l48pHlM+TuFxio8TeJzg4zgex/mY4DHhYxuPbT7GeIz56OORPLWjNlR0E2ZuhT/+YCZdnM9C/o34"; +moduleBuffer += "N+bfBv82+bfFv23+7fBvl3978ndGGB76iRLMEF6neuxUj+3qsVU9NqvHRvUYV49R9RhWj0H16D+iz/dmifTkXmhd3ZuNVI+j5WNR"; +moduleBuffer += "bqzK+ZrmjG8ps2tLzu4tOXu25ExsybliS86VW3Imq5x48aF84nuFve49BCnj8btlqiYfmjsCJhLqVl3JNumVzJlmToc5VzBnL3Pa"; +moduleBuffer += "zJlgTsqcFnP2MGdKo1YxZzdzJpjTYM4u5owzJ2bOOHMS5kTMGWNOW2NnMWeUObG6FmHOCHN85vjISJhBiWXyLkSV4Lp4PjLBMe+4"; +moduleBuffer += "demtKkjnHBtSmzaixeP58pG36rhae3l2ITjJi16uPQi+H6OXawfC7hm9XPsP9s7o5dp9sHNGL9feg32Tle97WSqPtfKDL0vl0Ipb"; +moduleBuffer += "LaRAUDV4K/3V4ukOzAif3gjw8ekw3dXi6SA6xqd9XDTQVTD4iXHVfK2X4CLlWm+iTzeTKe+RInoIfitWNTzlyVKGFous3wN6s4WV"; +moduleBuffer += "IfwhcFgjzGkEOt3Ub1IPshlULDfexwy6I01+FHeWq2pbr87sW59PzMhx75i1QbGB7chhQ7QTqNiHd5uUaSKcOdToTtrfRf7yTmtA"; +moduleBuffer += "42q61qMi477CvwQvR6HnJy8XEeDNej6lF9YmnyYYi8VnZGWfAaLVH4XaNE8MGFQgC5PPe3pRMnETrf2oehLTC92qurhN/sRXzlpq"; +moduleBuffer += "y9P8yfevOsmPyCjyvWgSYp78Oj7tkqdX82m3Croom/IRqu5aQz+4VMDcrU/JIN2lT/EgpZawgfJRV+28DLTwE2je6tFkWqMKWCEw"; +moduleBuffer += "lAvLqAMM2xDaMeNgAumZNERlnn0F2U0GUJKnLRAcJciwNWQ3Tdpwk4AYgFL9zbQTc5MncS8yTXeJwVF4Q2pYKXULY2hUEQ3gUKbu"; +moduleBuffer += "ibal5vVlRIRQaoCSREw1hLZAk5ZztOeNay5eAaQ2XRkba30P3x0a0BoOP9oqNbeuhyqr/gDFYvVQSbt49cvbHiQfaLToLlydVD5p"; +moduleBuffer += "+urEHeq7kl41mV84jMGdkQd1Bd0tjW6RPvdFqBCBoUo+RjeoL7gZPZVfdIvPb+6YK/X7BQPhF5H97fr926iUC9Ouxw20GS66jOGy"; +moduleBuffer += "4mr8UvdI/rijUVr+wlEbJU0j3sy/Q1zQ650b6TeGd1UQwON1dc0vjS56HS//619edfLR5Jd4XnQUhRzVEfCs6JbK5hfZsJd/gL4x"; +moduleBuffer += "X3Bp1q2m3W6y7FF8W3zt6tcJAMm7lWlZorz25rKDIkjDKoxwyMJ54O4ghbv3UsmbTjqTA96KyyC/BNOKaxe9B12/zNglbywJoHZ0"; +moduleBuffer += "ufQvuuoQcb3wUGBXfDvj2iI1aVPBP/lIxDU9YwNtJOVTXDzNFC58DcX2qkJxcEC0sksJCj+8sCjT5xgZrZTruxoPilQSzklN7Vt7"; +moduleBuffer += "N3MHb8D7TTVzAeFadtWZAs38s5Y6KIALHMihaRwRE+37EawM0g41pcogIyAbWbceRiRSTehaoBE6rUzqoUhaVIvL6HFBfbJhFKWb"; +moduleBuffer += "fGMDwUlFo1WwXEeBkY2V0Vaj0iFzPLDuyB21se6ViQk4ytaEseB5G6UksA2Nk4txOkKSZMuMUpJiE2MlBKvbLU4StFSK0FtNNBFU"; +moduleBuffer += "NTTRflBV0lS3cNXYgQwM5FtEj6lFQ/DVOX1apWmdUcVogd1GcsD6J7eOmGncBrQ3sjGW/mhPezT1pG5PZHPpNVnSxb0LndNehPN9"; +moduleBuffer += "u5VlJn/g1BNyYkq+CtMWzI5D1xUhXVWkt9BY6syPPeEMXkOrl2u+9+F5xgaU5L1wX0AK7xemFmHyR43kb/R4XziyCexTU+m27YYs"; +moduleBuffer += "tGycupEYSuWKF0M4WV7tYQAnylThZhfdd/SifGqQ/IqBUP31kO0XYapllIveAUj/iVkN623aUdQrU7RqKcl3/iMF5epbwijUZpgG"; +moduleBuffer += "MUofDMBa7ysZCwSWeUnGYsUyFA/b3zNDjMWjmI21F2Mszvz9GIvP/dNkLD73T42xeHoTY7G2lbE4vy1joQqBBWNx0ihjsWi2MhZL"; +moduleBuffer += "8uH3KbIf1e/vImOxUTIWi4aMxepWxuLSFsbiPa5yFncOcRZPb+Esznw9nIX6K/Hyj7vWp/fXx1k8XOMsVrju1oY5i3M7cRarNc5i"; +moduleBuffer += "1bWrHvweOYszlrN4eIiz4NpftGu/zllgydP1mqHrduIstpKg5CuCkq8ISr4iKPmKkCuo5CvMJr7CbOYrTJ2vMEN8RVjnK8I6X6Ex"; +moduleBuffer += "HMgVDfMVbdC/mK6bS74iUr4CBrKx8hWNNLYrqKF8RVytuYbyFXG16hrKV8TVumvTaU4WV3yFv5Wv8LfyFX6dr4jKZR/V+YqozldE"; +moduleBuffer += "w3yFv4mviJK/vWy+wh/iK1paV0Fz/E00x99Ec/za2Ot8RbCJrwg28RXBJr4i2I6vWLV8BdyK+SVfcdbTEJana9xG03IfUZ2vWITq"; +moduleBuffer += "jd3JEI09eQyR9OhLIPn1AFyBX3IFscUwQL9Z393PkCtYNOQKHiy5AnSginTYVI6h/t1JbbziCr7gK1cwP8QVnBGuYAHLH5ZCzZIR"; +moduleBuffer += "gJcQU6ZOvxhbsLoDW6AqxJ/03R5DVHasxzKCF4Y6xBMVZrStV3xDGhmq0CLrlLkaU97lb7fMXfBUDIJfv8yF8zYIQvDbq2poUTM+"; +moduleBuffer += "9ZPngaIISBmkXvU6gAqVVAnr2SKXPmI31N+BSf4ioiJ9gIdYAO7jwcPdv+Z4aVNzumlHG1kINRZI2bMQ2FRU78la7dneQHGz3huu"; +moduleBuffer += "6lb1IZ20+YLg7E2gnWC0WTzAmX1P226kDc1BBEPmJLitjeER4CksjrXWgHGlftR2UEFjW5IjWtrVzyJZwX8RMRQi2whlxB1tHm5Q"; +moduleBuffer += "mGNHLPU0dGMr+9vAnlVOaXNADyo66Mg+wYlQWZ7eADXlcJpld1qG4TAfWUkHyPQHgWkrj7nsFmHx8AyLy6Yp9CAMNCGW3SxQ1dRr"; +moduleBuffer += "b4fFQsoQvlC8hTIgXwgB7qh2NghwE0rdR1WVPIQuNLUV2zd3GlT97avebOG6LqJXnww7J3Wi0+iR/gjihqcNUHVsqKqUnk/f3oF+"; +moduleBuffer += "Ry/15YAwn3o4NYwcm8+S18sDbk0Y9NqvqQ7b5qIclsGoO5ZyjLzwr4UjgKZmxmrpog19TnuoqyN40Uq507tpfOukbDbSPdpdUIYo"; +moduleBuffer += "Q4kKsy+MgSPou3QrhfxZ3rTxQzXWkEby5ceetAYUwykLVgCVJnaEpaPse79rB9+EavdRxlZOI9kZQ/L/3Zs7gY4Y5szcBT3lm6li"; +moduleBuffer += "HcjQGwRpowApYjG1oLqOuDQMQDx9O02YC6CGLwJUawgQaoMNALWxDVBBH1BtQFpaB6qwViQengVqQN06ULhhgNjUQ1tTwyUZ3dFN"; +moduleBuffer += "jiOy0LLLBHD7NxruHhDKhUIsC47dTf6GYbLBRb46680qF7pvDnpZZKSuS905KGUxMc3EnZrYy8QdmkiZeJMmpph4oyYmmLhRE+NM"; +moduleBuffer += "WH4tYeIGTbSZOCh9QRg8RFQ+CN3XTvKWlKHkEV3cptShVCtfXH7CSc7CR+C6X/hmPmudg7nJ877KMhrYA+U7Hz5ZNHcfiH2RG+We"; +moduleBuffer += "5grbhdDKQpeQHRbZC+5wttHsM9SdhefQt9CHWUuz12zp2JberdkXbenQlr5Os7HdNMvSTemC5iMcchc5zO8WxTc2Fbc9PO1p5ZGt"; +moduleBuffer += "fI9mL/k6zNAOM9TsC572EB3XAMWNYlQA0XRBpxv2Mzd5BCQZ4DorfHHyl6A9LS2Ja/BpUGJf2Rmi0YqbdS0ePYw5fdjoDCNU3hyN"; +moduleBuffer += "iJh8UJMP2uSyJpdt8gFNPmCTpzV52iZPafKUTS5pcskmT2rypE0uanIReL5izynC/SefcBF+U8fnJl8R/uhuaCMfv7u87Ie00vQT"; +moduleBuffer += "lVSqQ5tHTX8Ev2ddDbR+1vRH8fsYXFJ6jD49pmcRpTqrRk7yPI+A/FAOvYvCZhum65yRU738PuX2GUPrKdNnSPg1t9/S42R/gsdM"; +moduleBuffer += "2X8IYFc1Ndm58252hZ5B755Lr7ibBo4010on7pYx300rR4/ahntsxvNGWYp0t83YMLrjprtsxnNGt/l03GZcMLpdp2M241mjPEI6"; +moduleBuffer += "ajPWDUUrfjpiM54xytOkic04D+A/w0Pc+QL0HesKG8aFJxAAtVfqWLR5HgV23Qk+j+Kf349MrHGFcWSz8WhwOmREwAmwC7gRDxEf"; +moduleBuffer += "gZrD01kMixMD8Qv9bbj0twEXRreoU4fpLNI3ZugNCF3WlPlr6luv/jbH1ix/k98KuB25R+GpSUOggeOX8/RtWXtSg8/G6q0mRl5r"; +moduleBuffer += "UjYwdEGAL8+cXVnEqZTFViYN3EwjPfpA7d7hU92y9DLiqPdbx7oig0tsXE2CPn1RzvYPMDDa4T4Prjf2Gf3hjRp67E2MRJiWp9y0"; +moduleBuffer += "Ie1YJ5hgwKGJnUal5rivRxB6xdTIaDxJFX5d1K8FTZ4cDZysHgnzM19Vu21X7bYZS2zpi9ZuG/pxlzea5Wo0bwKS41By62RG7303"; +moduleBuffer += "ZvSiJntkpONz7aBlD4eNnPBJ1LCHfS2oJ2SQmX/vfNZTAV535vh7su6JtHcfEvedmHnDe/s+j7j01BWrVRXt1CIAIAKXEmg0U0pV"; +moduleBuffer += "Yf/k5ivo4il2McGf8bSDuCCwgP1i4WEoWfFgUQUthzKvr/L5VC2H16taGO2uTZ7aT5Nj+DZRcAni3ioI6NBBnKPne4cuZYQB05DW"; +moduleBuffer += "cb7xxcdLDso7Cu5bltJ81p3PRtS2oXen5I285cgjwjcpP2R9ToFnge5JmK9deJyag7S6f7Vk7AEDEOZfdLDd6++b7O+NNEA8PAtV"; +moduleBuffer += "6JBBQcEfhLxvAD+Ap6kB9v+QlxbY7xGdPd+4UJjxy8LB+gntlfF/DNzouOoXx3A+KDs4bf4aN8HyARI7GgoZtSBzGAMLAjzXxgzk"; +moduleBuffer += "7MNcKLq5Y8xxcmS01RQAOt8Fyz+Yewqo3narJjwk7rIJf9DCKWoWppbok/CpoZrVoT5BHKmIojOK+AK17aQhF6wzS3uvnO5eDJxM"; +moduleBuffer += "C3lgv1qZB2tnIvEkvcPAtpnziIGYPNE5NMn/reZq1tBJn2FmGLIYzAyRLf8H+qo9pwafyKGhHrqS+aVxoV83O/TrZod+3ewQW0FA"; +moduleBuffer += "ntgaa1orNbU59VK/VtIy9hV8SEyiW3lX5c32fbXqIsF1rndSKIobx4ULHPbT14gn7j22LjzxGE/u2YFtR4gfaC04sO1wyIi7NCwz"; +moduleBuffer += "VHJHfCAavMFdVq9FmSTARweRI4ED/xQ92P962vubrcVm0cZwFaw89W/tkTaNsyK0r3Vtn9v6ElH1uDrgc2BmEufX95s87EFy8S35"; +moduleBuffer += "wsKTDt9kwOXMncRNIIzfOOeyFcxVppeUOhIJBEsECVzKQ/W9PgMJGixmkcBmCwK0c2vbSy9fWauc4lZ98lv1yW8NGzpr7JMs1Mlv"; +moduleBuffer += "WKtlPU4Jba2VVMdm9GrIww0IUETrSSxUC4vxjMg9kUFchAF9ONQZSWkMyIVLyFos0Q0gC2/f8XNZLvw+zuM5u3SSPgTR+2gHIVgm"; +moduleBuffer += "UHBVuHzISbWWWGtplLUI9shBcJZnX+vmDFo3qDCGs5dhrMJZFSK0OkqBJWH98AOSqBVwfUg6K2hEOQ67BDI0hGjxjmBqRK9rkfq3"; +moduleBuffer += "ENyn8TJXAcPy8mDuqIUTV0FoV8GmHuMsHQ73WCFACYodsEObD8ZMVTPHElWim0srZm1xuDo2JIsaBVp/03BbODCueGooIt8nX4tJ"; +moduleBuffer += "eLmgmPF5zUg+F2vo9iVTKDTJohd+LvkPwn4zIqSXn/uBJxzVYZCskxpaVgq61zs3Zh6klW7+ML3ePeeqKDXV3Oudw30GqT9pGFMA"; +moduleBuffer += "MXAhaVD1A2CnQ/qdhnfP3X3IWUQ/NtzCveBTDg7XkTZcD3wFV++Ib23K4O/UXCzTDKk4XV0Aeho2WMPOC5YkH2lwR8+gTSCHsh9o"; +moduleBuffer += "QmRWF/96tbttrT6p0hN6pVGKh+XodPiQc7gIoRVST8RXh2xB8jXfulb2kw+DU8COmsWavYbtTrLtjkDarRfJ9h1vkn29SdZavOo2"; +moduleBuffer += "2bfyIDJ4fvJHDZBK+seueudosJSkStPhSTk6p1QUcACLAOJKTJ0Ds2uOii6K91J8K9N9yLkRKmXG+kHkVW7yA0H+VR69BGfU8mHR"; +moduleBuffer += "U2FtH3yXdMaxFwoQyEa8DimzYF3rk4srsqhDSpfGdOgAFQv1XPqFSEWeM/bT89VjqZNaeHkClHEpi+uaGB6b9mJYBqFqM4yRdZ1z"; +moduleBuffer += "ywpWq8ezbr2uFfCW9DAtvwgmz9pOulrdmlriClv0swyLRfFCs5TX885BjYeJiQYCc7Uc5kjNtXIGtkPFVQAMPD1URfe6eDA8+jby"; +moduleBuffer += "kz/4hFPk4DqBysHJzyF5wQzyJ+V1eW2zLhmP1TPk6JY/Ws94uEisoeUNaghCgv1zECC0y+4XHQ/LiwcDoUVqqtVm6MfYVMvR4DaO"; +moduleBuffer += "t1fbjRLP0we8JY9aiPc3FZbAHc4RD5IeRb302eUgsMKNOLYJKmKbdu1JsyJJOGzeCJxb4Wnz/sC4xxs4bW44RSSUfQNepmTejKPK"; +moduleBuffer += "3ckXbBxE5MDi4S7mAJmvNXEWzEMF/1pv33w2XICkAEYJOmBOKSwZ5oHU15pkHlcHM+n98v3wd4iSjpJ4CzV+1H44o6fRifkMNz+w"; +moduleBuffer += "rsgiVOCzgi09w9e+Kv7//+y9e5QeVZkvXPeq99ZdgQ5p6CD1vpOZaY6wzKyPQ3KAJalecjuYA+cMi8WaM3/4reVa4/c2n9ohk+P6"; +moduleBuffer += "Ti4tiRgwSkZRooPaXJSoRBoEjQLauYhRuQQHMSpCFNSoQVpgNKNIvuf3e/auqre7g+josA7LoP3WvtauXfvZtfezn+f3wwfr4m06"; +moduleBuffer += "uE/k66mxERH3hWi8yHFRnzYoGXFXd2oX0qUDegXJcXHZnMBUmJiHisr65KGgNKib+gI2Ef4WoTWUr7MPjE9GyNMHrW2QtfnV2jLU"; +moduleBuffer += "FmjrAnQbixblApYb7ikXsAju6OsdUZVf3lE2xpLptbKB8dhBr5WNj2fzrpeHq7MXUDfzXVLk+3ue5CToWLZDssXM8oYiyxvJWqNv"; +moduleBuffer += "jq9jfRZJm/zXem/iTZAHjrScgdLbfD1HlXH4UODWiUTQKkxeZLtwFj9UyoKAmRBjsxMx2pru4rdmjnbqTNlMJSpgnN/nGWMBwHdH"; +moduleBuffer += "Gpym1lVeKPNOeApiH2gi5hToX0Oc8VAhg2dU+189secBjgb3c9IGUD7vGujRUmLuqrgAtiZwOUScgpiKUzIsZ01NewFuQP991DTO"; +moduleBuffer += "0y3f1jQZoSgsKFjTfpPqa+rmmId0NjhOwL2kKNvU+3imxUx19dTK52lZwpq1Z2KrddU2JvaBeF+c+wU8stImN1BzoB1XqXOvOvnb"; +moduleBuffer += "oB5oySzJJ5us4f7a907lkWpaV007so5MIkHIpFQOtr114u1kDeabZr46u9/hEWiRcTPPuHY23HBdAchqD7Vm/pe5fcORa/55gev6"; +moduleBuffer += "7hz/EvwhMB/QX1p0g5QNPM5Mo/NWtGJsmfN5VFveOhlcMIQToDxZQQyxxkoecnsr85vu2e3g2FmizhvCQUgerOBPb1rmna+p3oum"; +moduleBuffer += "8hv7h6TOiIR0nM2tPpZLktxerpSQJhdMRZx8/qq2lz8dtkM1AMrbZ6vhU4AUESGrDGC5CVu7zCnOWINLaKwu1l3W1Z237KNjqY1W"; +moduleBuffer += "Dk+Hy4faQNWALs5s9EUagMyMMrd8Ueo62eHJbXz+LNwdYsXLu1Bawk5+4K7dBeLi02F+yAbP4pmdfBfr+DndpclAPrAq//QNWv9p"; +moduleBuffer += "oD3EUd6qvH+sEtvP2GRGbB9jmzNiW4xNZ8RS+77iH3IPtF+0D8G8kv+GQIJ47PxflaMHp4DyEe7KGEOY1iUYQT21YelZP43KJQ9P"; +moduleBuffer += "Q57IRC08fyvp83TR6r/GlackbSIMCU93Jaesz1x4Aj96wEVSMlfSk0yK50p6lEnRXEnbmRTOlbSfzaDEjHu6u52V5wHmocPw+Hgw"; +moduleBuffer += "1nKBzEMAcaLxYGd12KEaC6xwhP6SmR9jK99/f/0cCbzAwEem6+fA42zq5/XR/P87D5eTH26M5it4Of0tuRzj5fi0XD52qV6PN0fz"; +moduleBuffer += "j6zk9d6Py/X/1ujLl47mk1++SIuuX2ryJhe0XDTjusndTn5S/hx+9rr57tvl90d+ustVpfEnPyvh4fzX+LnBy6/7vPx+wpPkxlkW"; +moduleBuffer += "D/cYHYgDswfigjkH4tCcA/G4OQfisXMOxMHegTjw0gfiwpc6EAfKgXh870BUJRZxGhSBEx01eyjsRuaGQbdu/Dz0onXuWkX8Ur9t"; +moduleBuffer += "HwKV4JZUYUDoZEcBiZQdvoirTuoy8/hjnTi/vR84TFvv2gV7yUY3/Q30mvmnNNy04U9ruGXDt2m4b0a434Sl+qeAlCW3yJ903kwT"; +moduleBuffer += "+B1NE7HZf3O7YS0l5/7i5L7qe2lO+qTz1rOIGLrZf2uneVa7lp/AswjicI32NVO31WzUa0kchcE86EBmZuh3i3Q/ldXLWVSD1JpN"; +moduleBuffer += "zXw8LnpLNG12z3VajZEHvLbcopG/qh2PTOK63hj5J/zWNO5ZV66TxsjD+I0bI3fiN9K0a3EdNkYOOfIbaNx3cO03Rk6XH6+RL2xI"; +moduleBuffer += "3AntViMjuwgRxpbzCIhzI22oAmlq3AS2jjQUvrDu+pHNC9dmES9l8axRZ6xdLb13e/8ovGX99SNPeWsz32Rx89v6R/Pn8Qq8VVl9"; +moduleBuffer += "NGt0NdfqrLUaRBn6/P55K7atGRm/MVwLB+DDlz90+Nb4EoKVyeB5FTT2HLkYWEAs8SF3HOC0qDndHbQHY4pQ0lri0zS052HUiHTm"; +moduleBuffer += "07lzREIm4lONq4GM92d9BeSaigsjr/RwTde96qgmi9zDdr0bmvVvQ6OwFqRbbHqa2YM3ZV04XlfvWUaqVZiJtDxSuqbMb/rJFLbM"; +moduleBuffer += "p5kdLox2ohRHzrJ6Y/7A5p9QHYRkfovZiMNuK0Bm1VnUGHyL7jI7LXDUsF41KYuzpoRAIzde12br89jqNwc91YeYo9i4SIphbjLA"; +moduleBuffer += "04HJMRXoQtzV1kba2shWZ9feyIxNReWmSupS3ArLchx/8UlwFhyx1Wp+1mImHDtrV2JdHtquxEL/tIxOBVpW9kl8Rqbr8tTVy8Xd"; +moduleBuffer += "siNlBQ7QqJDgoNgv45RBz0U8CkjmjMpk0QnxBM5y6DtpvROo4RX9aOS9mOnYnFyYUwAc7dHqqaFTeywTYU92nh6hTBH29AylCPt6"; +moduleBuffer += "jFKEySUdlOEQ4bAMRwhHZThGOO4WzUu0eQnJxCxspiw8AZq7WmZro2vN+Mb9Mdo7R8tbOC/1V3aCfHAMVkPISmYZV/onGEVsnRjr"; +moduleBuffer += "VAjSKGWVAoEGWX3lilMLAy1zCpD50hMNpbaO0KchdcaRNcycK7c5piJvkKTpmRDgfDukHPTyeKwT6HEzMX0NW0gvfuqowU/1el6H"; +moduleBuffer += "W30d7ozX4c54He6M1+HOeB3ujNfhzngdbvk6zEGweR3mYMxpvD2SXRO+3LC9cPJAGULyt411nK56AKClYyTB0OUcuxqohm1d2ctU"; +moduleBuffer += "cs2e3Y5xhiCDrszJPiDRN+3BmZFa3TJh7RityHGuQU97j6k8dvDTL7uNyleTviC8Jx2HtphbtLCFsPdr8aWgsZ6URr0w47OVS/O6"; +moduleBuffer += "mXnDpkRPo/qVXGRmm4piXK5454EaJ3PSx1ySNt8ipflHMaM6ahDcCvLnvsy4jhOYgw1z8JF0HHS1Fjx8QsbF7QnLh9gAPhYh5fLN"; +moduleBuffer += "SN+sFUvnasVFq+wDZEDJ5CPQFJnRuW3sTZqn4y9v+bbDANeNXVZRt8jVifJM+UFpr6Kc6xtVaqOMlENB9zzseQlap4aQvJE2lDff"; +moduleBuffer += "dKSGlt2H46X8kHyCn5c7YSytyzfYBpLGyV+1suPw1HADX0nmU3gJeQnfp0abH0SF/jIEkZ7+wCRDes/2ucs+B3NA21F0X7enz7F0"; +moduleBuffer += "NX2OCVFEmH2Vr0PHNd4beqEax066Vic60E1vxhLqFP3F7aE2E+F9U8ff1omBXe+e6GedZKR2BfncAGAfl470celIH/c40icjbgFg"; +moduleBuffer += "n4z0F470ycgJxpG+Zh3pYZ0IS/xOYEHsMfgfBlPFpdRG2jl9yskPrlcMe09Zpek7hvPOkKclxYpfLQFA5mQw7JeO5UvP0f2VfJET"; +moduleBuffer += "PTbIk/z59YqiziMB+UJ+xQAxHeSpE8Kqy+sE6c8TVexXSm/aoKU1J61qTnPelHkjE8ZR7I2S1TmVKkbzRJcoQCDVV9Lt9DKm0wXr"; +moduleBuffer += "pNhk3fRffN9MDptcxfPbTC4OBU0nu4dnyhGxnsAx5A40bnSciDa4av+rAMyDK7HTe0EmrWTlCt1yIQQnh1UrVqiRaGAeLcinry7h"; +moduleBuffer += "5zFO8oztzbP80bfrQ/OQiV5ujrPEMYdM9H+zYbKoLCzCmXeiM4ArnqAA3/yVMSYPXfPHHZMb3//vGZNb3v+KHZObbzjSmDzw3j/e"; +moduleBuffer += "mLz6//gxueU9O510ffxHG5BbUd8fPCC3m9J/9AF5d/ByD8j7Nu88woDcvmnnH21AjofusEHfHexB3z22B333uB703aEe9N2FPei7"; +moduleBuffer += "x/eg776qB333hB703awHfbfdg77b6UHf/Yse9N1FPei7f9mDvvtXPei7f92Dvjvcg757Yg/67n/qQd99tUXfddR6RETxQgwC+SHy"; +moduleBuffer += "7WkOkWZLcFw3W5C9+rIq5Ox/MtbNFnL2RBO2kLPDJmwhZ//ahC3k7F+ZsIWc/UsTtpCzi0zYQs7+hQlbyNmOCVvI2bYJW8jZzIQt"; +moduleBuffer += "5OwJJmwhZ19lwhZy9ngTtpCzC03YQs4OmbCFnD3OhC3k7LEmbCFnrRW60/hVoPqbae+lmhJljjUg+se5LET+UY0tfbivQDpoJKIB"; +moduleBuffer += "B+9wuMONGkadbFtWq6Sqk8rbNKBOKis1oE4qb9WAOqlcqgF1UnmTBtRJ5Y0aSBh4g9myMfD3GnCMzwzHta8DOtSRHOgQjnTsxjpo"; +moduleBuffer += "azpa6zpMGzo+m/ZRLuq0zKNcOEb2ZOyzmmP07cFlY4ycc7isw0dCL2vwj9DLeIyMbcQeHzOzGoDbyO1G5s0x8vXRA1Qux6GuOmR8"; +moduleBuffer += "ycd5TBymF+u0THMcdZnQSawTy0ZpWNU2ezzrA3kxquKv2rZA627cddAgW2CCHMPqBgANBZL99Bde1qIpR1Kx49hb2HFcpOrCC3vs"; +moduleBuffer += "OCal8tJpAJPptKfYjIp1nP6eWMfF9toh09po34I5MI8H5h+zgGef79m4Q+bh9O6kuQDBDyAYIXgMgtch2ERwviLOJl21md+DhHr+"; +moduleBuffer += "DabTkTbfiuvHGJ8BdCHfLtfpT7zmgBZ1TdFDyKJItPkBZPmmB1hlN/81ElLc7KjeEhvZqPy6K+XH14Kb5Dr9lUfc5ErOjyJLc86c"; +moduleBuffer += "KW7xqSvt8/T3FjzwTj7PM+8sC+57pxbsQ8HPFQVbCO5CsIFgE8EHrrSdSEeDRxCsI1iv4vS6+XSlXfuv1EevocSzV9pH5yJh/VX2"; +moduleBuffer += "LdDA8koE+xCMELz2Kps57K1+OxJa+Zfxk/Dh8q24vp/VVbpDXkrQ+/xPXsXn/zl+As358FX6/H7vm3/mKnbxC/iJK2/+He+SP7Xe"; +moduleBuffer += "N+/1tm/iXWXtm9+lj+/2tuMmZAnneoHKovofJhfvuL9HLt59f49cvO/+I8jF1P3sx6/dX8rFBK4fub+Ui8n755SL6ftLudh/f0Uu"; +moduleBuffer += "nrn/CHIxeR/l4poHys7a8MCccnHtA3xpc+WkXNz4wBHkYvN9fJ4P3VcWHL+vIhe3FgUpF3c90CMX9z7QIxcPPHAEuThQade+Bypy"; +moduleBuffer += "8bMHeuTiNw/0yMXbH+yRi6sfPIJcTD5IubjnwVIuJnD95QdLuWB3zJaLRx/k8//owXLk3vfgnHLx0wfZxb98sJQLvvnfPljKhX3z"; +moduleBuffer += "M+Riy96y9o1755SL6/ZSLuZ4gf/BcvHVT+6sysVDCJZy8S0E55KLDZ/aiX58D36MXDyJvB9ivD7QcxIxh1zcgSxGLm6S60IuPouE"; +moduleBuffer += "ueTiGjYq34d001l7UHC2XHyX7ZkzJ+Xix5/aObdcPPcJPs8LnygLPvmJnaVcPFsUpFwcRrCUi6tu2VmVi/ciOJdc3HJLWf11t+ws"; +moduleBuffer += "5eLWW3ZW5eJLt+ysysWXESzl4l+KzDPk4jkktPK3b9tZyMWTiLoSEVGlO2bLxdXb+PwfxI8ZuZtu3jmXXHx4G7v4E/iJK29+EhG1"; +moduleBuffer += "3jc/Qy7uq9R+97adc8nFXmQJ53qB/8FycedHd1Xl4h4ES7nYheBccjGNhHr+a6Zr7+zF9RUTuwq52C8Rc8jFBLIYudgs14Vc3ICE"; +moduleBuffer += "ueTidiRE+Xb8mM469OFdc8nFXcjSnDMn5eIrE7vmlosn2e7855WCD0/sKuXiF0VBysVvESzlYuP1u6pysRnBOeXi+rL6667fVZGL"; +moduleBuffer += "63f1yMX1u3rkAsGKXBSZZ8oFEkQubthVygWirkREVOmO2XIxcQOf/5P4sSudG3bNJRefvoFd/AX8xJU3vwMRtd43P0MuHq3Uft8N"; +moduleBuffer += "u+aSi/3IEs71Av+D5eL9t/bIxYdv7ZGLG289glxM3cp+/NqtpVxM4vqRW0u5mNo2p1xM31rKxf5bK3LxzK1HkIvLJykXGyfLzrpl"; +moduleBuffer += "25xy8a5JvrS5clIurp08glzcMcnn+WKl4E2TFbnYURSkXNw/2SMX+yZ75GL/5BHk4vlK9QcnK3JxeLJHLq6+rUcu3n9bj1zceNsR"; +moduleBuffer += "5GL3bZSLh24r5eIOXH/7tlIubtk2p1w8fhuf/ye3lSN377Y55eKp29jF/3ZbKRd88+O3l3Jh3/wMubju9rL2TbfPKRcTt1Mu5niB"; +moduleBuffer += "hVw8DP8Jd/XvyTJUSMO8WdJACkFJlu09NMPE0vPy55/eRYMjD2QtYDy5w4V6DAN3uEvmE+q1oSJz2TRLE5Q5J/oJYLSLqrZMz6jq"; +moduleBuffer += "zpdQVfrSqvrsS6gKx8CvJoJ3Uc/2mfV8TvEuM/+/+MNFJYNFxUmluj62bNgLEF3U+PDMGre/hJa19CG9YAmrcrWqgzOr+vxLqIqC"; +moduleBuffer += "eOBpK3kUxOemK4Lo5i9MWyGm0F31CytWFLotv7BCTKGbQNAvhQ7BwAidm9/8C1sVDunzzyDYj6CP4E4EWwiCVjJ/sLgRDFXZdTRL"; +moduleBuffer += "kJiCLudnxhvD8nzk/mnOSfC1U5RCx9A2KFeDQ4KGnOxB/GkWXJHQK3bqZ6kZSLMDCk9qFGla4q+EOZBDi0D5B9vErmoKHfpEQ1Rp"; +moduleBuffer += "iBAsU+QdGhgQfWSR8fdUmwQL8SNPAtpXn/ND2zAOkppUzX3IE+uQcTYPV9K/Vu99ZnlrA7Da2wK3pwVutQU+qV8zeCZYfFFyU+QL"; +moduleBuffer += "1c6GhBcK6MgRIg3luQQsNIGFazrKVepL9SX36EDur4QdVFNipdOIeRjAPDJqFNCaWaTTVKBV2qrmrCfSeqKinpqpB4CdtVNJxukq"; +moduleBuffer += "MCheTGd2t3q2WxsGGVEththrAVCk2EPUCsesQu1BMLzK/pIBIDcnGW8jM/QZ7zODbeqYquvPAQMpXhg54pOxn0dnB6xbDywip1z1"; +moduleBuffer += "/8FvQ5MUbchVdDXfOFF6BmeONohN+o0cKB11DBydb/DrmpI6HRtfHLjx1EzZSDGFGhqEA01AM8ED1mMmpuWf3rdmAZWmrZcLzIpM"; +moduleBuffer += "VerM4tmq4F7jEXzogPXjUR8gvW+TD2lQ9IDh1iHojynbp1WZ4Hg/fYDyycdka6Pd2K9el565ddqlz5untU3MQ/5aJf/4Uej2qHgL"; +moduleBuffer += "R3XpZc6edwi6qM04Wj2rTJsnBvQREmYzHjmmW8fnq+dR3dQ4Hy1OtONADtHlO9fWHYNBcUfgtQrCrv5FYOZxQP3jrOn4JWsOmIdG"; +moduleBuffer += "HL0YtheL7EVmLxbai0F7MWAvUnvRtBeJvQjkx7ekNqvXdLzKdVC5DivXUeU6rlwnleta5bpeuW5UrpvFdadV8uls6/irO31AU+vP"; +moduleBuffer += "PNMLmfIXea/1iOJmYz0bm0is5RnK/NVlQlMS3Hzt2LaCkaiSmEpiPFepAUlI5koYlITaXAkLQc46V0ImCY25EhZJQnNWgv9amT/7"; +moduleBuffer += "MftKMGutubmrB4T9YOLp16lkf+D5apGwuYA1HDbeyYDdtVeD9go/qX7DTlFbzGWdYJu8xtOvwHInk5dYu0JkJ6KZQlSaKUSlmULU"; +moduleBuffer += "Y6YQV8wU4oqZQlyYKSQlRY98nKyFApy1cID/elpk0i4Xs5uTP3r3ThrNADuuTdCmhC5SDqEXjR+GO9p2FIgxVBuFoGKjsBRGBj5/"; +moduleBuffer += "8oN3GxsDwAWI5KqFAkMdh2E48WGazR34FN/kAjpmo1up4nlThVM1U5APZGGm8DpdBhDwTt4L0e5wJqgPmRIohzdhjZn60lurGcl5"; +moduleBuffer += "aYeP+VaYKPhmOX4py6KMAwsFn5/lsxTEStHQ5QIw7cZAwYGBglMaKDiFgYJjDBTY+/pMQb5nqmqfkLGZeZYf/ILtrc3GxOD7gaz3"; +moduleBuffer += "m70jDCYOOjmBoczR2eHmUQXBwtcx/XkEuMpLAIWmz32y8/eKm4Ulh0m+EEhqdMCX5ItolcBlk0k+F8BpdMI+2Xk9rRS4vDKpy4j6"; +moduleBuffer += "uJRlX0erBS53TOrStpJVIZXsuGTfHTSpi9tEVmQquXrJsbvQpA63m5lCVp/skDmYH/nMpGbtFuUJqbRlWMSzaJM62O5jVyKVlhXD"; +moduleBuffer += "tIgwqWm7Xwe7pA7QKoInyUxViL3m6BRmvbCY14y7MQ9ROSsEryUJSVwG36TW96vLmEsJ9Ma5rhL7VuarV2JWMqZRiXkbY5qVmNWM"; +moduleBuffer += "aVVixtXcv68StUGj+m1U+FqcQEsUxoViqLldtbtxdJWjbGI6yLY0vKjE/w8VzYzQM7ln3KZ8uBotJ2SUFD9T4Vm3et12hIHpG4dX"; +moduleBuffer += "3Zl04m56G9i1lys0PfZJkUKbR7n1w5Lpopv+Fuilw7LX3rjTMThpcMPK91TDg7KhroRHiOUd5NttXEq3xXxiw07wZ/8aBsUxPd5g"; +moduleBuffer += "zoMVIQXi1zgcT0YroGtAMh0nBw3LTxPyJMifc2lIFgCUmRcn+hOACAxOdg4ASjDAk9zBZcc2+YLKtF3HjN2ULwtm7EY5YzfKGbvR"; +moduleBuffer += "M2PXKzN2vTJj14sZu2ln7O0eEV5hH1CzEzdoEu7w5G3ep86dsvJygcIrU/fey3XqDjB1ewTap8uGR38vTt3wBVAcNsKVYepOiqk7"; +moduleBuffer += "ACt8jjtu9zDz7r9cp6MArPWykNTJmyGs4DB5B+qOA/OyALAildLTpjQo6DFv0wnxgEyCxcS921NuiLu98qm2s913eG2NuwZxU57e"; +moduleBuffer += "R6vmMCutzCT3Qa/DUtMepnDoWDCFH9QaUM7DHB5gngbmL4kK+C7l4knUZiZxD5O4V07iXjGJe2YSl9bR9YiPGOQ3bSyncY4dmcrZ"; +moduleBuffer += "ZpnLp8f18aP8WDQcRCBqSRbl8xCxoRJRQ8TzbhEhw855zl3iuNYqUGJe44y7pzttifkL5L7cOm408E8iNvtETz/Z2Sq9kXtnk7ng"; +moduleBuffer += "hG4eroL7DjRV7gpI4Ir8LwxlwWkOEoblXaZvh6M9TAQlh3yFL5cnb3tm5CCLwR2GKF1OKccgUo8OiBIQuZOVWHez61atON3d6pm6"; +moduleBuffer += "daaQ7aqnRQ9eLZLq4poIab68nCtZQ/rt4DRpvFoJIh3qDZXLkLgsACxYD+ec7a5pM5qbabVPFdW+xBr3w71F69vjw1xmQvufGEJ7"; +moduleBuffer += "GbO1ErOPMZNlTBae6Gxxl3hTcGy7zuDNL7JI2E+qWY3c///JCKIFAhcZ6m9shgoRaCZXr1GZZvUK/lMKwb4jcGtGCe4bRAED5+eA"; +moduleBuffer += "ZGKZQt6pixPfRgEjb8HpCeWVKP5VDaGFeTKme2dwJUH7UGMb8AF3aK+VbnHlpfomzue+HK4wbgWuDfBhgJMz6GAKG+aPuIqiA0gt"; +moduleBuffer += "LFCyYPlQO8gXN7AagD7GU71GQjzI5qUYYYXqxn2Nq2oED+64GGlUHw17qjd6jet14vxAfEGwTOQuhPvqA855Q7RVkkCdftte7tPB"; +moduleBuffer += "9byhBnG+m3SrggcV9b+jHY/4euhD+RgBaVB+Rg3PCAb6YQDLVbDFPGKLqZ5WscU8gy3mVbHFCmi9oAIphtmnXsXFK/qU/exLP3M2"; +moduleBuffer += "5UDd4rbo3uOtU4eYDPJ7nL3FjIp4C2nReQ0FGlMEtZq8A3ZHmx9saIszt7E18JKSK7Shn+ncOSdzjS/qxcXVfx8yg8o4jfJ1oomN"; +moduleBuffer += "keNh49wYOQFkGfw5V35eBYZDhpZqaLGGhvUn08hBDaUaSjTkjPgjgyMyTOEYOy472isfwUZbhtBt/5qsk32P/KzFulZ+V2OeHnH+"; +moduleBuffer += "dqjj35zf8mHvzcB6mfzXZM2IBC4akh3Twz9YsxZEw5J+Z+P/vUWSt33YWzNyZ0NSk5Gvr7SJT3lMvKOxZuQplKyNvI8FAdc44l0h"; +moduleBuffer += "chKPPOmshUfwyJnvzKLVI5v9tQSTD+nAu0ZHA786ID6AJ1SzGB3dtmICN4GO0wn/lpuJcI1U3sQ82VSc15HNC8eBuTZyxrg85hmX"; +moduleBuffer += "A/0eHyBQKUAl2Ty/0wLeTbwaS8ra6tUje/sBVyTrL3gN+4AJ8kfGvb+jJWdws5StjwL0dyjzb87Cm7P6zdBEjZyxds3N6RqdXpq9"; +moduleBuffer += "r7MnokG2Akw2Vwduax2HFhBWMT/UOdO0Gwor2yRgXl/LVU1rFqhDIbaU7dDqXzNZQUZ5vJyuXME5UL+2A5nyKF2yOlg9BsWQTGfE"; +moduleBuffer += "XKTOM6MHYV4HuLzuvjqOQm0ABG604yxvcTpCoA1E/Hz88g1JlhDINL/qmq17nctGs9oKE21UqNWUsXz87ZdveJv5OaflkXelnVhf"; +moduleBuffer += "RDi6NqgjnNkigORUWoRnoQI2oqchQ/SptAXwhtqc1KNMIVGKcoQjwPeOTrPsK58OtrYwEJJhMh60FZmCbmINyHNf5smnJO6E0iD0"; +moduleBuffer += "ZFPyy50a+XMf240jpbqdlAnRCZvic+hg3m9a1aadbzxKf0lOhk3Ye8IRNQafHayWS3Up7thqZK3GQ/O9gbW0Lp7wRjsLMJ20M8X5"; +moduleBuffer += "Gyw0GoNK3MOrpLgaLq4WF1dL7VXlJ8sG20Pyf6zaj80TNDuTC29lpw0cvXYoDySbw/bx2RCs4dsnSPg4yXuc5n1VdkJ2bHZcN4/P"; +moduleBuffer += "H+p0sg52xAtlz3U8LuBw70N35RONb2F2PNxsj89ehR8piZ8TpCZ5HcdRNgex6Wx3s4Xw0htC8lBmXHOPRa5jmWtBNmjYVXiVLZH9"; +moduleBuffer += "6QJsSAcVT4sp2HygZ4pw0mX/FOHhLnupCC/usq+K8NIue8yGQT3bjx+AHS8AH+08/GC7uwBEtEfhZ1gGj/wsliGwABdLQeuzAAy0"; +moduleBuffer += "l8hPiLl7QXYU5u4FWZ/M3VCBe9btf4Hs9DtEeA5HnJEXPvfCLx+bPHytW8CqIfb6fT85tO2TOzbtcgrUtNBAtr1FYxaXMSWIm9Qq"; +moduleBuffer += "m8LZtUIxEc9R7X4TX6l3uhJlKibhnfSLbLlm1QwgxsYcNU+Y+ErNk5UoU/OU1jzYac7RZklrztVmE19tcyXKttnrqjNSa442S1pr"; +moduleBuffer += "rjab+GqbK1GseQGYoIh7BQAjRb6zMG0W5s2Ax2G9TdC4gBhtGswAWlcGFwNyToMGyw2Qe2B+OmQB7QgW99bVndrFIm5wcSAZ1Ym+"; +moduleBuffer += "+jdI2htWd2KkYcO9T1PgGSEpF0qdSMGSzADkBSNr1+utl63mjdEQi0oXK8rcxfg7gDyT8gkEdx9W5746RHjYpRd3xD23uNWWbna1"; +moduleBuffer += "Bu4NN2qSX9x03C3vGuhdeTc+yH7g8uEheircW61wz8wKp2ZVeAxb4a0mV9FGb2YDvCK/EpMB/+/oi7dlR2cDQMUj4GGSzSew4Xa9"; +moduleBuffer += "20A2H41cTbpCf9pFV9WyYwjQd8A1r6KmWfggE95qokjWWcsWz7yTYy5iFl+pr5sGTY+Ag+bGEaEI6bmgPRBfVN540uMQAcIhXonX"; +moduleBuffer += "e2NfqbVbc9TKF4zH8Xpr9ZWX24D6sfvwnfBA8bkIzN773QKqhONZBOGhr2164tZ9zzx6WYkCKbEb7nls+3e++cVn715XTFeIXldM"; +moduleBuffer += "VQiNlyCQdqqao0bqUOeocr/TU+e0M6vSYpqao1bixc5R64TbU+uknY/mqGLqCFXs1TLZzBILCNPiKkOY0uOZeSEs5gWKoR0Qdvoo"; +moduleBuffer += "EBh1uoitJJdCbId6YETKvnw7EYXm5RczjM4SNYWzLKeJ3vG12dWbWKGt3mTSLYYLRVJFTycDnZ9Wry7mQwJqrsb0oEO1mK50qBat"; +moduleBuffer += "2NI7ykuBM7fWwbifmLsLyMzML/Jmt+OvyfhV3uJ2ojUc4enFMnNyX0NQUhxxzpO7ERYTp2cL0FLJsbrIgt1g/8Xb1qzWLPy8b7VZ"; +moduleBuffer += "+JWfdNdU8vaZvKvT/a5+9be7+DvFv3v4dy//7nOZBZOPLsAW4JNjL7cUl/gZ97SuwU70Wu+QqTiFpnnaBBLomA+YgIN1Fu8fEXDz"; +moduleBuffer += "eVwqPudzuAx5eRCXisj5pNlHQSixjlvAL6P8bwE/pCVVXsnGS3fNBWbaKpCT+QxFRNLV57MRaNu4pwuqCXot/cb3YqPq9uxpCtyo"; +moduleBuffer += "wvTdEffMCv2pcD+EK+IZicwMBYROtAq7Hbk4U1ELScuY7owN4+brSByHU5Nhb1knyb2zZZ9ZYeioGWoOnljtdfX3kGvaAdigsCuL"; +moduleBuffer += "zfQw2jNBWY2KBqU/8ExslJlKg+XBuszckncjpUU1okNtp0ttMAgZ8IT+ym76bUN1aupv6EONmVMudVpWLusnD+1w0p/SrKIpRWFM"; +moduleBuffer += "knmjkncbSDO34byGSh2QRZB3oa5Tcz1rXrHBQH6PtgOjLwSg0cZ2HWrD+oUt24h6+g2/QW6uvYZMfdoCNPGJMzd9XkkbpgDMx+6F"; +moduleBuffer += "ktPhk6bjUSOL5S8dKlkAZZUolbzR8vLf4as2bTws7D6goIzT/8nTKBp+4CQyYcS+QC0IYlJj7VXU1/SLOPU65NCeIX3cp5UH4yYD"; +moduleBuffer += "tYlQVzu+IxhXPBvaLJXEPUaXycRIvf4UKDai8nK75agkCBaCiDCkPlOeAp7Sc7CoWhtxQHGyEJh5V0/vpwTzUh6Nh2lFxGoirR25"; +moduleBuffer += "63ze7b6CXbOsg+1KqM312SHImLCkq3feqI+vgf2+MvB+EdyS+HR6euvxEK/hBb9QagZqv2igdmgopWc2Pk8juSF1aL6j9lyRGnYl"; +moduleBuffer += "WB3mzUuxhSdVNJmSjQrCr+oR9Xw36Hj5DkdBHNUcKvKXEQHm1zfvxqlzFmH7nEC8wTgtMedbE66zWgRbQ0aqkVmeDfOkYSEdaI3J"; +moduleBuffer += "UdKT7EoyaDhe4+Ioo5YbSCoAx3jrqML0VIWJb1F8gcJOehVFpqeKTJj0QE1Rl5EKzaJimNbf3Gnk9UtH88UrpF5oV7I6hCEGjmKY"; +moduleBuffer += "SdpbNUmPiEJN81kcEIJzpweafiA+Qno4qo1+s6ZRo4HkqOfJ8cZIXtyEckXNtnJCLNKC9aeB+/uYc0vVJ4zJOzlBbQsMpODfqB3r"; +moduleBuffer += "/PlxMr82H/+MPev8eXJ91PyZ/44emI/XeBSOPBxDoopQQpAgT8PyioJq2J0R9maE/RnhYEY4nBGOZoTjGeFkRrgxI9ycEW7NCPfN"; +moduleBuffer += "CPfPCKczwvNmhI+aET56Rrg2I1zXsJtnY8pQI5fLunxFZ1LapvIvrTsXiF0yRZfRDlyJMTUMwORY30a/QfXEmcIxUq2qy0zEACLc"; +moduleBuffer += "SsR8fY2e4cLNw1WnOVGlZTaqcRjfe8J5jrvlGYo0Ib0HREe5m3vKiBSkN9Y7Ye7K91OWivLJ5gEa2XWI8yuv6g16cs7Z9rOBavnU"; +moduleBuffer += "dCb9qbWFIFvZq/00/QlJ6paeRUi5IP1JzdKYy630+wq7C04bQfoUjW3OtfTkjjF/wNRJe9SCl/tcWezmYZtIjuSD1LP5h2mlcqvv"; +moduleBuffer += "kVLtok5kaurEvD9AHB1AJucnYcZE9Y86donFei9a4g/nkVaWdZl1oepHXXjlS2N/OOXAJR9HPDBvyI89lZYJjhKo85MIZ361zKCB"; +moduleBuffer += "wW+9fF6DvEZK2t4mRxDaAc0toLXCbVgFNHLwtfqy52jXoVqtL/HfpDXDzkKG3P+NHpzd/VnEZxvuph+sNUjlyrsz5GPbBU6Mxvd8"; +moduleBuffer += "t28t0F6548FXlwj8tZFvfhJw8VPj90qoD1sCAO+T4xw5ExIG+Iluf7FD6LRkBX6xAbl/8KqfHT78zVet6fRXge5x5Ig9VIfLn1SR"; +moduleBuffer += "9GMu1FvUJ0Ss7iIahdx0cNedVz98x5YfO2s6KXcWvbUMAlJefnSrXOdeWLUSMSqOFW//Sx+75roHp79x15POGqPBMbUYLUzWaXIb"; +moduleBuffer += "qG1pFFtwswcPtS3f+vanP/TkL3/y7q874B4IZtUyjDqG8b6bbEd48Uzc/w/df/jrN96ze/y4NVZz1ERvJiCEa6Jng/UbcDCE8dZA"; +moduleBuffer += "ZIhwxnAd4RjhQYZThCOEU4bJKtdCOCH8RW29RPYh7DTeHVj5BpvEi8h3CPkOjHwHFfkOC/m+0NhKYYDdo/JdrFIyJU5TQZfFEEwJ"; +moduleBuffer += "suDVfgJB1+8a2Q1V3sO55H3pDHFfWhV3UtgsI/RhUEjlUnlikfbQSntTBXR3j7S/bpa0Z5D2wIqwo7Z2VWl/HWYRI+2pImQ2C2kH"; +moduleBuffer += "L+SByZ0OCWgh7X+v0n6pyuSbKO0HFArIbBLArHCY0h5WpT1QPBwr7UEh7eDy8RcX0n6J1nyRSvt/R//NfhlG2gd7pD2x0k5KB5H2"; +moduleBuffer += "7/rku+OHaLx+HhcM4So9nTLU0gHNXMjCGOTeygxoQaO0NZF9VxHGmuvE82g7E+Mk1ycLnFI3E2LEbk9RNNISSqmWr1Mzdaxa2lgR"; +moduleBuffer += "ZhfokSoZlmHe2NCWgAxOFtG0s4JNkcQQEJIoqvlfnw9oSbgrKBMzRgbYmHCLVdiiQe/418u1MEmPXW0RDpfoGdXDXNzLYxxUQ/nX"; +moduleBuffer += "5Co/XiM2RCDEribzoAqGnp34fL4CeSyXt0RXybbO5zZetoPSOdimBFgOwhaETc7cVcRU9NFHPjWzUN8pxKlhnQbtNeQpWakf78B2"; +moduleBuffer += "Rr6u2pKHfTdYZ77kIbG/ZCsqL8MygwFSVXoT8qwsk3p8KE2AQuBCUn3nNOL3zm8ZTwW8aJQ3ZeEgMbu831teipzPczi7PiWFfJR+"; +moduleBuffer += "jXBGxn4hVJWhRG/id+9t8vZIOUk65BBRF+kX8RIcwEkd6VZXVRgsmk57uiDlMiM0spAUtcWza4tNbWR6n6s2a2US0mcGZ9rGDAtW"; +moduleBuffer += "QB4sgUOwVL5OM1yoP2/TGjpQh8jMk37XJeMW9ncGzVjeePrpmt7N0zu51ooFX2Eyv3n5vmd3GFJtCNcBG7om1N3gfq8kz+Ye9gex"; +moduleBuffer += "TjTWhHp/eVnwStGc+kJd4VhT14B2o51GCr5dWgolZBG5F/Vd41o/AAkm+dZrdzo2aco4cSTpHgSfowdIPd8jWSTGHIIqv9k4SVyi"; +moduleBuffer += "9PtkgZbp/l6COOdeOukpiRkSTLTsqjR62SihqE10LU80er+jThw1mz018fQzAduLyZ9pPPxOEBHZ/PsdTZgwBZigto2xFHuMyWCV"; +moduleBuffer += "YU0uc3w1hM0I/IQASudatjG4FMGSrBJB0/CNZQQw98ddBd2nTg2d7BWvZrK83OpV39KEp3oYviecabl4T3e4HRcvCm/kLrh8JODo"; +moduleBuffer += "8XHYktX52r4SK310em+ib5Qa75LOitoUfjyLCDKzUSttY0SODrn68Vu8BBpSgDtZTuSkpKnCMKOq6OeeughNJMVZAxHR0//Kk4MO"; +moduleBuffer += "SZjJRKMuQpYfR1HQw4KnxrytgjcoPUsPBkGKxLrg0ROVpafjCumNZ6h4isomCAMV2eBeT+8cslZ4HSlPoRb1wSwUm8T9vtIO2UYG"; +moduleBuffer += "OoZMcErN8GSA3IcJejrQzHUWVYxyDGe9aaheRYne1JADgW4Hs5hr+iQCiZ1FV4/Bj7lYDeOifPIRkbla+oF6ei30+hMJ+vtW340M"; +moduleBuffer += "dQ4XcZnxa+WH4Szz6acxWHqF7nzwBZTfwZMdmG3+yjmfPB+ke3BHXFX/yjfwzad6SU57CgPBB8MyLAI453PhFZkqB6Aq69JyRY2f"; +moduleBuffer += "iZlvqEmw9cdn1YcZfAAVNW4c5/3nYxVwAUzq4vywMyaTXrxyBXz61CAonsqdc1tkekHtHe98Vg3NgPpOuvrNCwn2ZtpPY+mcHCaq"; +moduleBuffer += "hLAKlaRsbdOY0tnnV4ID8/zY2qRFH7xV+yBomC7ZNpJdsYTmdbk8ZL79m7vMuqAnuZG7Df1yZ5zEmXerzfu878r6E1DLBqPbUbTs"; +moduleBuffer += "HqBuhVrODB+mP9pxXhyo250F1E1QcwPUjVRVC1SQuv8QlG6lPO64VbxofQ2zULrdmSjdZYOKYniL455RbKSPkZb1RWCnXcJOuyXs"; +moduleBuffer += "tDsbdhrqVSX9zhxFBfT0x1XY6S0WQbwXtBsfNx1ORSNnPtEM0O5+g6vtzMLVnqOu4oEbH/M9X7ddE2YxFpYf5bAkewwxC5tL/EDm"; +moduleBuffer += "5Pt49lm0KsapSpdi8Z/1y8LfiHtc2O3EtNuJSAFAlmMsKQ6VdU+Xlwd6bvOGXB1evZ7bQXkQdO196TyjxJ2+BtdU7+pV7xrhXPCE"; +moduleBuffer += "VduU1tM1TKBlzRkrZndV28oUfM9CfEBtUzeXl1vcaqvHZ1eMw+OA1IRd1YrTtm1sxo0c83DMnz7jqSmzzKrXYMXs/Q6eh6DkeVCO"; +moduleBuffer += "h0hZAixFADjvS+ruXmYHt8T5LxkASm6AkjWg5BMomQZKDgK9oilecI5hCC9YGhh7fqH7ffvlG5JL6Y8WZKHtCHwGq6wJL06XUHmy"; +moduleBuffer += "I5Mk/NGfrCA82Fh3F3DF+3ljfOWe7Ey5QF0lLOdpzmZp+sgznzv0kQ88PP3+xhJ/I8JPvf/Z66+66pF3/YMMFIS/cO8vv3rwym/d"; +moduleBuffer += "9G8ycg7JZDcy8a33PX7ju3/2yBXrlMlz5NFdD+274ftXfnNwiX8A4e/tf+9vtr33S/u3SYb9iPjhneuf+/Fth3dIDfsQvuHrd7/z"; +moduleBuffer += "8U//9Cex0o6OPP7eO6c/cM9Tv7pLCuxBxHfu/cTer227/llpwxTD27/zi3/d9cUvftuhp4o38rUtH7v8isd3fv4+8LIi4tnvrv/n"; +moduleBuffer += "a3dc9dV5S3yY4Y985apHNj99/V3fHeGC0Bv58Y+u+OSeb29799ASfwvCV0x/8Jr37Hp83+lL/M0I79px54+++5nb9n5SmrCRGQ5e"; +moduleBuffer += "/Ytvv2f64Y+t4ym1N/Ktf9v5oZtuf3IqlG6QaXPkZwc37brt4FOfeRoMtYj4yfeeeeihz3z8a1ukxAFEjH/9U7/4l1/e9PD16AdE"; +moduleBuffer += "fOiWb9xz4MkXfv0ZidiHiM3X7L1m4rkb/+0fl9CoAO+PJ2lcWR6V/hJf96mPwOkm/VFkGaDz8Q+65/AbtJ/Hld0cWwb6M7pYuZHK"; +moduleBuffer += "umEq0fJIV8YYMrImXVnLasT2sGsqQrXpuvYgRsep3vaPuPmZ5n7r5G6yhbtcvvUT4z/BPH3m2DZMmDL4j875gcmi9tFqEn603lhW"; +moduleBuffer += "oJ/FvlZSW47Z0zRoVTMxzx6K1rhobaVPBLrr6gxIFJae8w3nJRN0Yetn80uPb1ipt4z/eI2rYM0Kv/Q+mQ4H4MUdZn3y/VY/cE9p"; +moduleBuffer += "dHzjBC7S2k/yy2nrNp9m/eZu5BlOs7R0mo/JOvm0dZo/Rkr2oyIqbNnSeaaiCP73QWaCWHEvyJq24fChT3hXlm3ifli/H4PcJGrV"; +moduleBuffer += "Vgd6UeNcKy8Ey/KW3PFp5e95ArYaoT4ZHjHVC+kQU0D67WlUiJ3OtPXHJ5uvaUcD7Zgn9y388SP7hOryL6Xmcb9IRzVZj+sLapIy"; +moduleBuffer += "WztXPfVBGMo0+OnH9o4BbDVKh/0CKKABu7zSTx9cSR9N1Cice0ZJaXDTFZlb04FfRkotPyDDtpFeHUkGNa9Q6/HKQMdog+3vRgzi"; +moduleBuffer += "7KjTHLnAwP48s3/caHT2O6XvNDV+73NVear61Hyh2fGpWQc1BOije52uUr1xZ+cvXgJ3FSnmjnAxDf3oa9xlnSC/PFUdXHq605Kf"; +moduleBuffer += "BSUlFg7JulSz6CmzfE5Odwf1TDc51T2O6tMBGdrc/iZqdBJU6LnzV4mgaityB+tlrUWacy7029TGoq1nFBpY2cjQROSUcnva5H6r"; +moduleBuffer += "8jw8cKc6w5hpkcXJNxZS6uEje9mT1JfcPjGeFuz20uBCRekAUSMoDGKkXekSruWiGc+JBwmL2+u61jeeAVOhl6wLsdzb6yj5O5xq"; +moduleBuffer += "OzRWV6sWgp6HhoWOfrey1mWK0rl0fLLYGGce+Riez1PBpNvQOqDL8mi5YgHguQ6OdUtI2vs8UUwJWkrh/+dBi//cMzuc9MOBOiC7"; +moduleBuffer += "CqdCeHWApGDQ1/INz2oWtSnomLJtLQMVLXyjYi3sGxMW+HGEODBqocucTt+aTv/qTgM938j6L9oGh4us76JtayRy5Mx3tpuqU1ZP"; +moduleBuffer += "LKyk8BNCDsi7lzUuDOBn6a/kHXyqlKk8zWKYloHwvR1faBTHDkBSuDMknJo8IbcC0M2l7Id8Dx7pQ0oPi90ZtnLXSFzezrcjiWrc"; +moduleBuffer += "iFtmrJMfl6jtIbBYFirQPN/OjD73TZ8HyDfYjqnVlF48f0jbTGepBtuL6ZSds6bTV/SK9AZgFLJW2Sv91IlzmUUmLn1MXVJDkNC4"; +moduleBuffer += "8f0AHcV6L8LWOoIP+V2edBjYXqlSxJp5vxogRThfjWCFtF2eKXfTrS6qyhRRW62k0i8rrjVDEWRIRvA/+V6oIzizSjxip2Db4RIA"; +moduleBuffer += "xpfhFOUbzXAKdGgEGBqh+tG66lVL1ni6pmwxeelO2uwAqcSTceVr4UgLGydcx/Qg2IRpGlUD2oPTaazpNFd3WujBJg4JZS6u4Zhu"; +moduleBuffer += "DY4opQfrtgcrCEM6v3LzW8vqG9BRHFnuyLp2Tf5fx+qAklfjGDZvyMV4c83I1PvgWNPcpjbi/I+WK+OooZXCEUSeEdWa6kx5z9qS"; +moduleBuffer += "t70LTYHAaAjUumUQooChGxRDN9Chiz7Pn3zGDN3vh16f7iGXdY2Ey27pA0lHWWgLarRB4ETwdXmWsH6kVEWqA3ihyaayT8qp5mgh"; +moduleBuffer += "fHsIzkDHnA4dWNOOJ6G9b5HNUoapbtxdPtSJn+93O06+7uyWp0WzDpVA3H9nCtMmHzvZRvvmUBCzIMYnuThTHLl56iYV5kG7qXlq"; +moduleBuffer += "MG/KoYx5m8IWyU5tdDlYZWso2dLh6CxS+x0wvXXi82Fos23Eu6IDnJWbJdR3cyfMnz98+DDT1ECqkwTrqLr0VirrgEdAsoE8CPkZ"; +moduleBuffer += "GuSAybF+wecg/a427ix1GSX1iNJAethEBdrGNidnuoo2NFvSkGmuge9kK0v0c4JXbR6pRm4xDZzNp0IZ+bTiuK+eNVGurvxnNT0i"; +moduleBuffer += "jVSCOJdT4BNtg6PgAOqyKLFa5zn6yYAQkQdDNVQXKAPcgEJvcJ9V8H+RC2yQH+DlpH1mRt8coKGnMMiItkWYEmU89oqxtlg/7p3I"; +moduleBuffer += "jDQ7xIZhNMlPp0Nbp8LRx7P0bsM8A4GdyyJ+Z7v9DafxkOcmWN/steSa+YFIDzeewPHd5Pd3Oopx5FnAKU2YCiyD/NOqeX3QqpKh"; +moduleBuffer += "ad1EK75HdzrpJwgU8oOd0Ih9LknfR+J3CaafjMlVqUvZfO8TEqU16VpbNck4JJh8UpNUfZxQfXzAIxLTJ+Os5M8kbhLOIr5AjTk2"; +moduleBuffer += "1yc7E2HHTx9Ctq0gUATpZsYINPkLmJE3RkWT3fQjUkz+XKZ6d7Tvowm/5S5arvhNvlljEqKJD2kiZDVJ6spxVWlU/oOCQz5WFwf8"; +moduleBuffer += "WZMll7TAehGh1Wsuwt8R94o1ZPP5O90TSWaZuQhOKcuSEPh3gNxK1nSiNVl0cSsxCfgqdGU8u6DXpVagBqf6GlQHMntCddCAiqEO"; +moduleBuffer += "L7v/cja0vLKUJtBiVxF2aqPQAvgXtOKsDr/hxSg8ij1hM27kf8OFALaHf2M0BtDSLTZkroaWUIv5phh8qWvE6tkB840dr6cX4YqW"; +moduleBuffer += "L5+PWqnXMASxWgUsCbdO7DaHbwhtLEIeGucwcksRyUUwLQeM2s9y6ZHm7+ORG68zBhcet44yfxcnd3jRL6gPBk1k71bzaR6hyDp5"; +moduleBuffer += "ABVjAB6j4AX14hSVyH0iqdQM531dDLB6x1fIiqir/oqsI+n4p7sEazzdDXpvrzf3T3bSwiOVfuex1htO5c5/I7vnOB2dA+jhE/1s"; +moduleBuffer += "UT8e5u9wL2BCa2bCYWfMmANwS9KEJn4DNfFp29W7RLl3Tss646efg4+nNCUJ+FODDSVPnatVR4igzVpAqmoeMZQPgloTbbs5ksaz"; +moduleBuffer += "4buzcgXIoWAvjYd1SYsqJed189fo9hDHBthu4i5+Y3Z6qOmxUaqH6bV1VlNtDJtLE4+Bbn6SqRdjIgASIDcI+mqx4HH1FQaKPCFv"; +moduleBuffer += "b1BeZ0sV8T8nQdSQZQLFa3SOPd0FN9ZuR1mWaICs45ZMuQu6+ck6E0Q6Fog7xfcvr10Hp6MENhLXPN0xHI2lXWBe73Ik6U2Jxmoa"; +moduleBuffer += "ElUb4spgv5QK40j9ZP3TKnVlgSrBJd+lp9NosdHVegpK8mZXH4NPQIIULjl/t5z89uWUk9++UuTkt3+Wk1e4nBx+OeXk8CtFTg7/"; +moduleBuffer += "WU5e4XLym5dTTn7zSpGT3/xZTl7hcvL8yyknz79S5OT5P8vJK1xO3h68jHLy9uAVIidvD/4sJ69sOdnwcsrJhleKnGz4s5y8wuVk"; +moduleBuffer += "/cspJ+tfKXKy/s9y8gqXk/GXU07GXylyMv5nOXmFy8nlL6ecXP5KkZPL/ywn/0fLybiv7gRTLTWipdFGG+njtF6gsUe7ldGABFDC"; +moduleBuffer += "MLRo99MsUz2gaSLdTjMaE7fnZbQ+bh+V0Qa7fXRG0+w27GhQ0/yMtsvtYzKaebcXZDQGbw+quWj7WPrsqRlmQmM0uO6HMAKNT6b9"; +moduleBuffer += "b0gDppOdN6yAKYg17yanWkADY1qS1PPJf9vppHvjLEmfg08ozMjjTCG3HoqzBdmx4J/C5THZYNanl9aQej4wJxFxVDYAUEtczsuO"; +moduleBuffer += "zhp6KTcwxvdpllgzfFi+B2o1mMCh3xpxwhCkTjMjvK+ilbC1JkXPlb9zptr4cs5UG+eaqaI/0kyVE0tLZ6uItIrO+XZuin7/uSnq"; +moduleBuffer += "nZs2/ofMTZGZm4pWhMWk1GQ72SzT3D9PRi82Gf3Ec8N13rL8/sP/Owd6i5Ony4c6zmjm0scsh/1yo5u/bQy/5w11gq7UlJ7T8c6i"; +moduleBuffer += "lxYsTD36sY7CIZnmWm7bUYB9gJMpDIYUhzkmvdjGgNFArAS4iI7ifiQWk8hRuq75YzB6zGgJGuTu2IrcM+6MPozTfMYyBiZ3Iak1"; +moduleBuffer += "TCbjKNqTCe4JN9BXgNOcm5VmUhmoaoiYQWdYV26Nx3LpeEpTQ8V7BxBitR0WOXBUxpFv4kiw41VvG8htG2oHDF/gxiOeQTPsL13U"; +moduleBuffer += "9xO9kDaEuFQvdZr3TbnWAZzBCU8ZGcPS+C/KLLtlaEwSSWMZliaJ4NawnI3WL9y3Bozwwallnr0BnG7qdFVnqhJXlrdP1AHFBDGz"; +moduleBuffer += "+7R3nGbZmmaumbJ1ZI6VTtPj/K4O6HrfpvVA10YTc86VuUMfu1X6rXjwh5GJ3FgYwnTy8Z2OPODnknQLXNHH+0mwbIw2x43Rpqyw"; +moduleBuffer += "lDuYpog3uXDnIBpVem/SNrjXuGW++dpdTvqvaMR2ulX62nN7DCCAqw0EFQ7MHl31N/LyfV43hV9afiAElZNxmt9HpoApVPlRej2k"; +moduleBuffer += "79RWTPNVWTcgtmVvoI2haZ++NC2p/RXh/vK526LNU58mtsWlu+EWmkrybVwL3zDznMcRrjbGNHTA7xR2nU8QQFRak/lj1pIzLFrj"; +moduleBuffer += "sjoMxkBe37V8ubTb3ODrN9KAPhbmm+odQvGnPKGEP2YQVoPzCMlCx+gYcEZ4wtVj7cT49io3jUwA+pua30H+el35B0oOIJrBGySC"; +moduleBuffer += "o2ikXpghP1f+yizuwo/Wt5V5WsL4cMC3WX0y1N/egy+/m8XSZIAfpOfB7V+6cWUbrvR0+pcM0kiSzrZ90/b8E7t3g3/7OHLmoNvv"; +moduleBuffer += "T4B26RqLeXxhfF3u6gco33Ml/MLTTS5gJB++areTP4Lo/m6+G4G737VbhBDcHajuDolKb0jUcLPwS0rUlNmYNhvoxR2+S4pTgFxW"; +moduleBuffer += "3wKmLEMQ7rue75QU10HZ+AFtuAPkBfhB5ddt2O0MO86pjt4vv0bChsDKyTeVAS8fIJ+1+rIzBEAYn6zW+TUv7CJTsTfiLfFO4VIo"; +moduleBuffer += "6G6jRf/EAEHClO9ao/YOEicMUYMy2y4uHH/gIDnclS5rO4bx+awWXVqa5H46SG5q0JwjPVdG7Xzzr+y9XXvvQXOj/YMEHCNuzsqO"; +moduleBuffer += "k0/I81gjckTueYcNl4Tcc7bGsCsFFXpiN/1xTb9qZQLREgLl+IGlu2dMyftlJEnXP//sLn3J3wzdBhebvnW858zspo/H6gdPIs3F"; +moduleBuffer += "KsD50m6n1aGxNYjBTkmfk7kEPGOAt7PwPZigYAHtpqdlcAfEbyPf8PMph5cyl5DAWJLSt4gY3iEJtugWwumAvPgt2IHEBa5uekZG"; +moduleBuffer += "UB5M1H66K9a9ASYupmxWLmWZ8Jk0RbDcJPfTg1g6KhCuSIWm4lsFnFoU3GtAemqatJmflVoeasFxWqsHWi3imxo/qXOmloKjQazx"; +moduleBuffer += "+0183cRr2wKtxLWVnKCZ8QWsl5XX8zNNa4PeSvIXHE1QZudKAfN4QFBBgcQWaJvWROrJaVqZgIdNm29QYFx96HHmi/JXIRXVnMG0"; +moduleBuffer += "PWHbJVX2YgWzgdH4VExKOGL++pVhsd/Tj2YDo+KQi2FRDAi8zfdgR3CL15WAW2Fll7ucKa/zl0mmTNqKzJOvu0yWM4DoYTUtOzhk"; +moduleBuffer += "pfiox2GndykAd2KSo6GNb4R3GmjrGt/zvECBuScKmlNPScddkIXPxt0GxLbMQgZ5Gy6H3EpO6zCD8yEdEQP59jYMpvbXIqI1/cCr"; +moduleBuffer += "5CN+tks3OFddD13iZLtYcpU42XK3F4HJltQwP/j0EVGyE6Bk12aiZMfqCia70blQsmXfu5EMjVmsKNlyk7gAyZ52FCR72ahF1gE+"; +moduleBuffer += "NlqmKG3SMXckyKhIEO8c8JK18+lrGxh6a9xlnplImhLRLOiKmwW5T7Mg92niJ5GIA6TOblL3NJQvyjP5Sd9QOMFPkRQL6+ImELXy"; +moduleBuffer += "6amCurNJzsQD1YhJidhficBN9niSsM9GbkVoK0Yi7iwT+T8l5j7wtTfNkUkua+H79VPnMmxPlDWNW8MmMLF7W7F/Ziv2zdGK6Z5W"; +moduleBuffer += "7EUIc0+r0g65BG9g07AbEkC7mU9IVMsGDrFImUZQgB26umoCctyVvIe4dprHxbfmo0iEs57u1JkPN4/r7SfcbF7+8O1kP5Trfkp3"; +moduleBuffer += "U+JYnYG6nydveJ46SjbNfeYRYkyal17nSVWt9J3QHWyWzH2SuQ9vWErw3YoQ+msxn8jbXctwH+bzar/2kZX4QDVir9PTr33o1zch"; +moduleBuffer += "o407VwKAwcW97Kv1zavl/Ykj7lXerHFvwcP3kSS6pwXj7owWHJqjBZvdahPeKgHIklc2Qq7Q72xax8Cu99ED3rOBLa56dStoOr1U"; +moduleBuffer += "9TWOyGub0fJTZzRcW7aZ0Gnzhr2MnHv5HV+S93e0jIa7vygXe7600yzw+vl5hteavIzhrhksBG6bBzc0XWERt20e+KZsmC8vKcLZ"; +moduleBuffer += "PHM1T7HwZWLv50C29dlvQ3++Xb5nx6rQ9xPV/jgb2CqBIRMgpFtAt6j+fEK28ftkAKa/IoNisEwX+vPlPvNzIhfNzw/dvpNL3fmc"; +moduleBuffer += "d8xz+e2mjKaW/L/PzESplEnx6eg3A3kBhlF7ISmz2sdLmkS2XyW/Mpm0T5DfFKrKFGRA7Sxf3D5aWnS0jJ8TsuP19bwqW6gXKTq9"; +moduleBuffer += "A6YrBrNSFFMsVVz7DuXt4Bmk046S4f+EfFxaiuV1tEx2R+PvBUOdY0bbR0snHiOimCftgWxeu09uPCDFUFnWhyVdH8BeRSIHMK8P"; +moduleBuffer += "cFy0+2RCJ6NbylpPczZ7evuWad+gSvGgJKuYpuAi7QxkgxDTlIujVjYgworbZ63smPymLynR7FEYFSkJMPRlH4VhkeKNFxEJIg4V"; +moduleBuffer += "RLPScyc60y4uUyCN9WcuVMbtlqyWwVLawB0xG+V4ldhDtDwDwdmSN9XCMBjUn6UZfOUdpxOMLL0CLrmWBzkoeZCDHh7kYCTZaHmQ"; +moduleBuffer += "g5HBggc5GBk2PMiB5UFOtfLkT1J5opWnf5LKHa188E9S+WKtPPuTVD6slQ//SSrPZHyriqqVj/9axu//kAsw0MlMuec3DCMp65pU"; +moduleBuffer += "dZWmPgbsd4QQTqALBgkefeoH4SwPnryErrptOjdWMb8D+o7Di3U1FTIA4kYkNnlJ1lhNLBqF6w6VYwjjzoM/PMjKEqZESgE0KLPT"; +moduleBuffer += "FMDL0vXY/MEpGg9C0PFjJW1fYIE6MKXuLUJDmPiKkMxxJ/pTAWZSA+Ql4YlAAT9EljkZFwggaVcn5CIi6eqkbGuTtZ0i9V2HxcCr"; +moduleBuffer += "tYn5JgT2fcZ8UGSd7ZaA2fEiwhlgho6JLQc1G5bbMRQSaRYX7LyOJV7wXI9AuNtv2o29b+4pXu4XiiB1NXebYNyQ/bLH4x/COMbY"; +moduleBuffer += "9f+9/DzHDJdk8Yi/xHuj/HBzvxBQPPKg2zZgcQAICkBGILRM6wW/ID5z6p4dk5ekpD2WHTCvMoCu6n22fszeJzjCfS7suQ/uGsv7"; +moduleBuffer += "VCXA9ELcusG4QjGAuKWMWtoFJn6MlY/s8gBq8LHADS2ijXp8n6SUQs1u+hCBNhYDn6k84TmpE9oTHmCVu7JbGjrNebV+QLm/l5RX"; +moduleBuffer += "y32a6EUl2cCqwuMyG4epfnlu4RfnFm76Q8IG06Oedw31bj7Ojt1ZZ0QHInMwpI3hJiaVOpSgGJnyU6joLw8/Fuvhx0nFERUG0CIF"; +moduleBuffer += "FIDOJqKmhF0GZB6zQ/AUfsIjqI7CQ4Ke6OxgXe4obZG68+PKW9lVDRYIDxrQyGFw0osdWaDlgct0yF7O2JpmOhX2NI4nM47qzSXf"; +moduleBuffer += "KeZ8ueekgywuvemu4sLPKhVpqdAew/SkNzSlOKdxK4QUuF1D1fKyHTvgua21GeeyYShvME0FPZQENSDrAzifzD3k21oNKnXA7XtV"; +moduleBuffer += "BoJ65pV4/SZzCqYBT5kGvB6mgcYcuQfBKOApo4DXwyjQnCN31kmQO9HcVeaAVm9u4u8VnAkVggBPCQL6SLiwHmgeWZ/ElgQBiUQq"; +moduleBuffer += "4H/GcIxwsyQIiBBulAQBIcJ1SxAgAwrhmhIEfMNz43Wy4KqpwFHPTJUtgDscS1cPvAtMcO0WN5cezs1jCKPb8YCM38C10yG+m5s1"; +moduleBuffer += "zgeDsHx8mvK5AklwU9FIMZEsp/Qk54FiHVS7HPPUROLskgJut3BZC7pokYsaBiDgqDdN7nbSrXDBx+EoQ3TIL+6lyusITxFmUZe4"; +moduleBuffer += "MIcP+2O8DUDa24QSOYmYsM5/w8EXUYjQLWh7KE8kLTnsjPH0FNA6nuIU5c/fKnfbWAOkUOaRv/1cxTq4DIoLi14o4bHGXuhqvLUl"; +moduleBuffer += "XO86BbOJRpy/DZbJ64zWAKk+3Ytdan402xSNbH7AuQhadwIAcaPX6mZUVwajQDxGhvFOjJ+1awB5ggcDVVEHryu//eO7ne5rHOd0"; +moduleBuffer += "B4oSbzRTIqNLRzXfjBwO4OalISOHd3zrNRdncVvRK2MAe8YjTzhAi3BAleSwHV2qcPVerLO3OtX51C+YVWhGPpV4t5rB8CTJG5f/"; +moduleBuffer += "HPvQstNzRtO3Kd2KzAe/8FzguQAdRdF0C0RZ4J4otY5MeErOPoCT1WFvoOMNkRZAmeM9o2dOsJGhnp0fdG3SQFfXD96QAozCOqPj"; +moduleBuffer += "ESeM0ajNBSSWx9pdW7FjwOJx6g3MKuqvF8rEnB/cvRsaKCDLqr4pH1BsZOfsoa4eY2DYo1GuCUozNwJhdqMizOZrWdn/GjOn72y7"; +moduleBuffer += "ZFPqavMIjuLdAifXguhKOUDospxC8xLuBsfwrv0MpXrTwYZ2lMPTZVQ2oFUPNho/9NyBdQbRzByfkuAsvQtcedDe86TmNp7CLlJ0"; +moduleBuffer += "rNdjb6SsFgDRglENcc/4qYFpjUJM8/vTz89Rm7A/p7RT2gko+NZS2f7SeKCGnzMA/Im3XMfPMgA1AqaLSMCvaw/wYJvIp1gbewAm"; +moduleBuffer += "mo+fcy8by+Zfhi8tsLca2cBlmTt2mWIBgWf3aBPGjAl63qNMGB0AVpd5JowZFIS5qQkDZBha0n4TxowKaKI+E+Y3U/5rmbDDGRcU"; +moduleBuffer += "94cPSyNNrCwDDPDWM57rEoIWMycWLouX09zEO92tngL6O8Bu8V8D4sXhLj7FGqfC5zG/AwOXEO9OMeC8UbQ9aHm51yYNG9MyLb5Q"; +moduleBuffer += "bzBYlMu1XP7V63cTakjis0jmLqkj99s8fL+gxfM32BL4y1vEI+sq23tRFxXRYb6HlaQa39TVSELjAV9Km0ZkfldPigJpP+6hNblM"; +moduleBuffer += "NlXYZuoiyxttQ1GNFcmwNnxRTqbIYq0ScsTn2z+yG0BvD08Yvo78SbnKT8g3XG8iHvIUTD0tZmdiYMmMjjUjkH8xOz/C2bmOCUcG"; +moduleBuffer += "GZjo+LkI7OwMC5SuTMMyOzua4c0yV8vPpaOdqJyc45lTb4jJOaKS/wiTs6FNkU+XTM7ng+8ek7MHI6MniGMeWJMPfR3SFGAgB7yf"; +moduleBuffer += "c6QJ2tEJuqeQM8cE7ZGApMgwa4Lmc+cijWaC5sHpPxmjgP1ROVtUzCxcY3thLCemXD3jt+YNkeYJ1bxhIlTIfzW2cEuDDBxysdJx"; +moduleBuffer += "X60z3KohRmANIKaCAkNKCVVwYuUqdP+kHvYrDj9xfYjsSUODaZtNrRGQQTGXDIwqqHBxEZHjkTHAgZqOFY2JNhbTxrZDuuQJ0yW6"; +moduleBuffer += "LS9P8x0qNA2cokIuGgzI+LxORFzrLB7tJC1sULgywsBeaCdyT5fUg930YeD4gYtricX0T/g5QY38GrEECroEEhs0HzNTllOsr/Nu"; +moduleBuffer += "aMrbr5hvJjbdL8nyEHZqspk4O+d6U3ZzQ50QK75a3jpnBZDa1+bruHrK62d3gqF2lMswyuSC5dcRc7eW10f7AtdxXO43nILcznDX"; +moduleBuffer += "xXpTX815ogwnxs2M9hMwLWQzGtb4SnUKjU/5stRyLfKmbtgWKn/nL2ETOajIocM9/E6ZLIx1O7dQPvJcNRCDWgnYbDbZJcTcNBPs"; +moduleBuffer += "XMmkAi67Dh9WKczc091UzeGa+pOoiQJk8agutM6rgJxqdokuTMUCkBxi9doo04mLiiUZuaYqrXLsHfyCwtcyERal1TI40obTSk8f"; +moduleBuffer += "0cCZekR9NdbDwyUsq4WMteFFJUcIwydVKELU1o39kl5tVkwk5Dqpmy9SczzZJNu+cyogqp4xCNRv3UaATFpEQ9m7g7dLLSsC2H2d"; +moduleBuffer += "7ITyyedcDCTOTpIHikcmAzX/zcdkDj8kf7jE7tSGclCA1oYIxqlUqPIdjGhekHmzY/M9qGBGArlCEIJhDZ6rZmGhUeK3KOHPqmoh"; +moduleBuffer += "UP9CKIOHsMk40RtYArKg/FFqUk4hrP1Ql59CpIp0LsKvIwuYEKaWSzMijaawsJCrk53sNOcMQCEvwQePOoxOAlsJsoun17jEr9Tm"; +moduleBuffer += "awimNwu7tuXY68iCKh//OB9Qrk/R5rZjQ48RQrhgyhkamwnQibjmC+gtcl462yjfDrRcRyu9aJzUDK3ovKOO5lfi9m/tkOV0enfS"; +moduleBuffer += "PBrBexGsI3gUgnsRbCI4D8FHEexDMEXwp0VQKSIQ7EewD8F37rNlWwi+rwg2EfzoPluWELHb9tmydQTvRvAoBGsIPlCkJgh+D8Fj"; +moduleBuffer += "EIwRfLYIRrTzEbkkvmx+3bclIeQMnG+S6/SbHpnETBYY0txhszS7+U0mC2lMPo+EBJWCaiXf8W3beszY+f0IthDEUX3+HQRTCTY4"; +moduleBuffer += "ZYvofEY+JkYhAnJfMjAGa/DhUA0uyRuTi7Z14jXgOLpoG1muQD5IbYOvWo9A6RclmRTpGajXQSNPXkSbbVCzDc7MVu/Nlmm2bEY2"; +moduleBuffer += "1V34hAtcDUJ0GnSS1Jx6nxFMn/3rwc+9mgaXAUBWJV9S5GtySR0ViuYONdKSJS2yDHCVjcf0yeXy1vVZffVqsKxTA8I8Cxs7PNe3"; +moduleBuffer += "hGjBogpjDibY1BCiZGOGiCV3ddHnc1PktB1LwZ4F3fwwOAXzfllwy4JIJrRvEYuxft6QWpu7ul5Lz8NQWNXGfqphzJd+R0VLfmc9"; +moduleBuffer += "WO8AuDN/u6sb7HE3nxBZTz8WmHXZpEo+68cRr8O1ma7l/qCi0JBSV9/Y7dkpO6O6NR/AbjtzrLbCISaqr6pXHOoGZj2s2orEaite"; +moduleBuffer += "bEEc/M4FsSHHc4y2IikWxMnIE84l0ozkZi40oBOFYTQa05XIDj7ExY2DI95A19ZcHvfUEMyxPFYWwyKDWR57mS6PTTdgsy/9SIIT"; +moduleBuffer += "6cUfeG5tLYTmEj18ubBN05Zz25TfZW0K1NI29YeLwWmoRK40IbDWK7joOCNgag1GPvXNF0SMvnT48+su3rYG4i9SXyo9Ias4qQjV"; +moduleBuffer += "GWQD/l3YcYeglkcNZeksWJMhfjEZYGtZ/eJtWNOCSHXNaqOmXNOpkrHiFAgllrFEgJwZV5oXmRI+5oGqmhQ8qihxrrLMQuC5Iw5t"; +moduleBuffer += "CRFvmTkqqlLoT1HiQlNC6lb4X1NCppZSX7qaWS9pbPd1ua0GtHmga+vhTghOK4JZt8FNQMx1GjJFugSXyLav6kl57gsCc/LAjBb2"; +moduleBuffer += "F204uwWoWNq4yZ7BV9jqRDGvY+roW/h4h8Bxr2NnY7L4moUg2QFIn0KcyonYhI2ietlEYkvtKu82vG9ge6uE85Fsd6so7xhfqBzL"; +moduleBuffer += "fLOTkGHjyYJrMD/4xA6ca8H6IX8U1zf9cIexk6gVppdpejCxsOgBEkLuZ26jyS0UUoVFK3SuxhTXo9ORaRWW9Aek5jzLN/7IoqlT"; +moduleBuffer += "oTSMjb3yMvEkQOm77HOaRT6+A0nF6PY3fs92nMo9V2URBrHAy8/HU2WnHx8PLjB+f7m/ok3Q+vyoVfm0uwKkBQhFq/Izx6QGiehj"; +moduleBuffer += "RLOMaOWGrlqKe7a4pO+fs3gr91XiJbdrc0v6FHPnXoO0qG6R31GrYMeoGUfP1yW8jJf7Dfa1sWjNSMAHFxEj3PSMsOjSiYiY4QAr"; +moduleBuffer += "T3WVhDtfx2Mt+e++dxmj5jzhNIUT29wwH8bnD4ElOU+Wy6/RalSLQAiBbY+d1MLCknkgdy02NveYegiV3uibgyRDSUYNX1qtDMPb"; +moduleBuffer += "ql90exbY7RmUZdYxDM9tSIKs2iCnLobf6M2WfhxGQYvJRKy9ly+l5Xw6HjXdxhwrUhfZQ568Op5yoOtUmcNjBGaeOAlz/uZU529k"; +moduleBuffer += "Xj1Fj6PUKhvLPYgkd000N8e7eiQwNKU+370a6eo0rEa6bmag9BWb+ft8dhHK73CpZ0p41RIFFygVDek/Y98L/iYthAVH+lhsn/Gl"; +moduleBuffer += "3POfk/KeaLaUbKjZsHT6wT9AniqjuP8PlKlKFX0vTa4qJVqzZctVk28jTZ6RJiiWNhtpMobjIjz2mPYlSpMMnHV5RaZaznEiH79b"; +moduleBuffer += "kIDh/gfJzjktdYRTxXgT66t9z+36owjQPaUyE9+9uq7PSn1lqOuzgB6R3U7Uo68Mjb4yLldJyczFV4TlGU7ffufyzOgrw2J5Fhp9"; +moduleBuffer += "Zdh2KquzgJpF9GtxU+dFl2ZOz9IsOKLm0izNgl7NpV2amR7I67o0Mx+fT3jqdzOZUFp4Aj/un32W0QlB1dmDsg4PXk+dKuFMwEWa"; +moduleBuffer += "iuke2jyq2jHfE+skYBNhoWtcnHz6IIWqcvLyzT+U2oP0e6QNp729xB2QOF/j9pCK1Msnf1rmA5w8PEQmn7JxsKJ/EHUDQN9TRHna"; +moduleBuffer += "Rpg7Uu3pKmeROlYlBM03OZUeT3PPgpb3pXPQVZORexyn6ppld6C/SqSHDpFq4UFSkO95RgrTCzg/E1sfT0n2ZhJyeUrIRVsTEG55"; +moduleBuffer += "5COBuwbYg+EP7BpfYledk+Bt91kXikjSZ1JFHKgNr/XuDumT3Q+HXR8+2yF9sufBS8OFISSZANtH00cJRuhNdSyg9za8u+G9De/u"; +moduleBuffer += "Y9T9gd7bqGlQHS3ax2bq3c2JudZtD2Xq3b1QJ2qQuGDP18BPQptHOEY1oDqsqXd3o8e7u248J0CDZb27W7LU6sunZnt386A5q8PV"; +moduleBuffer += "bEhe4dF6eVy2MDtKL61397HZPI2A53eql/OzBVm/XrZIWIabDRTe3SEMKgO1r05GpV8asERp0L4eFp+qAylbab27m+RB2UsfTb4z"; +moduleBuffer += "6/9N3ndMyp+F9h+MxtTip3fGtDCwPuX2FZeO45GMMOVL6am3Vrzr8aMMR01mau7E6d9lpFum10yc7oTngrJExOlD2AXCeSTmkQHT"; +moduleBuffer += "0Jt0IdCCDYoHHGpYsGXPE5gX1G1Ik3pqrGFXpIRvhY+81HcUZmO30Y7NLr4J69DnXV3cqDuZpCw13gLgSLZXw/ZqhJZZHj3e/GXc"; +moduleBuffer += "kibyaYI5OQ+cAq79ZFEDbnmZl87oqiOXnw+uxAChqcZKKBWSVQxB/71qhfrpQrns8suGQztVYoGxBQdxxmm5MMFWw1aeLageGbZ2"; +moduleBuffer += "Xkkwpkfl8ghFmEcSwwXpB9WMjdsNe9nicgWrR/WlLjHoOH1+AIs5KPellRuf3eXkcXp3gmMIyCdmZEeZ50kIzDONAfonuvnVyO0h"; +moduleBuffer += "N22HPH6S833P7FKvMxxp4KT1LlruqeOc2l7h62yclXEa8lDS8rOKV2MbU6IIgcO3+CI192nFvhLw2vqLWlUpQU8+FJ8uintF8XRW"; +moduleBuffer += "LX6uBx9z1tdgv2Ps9xueHQddKzPuLiXC1cqc/Hu/QESgebhzpJay4xiiNtJkbXl6ly6v8IFMfySvYbun9nmLrXke3FhKN0loKGhK"; +moduleBuffer += "qPYW9OLGaojDEFOyDKc3q1NbFlx6TheLovSFSI9YDanWMvXRBg/bcJdsQPLB1EOFAKZvjhoJ+FgSyQ0a8BNfSWMe36z4s+ACexDu"; +moduleBuffer += "sGvYzqKJHu09U37KM7XgSPdy4ZXp6ZZkGE6/4duXizw2A/bnhrRYO1r5QaSAMtFxiBgPExTPt/xYNsAPyQZ4n+fV1rqm7+gvRF0N"; +moduleBuffer += "FbP+DIVNoArccJbWBjeCDRr0qpFqYWPV2eK4NDSaHG+Irka9mhx/TYZ43tdocgLVkVq9TDJTkxOyRMoSktPoZZKyRIwSVU2Olhic"; +moduleBuffer += "USIuS0QoUdXkaIlsRonIanIaPZocZIWJWxNbHDji4A00vuTpPFJYZCZkOnc6FWyfs4rNwQdju2eHLJ3s1CSmhPUI9GDNxZTpFlMm"; +moduleBuffer += "d1t20nQ5acpCOVlF7r10FWcmWL/hSyS/NLjAL0ALDuuJUXHzoKHsuNjRBCRSpExD4ZBOG+KZoMv1u9XtBebkjuX6tRy2UKHWEvXU"; +moduleBuffer += "EqAW12Tu08wtzVzJ5Usua4za2K3WU2AFSzOHWx/YT52Hbc8JeDSlzoKbC3Vlq/6h44+ukkUWPgkrR/PXdhsdMwNayyZYnGbeSpFo"; +moduleBuffer += "Y63ETggyp9jCQBFvuLnxQesxbVJC7/6GFWfauWJB9rYxHsaqR7ubH4uP6SqYY3j5CecMrSStMabo41flwViXiDEo60GuQ/iZy3DT"; +moduleBuffer += "M+2AGBpqlKfuzsa7WnnDHWVic3p5w8sH8Gc9QOPTLbffnOfXlYZru9ehHu4OHVPo3zs8fK4bWV0PXMd59r7YIGnAZm1IHuuUrlzl"; +moduleBuffer += "+z4BvAELOlPnqX3Ai4TePql1OwQnoE4roW7n03cQTgZOTcApguN/S6vxC3uhrLZcFZ04zvFhIxTrB0YWcwrcIdGj8pQ8ERvGV2bY"; +moduleBuffer += "W3iOKkNio4jE4WEALUmIqZqQE6PtpDw3xJ1aeAEN/AQdqE9pHdWA9VCDhlQN2UPLRqeB5hiuNH5VIllvyifIz5//hvTDIfgzewTe"; +moduleBuffer += "gfGoMRQjNE2BQOMbOABs5dgwb2aE2yCMwaZ/2WXpm9TAO8THx1OUpZPagTKS10C0m098Re8e4jMSIEOGP4vySSR8PkZgEH9oq5RP"; +moduleBuffer += "IfbH0NDKYlDWpDDWmt1bJzsngbnSqnN9xEfYyfanH6zTxDb9UJ0/v+YEYqywyxKBLaGvkp87+jdQi5t7qxT/YzSXry13cdLJUsfK"; +moduleBuffer += "dDJEWwc63pFeJJQQitxkOmCv7QB4816KDAn+NPP9tgOUdDYy4C9Eqko/x44ZhtzBeg79Kr1xfguTjgw9Pts74pZfNSDMdzpKJYs1"; +moduleBuffer += "7umuGcBJaRkzkPsctNI51MZxnCQy401ivQpMIGpREqOGhG+vLy3RNZY86Ou5SC1KwJKQijiuk8/gzvo+R4ZiLu/xXn04mCLSApGO"; +moduleBuffer += "5nvv1bdbfS+gHMPaVDYz57eM4aPcQQa4ucmwGi+ehGMCjCtsW/ajog9GujhhezOaSebT5X0HachIfK1xM6pg8wLP/vN4o1Tr2ozE"; +moduleBuffer += "R+JqD/CGA2UPqDFkp6Ea2nPbkYpoQhMLNF37VS1jIhUY2vklKomBSuKj39DGJejjBH2M+x/8BhuXe1h9JhQo9vjJzrm6HqVxR2Yd"; +moduleBuffer += "CXrHcHAEafBnjs1Zg9WdEYFJiCvfOlwjfFlSNjGtKxmtXDbJ8EvlWV7XD2TzZKd5miNL2wYGXVPngvrJzoB8tupQydVJgaksind4"; +moduleBuffer += "HahDx8ddgKo0ucyjqY/a27pqCupyI9zMfUWFMtBSrvlonOYkzaASbxmGEe9bZwfa8mb11zjzlW25v4s2LVAkq/qJ3iC/0qiMy/nC"; +moduleBuffer += "SqrqL+Hq54dGlPLjmq+MzOeL8e2h6vBjHnySJe/IrXc+e93em999Y5OHd+o2gaW6txp6ZTgquCPP77z+Kx/75I5Nu/T0rXRU4Joe"; +moduleBuffer += "GX3N6K7u+Bf2pAZIDTQVHZjyxK+3hhArQcR13JGHvrbpiVv3PfPoZetlcRtJm+itJYU33PPY9u9884vP3r1uPdRbdNGg2wWyEH2L"; +moduleBuffer += "DhMZvSv0lHI102gYYO7+1vWdgI+Q+VxsaiZXfSM8tDMzDx2uloUpHCDC6uoyI+CJ7k1gk/QmfvdgO3Wqd5L1S8qnsA/X712gU61P"; +moduleBuffer += "5mvoR5z8lvVTnFNVg6h23z7mt7uR8HmiVSZckHJvdx9ifxzzFL5tDqgWd9WOKd1Gk7Az2qxmqUJcnoL9EYyoYxrI29sevNzcFtON"; +moduleBuffer += "/FkE3KL8+cu1dphrYZGUHsR8kZ85xslxylHVqjoI5dEqJvvma4haN5VtHqR1GjMuG8Pp93Xaclrlnea8yS44/xR9uv2aI/Tpnmvm"; +moduleBuffer += "6tN917xIn9760vv00Pvm6tON1/z7+nTLNUfu063XzNmnd5pTnZl9esiBA4506nYXTZ+rV+PRDnfMcaVXY+Kn5LfcvfMIIxUJs0fq"; +moduleBuffer += "3TtNr8aVXm2Huiwm8XkGUCrVDQ/i7IIq4vyOL6p3e6RMxyAGzh+9a6ch6S781jiRhsR6Qznq5Kh4jNSFdI63FupbC/Stmcc6eNfO"; +moduleBuffer += "GW8NHf/8XTvLt5bIW9uXvOhb25cUb421bir7ZLYkaM+Yt7bdta/t01UDGl/3DcoMz6WD2ia0Y29tFlRsE0J8eInQ4hGhJZI+Wq7w"; +moduleBuffer += "kxdY2+HY4LE0MkXJIVBLha88Ur5yGe4b1QB1zrIcDNg8TRkS9Ng4N3IYSNF2YgdHmO99XLnI3XJYgIucttv5/scLeJdA3xF91RSN"; +moduleBuffer += "Ct0oHb7Ra3SSC5U4OgFWi7VsOS4znj63mM3+/sKc9yQsiVwu++C8qG/bbnMqDqIEpgmwII9UPYCtIReKRTGvKADqZNp+MoebPpUU"; +moduleBuffer += "mdyeWn11+/XVrNfPff1O+7Zsephbfkf3e7PcJ3scIavpQSXdq3zXg8InaUYBryzQ0LMGYECb0/Np58VOz1/awTnPo3AGtBVvnLqT"; +moduleBuffer += "paOnOUtxU63mpRyXJz1H13RYx5H3ky6Po9zikHyOfDiMutm1R+Nu5Wi8Oatq1PnVoLiD1aSYO1SOxBV2c0Kap1IIW0CFBdvnGMV7"; +moduleBuffer += "iBWsvdxTXOJnGU9OMx4Hwng2w4GG/PnPHo6/TvjHW1bzAyPBNZ0Yto4xOMnbxE3qUvsL/8WgpxZ8W7p2FW5z8Tg066a3+QpSZpsz"; +moduleBuffer += "XV4e6mnZG2bViyO8gF+YropegN+xGfdx9DmYPX3GI7AteugemqipfRltSr0ZOktfbU+DNZ2kqrOsqY9uXU1CQzUgjdTcNJ5hfZbM"; +moduleBuffer += "tD7z1PrMoZ1XktWMdjC4qLA+o2VYVWeptmQpS9B4lNZncVkiQonZ1meDM0pEZYlwpvWZlshmlLCa1Kw+y/psuLBhwmbXaNvVIJhf"; +moduleBuffer += "abMuXgItC2aQ18P+6lTvDE0/V342fG9Krl6nEafoz0k83srk+4e920nwXZ1lqE2DMKrAqEPjjiUepZ/OO2F0de4QBDw21tpKEE+T"; +moduleBuffer += "CZlPjcEzThlEyu52Ye7s5Bvu2+nkC5BGr+9/RvBYBDnL3VGkclL7OoJtY8Ysn10EB40Zs1R1PzB7YMas6qpBnCXQFaPjmF2MOmMY"; +moduleBuffer += "vvr0Uwl1AulNtVIp0CT8X8crH82zjyYTl4v7Sn7e8GQnyP1zWtZihOdNekhBXFzdKgbzoBgi3LaJoM4jPci1QDMPeOWYK9isOwoa"; +moduleBuffer += "cYu8onwJG5hfh+u9j02pcd0zvhetc99SHJukx7WT9BMuVO5/5erBTlbY4/Db9JcudQW8Sv8vzR0wN6a59F6uXJrEARikMxQeCBDx"; +moduleBuffer += "GRU1WTykXyMLX7CQVh9QKqhRM7wz0u1Q2dB1NSCaowHMxoD01VMXPgG+Hr1nwAhIb+SLpHHLosx4Gi3CGe4joZqpuHob6NvLJ+I3"; +moduleBuffer += "EkBFYWGHQi10J0o31NSbAs+5QJ8z5HMar5kwvakuHysq2pu4f8MYZqifasBlh0s/Svu0+kb94pGcjksZKx/Jnf1IdDeywAN8KCRw"; +moduleBuffer += "DPuaYA99NMWtpPgmJUOKORZq3PhHXKek/1Z7sUUKkv+gFYoUfNmXJ7M7KXzRTopmdlJYLOZ2e7N7KdJeonXtbu8PXcjt9v6d/RT9"; +moduleBuffer += "vv0U9fTTH3Mw/c4V7x+83H2Z17qf+oMtRee0EeWKNpi5ov097T29hr1DZSXsaqsXczV9BDPQ0JiBElX6T2ADeodXaAsCPTQ62Ul5"; +moduleBuffer += "RKeGkp/hGx1Qs3ScCAQ8f8oVXQB5AuzYhs2yWj0zowp2i3U0jRUAPj4v8w27wQray4cw10z0u++e5qRarqmzKiqLe1Sn6qGaKnS/"; +moduleBuffer += "P1t7KrezZ7yVtri2zlKvOkdZHiVqG/CT9Ny1SdyZQDfrH/BmusVRqM4y22bacVqnHj1yULVIswsLB2Nl6xjjWsca18KSpTSuRag0"; +moduleBuffer += "rkWox7gWETOMa/1GTxVFnv1zVgHjWq+3RMvmsca11N9nDq7dRvq/DD7sgJrbuvR3BMxy4X12tYzpSr+UFsXeES2KvR4bYm+mDbE3"; +moduleBuffer += "y4aY2OW06tfmuz2PONN+2Ob2Vuiz9NgO20R3RaPHOt9htEjMVXFhHOxb42DpoelPyYLusdBYFftqapupYRROgE135E5j0wnewLrA"; +moduleBuffer += "uh3XeSqxWGGmvxTgWOEUYvHKxWJzqvA2CFYdMUs7fbBgqkOqUvmhhsxTrQwVN25GqAsHrqJMPkV/FuMniwH7hL1DXZYq7VbVVsex"; +moduleBuffer += "hsNcRRrML4C8eY7FBIc2bZjd0A7MbljdSgbVMbwTp+8LddgP6nSh+OvcwEzRuitOfxSoTMm2UiamfPft0m1X63davWoCnjXBfPRA"; +moduleBuffer += "DR5POLFpqNC5ONIF/Eik+6PhLoHGjPEOcTzjsvHyuKbx2OdAbSVt5Ak0NB5qhJp2202ay0V4uYm0HwvOJoTVoRWm7FFj844Z7C+D"; +moduleBuffer += "WX/u8iHSp8IGbTYBaL3fuRSwtWr9GsMp2NiTyyQkDy83mjZHXvLdalgEeWxmmks8OtZxT61L5eAsHnx7mshDb5qfGYdtoGfy7ePd"; +moduleBuffer += "tXSo6BJVlsN31gp7Lxk4i2YNpZOwJ8j0erjTgokGR8qgzvzsHxz3w0g3VDXqqzH2ovz6T2O/mVYdi+TlN1XBgC1Op99eJ93OPHNt"; +moduleBuffer += "ftqewcENiZ6Bw+QKdvZNBCuPeLKoRi7/JNMvjgFvcklUA0sTIK+LfOLgfkX+M0cNUJPTnKV51k78dVkSrGMeVt7pk0o2BQb7mpaf"; +moduleBuffer += "aG1Dm4P9Qif9/8l7Fyg7rvJcsN5V59Q53dVSS2pLsl3n0Ib2XGvcd8aoNbJzo9L1M7Zjh+XJYmVl7uLeRWZYpz25bkkxZEZYjS0b"; +moduleBuffer += "OQgQYIyccYICwlJABl0wRIAS2pJsFBBEBgMOMUaAHcSNAQGGCGLw/N/3711Vp7slBJgkl9irVad27dp7137+z++3vyV3w/zWS6MY"; +moduleBuffer += "yQeKkWL3W1X4GxCcdkGeGlTAgGDrC/OsvN8i91nesPd5wF/TEDPlABqlb2S3kX0Y3vyPycG8yFYurGJ3sb0BOm5aa8qaPNWm9KQ1"; +moduleBuffer += "+0xrFuSLTD0L88XmV1a1DXWvMXWDBBjIWW0jHy4Oo4S3utrh0OVnJ+HAQDhr1TuHxX7X+u+TJQyLB2oJcFMo9lQJwAbc6eJnIpPC"; +moduleBuffer += "aLNhiQMjvjSl2YSi8kboffpBFG5Im0DYfWLrWS7rpjQCHe4BrtHcyNIc0hsDd6AeaPSuV4Tf7/z4QadYJIX/eq94HL+fec46r/lw"; +moduleBuffer += "oF8+QSZwBNPqIttqiq8jIZfLe067UXsfGY93mr+aDW+giuyQx0aG4BYn/nbGGLzj/Bkg/Ga2qQvM2x6rtfspFj/rLROOO/PuuC+j"; +moduleBuffer += "tokuA9k+SCj6jCEwPZLi5JEZpyxnzWS3UZyop6zCvnm8nnLM3oxzN+8aA4c4+0e6rxTTn5bN+E/iLlZI2Wzja1e22nMsIkRS3muj"; +moduleBuffer += "ZXg8gHeoLQ4Mp71rlymqU4LpAJFjlLeweQ5gTwvw7oDuaa3SBFNlJiFR2sqOa7AN5kYD2pUdFpSfZCyL5ZD+SENFU1GxzXxTqKdU"; +moduleBuffer += "iWIRau68ujfQKPYeLcz0a9F2utKYkFgDqqUYoIsmBqbNnUU3xFRGKDUasSLcwOA7k0V4c3ZvKOnLZftQAjPFSk0mvGGljYb42rAG"; +moduleBuffer += "EuIL3Sh7CHHVZGkFa/M7YXg7xGaqaa5U1SDuOCzV0aBMTWw8g0YH/i9DAzqD0uty0GU+DKER3qVVRQIo8TR8YLTkV5D6SiijbqmM"; +moduleBuffer += "OimObz/gUExN+XQLFiy9TmIkz63sicZqJ89DSwX09282q3+Tvv41v2R7z7uygb8IijU2nqLPuo3ym/74gLGnC4sX4UQt1HS82H3P"; +moduleBuffer += "ARLr5hcMjoq7JHM243Lxh+Xi5q420rf4w6p9vu5pVft08ful2b1fmt37pdm9r2b31CRImxFUAueYX2x24RLjY7OX2Xgv1V3byS3f"; +moduleBuffer += "5XZbk6p43AwrVX8DVLBytxV3Qp6BIKGJepK3XuwZ+T3NymFw0wEyvnR/y6gHQlbeSehFn2NpNQChkpvTywC1+OY04zIer+4tsItv"; +moduleBuffer += "vosHQKjaUARMkgesVa5rc42jkNDuKrfh+1KgqEs1qKuEys16rKu8h72YlqLAvI3ySY7ZqWcFFpiQZTS6zLBAGrrJD6noju7TPHgW"; +moduleBuffer += "lMbaKfFTsG6Yk77SvgVMKKZbV5AIzeiI9eQd8zpiyQne6nsYq1Xy1cs6IbdxHGY4nCeloQG2784QahBuXe0mS6tJj7QaImk05PLr"; +moduleBuffer += "U9JY/zom/VqPcSqW8D2HAUgTNuLGHuP7eYjcp2of7O13HsCGxchasHT3FB+9gZmC8ViyZRchIAjvIC1qIcCMDcNldmoSoWn2rpgg"; +moduleBuffer += "Vvo5sdqcbyI0+oZi03pZyW3G+7DtArPYwFSTXIVPuDbmy3JPWl99yFl56/7O0tN+jXF3Z9CsP9LvKT8Aids1UZittPCvbvuzv3bp"; +moduleBuffer += "bfmSO7oju3Jm0PfO2rIrz6bWmS8fWTv4Ug4vOqA1bwe0ZneAet5lxT7Ufl9Q9l+s06DrZ/8FectpQl8c6RQY/e2278z7vV75AWYU"; +moduleBuffer += "HzOjqN+DfbnVP2aNeZvcmG/MtHVs140m1l0P+bx8EH0VF0NXaZzIwoWef6g+nYU5BhYB2AN/EneTXfl13TL9MNfMf9uQoJc9gKP2"; +moduleBuffer += "aNs4+EcQhQuPdUXZ1b4un26jCpKmbfbKUraRT34Xhry+sDS+pMc1xcWXylBkxck77WAghyQcLxMGsg80Ug09wUOAy74Jd5YPNuTa"; +moduleBuffer += "grIHBBc4mI5bE82AH7LPFTZUHxBA2Mte14Chm+JK/fE583LjQY0bj0/NjbeUG49nc+PRmXDj0Zlw4/OQOnO4cd+c58qL5YYbj7I3"; +moduleBuffer += "GW48v8w6cMtJU+PGo5Ibl4MUDPnJPoY80Tiz4LRHGczCMOTL+xnyEVhwoB9c0F5RnSEf65GXKxnyyCCIg6mn+UquDHmlWEcUBzLk"; +moduleBuffer += "CL0lHPObaJMcKEMeKUMeGQ6ct1l1iygL/AhlyCNlyE9iXQ2Y6BPRXIbcKLGVALAMORTWPFvQOTueH4b8Qz+VIY9Ox5ArXnlLTZti"; +moduleBuffer += "hdz8dwqaeWRehnygxpBnZ8CQx2TI4zpDHpMh95V4C2sMedzHkMeGIfcrhjyezZAjDwvvtuoMuWosKobcr4kP/BpD7lcMeUtY4C1v"; +moduleBuffer += "t9ZY/Qy5bxjywfIeDHlFcfiKhgem2FeG3K8Ycr/OkPt1htyvM+R+xZC3lCHf/vZTM+SDVdtQ9xpTN7bQVsWQ70YJ12p/S0Ir+6fE"; +moduleBuffer += "kmPKj8ez+fF4Nj8e9/Hj8en5cZxyyo+Hyo/78/LjA3V+PPup/Hg4mx8PK378J5YfD0CSL1fGiiT5RX1sZljx44HOutFZJHnJj2eM"; +moduleBuffer += "aFOy41HJjh97DMaXlh13Ga36DdzpMry7oA/xcQ4v7c/hpUFDy7Q9Xk+p8dI+SVO1EY3AS3s1XpqjF1R8BwcvqPgOjl1Q8R2eDTMp"; +moduleBuffer += "vHRYeOp5hv0evHRKZT6HEgR/nmLfWwDum7z0AiXoS17ar3hpr85LexUv3Sp5MqXMyk8yrIL03F82+IWQ4JhvipWxKHnpWHPn1X3S"; +moduleBuffer += "Jz9AJBHlpQ2pTzR15R4ygnHg0uI5Nj3Eo0D3MuvDNB8v3cI5tFBpghYkR/28dItBEEpeOlZeOqjz0sG8vDSglkDr13hpYDEJswJe"; +moduleBuffer += "egByX2FaSl46nc1LB/Px0qnlpY/dX+el0zovHQjFrrx0MIuXDmbx0sEsXjooeekgD2bz0sEcXvpv32t56aCfl966y/LS/BWAl378"; +moduleBuffer += "vRUvbQOg+rPmtD9rTvuz5nTws/LSwWxeOjgVL51OKuyp8NJpHy+dkpdOTTzAJE8NLx2ADA0sL52i+1Nralfx0sHzy0sHp+Wl0VPG"; +moduleBuffer += "wm5gFi89MIuXHpjFSw+UJ9sAVtaAXWAgpbsxeenBubx0WPLSC0teumV46Va5lffx0oNXWDcy4aWfvv2A2V9zijgNLy0bxGDfw0j9"; +moduleBuffer += "da8G+D1C8U1ScHBcrgNylZP5F+alI8ONgcgjKyrbJ3jpsJ+XjtlKy42dgpcOdUhJL8bZ1yIivGrzozm8c9rPO0cl79zq550H5/DO"; +moduleBuffer += "acU7z9/6MA/PkHduKe886+tqvHOrzjsPzuadT/vBc3llGbGMOMcYZuGV30YM3HIeWGa5NQ+z3P+BXtni8FTMcnrGg6LNYTvAHIdk"; +moduleBuffer += "jr8G67UBFSoJc4yaI8sc1+bnT2OOdUJr3tAwx8IuDBnmOL6MfH+mSwOd4+t66DZsryCCZJRrspaCxjKx0bdS0H0Rs52COY5mM8cL"; +moduleBuffer += "yBxnuqLrvPGHfj7eOJ7LG7/PGKbOeJYv3e6WimoZp3td2PQpZ7TdlV27ZGioA9jhamRqZYtpscOuSHrZg4zfuN2lr+IXTLhVYR4e"; +moduleBuffer += "NJNpsUZ9561hT9Qy1s/+EEgfaEax9ZNC5h0yMRZBxoX0JnBXOJfK9PwRWFVFWdqNSJ9UbTN1hbMGzOcK57DihhxxTVh3LQonZi7z"; +moduleBuffer += "Icij9VPrVztbQX09zg+Ps/fRY0FqQJR619DQ8in7vRLk7nGX/c0j+pgrJ6ijMNeOmjgV/yjcWrEge09SDosaNrmGg/RM5Gev+KKD"; +moduleBuffer += "Mu6VMlZlm9RCyc12+OV7pbegh3Cw/3ZsLZ7cf6a2Fv9GOuTwo2faIR/1SlydPk8wxAGle91Rd65/XQEd8iR8oK+dx79u2i2OPnMK"; +moduleBuffer += "/7pjz8znX3fimbn+dXlZ2DZbWOl/BVHZjmdmec3dQaxZhn0CwAsXznOOumNZyELjjhXfLLlrTnRSyd6qYTV3rOlN9MeaeabuRXfU"; +moduleBuffer += "zTUid/pW03mVInY5TVJN9LncBBOCTbUFCwkpBcuOmgzurMcawi3XWIj+/bl7v9KGiY3optvlV/i6AymYp5w5XbkDE5BNytVS/f6A"; +moduleBuffer += "bKOzrSxpfRfMee52/JptpeauRWgbrSKw+VVgt9J7+9Td8jen7Za8V2b4leyWD51iqZ3GkdW6sc6/0OTY2HHrKVwu9946n8vlzK0H"; +moduleBuffer += "TrXQYLDwmtmOjlhoJ15zYLZ76tyFdsbOqtNVu+a4PW679cAsZ9XxX8VDbNv8e/azhw6c4Z79+l+xDjnFIbb5K2d0iP3KzY/Xn6I7"; +moduleBuffer += "Dj1ousP2QF/H1ObHV41x+9GSTN/WR6bfVSPTt80l07cbhDvjMhOo/sMzNPo2pdH/Zi6NPtBPo0/XaPTbhQqHOFp23mM7hcl51BDp"; +moduleBuffer += "kK8Hlki/IduMkh9lW4Psq4FS1jesdl6FkbOU9ZGKsn60Rlk/JlTxMz8zZb3NUNafIWV915lQ1kdJWX/w+aebHt8n8/2H8+zlT++b"; +moduleBuffer += "j2h6dt8piaZ7bUl9G/mefc8rxbR/32kopiP75qeYfgnd9vT+B+fvtmfxYE63bf3LB0/VbXtsSX3dtn//g89ntx2pWjW32x7XuuZ0"; +moduleBuffer += "23OujUylyAjQh2qYRcC2dL2r2wTE60EmAIph6v4iKYCqFhavSa5ahmZfvgxwpurY6W7oNvhu46plhHxKcL3/lm4TUmgpq7mr29Bd"; +moduleBuffer += "QQpD4REUQpS0hDdCEamW2dA2Bharmka6AYH9h3vZ3zE6UmLiHxEBJzeeOiCODIo/d7pIgzUyGz89UepJXRTVk3/v8007HX+9nLa3"; +moduleBuffer += "xXNnzcnXz0c4bXnDKQmn3bakvlmz7/XPJ9V0+PWnppoee/28VNN9nhubID/AjGSkHHgj+7MiHfsbTYxgIbJ/8hc/fO5909944rMO"; +moduleBuffer += "44DME+q4nvv2va/91PRrfnDv/4rQQfNFOq5nPvyj7x95/3//xg++J0UnNnc3NgF3YMWysesrdk+Ux7WW3IbwyoQyRWwfX7F74qpy"; +moduleBuffer += "vBuWMebV4XsjMzLaZq3i2/IEHvYKGxma0PLpPq8WR8wnyBWsJOpxxBhXzPjDLQfo+ZRGV1fg6KCMKObhtwnvdZnFTFNER2a6E/Fx"; +moduleBuffer += "3FqmNt9Y3uEWwRhg1KkwBphfxgDDvNYYYHzKGGDQvEC1Ac+HVepRxxhgPvU9iAEGtAyZJz71f7AwwWaynOhlDPRFhUkZ6MuvAn0x"; +moduleBuffer += "hDGBFkwws7AW+StUL186OO0yaOcnPOOLLFNytwsrKM7dTqzOTQnk+Jj0IDASpEB5tw+hhLLpRu6v3Y054E54T3q6ro95Vt14zNNY"; +moduleBuffer += "wYfdXva6UAV3vvFaHO3SZnLsOhPDDBTRqC5nIHt/yvg5N7BN+gqK7+syD40QfMI/BuOpBoKRNqhRQn1BsXkLzy5KvEkQHXazbU21"; +moduleBuffer += "RDBNl4aoaNDTXx3XyMdPeArzGsj++8xrZxQ58Fe1o7bd8/x01PQ9pqPe8EsMTBaeIjBZbLPFtfhlXRsJrNs0wccMrpjftzMliDsm"; +moduleBuffer += "+07erOGK+fW9qWH3poQRyBQ/LDCx1Pv2pnhjHuaNMk4Z9yY59v1b/E2lQtp4h1L15QOoSa0t6XwkHyC9Q4xcXiP1+cBuF7JeKjld"; +moduleBuffer += "tf1IVCcIsCBVNV8PuGVAI/vyT5e5ZBjk8VpZ/2tdmuoniB9aVRSpxjJBXi2KaAKmquB6G7asoehNDUVvahQnH3+QhmcNRW+C8rLY"; +moduleBuffer += "+dUHFb1JqkMYIWO/C9Rvfv6OkpNRS6Sut/Yjf/Tm93xn1999d3jCf6mcL8d3fOvun9y5H7fXy+3OHTue+fh3Hr7jHZsQK8pbu+fZ"; +moduleBuffer += "b27+2tZbDx2lqY639nOfvPuuD3zi8A//J4Sx8tYefN3nPnB4/3fvuHMTHQfWfuaNP/jy333py28dmPD3ydxd+ycnP/Khb+y5+5EV"; +moduleBuffer += "E/5e3O/6889+9sfbtjz1WxP+btx/58cf+eIdH33n5gsn/B24f/bZv370zY/94+t+d8Lfjvsvvn3r5971zDe+/k9S/TYkHP7LO5/+"; +moduleBuffer += "+Jef/O/phL8F9x/+yve+9qO//uz+s2kO5K3d/uzM4Ue+/InPv1ka9Cq5f/+3tvzdlnvedNeqCf8mub3ttjs+9NiuLZ84IOW9Qu4f"; +moduleBuffer += "+eB33/3F133+bf8BjiKe8LXG37eXHafYR9k/C2zja2wG5BD+B1nwsIoPZgLVqrOJyXiiyoiIDiYjI9WW5rE7PHWttvA4BqmeYWpJ"; +moduleBuffer += "TJpQtS2ywKOI76bKZotoAlBguGsolVrZOcJUrO4kY3xixijjKw59/yDyjPWyrS6aMdIzIMAWwVsO7ZDAINTJKxEaqi0fjtGwglRR"; +moduleBuffer += "8xv2VaIB19WaCZcqkpXQENIMgnp8Kum6AJQPilb2VEMjVxmzKK3NxjEtpp8jhrrykeqgMwrxuyXsDRQbTwI5ab1NQilIdQns6Qhu"; +moduleBuffer += "Xyc+ijrZcbsc4XmIGKbyWcvq5IW7tH6QYzGGtZfvuG8WzYL8vwg9Ep+eHon76BFpxSyKRD50fpIkVSdvPbocQ37kTvrhBFApFohJ"; +moduleBuffer += "HTiPaIjobF8A49LrOxb8RbiLa6w0OcobWPZYBmU2zeATolUzrNGQExEmHzy/sqM+AqwiCFvE8VAYBF/RS2T4klHsh8b8drp0Ljzi"; +moduleBuffer += "qPD7w3DAq7UoQIWxRV5gi+DIX2bTDKG2KNAW0Zg8QIsC06IALdJ4cCiM+BUY400MAI/TAJf4CtiICpNnn0lXUrtevCh7fwhXlSvg"; +moduleBuffer += "Y3PlMhB7vsq3iQIeKMBWPcE3gOh0V1Snfl9a5zFAtgUfP1WG0Ehe/CJEhkavuNBgGJCwZAFlwMg8WeFkJVJFwuDWpr8MeG7pd6yH"; +moduleBuffer += "A7o6poKlG2ZP0Xqt6m8P3ekafYL2txxmVbYyA+MraX97ao+wqsf1iv720N+qVbD97V6m7lWKZqyGYhiP7NMRADFs57mze9Ot96Y3"; +moduleBuffer += "T2e59d48ZQbbm16tN916b3r13nS1H71a08s40I5pYaXgMC10UH5SDJnyyWjOA8Kh6WpEMOsFV1/QEM4JF3BfTX5ZUwurrfxURz+1"; +moduleBuffer += "grU/ZQa/BLUNkaFRVm2Ad1QXExmEsh8IZbXJrwQqFVUley+pnZDLMqbD7kawrLw2GMQ7T4SqIsTYRhqt0BvLUFWV8RY8Qq8HeHWd"; +moduleBuffer += "rgqVrgqE0EmErgL9FpKLLKtqqIdXMkkcIxTG+JumMiHIXkIzLhWMMK5NPzrmiX94cA465pNPG/rqmwgikzsq3VBbfhD/YXHWK6XO"; +moduleBuffer += "gVeuB9F/8/peT3eUqBh8pZTQlvSoaEp6N1JDQeAy5jbSPF6O+XJcvSx7D14O+XKoLxvoD6I5xibsAl52+bJrXp5TqTk26c+lx0XX"; +moduleBuffer += "wWsOX3P4Wj6nNoz3tkpspO4EwxrrSvjZws2+TRDyEfL3ADqv+RpmOf0Mltes6xEMyGV4OMLhZX8fGih4Qrx3YfJZkDaBvZCCvLuM"; +moduleBuffer += "AcNQmT2jp4wuZ/jLCHFyKAmS6/qOwobJQ9YvA3byA0YZBLs7BGoLoCII6XSKMcjU1onA6cuL48jN8G8OjKmTMo5OWDlfKOB1+mhd"; +moduleBuffer += "kuiXLAU+rOtdTfs1sGi4FIlKPRALgRIYwLFSXliovLALgELQ+XmsQXk19AN282CTbvY48OdEtVO/arloVDu/jGrna1Q7cqEqhCge"; +moduleBuffer += "+L6NbKepZhOx4ngD9PlBT+O1HnVLHRCndWAgUHFaPG1s4lapW9lOGZIE2hi1QlvpvSInuNrL85jbvqp8qQUBCQ+rG542ZeAQQt+8"; +moduleBuffer += "2VMmu2XPcXxC9pRipDJTcRF1woZooRUUjjQ1l6Immpoq4MoXTwJ1MfshldUXaXi/cQZRAhNqlMt01IaQVVXSoDdcbkHdkCptC5Dk"; +moduleBuffer += "r7SToMGs3BsRK0g10u6/aLeddP+lu23VL9Bt0np3U+uWShwNeUVH4/B0yH+PdVJCWcLZ/Xw/7xDYMu+0KXLoEN9yBMa55/uAS4LU"; +moduleBuffer += "gsSzyjco7djYHVQL/AASBBwBg5B/JpAxwOQx3sioYiEFBkklVvDzZj4AKYBkYdSe+AbzbAR0Q94GbHsIgYUVNIA3yuFXmbc2gvJl"; +moduleBuffer += "fORIRRCIn+NnB0o9hBwfSQ03WrpxEmFUlL7K48tLakIR9yFAyCMY+XL3Sxj6F33rcgS6jWwroWFbSuSpIKpp5gSwr0JznvtFezbt"; +moduleBuffer += "0SwBwpo1VHuvhu2qWjwZR/lBwAAmJAVnsDRcgy6ZKTaYWptLIIV0Qj77ses2bMx3daPi0eCWLnMwKWQwGxeH7bBmyPMSiTNXnC7o"; +moduleBuffer += "Q/DJRx01CR3XOZj0svfSl2IdeFDQNPSBU1NYWYAvpel5pMGnX9UNSF2EV3UboNoSTb6hA9iw3KM2iIRGT0gH2JSDTshjWDcbyKkb"; +moduleBuffer += "cMx0DDoZFq98rw6VIicftQIAAzmTvtZ3mzWli6cndnSh+wZPN4pGsUlOdfdiJNBpq2lDKzaK1o1dABEUSeV8MqaeyTDWbMkJ2k1q"; +moduleBuffer += "D9UvnxM4MU6BDJAVcuVCNirNYtyXUHf+kGGf1VsxLU7eZ0SIIKOAFsnoXzUdjpzsxZe+edApxoot3zpowkyj11s3qvAC1udeVYtv"; +moduleBuffer += "zpfcq9WyZZetJchbvRKXmhhFqGBGWiEVHEdjWIFXViALi93kwIMgKw/oppUPqGMB8ceGa26Huuxe1w/pp2d29k2hZK4yiqOuQewL"; +moduleBuffer += "CSTtnAqsOrD8bX+++TD8gp+C4ddXAsD85gPrc1fOIt6Nn4nBXTORLbySdJ8fui/og+77gavS9OlSJpgxUmNx+IsHHHC9M243RmBK"; +moduleBuffer += "gquAKIOAaidFQyxfJnRx4nGhmN4Q2XC5GggG2zsDuwirdw1h0MeL6S9ZxZ+MBQCqtn2pfDPQN6GxSsoXdpQvCKt4UwHA/GLGmVqn"; +moduleBuffer += "Zh435XH2cKLStuzH8RSidrpVXneyyKeYzanJ1Wj6kH7NxH8sfYLzMurjSPkrq8d/VN/cTmCM5GQ7uhyRo9YR1tXIyH5quMcLtNvc"; +moduleBuffer += "XgFV5QXwCz7yJxb9KJikwTT878w2gjNwAlNEXZZy6g94nxkXJnufGBcmvTdIqI+7bgT+hKyJbwKEgz9ZCuJ+EYn7+JXgErgBxcoN"; +moduleBuffer += "JJI8lcfrue/LuJRsio6PpjrdhrLt3vop8PdT6+UDznml/LPwlfjZRLFdM2MbuWqAEXAH52Wyfmo9OJOl4EwWkTNBM7p+z8xklOSy"; +moduleBuffer += "JBcl5dxgWVGAN32yI7f+7Ov4jBbxL7iC/1mX7zfM8j3hVPO4G1QzuRtWc7kb9c1mLMy1pUTY/hqvT/kxkhYnzTk7Bgi6NyLFYRgF"; +moduleBuffer += "A5RECZERpRS50Cl5GYtC1ghzlo4Jb3R1Kgf1eRzWJ3Fkb8q57xmg+HtDJR+EWortaFsEyGLTSjpGttThHaayASkMTF7pww7tIh7w"; +moduleBuffer += "oIz2jQBzn9dB0N6mnoINTgJA60F8AEFqlH2ZTPJyisnaLp0JCVfEc11jnjEQlLx9ubBoc9+i6rH/rSAt62aLhO2FhuYkIs49bSA/"; +moduleBuffer += "G+qC2JT/pX2TXSYPd8E7tyB1BGXA0NHvZpg6daAkfCwcaLa/20asYgV5SEnBA+pEloAkB/eN2QQfWCSFCkSvwaJiYI96uGTwYzaR"; +moduleBuffer += "Ga9gAFHqHlRs7AKaV3kIBRe9ln6AARcYo70R4dPUJHcO522sPCmLNXjC5QLwFTdUJvghzy4Eu45iOcfnB/bVPVxdL12FHH36HYc0"; +moduleBuffer += "kiBiwQ7neHJh736SmXuXbyZ8vCQBvT1Tz8wndx404U4oEItr+Kr1tuni6+sH0OVUPbzbmE0eHTCxAJWKz440bBhKN/tkowxReThQ"; +moduleBuffer += "iC8rTjA6mJmgBt2tIgeESo6yd2Fkd6S9GhEWZN8U1iXb2ch963e4AyHR7xRy6RFGg273qJNSBD8N68yw3UiWsoq9vtKnJ2KkmLuc"; +moduleBuffer += "OQov+zigrfdWUTR1QNSOuxwayfnxNwiZdm72ydAGii2efp2k5JJS+j/50kz4kh0d6J2mrz5Z66sjz3NfPRHM6qttcgbv+GPpq4Pw"; +moduleBuffer += "CNzbYqd4tq/Qaz9DXz18hn319R3sqyNVX239U/bVkVP11YcNnVJ51OcVgIRfD0jd0oDU6lHaF5BamJgjjnYHHOY3gAiyJIpXkije"; +moduleBuffer += "qSNSq1kX7alsRGqPzoS1iNS+3eJy4xef/tD92c7nn344/yIn8z/rsfxZyAX9WmghWqZEOYGLqXm6HVa3tH5mbOYLoF0qnCvZMTgT"; +moduleBuffer += "71/7nHPbWmzLzzlT2cOgFl2auzHAsSTHRM2j2/Nm2C4JH5THmy0MUx7uEQKtgZgYZQm6TPQNYzOBm1g9P/TjFmkE1n0Pw4ddJkCq"; +moduleBuffer += "fBPFgt+tQqbbNddVQT2pQmPYXEI4tBjBnDqc7HEr2CsHC4pRw785qnJwVzvDuv+GFd6LY7ANAv01OoHYrzTslg4ttcGE1S2BLWDH"; +moduleBuffer += "yCEq76EFLy4pueOy7jEvp+KVK87s7hzRzFplnfhZ5vBPmcA/9+z9Z526DxqK8phvVK5Y9bRbIKpKrNwWgl5r4rRPhSytIho2UQ6i"; +moduleBuffer += "rsYt3SuPm9njmLFHPaD2NRE+2mHwhG/HDF3q4wfiiSX4EbAkdhnKYpyx7ERs7ChC4fhOIHdDG6VGE0jlq8d8fMLbX+J1FHTqRDzZ"; +moduleBuffer += "XSgfsbDYHvYYuhcpOnuf9XqdQQNaD3iKBtAJWkpOLBhVuA9Sk+ME7wFhK0vYU0D578YazQNr0l9TRJSsbII2ggtUBXDUGadFE2Rg"; +moduleBuffer += "2nYRtSXguxpBles5MLyermvIWDl4EQevaDLcGNS5TgnEEgOCQtgioiRjW3FBTo0KY5oq3TYmO0l6VbCpcHCypaylkCMMm0laHH/k"; +moduleBuffer += "oFOk2ffiZcCNdXUSuDr3Y6wMUmcj3VT2JeNI7+o+1q7QYLiJwdscokX6c1NkmeJ06GbFikmchMUz7lV5JruP3r3PvWqqSztryXA5"; +moduleBuffer += "Xcrws3G5/JNfvm4ZjZtV7hizP6aQ16QgyhoF6DI3vLaT2vSAIVGuRoe2KeBSUkLldzLUbkEDwWuXdYaBYNErNk7l0iOLSiyEpm30"; +moduleBuffer += "THeocH5T2rBISO7CB+nRzIeva+M8RaaugmfLUl9XTL/m1s2vmmr7jCUtxPjwVbDO8lKSmNN55zy1gOmMspJbql4rBzErHnvPIQc1"; +moduleBuffer += "F97kgO+4XhOO4eo/cVVbuC8pxOmMthow4jpv1qPRVjJ/MjpO2iqnSfGxTb/RjmoJxkklK47JfM8C/GrzCApl9AjE9bKpYodMYWqO"; +moduleBuffer += "3eLt8j4d9YeKc3scwNZ19PC/Zar4fWq7izVXtunCx18a6aBel6nvhDs5ELqOzGAHhQ1qYd7VeO0319kShMdj+vh1pqTijdIA+vs0"; +moduleBuffer += "C9lNAC/ATwz7P5HfLVl89gNsKqun17RDHZFjoMDM4GCY9BXPvOL1vWIzzjhpNY7g8aS379+cj27GYRSq00tk1m2TUAD6S5t8bdsx"; +moduleBuffer += "8wblOldSRMzRal6hcwX3V1P3HOqSDzUCd6icksfw3YmGbgeeN2McYzwi65DDBdcNMIdW0KplheOWv7zyl1/+CviLwxIW4WS3GbCS"; +moduleBuffer += "rMMY4a1OVvw/HVf2Mg+ZQ1kPTSzTIZkn3SE0/gosiqG2V199kjNCxF6n+EN5N4ZAPNIPiRRnNIJ5WE+Bzj0NGYmvb6ueva08W7s4"; +moduleBuffer += "+omD5NnaqmdnAPLDRyxbFhn2sa2mjLJB5V0FT8TO11aIJG593L0u6LrZV8i8DufcHbOuu0xI3+DaNkLUwj5A7rGmZRM2/QcrNa9+"; +moduleBuffer += "49dvguoGW7d0HilhTYnzNiR7MVjSMWlLAybBcfG9Rw5SfxEjDqdb3GR0O5t0ANToHaB4ciRoY1u6lQuRDpowUWSHRGdHgjqguCLb"; +moduleBuffer += "2yTG/yS0HpM0rOsM4R/IJjPlippUMdA9r6lOGZIdTT92SIOKD+XEX0wY3l6Og06GKUzmKJOdX+N6mCYotmFSJFAWKSvfSrjzXidZ"; +moduleBuffer += "wxR2MGp8mKiVC7Zro2+QeuWAoG4oyeMLnc7FQMwS8hUH2QtA5SSAUxudUKOAWg0+3gj6GhDXHqN9Fdqiihy0DcyWst9xjkOg4eIC"; +moduleBuffer += "teACdHNbBmABOnqYKvqwsq70iEaNs5vYTjM0MgyUMZOpVfpKa3ScQA1uAhMF21vhjHZSVavmcgx6xgnwfOc8GsJS4jvmOCudCdpa"; +moduleBuffer += "Sj5nYiWYqTwF8ethxWR8wx+fcBbVg9bh00Zp+Z0JEUarBDghMAYDQmwhciB94T/hWtHYGvXscxF/PAaTgbDgobaWxsyrHQ2vo5Hf"; +moduleBuffer += "aT6qgJUw0ViFF6+UHgtmh7ajWX0MZM0QlJeQf1fT3rnegtn1N09Vv4mv6E914wLB07rNq9oARgKd+WkblN5FUPprgNeIYPFDGjF9"; +moduleBuffer += "zSSJ0VU9ISnvJRG+BntChHXISuWhsL2Fn/1nPrxMj8NmPgS9pGxkEK0t6sHubTHgXfNFve5QLRreKIjdqDj6kMaLB9Aj62cADvyz"; +moduleBuffer += "vDj2kEZld2HfzzAt8g877pLixEOlGI4JQhBf3W6oHSvKnX5YY8drv1UGRH1tbjMM4FDx/17blp4ugivYvFEpAYUstsy46oaJswWc"; +moduleBuffer += "0R0omig2ZgjN2KzqFUHVVaaoIjDdVex9WFvsQhu8SqnSFc6lc4aMgeBe413sklCzP6OUAG9S/bay+sBgucg2i9UcUpgpY134Nxbe"; +moduleBuffer += "zTLs3s3y08Qdu5QwMde1ua5cfYkGDIDO0UDxaW5i/mGpEXbVw/7vkgld61JuDauBUWwFF7tyWevATJb72IhcRnG2JFht2Eoz3S1e"; +moduleBuffer += "aGZZQsNAsyQTswhDHtUrnE4H0lNd71pAaqyO8wVQubu6oXi66FtQsy+Amv0FYLVaekC08mEcEC3d5Vq5DY3EBEDuMRBeq2TYWrr9"; +moduleBuffer += "ttRiqqUngD5OpXTubg1o/qGWl2lj+Fvh+8/3LpUdR5ZhA0NtGtWgrhigrccd8MbdUYVWA0JnyNgqTD1PU0+SyWtAj47UF2pqq2cM"; +moduleBuffer += "zRT2TBbKCycMAFp+nv4S5nt0wjbjelRyUz7IF/EOwULHpRKgx6rxUSM3dxydBmzIXHnjIsi5pj0KugBZCln2oML7DqKSwFiGDxJO"; +moduleBuffer += "vbwZUTC4CVvXTVKoOk580tHGY3gHiwE4mw8qFHCDjZpw/iNfcdZMOG15NAyrlY/L5zvQSKTyTJurcbzAvT/r0ST1sKceOsIK09CG"; +moduleBuffer += "em92uV/sC+mTXTwgzzZ7Kh7bH6vg5CJjXrqSBuHU6GlSccih65TJ3+ohYuYIJvs+jyZ7D0BbSy8AF3KIAUpN9OUBxsI17w7g+w57"; +moduleBuffer += "CAhBqfqAShmAXatTb0CpiwEI61uS7pqjdKCg0FW+zJbqGinBibhHhvpeYaix0S8c87aTmFkIBp8GGodZ90K1HPH0VqkSPcoIX3gI"; +moduleBuffer += "MveHNJLe+d6YrFnXYHFSuA5binxhPmoxdkeBwXf0qRnhXQmrh38CIVuEzW2G8ijVz0AObBcNbBf5whXO9tDwynrGK2PfqgIVhRZY"; +moduleBuffer += "UptG6PAguzOgsZ+0ppHt1/2T+MDhhe7wxW7CI8vsvs2S1QlJZxoElmKgh8ALzS53zrCIDOACy0hg5cEY6he7xpxLJRCw80blDRgX"; +moduleBuffer += "x6bcBvrFlBvPCJPaRqipaXXbL0JoWbySHo+L2w1aQ3v2A3hVg6Vv4gC/jIShhoWDIxoVTtlfgPSRyuEEJZdGHl+usop6YRESPHUH"; +moduleBuffer += "aYJkoAarbDpaO6CtBXktKwRfAyp0wzryR6l+HnbtEEvM2jV7ui96CIuk/M3s57E+t5bcZStiQ7h4qnPSZpnmphTsKObicKeho+Sp"; +moduleBuffer += "Rk8GaER6tg02Jyy+BflSscweqhgp56yL3Rsl8RAfLVetEAlTELBhsaRXrFAzqEiHW+lZDLGMrJ47hpCVtNbFVIg1VCGmR0nR7HGy"; +moduleBuffer += "aKX4KtuQqN4QN5CGUBwTQUpEQrkqKzfHkuS78WIZtaRIe1qOKSLRDeKQsfNGJRona8H5HsUUpIvtJJNzEp7rRSPb7fc9ELIMNGlq"; +moduleBuffer += "RWjbIgVWh3TUMdLRIPsjeX9XlxuTAwGpV0YAnQlhvgrRp1OGvnRz+xxvllm8MkufjtCINCkdbedOFSHUVwGQPLPyzbaKttqlXX1b"; +moduleBuffer += "xaNt3QPbqkdsl6ftnNfd6vVUxY/86JN+r4vrvVGvu6w0uPLP9+6KJvwTBGOyFDPOiG2R7T1qUZzaG5JbtjfjkOfM2YggGd3rwqtK"; +moduleBuffer += "h8ityc+9+hC5xgdBe8qX3s+u05CL7oVuhp3GwXbkFgvsfHCKQdwvNNMXJpm+EX2bsJ/DPdLBVg06OqEWIKpWRe7U7IrSMAcGct5L"; +moduleBuffer += "IE3IHVWi1TpU/baS7GOhMPf6pqPObThN5IxYIted0pnLS9XByUSxw/dElbnbvsS4wUrOs0sY2JlEB2NGUs8pUw8nCqdyuHofA3Sv"; +moduleBuffer += "DNDxRLt+r/zeq2C3UecspMhAnbfW+y0aVe7h6Xck6hVPutmmTkduNkvSEkNY+MVWuRsu27Ydfi0VNC2Cdpd3uwNDdbAVZ630TsLi"; +moduleBuffer += "/TxMFW3JcWHlnjW/9yYT/jZzIiyVDloKJrql9xk4c8wLR+dFZudFVl+h9XmRqW2/p6ffjtKr6zhw2HWevBsQm2O9breLB8+UNGQE"; +moduleBuffer += "R64bJ/zcyi9hTPAKW0tUn8nIShTfWX5bQQ1YX5sdZXtcWCZqs8Nas0M96G3rQ7Q+nNN6XRkNgOs6xYtIGLo0V4bCKHuCHNQrOlaf"; +moduleBuffer += "LDcv7zZMtxRjilg03ss+Q35tVYc2DBd1aHw5joxXtCmJfNKhabMsMSd7i6/FNNXBp8HED3tga16uojn3Quf3LnYgI8AJv8L5v5Rf"; +moduleBuffer += "fcjBB7tyGBvyURlWT61BbcQGMK+0rympcS73m0Btj+PXKzovkpJHMZ+0lKA410w13iwBrU3O7IUTzqBcXjThxEYsgUOfxb2CbrOw"; +moduleBuffer += "LNvu9rK3x2q5Ais0mKPrbhfkKunAgeKoUIAa8UvMDsDnNO+oZXNTbeOozX3CKbOPTjBfc2UtyAPLxSGV4XBkj4XVnhTokWr3JNbo"; +moduleBuffer += "qJSlpbGlZpWtFGlod6GkNIBfxOAWiKfAFxaVW/wiPQgj3Y6s6xSm+la380Kkb3E7TVw3AzhHrtNuhzErN6q9zqs6NBLa0CEey02K"; +moduleBuffer += "s3Jjx9HVMchZotN+RModwTJI9X5g1MBLR9ndQMQYUCILlHt3CHeN7B4XMc9aKKakVxfLa4vpOIm1s/h8L+HaWQzLO82XL8baWWVk"; +moduleBuffer += "RYOjjjJbkbwmnOG5WBlytiJKVDcne2SW7WA+CM2qj64bRLUv0OIGYdWV57VcPr28h/JzhQrJz1W6pMg2rJOsayazT5JLB/S13AuF"; +moduleBuffer += "NIouH0ITbBlDJtZgIL9ewDEbVC5eX5Sci8uxGtLBHSKudioPOEAD5dAKZ2L0wakSUCneHyjB0hlPiL1KvoUsjk6xjvSyzLzOYnkl"; +moduleBuffer += "xit2oqWYh0OYgVIfJqaCeqNxZR1LVjtZStaKU22kmmr5iGmPzjK5SHtGqvZw1o30zboRM+swnQYw+W6SFcR5lFbzSMruIr6e27cj"; +moduleBuffer += "b3FhvcRNUqfgZjNfp8183SjTdXQXoNdlUg50GBPmLpdWZ5DKj8nlhShigMqWEZBfTmcwTxA0GdFnYOAub40q1HSmyM9mUFv4Crvr"; +moduleBuffer += "t3TXp0BiZLVzkQor2P9RLrz1y+XNrzscmpvRt3Qy5FlTfo/sDddADwzjfgZBvRR23Stx1qCsS1QXugr2wHCUjrAhjNvjxrtefslc"; +moduleBuffer += "+V1UVyQ3X+z8ngZ/5eFUP5ro1N/SYw82xb3sU4QcQk94o9qOPA+kH0PpwwbWO/osxaBoSEu2uduoDjvsz5l8+FiPG6GULkXlVU9I"; +moduleBuffer += "uyDtacKXoYUPHJELg/iwlzKV/UCyk6hkh5tvy0z6qNotW3lmdssWZmlW7ZYtTOKsnMRl1XbT5GBl5aZZb1pgxgrw1mZCL13hXCKz"; +moduleBuffer += "gRRcS+OvM9jO0j7qjWWkkmjiDWxr4JBbVpJt23E058tN54Os2xvZs244P7vMN92AYOCc2bTzlob+3m3INNDOkK+scA5FCDB5eRvu"; +moduleBuffer += "7l+nEcPHS+7IL/Ynht4iLXYo6ZmgULg7mtSptsfkbri8O5aoa6VpxIXOQ9HFzlOJSmT2GjpxS2PCeyCpKLXDibpXP5nMInfcMj6F"; +moduleBuffer += "ukwYKi2w5E5QI9KDfnLHA7kT9JE7Rx1r09jqqf2nkz1I1ihTF2z8LMtDqHkhIR2w1c3yiSzuumKjpTFqhUzyTClq7j1YOnEXO4/P"; +moduleBuffer += "ONlWPx+AHQrU3TAXz+7yNWPDVqbhMCAi4ZYXqkO1XXXkzPnV9omdhKHOvlAXjWcg0kMb5UkpkVB52tAsBs9GpSH579SsfmTMeX7p"; +moduleBuffer += "91pGkaeXV8ujpxeU+Q6Oq3cq+Dy2Nqc8rlyV/Bp8CjOZoEm2rKOrrIxto6ttdGvuLCGeW0mF1AZJhWs8tB1z3DFaTmAWtIsFHVQL"; +moduleBuffer += "2sWCDsoF7ZYr2VXvf9uJrnaiLTuYS/604fPDM0mZW7kMgx7Kbde1GY2774xqK2Xkz6KMlpSre7hc1+V6tWuUs7Ztwi5Vy5obfrXo"; +moduleBuffer += "jzISb7Uh+Nysl5R8EmL5DterwDZwZbnwfECx7U162T3CgKo8iyFDdkRmDGEhXJ5OseGuZY+Nld2PyXq2CMgwA9tQsJ7lVnA47a+c"; +moduleBuffer += "S31fqo0k2/ksDAxqsXwoHw84kerhgACMVGwLZPlXUUQ08FVCY/cyiUH+6vOZMdF4Vvlm1l4JIQO32A7ZUIiCp9l06Qd1v/NV+l/x"; +moduleBuffer += "nuQxyk0NDgCBysZ9NeOT9iXl7Rgl/PXPfgWjE+HXleo9JvzqFlf51WmM8L1ufXe9C8j/thPx1vgEgsMQq4qYW5ptr9urNQLhAoJ6"; +moduleBuffer += "0K6MMD8+QnBJhzxghN7boz6rXxtabBs8nadd3W/HjdhJRVFdL/vHhlEKwYEUW8w3k5U1wUWxCMsy1sUMs/zsudjMjNzN/piiD0h7"; +moduleBuffer += "T3iKPE0Vi6JMaGTpE7VB7ZuwZnrv6x/0mhjgmFMXA1Rz2nL9V6qz5Ym+lzS+tRyrfdUs6auC0pK+anjA1quSM8xWhVqvzIW4OQuV"; +moduleBuffer += "+b3sML+OiEBSNzxmR+1M0gaA9Klmk6ttqM8oTxtSn1WBtqRvZnXP659bMRTgulixckc1ktV5umTPqpasruUMRGsMgss1FcX0Vi5v"; +moduleBuffer += "VpVnOb7naGr2WydfUBeBLZglAlswVwTm1kVgC+aKwNy6CGyBYm9IRQuLp2X/XljsCFXDD+XFwvOde8IJ56lYfrtCMsRGCYKddmHx"; +moduleBuffer += "ZAzIpsRm1xMOaikraMdhQbafMu/zHXfC0eBiPI6MQEBbggZX+peLFE4qKRVKtrkLVXuT/oOx5D2NVSswdn7UOKVBq3ncZ9AaaI7Q"; +moduleBuffer += "GrQG8xu04sVTGbQa144KCeV5MGg9w489efqPPfnzfuzJf40f+0+n/9h/+nk/9p/+NX7sD0//sT/8eT/2h/8KPvbOWR97OiN0G25W"; +moduleBuffer += "XvqZP/Y0Rui/jI99GpgQiQ0brKAQnoJCeAoK4Y0QBsID/gO5jUgVJbHxQSDwg+ds7KazgB/SMwR+aOTNucAPkQI/hBbXQV6gb/1a"; +moduleBuffer += "JdcU5hL8BlNW5QYpmCff2k0GAYJnZPZpc5TK134fX+vha2ciq1o7oe422X2eKpKEnPXWer/FoT4W6kF80mrnfWjnd4Iy2vMBwBXt"; +moduleBuffer += "kJ9Q5e9B0qqV3n6GioPqZKWQ1crg7sOzuyItSajo7H718ykWYYeOCISl7SA51CVoaAAFiUHoCNV7ExRwcczTwQwVtDMwR5KvSB7l"; +moduleBuffer += "2SrpSaraGvns7zW8xi3NTTXJpQsLzqwIrwo28YxTSKQObasSiCv8DZ0MWE4LKcnsDNMYDcbM3vVtL8/yhb0uYsRS6JpPQuhKxE2H"; +moduleBuffer += "yJvg2Pe6DHtZ6uy9bvSHa9e8eld3KA/+ME+7Pu7yYK3zkmW7uu2rwU0Vv44ocEPFl52rYQ2btyeL/CpZTi2IafJoLZZkPjTZXZB9"; +moduleBuffer += "PMhbL/Z2uGvdjRYnjQ1sQYyHOQgQ7fZkt82c5/vbIFxu5wuuosUQSDspLbdPr+82rr9MfVOn4QbQAkkm35JH2VehLpIsa7qNG7pt"; +moduleBuffer += "wCeA7cUANW+A0P23lqlyovnqvH3/qwlB23g1vDnhe41ZndwA+KsWPYVkGcjExiTfiBeIWYJ3ovo7gJcuX2uiMdP0u2hMw8MYHzEJ"; +moduleBuffer += "+wL5tIfRGpCxZVNbpEqluTfJz5NsZ675zhemossmJVyCLVgo0SdpI9C5hvhlx/nGq/WLX0Yg2q6MlU8k2r7hulZGBXED6R9wvcGM"; +moduleBuffer += "ls9jH10/BXthmbYwWpPEaUCjyvXWjsKw1voFsKnqrGF7L9KeSGRku+H17ISA2DocMfn3dwADef2ybntZN7qh/lL7/k6owtRxnSz9"; +moduleBuffer += "U2C8m3CQW/RhQo3mQZ4nZtQznRYhu3KtU/40vlwtRQGQbaxlsNViwoHjNgMA70vxcb+Df35r2TJWxhH3CfAtY56ga2NtdCjjDKSP"; +moduleBuffer += "PJa2Y9lQV9SXpfYMQlTd4G6TXmHJ5lZ+5Fu6hPbC7joNy75bXg3LWdwE9oY5JCFCQgdVyWv0YsOvO/JoMxcvbTsi23R2iw6c4tsO"; +moduleBuffer += "5IQnHyCOqFyIzjOQx9iLWmA+oUHArhDIrpEBLWXAMueQvQY2vueoUXcA8xhSQtl9pZ8XaQZuOxl0A5iMJp4oTM+6A7mBgh3IHhLW"; +moduleBuffer += "XYqSO7w0bvUcg2lx7JsPOtkjkZPe7rmuPcZVLicrtzjxtgM29jHjGxUn6wmA55veXkug2nBVBeg63qNqs7wHm2TiB/uOQZyoA8Ca"; +moduleBuffer += "bbu8H1FlfwkIKydnjnPNMzIJ5DluW0RrjGKLtAekRLPrZk976oMH4+litz5gmmxYkN8Vh8s0zxzwf2f86kpfwhGVpoxUApZM/cqy"; +moduleBuffer += "KiWhs11NCGObB2cknowMQviVmKhXZf/gXCs7J8r9qmcoZ8r1+xhg0wWgoG8kGo5KmEZ65X1mgHPtfaIiilKMRJfBNP2eK2OcK1Sv"; +moduleBuffer += "lPxIfCOAU2RhnDulUkm6EnlFtAHvL70ZfJ95GuhTsIB96UluUDxmpbc0PZudnmn68Oz0YU0fmZ0+ounLZ6cv1/R8dnqu6aOavtIb"; +moduleBuffer += "TZ8e9oZL7F2NLB2oEUA2qYANajna5tGk0E+B2j7WAiwXSZ8o2U2VAki0mJDBn4lVBOu5Nt1mjP9pE0BKXSAldQaLTUIONlF/U4VB"; +moduleBuffer += "Awows6BwOxmP5EG0otGJTAzPpMNL0BkiJqC8PVi0JjuDDOXZaXpAeV0g59FATvXi1cuA88rbyXxoWTcF4msKxFeo1TRQOkD/Mtg8"; +moduleBuffer += "RyrOprExIE076s0sTXXyZBkRIogQ3paqvQ09BL2EL0cbk5EuJRCIUE8UqwVwrPLzUOM1QRIaoMWxAcMIVMVk4hCp40JkJPaB4n2W"; +moduleBuffer += "UjUrgy8HQjNmfUMy0vfKrCFK6XvD4W3Jx1XBj1rYpRBF3CoMsUshbLgNjY5dClqqMlR6C3HW/bwG8cFjsQsXpcvUVamF78zel6i3"; +moduleBuffer += "cazWu3T+aVctlG5imQm7pOtyYnhFimC0Mzvhbl8ce5fFlFKfQoJJQaLUbSjf0lBr5QaKCIysX6ZWT4U3scpqyhpdAtuaDmP8VMUo"; +moduleBuffer += "4B1pv1rrhO1ain9XLZXT0yBlB6oHNUBvOT4nU3lz+U261Y2oqGuerx2XJ6M9mbJ0N8oo5O8sMFauqpVK1AX2qGNgFyhD70JO203R"; +moduleBuffer += "SewimVcXaBD5MRr4lrZsicLJhZrnoh7B3aQqxMMNJwc8z4cyR32/Ei7aIuikoJNMYrOIJzvNIkJc9jGN9defPeyk8tesHsBYFanM"; +moduleBuffer += "kMoagW466tjnLd0KErXV1bDU3QamR5Ld7anT2Kiqj3OQsxwSum44CjqMmBCh6qHphHelwqFdStQ6Y/YpvGD2gRBmS6s6I1i5a+Td"; +moduleBuffer += "AWiFhSny1B7dy0cmvDFVZuGdxL41UC3CAbx7DXIPoLBL5QWiPDi9EgEDOC4VtPsg7lfh8wahRRw3mpqAIR9xGSUOAIy5hrhKuwvP"; +moduleBuffer += "t0HYoV1QeJrusE1UdHGQg8Lxd6glGOsQN+aiziJcxjuLWWVnibz5pNNTsBzFj4+4sUTQysvZeqG71UM3BXR/hMae6DEl0Brq8l8K"; +moduleBuffer += "lpiTrikXoXI4+dTA0aP3cHGJnIsKjOtOyidbk0nZG6vpaFArwqvoY3QBpjZoHY166dECehLghjQzitBdrm65rlEzYtZ5qkVzs897"; +moduleBuffer += "NIsqwrkZjc0l8miGS9R8anTCuwhC1R4GLk+yz8hMBo0FJXl4mrJYEkx2lQupXi7nhGoiR/WTxoBuKxvJaQpLVeuHdikS/ir5lfHX"; +moduleBuffer += "3BbiLW2kmxa7d8m29+Li2K5y21P9Xm3GCXOU5nayDOUL55s29YlXn0Qa9YLAToZd02mI6FB0K/HLsjAtjB3ZBeAsYJPC02cUEwsL"; +moduleBuffer += "dQGR1DjpiHCJvaFRug9k7026PFO3eaqVheeK28ueDTQWQpTzR2LOPXajug8Euux9g8WseIRume8abYaZslKMHFW1eg0oJyeyTtqm"; +moduleBuffer += "TlqdsB4PGV+mLA2aEVKwG/JUwU2LBCCOhYY5FvxZB7FPG6/yIc6MRu2YhqpdSQPiNKpmuqWeWklunfgRQ/32yHyvzLrihBxzANG7"; +moduleBuffer += "zwy7Pf722gQ4tSzRLWYRihjMFxut8gljoFXslVeyLQjG0KbBJnvXREyE9y3PsguWWiAkoYrL6Q0zFNCy8k9mDk94IOGglK3UK89I"; +moduleBuffer += "B9unOSrVmxU+urUzU3UZbFlLiexPz4HFGVSz0I4BxgFLlN3jFecasL5B7i817D4qrGEFjUVPWP+AQ9+Vb3enJi3GjXmYBzNFcHNP"; +moduleBuffer += "FfXQPtKjNWQWUxthBALJxVelrMEpLcTrKW7LZAnrh4qlpTWsnMcNFGxuoYOdYjP9OJyj//WFbnZ30jWRPlwF0HLhwaNw4x0jJYsU"; +moduleBuffer += "NlUxCuj0Z2wgAmydjN7m0L8OllSYTorOa7i/jLNaZ5tVMXWTkk8ywFeOeiSHOildQ2aV21WsrxOJNSU7CObXSb9eIccEuvmvcMYR"; +moduleBuffer += "OU9Nlt1sN7aQOSAJLnIBVXjAi11Ih61I57I2vVS97POBEtykPQITbETS306JtJzBX+R+b55gc78VSCKynib1IQTa2ROxWryWryOT"; +moduleBuffer += "fd0WjPTdCWxr4fO+SibIqpwmvFQVqxlG+oFQMV6BseDToP9YYKmvfYFq52AlIAsoe8bMNxgVJ9lv0wDHpI7TP8ykhoWvqY8RfkUS"; +moduleBuffer += "mBzbZLjv1ZM9Td6t6Jt5g8lRkWryUZM7MrkXa/JJkzs2uS/QZOC4NMvcTWmCpsPjjQgGTE9t9hOzspsWbve18NAUvkSTYSYRlnWG"; +moduleBuffer += "RajJx/15v37GJDdMMj/TL7a6VW6cfd/xsoeT1c4YDp5AfQwcmJA94HYD2EbIJN/rThmrBrnZI+Mqt5vN7W69nTa3O/V2o97t0LtX"; +moduleBuffer += "6d29erdB77br3U16d5fe3ah32/TuFXq3Ve9e3hdrIyGQojSW1uf4RDPcFbgixDxdeDfjMZ0CgZjzsMss0uUPG2TG63MbosIHuvPL"; +moduleBuffer += "pK9qUWIdg6izmfY6BCY+HvrNTcEt7n81QdVKczE322VU1mrlluvqhwbc2wQ4AOXvcx6Qsvfu/9pBGOAMIUQiZXXYUQrv8i5Pry4s"; +moduleBuffer += "TQigExLXpQzlFyhVoYEiEABGdulIjdQJgk89BH9dt6wbZV8PZceTsoLz5BTEX/aAly3ghpU9DMdu7JSQaLgGfx1Sj9BWh2iRFM5O"; +moduleBuffer += "ktwa7mU7EwPAw9/F6xlKM1KXUSVe601E29hM4MNIynkuvVTZxmlPGhhm453B7M9dGbvBF7q6KWa2vfF5brZQdiHbzqBsp9ON0U4b"; +moduleBuffer += "4dCXHapqoO7PiK8yjaBgIT4hzt7Z13DmkbRii34AHlCmiU8pTj5+0Ckexn51bq84jpu9Txx0suO+o+ANpJBcmgG6ilJLC1yvuOvA"; +moduleBuffer += "ARKaHvRJl0rCs6Q2PU7HlaSJgGpALggO5iclv2J2yDHf6vAyTOB2bzkR24V6HCieeVByHQg7bnHS/PL5OmJYWZ9fAuE/7WmLjst1"; +moduleBuffer += "rYbO8/KBCf8xXNsT/lFcWxP+YVzTCX8GzYEL6D4AfMmm6+nSYYC89GnXXbBJGT9fj8lABUPlEUppUaznaqJ4xg0lLJtqNpnqCUwk"; +moduleBuffer += "3WH5IAjZVLw0Irw3RGtCzXvAURqiQK2zgGgQnYUUo3Ugf/MY1VT+YehAGIoM91SiNpQv6KnMbTDPeiqVa+cDPZXbCfGjkJXQTfZU"; +moduleBuffer += "9hfnicHMFaLYhPbwibLipF92PU8lcieszjj3FJ5QY38XNsCMV/iTxXnX1R9F5pEPf5ug9LehKYrkP/R5xQqQYVvtjEuufw9S/0VK"; +moduleBuffer += "0kj3v5QLAjPkZcpE0k+HhkLZn5F9eblGqHgF4wVYKsrY2tAfXxWI3iuoaDTBykOhb4yZlAznf1vmdRRlrzS8Xd5Thx6HYaO22aDZ"; +moduleBuffer += "2Lq4vyqdTGcVIZa/48+FZvpZ/geF0iJkxAqnzY1Lyn2j1ys27xWi+aRGLneVHkTVrZyQCgNmZdtGIG1YATIWaUSxMyllMWHul/eV"; +moduleBuffer += "srxN36SzUYp3RqWcQ5D80b5SRtu8nIdS/DMq5YWkNy/oK+WCNuEfVjCg2xmV8j/DAwFsbK2Ui9ohLi9GKeEZlbISK7a4pK+US9oR"; +moduleBuffer += "Lr+GUqIzKuU/IK4EhTm1Yi5tx7hchmLiMyrmcmwYRN+sFXNNO8HlWhSTnFExv9kBMsij/cXcADiRFc7/jmIaZ1TMb2PDKh7vL+Z3"; +moduleBuffer += "201c/g8U0zyjYv5TZ8A43tWKeXmbz34PxaRnVMz/iQ0TLmj1Ym5st3D5v1FM64yK+X2KT57pL2ZDu43LH6CY9hkVczM2bDnd+orZ"; +moduleBuffer += "2B7A5dUoZuCMirmlA1Jks9tXzGa3PYjr7YxuOHhGBd3h4swAfVsvaavbznB9PUvKzqikN7gdxNK4q7+ku9z2EK5vZUlDZ1TS3W5n"; +moduleBuffer += "kWS8t7+ke932Alz/hCUtOKOS/tTtLJaMO/tL2um2F+L6Lpa08IxKus/tLJGMe/pL2uO2h3G9nyUNn1FJ73U7QowVD/SX9IDbXoTr"; +moduleBuffer += "B1nSojMq6UNu5yzJuL+/pP1uezGuf8mSFp9RSX/lduCecKi/pENuewmuD7GkJWdU0sNuZxm2ov6SjrjtEVw/xZJGzqikT7ud5diN"; +moduleBuffer += "+kt61G2fhevnWNJZZ1TS593O2diQ+kt63G0vxfVLLGnpGZX0hNs5B3tSf0lPuu1luD7FkpadUUl/73bOxbbUX9LTbns5rt9kScvP"; +moduleBuffer += "qKRvuR0Er3mmv6Rn3PbZuH6fJZ19RiX9wO10sDn1l/Ss2z4H1x+zpHPOqKSfuJ0u9ievooAY23KzZ8iY2/GjOLe/MIUrxKYk1B7M"; +moduleBuffer += "ArqrnXPl0lntnCOXfLVztlzOXe0sl8s5iHTq5WevZmzX5auds+SybLUDid/S1c4SuZy12lkMpclqZ5Fclij22eLVzkK5LFrtCMmc"; +moduleBuffer += "D692huSycLUDQLQFq51BuQytdoTUzrPVjnAS+SAgazw4G6J17dUORA+t1TCSzlODA7LagbCjsdqB/CEBylKJIiIULkRC4WqHQtrV"; +moduleBuffer += "DuhaEp5K5G/x0jmdeC77gdFYA/OodY5JG6mlnW3S8lracpM2VktbZtLGa2lLTdqqWtpZJm1NLW3EpF1ZS1ti0q6vpS02aS+tpS0y"; +moduleBuffer += "aS+rpQ2btFfU0haatJtqaQtM2qtqaUMmbdqtJWYmcUs9cdAkbqsnDpjE7fXEtkncUU9smcTd9cTUJO6tJzZN4r56YsMkztQTE5N4"; +moduleBuffer += "uJ4Ym8Sj9cTIJD5WTwxN4rF6YmASj9cTfZN4op7omcST9UTX9qdXJYKo2kbYDEfWbCDEPnm5PLjQOftixzMeLSucc9WZniBLxMTu"; +moduleBuffer += "vqCmjbmowhowCptLKLg2AG+B8OeKAEZ1D0rtGOQipzjLoA3A0S1/gUbpOA9OCbDidQyb5hoocRawkhji2iAKSD/puuEmlSkFGp95"; +moduleBuffer += "rOurTtmhmMVAE8A0YZdfRbbI3gA0pE36Qli9AH+rq9oEi0nUZJVghFAYgE/0N2gIIn9DN+4x9Iwwuv6G7HhjKYFJY2U3x1T4jWI3"; +moduleBuffer += "sR8lH0Yg7KnFQ6ZGXDu/9KBTnFPseOJB1Z681thyZSq03zQvi8igj4h0DTl2w/X8IIzipME9yzF6FLc4/P6DwnNTEFjsk9/Z5zxM"; +moduleBuffer += "Vrf4NB4MZfsTTFO3+DJuM9wSI/nb5S3lPc/hNsQtFZObP4BCcUud5x/hNsEt9Y5vxu0Ibung+G7cnoVbV5sWUMQg5zweLCy+zrcp"; +moduleBuffer += "GCwOye/sH4nARBuU7YGGZjmqYZoB1+FbOSLwwcFErpnsRjDN8opjXo+G1X72MG5nPAL/8RnMrZGKfdfP9nrUISDGqGb2AbSEZJgo"; +moduleBuffer += "JkiJKSBmRqkAJjKeyWjqopsd4mQwtSGdZV5vaO3ThC0Pi0EtZAcQeoGrZPMP2fyRre6Nrsnq4cPivGkK8tT570J9eoxB4pvyXfqR"; +moduleBuffer += "rj718DQwcbVDLVSK8lVcGxVb3nbAyf46pAw7h6DdNfF4CItuf+4rf+ICL2Oqzoi3rpbGwkhlP4K2QpUO0ox3xOxMSgXtrZx2EIki"; +moduleBuffer += "NzYAOBwee9MBR9jeMrQ9jMETNe8LyKsRjsQkIsQW3t7qdh1cL10/lTvrWagJ7vi5ar17BvtNRW+JoqxamyUVSznqW2XDx6sDl599"; +moduleBuffer += "M6YWhqhmAW0AJUmFc6F19vM0wmbE7IjJzRRV6PhXL+sAU9SloYJ7RZsyuOQyvbZyQvSF13VcEwSgcluo4iCzznLCH+8PC0CR2G73"; +moduleBuffer += "xp7CVumSx9gZEwp5TDRARZZ2Jxj23YXqG+6QGtndpcaG5iTqIdClDiv7q4DWjBCMMdCHdTUc62XvoffG9d0AXyK/biiSK9pMe2lX"; +moduleBuffer += "oQ/oQHa7WuPjIxycctk2RWEzzhaysR25Y8Yp/p0kfNnpFftx8+RrZ1Q6/Cv2pY+9rfalh3FzYrv50o/WvtRGwpNRf1eDuzKlvwjR"; +moduleBuffer += "QcFvN1iW/W2sNgErnOQy/NvAQXZ18Wu5fzOE+OvWqb5B1vyG4rG/naE7JOHOinNlWmY/TtQrBWv2sRkKU40Y9EGnJgTVJSDULKSk"; +moduleBuffer += "sfrSGGoA4WysPe2nEYHbWl/a0LBAX4S/PwMBlxE4Sl8fr/T3D3ITqYP+32/yNWMJKeUb68EytHmrbtFGjax64JSROazPZGRCe9DE"; +moduleBuffer += "wdgaGrPZ4dkeQKHxADL6/efve978K/Y9b/lX8D1//fN8T/a62Z9y96/Op2z/1fmUe/4VfMonrLtjOFmLNpT9GESUgV7I3tLk9jkT"; +moduleBuffer += "ZF8BvhkwLVUB9TE6yAXZa5AsVA+InuyNVP5Py08El62OvNAcefu3moMg5xGzsetaF+vSf8KpghbSMcHeW/8JvWcDNdbYsbB36m/5"; +moduleBuffer += "yfzf8tX5v+XWU39LdaiF5lB7/E9/Wd/yLVdjt5UBJ3NjocV4CELbORfKBafn63nse8UbXCg3GW8JqGHZrXKaXZgTuxVuCIxH6BVP"; +moduleBuffer += "7jpIY24Ps2GUWuULqQv14IV6I4hVRkdfu0OJw5fJz1sRz2PCe6kWdr1mvQbHNez4vLXyTM5nkiLyc5VmGy9118OaQMD9YrlyO6Qw"; +moduleBuffer += "s0fQItUxHoRvJpeU+h/k5POoYxWGDrYlk1OICnBLNwKWDywbdnWNGbw8u1oSlLjVwIukcYMCa0a4WQrdiH8j5WV/RscA8l8hvQXd"; +moduleBuffer += "7APqK5B2vdkgqIUhDYIqPqHipZsaNHKX8RG410RKHTfWZaC8i+BaEtSOtdmCVRnjvNejllFJKfNF+MZPcs6NkG6XH8OXqe3jcgZ5"; +moduleBuffer += "ICqChyWMIdRYYDQ/MDHogZa//e+FsnlHgknpqRa+ZP1hFxCsze+csF9Bqt7X5iXG/m9MfZI3UKOf3d8onFQN3OTjYXwNNTNIrrXG"; +moduleBuffer += "XciFBQWtOdVby1NClA5TJoo9o+R+yEzp3DpWb2LQIJkLwjvJAC4twPiS1JW+2NDlJM2Dq5bBNrBIrl0G/fiVkg+0bbBJCd7lgHGh"; +moduleBuffer += "gcdw4YZs6ggXPknC4V72Tm6yCdgRV/dmLtUWRnDbHx0yPeVrVJAyNpmG0dZ4bPsMwQqbHWvgXxz/M+HfTmqo49ybKeI/6PrrZSJ2"; +moduleBuffer += "wkJGl5r4hgJHT7tTRXyzhkxWAzDtra5n3g8MMryf/QmGGL7yRyJ2n31Oq4rQgElC9rK+G0nfRZPrZgrnN6VovKAh2GFuJFwC5lea"; +moduleBuffer += "vsfGGPNq9k/YBX9D1x0dv8YRbvY3lLEnpZy9xWPnHbv7oJP9uU+hwN3CfSddH8Z4yoInZXBEG4Aa1sZ+ts2n4VOUwYZlL0P/RNlx"; +moduleBuffer += "V1l+uFfIA6wXRIkGvf0yFVRIN+/26mHvKtlVoI7uxqkG5oE/DswI1wygFSi+1fGscTtC+tTA0BUIDiYJ2R2NTlD63mP5r1frbxQi"; +moduleBuffer += "g6cntAmTXiA2JlhamPnimZd92WM8Ri0BAexoVO0XO4/MMAwNPcKF/yrOgmUPOK9VPTJmOX3tAlj5YGZSTpELz0WIgBGu3ew9CVwl"; +moduleBuffer += "cBAE2TuTtDq09WTXM/tz8HvrE3556gsFngW41A4is2A5pxpygXIpSB99yuxcExvIJMlOBlnBBRAp/qbapsxbiE/2nKI0gv4QPD4p"; +moduleBuffer += "vA71Fv6MhlUs314ib7PkqgTPfBA/jLur12GpYP/TraEXb6J1XC3yoSJhl6yi9PAF2aJOA4ZfYd54oavzNigMbGqosKlqKmVFhThI"; +moduleBuffer += "ZFdbw+W4Cl5Vh53K5Fu2xDUMG6OulTRo/iAFHTmMz2BFROHxmHcpp0HuaZDwcT3gTd4RxUNarvu6mbo0JQzVxgnny1LOMun1fVlD"; +moduleBuffer += "v8HlNwTG5RKN1xBMFMaq+X/SjfT4AtiqtO32BgwwVaKpghI11HfUqSawywGMNAz7wUenRIEf7xXBOkwrs/crhpv0SK0v/PEJBjZV"; +moduleBuffer += "S1zpW+uXZQ4wbRaODYS1i7XGWLdNzwQN0c20vhB1r8ayRSmF2zH+Bm7fIvN0kUEWJovM1UXm/lIWmdu/yIwUyqstsn+YHYWTAIHY"; +moduleBuffer += "AB5h44c75jgJLKnvWTB+gxQiU74FGyOEkHCv5uRzi2ffI5vquwIS4FLYpG5CVgSO3jCxPGGTsOegkVd45gBe4bRgL1Zf6ZEuUkMd"; +moduleBuffer += "2pXmpnN5BEVUsjgiXp0LeIPZew3hsslI03U/8BST2Cs4FF5x5ImD3JFpqgjS8h1KgcqvUSX3OH9sHKUW6DyanVufhfWyXgeupv1p"; +moduleBuffer += "YMI7bRASZfOTB7kssTsXh79mbqgg8Gv0jhI06Ohc0ROtLN2278nZ7VuizXNocNnXygv6W1mSKl9wS40DcbXRHwhxRmEcUGmHQowu"; +moduleBuffer += "HmhIOe8y6EpDdZTkUgWl+TpPiRnnCgQtkBmyrgPjQPcyNHZqXZs3QpkEROlO9FzRX3ihTcnpCmd5EUy1sWpUKFZsue+QU3ARmqa0"; +moduleBuffer += "lZIbLt7yjllPOkRu5n6AZZYed71EyezcSIrpAASvmo7GjpfF996kG8CxL6CzTcigR8CYBAkZF61iO9ybdmEOR8b0l14zd3k9+LnR"; +moduleBuffer += "eyamZW3XB9s0c59wSmPF8fusU1RCYZ2STnSjCLouHIuAMgZcTaXrGHl8RGnWpPQD94yjuvUT90p4RcnZnKAHNam2o55KxE9Ygaoe"; +moduleBuffer += "6mhvdhy7AoF8vOxIoudMUPUJTuAPNxCwDF7Q5P24Ql/swZ763D/YsxHRst9+wEHKqwkSrE6RnVA9tITkeaKhioWRviYG2uSsujdO"; +moduleBuffer += "vva+9G7Vr5CmwaYtyL4ZYGOUhSmbwzXWn8M/37thwkusw/zjTtUz9Kh/spbA0L1P22MPmy0lvbBZ/sf3yvgskF2RgUqxLZqd0OwV"; +moduleBuffer += "1gz0l92jx9/6b61HPwqtTU4Xn8nCvzn7SWRVrz7AedZwylPcMyY9UQRAXbIRzTvclBJ56ksyWKBUtlV/AwzvfQ1+ncf0Iea2qToD"; +moduleBuffer += "QPsSVsjJPuOrlkg9rEqFQon756sKSYOT26wuw8gRQyp9yC2ZXZ9nhkusa1djp3ETGpO9j7pebNNyeKbLeKZnH+ZpjKfCHG9iVWGN"; +moduleBuffer += "IJBuI6+bfSjSUgKFKvKYjxoohcwlzusV6otfPPOMsL3vxq4ETsmyrw8JRZBNR8Knk70jSwo9O2ypudW/35zzSrLJnJAxKBjUBqym"; +moduleBuffer += "zo/A+seGCqpANkxyQG4QKAcNeo1k8JgSYlL1fyNnbdz+5f7PIvVtUM9IfKNvBRZ0dygSowHjYSfjDdKkp05gjlJ4StqlB8BJa39L"; +moduleBuffer += "38TXIuTwZbmvsX2FWqgI8DmUwSDOfOqMrrOVt4wq8NiMET7ijUFV6xMsBNUY+YEGDzdvWbJETrxJNZj37sdg3nz/2rE75Ie8xyiO"; +moduleBuffer += "COU6SIKkalH6lJEGjJeeeIhu8pz9z7lNVVvT0yefc35HiScVJd31vYMEteDxDrnVR9STAkexUiFjPXX3wLYgpzqZYdXCtowIBTz6"; +moduleBuffer += "z16iZw+g7CsNPZnVKL24VwooPKFD5CAulGTRqHF++qnAHrglIQlT8uyvuFvkuvH4Bv57tODCyd4YknADdEUJ7JlMkA4e74OYscgs"; +moduleBuffer += "YyR7GWBzvBJSEHJsTDgLqc1TZGytj0DXWTYTw0M+6KgHO91kS2/kyPgcBnlKedEYhaVK1UE1zboUcURpCEjOeJRHupPIZVIhOALl"; +moduleBuffer += "fhIGxEryZo+entbxU7ZNMDMI8VAgckqbCziRNZCCZCR9Ycpm3Fb6ItdhGULT5lg9S4BFYXezWFkv0Nn0R43yZE7lBocEfqNdl3GC"; +moduleBuffer += "I6OLDscMkkgNfoNOg0bappF1A42sGxTH3z+jTKhG1tWDSF10SLlYAGCeMlkFZMOV5ijDoppbU5QMKooa5yCaou7yKn9clWs4Ktdg"; +moduleBuffer += "fteq9CG9poyWHhmX6PMrYaryJZR8qSZcpJcLIIST42ylt0ZPbGe0FGC3evS9yhJV9VI818qOYRUPEygcfYTDJ/tmRNoY/8Bs84Je"; +moduleBuffer += "9nXgQd7T4FE56gghuEcqLybIAxf34vfRJ6z43MQCHatgcF2DjmQCfjpymvJNnKYU47wT9+rV+5R7egOh3NoFxcYuyKlMb1DKni/I"; +moduleBuffer += "+m0WH8JFqeDi3i/Q9EbNfz6MB43S/OcAbmNj/mOtizAIj+NBu/jGF4yRUatXHDHl0DLo21+wdkO0DHrmC9ZuiJZBP+Lbhptxi9c+"; +moduleBuffer += "dhAB5PcnpTXERv1Ku5GYgIbKgvjYjBHLad8nZriZ+Ws9bGayj2Cg/WJAp5an/DIDPqhVAAWmhoFWS4FEWWl09l9ElkXci+MeJ0CN"; +moduleBuffer += "SvFqVIqvVEpQwMvLK6mUQKkUHweaoVJgJpb7lkoRMvA6nuCeoaJqlMpakim6UA2ZQqOHOoFilnHN71uLSuWUtFq68YrXqXA/jKM3"; +moduleBuffer += "EPFVfuQYHUY2QfynvKeQA34d0WvMIFNZBC/foMWoudb3D6qfd7aVclET96Drl4KmVjfUgESJ8Qp34WrFHWL6OVXMGFGfYUTv9Eu7"; +moduleBuffer += "HmFEi90fexCx6UY68zhUFUntA9erl/11yzDrk6Sa9gwXHZVrpfjxswflwCoWQoxhna1g/OOaFeN7juunhklTykvdvlQSlvTKR8oQ"; +moduleBuffer += "yJk25Bg5UWDUC5zPCJoubL5bHL79kOHspaYdm80NI6eQOI6svzz321BHybDHcVrMaBecI8VGafGE3g3JXZgW39a7s+QuSIstM7y7"; +moduleBuffer += "RO78tDikd+ey5cXX9O4zjmmdzlHlaIxAshQIGeXOg2brrTRyxpL0kl41HNRrYcwh1Oe8LqY94AJAVRXAgpI6q+Sqtm+Qo5jLV9JI"; +moduleBuffer += "xWMEz6fS7SjDBgT2NjOBd3yrkVOVMO8sbI3eMVQ3ZQJr0Db8uMSEtIO0CngLNPMCeavBKTWWpbQiK4xZLCKCF15qYLr1mVEUUYyr"; +moduleBuffer += "soIfhqWq2WPcQ6Nr9utws1bJd7dXaoAwm48fOqT/UAbBXdSqhSIlv4UeeuDwIezeuMFPGuUUe/EL/1B6iPekpaRTI43pQ7dnYPGq"; +moduleBuffer += "kSvMxmVaOmnxeFkdKuBtbqrmTXFMM8heF+qLw5jPIVy8z4a+EMb3BDEaQcBIQtJl9iVOleJJvdE3bYWylsI8giJNP0NjqlzWdrCt"; +moduleBuffer += "7QhKWWMp5h6pdqNMNa5wE87VaVhdhc1pfpEmjOplOQnWzHgKL+/RQXNcsVXmORi1afWD0VU5mlvsfOCAEhcqR3OLHyqRYQ5OJRtU"; +moduleBuffer += "lubyxKeIVg/nR4zhrClq/y9WVAQS6ZCUoRa6DC7xOdy2jdGtX3wVtyPmaPWLH+F2mTla/eKtHzwAz1p7tJpWPfrBX6RVKXVno7Sr"; +moduleBuffer += "NJwBg0xozGZu9wybQn2qC/LFoySAvvqTRiELLfjOhg2/MphaGsmbRSD9f4ZLnfZL4GJXwShlWY+rBcM4xBrHXbZQkuTg2uGpoqLK"; +moduleBuffer += "c8zRkMjmFvg35hkIijD7PUmccRUj0uQ5qoWordy46lWlYGadhkFt+vGK/ErV2Hy2rFQI9xRTvg3vGLBhqVItqdHJ00T3iAs3azhd"; +moduleBuffer += "y0+8scJpC4mZQnLqq+RUdq4pnPhXrGsbtsNR8ehlaqc+XNwG2Whf1SoMx7NbVW7q9ElH05p09GN9PKlUNKSC72MPzRijCTnGcqhB"; +moduleBuffer += "B/MKVcUITCqTDntvTT7svTUJ8Us4UVL/Jdtp2NFnDAXnKc1W4z95uqi1x2CvOCH5uNSLZ+VXdihy0vv64D7tkXQZhccBia3gch5G"; +moduleBuffer += "GGIVFjSzR2NdQtSuuox0km31oGzIOqGqNiKNyxjKFnu5OpKnFSuv6ogKeDwEjWRD9Dhw/AmM/KLUN/y5mc45VHcjpb11Vv5K6obX"; +moduleBuffer += "MICmNGGSmvWwyLXngzqAaDALQDSYBSAalACiCu0A0ovLlYgp+LU+96fyaL0e+Vb0mL7TWFbvDe2kOG4s7WWdZH9jLdThun/MMYAK"; +moduleBuffer += "VOmscA4H2SPWOF5FQscJm+AqvirQmpEEORKNA4xaHKSjLCw5lswdlswxyLEeiCltgTHZXyTZD7CQ99Ja6D7TyOkFk5Y3kDy/oyuV"; +moduleBuffer += "i3mHpwsf14hPZgKLUHMARP4xBHah8QFvETsMazjWUlI1b/ezg3g409aHgd4eG2Tw4ewRkkyS6QBEljvo+7bDhJmZXoB27pKd4pZT"; +moduleBuffer += "m/aExrQnPEPTnuLPD5E4WGptfGCB8KnE2MJkn05+XoOedLfBibLSFLOlyvpbB/ZGxbJYl51YidwE4gWleMe6Lmnb8KquDZMDXJNE"; +moduleBuffer += "aFyPiCYORWv4/GQSQi/nJZIUSxZmJ0YHZaGyV4KG8cnc6PJKS7MayyHI/GxuKo94ZS2c7HtE2riga7DeKaUf7ZLCzbsk4ZdrGIOR"; +moduleBuffer += "LnU4w12CcWTdRKMcN1Tw0lxn/7ssbxQzskSaxdEY3gcYnnPkRzKVx7JqpvJwKg+msIK8KYLXXr5OZrU5ItOdJUQGjH/KFe+XK94v"; +moduleBuffer += "V7xydxBfyzJX1TFAP+WfFxvJKn9t3NgN/wMSZMp0QjpgGPMj5+cFFpZBtwzjdKNEjf6uUA4zQbZJuIVfxx7KuRsUm4TKXIud9Nen"; +moduleBuffer += "7r9DCLXNoLqnX3IbdkzQnTKoui/qGYwD84MxB2+HgUqRFabbP1ci1vR6LB5WthTyajmPicUNSfh7YgichMUNyAffafb5khyQLF8L"; +moduleBuffer += "qvNdb/QgD/Wcl1V/JDZ0A07bt3i6l2Tfjo18+tux2S9gBvk1VUHrDoRse6CHxpYFC6ETcXn4S6eF2mkzrqVNZt52kLvhJvLX4z1C"; +moduleBuffer += "+chOo5R5MtmFJ0EnkQ5VfdCmyxkN+hhtNH02noCGUgBCSYTo5C1r3duuV/H7MSI2gag6jr021laCt5UOCtlBiv52zNh2ztBH5j0q"; +moduleBuffer += "wcBBAl1AsWl9MX3Lug7Qj3wZ3f/SwaxzArq/FXf/zUFGdddD8o9xd6ErqwkRre4xz6QETdhuEmRqThXJH0zpdrLdvuQUbzMZupzM"; +moduleBuffer += "vr7IrCkFJ1Gvw52zRxWwzIl0f0VTxaekqWKlqWKlqWKlqeJ+mgrZlJCKf7mEVFwjpD5X0SElyhWm03Av+0yoAD+hsqXSoloYXmtp"; +moduleBuffer += "IUP7ncjYVdhQjjC2yJ4y+hTfRp61JIUW6mqRgTWoxnE2E+pC7It+WJp8BCtr8VLqz8PKMcmS5+mxeT4LS++R2d8U2G/KqvMDNFyL"; +moduleBuffer += "e0dL2QQZjmLJ5TCDyN7WpOGe2p+wacb4JTsapnWDno6JEelWX+if6gv9Spx0ui8M6l94NHQ7FQVcHYDS2HM7BsiGwCFndwj8sbRD"; +moduleBuffer += "4I5lHeJuwEZVLks6xM4Y6RD44qwOMWEWdgheMdwh8sSizrBi6xDoZUGH0A9DHeI2ZB2CLrQ7IwriQ7iDwQ6xXJodQhakHeINEDRq"; +moduleBuffer += "hRN1iBkQd+jwn3Tord/oEG4lBMrACifo5Lj4nU6JPwiBVLQBV6/bLbyb19EerhjYsE7ZvHPzvEg2rMs7jMHcLfypYgTPcnl2TuFt"; +moduleBuffer += "kKMwkpfOLpryeHmxAM9gjbqsCDbIYRnIs6VFS541ZfsqhvEYgtazUGnC+kZQmWQdnCoW4/FwjjAIi1nrEtaalLUiVM4wao1Z60LW"; +moduleBuffer += "ukBrhRB4CLVGrDVjrXFZKxygBlFryFoHWGtU1orNFnifqLXNWsOyVjgTfDTATulOKZHq0bYFJkXYdMaMPiSnNuyCLpPUX7GrGuAp"; +moduleBuffer += "xd5SLC4DaA/TOt4s15vlvBnRmxHeGPyuYd5kepPxppUbb0LXwPWD/OJNkFtme6omQd1VBv05UWKYrlI70re4tJCWjWUVCQ0lFzTs"; +moduleBuffer += "XtdVDQ0pBhP0JSjjL67phmomAJavYjnUCgWPjHN2MXSx7M9UxbYMgZkjIB7FP8Z23BoD7DDMZzZZ491A3QrV+STlcz45wCed32fK"; +moduleBuffer += "jZOqb99QvF+2496FjnOxM1DoNl14dA1oXtcmtFi7l9PSb3yd2obRlIii876XKRqR/53yFafw12evYjeouYJftVAF6F4/Tpd0vzFF"; +moduleBuffer += "9douDCyM7azcWj2hqvkVFdy6fH5Ujf0wt4DzJ28aM/hEI2cJ6XO5mm9TgwtqrDJomxXZSp3I9cBoFVufmlET7w//8zQeTb/Pf16a"; +moduleBuffer += "fuTHpun/I/b7nr0H/gUa/+3np/GbP/s/cON3ftE0fgYkJIzW5+qKTvW/UscQCC92SgiFZtpqDwxmQwuGh4cXytYymBa+/AXyF8pf"; +moduleBuffer += "JH8N+WvKX0v+xuXv38vfAvlbKH/D8rdI/hbL3xL5G5G/pfJ3Dhlc2IVk3wFvkd5c5GQsf/JcLKTxzevWpW/1LW8BBFdaYsJ6i5Zl"; +moduleBuffer += "/dTiDz01xrVEYzc2ZGPRECr4c7GFF84rfziDWh4QTbkkI8Pzves7iUeDzGsMbQp7hAkyKi3YHiDaTvbpgKqpPuq1jEmu4pc7fGN0"; +moduleBuffer += "AfFZSQ5GgAqtkYPRbHLQ0IGGAJRybvcRq95iq9vSZIuPlOwLVNhFqYDVu1YpaV7aDtkYqswQ2gyGyC1NhkPGQTI2w8lEjQoOFe82"; +moduleBuffer += "/ZsGDPXtsIA9iTksvnZDOKpCUSHAQh2dL8XaobbtkA8WWd7ctQypmRmfUCG3fbXwsMPkG5M5I0AMdZhiDFPTo4nHNdbJMs6bGKZY"; +moduleBuffer += "Q4fYYYorN8xS9WQAEnT9OmpeP1LJBnzV5JSyAQ1upJGsXlDFVuhbOSHJygvdTIj/Px2cBFM5VfwvVwWbirtcyCeOlmlyKBfjKTEY"; +moduleBuffer += "WwqbgjgwSS/7tAaAtHEk9Ykv5HH/E696srD/iV89Ge5/ElRPFvU/Casni8snvmUvvOKLTnZPDGWOo3vVrFkT4UEGGXI4TxZyV8Gp"; +moduleBuffer += "HvineuCd6oF7igc20IKGBnk+RjLSkXzu4+61NPHiqvYKRAABAZaUXdXQwTIPhWIHZTZ7wPRpNGco/erJwtkDVj4Znj1g5ZNZQxlV"; +moduleBuffer += "T04zlMmphjKeZaKnYzsrZ8MoqP/FhxoDnfdqG1pcyxjWN7S4vqE1J2o+0LHZ0O4rxZPTpQyLWKLZUwxddj05exgKW9GCjyB4a/T0"; +moduleBuffer += "8cutxu8TPihALimE7IRfttOf90tbBrXXtjOc6DvitZ0zp2znh4Ofs511Pzsq9O+glLKGCHXCNwKI5+ML3hd77dMcHfYElXa8iW1Q"; +moduleBuffer += "mQqPvcQeHY08NCeGegHWjopQj4pkpQbXqI6KzB4VgT0qslMdFUHtRG8q0Zcg2llLzUNcH3tEi8i/6r7C2GWJ+ST9AnxSOIdIefNs"; +moduleBuffer += "IqVhyIuiWRIpYT+RUoY1a9SJlMB+UlAjUgL9JHZfUH5SMJtISe0nrbpRYbWDToOf1NZPoj1Mik8K58yzRrbPzLPMzjN7oGvl882z"; +moduleBuffer += "qFY5iR/spYN5w1JIETINaDGSrLaOt/v1dGnWAKNVMXpLndbpT4Hl6MBK+hRYWifsn7BhZd05a8KGOeODhaWiUrH9U9N/EF0nKCu1"; +moduleBuffer += "ZYV5u1g1KX3YKFb1Og2pLKVrC+pPy/qTPmLMPEf9iY5TWX+i9SeG1gpM/U27uxtrAZltZf0txM5Tp1ayHKnRa8lb/bRefKoF27c1"; +moduleBuffer += "ZvUFa7fG93mer+IT68pB8cVKRy2AVGfj6YVEX2h13J1IoaBAOK99zvltRFd9SR5dv0xtphfCGEouxZ6PC79yX8CNfSGdB3JPCMBd"; +moduleBuffer += "0gCIK+S1/+0OKSHespllIyiMpMVbGDtAWAz5f39VBN+9xIGMG3m7bjF8FQ00hvsYLeLI++o0RUaLYihltIKK0QoqIbDxHxlkM4sj"; +moduleBuffer += "qJEuUCxkebH7YcN17Zkdg8UYWF0brLEezH72bXp2DquDJ7TsNcIeegAIrotH32nc/4ze07B9yh14ZgSDuQ5+Rq5rJ7oVBFtHgBZB"; +moduleBuffer += "jgxO4HtnWzwYG4QTH5hlEv9WaxJvrEPVKgGmjSPeJng5Wmt7+vEbu6Ir2sQmVf/8VlX6lgdmlX63Kd23Zg6tnlrimEJLx7z/XPLj"; +moduleBuffer += "2lwrc1HBhUUzkPqM4rV16tE0XLMK1IsnHzagCf+pLoWrSXXmMOgGl6F1CsZ8Nl8umxqK3x6U6jKvtCPMPlYCqznWW9np1oI86qep"; +moduleBuffer += "16J6OeamR0dgYktFRKQBFiL2AQwWYhNQi4ow9Uw9Rk2jNTNwi30Kppc9FXPVFgGEv1BQKowBFtEK57GgdOpZ6T2ARfvod2A4tdfT"; +moduleBuffer += "8Ej7PdqN7EBchH0eVbFyu9frZa/xS75bi12q3hFBuQu6mM1bUPtOlrlZfsJweRuSlqz0dpvrDlxnTiDLvXHOAAN7YlZ7byzVbtXf"; +moduleBuffer += "e/B7J0uL0IbNMdpAEhJPo15pjUvr8p1RN55wDkKnHE/wyzSYMZcpswV4EKiNPzeovTFDfcCsHVvIZcb6mZuD/ULij2JZButo8FXs"; +moduleBuffer += "OTKj7mBGr6PKp9TIf4nMCOPIcmbsdX+5M2M6qGbGuE6MGU8nxrjOi90GkOLJ+rzY5vbPi31ebV7sRP8/+hgGaIer82KPq/PCl0HZ"; +moduleBuffer += "7dp5scPtZdP1eYFi558Xj2HodrLMR32dF8d8nQ8nzfUEDXG+gCxP+zovnvVZ7dOo9nH9/Sx+P8PSfLThUR9tKOeFP3te+JgX39P5"; +moduleBuffer += "wC/7qfNiOjjNvDBf+DPPC4bUTj/ilr7ZfhXUKzhlUC8MjQ3nFSCcV2DCeQUM5zU3cJeX2hdrkb4Y6LEK5UUTgP44XvOG8HIYvSvN"; +moduleBuffer += "jXPdn8rxcgvs+HP//rXPubchuL1QCWNdOvuO3X5bHvz/7L0NgB1VmSZc51TVvXX73u6ukAANiVr3ErDRZGhdhs4muFAZ+ckgAzp+"; +moduleBuffer += "fs63zq7ffu4MczvjmMAyzhhJAwHCihoFNOAPQUGCEokDo+iq0yRRo0QnKGh0UDMKY1RcM4oaFeF7n+c9p6pu/0AIEZlZgvatOlV1"; +moduleBuffer += "6tT5ec/7+7yXIHqJvEOmpdklWazlmZYPaflQUT6k5amWp0V5quWJlidFuaZtAXcC3wj5kffGwDBsbg4VIAWmIeVNT0Rma6FCNbhO"; +moduleBuffer += "15U99a7TjJAiW7y7yPW6oOt8ZbJ6OhFres/E9SdyN3b69FH61URnCqfRUK1wku5rVJ6pF3dDX9DIeNmkP0qKOxo99UWQCBLVXmIi"; +moduleBuffer += "hmCV4NmGB9NH6dIXq3h0fCFLNFSW6HMS+ZTrSeU6eWerayJxTuBTHqiXDzTVMQOdCM+hQgqmDAynsKtLERgiwFR+NMGFigt5varl"; +moduleBuffer += "rjkr2e90xH712CP2qwMdsV89PUfsyoMyYu8wZdyEjoAfsQgj5uT7Ez3366Jr4/SHDv0kntKuq8KK4rs1jdKH31xpV4UjLnJuHnC7"; +moduleBuffer += "HpyxXe+xB6Ndv9MZ/uvHnuG/PtAZ/uun5wx/++90hj8w40y69qDM8Lt+hzNJMYv5v9ZjTame+w5oblVreFpOsvUHZZJteRoM5n6N"; +moduleBuffer += "5JMcxqfnGL7joIzhPU+DMXxia/KgLMun7ai+83dK/n80I/m//KCQ/98pI/Gbx2YkfnOgjMRvnp6MxMGhD9c5/+KeLA4Ojk9e8gtA"; +moduleBuffer += "zRHTdWGQIH9lm2FGDRfBHDCm1wFqxdLThGKFz/UvIqJe6O3IE2MyAre6xOlOT2mKZAIA6IUCoRNpOk8oTulW/1YfhmiKvDIB3eYR"; +moduleBuffer += "n5E/So/BwRUdkf5XSv2jMLD0LZvr0DbGmOYmXYZuOr8dnNJPt2Ngnwb5hQpHI2f5hg9scwh50LpuVjd01i+3Ii/AWPp6bx5prntC"; +moduleBuffer += "Dfpa8Ntv0dWTW4SOt7m2KvCtsjO1CtG48N2Ui9IkREWkZ2nEHZplXbPsjM0KymYF1WZtCCe5rv/2Q4w1ekC6doxgBLGCEUTwK6Ol"; +moduleBuffer += "pkx9Q7OAye+/Vs0CRs0CJn+gQCfxkD7GWQZUeYfYYIYuPihPFtG/xmOiuGrXvGtStZeYx6+WYcNXyJP5US5sOMxvxekhROTQuKYS"; +moduleBuffer += "02RyvG5vRHCJNFpGBAdFRLBzvf9UYdzfXCT12fzVLQHVhzLy6xjwS12ijBqi/DeMf1+TeUcaJ+SCd3hrJ0w3aOgYn8giFz5zFOor"; +moduleBuffer += "MHGFqLyBREJvwi8mC+5e69Gcfa3pjwlK7G7uBO4ZNBfPfLpo/u6ab/66b28JqBXv2Go44EzNRxyUcS8M049r8zVcqtL8Dbba/Dcb"; +moduleBuffer += "NknvYpjjlPa7atO9vv1sUeCeQXvxzCUKqpspCK4CZ0dqREoIN2mJzQlTV/oRzI8mDk+BuctHIWLKpV8sgg57bEIeVMsX5z7IQ73C"; +moduleBuffer += "m1rCwEMfGat9CLulswIMMbMO86KEkywA80CqU7UBtNSQljCCzpuNTfqJurcBYm4iR4Bt5pffKrP2WYqIqi1wWujiJtPsvdB0htDf"; +moduleBuffer += "Ykt3H+SWvtNYc4FZ7S0oWejiTq2PO41c3Gl0k2+uXEPcaXhKJXx0mrhThuJ+UVg4jcWZGmVasdxOE2X6zh73YnuyBmtGiqoTEfEv"; +moduleBuffer += "cpu7nDXt6vxCbRwh184kFDrpDFIrAUgHgHcast2O8sABn684xWGmZ1H6ZYduTZtkAAy6wiwal0bL5jVWWUdvBc3sEoMoE7PEJHQy"; +moduleBuffer += "S8/v1JEkkgTz/E6CpJDoXpL/TBMvIHShQZeQTk2OT9ModMc+NvI5YwMhnIyBmBYB7tTCcQ0cYmtqGfG3J5UFODE4MacCP4ZdVRY1"; +moduleBuffer += "dewMWi4joJh4s9W9baCLJJUKi4c8lYFPphceZ5IlJmJIHlwi+3DNNitd8zZjI0fniniS9Q9vARp6Ee4YK64RcV0R7giYkHZd40cR"; +moduleBuffer += "O6rhjiNw/gzTP2RCMjxdA5ByT6wjUnB9uDf0UyMbSzgHWIgOtYcW+dkHpEUDuQPOBuuvbtOLdJdOSyB4qfqaWM1JHqIZnmo31hy4"; +moduleBuffer += "uTCW6TXGg09l8XHBixCSujA4sXSBh8/uosJvQWofsDY08B5pwrR3UjdfiIbWsxDdX0cSe+SOo09TnWsVGzYvz9LLqZRf+XsYs7ps"; +moduleBuffer += "16Fj1RcVHmKFBxEsU7cb4NSl7cOtcyPyokx2uMIzHY6FnafpRudOZL0v0rgpAnwZdCpXAyRvEQL1Ei/iTHILlUune4+tJO9niqml"; +moduleBuffer += "wWgQe/cXRtHm/chQw3udwxpgAvNvBHD2tIhc68NPX3uQPdxusv/bKX7q7RZ+au1Z+Inb/fiJ2ofgJxQRSX5seza8icjOk5lPbyBv"; +moduleBuffer += "L43Wl85R51HcMztrFFcbenW2OpDi6iFZf3G1X68eok6kuDoraxVXW3p1Fq7WeTXNmsXVpl5NcTXh1cGsr7jap1cHcVVkvPzBgXzn"; +moduleBuffer += "oHTfC86YCyy+RtafAQykL30jb1Q+AB5gmNoFUAaB2XdpEJYbWXtseHZnCLbAMBvKDr8p/YBh0lJ4OkUrZSLAJ1ndNyIGimahzjew"; +moduleBuffer += "BMfKIB+uwV0W2d7VgSbErEnUfTBCVkh6sxHU3PsXJhpN11AQV9bX0CgO/z6WJdOU1VHWQH1fDBw2RggihPrm4IXxdDc09IbZuCGa"; +moduleBuffer += "7oZ+veEQ3BBOd4MCS2WzcIOd7oam3pD6oNMpN/TpDYPcUkNn8rYqV6ghGM7S3BnyPoi5h3QdxGIIMlDLZzsyoM+61Av6LsJODk0e"; +moduleBuffer += "gKjs36bz5SOlKRz1Yx+ld/ioQ10CIrMWDbEI0Ewnd44YZUC0zB/eWMezvF7PjoDQU19KkMt6gWMSayJHUByZRjpx6phE1h/7cNon"; +moduleBuffer += "S5RmPXmiNIkkDRYkqd5LkgarJAkaGFmaAyVJ6leS1FKS1FSS1KckqaEkKVGSVFeSVFOSFAstIoGaowTqUCVQh8mCmzUdgVKeumgw"; +moduleBuffer += "7josO5TXpZgujrLFAyU6yYmly8cO9d0ht8/JZk9L0WqsbCaKVufVmShawqszUbQGr05P0VRTRYf/7NCDSst+bZmVuaBls2agZa3H"; +moduleBuffer += "Wa5IzjzphpyY1J6EAY0gcbmZ94vaeco2q5ey7RdFjad59nGJ3rQ0rUr0pqVpVaI3LU2rEL1/fzTNVGia2V+a1mQuNJ/2esDl7RBe"; +moduleBuffer += "8tgwpQsN3jgg87kKdzUghVW4q4EC/iovIzgGnAcZgeL/IXbuTQOq9Thg3vXqf+O864eflrzr25/hXZ/hXZ/hXf9t0PmDz7vuJ1F6"; +moduleBuffer += "SnnXtz/Duz7Duz7Duz7Duz7teNcPlYg9dkbTJwD1J5k+q6kH7rnjziBXG0a+TY7Te12ugF24UHMmTetNmntRCgDKVjff7W5n8oCf"; +moduleBuffer += "4UKZPOCij9+pKQqK5AE3wr6V0ezd7YT5I48+Gi4nKuSYIjSx6KTlChWZjTmkJiJFjjmkJuJFjjmkJqJGjjmkJmJH+hwwjDsfc0hN"; +moduleBuffer += "7Lkxh7WZP/KIvIK8+piLxcq/tdcVBYC4PCh9uvbmLUWf7tu4pezTK3BhSp/egFLXp1fdvKXs05tv3lLt04/itKdPr+ttLI2HCKFu"; +moduleBuffer += "zFWLIWNP04tqPhak5bOWBEzEO+pjXdSR5GiTzp/bMTSUmfS9fWoAw1x/zCrk8vs1c5Carhw5YAMvAvhVVMmqTJtqFi6bqzlqiW1i"; +moduleBuffer += "iUGaRel3kByqRlDzTp35eFZ1klWdBpZILWu8YhN9ZI5FrpUsecWmVauQfErT/xIRVaMD24pT6rLO1ZpvLtP+2gL50xbIn5OjSBlF"; +moduleBuffer += "7AB+bRXI004C8rSTgDxtBeAXNj58p+8s0G6XE/dNzsdmIqH1ht41E3UC47vsE7Jn14i9k2+vE7bQGdmQS/xP5bv2AQTT5/5l0l1N"; +moduleBuffer += "ThH7+zIz6aqDJcV8nKgr5Z1ImDBaEzktDFIXzgN4+6RixpSVdAKTJ9Gpx0E6IL9k3nKp1zoGC1fjSwMNAQsyzdLaykPNZqBYh75S"; +moduleBuffer += "CLJaY0Bbqk8uyWyUNGDKN2BzuSWsmrp0+tguQVBlqmPUNTVppEHjNUTSBrCaAUUI9rmautiEGrQbMsPs6f2aRMzFtTOcKtamMFeQ"; +moduleBuffer += "LcyOVWgCUvwCoCpSfKTo5BKmIN+zcavL5RwNa4bxdHXbZEWeX368zxRMI2jHKnRe6EDbATS6QAYcvF4lZlczB/NHWFANXHPZGpJu"; +moduleBuffer += "eqWwuG3jUmRHPsspUwlb6BrwUQt8mP8RXe5k+r5Ad0U7gmCzWRrNy1JZXqOB8w1odpnwQI4utGW+T0xUl0pXcykThb0nVUgVe9Iq"; +moduleBuffer += "zpHrAZf/Ixsrs8i4ONcwfb/Dj6gEGDpUvFYJbU9IjAjhVjVFzyN4cP5ZGOij9Kf1U4ivYPIvVAtqLNopRek/O2u45ZRZjEmh0yfg"; +moduleBuffer += "cVM5ldTZ9I8qcjjD1jzYzW/4rtTxbtOu69MgTXSm0wTOSC/3fowNk/0RygVLLHKKosi5y0UauIuJJbfnli81rqcqmUeMcxqI5XkP"; +moduleBuffer += "AwBQ0TtrANbSGRvp/HWZp2FvBwnvtwQCM8QF4yLULw1dkP6kiD96OOoX/K4H8vZ7JwALXw7kp6sFOpDb733yA/nQd/6dD+SNpkjY"; +moduleBuffer += "RIclcLVzyiRd4D2YUZ1JuoazIifX2q2IZx3Rgkx/Si+1Bfm7PyOMCMqHkGTLuTkca1vFVginT7fzGZ9YYrNUyuRbJ3XzDTi+Z9sW"; +moduleBuffer += "9VXbUDazcA2cU7oGIpbYJX7PNPeAcwi84xMTgboAspnepTDT6P0FFN+lhZ80zomm2kJbtrBIfbH7E86VTlq4E8drPum86W6cgSlU"; +moduleBuffer += "DOKg43JqkC+MlC8MhS+kZ+Rn7hJO+MgqzwcWce9dJdu9+64KH/0QLrR8SuGKj+K6HXciR9i1+AmVWRyX4/QXtuC2LnYo/CMFWuBw"; +moduleBuffer += "J9YUl3DljZ0fD7ftJvDjFwYjyKckPz5bJm+u5Lk0LtU24PXviSn91jJNjvlTcGuM1mX0beZCbt8Hli/Bpr3T+acgAWqbeVATYNdD"; +moduleBuffer += "v1PDzxDAd3EtwU8CLF1c68PPULupSOxAu22qeN8HSiESrhOLC7D20+WsTvSXrDYaIq1YjHzqIjZqaK+mGUu/BD5K87U9mfH8FLjw"; +moduleBuffer += "KeM5HcvP8fwaLkw3ng/hQl/+CH7ceN4P5r8ynm9k8LIPHAZq2CoGFndqS0+6PKstXXT5JUQiuWQVU1FI8UIUhyyuSTFlSyZvZFxy"; +moduleBuffer += "FuO5mM/FfI4PJp0YD8Z8MHYPJnAOw8TxCJIdqsHSTqQZ15w7IbBCVJayLjF2FmkapSIvV0uB/tOOPYvgKjH5PHBIyj6S2ZMG9nvv"; +moduleBuffer += "NHVTtCrATYXOaF4XFV7qxcbDJOigwT9gtsaS1oMPuz5RGtaqegti/YxPqOSj34m4bYqGsmiw24mEJwdNOg/j1rPmptfVME3IowN5"; +moduleBuffer += "N72fSsAh6A4XBkdQ5Goxw+OR6a6aT5cwPd1x0eoi3ipz7GUnVuFy8nDr0e2ogJvSr9Q8td6YxMTs0JXChhT0iGLO+U8mo3689klE"; +moduleBuffer += "3/vEb1Qg7HlQfp3Lhigv2kWganyg0Q80ZBN7PnAG0u+2pakfaPwHGt00sf/oF1a2aAVrkF36drBb1xoKd5M+qtypXUXORe6Vurp3"; +moduleBuffer += "Fv5xqXxdPoHsKLh1cTDI3SvL9920hQg3IF05dpAsX7txiwe9wdvvdAj+SjcuCQu3xLpCIeR18OjIXa4JbsI8OA0pGE6hhx1F04jA"; +moduleBuffer += "/ExjnP+eSCXNFo184J4KZbRsxN181QoIWBRhgF9NtOUsPENkeU2gEzMzYUTk/987tV+TFCDFAiqlVyRc/c7op4yAk3ZMWIv8w/fd"; +moduleBuffer += "8a8WzcvHL1qTUC5lPJZeOLfTGMsaK/Vaounj/JVkLEtWrsjHL7xozevdD8EGFcI8PpP5SqWRUD//XjsqGhm6RoLta0dKKZn1LURb"; +moduleBuffer += "4UkZV/Lt0fOzTl/RU3GBCe8XBtFKZu4hhl2G7LYO4r/5q9g2e3PaggTMV1kry0JNRsqfSq5JsAP2PJdkUhOdkrvr9Ak7oYujgKFj"; +moduleBuffer += "LnFDLG8ohnJ7fi4cXr7nczKJ3gob4Lxup6kuwhFJ6Kido/Mi0Y23fLCD25GrlKE6oDK1sTOoY2GGcRFQfhADtwvaFGa6TXBClKOo"; +moduleBuffer += "xAuNdUWmnmmJFTqkyAwZcyftDGBvTKizhGBKuo20h8wWgwYM3CQLiQxpgz6iDZcq11Vbg56CyWi7DmvdaQ/IrzPtXFLCyCpTDDah"; +moduleBuffer += "rtI8AHnW+PR/cB5VF+s6c+EK2ZfuYB5co6gtY3gH1m35omaBR8vNxqjfe6vT0q7DJOk0XGrdqAPsM/k4GA/4i09N9zSOdMkYYB03"; +moduleBuffer += "WaPLjIEOwVZBG6WPVBDHyDBlTdPzqwC3m6OZ3HlnX/rVmvz5cKOiZytcjCvbRuAzhJO8YlzXaf5Jocv0msbCwe0yH5qqezCa29dt"; +moduleBuffer += "95pYgmBQ933WIW+73Vsz1FDnu+GxWZeZuJb3XDYdF7r9spILveOyChe647IZuNA9l5EL/cllJRe667JeLvS9M7XQVpiraLpmVnWo"; +moduleBuffer += "0zHITFr70R13lklrCx3qjh2lXvqTO/R2qjbv3jFZEb3GCBHnm5j6JGEme6aOdQntARjXtpo6VTVU8bJO3cFtoaDWtkwNjUxKBpmU"; +moduleBuffer += "rMukdDZKwDTr3cxKitQkAdIoGcZW6cbYVM1bAXzmQY3yBz/s8gb2Y3thIsiT/VdaTbFr83W3bumFL/tFMDVR2yQEM4fBY/INt4JT"; +moduleBuffer += "1VzhUD7jFMS1J2v4W3wQmccIy9e7pHzIfRPm+wBQfnNIVJ539KWfTZDQnpn+hOrmIy4NGa4jDZlJ14VKgNNT1KLH+CV3iuxji4N1"; +moduleBuffer += "iA64jfsunkKtD2E8xxlQ8/aewER149e0UWH+XJoFOjHpxSwb9DutNefZhTZdpX46CERTpEhN2CB3uj4hDzfQ0cfIvQ1mwRip5Kw4"; +moduleBuffer += "0AwGz+UD7ahw6Yma4w2VtgoKHalNe2c1P2vLKk8IvjQiX1pkzibKr3y0507naKfU0i/6bK6rK3/5uSMeeUv4vMAi17s8849BN/0l"; +moduleBuffer += "wz8NNoHjGWOGrXVIK8SLpM7Jz9swpg72eNo0S9ZKrW3IZmvKys1j3WrKNw/rm+dX3nx/qBrmEcIuLgxeQJjP3nYvDF4IORSp/2rk"; +moduleBuffer += "BgvlwTbOlQWFHp2yoabBED5uSF88fxT7PENcnUI+1O3x5DE9b4WP0f4MOTYdPzrkD8jvKR810nUjSFl4xMPZY54cX+W5eyo2zrxq"; +moduleBuffer += "0cwSG00rkwX5j9OPMV4g+9GkMbaVvmIUH8eYdQ711Dn5eY6x5YebadrHMbaVMZ75VlO+eVjfPL/y5l2hBgVzjG0xxj3txhjjbYtA"; +moduleBuffer += "R2w5xszaK38rY2yLMTYYY764HOOoOsa2Z4xnbL/cN98LVUP+IO2q4aqUOii9UerY9h2VOqafLyp1WJcF3upsUV17ReFJMP+osB/F"; +moduleBuffer += "wjR625kaqOeQe/OSEwBh9dyB0Sfpty23n4rYo3FlysQ0VzGzjE4fWtX6aWA7g7JHeB7h95IxJieXM252YwgDRmTWKVl0ysp+S/Dt"; +moduleBuffer += "rkMmE9mCaoSXM0Wn3EswfMgwcVZ7JSQXJjluDkLP+AZVTkTUKyjsWbz0hVAj/B7VCIdfDvUC1RaJwp4lhD1bBYYYqoxJuGghX02T"; +moduleBuffer += "W6cud9ay+sWoZz6qfDarPAJVAjbtykkaQ2iBFnFukeofbdLjVR9xYkd1hTheRF1hpltl/ndGdYlW1+WOPVt1j9VUvJYTsqMhx5w8"; +moduleBuffer += "pM/D+kfTradXyNgQcE85s6srdsbSTXSby8mlHgHFULrVhtTi5ApbajCjfkD21H9w0LCVuWQdW+rUCPMmqxGGVMq+sGKC5ST5W21V"; +moduleBuffer += "FQ7WrOjELqUPrLf3uOwUxIaN8z6k9xlZmV5TV1TYEh6CMmbf8jG9OjXVQ+ZxzR246wfcMPX2yHtq+uVFWhB2D+ECTWCruguFNLiw"; +moduleBuffer += "d/YrUdZYT+0lT/CKfhpSIGFT9vMQ19GFk9eR66J3Rqa2upI7AvJTmFvIsFgCxwVELkBpzZXWsxpKa1y08AxDrUm+miJ5et7K9CLt"; +moduleBuffer += "ZmhL69WC6DTcglB7hhKmZPviiqdbqEHGe3t0F2rI4ASFFaUoQLarcGk86oXeORRpwfnNk98Tmc1QZop01f/0cY8hFoXL3sYaFmkN"; +moduleBuffer += "I3x0DhXnEeVfmRn/MyruZxaBYTu/zRwzUDgN95u8v82srMM2O0OTxRzfto47kzsW9QdyB1SDcmWE8axMtoWfBUDorlXtv0Lr6acZ"; +moduleBuffer += "+NSotrQaC3F3E70McfWX/DSEgOSnoTrluMxWZX5gELvF3rQZg+SWaYJDTRMcnVBm+WiuLeNj1QAWlqZY6dQ3Jcz8KUzOp0Vs0Nk/"; +moduleBuffer += "X3WY81RZOaRNnpMVyZiLHSAp5Xf9/OIopoq9tmwulBlqQ2reDwYYiSGZTVUDdHtklxwpXq3vDC/LxFRNAf8YKnwZh1Or+B6sLHSZ"; +moduleBuffer += "wJkk1uEGhPnq06ivQTSvdUG8sqXf/oAIU7PyXfKTPuC8XriYEdfrFRxR+pa655J724J3SH1NiExIgKxelhGhmqE0Bl1/nP6usb/B"; +moduleBuffer += "7KuxjCoFBBHXDkrXo+Ol68+odv04GuX0GyUrDr2KpuaQZQD7XKhoJ1DcMdNmlPdR4odErl4vJB15/6lzXX4mkhcIknLr2EAUGEM2"; +moduleBuffer += "sm1Klwla2Ju3O4NsmYQoKZTZqoc5WTpMRtI5HVY9DmrOfklKdYJ9ifxKL5ytP68vjUUulUGhUAqhB8GRhiqAxeko7nQHZgFonztW"; +moduleBuffer += "xVr7WnDtUGgtP60LjXn6COy5kVqUNJacQRXyI1O1JlNVekr3HKqb4EQBFZIK3VGzQ6G6Lk+Err8z2g5q3sQ81JNQJXQJVVJ13VG4"; +moduleBuffer += "/XQ3W5tBEYucAeFw+uWQbjLuHn8DE914egHx10VVyBOovK4tV40Yn8/Xf0+m/921QH2MkK22IDvpw7UiS9GWqEiM7NNKtBt6XlMl"; +moduleBuffer += "YeqdTZiHQmc5jNHHdRnjwUmLBUBkpIR+h+2+UsL0E1G9cjRNgVFpLKQeJSIXoznUA8qmWSVJcwisBGYUc3mIkk6z3EjJlaQnKLlW"; +moduleBuffer += "828Tqymmhj/9mlXvSKcXDLmdqh6f9mxKSqHu7QuEekiNfYQFSm9I3GOFVVv9fHcEpURAP18RC9y6tOp+dWJx7iSRlNQKGmNtgezA"; +moduleBuffer += "87rk1tyNCfgE8ErFeUtNMP7cGWciKGCNvpu8vNM0W3qhu1iURuEU2uCI5PNTZHyo+QSU9AIypyLFL9aOZjNAgzDrC0Z/TpeKxeLc"; +moduleBuffer += "QejreW5i78mjxtR/13No1zNz6KmYQ28qMzl7UHdlwQtQ95IND6pseFDxMyk5b/LwD9aK0DdGKjQWB1adB41HHrHqOuhdUpzy9aqe"; +moduleBuffer += "xlReXqqGn6A+uHSYoHpzF/S9s6fRXD+MCw3VED+oGuJCJXw3MDWsdzQk9BlcI2JVcRiX737YvlL3s9UUNckZHa/zdFHTRwgyWTHE"; +moduleBuffer += "bRNekJnoAt18gqXBUgv/VggEtNXXV3Vq5H+cR6vICS/ftIq2l2SsrSY2uDXG3ouo1mw6mCIqCb8cqp3MsgAt7ATwwgicN94Bd/R0"; +moduleBuffer += "ngxhrycDO/raD26ZvqMncMF19OYPbunp6JXK3+0sQiuRywVG1hsMsnaEY3QLjqTEZZcubbCxrqqYZYi9cKZQ6Az06NwsXJHVzl1c"; +moduleBuffer += "mFupaP9bfeVEkRuJmeFvoJDiXZDz8RCQKJrZHbxMrJg2yO/urLj0cgS7L31/c91ZviOfn14zvCMppfy3ea/LBvOGqvirzHtQpY4B"; +moduleBuffer += "cbig6HG9CE4VYJUcopIXI+0CG+vPs4BHSY9GIoFGopBp1xjnvzs/ry9XD3v41fMkc3Z5nszTkyGeDOnJHJ7M0ZOUJ6metHjS0pOE"; +moduleBuffer += "J4meRDyJ9CTgSdD8XM30+95v0Zdwc1wqA0Sc3nzVVpkOV24NaApY1O30C3X5QzncIyNR5+Wsn9fUAFHnxe1MD4GzKzH/97msIoDB"; +moduleBuffer += "cSWmS+if8atYc6iv2APnkzD9cF1FLNgYrq7D0YOVbrTdTh/PTpEB5QNyZ5g19JUR0XKySF+wS26GBbvBm/GarE8OhaVNN0H6WQsT"; +moduleBuffer += "uxT9oVTY5KVELrG+JN/z9q20ntj8Dt6GWvGJe+RsQPZsVIr7Nmi/4LWuD6QRdYLy8AbWHrL2AdlQ5E3pR+iQlQenpbclnQifV+eb"; +moduleBuffer += "5cCk75Az+XOuZtIO5UR6BE0yuC49mN6c4G3pm5HbCWvBSMU1qZ7q/LqjgzKGIEgtJYwdp+oH5lvd5+/AWqnxKcakMR1MUg58AVh0"; +moduleBuffer += "pI60rMkNMbwzqMJz9FbmARn6vZEGSK+tYXw4b6J8+8MkRj9DJ47TEhvlay+UudTUMnjOuw+SXq5hsPhZ0M+sv2QrUkbyvj01HQB0"; +moduleBuffer += "OepY/yZ/rXh6PZ3w+XQt65M+PoX7NbsVg7I5IVmyzltfBWhpkdq5UC+h8yKPmTTiIgEgbirdrnQuyXele4xSlubrTXWjVsnTUvLU"; +moduleBuffer += "0BKUTZI8LSRPO0ny9PYWSJ54uFf2NG0PGlbInueYGGrecCkc0gcvhg3QH8YXdCAvh0uztZ36BVyQBsfJBas6cnDpqk6kDmhCM1++"; +moduleBuffer += "CRPxApDWl2+Sa7xzzapV0ElcQHez85VOl6BWC2hwTO+rU6WF6tNL+mgblJ+QjGL6uTodmV4Fme4E+0r9OVsV9S/PmI/vJVRsCWeY"; +moduleBuffer += "ftmqOV2FRrdPXmp6MzpVVLaBqmyDJcarESO6uExR2UJyFpbInvwYTJGGKJRskWqcykiZ83rgMU0+0FXAVHOcabk8OvAWTpxrg3V+"; +moduleBuffer += "EYVyll7/562Ue+6tF4ivtsjjVygUYqcbpn7r9bpBjbgNiha/D8AgPEgLtE+kdYpLo9WTQ+uOAzBCF2m0LmAsmEJ6cr5lOt/mVbUx"; +moduleBuffer += "k/U0Xo/TiYoSOsUMlSFJ3A+hUBrr0MPHKa3H8uj8Dq9DszPcXFWYD8iFqJ9KrF4RFAPmqK9Lqii98+Rnx43b6F4cIwvQfOpT0u4m"; +moduleBuffer += "+ijvnLcG5oeY/jBatBtFIywa6eLr6L8TpdfWg+aFpeXfFGxBx57CCF6rLuz0y5tfOGCrIotnqeMbEDwyrFeGVL8mI9NsO99zOD8H"; +moduleBuffer += "Kng5B4lWN70lzhQ2FIjR0bSL7Z8qi+0KXWxX9BUzxG3aGXBL088a2Rl+ntCmp14DUJI8ucX4F0WmIeUO1ZUAbmxqtvDs4YjnDjWn"; +moduleBuffer += "It8P8hMrV4j+VK5QjhxXqAJR5LnCv5mUx81NtQ6dPjRBm07EUGM6K0n0/AyNnOSlky936YeosQzySy+9YgizCQCrThxzC/125726"; +moduleBuffer += "IfHhFUiHpazp8xV1OtTgAfhk5uOWzhTUgT5sNfhiH8j2eMgoMNvlZ+G+txn4Go5rss1823cngvz5cvEK28334uT273hwWBZ2XC2y"; +moduleBuffer += "gT+o0WJ8Zwc+F+kVGv0+bhSK2qQbiMOcX2G6vlBdQfRS5BJQCSddY7xs+kGYkiaMIp9+zRArlWW7Q2Yy1jJDBFXMxMHSXfd9CrsK"; +moduleBuffer += "Vseml0OpOt7gzgpIVrP0zre85f33XrF239BouEe4xaVfvv7O9+7Z9O2Hw9FwN87f+84fvnn31y7+p7esHg13oeDqj1317t/cu+6O"; +moduleBuffer += "XTKaO/nEXR995J+3b7/3m1KwHQX/uvtzt23/5E8uPHM0nOiHsNnfLdxYDPBZ4daMvbhfpj+EAjmsY8bsbnTT6yA1beAEmujrOokA"; +moduleBuffer += "QkQd4LByqUk8Av2siYKNlGsRWbkv1enyUscBrd84kKoHtUM3MFDvysj2qctjWqh+IkauiJjYR2a8bQoPRNmkmhUH6fwSNXxF6ij7"; +moduleBuffer += "3briOnd95mnnuc0pXh/jYrsMT5w+d8AGBtKbgzelGw1cOB0q7TAd+6kUhjK+01Ds9FkwDUBF7wvUmv2gBsrnEY+sO4LWZJNmw3bt"; +moduleBuffer += "TVQkbrfIoDBqEXuwOvsHzkW5tfTR4JXkC/vO6rcacNk6Ubic1fTDlbl8mszKxmkrlK7GiJZXb1ncGaTrGp0YeNuaFK1P4WFRR5H3"; +moduleBuffer += "00KGtPKi+tp2C0Qj75P/du6acKk+5al8ojjT/hT+MI5WZzEcb4Ua0M+vL2uqdTB1+O0txuVBKUTXYRB8+ERqQwOVrukbifm/rtGG"; +moduleBuffer += "JslACU2A8MKTMWj+D1NbrcoGqy4AHEFzBqHZhZy1Zbjly01TTqF1l66kTiNJf1CX6qxwM9g2gg4c1vrNkWAAacbqagZJC1+KgKGs"; +moduleBuffer += "ur0S33+rLVgVpdKtrqKqgq9s0fGNQq45yzk8yjoOMevrZ0nTlYwyssmFMRpwSK0SbN8jG9GLtqYxA7WCMILWWBfrCIMTMi7SwTjK"; +moduleBuffer += "+/WmWqUay0HHW7RAn/L57vybtR2T7+AUnqOxWSlNmnElSSrpIwTLTzJJqrJcrS43+kn5UCPH79XUcZec17lVH0nuMKqGdSxnEctm"; +moduleBuffer += "qH/wKMP85PT6+LGUb1Uus1f3dmdBQ9RlDQtfEWLBKd7/hTuD9F0xlyr0HWUQa02ZoXkaNDvkOKRKiIVWYM6nuTvM7/i81PSRuuqF"; +moduleBuffer += "NX9Du66MWAZU2zG5Z7u7x2lXjIa/0cjmwFoo+60+lTkd+ghYmzH0pJ71iTQH5hiAISIF6xm+swnsisDX2YdF00dJC1LfHrzRpfn1"; +moduleBuffer += "7raNrJHvKsqhhLPpvSE9c9JryphBTRNORqpO9m5Ct39npw94GSDfx8pX9Kut+USprn/UHq9crouYOUd+Tobna5Af303/iYuLyLvg"; +moduleBuffer += "vT4MvJRoJSIGGByg1rKGWsf6pDtgLadRLWmDnMTLOoQY7tPiqB3AlggaIdWH52XGOaUuDV4mRSAjvJ23isgLv1R4hWaoq/BL9WKq"; +moduleBuffer += "y+HhPe69x9Eeo54SPh5bnYZgKN5Bt/JhWR5UkMYMIWNUY41TqpmpjRBb3xlk2Qir4QxnVr1xrRoprHrjMpsu3NQT/cKgUyctlA/v"; +moduleBuffer += "w5c02katEo/54dIvWV/hvFvXD6/rh9crH249M6ms6HetfmmhN8wst/YOlYQ88Xt9RKG+E6d/QJV7pgeqSgx5DPlfjlBdGbQkdYA/"; +moduleBuffer += "SoQ1uNG6NykzikdjzwPhJumzPdjjQLyhZ2mk9ynbjbQj6btAJHCvqhzqeje5L/lCFGmB+4Ij9cVkDCaIbgIv1B9jLW6ISadlMm7B"; +moduleBuffer += "QhYepwPrKNjYG0HsxhWmSb5lK64L9wP2Tj6YpxsGlPW7m8oDuWkLUCMquPuoUp1nnVbjL5QKlglfHMMPJDQICukZJU5ExD52TsQF"; +moduleBuffer += "6sNIl+5tIwhXgOpuU6madfNYh/Nve+gtHln7ISHc73dxa1HHhSpYx/8nSpN7uP4yIM0x+7pvWBeGb2R/VU7faVAc2X3DpCDcdfdP"; +moduleBuffer += "OG/ftTxKSyGNVFbKvzChEbcqa5r8UNAT5ps9HroHJ1MaZ9xbxKNWV0N2h7rpx2qZht0Kh+Df7WDU1UeIzqhh5hyKrLoL+beG+tZQ"; +moduleBuffer += "3xrqW0POcUbXkNXRkJrQvRUW+XRv7GMUXj8pnhfOlD0Zgkt3digO/Iutvtjqi62+WO0bjO/NrHux1yyMUDOe3lLz+ow/E6nOcqzS"; +moduleBuffer += "axsdS4KArBXlmcJHgA9mSHpGvyED2qM3qUs4xrbW81xdz6Afs83XWlOEH7mI5cXOH5TLGqAJ6dtCr6MxXkcDhDDnfsQo2FBZBlth"; +moduleBuffer += "GcJR5RVMGZm8f6+76ql93dVP7euufGpf9/an9nXrn9rXveOpfd07n9rXXfvUvu6ag/a6/09V/CRgznXKO+YJEaKDmYE3k3E4R9yC"; +moduleBuffer += "yFlZ4Xocz/M3N3E/lCdXO3c7kf5q52V2bLCZ7+cnveugfdIdtgeQABG17aiiTnS++dTld5C9JM+gbBLeEgznWXNFag00YDCruQQu"; +moduleBuffer += "UGBcXXMtZrAOoTucf5bs/c5fLVumWgplI6GyiNRRIzAqEoJFOKL09OD5rNLTg+eN0tMj0Pg8ut6WgVILg0GI7Vd8akuQPy9f/+kt"; +moduleBuffer += "zi8Sqs0gRSWBOqsNd48NAj1Pu/RAK87pbznkzx2Kwn4N1OVP7VR/jz1Yr/vrKlvSozjAw7LTfpOcfcu9hgK/04tAYA/0RoeJV5Hk"; +moduleBuffer += "p4GvShxKId/7RjU7rLPd9K0JZbH0GvzuC7rpmwFutMa4gxvkgJeE3UaOrCC/Tw42o2SvOxi2a2zF8TxfgzRV6T9ApXdzo6mcr9ax"; +moduleBuffer += "yzLk5KuhaeD124IuhFxoqSiGDNvXdEJCjtnVyDFzlOaY0q4JFgbnAAxtYfAXnUYBvfAaFV66i4NzhM++Cbz7ZgMfgfldfYGw8WC+"; +moduleBuffer += "75cP+xf6bk2YDn/vgFCMg83wcgDKxrDdJodjjNyONGkM0iH1h8oeRVmzywh2kbvhZNHrXsGp3InSC2sUg7L0Ioh4aPTiYLNh2WYY"; +moduleBuffer += "62X6XMTkcOnlMMIG6dcjd4O7FFPkVCEB4lKcXmwIBSnnG41fHTVdPRsqBVw+68sCrLx1ZjSgTo7puGBRXwYtWCb/7Xirc84AKUXX"; +moduleBuffer += "t4mS+Ry68lKd4JQJ1CN00dVWUcRKEoMPze/zFTUvgatFfvuNWwLCrnU4n8rzI3XO9BbssZMKdoeTCnZFkwp2xpMKtteqBc1fNs1c"; +moduleBuffer += "rKrN1ktTcJmAWLHPOalstA7FTs1nEWUz6/xKWLDeOhw7V0DsllG7DoaHltSXrm7D73j82V7zMz4oBCN9M5Xjh3V5ALPBoHTDIbgo"; +moduleBuffer += "Et0WevdkQfvQrAVtI/XU44f6LWFvE0qOQzpBp8baZvsUTWTTKdZmxLHr9OW73yeVnSrFu/q6nVmwNrxfCs5Eksx8w/vdtXWzYe0X"; +moduleBuffer += "8VeviWAzB6aEWVkz/TXMeyIS+ys7m/TSkMkmVxrSM50+vLPw7WvA2tiP+VUpSuCkIa8piwBjtXaOj0nrHIYGSs2D3pUaFQPgdbcU"; +moduleBuffer += "pkWhrBsRtvI9UjincLqWmnY2CXADRdERWV9x+6Ju58isvzgVYXhuNlA81+ARQA+A9ws3iVs+IB/5CukYekYOO3rcBy+qTJFqFWMV"; +moduleBuffer += "3zMv/QQQ07FNdZ6F44FsTjbkjHNpdrg7GswOq7pcJ6PhTrhKJ+kn6Wsjc2eenPanD1p5/Iji8SOLx+dWHx/m47F/fLdM1sHsWVIw"; +moduleBuffer += "gAqkCw1Xti080vOdLFlXKdnOkrVlCTpw3I6GE0YG3KbviZ2aAlLnLGnacqk/Tf9O1rl0ha4LfIDc15R5UJd3L5dLTdxh8tWndur9"; +moduleBuffer += "itMA2ESZoLD6JA5DEVVPyF5wm5UnBvFT71eC1qaaqI1b26pvWU9TAic4FXtbgi4DXpEJMV9N/I5mvuf6YnHPltmBDGpg9WDsJ+IM"; +moduleBuffer += "wpfzDKghUAbK1gFH+lCVuDqXjZv+UfpOQ4OVh4EEAWsZ+DUAEhF6KSwh6NrYPVlN/XRsNhvRGmS58L5O3C/fQ8AP3BXp5/BZnHT9"; +moduleBuffer += "5xnFd1ObnSkwJtGkptrKijIsxhgUWchs+iXrGlyXJfhd6JmbWeIuOPNL2VfoO9hEcCfNMcg6uu4GT4VdwbgvyA7Vul0fyPw8FFpf"; +moduleBuffer += "BMQCJ9L4ZuM7oE1OCNRCRFF8R2PSd9Sn/Y5GVis/ouY/AjOq/ALfcv8ltd4v2OwbzLMNPWc7e84mik8T0vpsumAJsQe3uLz0nVHu"; +moduleBuffer += "bUSD9dd/ZQtdWV/dCRGCDxCvl2SEMA/obZlPBCtW4ij9bEK1Unr2ivS2ZCzPpNiZwQKvGbVOleZdkbKI+AdQmMXEPcji5W2HMUZf"; +moduleBuffer += "GEXrgx/VHdA3k1GjwxAaslwm6UcSPGmduwOMvzE9hhmn1y7w7VSfFjTPL/wmHNeY/oLgczQwMOAl/VGikJqMIAvzQzWmS8GEwC0+"; +moduleBuffer += "CpPau1yqRlvA2JbWfGx+atD34SDNiyLbKJhjH+kv77rFIL43aUP5TGOndTCbwCtbVAUCQIraRkUNR4sZkTg7fVBK1/SamhnIcdfS"; +moduleBuffer += "H8LFpw5m27mOq22kqkhswQetlj6IO03FNAVoH2z3qVq1vMd5pJBKPlYzctm6VVNY3FCv3JDwhjpvsCdXOPIGjlMiNqbrampJwVcR"; +moduleBuffer += "E9tz22Q1mE91uPDKR2dno2GqgsS8TuiznyRdh6KiUsJAV8hzrWTFLIC0KSr2HWciZlSk74UL/eZwphpFTpd6vWyGS6hiPu8cNAoX"; +moduleBuffer += "/YrVLi0EluZo6f3mzXW3hpU5UCDCmvQjhIvRORBV5kA07RyoT5oD2AkWKRSTnx/eoipzoJE+YKwzOvb5NAi0eTbSeyMFuoxc00fU"; +moduleBuffer += "56Cv0uaeAatPGbD6kx+wuHfAkukHLKkOWHywBiyaacAir0wxqz0AIg1S0wAg0okuC8+kIjg+gxYhBSGmF7OqVSowd+lGGvohqqQ3"; +moduleBuffer += "yeGr3TuwQ68u/OoRnhmd6cIznY4GAW9OVaONCqagMqqwKnenX6CrU26XNde7uOQCts3ZDRIi16TfTxj7k6kFkh2Qeid/usmlP3RR"; +moduleBuffer += "53RQ3A7TfkCnQXX0DhjDp9585jR+fkwXPKBb2fTdfQ4TGtqA9NuN9HaN4NRATuyUxG4iIGT69+if9zMbdvF4+ouQCAJUtjjsBGKF"; +moduleBuffer += "K+YK/Ij+PlRgOhc4wTkRwed/jQPZjcvn4wqkqtWsstSuSI06m9yBA82bgxzOAJdbGCT6IcbBWae61NhpGjUdlFijgWKNBoo1GijW"; +moduleBuffer += "aJA/fLNijQbqkRco1qgG35xgF4AC03kf7flZpCmhAoeLx9DKoAQcDTzFzW/44AQQRwMgjl6F4+0f8i5adOqHk366u0EqnXTTdR4q"; +moduleBuffer += "79/SzPjogc2Mj840M656ms2M9V/+bcyMiS+XM2Mzju//yv7NjK/FFUexPh/gl9G/VPZUmtk9VhtZA8+phQWjYBTS2LFVGuuswEka"; +moduleBuffer += "XhyV4cXqumS5I1BJIpvgOutVQ0vJV4Uupr6P+cxLt5FQW8F00CFBJwGyLrzozUoSmcWcjVB3eQ+7EpQN5Vul1/Uj4cJG2Hc83a9+"; +moduleBuffer += "KfodLXkBE+jwhQhf9vZjESYpGWUGja0AYjK6UF7bDhWnElzyXAfhNFL6vVQTw9FRg2jwAQKF8F0NymrxceYtshHSZ59btuzgNyvA"; +moduleBuffer += "LjN3Ew4jcf4OLRv7sQibCq+YqG26QYdSne2KRsHIfHiGIdtRm5lXUGdNvhB8mz2vyw+sh2Qlg05TT50QKFJnHoi00lRmOdBh1VzT"; +moduleBuffer += "eCcsxQ21FMs7WwX0lVE0k/yhjTIl1zYChwFKBQhcgzMXbN+xlXD7AvvGEOy30wK0L7EWnTdXSx8f0V0+v3+3r7xPx/3cJ8X9R8r6"; +moduleBuffer += "v/uJsf4H5Z1v/h288wmKOGNFoFpMs0y4jH5h6vCeq3d8fvv37lQH+aXRKD3jE+/RnhUhIz7Dg8iWzlsiC5WLSrwL0X6966p/fere"; +moduleBuffer += "teahg/KuP588buDzIrXEGVrioqaibLtC6wqXKW1NP18j/2nS+xnSjCNXZKWoGKu322LrL+BKhciN5fuuMa8F3HeepO91EKXJtBCl"; +moduleBuffer += "hIxQUFLQYMVyqBOUNIR+hVX8kACtYQlKWuNuRcBW4uPofh86dNbT1MEKvSHdQsSoslFWM9JXMwQYhH0pxJvc0i0CXknR4XOBHB2K"; +moduleBuffer += "X+GAROQzk0I86MXobP5FEetaQFnAT+iXkROCOr2OPJlHsFgAPcjpiJcGy51OxCWUvttmnJOP9+9tXmELkCd6YYMOrtuzNchfqLtx"; +moduleBuffer += "Laey2dClmyQ+nVVXM0UnJMZtx5IWL4tK/k19sFmsZghEEDoEUcXfriCIKlYyjWHqJKTz2OS7frBVYT11HmN3ynf+cGugU9lqjOb4"; +moduleBuffer += "Hp+lpE4oUttUql93UKQ1+iXTSzndzV9GiXODKZGTHKpIc3nhVeWMVZPxUEOPh4rEKesinWoz4KEGBR6q9vUg4FAxeggJkBa/0kdi"; +moduleBuffer += "jIxRQOpbBs2UHjfUo1iq0CQlh6sZsMm96PzFGGYXnpEBwaorTRaimePrg2bXGz+9mTrzWIPqMq9pWvJbbt7G/qV/lOyN5Az32o56"; +moduleBuffer += "1W9aQ/U7mozDzIELc/vkEuUwTH2VvsO90b9q/Q0zvqryHvfW/X7VtF+147fyVdO+avyDT/5Vf0kLLhInGvyAe/KBa2YFwtQohgtn"; +moduleBuffer += "Py+PVrhtc05+8Qe2BbmmD1NQT8fmzskvwhVTudLsAIeKFuUVjztcoX7Yzpk/bL+H66+rAKdk7xWTI1umhknaIudVNGVpJ3bZWEjD"; +moduleBuffer += "s3g56alVNqFwAc9cUJzfrpxStXAKP2e/tv5LJw5oi5x+L47KF0X6okhfFBUvivRF2Nzy+y6aCPb3XW4/2K+PmnjnU/RR/kXVj9pz"; +moduleBuffer += "5RP+qD/DZrT9J1uC9DLQNvgfb/wpz6Czz+BA3M3XPlQt2WDlTQ/5J8bDbr79Z9XrMDpv/HlRgv83/wuJfPpIPSsCMOXEPeAiMMsC"; +moduleBuffer += "F4BZFmRdjcwtCigPDPuC5p8HupxExs43btsmazjwLh4QsXc+optYgKjSOdorCyhNL3ChlXstF1HAdxGXAP259xG/0QXKJv1ZdWtS"; +moduleBuffer += "nsNyF/pAqKkTNG7JZfFSVen92z3sdlhN4RX0os5llT3Kz7SCPlShtwrCt+fzEz30AQ6uC+TnMAWtD7xbrSMKmBDDpA3qUzuiLwor"; +moduleBuffer += "3+OFAR8TUgFf+41+jErWMLBETrRm5HRDd2NPCWI358qsYfv3RXc8cKBfdEvNf9F/lRfldGYTAn4hKPj46hUAaUbg8UU8t2P5+COA"; +moduleBuffer += "NT0yv5gF45GUjD9cRxHPxxMUjO8LlrVtvgbhLhwvOGn9aQF86RN+yLTeZyYFUIfex6jxuKHTYTV0etrab41nqj1+YrX/5yo4uIoS"; +moduleBuffer += "4RSVcej12FDDKUkPTlB4Xi+fpF8nQp834I14Zhnb5Hzlis0Z6uZuTkVhhj/z8IdRxXPwJ6VukErBFfyH259z6ooCvyTI76538yPP"; +moduleBuffer += "7wKBEdfOWLESa/3PNOMngPs60UHB54s0mttqNHdEnL79m7G7Nm85wBn7sWLGvtEp/NMO9Hj52n/c4nDglHXNotce3M8Mp/vMImQ5"; +moduleBuffer += "UghUnWo9sMO2gB3uSdnpQAxmhhV2LMF/f/IaCHLgx9OSlL41cTFp+SJnbGJndg/wLQr1Wb6ozJuT/mPxph1B9VUfn2eP0iykslyH"; +moduleBuffer += "pPOGYH3r0/OB+ciny5h32nQH4Md4tDRooGJSHciO1iwbRzP/eAP5xwdK/AWtKZWaUtQ8B9eCdnwU3Ae9mL4rILxuehN8GoCmOFd+"; +moduleBuffer += "7y8AyyCj21eNhqc7PX0EtKnYZ/uWcZxbuTE8XaGjpODFwlb4kLQTpei+oNt+Fjz5pDsJaSTvZTCwNHBQGjLow/s/bLJB/6mDlU8d"; +moduleBuffer += "7P3UPnzq4ORPnSU1zcKnHopr+ql7jd9r4YqIYJyb4Rmxllg9Yf5JUwJ8h8fa281oOG5KUNrNxjcAa5DYnv5euY8JwPC5qxx3jc89"; +moduleBuffer += "T4puN912W34fkN9nF15jQ4jGku832hhveD1MWncYvh92iU0mO8x//2H4vkO8jbUyxoeVHQPPuiJCC+5os9FHN6Ub4eixN1A3tTWm"; +moduleBuffer += "x3K6ajQ8Rxp1gQ+yfr3/RiI9xZVbw3Pg9DVb+ft56Veg4f25VHqE/L5JerDjLKs2/04AnzWbv9V4a6s8f1xwuVliztPDN8vhq/G6"; +moduleBuffer += "DUbTvrzbIOn8sF1v2keiWetM+7lwArnCtA/H71qDjPDH2nHTPhr3rWrH2tqWS3mf/1Qm7xFFE/5FmnAUHXX09Y3Fwev4anPekmCF"; +moduleBuffer += "Hr16iXmNHMlcOkc7v0V/lVbhCdEv5/1Yx/PSWw0c25L2MdJL/VBgO5eH/uyY0oqezHfYe/PksUXdznMQCrvFMlq8k8lPAQOSZAmg"; +moduleBuffer += "8xAqDpVRqzPf+UXANy7LKnfBGw3eDM85zkTZc9R+TRSVBK7Bd1EPBx9AggKqnbqBJvg6GlqHRYj7fO7fSWmn5p39hZ26IR/DG9Wr"; +moduleBuffer += "ot8b6VuFkX521nKQf7NVcTsbNbQKh01UOpt9mM1T1+emnNFyf0TWmWYy9IzsMTqySTmynIedbu9cyo+pjLSfTZkfXTPfzZv+ch75"; +moduleBuffer += "eVXOM847hJofg/l0rL3BwPp39E1tzO9nV2eSvOyo4mXPHQ1f71q0MHiDbwDeimQHR54gX6Elr2E70Li/YduOtcv1Ravaw9lzb2oj"; +moduleBuffer += "LRC0QodDxRS3W9kh0r5haWtN2jdb2nW49AqwhI8h1qs6Igid0hGmC45fm3Vdm4DS1C2tTrcZRQ04Ei6Z+Ijiew6Dwy0+oSj5Nt0t"; +moduleBuffer += "n11dq2b+EjOkR9kSM0eP5i0J/lSODmeiS1k2xKqfrYg6sULVL+lmR1arGVoS/Ec56l8cIFruJJkq1atzlgQv0rX5KvmRufdytSSd"; +moduleBuffer += "jShsILHY7JAT7OnyMzwK6gTUWtKlKlVKMCR1JXi6m09oWguMHClU8aGcSN8Jej70PD9QIAeZdHu/TocmZqN0n++8zuG++3zndZKy"; +moduleBuffer += "tzqzy/7qHIEeq+ezuxmfqWezlwSz5OeIJcGhGCNZqyz3oyUfvkAHbVh+DgF7VsdcyuTnuYD6r6MD58AjcXGQys/Ro0RQjRU+teW4"; +moduleBuffer += "8s3GaV3r2WHHmXSJwYSodWU7OcR/cR1BgodJy/KFOo2q84Up31q47iMjiutHc3ahafKmw3Q9c0OEen1hcD8WVcjRaSsff4hMbO6T"; +moduleBuffer += "/5vhw89WTHo1hT/7uCBYYh5k+MQqOB0P2/N0U30o6OZXfV8E3H+KKd++Pjs8X7Sce6Hq2clXyWu8M9EhaJ7wvsdJdUuC35c7RrsF"; +moduleBuffer += "0Q/laUiRq5w//KLqw5qrkJ768tb0xobjCUofpKus2/NjpUOugtt7KkimqyChdJv+sFIBwQF6K2i6J9/dyIobRhiPLf1bZUMWQT13"; +moduleBuffer += "qLZ1W+AowKEYKa/xPlR9lWWMDmVPYem7ByZM9YG4+oCwLHyi5iJX8F7583DQwwSdJ9ubg6mf3LJQWnYOJG2j4ULVS0Oj4WZD/1Z2"; +moduleBuffer += "Ckwp6TWMctnLuO5Z6p01q9wSZ2Wzii1xVoXZa0q5bmDNyieg+5v4xFnFtle9XD4ltymqxSx1XLAoGHTro4n1MViujybWx2CxPtS+"; +moduleBuffer += "o69q4YJfGE1dEU3nnzioK2Ju9qzCbinM5bPo8H16wSaf1h/i+MUdGt5PVK75xG5+x/dkxu+OmacZKsAWZzw5aOuiR0rGOuaUfrGi"; +moduleBuffer += "hM9Rj5M9flLMQSv9vXNcFZEcxSd4oJFFeGBbL0t/InDAFDMgqn4AXRfDV6ImigYIb0+vpVvf5DcDBwKNBmsxSQjI+JUIWQIAMOds"; +moduleBuffer += "p1bckHWORspctrymzT66bHNTgQkotHC+pOV8SbO0mC9pZb70SbnOl75J8wVWeqnBz5fq5fIp+NizIWkxX/qyATdf4PApklgxX/ow"; +moduleBuffer += "XwaK+dJXzBfWPVDMlz79qD43XwY8YzVUBpBlQwWWsvNJkBqGis9VqXGoElPWlDMqYl5VqHm81ybUKwuDNL2m7o2LURENl/nMj0m6"; +moduleBuffer += "N6wkpijzo0TO7M7Kr9lvufQjv3259PqniVx6+8GWS3cXcukGJ5e+C9vBvkDl0lt65dIbRNZ8XSmWbqiIpekksfR1GqcjBcsrUulr"; +moduleBuffer += "pOgGJ5Xe2yOVJhWpdMMMUunfHySp9J2/Dan0nv+jpNK/O2Cp9HPPSKXPSKXPSKXPSKX//qTSDU4qvUelUgguk6XSb80kld5HqXS5"; +moduleBuffer += "SqWv0T1VGI38ns/dWUil50wrlcprpkql980slS53Uulw9WEVKjeoGHkOm+Lk0A0VOZSP3GBmfuSHlUdUsOx5pKkf1SN5Zip5jvQw"; +moduleBuffer += "GsPQaTtB8vgZBc+haQXPzTMLnq+bLHeO4IEHe+XO14jUi2u7KXf2tAthuYDu3WiUca1eknW3QeVOdglYOCd37n5G7uyVO/d95s5n"; +moduleBuffer += "5M5n5M4Dljt/VasEHDbmB+TbGGwg5/A8reWKxZfeZrIaJAaEINYq4mgNIYjYrJoUHAwEB163XnBYp4JDb+AhnMs4num94PYhttVV"; +moduleBuffer += "7At8KGFEWzca7EMJIxdHGLs4QsBqEHjn1e24ml7oVZ6HrjOI7m7bc2uit3BVGbV0u2x3mmzhl2jQPGmhXa1RkUnp1UvU0j6NWW3p"; +moduleBuffer += "D7Bg+wCCajW49UIL39Aor2lYLCBt6BjKgIfYRw8NaQ6HqRGQGv8Ye9ljF2UrolI6d7rEo+YyeLEjvQ+mhoNQr/jnXO++NtKvrSsN"; +moduleBuffer += "QY9nkctPfmx49qh3nHRKBz/jsUvKWH6l3lJv8nOAaKms4oN+3YZA0i3t5so0MKKDe4gqMbjMFQHC35fofZ6uhL0BmmEF7FwbmY6W"; +moduleBuffer += "93uFreWOvqCoN9LWkFtZ57kV+Vy39kKsvVq59kKsvVqx9ujL4SoHLSnWXqhBnz60qObXXqOy9hrTrL3GpLXX6Fl7DV17rzDmAkj/"; +moduleBuffer += "iI5nZBRQerCPn7RiUye6FI7XiJ2Xs7VrmP80urTMmSall7bt0sBlcdQEGBYJLqavtqjrUv94J5Jq8cJobdtqciWWr20bqdZOrvYv"; +moduleBuffer += "8Gm/PUSjAIhGARCNmn/kHIdcAtLV9C+Jp41vtVOclayLb7XpRiP1fSb0HlTq0ZYbxcPoOrQLo2gXgabKdH6y76h5ZGzhQBOGL7Wj"; +moduleBuffer += "0mG/xzHvZfTVgc+fLOgzOCEi7MJ0D8GvzVefC6jY1vJ0T+PIpi/vBGCQygQUYRkt8yYzGURUFz5cC9P3x0/IEacMg0Mc3mA3v98l"; +moduleBuffer += "HA97HXPCnoTjmm2cJ//tYDjpDNFJR6bFtB4650yr+0TwRyT8PHC4vWYivSicTh8KB8pvmsfXgy6jC9LjxEVr7IzRGyxvcDnsLG8w"; +moduleBuffer += "6U/D5nmMxHZY2tEFjMNQN7kOMeLPmNvR+G6jgRXMksMg7yywF2C2aJCeRoX+PglhHiANwz8X6NEyO4DQs9TES3EQNP/LJPSNjEl7"; +moduleBuffer += "4L6NldWJCrBeRMK+y6inbmYqCMLoehxpyqACpVfxNh4wJnbh5UQdiBBN2AH6lzBnjNSFhvguRMCulXqJ1q2nDG4kd4lktZDKZLeR"; +moduleBuffer += "bWsZofQSfDlbi1+D5RB35ViXgy8PlaurLZGXlnM/pothvGyuZhcONMevjBax+kKvTGReJE2rYl2Ub+aiVRjzQzS/S4iF0vx0bJPV"; +moduleBuffer += "4QW9UBie4/HJL8nx3ErQhbTdp3xJkQRHtnvlePrI8cTgeKIejmdDoSptIPlYkD+X0FTctLi3pd9KdFeNS6blNZ5pifPhs/hhwjF/"; +moduleBuffer += "mVv6orZLAkiF5ghuPK2fioj7qQ81jIB+W6jVNJR3SFj4ccKwvEbjge1xwX9fErjtUIr/XBUPn3H620sKdDO4hyK1CdQiRXK4RV1V"; +moduleBuffer += "hUhBx/WAEJ7XgQMZwdE5bThAzgf6gscYfI7ME7DGPDm8Kx1H6bk5GgzKT2s0qDvug2wGKxkN12sC+PWyW1xXV04i8YyH2/GrrIYt"; +moduleBuffer += "WI0Ti107Vk6jVrlNoQPPASid3r23ZEz6dJNvOAZiQ8lARFUGIprEQEQzMRBRhYHoK7kXjxphFXHF++x6NBSFmchtwTXUe7gGxUd5"; +moduleBuffer += "AvP37/6Nzd9rnpm//wfM35dP3e2xf//ITN3WKcukP96fnb3CMnLjnpllfGxIlOarrVV5eK/P0HosU0ZYTbYg2wuSLVhNtmA12YLV"; +moduleBuffer += "ZAvWJVugE0i6Gqwoki3gGx6u6YCRYeQuvsFZC5kANqJfCbH4XfK+PUyKKJN6U/phzU3Tsf4q8RKRgzXUkW6+usov5hnDAhDw4tAz"; +moduleBuffer += "CKyQEQA0obP+RxodBD2c1W/KWPvBZj5+MTKySYmwiZ+8RI7XrdmiWBBnVLNYkWvOTnVxkF1GhSGbBDg2h1tpNT0VONH04UR2/PRb"; +moduleBuffer += "Dc9Q3lQzA0x4YJnw4qgyVSfSBXZkYp6PvJFwxamdnxsE8xAsLfYnAB3cJ+xFWKROku5G3+QT925BjpSMJGOfzZ+zYrH8oDXpayFK"; +moduleBuffer += "kz/xD1moHjuaXkVuH+n0A7osTG9D4ssGg4r60s9qBFOUvqNvhWaztEABRJZHGSJyT5lI93sx1J9N2uSCmcZzEUHyXObGDZGO7c57"; +moduleBuffer += "NW8o0lNt/8oW5uYMmYcU4GUfiZg0R5Nz+lzAWbw4WI/ZNx53O4OVxu+MQDgHswF5Eu3OEiTZpLidUchOz876kIETV4vU8TUAsOnH"; +moduleBuffer += "xfwgcvCeEcyixcFuZk9ZHOzCU6AgrfShmKJoayxrAiQ2glR0zrkrsuhcwMLarB/9t4GDs1h+mQx8r2MtNYVnXfsefVuntThi8HEd"; +moduleBuffer += "1TWkfjcJFOziDibuitIHIIVtZP6wML0ezVxPF2+rJ4kasn+Mu7ZHmmVsT5FfbPyrW5iQVe5+ALBnRdILxpcz8QWHZoRQnCLYoyhh"; +moduleBuffer += "EY40VXam96wzXq+e4Y5EJgNzfsoPO1Fh7WI/WWRflbHkoVTjDlfyisuHYVy3NNycClzTMZXOkR6aINjez91C2R0xBhxHfY+3UOqT"; +moduleBuffer += "FwqSmU5dKJu/WVkoa2tcKGtrmQv6xGqZ8kwX68s/BrqD+c1lRet/ZWYKLQT8aYS6F3VaBATMN4a9N+0K8Sam2VgY7DS6+KS5EazN"; +moduleBuffer += "SgPT25FUdspK/FhSrMQ7uAaAzlmsxPGarkTufel3I7/seYrcJvlE4hYjPubH+Jhdday4OP0EIWX7dJ3tDlxLNzRwPxaatPSOJL1b"; +moduleBuffer += "M9hex4SvtkucwTj9Td2ttrvrXG26ourlcuPDlSU3YYoltxMDUV8cbMejWLvN9Oe65JpjMDltN7rmthu36LYbt+ZCVgj8I8NOEPK2"; +moduleBuffer += "g3bMG8LucBCcEFA2Hg6uD08IPm8opbZ0mW7Ht+7uY6awfD2S86G7a4A+JaxALavhhdIQzLuaD3mqp//igSsx/JdjD9LcLmH6PvCg"; +moduleBuffer += "46FPY+PzzsTodk1T01fIrA0t1Lw0lFAzd59WzVWY8a6GjDjTvciPLjfbs9yEm/WBplKVO1ypU4R5B8ll7K7xU/FNmSmWXZ29hnmz"; +moduleBuffer += "HSDQu5FbkJBuuW2HnrMdsIb4hVh0Nn+UYJ4W+PgLAhmjP2Iij/IEnIoDB5AhTZCQlQABDtDdxd99wuqOui7yumchMsRn3GsrSRpb"; +moduleBuffer += "ZS6ylEkaTZmk8UGXpJG99jAT/+6xaoTBfZqk8WFFUM8f+sqEJmmU1+Qb7pGTtV8ukzSCwLlaepI0pkzSaHySxgmfcTB9Hec4sH1d"; +moduleBuffer += "GVMzS3Ek7dd0gnu56mrp7pBpzzULE2BsUUCO7w0Of1yBxWKl6toUA7LOrE/pGzLj0LWljzg+7zNFXjhMyqAawYhHNytGJLJ5KqZ/"; +moduleBuffer += "PqJp0G3396FjyJ/zP25ZJaUPP3xngJI3QgqiVrDgXyLhV9pkv0CLMD9GMo1qzKkTPJH4T0cqU6rJpZx+3/Gjq5Eo7wKvIbLUEFnl"; +moduleBuffer += "QBNwilm4bG4nrGqILIOwXWB2t624m3JBGrj0pIuJaxIo/EkA5JLgBQEtepeucSBYUY+q6JWTtHbQaeWRw4oBqOSZc1VXGfpPdGgw"; +moduleBuffer += "xB5gCcBgMgv1sknHi9DEP9aKx02JAMuwa2X+rcKPGH+2C1b3Dwgn6TH6iSMuFb65L12u0hklAo7numKLNtxwOqGmQFeMWSEwO+pZ"; +moduleBuffer += "kbNK6riSIacyVi9mLDZTrr/Yq/+b/9XY1VMByFRxiQyFN2tM+JF5kkfpF5OOgZbcOD1o5jT5O368NSiD5gebQZOYNQ80EDnbGwxq"; +moduleBuffer += "VAeqsZ+auzjM178fgA1pFmru4pCMfCVz7zCLNI2xmkEYW37BJP1vcIKGxbYcL4/AVKrAAjcdMF2INFdMYX3cofLpTOoo6mUr8/kK"; +moduleBuffer += "EkpJ6ZUNxoxyNMmhv6IAG3Cvl8pfqjH4RHVXbG2Hq5mW54nDdHfnMN04yZu4Aq8JHEU1tPGNCV0NYGVYetG4+7d6lCCYBZyUoVo7"; +moduleBuffer += "InId8fQKhTmERvmj54NUzatp8I8KPM5oipwXlXHMGVX1oKBheqMm0oimQeTsqW4yvOcBVHdmT7i19WnILN02RzzUYSWIOiY1IEKD"; +moduleBuffer += "t4gRWo+azLN0nIrkyrpwFVSbwfgjmjf3RFp8RnoQutljLvO7qn+bsrY1jHphkEFyXJ0FlQzE8xSAoRiBORpk3DsiPsg4N4r4EzQ/"; +moduleBuffer += "1YMi5VCFRTpiilU20R8N+yP8ZBlzkgOdXCgfJe3k1H56Bknl52uqyLyu0D9Mv5w/57ystjLOas7MKr0Uu86icYYmria/gRRqkZ+n"; +moduleBuffer += "zPStud2KEsciDhcl0hFhRp9jHLkkBgSxDYvTlPmGi1NK7A6H1gFYVBOM9xh/bBmRXaRI4Jr5v6dZivuSylqs1Girw+HXoq/Xv8HO"; +moduleBuffer += "XO8vD0K9Z09CKwjAIBQzfCLwU3zCiYfYLB9zjk/X0F8fhIa+amq9+fbrIN6YJ1+5W5g7KwtzuGdhDuvC/M9cmMNTF+awLsydbmH+"; +moduleBuffer += "SW9jCeYpXXW0Sal0RLCSdUBaAHzoBBU3gB9R5TpErwJ55feE2KfXNMrxilbns1FJPvusuZoJQNcbnQTAvWpaX+aRJLSJyMJtq4Bm"; +moduleBuffer += "/ZoCsVYBlnhFdetCmhlS+1PALGliWRhXkUtWtmDKfokibGDchYUiVx4quIappJSdbkt62ZPfkl5KJsGlhs00Zx8+vmOYwZQfn/m8"; +moduleBuffer += "fUDzD/RuCyZQvkq/vwqs8dLi+1WZESEH9BeMQkfJeLAn1E5IK+rCoOWw4AijBCQagOjmtsAh/ZOC0agwA9RGAjV331e3ksOwymHY"; +moduleBuffer += "/DKjXrPWsRU+h+Ew96G0m96duL2ludOYpIrwpzwMhYs0M7D+AV4Ugss8sJqKNRQUKXljb2sgwGqiAKsNh/cnAwutnSYP5w2AXq3l"; +moduleBuffer += "ZgWkyDNW4uNjRRqN1SEkVp1hDRx2Vl/W6ZuLCrI+gvyV9jvvQRMo/IaDM/L4fMDR+qsSzTei7u97QBXFQC8MQpcPupu+t0+9dcga"; +moduleBuffer += "yUrqtOP0ZgOd6zEyUk0Kjy0A+hYD7DAOdVT+wWUcK9bkULk/hjpti/0xdGvW74+0PBg9KtGjIOz8bRX0NSu2xqHiKK1ukkCHmidS"; +moduleBuffer += "Y6iJlISkhOxX9avqhPkQkAvGHwlX5Ml5K8F7ns8zORo6f+VKzBOmVI66EA3ggCOi4LtUxVPLozHixkc+AROYgTApUo2hfc4y4hBH"; +moduleBuffer += "hsrzxH28nivYqoOy8kvvQqMdWMFSbDurP1O8M5svEzHHmBNgn+C70VT/7UjtvCiyajdImGUD9MthrgUawPntRruCtZjZiuvGq3vZ"; +moduleBuffer += "7HRb0tF8qjJnbuFxi8ebyCtbNx1UxuGkcVRYaNELs1CvRd2K78TZvS8g3ZabL05UIks6zCWsAD7Sdi+SQIzwIklVQR80fxXZmsiV"; +moduleBuffer += "R1WyRZPPoZxTK+Z99Z2r9YvUaVITajDpCh1d/jVUEkxK3Diln32ZfzZQF+WTTkNxH7KwLVvZz9Xy1a9OBPmL0u/HTPoNo5fZhNTb"; +moduleBuffer += "E7IbyDONpY8GFzvnpCxZw7QvdbeVy2KUy6ZyWWZwrp6lZR5xXZRXfk1e8wL/mqa6v6Ab1JIZcBXLbGSeioIy1jTpa4KVAQe+PEiv"; +moduleBuffer += "q+kHlxPN0tnUqmtHB8xcJzkbbow9ydBFlH6jZv5JnAXrerqjJy7XiEuGXqskQye1qyRDD51MtTAY1v49ljbReTRcPi/d5agZeId5"; +moduleBuffer += "ozbw6dHnV/zGaDRdQOJYgZ+RKpDlzVFxdpj6p1Ruih3SjgMrBwYnTLWE3+yYqutQnY2GY45Lh+JXC0ishgHoZL40tH3F3POpKRhb"; +moduleBuffer += "VmIJph6mWglaqOQdBiWl8JpHuKXseeOoAiW2hJlqwVodurC4rO80B0ooVKHpIWG5naT/EMEdFSaXmsZMjXuszwa/Mb0BZuXWf7Ie"; +moduleBuffer += "ZDvrb7c0eONC10swzTblta12f5Zo6an9ar5quZwSzusvVfrlZiCYK3c7XEyLXlcfVc8L1j3z4by6emZwj/dWVPXeinpglEofLT+W"; +moduleBuffer += "zdMKYFinLIHtSlgm5rh3hlMv7GUKb0ozJdZEXVuUTtSC5v+lfAXMnA7aHwmRvqGpP/IGex5mLFQHd6184x13Bjma9O6PycHtcuZw"; +moduleBuffer += "4hcGES0+aN1ea+s6S3b7iuEG8OsaBWHIu8hbN0IrbrtGxQ0TEbpmaOoA6szkgUC3MXvq3A5zvtcV0DgmoHG9GXGSuKw1FDY2fFca"; +moduleBuffer += "9X11ZNM9ADMrvaKmuRtPHkO1Xuzl8AT55knPJJyG8ozQx/Eat5JF3hERmxyp7Rz1MxzSnKht6dQxMjgW2f4gzoj8mFD66zSWmrVr"; +moduleBuffer += "HA8AzrGx9KRL24n64EfsmPT2pNK+auYcGI6bvm+zGvRwNW/KC5zc/soqx1mqtSJVa4HL5DF0VmDfsRI8lK/iDfKMnBR2r68VboAv"; +moduleBuffer += "LZOm6w7tFHEWfQNzysMkefTSPEthmSN1G6WyIbdg8OdCdRq6pkKYc6Zp5VOQNTvP0l8Zn2OWnVm6eFlVymEesFDu9N2IxdIO2I1P"; +moduleBuffer += "fCqv37hFp/LDUE7esHHLdFP5UmPC1VkhxESdCvMe040mfi3CFsCgLD8NKVjytV9ySG3w1Z6nLOOcrEDedFrFVFnB4QLpmBQjyabF"; +moduleBuffer += "Yxtqvmzqgn/1lAXvXfmmrvj89m9sUeYjv0OO0m21YmgPkIbk//q2ra7Gh+TI1diLjE3o7SoMJmOyInUaCEvI2JIdG6RfcwnDXNZY"; +moduleBuffer += "5sIiOyY1xlpjXNQY99YYlzXiisxV1PiD2PYrbdpbRNQOaBw8CuJJexijH3QPQ2a+HwcKSl7ZxPqZZg17GfStO43TtnslJ4gYaImz"; +moduleBuffer += "Psh95MWok3Y69EJItNjQ6FMLk9qDQbfTUP111KmXe4VxYuKQrt05sKJTWIPyqdWhn2q/QvMOuIh07syIZqhLfQP5Pwe6ZxkE5/5z"; +moduleBuffer += "QMMFXYvye0w3/Rh0ZUxWvIt+U51UnankJTuN+jftNJ3B0WClnMjPLHXx4V11FHjmx7pIrRY8wIGSjGGSo+OCZy0R4b6RQ+GzMHgO"; +moduleBuffer += "UyoP2wx0UaWG+d38G65ZlIEzEfyS/JYdwhAekn5Iuoc8ontNw2fRoCFBhAHOoNepfL6cGVpM1qzwA9WkG87nO8qB4qleWD9AnNrC"; +moduleBuffer += "4K80xi88LvjLJQbgKAMOIUabBoZVEzsjPPAcfBCE5gCGlbCr1Tg3q0hduweKJ5lccr6Hm5d5Ei8M+l3sEU2EDADi3Mq/E7hgFyX/"; +moduleBuffer += "AWzBA04ziwFM4KijY2iALY8XJo54fcOaujfUFIJC4gqix5rpUf7o5JnOKU7rrlW9jpve3Apb0BNZzbpnuE41b8gao9Ek6SPS3+r/"; +moduleBuffer += "t9Z4xNI1gL12e0YnxNiEflDilhN65M8Vsj08FHjLEjPoqiAXKc5uy2VdbKp+AvNu3PZ0bxlPlBTpXGBOfdg9pjNH+eDI9y0d2hJX"; +moduleBuffer += "t/Yto6GdverrBR05udtLRlx802NQkZMeh4jsDZ4YEdkZzEhETjwoNGR8Kg15QYWEvKBCQQCEVFIQ52hZUpDXeX9LoRNLH5d+jB84"; +moduleBuffer += "/XjeEyYfVLR68nGyko8Tnzj5WEzqcVJBPV60xCzy1AOgT8+bQjwWTSUei6fSjuc50uHYwP0gHS+shslNTzheMIlu0G79HasqQUzD"; +moduleBuffer += "wrc4qWyQkFIh8D+BfbKgHjtND/WIKtQjUuoRFdTjQe9o/JBhyI4FWXfEY/mMtCOq0A6Q6/umox2NgnbsViLQ8ED1k0kzGNIptAM9"; +moduleBuffer += "kN8/mTTTH7ZKPlJXfZV8KGn+k/0MpEL81D8m+xk/lb6r0Wye0aNvQqROtBqZl6yH707fETvlO/U+vep26dWKxv2bbgNx/FdZGWeA"; +moduleBuffer += "stZtU2oDyhswb9t1Z3svJBMdugmaK7bZMyuqOhXE7rlBOMnP1FQHkLh8XJOUZwhgx7DfztD4O2y+52Z56EG6k2CsVJc2t8PMW7KK"; +moduleBuffer += "dHIbahCC08qPA+mgSQOJeOFontCsOEYxu64dAl8D7RAVh+BN00DiMddvNYB/G05zvc2pWmLcFuHHdW/U273Kmu7HUF2930P1+HVd"; +moduleBuffer += "cxDruna/69pr1PbrseSLysKpU2jq29S+rtBK1VS0cXqbaoqApMC7jWtbqoLanLnp1+sY20abP9JGeCPWFweaNduPqoYQ63DZYlSj"; +moduleBuffer += "3lF1EybUwQ+LL7a9X+w0yn88nRQUUA66yx6gHPSKaeC4pc5E5OYfq/FPQ9Ncnba3TlvWiSv5LZds0dQDyya5InjHna60dRNc1oA2"; +moduleBuffer += "kf40zgJmcjdlJvfCQOnMSGUDy4S1Od2Y0MBIGxgVDYx6GxiVDcSV/OGPuAa+zDnwzNeJMNwufBY6TCslVAUu+JSxF6mMfbzK2CPU"; +moduleBuffer += "NVGSjlSSNpCkT6TzEvU5WuWJrsptQU+dL9c6X6J1nq51vnj6Os9uXg+Fl+lRi8pePJghh2RFO+oZsVg9kFRbn+k8iYu0iEO6lTGJ"; +moduleBuffer += "zRc8jjyTeYTcde7a4rMsqc7G6fUZezem5gq1lWBPVGsLdKQNcGulTTh/6C418ggjBWeN3jhR4/Wj6hGXfrfuFUJtU+owjRvMhcGg"; +moduleBuffer += "rIQynZVs1gyiTEqS2DybehTEI4RFPEKgnlk8DumcRAcaMyvSrBiRL+CqSR9kXs1WHuFoypLwpOn7DW9Y8Q/TLP5wnFUt4h9MJmtW"; +moduleBuffer += "bRnKWx0wzbS7MGjlh1PFmN/9pjtld08/mWi0dKARhntYqhzFLjlO77VFlX/UU6V3ffKZjb2Pn44hvZ3USp3+PHRd6gAP7GT60ttC"; +moduleBuffer += "VaflGzdt7WkfpwKa+Ele0CbulONqE6ev0xlZpqkzmqbOiUl1TvLa0KQV1zsSRAUTRYF0NBzKt98r9fTTgprfcY8c75ICVccF7qbC"; +moduleBuffer += "aIg4lAw7t3W7g66n48wVliE6pqtpNCeQcDOzczlfsiL9SLgpizYtzS5dA6iO68ooa5fppMquOLaEZh+68qj9mPYfeU9OnVmjI4en"; +moduleBuffer += "zgWxm1vYgayTr7wo49gHphRzFQTOgGSKbGHTWI5o+Fd2yBbYFqAhAzYw6Op+cMaGbBRPAxdqXETBB22/MNP/ZdRJTr7otsjTfv1S"; +moduleBuffer += "nxE1SNdH3l31ZPcVDFSnUfMGuIysZUR/NUnqeupID2Ijey3C8s77LpUV9Za4kktn/xLmvKwiQ1e9DT1Ig2zgUY+vIdOHw8xfw7r0"; +moduleBuffer += "KcarvoVnTEN20kvrHFqr2f9AU8xZZMpb9P6uUEZbsWM2/9B5nmh3RPCt0WDyzJ45lzp6bjaIV8Ihyuhjkrnw8vKDm2cEumGlWtDS"; +moduleBuffer += "fSvJej0kSGG4eRlNFgJmKOzdzeY0/0CG01LvjnkBygIxDT+xxvoZdU12UdVMoQgxmAqYMQpZzZe7KVENI8+NS+OeICqzDCKPITny"; +moduleBuffer += "NIsR+Z3RmyjxY6mKd1gyT6lGoPnobhAW9BCM/HTQwUGkrrCBxoEHPq07e/3MybQOm9J+E/crLu8l7o9V2/U7p6vtxp1lbWu+1Fvb"; +moduleBuffer += "dLuPkuB33i9PpZPrugOlST6Bn5pWuVGO01+UVZ7yxJ1hb1Lv1crMaZ5e+PQpXWSiGyZ/jNRxK9WfRVnhShkxDrLwZVVeu3mSVFQJ"; +moduleBuffer += "HpTOvW4LPfDlPvrkS+2lQ77W4wMK0281HrO/7920ZZr+/jpLtXO2f2jLfo/eQ+/ZOk1ta99b7nj73rN1Um12NZ0KiBTE/hSyp75d"; +moduleBuffer += "YAjnuDWKwJLMNtvOHNTSeVqhYaH6Cc/ctskb8tTd+JZJu/Eyx/ZGPiV3lBVJgXxyKGE/s2huhuCbwmt5GZFLlKYtW4F2nYpyOMp1"; +moduleBuffer += "LFOc8otnoHm2oHkksy3NlElT+B9INe5xuNPtD92cUkdWsBhO/clmD3PDzZTCFt7RIBk0lzL+yMNhdCyCuDxIBjDWPUjGZGSMU3qF"; +moduleBuffer += "YulCBw0ipOZRdV5pM3Y9iQsfxikyWDMnAwitogOcMc18NYnon58PFiK3Z82VzXb1aUpau2pLra7EJUWUczglyjl0Uc6yWZylThOy"; +moduleBuffer += "aBRIBN7nzf80FVRnuBIhLUut6VA17DLnpAvqrmqvZvNFunZlQevalTkwrLsKfs/VCGBwCs7PGgqX9F19GvpbPp0dyNNnTOImVfTJ"; +moduleBuffer += "9962VTlnuD5yM2Diyizwbo9DFITALNDnkbPiJZPS9ZHHGL984oB4jGkru+LaA6vsJ2VYk4qRIj/GvV7Emipd1598ZD7CPV121Fo+"; +moduleBuffer += "ctbctnUBTzZyKNJhPqebXo3YHXjvUzk9S5Ua9GE1EKdPcySWvJLUs6zffUnxMH10ie7CipSkxwQ1o5OSi2wLVYtOkRAz/I5fTQT5"; +moduleBuffer += "8/Jtv5bueMDFRJSuDQ4LYAYmbX9CQmYMAXmxTpfejHnfrKtoWKB2IX9e+oD1gERCNr2kxZZNW8mdyUGo5Nb4IFTyS3sQKnnbE6zk"; +moduleBuffer += "LJdIUZ10iDGsLtGe95cRYKGMY2iYIlNOhT8M/SFAjkDW7GBTyPr11jQq6VNVkYc1HGNhDKkD2RxVOPeVCpZYJqa6fEU0RXSclzG3"; +moduleBuffer += "thZ8x4Bce2pBZLOEAVeaKQPQRDCJKrhcnZREowQxZ4236cgbm+pIVsNP8BLVNDagXhkDAiVktXa/gngCy7OfuixsBDWqvGA0yGrp"; +moduleBuffer += "e5IjM4USg2u/dJT0BV1Wsj6l7H1VLRgkVaKfemfZ5iuBRvFXvVLq0arKOdqkR1d9lplD8LM1n5QzcDmwC95ftvdK9k1wGPmObdsc"; +moduleBuffer += "l5nvlEMgtWd0SVWHG3XKhxVMTmTdSV8ivFDK8CBtLk0+2Fw6SQXIZNyhOrpGXh+j/UNa+JGkE/SbZuHUlmkVmS1cfZJOOFZEKKbr"; +moduleBuffer += "FMMD8gVzQYaKGaKIVpq9Nsf8VLbZQX4ECOHVuqgiIWF76MZt5JM0CbOU5U4yzvtOVbud0WTqFp52U+Q97RqR/6N8UXqhdV68Ls94"; +moduleBuffer += "oX+VtcXsrtMpgdw3djzfBvmiL//sm8jFM8XsxrVyvAMFsePnoFT6vt2f6h78lDwW5j/mD4lkvgPHP/lUWd19n+qp7rG+EiLVfn9l"; +moduleBuffer += "UCoAsNgHQmOpxJE67qlXaDj2i6rojZ2k5xyi+eN0fmu/m3Wyk4ESZ0c/1dkMyGI5/gAAZNREYFHbcnu2PgRwpu6+/S50a/7xuyjW"; +moduleBuffer += "cfSuwvGn8EddxvMb7trv0dv5S8yC/Ku/dNVF3Xwzjr/xy3L0Jn6539XdDy+3OP/+xi1F67bh+Ef441p3D3zfHq+6Qud3z/8SKaOR"; +moduleBuffer += "fxM/GLDbcbCHhVrdNjmuVHfKE1BN9OolqkqJP64QwaqnftLjqR8eTYNMuqAdgSjKC4+hs6BzyG9VHPOzakJt5zGoIR6Z+gpC835U"; +moduleBuffer += "GUGbr7l5wkfOsi9gamR/bvjp1kCXGY8oUT0oN6cTJmh6SeSkqRYcNPS2KH1vrTMJslF1ntFoITZk1RVawNQG6guXRVgH8ZR1AKe3"; +moduleBuffer += "fA2gobkU4skr/QnVc//nt/TWcxKNuVl4JvnMcXtGv1E6XQa8dlVk06o3UqcvN8ox9AsH2I61P97a2w7Q+zJooqpSDMuobrq/ash2"; +moduleBuffer += "4cChOqEgX/doNbz7sbegL+7XFvSi4tMq4V8fiouBNtWBNm6gvYaYKFY9q09X3RWXkcq87bKSyjx4qRxffVlJZR6+tIcsTKmJ0WCo"; +moduleBuffer += "7OEr5KHZ+U8uczvEfTh/65uxC2lND17RU9PFZrIb8PFdJaUZ0gjQbDE0SonLEAg31aNklOvTx7zyCWSCPux8lzqauaBXMCsy1Xjy"; +moduleBuffer += "Qm9eBOvyqvQjtnAcPjHwMwQwMYGCDox0M0W71DLg26pvLK26rz53RRacuzh4tTxsKXKeqUquMwmyi/Q81HXhJNYpqnTIz2HCMQjD"; +moduleBuffer += "U7z57rpTIiheiUKUuGL/8gmjb58w7vUTxjX+wBLdzzQlbrhuK6bEzddtLabEGhxvwh83Ja66rocWnzRJC1TirGF6T8SDzWm0QhU1"; +moduleBuffer += "8wwtWXMrW3L5rWVL7v+wHL/51rIlD324pyUv5JYMpbKBZsvAp19+LbbewjXcnqlG62WIJKcmszSYEq1unkrEQ3o2pxRa8x0Pyuve"; +moduleBuffer += "T2Wa46bVGCosChdC+hvpaBdlDqvT+nUTQSWCNF9XPZfvWVs9Hy9OZqrujvf1Vrf5fb3VbayebyhOmsd79ehID7aaXTlJFTpFs1IS"; +moduleBuffer += "nKDijm/Isy/NLh+1Fde1qJtuahTmmxm+YN+6LT1fsLd6Ll+wp3q+uzhp/rUNC1O4OnS8p8878RSCQZjf8oCMz7tijeCKuSF2QnUv"; +moduleBuffer += "D7N4tBSH1K0nHY/dzJTqptsiFbm2FJKcTBMo8CKVKBVCuEu2EU7/WQEIA3WY0v6l+y665lNX/+/Pfubjq1+KPYP5X5b+6BObPvrF"; +moduleBuffer += "S+752XeDl/YbotVK4+TBfJdsHW3hQ4Foiae3b7/u458Y/8qXfhK8DPQFz/5g853fetsNH/ve5tUoAhPVls9oktOsOTRbxHjVNDYq"; +moduleBuffer += "KlWFzuqtAYyfTLzMtrR3EShjFao6jG4CiS6JeYpDMkRwkaGuirqKLPLfVMdUThdnhE/aDlJN8XVzJYNRuReCRYbTmtu8yFBLtUvM"; +moduleBuffer += "FdYxyn5OnWztBapqVOZRpmF4Muxam1Z1IiScCpCIqhMzOgZb/is2rVKzN/bTLzWaSxHEe8FRvby/QXLOaqz7TsLfEyWCKONZ6ONu"; +moduleBuffer += "pQ2/7yRBcAKBIqXkGTUCKux1vSVL9o5GB9YuGdopfNoMIbv43vR7ysDmVQXvE3jrteVbp3sqfdynFvfCz+QONyHA5hqqkp5Qj1+n"; +moduleBuffer += "JsCjSo6oRNRrz1FCXuSVi5wZJ/14rPSihLAs7DhT+DfrYASFgftZTHaN2s6YODOBl6jiillKvnj8GiPEaivzKqATN9jl6PENjqvS"; +moduleBuffer += "OyilyS9DUER23/nLLQqQfWLg7A9FbobCogIlq2ZjcDYD2GLUCVNbotu6Sovyp+sec8FfSdfJKC7JovqkOhcSbJ3kDP7SA4X6xQQb"; +moduleBuffer += "TXSap7yMz3bTpx1WGFV6sQhrSuwe2AAgzYI9BQQUww4rnimONbTN/zBp93X2zwiMk9PVCXMNALS318odv9cbLXEo3PkVHxMW7+N1"; +moduleBuffer += "VRUZpyqqjJOjN6MFyHmgHF/UCU+LPNo9Jz6cLDPTVGc4aT+cLJtL6O9TcfIV2ft0/9yYSm5QD70nibOweDb6Qzy7aD84vak82Lqw"; +moduleBuffer += "uWT/GLXC2JMRnY7FzROnqq+45crVfTXV6hlVX1V7yXk3zfAwoEQ/Xn+8h2cYoijf/sWt+zNEJ3ApYRm48SnWQeRi4EUq6+pKgJpF"; +moduleBuffer += "V0HzSjqt/VVvsysbpVWfkE5Nxpf+2WHhIlZqIdPnthuqfmxMVj8C0JDqx0RdmwhsWFE/VhD1ye7pfOZq9ngMw2QD5eCIyltcpLUm"; +moduleBuffer += "VLFNGo0o2HuQEr3UdPHPqkEudtXHGYv/ULBSKvQLo9NKf11XUZAKzCISv1iz/2navYqasx33TQTpW2PyAsQADJSqhBXGZbGjhFBO"; +moduleBuffer += "YQtQHwvmEkaeMgqaFnnKMg1c5FKn2spvANWZwxjY9Lba402ac7k+qR32b51UU6FpAxbnhW4s41Iij6sOqr5abW6Uj7C5HqnYNfdL"; +moduleBuffer += "luRSNzrOoHnC86WaoCTPVjiON728QR+gcYeODM6SqDTcF0UmQ3BSFt2UD66QrWNkpXzxKJZy37K50N46LLRoafpy+ROtbUfcLlEf"; +moduleBuffer += "/JguNIpLPi6bzAe2BQrVhbHaLGe51RcgubjUNJa+Pgs1CuWJtuhrwW+9Sc3f56AuMbJv5Ycr3OTs0jouPwMULM/XJnj4SRiB8xbl"; +moduleBuffer += "iUfKXdOogk632lYeutwvFQYngL9z0vy0cTOnGELrhtBWhvBhW3RY5PZFdlYIoBF0VjDD6IUKxAOUzej8NhfJWf2qOpK+ClxfBTP2"; +moduleBuffer += "FV+gfRWiryI/fGzWdWHzP7rl9pjNv6zhHnhP6A7eGzZvOzecv3ruBWYVn8vNCrDNz5eZkHN/o08jxOv2IeoMd5h0wN5EGaT8U+0F"; +moduleBuffer += "sv+HWX7NiwP+27v6/+0XRsBmC5Y6M+e+R4OLO8+vnL0UocYLlj6q/+oXd47xF5M1Um4uXfqIXhq8WE6PX3tT/qh0qpnbed5Sc3H7"; +moduleBuffer += "2Oz5Z1OIOeZsEVukj25DfPpS035+duzZMOO4urJMbr9U/vi6X9oJ5raft9QuFeoxt/38/K6/znf8tRxmhEA69uxmm7gOS8weADs8"; +moduleBuffer += "fzTcLb9LzWi4C+fPGw134lfm2g8Se7KijThrIdC+aWEL8ruul+HaIX+k5cEfS6O1RJjWuZmd25bulQsnrb0JJ0dJvwE0OjxrLu3D"; +moduleBuffer += "NqTJWcj6eoTifPF6ACxehUO7xKyTgcDjbYKFJl3gk5T37px0r7snbMr+FhSFhyHmK84OO8FuwB3BEvNuPuEq+XxZCR62zfy8XDrk"; +moduleBuffer += "Tpmewelzs2C5HEz8JiBuDe5oq7ayjXUanZ8f2m0DqeICmaKHjWWHyaE9a277CPZS2VvSVhHFBoAecMzZmJfF4I9n/480LzmlX7jl"; +moduleBuffer += "1cgsN9SBQCjTVG9JX445AGLOouzS7Bjp1WLyTATueqLX00nXx8eNuyHSG5IpN/g3WL0hmnID3iET5pilFpcCXAr+RPbUsTvzncHy"; +moduleBuffer += "fPNNcTf/UvqXHZPfHZzVT9j48+Rkw9u3BQAM6gwv1Wndea48fszS1ZfIVLi0c+zSbG3nmAs6C+RXyof1dJUcHuvvP/YCeVW2dpVb"; +moduleBuffer += "NrIwnpsdewFLjnElq9jKZBUKO8fkXPD5Rrz5OBN0ZQtnXqzhtTdRHP6guyBb6TGyIIYv7Tx3qXljZ4Gs1LMZFNZ3Rn+d6W3yW67T"; +moduleBuffer += "tIhZKEWgWOu+FBAT4f9n712g5LqqM+H7rlt1q6pvPyS11Xqcum6rqyW11XpYLdqO8e3ED40hOFle//KwMjP8azwZ/yWvDDJOVjLR"; +moduleBuffer += "ow2K6ARhd4gmER4ZGiKwQiTScTRESURoGQENFqEBAU3QQJOIIIwhPRnPoPAL/O9v73MfVd0ty0D+ZK3/t5f6Puqcc89jn72/s88+"; +moduleBuffer += "e8dTB35qZwVGxKPPfmkTvSKRCv+0o4e/fdHeidkW8i/ygrqrXAhiL8ZB/NGTf+PoFFQIP+J3TyJ/oigLKDO+XNCpLhl0L0niUgxI"; +moduleBuffer += "Vrw3CnvKbhB/7+00wVbFF99FbPOAZwTxC3QX98bj705enMaLWjyRvIBFpBHPHj0nqy1CPGjExNs9/TFqIJ7oc0HNSyk3hI2p2Tgb"; +moduleBuffer += "VdQNNCf+FfPWl16ydxMkpFe7ziqfrsYu5e/sibp4Y1xczsEH+y+B5yv/rgrc2RvKexjSwFLlBq8D2JZaWXdVcOwhvIuD48FIijBf"; +moduleBuffer += "aSf+/FLNg2iNZ9EEOGFQgSrj6B6+TCNYGlXeSRpF1Rf+oYkAdzo/DAIw7rV+YpDrqSrrVf8YT7tAjv150Pv4oFWuzIaRElGaIirR"; +moduleBuffer += "tVpPL2rriRQ3voUYbBeXG1l3V5Ia0CvUYAPR43p82sExQj++/G7dt02pbK7ihj35ulpcgfhKlkHbwN1wttZj8UHFcTYsd+HdvLaS"; +moduleBuffer += "hM+UtwvhHJOBaf5fMWtZz22kW5/ombhKFdEESWBY1JL1e9T6+6nB69WG+6nDqzeb3TQLimr97QT7imz/vj5hOAYB+xM4k4ueUMS2"; +moduleBuffer += "8SKk5y64rD4iLquL8SkI5vho8ki4YtKU6wzhkROQRHt/be/Is0+evezsGxl9z6cnTlmYqE9HxtlaJ69IjJ/FKWAxXnnKXClhxidZ"; +moduleBuffer += "4Ju7zuIVglN2al9UWBMbqnMX01/4QJoatigvmfQGz0fdhi7jGDtk9wmVll7H2Q+7DabMYt0640VO3P+6CkfSgSGBQ5O+htPQDqsf"; +moduleBuffer += "4D9dbnZHWNCMGEQPUnihIXaahQabXdKHILgLu2seErHrNgeeSeDoGf138ADxOmYGo9G62y2OdIqf+sHh8XrfXk60Lkm0AYnWEVXq"; +moduleBuffer += "X+nLDlyk4FA5CV2vYohBC0Ol3RWw9qbP6XJul2gqRUK5xDYqBlvhEWeb1JwtNh+FuzI33x2+cpz90hcEh07W1l+rQzboDrGS5WjW"; +moduleBuffer += "E9Q9xQb3t4OELZ2yQTpFrV/QIWq97ozsR/22tmGJThDrdQF7uZ7gb1Ah3AvcQlhyRuxM6oQpm9HEscy4fm+lXWyFYFzkS6fWEK/D"; +moduleBuffer += "TPxlFvDy9t21Cvt+50bXHImr6qFpEsyzi530NSLW4O5uiEUSN5u1nEZk88FpThMQX+3aSTgo3PkIm/6BTwY7ESng3kd41cvnKR05"; +moduleBuffer += "NVlRJURfK4EBQRRo3j/62wmrP/Y4vVgdj6cvLjzOKSbSF6fH6cX2ePwdyYv5J+jFUDyavvjmGXrRE0+cScRFlSiBvvsoNYybzDEB"; +moduleBuffer += "pCUFmbNd0piutAXcpK57H4EWSJsZUQeDswulcGC41GNRA57JiliWnPEUD8yMFbXRXdu9PUKOelo67OHOodEANdIYOzLDG6LHcnT9"; +moduleBuffer += "+BjK3bzF1BOR5OBjDPF+toOueYk9pMVLDhlvhPE0wOvEoM3clVC4JZHvbCbl2N6puQ9T83rxQ3BVSN3M/SC0AP/upX3EcDVxawrQ"; +moduleBuffer += "r9cJUpFf/CV/KS/8hdkCkfUY84OwIQ7ud0UmqIJ6shM92snqFOeO1qpsSKpCuXQZYvjGfEHWKeHreQ7VIa55fA2O47f+drHpadQw"; +moduleBuffer += "kxT3F6z+7NRysPMsUUTP2ci8J2qnMetUPQwLCsTDGRZUQAjF+AKCgsrIUd8Kd4Yt0VNmbTW9vmKLP6fkBws/rJGxzf1QjE9QVXrp"; +moduleBuffer += "OmM1ajfR9UW7UbuBrkdoWtKyN7aRca1azTHnlVrD15pay9dIGACGHvRWa6OWFJi+CrWu3Oqmf6d2iVErcD+wLa4jP9u87XxXRcZe"; +moduleBuffer += "4UgM92yd/eJiiRnh371gL0TFy5jum6lYcXx0RMVJ6LmsyfluJbEEFhIwVWAZCHgnr7qwt1DCNBIDF2JPgSZFzaFyrKnKrCne/6ZG"; +moduleBuffer += "tEJzJzvlTqIaiqyEO3EybDWt2KmqasW9xKC0eUP3Tqpb9yIMKsgxKGGgCe/wpGXYWUo/o9amn/HSsj2U7eVYRyis4YQZ+9Rss8b9"; +moduleBuffer += "WsM/hOJEv7ps5wUPvxDhFnfrDUt0K/MF3a00XSwAtspOIvSK6kIHlomZxYN42gU4E6iVqvNW06dLZbvllEtNfARTh+1IdJTd3HhY"; +moduleBuffer += "Mh5Wy3gQbb/S8TCvazzM6xgP61rjgaPxaxYfD7NpPKqBeFchYLgsdh6pLQMGgrmISui8YzE6v2mJATHuhiZsCUaddLCloyO/PMET"; +moduleBuffer += "b/kXTPCrr4fgq0FC8dTB1JxlsJZIxKGBDg6EEzV3cO8rZyRZB9O0YuyW62BDOtho6eBJ8/o72Ex2mJbuYMEA19vBxiIdbCo7+Yws"; +moduleBuffer += "Arx8J+vyF+9kQ3eyyZ3sZxyA3skCkLu7nMIELBivFx5swEJ0MXiwoUkmb/hJwwMW01iuMVJugQd6gTr323q9SQxNwUXqPF6w1ZQV"; +moduleBuffer += "1wX78VMrgtigy9cIQn8mhyCStWPFEARh5RHEhkUQBKGDyt0SiNtSFd6OIhCWKM1UmwjgNhmANuCzttwAFHIDUEgGACQqI9AK0NJf"; +moduleBuffer += "ska5LUNQUAX9unUIlvilvPCXaw6BiRYs2cfuK+vjNvSxqwm/LevkNnRyGzq5jVfh9Ab/EjxtXweeNlUrlzaXhNPMSGAZzmfDceSt"; +moduleBuffer += "Yq1U7L6JFmJialnmUN98aoR3Ifx4MqFCBDVkk1OFhT21uQzFk2wsAF1hq4kXfHwkCvAQRb3qLsFYEg+zITb+zi4+zfS6ijhJIFEO"; +moduleBuffer += "kxeIcvqqtT/ejJPqK1U53oyNRjgwxUEXvODEtk4cDyY4WrWjdq97pGLqjYyGjh1ADZhKZw09wVbWxio0RQywQE2SzqRJ6VvgScV4"; +moduleBuffer += "CoHLwCScPDnQvX7injGafpvE2mxlbm3mxtM+4lQdSZ2OwvrGGveH7ClawvYo92Zz2o9YbcLmHG7dmvLx9xx2LJeLKjv8hHjTrIld"; +moduleBuffer += "x0LFuaj3cTRMK8s/36wst4NXpFi/gE2Bm+Kr70nWnNcqHKcuXfTleV82f6dxvXE7WuCqVdvRng7Rj4XvgJvCeb8hzrPNfN/B5hAs"; +moduleBuffer += "XO9flV7J9k39x96+MXqgYcb2TT2/fWPw9o0xYtbqrds3fdi+6ctt35g9tT7evqGbut6+MXuUAQMibN+YimT2reav0qU+ZL9RlbB5"; +moduleBuffer += "8xA99Q3Zb8BppGHjPyc7EQBou9gz/XXs2qzJ79qshWKapkGya2NbcE2HnZg6XWTTphcC+lZTUeFreGhLsWIaSdPNNKWT362ArzWf"; +moduleBuffer += "Lm2NaFmtQ6ygPK3r3L9A11nikGGVCBu3UR/rPA3oPPuh8zRyOs8+YtaqD1rPPtUPrWfTrgs8FRjYb7ExbT2k2RttZONSbGDvosu/"; +moduleBuffer += "3C2Y+ojxryN4k9glG1UV+JHeqIyTUf/BCOruaN2QHUKD/fOVElwy6DaiedzUkVcTCR+M+tW6NGkfJcUmlNm6sWPwxg7Wwc6j9JBu"; +moduleBuffer += "7CSbMNEmxbs5w7KbE21heRhtVfRi+x61dcGOTrRhT60v29XpV5uW3NWp3ToiHjOM3LYOb+oMHIwGR8y9tc1qEwvLaOO+KPkQv9Lf"; +moduleBuffer += "XKfLVlv3RYt94Dbqt637aj/Fla7dzk2prafv5XaLtqq6sk4elMq/el90B33g1bq1O9DCda0tfNWea7Uvujm3bzVi7omG1MDY01GQ"; +moduleBuffer += "7DIFsstUpJv8LlOQ22Uqt+wyBbLLFGS7TOWmXaYSNhmyXaYg2WUqZ7tMJdllCrDLVO4pF1NN4+WjLZrGK0dbNI1jT7VoGo+/q0XT"; +moduleBuffer += "eCR9cZzSxgPxbJrl4tu40MOHEvFmLNypCtKdqnLTTlWViPnWPbVtarMaAp8ty34VLSiG1Hr1U3vU7XvUbXv2RpvQyxvV5rfU6q0M"; +moduleBuffer += "hQBHoKq/RDg0jNsBXUPVwSGX4B8d4t9CAktVH94VBScV0d0tqh+sZePred0QIkZBiI+GxNHXUXHriLrrtY0o73U0M1EekVWJ6BPD"; +moduleBuffer += "jGKrQBWSBxtZ+2rYAaUEJA+ojlH/A8A466gN2/buizaodXtqW4gE+/eqwfujgKYivdobbVf9/0eF1dMb8dinqly7gfupV5CT6NPc"; +moduleBuffer += "Q/OjTw3cDxm1N9qm1j3wSMUdsahvuGPQQ1QptOaWPXv21taPGFT2lj3Up/TZ7fiR3/epHMVSP+5Qr9qzR92xhwTYOuxt0VxXr967"; +moduleBuffer += "b4/asVe9aq/auLd2M/qBMlPibfdTFep71M30+HoOaINSa+tILldRe0M7jUCfoDIQl2r9HkK/yEvJB9TNe2o3U3H0G3WUGthL392g"; +moduleBuffer += "Bl7PwR3oBi2WMgGsdL9WsY1YxTZilbcRLz+VbCNiQMSKZyNWN/1qkJq4SQ2qbXhE2/LNRTvp/V7Vt28PMQbq9b21DbSaQAuRlfpu"; +moduleBuffer += "+/1Ui5vRW+ulhdS0AFUxqALUNB7um9Um9Mbg/TUM7XZIoJvV4F40jFpMP7xelmpxO/1/5akEChIRxWPv0k8WOnXz61X1EVoFbOYe"; +moduleBuffer += "IWLB3V5Qzt77d1eMxLmpg89sGrH3PgDB8XreIsl+8kUm+NxbQKwkiPtr6+QLW16vAnyBODkaSF/YIl/Y0vQFC1/oG3lgH43uA3zb"; +moduleBuffer += "ta/pO1b+Oxy/hECbDsGRxDrx2E9ezk4P9vOw3vXY3Wx6Mu/4sXOGnMzjOw/nGo6BZUyZ3C+luqXw6RLcFtR6qMCJUhqCIsE/zXBC"; +moduleBuffer += "VTIIUQGEqANCVAAh+gEh+mSeawhRB4SobDRW1lapCvZPcQa773bZzCDw2JffP52ALwaD3iX7p46cw0n3T01Vv906Zuq89Xzecxzg"; +moduleBuffer += "lE0iJO9xJDthNuXuv92atnTu/nzuyzbn7k9zn0eyGSufO563c3u37P/4BVuuh1xlnYB5xNJ7t8staDh57xYW/k9xEcdggavvpy19"; +moduleBuffer += "L3D8BXxMWdmG7nLZ0DXZaCaWPcXwAV2I3KEIQ/Z4uYDcHi8t7dkmU/YDzLp1tBSx+ddlO4LZW0jLXRv7ekVl35lt4UFLhQBkWPnB"; +moduleBuffer += "8uH23fBKi7J4C5E+qGPytovirszOzhtRQFhTLPCyrbwOdovOP1ex2b8TDgPuTbbyqqoDeqfqzkdq7eLsQM670HfgrcBqRAXeysvM"; +moduleBuffer += "OA4/3iJgzz3eImDnH28RsPPjLQL2ePJCec5+fObRqEPal1N5Ssd2SNU7VHuqjuQad0BT1h7Iwfo6DDOkr+1s385OXPLBEPdoCd1+"; +moduleBuffer += "yBVtJ7yYiaLSEUWlwbLVYD2D3puV+ojG0pCRbdZWunlFA0l7N1E00JqPCQ67OFEBXzFVQYa3AH5WaNXPGVAPuYl+jtYjxLLrstGn"; +moduleBuffer += "VUN+8paH3dC6rrpW8RhLauaMJTVzxmKaOWYRYAQktGBxDDJAb/h6J2I5unS5tCGvIHJZQdRUsb6kYrW0RDgKjVxWEPVlCqKCHj6m"; +moduleBuffer += "gwZYjaF3szB0BfAnizvznEVzBbo22FjeCfWN/TIdiUnK3dbHCp1cZ2a/NNW77yfdodwacEeCJQs6lOM7Xqsb+3QBuht1OblutFNu"; +moduleBuffer += "jDW/LRuiwpt4IgjPx0QIhFerkCZcuHi3MavUHQcWIx1ntnRc+ss/X8f9CB2VdBPLgRCSBxQRJh0GThNmHQacIZ7TL7NLz3G9rfsC"; +moduleBuffer += "Qsk3bwcren3KEwzetB1cox9mC80/8HZvlDgdAnNQEV9Xq4JaLbLgtdz/h1xsHJvxpIeNYzO+UMDGseJ94RWqxtdu4Wi1lcRXKtQd"; +moduleBuffer += "lVoHj3ozM9P7jJWUrWVMrLIoE4MSG+gD3ccqT9bBtIN5gZIkPN/tkE8mEQ41sVkWsepONjdIHJVbxVElEUecgiXSvSRqgnsz45Lq"; +moduleBuffer += "TlVR1XsXSiQvJ5FESPLBHpYfhZzkoF5Nv1DICY4CBEchERwlLRkmsG3bpmziNynYKqhu/JPt2528S7qgX29arF/tu2lOLt6vbFvL"; +moduleBuffer += "W1mF/GasdGx+M1Y6lojq+jqWYxxdu2NtOYZ5nR1rLdGxMIauLdWxdtaxbdrZAeHKNmy/si+GFfjHFA5TtsXotHex/izcjd2Xl+lP"; +moduleBuffer += "S+u7r0moNIf/BRKqug5CbUsJFfsnvGliKwTqXEn9WRZ4UV4SxCSwpaCa5n7hZfrUrrH/yHKuT8vSp+WsT6nsa/XpAixqt/QpurMJ"; +moduleBuffer += "jnKf2tfRp+WmPrWbYCMguJ1+xc71q72THdjm+7Ws+1U2ozpEq9KhlmGvSjZYywn2wObPTg0by5SUslSugR6PmUt2vNXS8da1Vwqd"; +moduleBuffer += "VEInjXUbVgrwK5XuNbJ1k4xOm4xOG0YnvNZiIdCLhRtpBNIBkjAUCHybLBbaaW1wIxYLN2J0+CSXr9p30ji0LzI6YdPotMno8Nj4"; +moduleBuffer += "LcC+oMWtL5/xc8PjwybPz4A9bx2Wdde0ZcA+GS0TW4cE7FeqNvp/ZTY2Lw/p/SZIz1zGX3JGEJyPcKpw1T2RcSfrDAowcKCkJd4U"; +moduleBuffer += "prTlOyseb9GlwKojh0c78sC+T7boW4D9NeBUh+pYAk4t8Ut54S/XxKFsBWDKgpjhiJWulQy2UGzqVt4oZih4maZ/OelljB9boKly"; +moduleBuffer += "Q5x67qoZ8f5k4hdeZumE3bidFb9cbN3fLzdtL0LfNPVEom9q+/HQc7kJPZdBbbDuLGdAEHuuQZSsQWxZbb4seM5WHa3g+V/AquPH"; +moduleBuffer += "A8+2QBdb99ViKw3mZpD/5+DisVNYVac2+/z/6roDtqZJn4H7dWZ9Jpv46LNO1ojRSiC3GkApWKpUSCTVbNWBOYUuQzXi/TA9gHNU"; +moduleBuffer += "DiayrKEPfOZND5bBvYnJ7cyMEGgiN1QHmwPQXTyoXDY/oC5fxlYHqoMGY5nYG3SIkWElbt/JgGoQv4segPgaDUoF+ejneCadl/SE"; +moduleBuffer += "lUOPWg59ag8bJtJlmVhTT5SgTvUk09wTqYHCj25jUIpnjQb9rScmBiVV6rfUkH0ffF2W6tZ9+HO/Km0yH4hlsxcGBSUO9YqLhC9L"; +moduleBuffer += "tnpN2QL+fLoFrBp683q79QviNfMBuqxFuJaSWrMdxUOTi839kj4jO3z9/jziIwenjPCrqYuiV5L12O81Zd3a4gIMx6mzrKb2DYFz"; +moduleBuffer += "pd+0tH+HYEuTFx9TJpIR/sDKBST+Q19Z4TuLSZb1mUPm1FcI9KhypsmErxCbzYvtYEOSdNq4/rRTL592KPVcYmVBXZoCuRj5QC6G"; +moduleBuffer += "DuQSvMcWv6+tvVvPRUJBF+Vcw7JjBHbJ5uwXvxyQabvErA/iDKqCeOaquF52EauwFKeWLrY/ZHXJB4vagWzkv3x54VRBFZWfeVGi"; +moduleBuffer += "B/ZQKzHkYH2ko81wVHgc//M4XAFI2WJtN8deFPnr74ocTF+41TEFFu+MTJzmJFaDwL9mD30f3IQdxhYCFAbPAZ6460f5sDtXPq+q"; +moduleBuffer += "FEeZgyvbNFwgzJ/YRZSuQlOVYJwpbubQl6V64oTO7be6JPy8xAtKXH8sSv+tIwSmQFT5/dTlyK3Y/YSPmswvn60dPISf9sU+F/d/"; +moduleBuffer += "5ddSJ/HKyLybt/qe1H4x//asERfiL/1tFj1h6m851EF+0kmkA2tBpAMrjXTQ/L0teY/ofMxDB7DWvuIwRT/hJnFTdoV/Yy01T1+6"; +moduleBuffer += "xjwdbvIdnwtcQa0LjxGju6tmq+S0PXVWzp/QDu7MeHT0nAE3y9qJHlzTJn5rZcOCq2griafY7hrBnztp4DWid3jPoEXSOhM31Dq5"; +moduleBuffer += "8eEfEzcl9h7s18piSIN4ppXwdxED1OdAisoOn7UlRl4XVohK7kP4mfLRod08K7A4TBOWkXCj3Pvg5JywlxJ2w2rXj3slIuS4jieL"; +moduleBuffer += "mCMVoRNaDB5CjJNguzUmw0sTqIRQZDydusTRfiin9g+zH5duTHYdJhaL9HHICS9Prh6TayiEjBB/GALEV9yVd95ftgOhzyXr8A/X"; +moduleBuffer += "rsPF66pDUwX+o7hCkZNSHEjFig9Z7KvUC9/GQXf4CZ5pPeyObmcn1hL2Cw65aLh8ofKirB/ZvQ4OY1qs9YhsDieDkohIeGfR581U"; +moduleBuffer += "9mvNPq7xx9fsIdiUuCSpmVkcdvZ+wqFY+cguw7aaBAbYYcCVXzkNG679PRrNLKMtH3CLPXYFt7TIycd4ZmDS34SHm8wQfFLctspc"; +moduleBuffer += "io2700nrENCQGvriiYON0HmT3kRgTcR7F4d519uiHUmLWt2APfU9cf7KLg85yCR2Zk/84Kz2u8R3BKm+p92+Pm2mTtYShyo1Z1EW"; +moduleBuffer += "EH7YY2/EWTdYSnyzI0Dr/OSzRnhUBzswMw9rQjEuKMJM/N9I/GMWLTmHNy/jB0Z8iBC3+vtFHCbJyxZ3SfQyyzW/WK75xXLNF9j1"; +moduleBuffer += "Rs7dkPSBk/QoLKfjmd/9qFhKyx0YD7rzP2vWTpQtB0ZZO8/LnFyThBszpQkfEx8+QlPx+O+fE+87CBXRhcVDvKlxUlyerTrAfg/p"; +moduleBuffer += "lWqwIxQJ/AVveU+altPk4wsEnQQJ4yjNsRFffIH9CbbbRuRAvMPfl6ucEe321KX1yO0cqs99miZJFvABiqMXLn/UiD+ONzTeF/Fw"; +moduleBuffer += "7Pkk+JmZ+HE308HTPhx58P7XEdPq31/VldskbL6qrHWmjhlxA9X3BmoTy7GrrrpB3VC3ehEdke8UND4bKUV3g/3uEuvm96twGOI2"; +moduleBuffer += "ue9GUJ8b0MHbKGHI4ZrSorqiQYRF5Psw2oxYjDeg6wigpGnK4EavkXv2RX8PpdnWqLXhhHpd7GtLqAHBo3iiSNxTmtPTC/A3Seim"; +moduleBuffer += "AnGkqhiYCuLn0t+wET5vqooOCJyYZgwYj0YSQsIyiIn3yIzpYeqQxRuhpAfpQi/eQKUYWEDwZZtcNtLlqgHxVAElJ8ZeKDs+QtCq"; +moduleBuffer += "KnA0oAoFaGcFC54IccLDpzxEiS7XUtsRPPocB8FEPItqyvrK/PRYwgirqfU38cfwlIt8MCAMZFVUQHDjgvimLkiDAsKuNJ7nHaTp"; +moduleBuffer += "iowsDHBVBeyJ15FSGQBSmu6asfCLMO5TDbF1QU8eMZMI4agywGJFVfqto2a0ZQjmJBXsAR8zdZvZxTImA0u2CtVIe5blkzcwjZ55"; +moduleBuffer += "bsqIN4dzRQLRH7HxhS4pHkKigkqhrGMSTs7BKvSOXfRnVSIt+etdQ/YOtYVjQS1XW57G+tyDtc0OTCxPhuCOXZGR5lm+3fpVutAS"; +moduleBuffer += "/lGp8RuVbhV2GCscx7SCQMtJDkhgZeS/+cYh+x6+o6/YYyY3LkLKjcg6zQUgCt4zgH2TPqNtas9Rs9ZKc5wn/JYtK3Oi3PAgLcPB"; +moduleBuffer += "3Cs0A/Q3e/DNjRizHvHoAFbOnUwjLzl9TfLTHj6EuBIV3JQxNdFj9GdHI3yPL0Rcl0uXXO6Tyz0JZWvzRa4O0/MdDU3PtJpxoSKS"; +moduleBuffer += "6VdgD3DcdjCfO9lCIHFd/JIDRaIfcUCFAge+BuUmgSIKQrouaxvFB5shDv8QmpeZNv3FYLoYKYNDZfP3Ah0iNjdbhIThTy7Ako7n"; +moduleBuffer += "h0/EL6lXZcQfAIDBFrW3kRJEgAmxCpCLKgMyzLJglRXEt2WDH8DKUhzb5bISa8CsskNMA0wjrOXh65YfiB8G1Pf6OVBbhuw6z298"; +moduleBuffer += "SKHpuXlXiA+YO2GDEp5i7d2iiQIMNEEjuuHgxOBx8isqXIkvM/2NmokygRmVkHSUqBWEjKnC9gM0abIeaiH2eAJn4DJ8mlA/aF5D"; +moduleBuffer += "1SN6jjL9p6Qv3LB5AjDBZuQ9YzTR9z0ZfaPlPWjWo6yNkvnChdNMCZjiwPKYpNmpXyZ6K+Iqm+Tkhb8hoPWkSUSWTjgjJxhluvA8"; +moduleBuffer += "muR47qV4utyIuohH9dTF3WAX5XR0l1HGLjl7lvSFOBnsQmon/JolsV74O4KqaO18vlzrydsG4t10mc0JofWaKUevHrKmivREgPtM"; +moduleBuffer += "UbUxTMXFYSVWG39ppiyKrPP6Os1XOQW33bpAT/HpNY3aTQJo2nqx68ItbYNY78qUSm2qi++6sQnDMKhO17LEH07n+Cps4NA08cK3"; +moduleBuffer += "uE0T6C4+u86ztJC6gSUWG/6diCaAMwcuD+Nzz4hPQ8yzVFKhZZilmJ48a7S+RssrTEwtu4BRuyDqIM4xd9hoMzcFmSJ1owJNhnWe"; +moduleBuffer += "FrVOuhDk94QiqohbaoFXOJSJGqSqWBPoyW2oTnZYiAv7VOwUd8Xpo0qiiDzvEv121tk3LWKd0rzWrqUZBlYzd/2drOSlPmKSR98w"; +moduleBuffer += "C+hNWKNOVkAfhEOWkUxibBVqxnaTauu3yij8pph307p04ejlm5hIMLo3ZQslDGJkhH/h0WQ7XAx4P1Qo8Mwa0ZqeXqOj57GMY0Xr"; +moduleBuffer += "1BoiraKoSs8XNWkVtU+giLJH8bzVqPUCYdGbFfRmBeZs1M0RID/s0qPCpu0KWtAmo7GCOp8Y7Ir4Ujq5V6gV/db9RHXUxBV1675I"; +moduleBuffer += "RzZeAW3/Gvhe1zlp+azSDkIuu1u0e0SaG+nrG8X//4rwT021kXqvtoVK3AiK0iWaAgPiYnjczv8ApBuITq8Yj3uNqJ+K3/J0+IeW"; +moduleBuffer += "dhCB05xH6X1Nf7yoiv3WYW/Inrfzp4WwAB73kq8V8+OJHJRa6jth8fJFai5rO655MfwTWpAkNbeXqnn+B1p0o6Y/y+GmlL3JDOHL"; +moduleBuffer += "0YHbRjvuaKQ6vTY8dzbiAY6aNmKhR2XZBKJxgAbh41tCJzgkg9JllU4Npb6mQweOyq2fZ4N6R9wso5B+tJf91kIPEH7EVf06JxKx"; +moduleBuffer += "pgCn5aIb6XqMOrOuSYK62McedTE+4SU0UYxP++K24zSlXKVJoIhjd5EtpxmjtenbaV+GaDrLjwE6SgN02Zeun6T7SR81O+LBp1K/"; +moduleBuffer += "TQO1bcT6OT4zfMKB96bzXiO+ZIb7axV6OECvbtQyuRgfoqf2tG5HHC2/+esT9GSnT8ed/KCv325dofqqbSAVqcllf8i6qu8n/SF7"; +moduleBuffer += "3BE6uJk66OZYu92i5wF6HsjRxUBCFwNL0cVAE0VP0Kqng8rogLiPlgmdHLPomWbgciq1I34xnYMdqqPfepgWsETG+5iUO+rWQ8lX"; +moduleBuffer += "OvKUjKS2SieeeP3NZISo2bnaHeEfm9ALS7XdXLVdgBwjrb2L2rsLak/MmXhjkSQNLY/72Ga8Cr7BRg/hV33w6oeStRseHky7Ja6/"; +moduleBuffer += "jhHgYCP8XAE/7SAZQ5dttCyjyyAS3l3hRRQVSCTVQWsCM/xdOy2GfoUvOXr5Z5aqDhgPsq2Aqm4y/sOtBpZRXgOv/yOmVzX+GJYz"; +moduleBuffer += "dP0NwlSGMcTvsKYACE1hVhWSqgqURS+iW/gV5MQbo61D9iDuHqptoZJ7qbN1KYV4rSY1fljRULfwndo6ZLTRZcuQAa+Wlj5dwcU9"; +moduleBuffer += "xJCLqsoA690FGB8XRAq9YOiQHAVZWxRUcl6iAOxSJSgrHIB/x5rRyyUD3EzqyKkJ/ifJtwyl6dCpE0BMXK5ymSfpHnMznlSIC3hO"; +moduleBuffer += "eFL2DS7cTZlRS9luyoXSgIPLODw0AkxwhmWxjjaqljFlgpTBjgIdLRKkfsisbcX7MbMW4HrAhGlH3Ro1aw6ue7A/W7d+lYQjXR4l"; +moduleBuffer += "qumAnqCAy8NESjw7OplKhOzDXpia0jTYIM/r6HkdOr0jfBIoad2AgTXXOsyMMp6K4TtNtQ4035bQPGVbTdlWozk8d1b3EyjC3FmN"; +moduleBuffer += "/Z+qtHY15s4OrZzpo/R93EbKtqMRARCGH7PoHbHETrp0JzO8T/UBUNjouj58VhfXx5C8M5cKnAwHzNo2mYCIHME8Dh99hJLesSt8"; +moduleBuffer += "jvdeykDRfYji2YsuL6MKSRllKYPGrAyFC41Zn4T0lIyUcnU6VmUZ3CThahmgdenQblDrGAY5aoNEdduA/OuoWaIfBm1v4F7lEJN8"; +moduleBuffer += "NEhIjIDeOqK8WpWyFJAlIbQNoMNOUOAGVQVhboDpEVcu/caKYSNESZrUwozUVKjrI1RGlzLMjdP6MNWFTVQXaqoDObWB+N5IM4jp"; +moduleBuffer += "qJrREZWNPfhxs4kjj5nQKYruwtN0Gmg6dYVOHag0aLITUbbVmLYPs2fIDnRpnS5bUUQbB9TsxpFBWjOrAqX2YOCDkymUawv6cSXG"; +moduleBuffer += "tAPsSQZ1JWuQdXVWCtenhq+Mu4eNbeJwgPu/Q7VBI9YRf9PglQH7iu7gbfyObBu/A7sgr8HZeSgSOrC3+DN0saHv60BZt4EHQxvR"; +moduleBuffer += "AZXLNrqYUDJqcWPdR3dEK7+Az8X+r9xq/AcqfZ6/4ef7DNT7EKrLq9wOSIBPs+IOPWH1Sj2UcqkfHepDG/MdfRaAIUCFqOsshrby"; +moduleBuffer += "dayCQ2p4vSF+4FeiJirrCSp4I10CbGWtRAO76eJgjbJS1igr5XDZSrQMvhqY+a5kvQUMFVNuuVINaG65ElQ6kHHLlSDigZSImwfB"; +moduleBuffer += "DGSwBlKmmf7O02ul5p0DCUHfPGDcRtTACG4le4RnAMf4I0NvXEZAL5l+CRkXoTqppbDtSBGSs647H7Bu0ktkXbtalaYbLUI4rm3F"; +moduleBuffer += "zmNFuT+uYRqwM5z+DBjngKG7xSHcN1Gj+BNe0hHF+AwcS6TI7BwOCqXIbMbPo7ZZempPn+aa4fgm42PercY3gA9pqCY1ThwrDlmn"; +moduleBuffer += "/AypTeOePnzJb4Y3rOKi5wIv3DKUVkjgTiEHdwrNcMcC3Ck0Lz+MZGFORXms8wrPuljKhTVbXNPkyvPoW28h3jxghNRhyS80uaVO"; +moduleBuffer += "gpu4TraGSVwKbtIyqvTb22CkUOQlL/744ZN2UxoP8p45uSfczhO5n0w41lJxg5NfEvrzhPA8JjxVhXqWz1wyCunSIMSTXUgvRQ1M"; +moduleBuffer += "Z20xo/m2THS1Yb0bsoIiV7k2FlxmLo0Irk4FqUWS6vcRJFd1gqu1pZKqM8/UOiUT1aEzBUKdyZJa6tgpdexMJ1pn7OL39ka8SX53"; +moduleBuffer += "ho3kdyysRdKhIFXQc7kTc7mQzeVOzOVCOpfzZZfxQ9KJndKJSdmFZPa6qTjqZ3iNRP0yQP1YyMEEQ7ewP8FSmXjqZ/pNZnkCqGj6"; +moduleBuffer += "1tKpW2+dqsn05L5nB4RQGKYzmnl9Nt+hH8/zgiLz6RvTJRJJmGwxlXCAe9I5R+ybcvuN8J2+YlTbDbZM6yxPj2E3713oArr1wprY"; +moduleBuffer += "a7esV7t51QlLWFonBg1ZdaZcYDpo/jjP8tOBVJJdEl2lBb+b6Y+4vmzuHmar0xlDVpzjCG4SS/G27olIzhCnr+A2pMAHh9PPulz2"; +moduleBuffer += "Q4gDzcnugX4BCx1V4RUo/E2OctWpHyRiRxHwjmOd6WLvgAOljPN1o45m+qvigD7pYx21KuSb/RCWHHx3D4QbL1XHTFmqjrK+w2yw"; +moduleBuffer += "0zUpHtYJKdNFrsEhAtFYn+e0weIYKqvEcTO3MkYmmsQTyHSGlcanLGnYEa/BypJ89SjPOHyujcJfqyguHSZ+UdDY4feKHPJD1IbQ"; +moduleBuffer += "N33H357TWcTLMC27RSXhsIjww5cKmjhgf8aKj24cSrY4OLkjR8MdTQoZ2SykWU3hp5vHPacEmDNaND+arJM1/z1gEPIZt+kTLFSb"; +moduleBuffer += "PnNj0ydYV9L0GRav+U+RBEs+ha/eo5yAnUjP241wmlu3oyHfxin0rQkxSQUAfJwcQXEdmomKK9JMWFyTJuICYsqTVze0xlwwT96t"; +moduleBuffer += "Qzxzt8isXZ/NWpnOISBrN8Mt/aFuDuCUPuxIaQ7tmQk0y+1WG7UCrBsKsI0Zy+2GAmxjynLTjyUKMK7VxpTzplXLMZSAfmdOuaLf"; +moduleBuffer += "vo8k3grZKlohU56XHyTfWS22AjyE/h4yG5rIVwABTEEVOo2Ar5J6BQ+gSk3o1iSaTnyC7u6jFFN2Sv+23mftJrEP2u8O38xzoFt8"; +moduleBuffer += "adn04jd5DthSbVvmQK8ES+QIsi8V0E29CdHjweZ4TrlUKI4SUrJkqkxjT2TCYoZsxrOW7C1JFDguD3nRHdIsyYde7YVm9yFA5V4M"; +moduleBuffer += "2QrMZt3aXgzoCq0LGeIXdbyYz71YlU2iXlZQav7TK6pfammvtLRXD9AKCB3dSxFJBWvE+jnqoCie40OfUXzF0nWMsJNwzKPruT85"; +moduleBuffer += "S2VM0C1sOk7g1Q52DR3R3WmvsZ2kExzrbrdO47fDnpREwig86dIN8edl1LPf99DgSHTi3LviKGorVIwGe4oimukCGOFQmHNMFl0g"; +moduleBuffer += "C3js36p7LNLppOvlZ3or3ttUqd+eLkdbUCRbPM+U2d3VhSIEF11pFXxJl6vNINRN8TsRk/cb7eFJC/lPrxESLcWXYU5OvzMl0PWH"; +moduleBuffer += "70Io4I4F6aZ7GmmqUjzLRG8nuWCz4/Iv6KGJXrpSlY/A0PpYL1jvJZ3veL1RW6/3Dsq9OI0x7aTmTF6vbMQnMT5TU92b1E3hQ3IO"; +moduleBuffer += "f8DwJSoezHCpD14y3zLi/HyFo7hISvR8ZCL9tVITjYvvvsSgw8ZcN8Rz3pYhKw0LnXga5KLuEsPccs3V9rB0x3a1Eceop29VEnzr"; +moduleBuffer += "Uk1Ab1ITL62J11oTR2ripDVx0prQu5PKPQln8kPitiSrERVaHjCmHalUuW6dd6RW+hbXaaepXuV4cLs1AzVLV3zZZTel5+VpwiUC"; +moduleBuffer += "p/ldZg03D0pUCP/Ya8oyiVnAGUyd+AQArSQ7wp5X6ZvjDv4edsJPUxXiKQvURS8mPfw95dFrbagJy1CfQzHhBAXH9/LZOzctBcKv"; +moduleBuffer += "sbNrWCBOsjW032+dMmlG+GAPPoADnOdzHlmEe0lUSsktOWENnWacZdOyLM99KJ93psKXXPQSe5ZhRJe9cJJi/XjOTOOQFUTTOGfI"; +moduleBuffer += "Q6IBgTlq+EQJJkvMmBIrG3ZEA1uH5Dc/95sZsGFs+luY/YZf2CTTukOPpncnn9Y8bmOQzjsNqQKPuir30+AMgZuVkfucRdeZH8LW"; +moduleBuffer += "cIpuwdXO49XNzNUouXC1aYvvsRFjM29LhxJjF/7Qks/FdRIA3/ewn+cHMvKRA3tHphi+IfxuY8mbTBipaoiaTlIBs0ai6CNOx4Wz"; +moduleBuffer += "yQgJtE7eAkvMG0cMcYLXGW/iuJmdIl9tZvsjE8U9soQWROAngUq1zUdn3eq+k3dk6U7F5xF7/HEXITyghaG3LDrK8jkmQF5sbU9e"; +moduleBuffer += "8TKeep0WzW2IIHgH9sKxCP8dLwoqhjw5yVMXrxHDp4r8pJf/4O3h2yQBnlT6xJkHm4ralhW1A0V939ZPBMTSgjnlPU35XpPlAzhs"; +moduleBuffer += "C/8oeYRVRlt4Mvs+DCZ/K/l1Lv9rF4irJbGVJsbjnJXLO2o31XCMEAl8NsMtsydKJFt5wPPw1Uwpn6Ta6zOB4DB2UzXnmgu7zI9P"; +moduleBuffer += "FvXjt5ofn29+/Hbz4wvNj99pfvxu8+PfNz/O56ph7acXV3SrAvuOGDYEx3GCAgezA1jnmIi/xdlNPrNiBpzxDuGg0FaEH9S9x1qJ"; +moduleBuffer += "5BH2bBiZpqLnrWsXXaN+o7zIEWirJuYUML5guyaiZtn+Z0Oizmz7v8lEEKZBrLqAZa/oX2hurMI+WD4Nh7GlRGwQQMxmykoMAaAs"; +moduleBuffer += "LuPVOfhf19wFYiCefwncBZIA3OUCXm3abh11mKMcgd0ISw7C+0fw2zGbZQELFxOchbgxMZTve9YdsY8PnPAiLGTls2+CI+/Yf11P"; +moduleBuffer += "1Tcc+Y9YrD1gOLF9d8WWGJJmOAnhgRC4L8DeXq0X2elphnjOgqnVuJZZh0iyig/VzxsPVFClIy4cUT0GR1S6Yp3x3A+mCJ8ItwIz"; +moduleBuffer += "GnflOkZXqGqnhGPSVCHoaEu71Janqbvc8KAXw3vIKBWr4uPfp1K+iUP2atg4go6DKroznjWFE7pssf++IpqO0C5ltsNGpD8jswvl"; +moduleBuffer += "/dSZdBeUSqit0UkSuIQ4zcrtCb9ciFmhP2AUa8tT0AIjOmjlSKwuD//aU95GI6wtZ+xCVS7eXYFx3XKE5jn952d5+cb2BNQtXzd4"; +moduleBuffer += "r9VDMHF6iMdOS5jf9BgQwqvHR/CWWrkGLpCRDo1bw/EhQYhrOIIqXQraMnVNXASTaG/EWzmlWo44k2tEF75Gx1v1sABgjl4dMB4S"; +moduleBuffer += "K75CI1qOBI/IN2BuQihCUSco2BvCBnjG2RWt4mzLw3/gCFZ8qtHhF7/hxj8kKCR7LHgCMHJFWzpu74rWUklr0fDwT/zww6ZaG58A"; +moduleBuffer += "kIwvfZfo4RI3a2183mT9CiVcO2A8GLnhiz69vUpNXxtftPCX1jPydsB4A40GXQ5hc2Etb78DpQhq4C8pdxeV5bxp95uGjWnUY87S"; +moduleBuffer += "JsrYoo186gf5MOw2I6y0+LBF+DjhGikeXp4JksDPLqyQR1Fj9m5HVfvLAozngFrCyaISMzgS2vx6Esf16XUsYcJNm8+BimEffrMb"; +moduleBuffer += "CGNkxmt/+cQeXQq/2st7UCYvEdlFB3Gq8KtFot42fJaWOxxe2WVVzIsw0yQafINUbo6NP9q457BTtJa6HUtHeFdXjozJP5q7pftB"; +moduleBuffer += "O6vAn6kXlsebGwK8VnE/UM2/VqB79JFJhDrIdLoqvg2aMfTJqgFjB76+CtorRCeQ9Nw7ufQzgj0lw3lTclDrI1iZuuEwDsYk351i"; +moduleBuffer += "8x+cosFrk69mfIBog29XoS2oGXXHf6IxOQWi0VnnLAEwPn7JSoS9iJtgVlpdu1ILtJ8bgBvuV59JBkWg10xMrTdwgGIkgIY8pVCQ"; +moduleBuffer += "wYPotxmnwfOCyTWe/F5KwUo6TaFcRVMr8tBqxVo+xXSs4m0wgcNbGieiXLqcsGg9gSmFsfk4//KQrt4aPq6Rqx58cStvF06QMF2/"; +moduleBuffer += "gUqc5JEvYDKf58hW+wVCr5FaxYYrJpGy7W/qbYAZNrfsJOEJq0CGdcgUYJdX52N7QkDnTtjVQoWvbSsDYSACm++sWAvx8VFewIxi"; +moduleBuffer += "1X9ES7BjzkJ8POEswMfAvqZIuEXxMQkhBsMQzQk8hhra1voSkVacyp529O51HtTLUGlADblkJSD6YgaiIYZQhdoqjaZReS0vYFi2"; +moduleBuffer += "rBe70l2N8H/5dD1nQNBNCUdfJqIIHkAOMCeZQazrZVh93BFtG9k+Fm0d2XFQbSXKmxb14C0jpYPRlgP0fvSH9ltG6gcPKLodvVp4"; +moduleBuffer += "y0j3Qb4dvdL2lhH/4IED6pYR66B+QffVMUmH92vGODsJ4R1jBw4cYOvgZco+ScXeelBt429QYfbB6/vQttyHtuU+tG3hh8aFU2Jx"; +moduleBuffer += "B5xGq07xq/+S8Sb4vRH0tYz66QBsMo+CHXpsBs5aQ4QAoGQC0som7Dhsoq/d9O9u9jZKGDsOKfcYrvGx/yFyfxnPKjd8zpdj+MKL"; +moduleBuffer += "8EwPE6bwolFxgrkMWDxXxildBskaSo+FINVkhrprZIp9eg9ZhxFDhIj3kJlVHP3JxgHyjgadTw7y16Ro2M1jU+yzNtu7UuozJjFN"; +moduleBuffer += "uk6ZiHi2TJulnkEuv6GzuuFjPtL4fFYbd2X5BK3oMeHtR5lKtoBqtmQjtyUbuS1NI7dlxB9LRm7LSHc6cltG6ouQCOSt9IsfH/sH"; +moduleBuffer += "7hcWPMv4QEE8qMl7MD41n3Q8etfVq3X43qf5IHZ1R5nlOzLF9Ezhk1haevliNTzI8qbmMO9txNPfFm5eAxGN88hd+Ba9GmckdzPQ"; +moduleBuffer += "VU0lwo74YsSypIayHCEPpd9A04tC5pNXvthEavAidj9lhOhzww8XNNAT27o7dsHnSvjDooT/wKbuMz6lhmS6kQo7AJjGXG+RbEAN"; +moduleBuffer += "LTlvZF16LhuVRRJ0LX5As1azqFhDV7hr1T2JDeoQRyeZz4y7u6J2ytgeXzAaI/vB8Nph5KtvcXkNXb72lYvveffk5//47iHrZ+jx"; +moduleBuffer += "+3/17MeOfegtb58lfn0bPf/Pzx3+uxMnD/7vh3FAoh00/SBdLjPH2sazox3jlgru9njOSZ9whF37LKgV0gci7fZ4kpijoutVG16d"; +moduleBuffer += "2qFyry3XkYYk6Rd9ONpqjw9TF9JShO620cJfPh51ymejqnww8sN7sPVzziZW0M6SFbiZ1cjtDC1wRkc/nmK1V106sj2+xAhAyWNd"; +moduleBuffer += "EDVP7aREiGNdVmdSSjXJ7yc54Y+pVigbgRG4utamWhPeLhVWBczuQqJZh4CtyUShbzxIkF9ytEX2iKGb1hmZwHTRFu0Znn6gFxtH"; +moduleBuffer += "DLmpJze9yY1KblYlN93JTVdyEyY35eTGT24cusD2YS/Un3v2Rjty96/K3Q/n7m/N3W/P3d+Wu/+p3P3tufttuftb0vto617iP0/H"; +moduleBuffer += "3b9M8xjEt2f3yT3RFnZ2Qzzj+Wcmv7lv90m1I3GXz1XmBDxoMejXoQSvWpjA5wTP/NfLUy4lGF6YoMwJMCH2U4JbFyYIOcFj//Xt"; +moduleBuffer += "f0G1UtsXJuhCgpPRdnXbwt8Q5eqnEr//23M/rKIfbl/sB0U/bFvsh1764ZbFfqgzP8aj2rr36QYOOrbzErgdPqKJitf+clTFQfEK"; +moduleBuffer += "jsfUfHp/nH/FnrC8KyAtvzuVvsOcmuR3p9N3IPJT/O5M+s5BCn43lb7DxD3D786l72ha0/MEvz2evOVz+O1Yah7HlQDdMVwdgnm4"; +moduleBuffer += "uiT6cfUIEuJKS9bDuBJOGre4vKNc3rGsvDF5f4TfT2TvD+B9GyazPI9yOpKytqruxs00u5+OjZ/teWS7dYJ+HTnzvo//ztu/dmBm"; +moduleBuffer += "w5B1xgZbfOaLVx97z+Vv/x5x0VN48aGrzzzxncPnv/Df6MUJvHj2wPf+4lt/9Ow3Xj8ERUT7yHcee+z08ecPf/q2Iesonp//0G9P"; +moduleBuffer += "Pn7x/Sc+SYz2MDqJFbvMrFRbuAPRtcNvo0PHXWL/rvA5xUYpc/941liEk4QE2ae+Twv+aZfWAcPGIL0JB4xBeM8fUjo6XggWTqXH"; +moduleBuffer += "QzCJ3NEIpzy26TzKuv1QeFkoFjL0GpzUVAEt0t5VUDdiBS3S5yrDpRv5PRb7drIhNAFeG7/4QiqAXV5A/SL9rSVvRErzKvQXqQzC"; +moduleBuffer += "AuG/p7eTtohHaA5qVFgNMq5WJ5FHgrmmsBLWYk0MeWcSWRZi+yC5pbQyM/gRb++ht/tgyRjygac3QrCFSZpt9GNemoVN0ixskWZm"; +moduleBuffer += "Is3M9AGmpyzNKnSFNFtOV0izQEszSSrSLGQuv4ZmaSjSLNTSLNTSLNTSbCfsWUn2FOjNeYZFgQiekKVZKtxClmbQzeiBu8TCrSKP"; +moduleBuffer += "a2Acrtf7SYmQZkEizZYn0mxNIs10ThPSzNTSTGptKxW+WiqsGKvaCQ3iNL74X8A3HqwFOodIs/D/l2YszU5GQ6kgS8RXs/R61YK3"; +moduleBuffer += "EFmJoFJDC0TVvqXF1PbFckE83bbYD02yaWgp2TS0lGwaWko2DV1bNoUsm0KWTUEqm5Zr2RSybApZNi3Xsilk2RSybFquZVPIsilk"; +moduleBuffer += "2bRcy6aQZVPIsmm5lk0hy6aQZdNyLZtClk0hy6blWjYR12TZFLJsWp7KplDLplDLplDLplDLplDLplDLplDLJpR3lMs7lpU3Ju+P"; +moduleBuffer += "8PuJ7P0BvIdsWp7KphCzSmRTqGVTkMkmMLXHia29Yx+LJnocO0yPj9ksmIjPfQ1M7z0miyV6/KPv09B8aD9LJXp8+qWX/v6lkyYL"; +moduleBuffer += "JXp898dfemL0fb/OIikUkRRqkXSrqotIChORxMyKeUE8//1MJOXYQZ3Q8cz/nRdJtRZFX40VfaCMuqoNGEf1UswBU7uR2NYw23zJ"; +moduleBuffer += "ekieoGFTNUkM0fYQQfFLz6dKtNVQ9QLfs9x50WcbGCoRy/0a1Gf6pYEQ1DXovKiNdH3wTbuVySqxmlaJrRYdM332LyH7TFrzqVWK"; +moduleBuffer += "lmDUGuin2Z2LWg0N1yq1uknDtVor+W5Ga1nXwwvJIJDN4iN8RHQ92xak+8NHnSFRYSU7OHOs/2rawbl5O+/Vi55L7+CwLgz6L97+"; +moduleBuffer += "OWaL/mta9F/rW/eGtcbLwm5M3n4BOssJVxs/n3tpKvUGqq1aBozj9di5K3KSg8/28fqQPdanSvGlPvR3KR7rw9bRaRtWL5f78PeF"; +moduleBuffer += "vvAPYfpns/Od8L1uIMecKdnbYAxzvNaQmyO9fOPcWcHTVBnOBWdSkzk+Zz1dHLJP45j02Np0Wwhy6sqH0x2hEnaCRtfK9QqUn1en"; +moduleBuffer += "6EcvfMkk+tqsBvkmfvNZeungvqReze01VA+io+BI9qufhuXFpbIc557DB6kOF/k5Nu6GI5VZfYT7gk40oxPx0W5DjnbHl7obNdu+"; +moduleBuffer += "Q6xxam7OHQ7UpHJM3QyPOHJIyon4rLrb5A0BPib5ABUfVqZs2ujKFTeD6Wll+GMYkwNsVpkd3sELTmLFFfCpKzlIPNudHQI3wxMu"; +moduleBuffer += "nyAuw7uDLwMTH0TflNA32sESjh+XGcNQqqI4WePoun5yPFus63E0O8ZJazN8zmKnETX2HeGIsyi+L8djJz9qhO/1DfYYARnmsd5G"; +moduleBuffer += "usMF/0QER1tcSTiZx4jU3ROs+k2pq3LDL8GgizCKC3LpQ7fOdUukUiabeK6vwS6Z8nQ02z1kT/fBwxfb9872aZKUs/591C8gjHi6"; +moduleBuffer += "jw0nUMos3SZfCoT2p9ZQzu742BnqrQ0yxvFhPIwSwYlLn2unm/9Ikq4t/CI25H+nqHpq1EroojnrTBlZdeXsxKpLT68za+Tw9yLT"; +moduleBuffer += "a7rYCB8v4u5MMfFJIv1r6DGWLU6et+F3fbEyk5vxClSFtVvw/bFKbZvQ87E6pv+RKg1oSeU10P9Eiufj9D3l/L+geJ6EjCDmU6EO"; +moduleBuffer += "bmi1cwlWcXUoWeGSNGywq0UiokN/RgP2jx66vUumRUizYr8y2P+gIV5eNY2aLP6giXZymmjiXFVokdnOLiZI8GeiEKWBghGt1kTz"; +moduleBuffer += "Ewud53w96EamiaaBvCFfxgldBk1X1kSXUJMjVeKAiSb6VF2Y04k6N+34chhL1lH/Y/WaNJeGn8RKXb4mRbOLrEwTTalf7I6Y8q50"; +moduleBuffer += "QxNd0i65XgSBwsUkZ7WhiS6Jk8wK91FZPkGSoBsRQv/pNNHUJJMnK/rFjy99ONNEi4CCjEgMKuk2PvGnSe+LtWQqQ2SqZPsxnNFE"; +moduleBuffer += "lvGzSZbfYl7zqXJiuUxN3GRMl281IQ/rxnNi6luKP1NuxK+SUk+XMS3p5gnmSa9K7DGNt/Wxh9zL7FCXRCi++4x7Z8VeGY9Der1g"; +moduleBuffer += "0CQPghpi4sIJ3A3iAOUGpXncVB388QbxxHODINgb2MvKEz7d0CDydSM/b5Kd/E3UKibU3ewv8Aa93N8E24FNsB3YJO5Vftoy95v/"; +moduleBuffer += "idax8CwNM9/wvSVWI8ALO8ffYg9+4fqaDY9kRLXr2NOn9tKG0y5B3RC3ZnWIsBZvneLvDO6wDnns7U9szsQVH7NsSxwdwY3oS57i"; +moduleBuffer += "wIvsdpFNYcRBoAk/ZlYc7hYXjYqvMIl+a1H8eYZP2frmXXawSVx0IuBv4rAvcrSTu4chcOMrTAe29issPgjFG6cfWQ9HElo+cUfH"; +moduleBuffer += "hhY4Qw7nbdZOuFwM1huxzpI4mKUBjdgubhcCtFLf340BuKcn2LakG9T5Mx8l5CJOB+foPvxC6v/02q2eNhdptXbxqhLPdgaOP5ri"; +moduleBuffer += "Mc+Mj35YPOaZIwRBQ+3GmJ3iwU2rHn6U9BmzYohrpxPvPWfE3Cnd4oe0Ik65ORH8qlrBQccs7E8hgrgh1Y5Ji4ljUq/ZManHjkmV"; +moduleBuffer += "WM/4cEyq7XW1Y1JPLGMsnOHkex/t8EBoXZSwq1HzWxyNBs2ORouZk09iDOEPX5mbUT/v4tPPuxktIlzJdbkZbanBi6/MyejiNWj6"; +moduleBuffer += "/DWcjPqtTkaL2fG+osw2cTLqiZNRsSYSJ6OFViejhZyTUU/8CePsEmM+xn8augWbW2lciG7yt4i5tQuBT9B9jsCXyDFzNMsxdbQp"; +moduleBuffer += "x5JuPxOPn2i+OI1nt59bFnF5DGMv9rfJ3qLLvFYAsNKfuCX5RCTTlF2gxhcvwh+4K96v4TubQYTBLrSp25ZqytjY2XR2X3nr2XxT"; +moduleBuffer += "BohBxQVxBolVJokr914OTfgI3FdjUYDDIHERC83gzWary+FNpoPDNZY+luFbd3D7InvAcO9MXBgIFyhDZB8vCm/XpxV5fofhN5i9"; +moduleBuffer += "SyLWEQa8NS3+AQzOFiQ1/vHr8P4frQ7v/0nW4ekfrQ5PZ3VYitDPZ2M9cf7sAk7ONGVnNEWCKCUoOyUoWxPU9ytWcb8DT6Bz2srQ"; +moduleBuffer += "5NUlNqjtfEBTi/2V12H5+Drt95ykbuDw0dR65Mtrl1/7sAXOIqE255AFHE32eP47VPuP4zDciPnzFROq5fCTHu/Ih48VygEsIVjE"; +moduleBuffer += "uyziUXaNIxT5ARvZOq91ZBCI8Yh3cMzYIn8pqBUUjnEXwk/ZIPuqZdl8EmQCpx3kQ3Z8nHXfzHri0e8mtQk/aKEubGtn99uzVq0M"; +moduleBuffer += "BQ8r6/g6Y9Fyshx+DsEexKoLOqFCeNVD/BOPKs+N4K+Ufbx5q5s2C2ERpVkWN8sSx24W+xkn6A0DJhsW4rBpsB9VBQKgu6hWvxZV"; +moduleBuffer += "no6C8C9hjwd0Zyk8UEfYdWLmke4O+DKBvUqDD7fA4QQfGH1jQBzAIRRIgITKtHSZ3LAjJh+VfIO4MufybqNqBcnAoRQMHIJdR6Xw"; +moduleBuffer += "PKo3bTZiK/wU+hBW1PzKbnDgLviHRMCiEp/VZFM5U76itwLCjyHq/bx+v0O/pq+8aCO6EO7m7ciledMTLUZyKoi9X4mse3mvxJXp"; +moduleBuffer += "ZYv3WCu+PE+j+C1HBprthtl1FgFCiXty3Gr5LLsGpIxXWjOG+NNFGanGox6++urdd1YKeMtHbdyd6Bv4fnLx7hgGka7HnYDHrUaw"; +moduleBuffer += "Z1fNVZWRV7+l1jZiqMpe3CHQnwn9iKlcOICvKgtrmLJqGzvAhx2QCzbYlYO1Ku+X0DembFCOdFp4yucQs3rQm0ZIlWhUdmFdDTFV"; +moduleBuffer += "klE186OKc0av5Sg4V0xYW8pI6kMvRvgJV9SbTH9OPPld6RPuw0HYaONmGxZe4ZctPZkcsUpdmXauQ1Pjg5ZUOzlE47IZKSzwpeJO"; +moduleBuffer += "VnFNoFI33F62o2L68zmbJjS63KZ5Gqhi+D+hBbOkr484UtAdQj1S0hW7JhFudDNoSaObYUr5dfzZqPlCEmdONfRMKMUzSP68ww5T"; +moduleBuffer += "KKXCn15dMSdfMSepGGoevt1ib2rJR+d0Kbqq3fizKl/p/c2V1qUcF+KUOTLNqoIpO6VVjP+oV7YwTLA09cFYpN+LkpLK5rRFQmef"; +moduleBuffer += "1NTMB3hljCk3h5DQafQ0zB6JsSBbkkErqYxAYHTqFxveeo+wX2xD/GKX6XLx98+Nzq2CJ0mk6uYDPcTk0Q/A/hlfBBd0gngcv4wV"; +moduleBuffer += "aSE6kdzlJijVO2k10xEx14APfo1LdwiZ5vqGOgutkzZgwtpaaW6kNl4rqQ6jEDBzWJ8GG3gNda+4BKe+fx+HHcEia5decPJMxtps"; +moduleBuffer += "KWF88TeeNeI2Ecbn6b4FeOmVYQIKJRJx+G9Y/sq60NLrwiXKP/yBZ1Nhf+ADTeVvQS8P8gzTjWOP6vH4FyjLkc8/y7713xCOS/Rj"; +moduleBuffer += "JAiGjLzXdW2czi7X4/GLlGv6ryXXlBl+lsPeSZKlKvfMRLamvPzepjXlJvqSOHb29dESk6NkxOVhw4812gEhxVZwje5982T2hePP"; +moduleBuffer += "NH1hPa9atef+CGsHyvc6Wg2j4Dfuagviq5+nDJ/1jGBjWrgQMAeUMuMD36PCg/CPSGyEf+DwEV0q96RtO/vNPYnndl7Us8d50SUk"; +moduleBuffer += "ntwjSxw4OqKx6Hf2KX1biLyfMfi/uY/+IoIZyykU/GdY+5T3zuTXn/73OCE6SX3BdgT83/78vXJ7lPczkvVrP/1gzwiiKHr/Z8+Q"; +moduleBuffer += "7Y+Y7ogRsGcvgZm+wCoTDocLI8a/riT+by12mW/B+e3U18X5LTtcFhjoSoQA7VOex6wwMmq9XpY6w0Y3rMzYx33eMz4KShznbxLV"; +moduleBuffer += "BVyRwFv+5U9OGeIt32Jv+fEybMwa8XKE8EB68IUml/mKNTIYlfCExyTda7DfXCGSwm2GGRsBnxQx5cSSg9WXna3UmuMlsOrlKtY1"; +moduleBuffer += "mfT/QJq+bpr7QCknlX1SmSf1DrsjQcCoaOzf7KL1UNCfm17hZbNp4shsS2bVQNOsCt/t56MYJJMsnUtbjGRWMEW8ViiYuMKUDhcj"; +moduleBuffer += "3FVYK0+XYIdoTagOAwbvl0msJOhNfuv95zh3qjeR0Dh8vN8MTjlpNAlPVCaFRGXiQGWSBUkqQDlS0LGSRDniindGVo7wPStHXFGO"; +moduleBuffer += "YFeIT27P5ZQjBdE3wO0zRyUKHwFmO26K8uAYTuiyogIUd4K65rApHPA4HybS2hH4GqC/R1MPilY8w28O595M85tD2RveQjcRAqPf"; +moduleBuffer += "OmCywTwJ8PDxkizG8UUcd3zeblKmQK+Uq+7uluoazdW9auSre7GpugcWVPeq0VrdF41Fq/twWts3U23Tqv6t3aR4MVld67TsZln6"; +moduleBuffer += "nI0rChaPvWSKgsVrVbB4OQWLDtiUHe6C7kufOA9+1zX9ZkWbtwTVeKAa7/qpBnVkynG0NbatKceTtcIxtkyiPkDAHpvHwmJsbXKo"; +moduleBuffer += "O5b4GAkhFRuFbtQrV/HjyyffbCinP2Tpo3Qiez/DJ6yc8AmsEf6eHkoKUWDkuQrdma9K4RQVGT8BYEzrwbPJiTj8RvCuFF7Ez3JQ"; +moduleBuffer += "pSgQQoCjFx4vaOyXwMVwhiu+SurfLU43sub9Q2vzjHzzLjY3b2aR5n148eb90Mk1TzXkeZHmhT/w04b9ZkvDZnTDwrRhfn49JA0r"; +moduleBuffer += "S839HF1aObq0tfNfN1H8uden+HOvpfj7LyWzvD91FpFX7ftpoBIOVFyGrLEkvJoBaWMRzWmrQshvYqNvhWE3XQ/CJI6ujwGH03XU"; +moduleBuffer += "5mCVAtVgtaO3cUzlDxv3YAUxbOyETBw2/hWOAAwb9+bdWZz7koT7SdSgHH9LJh88KVP783vc5TTQnLhOhzeAPNDmrYScV3NDezU3"; +moduleBuffer += "GKuIjsdnxQ4tzR9lqcAfvPsRnPaByJOIPcpPLDsj1gOFCE4HhJ56ljK026iQw1KibDFxspMG8N4jl12Rb8iyxYlYwPpwm46TDmZD"; +moduleBuffer += "Psjeqm2cNjJoQdK2GxtbTBcwV/gVdtXpBEmJOHtDdHhVTHwMIQFTogc0x5sraP/qehNf+BV0aRwEmq9H9HVcX8dwrWy3RnGtIsiH"; +moduleBuffer += "Gc9+BKP0qLx4I45v84uH5cVDdDnFLx7kAzTPGXxKiO8/hfvDcv9J3B+S+2ncH8A9Zdsj0OmELRsjx+k6MknDO28MWRN4wFirIesI"; +moduleBuffer += "EtCsGbclwyGdYSzJMEcZRnMZrliSYd6SDC9YkuGypTPMUIY5K8swqzPM6AzndYbpJAOc9U/lMpzWGSZ55UNt0BmOI80EpRkcgoWa"; +moduleBuffer += "OfJm3QSdflynP6TTjyXpKc1oLv0VU7fAlPQvmLoFpk5PU2DOzNLP6vQzOv15nX4aaej3qVza0zrtJB8lR6AevtyHVdpfYjhfIy8e"; +moduleBuffer += "4BGbBKn+At9ewuDdTzfnCb39hZmE9mLzYWyFYafTYvVTFoiG4Bjr9rtrZVnNWNA3WFkUGhbtXUDOFpcRH/9z4iS/74hQr8SG5Dew"; +moduleBuffer += "BevKcsfFpg7sVSrCSXU0rkHNSIWbskhlGatd1gQn1lmD+y29XAlbBHYh2RlzEd1JRLjNIjxMPIX7jdpW4vS/59SwYpgpMS9Ltb77"; +moduleBuffer += "s6tsfnng8MdKwBo06xCnbqYAvlII387hJmcKUQG6XDhbKdJlttAQd/EI4RB+hKHGhULk6rR+EoDAWilbcLMFGkJd/AlcaciOl5hD"; +moduleBuffer += "JJlrSWYni16Q5j2j854uSVVPoYrTJZgTTZaS0fHASY+XCHmV4J+okHBkOHYowe2gJUdwEJownio1ojbs5sDGqFYWY6QKdrPiU/RT"; +moduleBuffer += "J/8E1FfjJEatSwLZLIsnPjvFIU6XYxexPfFmVwrPF6F6upOP3o8GOL79pwSMwhFot+lvlf+2898V/Leb/94gyeluZXrXk96tSu9W"; +moduleBuffer += "p3dr0ru16Z1K72rpXZTe3Zje9aZ3N6V369K7vvSunt71p3fr07sN6d3G9G4gvbs5vduU3g2md5vTuy2IfCr3w8bfA61vGTa+i+vm"; +moduleBuffer += "YeM7uA4SM8F107DxbVxvHjaex3Vg2PgWrhuHjcu4bhg2vonr+mHj73DtHza+gWt92LiEa9+w8be4rhs2/gbXm4aNr+PaO2zM4Xrj"; +moduleBuffer += "sPE1XKNh46u41oaN/46rGjYu4rp22PgKrmuGjb/GdfWw8WVcVw0bs7j2DBtfwnXlsPFFXG8YNr6Aa/ewcQHXFcPG53FtHzY+h2t1"; +moduleBuffer += "2PgsrgQ/ZgrcC5hufjz9FLGTL2MP9ocuzOxVOfwbcBI/nmfA4iCaEQjpzXjrhIdLnPkcYcP27dZFKWoiQKwY/sx2i6tHE4c+007F"; +moduleBuffer += "fgAnJ3GGtsrfgnbjHvx5TfgRlFjSc8SJLxewHLqc+gd04rmCOEzK3szym8yHoAPkcd+QjSaxD84Sqh5+hoCi6lLL1PLwq6jfOBtu"; +moduleBuffer += "yod8PtEhn8SeAjavzfDjRZwReXLKSKszWcXOSVXKknbHM4RlS9iNsTi2nn0lhJL65JA9TzfxgXZ2shnPh41wDCsYdOaUHys091B7"; +moduleBuffer += "hJjA6rU9Nd9GEANfPGZgFNLypyrsBaFujbVLnvDfJTNbapTW7nSFOyvkiAHcNZP8Zi735ji/mc3eUGcZM3CjWYEbUeI0UhbVG5KK"; +moduleBuffer += "BxU2uHaAjx8gviFVpN/jq0/p/WSpHDygiP8xnPyNaLQPtcsmA4ISx4feRR2pwvMuPEyK5egUQmWY2u5zvF38dBB7G3cjNwsQVZB1"; +moduleBuffer += "cpFWrsw4+63Dbm0bvCynrHTMxVEjWglrEijAcQr9ncq9ucJxiU9nb6gke9KicXJUoEsnpm8xknHUtiHrnCVuBLqRcZYzRtvSrDMW"; +moduleBuffer += "Ii6EEnNvmwQGuoW9Bnai59rwhwMLUSupJgW9Jh4vJW27qwIAPu5ClAW6cV58yIVYONosTQ6XhqwD2OWDFzQ/7QqWRaNuHvYbWbCk"; +moduleBuffer += "kNEs7Pu1Typ2k6eXBvISi7y2xEUyJsk7SnrJK+EN3fAIrZ+w48a7YXMSepuDOYOUG0l8+VI4XoycOysSdEtWr22y6AO4R7x7cdTP"; +moduleBuffer += "h5TDMY/fYJZBG/Fdmx/9+LzVkKJc9lbkSlgAcVEMgVbE4Gu3u9iSy/xGm0FGVewPl6NMsJuEFM8TSdTYSoTIh4U8kZmTkRkL+SMu"; +moduleBuffer += "8yru2AsFEfIz4mtXBeFbOc0qyd1dky9gK9kNvwXNJz9ik3ZJGPN4BmOcZhgjx82uDWPcHwfGeD8WjBl3EgobtQXGSIVfEYyZMhfC"; +moduleBuffer += "mMM5GDNfzWDMczkYM19MYUzMMCZmGBMzjIkZxsQMY2KGMZSc7lamdz3p3ar0bnV6tya9W5veqfSult5F6d2N6V1vendTercuvetL"; +moduleBuffer += "7+rpXX96tz6925DebUzvBtK7m9O7TendYHq3Ob0TGMP3BCM8gTFf9QTG/HdPYMxFT2DMVzyBMX/tCYz5sicwZtYTGPMlT2DMFz2B"; +moduleBuffer += "MV/wBMZc8ATGfN4TGPM5T2DMZz2BMTOewJjPeAJj/soTGPNpT2DMeU9gzHOewJhPeQJjPukJjJn2BMZ8whMY83FPYMzHPIEx5zyB"; +moduleBuffer += "MR/1BMY86wmMOesJjJnyuBcQzcmPj78tgTE/SGDM1xeFMY8tBmPOS1HjJYIx/FmCMVw9sHSPYcwfZDAG31oIY2SOkLz1WmHMjNcK"; +moduleBuffer += "Y6a9xWEMmpSDMZ/OYMx37BTGyIfyMAYnlwTGfAJyffw300OuJDYrAmM+nYMxgDaAMdMaxsxWNYyZoZv4UlXgxkx1ERjzQnVxGINR"; +moduleBuffer += "SMsnOCgw5nJV8oT/VnpX6pPWbYzfTFczyDLKb6Zyb64U8eZ0tQnETFZJlBcZFtAkIF4j5VHNFwEyl6oJkKHf44tvy4AMVW8hkHmh"; +moduleBuffer += "mgMyL7yNgcxzOSAzaeaAzHw1BTLzViuQYZfmGsa8aDGMgUuNlJtetiDX6hlsmeMXKnsxa4lL/zyMIfw2YzGKQeGCYs6YgmJOmTkU"; +moduleBuffer += "M222oJgp8zpRDDWxAO/0gmJGixmKKeRQjLTNY3fVhGWKTcLkQHHIetHOoRidGsXP2z86ipk3WlDMb5dEgZuAmCecHIgZvC4MMygQ"; +moduleBuffer += "JnEe1wRhYLmagzCTZg7C4AznPx2Embd/DAjjZxAmcTacQJhSM4TxAwERAZLFx0pigovEd/JoT/AbWAp58fFS4pXKgxNEQTOaNjHq"; +moduleBuffer += "tAxjz4ce6/xBKOFvch26ai584y/5ITv7kJ37kPmyH2r6ikNDgBIDtVV6dKtsIhAkK6FPO6QzQo6uBE/1OMprsKNCc3fk8CZCyJ7I"; +moduleBuffer += "HN5E6JChCKEyC6EyC+ucJUxsPuI/YGMEM4axjbb6wH1i9mEqq6GPGlzbPiRJyIU+pgsdzRU6urDQ/wubufAK9pFCxFsrVmaDbUNp"; +moduleBuffer += "CMqL/+DcOWPAMFZyyk/7kUWEyUFHvwErGQsbvD52/x47yxvxlsQowr72iDo4YrMH6cymIjXSL2tV7xQHQJGjteEP4BQrtanI7avI"; +moduleBuffer += "BnfEBnvJbrfegw9+TXaWxUW9nL5w5BifK6awsjPDVgEWhtXHxpdYGxjY97fEcUS6w0oV+Qp3c3Iig/3um+EHi2wXe9XTzueDgYW2"; +moduleBuffer += "1kj3tJ2ztX68kJiJHDNNt8VAIDloKDDWgIWhC2s+mv41qoc41marbyuw9ksMZZjrKWvXaxGgXI5iwEzpXnpUTlKDz5l8vBKGlmzL"; +moduleBuffer += "achJgjQijj43mVklPF5IrBI2tHQ8iptD4NbRhYdUrndYv5RGNc5K19YsbPyqLFh6GYnPa927TMpnDSHlKSMjZZxaaiHl9drI5zrs"; +moduleBuffer += "e/qpCpbsLYXvLOE0lxE+KVdsmdKfVXfBdMEU03sTG0eWBHS04r74whc/qg8QG9KlciyOJ+kSR14sDvoTfsZMKGF2vbVMLJ0pbZfo"; +moduleBuffer += "yW3oyWXLDT5AbGjBcVBdW5E8a8th+TIOgK6Se97P5qP7XZSwSyI1TBRSrbmyIUN4JtgyL7AvL0bjo66QxFVHrlf4Sl3PQZtZewA1"; +moduleBuffer += "cqHl2JLDOwj04xWHlnDZfqCFGEkcutniCcQnm3Ci1dW7xkIg3fr4hx2+A2cIqW+75XAwi3A3E+G2DtqM8MZmvDmN2IzK1+SsLv12"; +moduleBuffer += "QyPeHF4u1kp03wV7Q96nMFUJs9rEwQ9YbrH1ZRo8xxT7yrTmpj4t282G8OgoqmCtJJxD9rrbGrUyw4EiwnqUqO6IElaNTTixZX/A"; +moduleBuffer += "PIvYxp0fK9kjgQMTLZAQzdinJLG/+WE4VtwsW+t+Lh5zCfGYi8Jv2JQhiYBDLReny+iSGQ0zLB2QuQBeXZbdSObi+YDMBeZFjA4y"; +moduleBuffer += "vIChCX+b7fsHNUa7AOtQKAEsonaN1UytBLCwX74RtINxZXrp1d5sKokTdd7BAe8vS+g8XyKs0+q+g23U5Pgebzmhc+dtdoSOxXts"; +moduleBuffer += "vY4PLUymNgTdjRFtrhKmd35yl7xQjXj+mWSZIhMntbsqxQBa8ak/Fqqx41WNKNA+22FH7w9ZXfqLMB7Bmc8uMaBjhhkVdt0rJ7t1"; +moduleBuffer += "SRg9/mSNRp1Plpqv7Yk6Ydpc4EPukg3Oph6G0gLGA7Vl1h3w9sb0rQlfAxBsl3Hj0mctfJNntsTG3TJVTcE+fwxlAwgDR9aKchS3"; +moduleBuffer += "XXUC6JXYGTxSEQQiYsL5HsbMMGbmyH+uDiXvM7rTpOVjAnTxpJP9bisNOL/5YeIYfrwDpftQ0NU4wAGiPPhob2etmOzOwRKaAyaw"; +moduleBuffer += "QZkq7axYxI85sa299mkvATg9yt1E0wGn78VsUAV3VXQwCl/2RDk6IpShMIqqFWUCypm34O4KB5mkMdlFSX9JFV9LANDiNQIVzLEs"; +moduleBuffer += "WNw7EoCJiP19Ppt8oVzoKIuyQtNykL5+N+xiXO0X6E5x6wdu6iasa/xZTWswN5AmRKW0EVwErxDH2dxOZUvU01Yjnv3YFIdj6daK"; +moduleBuffer += "dno1o1/doDXt9Gpav1opr6b0Y8+QPWFhsU9LOV0A7Lp0Rhh0SQbVw+ZbUOaVYBODPpNBcThQGMqAAvW/YIENvRyRWfg83s6x0TaH"; +moduleBuffer += "ySZk/3OMZ9GOItb8UG+74a+zNVhKiqAIGSUTeNtNP1JVOK//Vv0tVQ2/6eiCi3Qra06ZISaOJGBEdtUs7vWAHcnyp9nbrF5WYye0"; +moduleBuffer += "V1yrx4/5t5ocWs1nuQzv1XAWS0uqd/jstwShHx7zWhK1SRqqm0+8PHy/D2uQabMCayCn3zSGTINXvPDYjEmavOGDjCCR9A0HCgdR"; +moduleBuffer += "6TeIvBEtU+14tA0J69GugvQRoa5peulHWszhLtS2isKtxFtMEnomcb8eDzIY+lSBfRDjT5lhRjwYXzr7LJ/VDjSG46bBy++lAiOn"; +moduleBuffer += "aIUKBoxx9ne8j6PYU1Lu0tRSV1XlrM6geDgvDhum2LhWxa37Dk29YuwqBv5gG9xrkFhz7IemoMdKD1iRgdrmBpsRcEQRZm3E+pbn"; +moduleBuffer += "+V57nuktSx9YKuuCQBvC6BpMI5t38ZlsBDXsjCc/REz9/Q77oTDjiQ8l/lyodp+EZWpZDIrLWJhwoxb9gSOjgD2eLUhcYJOIBi/n"; +moduleBuffer += "2dZCL9zaqJ8qA8YRjgUDuMMe0enPhNnINV1QZlvsbU/d5FS0px0Sn1dYSLNzdBgjXLAasr2Q77s2mjTvKOSxNIeBHISNmylI3tMx"; +moduleBuffer += "9liaG2KTl+Bq2WgwZaMBSXsh3mUlPMvfO+AmgIeVK1cd1gHpZTaxk3SZbaa55RD8PzN2xJmFVuw4/kqw49eNpcHj141/OvQ4n5pK"; +moduleBuffer += "tsLH8VcOH6miefz4dYMB5NeNJRGkONZdGkKOmj8RCPmOl4WQxrUhJM52XhNCklxcCkJipdMCIaesVwohR08lG/aLQMgp62UhJL54"; +moduleBuffer += "HRByyrpuCDll/eQhZLLznUJI7Aiz9/aXh5BTVjOEnLKuB0JKqhJINY8h56yfGIbkfroWhkTzrhNDTlk5DMkFXwNDotxXgiHnigkL"; +moduleBuffer += "m/ioJjaNIelLi2JIwCXGkImtxqyzAEPOOAsw5LRzLQw5BSAGswZdwLyTYsjLTh5DzjmLY8ipgmDIOUdjSJiopRhy1BUMOeVkGFJg"; +moduleBuffer += "32cSDPl2k0FkSowCIqesJhCJr+RAJNzwaRCJkhMQyaSbgUiaha0gUr6Sgsi54tIgchYEiriSLwciKU0ziJy1/jlB5KSbgcg5YzEU"; +moduleBuffer += "OcfgzVgER84ZC4HkmC1A8hsFzqWR5ITVhCS5XxcgyTcsgSThf5ZzpFBy0tVQkvoOogt0I1AS6fSwCZT8uvHjYEldUoIlhRtYVOh1"; +moduleBuffer += "gskvW0uAyYU/CJgkRtkKJicKC8HkcasVTGI5mDV+UTA547wcmMz1HsDk4YVgkuggjyb9a6LJsohyP0GT72DHii+DJpugpJNASQIJ"; +moduleBuffer += "MTvOCdltkmgsYc8ivRNK0i7eJcFpHV91xazZxZ6KxXsqXVAuK4v3VEIRMQiPx1Hx8Mfn8He9RvD0Bqtzv7mEBbKdWCA7sEBuMTxe"; +moduleBuffer += "JobHhWYVauv/crCMz1RMAudiIUS0qy115iw2N55y4f/Yw+4syXO9ZqZ5JdY2lyzZTpsjSJTbFMWryxb2lM642t7GlQ+d0iZbsj/p"; +moduleBuffer += "QCZVeBsD8DhhAUxLssEJtVyZJzT7UeQTTnhXYoFMTYVx9YSdRMKEzwogMSvxcz1nZMdnsPXJsythMSthgG3fwdYIdzEugZfnKqcJ"; +moduleBuffer += "LzrYPLM4AOqkJcdAsXFZ6xRwxU4iEY1n2oy6ho2ChQh2nKqTGMa0VpgoOQFaDoN045XrNIUTW96wcRouL1xu7hmL0cxp6C3iz0Cr"; +moduleBuffer += "cp5m8CmHg8oVuQUsWSRF+D9s1Ow0T0C6+TMRbPmsV2xJDxHSQJo/t0R+QPfFXMOt01dxzEi28OUrTsDGkKDLQCALxw0iiWGKV4Kw"; +moduleBuffer += "oZvHO+dO+HeeDiKEtOVspvs46IMtaz5xQ0WVdFGOYNKwkWcSDjuiy3KX9KLT5p0sax8csma5y2nuEVNylzm3P2IxKy8nubGIdGUD"; +moduleBuffer += "AWd4l0soXjs+gwBdhIPjo8xmlj9NE7QCf7dTk4Rrpie5/7CJXciZbBZAqhLfFhwbRBn+uQUqQlC9UE7bzTlynIwkn68Ziw1UEpXZ"; +moduleBuffer += "e0JUSl8SamH/AoONTaZBXJbBuEWQZtZBee0xW4HRkilfJz7zhsUtXTaZHbUqcfuizu8jHJIuPHcMiTH+rANjBxvwSyr+ZvavMQu3"; +moduleBuffer += "CbwXd3eFz55dxI5jc6MT0sNng8V/NeXYkd6Nl2J8ObE05/Dqmo9LXcGVnl908jX5gCsdOMvygG6+jErZsFawF7S9gD560RkS49Jp"; +moduleBuffer += "HsarTt7PvoyuHtgCjpadRz2D7eZ7ca3eak4kQ0np/5JLqPMQGHjxIX4hZif84oP8ojt9wZQ0ZLzf0n1y0Vm8UyjTi47euY+tZsJa"; +moduleBuffer += "LD2oapQRRSUVXXNWjbnxhJtZnYiqg3rIeQTtfYRaK6YnF1menXCbTE+OuUO0mBUuzHLNhkqgnWSoMHMP8bHnUOaBgjhmw3k+8GFn"; +moduleBuffer += "gDpOJk8mMnAYztxVtUyO7nxnhcfExfrflOOJDAq1Komjq7nChSzWECyRwgo4ZCCWOEiRKahXymRbNFfA29q8BCljwXnOInBE12mr"; +moduleBuffer += "VoE4aZdmlDnYQRA+V0TYtXJ4HleOvFYFTvRhLKaVivBVUmxwDnma5bN9JW1aBiKI4JafDeSJygL82iaLA1jB2/HFgFMQJ62E/06x"; +moduleBuffer += "V6N5qmei0LmccA4a2YCAMV0vBVS3/+009TKOhYoskUkXObR8pHlOUDt8L8/SMTgmkAie435USgpSDq/Uff7+eZedz/yJP2yA9VwO"; +moduleBuffer += "Goldk0TILvEiZ2fFgWO6eyuu1Ap+YYQ/H3pyiiP/2mLRir11ylWE2ocXfUmJNrRM84HM7BdwrWynlga6/0o4SmHr5O8rKq4sc2YH"; +moduleBuffer += "ZytkCOBbZ157dHyR+pCwAY5YINvhMtVzu3WY2Ql3MMmHQ758ZlzensGJizE028EJCyIYylSRExbwDVPG36NlGCf6Aubng0Z+wX85"; +moduleBuffer += "GGJTgtyZB+LkVQymQ11Jy75SShZU1/CjoNQpGGJh/LEa9PkAknI59mB1t+72IluR6aB1o7DzxzrdIRo68a4EnzPXP+QPES+OZ3+P"; +moduleBuffer += "XRBzz8UHjtDDmXclLoghps/j6ThywebsfFpGWZ+rKyg/PKOxa03juBY7qX5CbUPWEW0fdVjbR3nx4UJjoY0U+yz24lNuQwy843d+"; +moduleBuffer += "Ad794NDY5R/L4j6mBUK+PYGQmldlCFIvmK+JIL0fFUGmOxE5BDlhLkSQeNeEIOfMFgQ5ZSYIcnBxADnYhB8HBT7uSNHjV3LoccK8"; +moduleBuffer += "Bnp8aBHweNloBo9tOfA4yPaIjB2Pmyl2PGEydoQLBTf+CC2Jp5bAjpxCY8fjpsaOf2Am2DHNugA7fsBciB1PmItixylzIXa8YqTY"; +moduleBuffer += "UVqnseM3lsSOc+bLYMfcbsVC7Dhhvgx21JtIi2NHnXsp7HjC1NjxkHmd2BEmpNeDHaesRbAjYZyF2HHGWgI70oriJ44dT1uCHU9b"; +moduleBuffer += "TdjxtNWCHc9YeWDDjV4SO2a/LsCOVIzGjlO0hL5oCXactUTCXLDyNUmwoyyEbCyEXgY7XiDuxya9p3kYCTQ1Y0e4ijhkptjxjCnY"; +moduleBuffer += "8R2mYMdxM8OOHzRbsOP7zRbs+C5zUez4u6buE1l+LewUynTBennsmKYP0o3Nhdhx3Mmwo62X9Bl4PJHYLXPc+aNO8+krwtkvetpO"; +moduleBuffer += "2RMGPOUyehRG3owey83o8Yz5ytAjtukZ5cmycBH0uHiKPHqkFJlqWqPHRXMJemQjiBJQ4ymTMA5dT5tyYLsizShxFCxfUCMfzknQ"; +moduleBuffer += "Y5uGLkU+2qU99ZWyIwmCftjYO0OP1eRcgqBHQgpinoDDBwJuHD6vEYT/9nrRY3Vp9FgV9OgDPRb53MZi6LGYFKR8Ro9l/v5zLhTO"; +moduleBuffer += "LegRw0Ut4loCOJIIy4CjI8CxGI/+5mLAET+1AsfitYBjEYdXcsCxmAOOX0+Ao88bhBlwpPrhUEsCHCtNwNHRwDFYABwrcqZFgGMg"; +moduleBuffer += "Z1pagGO5FTiWM+Do50+ZIE54AGsT0MtnTQ0UA/Yd+OuUC0sRjRPbEpxYYYjocK8Q7WmcSOQRHzq0GE48fzCHE6/g4eihBCf6RFIn"; +moduleBuffer += "DiU4kYZInriMksaJDPdoMcRYcd7TWPFwYQFWPFIYIowmWBHzXBU0SHQEtxkLQKK/CEgUa3fBetCaw7SdoznD8p639lt/tZNfg6xk"; +moduleBuffer += "M7vXlu3LxLJ9WWLZzlpYESi8k+7EhUb83hkcUML8v0p34TlE0usQd1Wtxu92s/G7fX3G7+w732LvL/gJ7mPE0JU9lLE3GYu9Aj/p"; +moduleBuffer += "W36q0WW8qSzZjWkT2DmR+ru/bDRqoMfn6VpItxRhZPykCzFniD/bS4iFO2CY4TtNiPSHVIF+isNHH2HwSbT7YKRduTrhRV92CQ3q"; +moduleBuffer += "FMr6baMRD4inQj5/Ff6K+K5zbjUdcWHHNGixd2scZrrA5xLBS5J75d7FjBu1MMPfceSDDn2wIib9/davsrs68bDDHtjKjdT3Drti"; +moduleBuffer += "W4W6jJrZi168GMu92CjWNOkLQQ3s+ukSw0oz/GO2XXioFiQM8MHI0h5sFWG6I6a23JX99DL8RbFbUsRKOMu+gkPpZbZzT7oMLmof"; +moduleBuffer += "c5RF8Kzmyi8lSCKYkpLgDT9m8S51ZPJmdt5DCW/xcAZPirLgy0abnEgawCsG3WyTH/4+a5Mc2QknaNkrS4BylsmRTNhcRwQe7gEn"; +moduleBuffer += "MXCIN8rKtLCdf3dTXOXi9/ZGvEl+d+HBzsGCHecdUqdUsxLQHqYWKcLEphlI7IqRnaNAJw/Z96XjLHL7jl0YhBQ9TnNhVi4TDvPt"; +moduleBuffer += "UAGcAEZW+BU/xh/xLxxqqGlp3Gnms+0YEndLw8YquljiBKnIW5irmUMAsVnh5/8f9r4FPqriavy+9pXdTW5IAoEEmL2ABiUQrQpS"; +moduleBuffer += "VO5aRaoWWm3VfvaDCFFIkEcSUNsoUQmFFi1aH1iw4ltbsVitRUUbICoqKlqtVLHSFpVWrNRHSyvq/zxm7mN3CeCDft//94nZe2fu"; +moduleBuffer += "zJnHOTPnzMyZc/CMb4TiT1K8hqa4NaxTkiQwdCrEAsFhmOAq3WsXk9gij8RMJsJ5gQg0ZxysZ7B5Rttw8sBHDaWieCmkUQXtbVSq"; +moduleBuffer += "RgZ16L+5w1lgWy4VWGkS+Vzmhmv+p84NV/7n5oa7vrC54WNz93ND1//NDf83N3xec8Ng6d1GihjSD4EVEDIAGSRhDKO7V3JRbpE3"; +moduleBuffer += "OJ2uPeEFt5Kke9/ra0Ayc9fDw54HgtB6U0/KS0wptd2CXnwew1wGWRccqfXnd9uB5XAPfhcOUAsZg3XjMDf0ozecJfrydwuIOwrB"; +moduleBuffer += "KhzfbjG89eEPcQdWnXPQAi6Z6oO3XkIOB0A9BCsENrsI3srprQe8lQkS4OCtlN6wIJuzlTsJKqhYoHoiFpTmD5UwHrEg7OoiKqiI"; +moduleBuffer += "P1SDfI8FxQUqlmBBMXrDgvBaWIQKommOCjI520BHp4KoO6kg9vdQOcc1Z0EbjdZmJEVsbs85bsksXF1jVG9qaPkc95hZ0JooRvWk"; +moduleBuffer += "RnDGBGcsoepzxiLOmKKKc8YkZ0xQpTijzhkNwFldQAh9ao9CqEdMT+2JmAazqe0dWsjUNixfsUtM+0eoALVDC1yFQ/MpvP/KnprI"; +moduleBuffer += "2rUpbfWa0jy4hLpRz4H6tkFQlxjKaKa6g1YXBkqWt8O36wZ5CUlFRGj2SajpNAxkeVxl6YEe0smiKlYMxf0mMubtaDiPT2yZJTT0"; +moduleBuffer += "LKrua/pOSqTSFFa2pBHW7zcq487UmUGL1ganw5mPUu4whbyLuEs3DI+/c8N16fmEb3GipoKv54LKw442mNZXurTbLazhKok2kK8j"; +moduleBuffer += "orlizWHju0GHIlaxoek44aV11FdxtQxv/qXlqA7YwGUXYZqvDUs3DNHo9OpP1knfWWRaWavFMVOrJew3DGbhvv8wtOrZXeqbq4wS"; +moduleBuffer += "r/UlOX6mokqXJaas6UV8a3rsRDzemCllV1PkOioir5kGLOlx03mXF1nddpN54TaT9PWeMEkxNRPhDKRJ7JuXYT1XPD4khW5UCFRK"; +moduleBuffer += "w2RiwUiRsSQLNyzaDWaiu1ADEM+0dbKWsVNvtF8yZCEEnjecUREtQZv5jlIx5RsrKdKtc9KSqQIEg0StRqdYRWHJcSgZlQcX6L7J"; +moduleBuffer += "TjKQscMabrZz2e2BsuNcNkhicb5yS9qRvGTm4F2Wr+1qubdAKC1ZmYX7f6JYhbh44yosYhEqLHqZ5kEoJVmeRSYPqPoqhqpnkMkD"; +moduleBuffer += "i00ccFctJvnEvsXM76YNViN1kldEF0VAB0W9yq22ZAelcmp4n5RrVuIzhv7CyFkrw08nyKoXWZeO46kgmzmmDNh/5Kuhh/3DIpRa"; +moduleBuffer += "06bU0+fDn8pGeRUogXu4hq+sl0AlSMPX10v4avQRkfC+jGh0t9ywVvPCdY3upmC4ptHdGAyvVwEBARC83PevD3wFiczdHowAacrd"; +moduleBuffer += "GozYrAJ4GgXCWVbG7/Bft3mv+JiIKe2XLWlxiEL/iNuPKeXRiP03PBcCKS4G8dC3f+OkadxA3wa1td/F7WgsF97wYEjamgByj4Ug"; +moduleBuffer += "xRgSSo4hULDuoD1gUibXMjH4i8Nfkaf9iUrjrhhDx9oxUdx4OB3w9J99Vxt0dayR3NWX3d4MhF+GQmSmiDbyM+xVMolklwL+mWq0"; +moduleBuffer += "d8Wleihu8cTcuahqP6sKLWxUkcsS1LsXaBTnPVlRajiEcKlDZl4a+dPoJv6On8ykalSB7mAlXsgy2JzIJFzZyIjxxo7dyOjxIuKN"; +moduleBuffer += "jCRvLCUAPeSVG2mC7jogzcqD1rdJ1X6HgR6ZLXczDRCYXLwhs5ViFgRitlPMYjM0ve00yHM1AXvfII/VlrsSpg05KiIiSkZw1luK"; +moduleBuffer += "ylOsxCxDaQit8kIEcqXlqWY7bE9oI26H2w+j2ZfFd3WimfPL6WTVXRCC2h6CutMMQd1hsqImTCcISU5+DIrmYCgL+6UzQTPN5UUU"; +moduleBuffer += "egVwLHrYv4mni9xtK+TeJJ5mk8r7dlMa34ih62TL3UZhtGb2H2Mkm/6DjGTT/x5Gcuu+MJI8NtI9E3k/zETiQSYiTcmHWIh9qRwq"; +moduleBuffer += "koGw5fJCDCSaw0CiOQwk6jGQKDKQ9mu8CZ4c7uy8OhAGBrIjGN52tcdAosRAlgdzIwNZEoxABrI4GLHgGo+BRH0GEvUZSNRnIFHF"; +moduleBuffer += "QKKy7cxAova8IjnnR3HOjyL3QK5CzERxj4h7BxRlv4Pz6QJ+87gHWQeM+GAiDAZn2RAcZh2YOlMkWUcE2YfPMdAJXRFxjDhzjGiQ"; +moduleBuffer += "Y0Qkx4gHOQZAGGMvLUIeEQEeESceAbN/gEcUQcN2yBpR8yBERxxUF/4EPIK+4ye6uki1L9BoxSOiQR4RzeUR0VweEc3hEZcWSR4R"; +moduleBuffer += "DfKIEIeIBjlEQKzyeIQT+ZRcQpJ+jGdznGBxyQfN9fkFurPw+UWE5qhIgGdADzPP2IGa0TvYmyCxOczJrONBdISKhppWJVg2iwRY"; +moduleBuffer += "R4RZabsVkssiAQZCRTADiZFBOYAXYZ6qYO4kpyXoMPHXCSrpErIXaW+mSBrmwEQSASYSL8BE4j4Tgc9+2kgwYCXdf2GgJwbM4Bcj"; +moduleBuffer += "GNADyZJA3jqRKVJ7UpTy6VcpcilE2uKIPKNCBa4SOqJy8OYFvKMZp6hyJG3LOxx4mFWCC7YSXqJuL9aL5Wq2mJdoEbVEi/uugPMN"; +moduleBuffer += "nisLZGSU8lqLdqsXR0mG9pdnfFctwsaKIrRLiRKsiR0eR4WxCDp941uwS3Sy+eduNNGYoVIZo5sJlCptEHZJo0hdSYiiQhl83YAu"; +moduleBuffer += "KCiVk/CtzZLPlI2wYO0yufBOfAITXm3SeSlDiaA2w3oTMR1pRHOb7mqTN99RqwE3yGJk6Gg3Cg0paVXZ4dtiUc82oWc2wJ1/Y6dm"; +moduleBuffer += "32DgvOWlLgqmltcwmXvQkfmtCdbJi/G8mFSmmyWfIU0yvK6Jh/ZXxXh2iJE/pWXL+RzeQq85Tsz1WT6wu1aBvoEayWit3Yleasrx"; +moduleBuffer += "5BszyzGfxDHfyvMBzylRrk7S93BDOdkiLF3bRsXbjcVszC5O1u2pdY4dsGoaNNQeI+uIFtRixw1oiRClZ1LhQN3TdTAC3ZUBY9Ux"; +moduleBuffer += "IN3FbOavkyYoyOyZfdxBxrBliKVT17AfA8bq4qnESmIZVTgZx0NGmekmFMa8Cd3l9oeYpFQji6HRR1Rlw/PtBB9y011Quhi1Z2Sv"; +moduleBuffer += "Xk7I9rUzgQZ3RBzA6/FpnHgWRXGC2uXpa9ME9X5kuDEvykTajpNOe7TR/nk0E6VViKJv3Du+mTwt7W5EXR4aUfHggFJDxvKGHTHk"; +moduleBuffer += "JfJ+h+rr7kaUuccRxVA+hxElEY5KPFHPaDnZJ0WrHu4bl0Mn/9QbUZS6KJha2sbpfkSpsYcHQaERdaU3okD02nWZGlAb8gfUVwRZ"; +moduleBuffer += "2kQLit2Mp6/weOLDlU83nlAhyQ6MoaDFYH88bcS6vm1iDCrUo0rOc7hoR6PqRR4J2IqG93Y8Pb678eTZBvXG0+OX03h6qtvxROZ5"; +moduleBuffer += "1HjaA6qXMaoLjidr38eTmT+edC8KzULeHOelDnD4DLLZKHNbiwfa4qhkoikAUIwvpEhiwXvUJVVZ5rbMXEUxorgYuW0xc9sDyCKb"; +moduleBuffer += "3IIfJ60hGnyBU2OzDpHWxuSAXCtzkGYE7ZRfXKT2v4fkbliTxBP3/d3F2a4hlXtTJHDQTFYdaL8XOTSrSDt6rSZPOcn/IKIntCu2"; +moduleBuffer += "QWNjf6MbsU7+TXbLc+dtKXfevOcWQ4D68dZcmD4sV6MjvirUSYQpDb5BmtZmt6IZjQeo+7tkZW5zlJTZ1Hk1HRHx4StOXi/GWCOI"; +moduleBuffer += "1LLUMWeUp0MyDE4HaWx/bLAxHg+AEbsnOSZDieDxL06OKd7pgY59xmI/a5wi4ILKa5myGxKndYpsGzsq9817YAdZXgdxa2L2bQlu"; +moduleBuffer += "TVy1pkievsN4isvWWOHW0GLXP5SVrdFVa/RAa3RuDblJ173W6H5rBPkEs98hrqHh6SjekFVOF015Kqxx/k3qhFTDE1JLJvCsbUgf"; +moduleBuffer += "kgQuKdhhlAc2sjuwkd2ClRtbSVoW793YqJvmjQ0RHBvfpLHxgyLB5huSAwukucvYi0QPmTmJavxDLt+c5Gl0KrRFei3kE64OXTdV"; +moduleBuffer += "SiaI9ivW8pqIbrUv1kMOTzX7YYOJxsECIYBx84vYxAw67oIAHWRptdpoPKoa3eLg8ZXW1Nzpal+DL/KYa7HUeudqHIhOhEntWGMT"; +moduleBuffer += "Ihp7OFNvcX5LnklGJJVXefsHEdLqMJALRzQDGLEJS1S3kw+KXJEh947Agwx3rcaWJNdo7n13rM0zJaksVOZ12juxAr1WMOU2Y/cp"; +moduleBuffer += "O61gyr9xyk6LU3Zau4W5o1DpBxQwFfpjBhm0EjqoQLLj8lLV0kFYOR41Bn2IGjgh87G5wSfM1EWHErGjG6zlN+e6Hd1NlgF0xEhO"; +moduleBuffer += "TqVnUzqFK0kKNqmLiFig80GrzxV4ljfkLG+qWd7V7GuL0A2qa3jHfxbP+TCBMaHC6DVhOuY5J6XmEx2d3r1uSLOk6E34MLKvotM8"; +moduleBuffer += "lVQc5yBytIo601gI351xNLL9jU6VldtXPHodmpOU7mk70gPzZjmIZOpOnUgcMEC+YXfnKhaCybssvQT7Ap1jxollLS/1D4v/bHFG"; +moduleBuffer += "dONKzxRHdZJAHJOBNI5VSIHUC8lTeGptyLxR0hpi2tJpwYO3lSwOttPGLQgjmBNt3OoSBJutU8FOsjincTKdDJKgBW8qAGQWJ8mN"; +moduleBuffer += "coowyhBpkKAAPJl5YZLmg/ZMicCrgimEIiuIVYtx4igIXztiZOGHEqNrVLwTKCFFcMCl5EesU0xu3ss6setEWBlQsD0R+Bq176JG"; +moduleBuffer += "kXI4sFaEpJN3jEgAACm4RxBDhijGupnUAdxPKUxrirTsxWLu8JgsrIQ6HFkOlVNCO0RAlZS408bERVxsXCWLE1FYkmjiRBMxGYIC"; +moduleBuffer += "8Doe+lY2G4H//ijKLlqAXh8oA2qBWnXEmLGjAkQBGwpYumvMcc1p8DRnOTq8QRjQNo7MWlQ24gkG7nI9vU6zH4hJiZ7lexsSgKRy"; +moduleBuffer += "GFuRqiNPlm2znIBFKVIkQ5UNtDRlH0HyBnDLEyCUds2ZmHQUvgvkJkfA8gPT25B+hKuRuQoNPfHhJq1xKm1NjmhEt31RMmRxhHES"; +moduleBuffer += "Kg0SUKb8KDGgiP0IaYJPdNg2R40xAn9GZWiNMiRDK6c6XJ24fyLvD2SSBsr6sj4RHmsu6fiBhS4BaY8bFQOXkrK4TfbYyEPBJuyM"; +moduleBuffer += "N6G8Wu0k+x9GJoVvJ+NbBN++hm8JlKFrtXHwjvZzWPmF9xCtVlSZmQPhegjDTNSKkRieyKJgDGhgU4zXVLSWSrk7ZZFoiiciUs3N"; +moduleBuffer += "zW58DojnKKMf3yz0ZveTT8xZabTLpMNfsScaG2S1rBkvUhkZOvRAdQ7L/mvUKRvrlKfxiApwgeHI2DRq8EiPgzaaA0Jxms4ycbsu"; +moduleBuffer += "JdkQW8eGgd0kXVWbJ6Y1UuZxIq45nVxdFAEhjcHdYgu/8ZEgLqncBc8wIZE97CQfNeHpj4nkgvMEkEUEPbOizkiEyKKSD7HKKSrW"; +moduleBuffer += "iPaWLXSIiH5ULLQUjndRzVlIZfjGJHgYpU6R9TrSpD+JPGPgElegf18kRovWyECDdAESXYHgunhUIxCQN0CgguMdvlxYg6CQgqj2"; +moduleBuffer += "1Xy6JDJ4ePK8Rg5b+X4hENJ4LnMUKUDq7hJs9E+iQpkjwwsyunvHM4xTq1Yb75QARTg9QAwhbwboBjXuzkTYtdrXM0UoFZMNnjue"; +moduleBuffer += "XafhXS14vR1fIaHoQWXcJoO4Zmta48ZnzxIRhIUqNhl2oEr6kaNgNWe1unWkpDWnGQqmMrGwbksp2adSjsKT6VZ3FCmMQSlFe1lK"; +moduleBuffer += "0T6VcjRAP2YWLKn2Dnh8n4AfA/NsZFyarqcBUaClBkYY3hcGJJ7qRPgUSD8+bZDCgHEik8mZTCGnZ8hYlY4WDdFqeQjFEGNkSlWV"; +moduleBuffer += "8YjyMyAXD2BcA/4teW4d208y2ExdHBuidY/x3Ze9VyinslHOuSNYtquPUcXrHimUFiKF3Re/V7RAxaNNxlWqeCjcOBFmQuyP9YFI"; +moduleBuffer += "y131jLQVT/XduVF+o+wLvJRUaQMqC5T1uZNtzDW9jjExxgW+627yCk/gxS60ZpDi8xD2xoaHzY6FYi6IBWWNorwKZoYEHu2ieF7W"; +moduleBuffer += "RFKFObYqY6B5OFrPoBlfIjucQbQWUdycKSZTYzRfeVegi2nXzdVbqX6untHVAhYS4xpKZy1ojV3PasjFtVSKWNNkHAC0yTeNmeoU"; +moduleBuffer += "nNChNOR/cR4YEYzQmUnCADkZT/CA8jECD8dMtLUEESZGQLPx4Am33oAlppglIkcCOLjDmELOGWPOiS57ABq5TYO4KOuRxoEziliz"; +moduleBuffer += "sBR31Jszyne0dBQNQreFehHevpKGEfFABKWIMY0sCNHIEi+EtHWHF0IUrvJCmG99KN+mUL5tKsQnogNxyUMKq6SbUZ9s5ZW37Qn3"; +moduleBuffer += "bPgUGLHhKU4aQAru5u3r0KVBqQkLIboKYBxuaOjkQ5/HNwts3uZwt29bp7mPYUxJo7sZA7f8dZ28aScdQTi0GvMdmshlcGBhlrwd"; +moduleBuffer += "VtG86ebvMdi/lz4SlE1YPlbXPSufumflU6cH0iefa6NgSGq6hxOh09G2QdpjfLodORq3KOlwm52ASDNxvLcBGebAEst+LG6Tr2vB"; +moduleBuffer += "uwa0yTHOWzT6HeirnPIqTyqQUt9q0p5qnDYU7HsTsutU32Rolah5K8ZazbKv00t4wUirxRu9rgl40liOKqt6cOmOy0VpdoG2uerG"; +moduleBuffer += "0FCtg1Ueqi6HukJ3F/97TaGuCEwmSDOUPdAbb5Gut32k2hVQ+6tPS28nYQ8utAdap7Y+o/YxUGUjvGhWNYZChjSiHyYs8niYccxm"; +moduleBuffer += "cmdBDqgd061sxYsuH5uzcCeUdOopROrlzc0oC9ES3Gh0sQ2j4OFu37WGBCDGLgrBTaSm4y3FpVsZ2jG0pF1bbg7udnmucGgBja5w"; +moduleBuffer += "sDtpA0GjywIDvS041h53DLoczK2Hf2TEdxD7HzGkxxFoinwj3znTAPL2eDKPBvCc44mopAGsZsFN7i/T9ttblkJCtxWyXGG/DRXq"; +moduleBuffer += "NlFcJtr9tuE9phoH/b00apfgu9Caf8TlcOluW9EHckD3tdl5nW6/hb0YnD/cF9b4O2nBKWSPCHlLtj/YkYa9TedRj7tZsifvN/XY"; +moduleBuffer += "3KAdEsM+A/ev1X4aahWt/N1adZ/ZQAMfm3U2fL1RPrt0djy0mp7Q3CPQazxp7mfwqKELLaICSzRNsnDBdmoNdBJmL6NrU+hyCx7S"; +moduleBuffer += "y7uGJRikut6l08BGu5ew9n+SXLuLNF0aGpgxk37xNVA4JSVrwuh+DEc0ar3E7BfpTlYlZ6vOybaRs+FVIFj4cwk2Jy33km5EK41m"; +moduleBuffer += "Wu+TpCsKobonuO54PDSLQLGeCnacY9rLkQuo82DeFvoezig6WewgfZJrMVo5EoViN0NHpXTa5cPOV/3eTpuYSWH55CQ3sRR2d+CN"; +moduleBuffer += "FfSMdZk0vwXJfl0YvStjAfQufm2tsnNE6N1ucKu3yOcLBqN3g+GhdyN+QpvHiN4XjILo3WDsFr3bDUbvC8ZeoBeLr4HCffSig1xE"; +moduleBuffer += "7+JIN+jlbFuMvUDvFiMXvX7d89CLPv489D7A6JX2Lwi9l+mSBhR+lzB+ZQfXQOND+FUdvzIWwi/Nh+s0ua0LqaY14oTsdmny7CPj"; +moduleBuffer += "32DBWzDE/PCH+BjGUQo38mW8KYQmggJHgEl27ZhkLs4pYjkpkGnPyU3Uaw+J9Li35S83kN0iPxHerYGVIHUjWgoocETwbd0IT2wm"; +moduleBuffer += "TmzBizLkCcyU09zFBt8jC95yowtk7vqnQDC7Ke5vPOPMCsVy6aa77el8d1d8qkU3onSLPWQB8pPqnpc2BhvRDZsjbEyzVwGbczyW"; +moduleBuffer += "IIUE+0d00mA/GCOCR0kxL8nHNL/bW7wkA5lZ4ojia4Eb9eG0s8+hHRhScNSFJ/uyqKCDA/tlQ9122jnaOO+iYpnqu5AK+dfKBIpV"; +moduleBuffer += "vvyki++S3HSBkpuWfyjlJhKYLggKTBfYf0hk5uvBe1bfrTGGOBescI7HtxrneyucMfg20Glb4ZyAb8K5cIUzFt+qnYtWOF/Ft0pn"; +moduleBuffer += "7grnRHwrd9r1Fc5J+Go7F8Pryfiaci6B11p8jTuXwmtffNWcefAay+KWWclFjskvl+IOcRvUVcSyH/MXi18udeLzhAlfnEibg09h"; +moduleBuffer += "YaCiDYFZTgcAGyAUFJliQB6MnvPanKhM5KV2SvxaAMhEm//FFCVYmzanyIOMN1tFXwW5n4Lcax5XqD9QwTwg69YVjmhzylQ2ESUw"; +moduleBuffer += "XtlFFCz2oKbUh6QqOq0qRWCL2gC8/GKJNFcq6WW3sVK1qlIDVaXK54l+mHuQ6OAqHYB16z9nhXMgqcrijYt4oJZOaU59e3h91SaK"; +moduleBuffer += "w1UWKQoHKo7BGg/UYPXBVvXup1qEsJ0kliG/REU/bpHtZc9gi05WLRqqWjRsnhiIuQeKwVT/GqKENnEpt68GG4rtGwxoANqgRjqV"; +moduleBuffer += "qiqlmDo+L9jOHuF2JkSJKrO3LLPN6eOl7r4P2pyDvLcqv/nhhtWpDxnV+jLVL3FsWUmbiKsvcVHG/ZLxsh+CTThJ1fFI1S+HzhND"; +moduleBuffer += "MfdQUUf9QgQRbROXcL/UiSqKLhJpldX2mudV9SBKcyn34EGiJx4gtcGIrAz3IvRrKcXk9mJPj1pEbwLVJ9S5qvt677b7vI52HO9t"; +moduleBuffer += "pPdW7fdcuE++pD4cojquWHVpWk4SaW9YiWLu0kO87IdhX52o+uVo1aXHzBNHYu4jxZeoMUSR8TZxMXdpRlRTdFL0U1mrvS71ajSS"; +moduleBuffer += "0lzCXTpSOBS0mCgYJx5pcG+JXkJQhwujzRFeT4U7XPRvEz3DSAHxBGa9HHJuYzzk9XivvHkn2PdVBbAw2ns73O/scDcerD4cpvq6"; +moduleBuffer += "v8IC1tXph3WWX3pCCyj7YV72I7DNX1Vd6SosfG2eOBpzHy0Opu4h+k+3iXbGwiHicIougaEusx7uYcGr0WhKczFjYbTEQlQikLDr"; +moduleBuffer += "NVUOFMSFKEdUFbU5Vs4g5l4Ug8QBQkhMedNgTBzY5pTn4O1AL8xD6QCVGtEFc2tgJPXOQWAvCg/yuqnSe+tdAHWxAkis9t6+5L0N"; +moduleBuffer += "93EVxsIQ9eEIhSqhkIg1ccqwRvILUCoj8Qgv+whsz1iFiaxC4rh5wsXcrhhCPUcjrmebmEs4PEwMp9gKmB9kzuEeDr0K8SBsZxx+"; +moduleBuffer += "SeIuLtFPtOFPEIzDGJYyDBGdhJ5hrDvDwqMNu1sMlPOl1QasU34mRBGiQ+gtp+gDCZTCshggBgdxfEAYx6V5OM7hOTVASjlYzmej"; +moduleBuffer += "e8J8tADm/eF7uPd2sI/gMOq+rD6MUPi1FeZx2nYG4PQtvxQLmzE/wss+Clt5gsLfsQrz4+eJLObOii9Tz9Eo79UmLiLMHyEHdT/R"; +moduleBuffer += "X+U82MO8VyFG8VxC/OFy8KYlzQwpNHhRvhCHInWUQMcwqfhcLoD4oW1iGD5jbSBhhBCP0oWoayNhA+nCk2ZquqELnyKIQHZHCAfm"; +moduleBuffer += "EII3q/cVBwWH/u6JYtheEoUvjtR5b3Hv7dACU8Rw722ITw9hTB+lPoxS5DBQEUp/RHXfNtHf4wAwtij7KC/7V7AXxih0f10Ryjfm"; +moduleBuffer += "iWMx97HiKOo7mkmK28SFRCgj5MRRBhOuzDnEIxSvQkwSFxGhDJczRE9JYl8OzxCH8vSBhRyD1FQBHSNnCNUtUpJCoUgcycwaJCqv"; +moduleBuffer += "T4N0lGkj6QvpKBOmo1oxMkBbw3za2j1N1YRpypuwcqjpwDxqypERejCTCvOTPRBMVQGCObLAfOILZcfkzSz+yG1zTvHeTvXevunT"; +moduleBuffer += "T5gyvqU+fEWRT7kiLANJA7i+ob7UAnOm7F/xsp+mvg3yc8kYAd0gyeY46hWClxLHeTRE0c7p2KcpYGsO4OEMiY9vy+d/yeeZ8vkd"; +moduleBuffer += "+fxvyoRElBa1KC5D3VRp5XKyKvcKYqROoN+JEkK9fJ4ln5Pkc7J8NhCUvvCvP8KHQaXgp+WXtAefYpyB9Hu2zH+OfE6Rz6ny2Sif"; +moduleBuffer += "TQRlgCgWAxA+zO4Kfl/5pa8Hn0X4vlIe4vzT5PNc+ZwunzPkc6Ycu2Uw8wP8XnIw00B3WMAZIJMOkc+j5HOWfDbLZ4vkFz1hxQig"; +moduleBuffer += "eGrvKT+WyWe1fLbK52z5NLIsZsTlP5wEcP3bT457/J1Dv+fRbzzLoiXZL+eJACaACvpGayXnfPqltbJAc8QxXiXAPFCS5TUK/say"; +moduleBuffer += "vPayvKHPi2WL4mkJG2FO1ObgyRaI8t7wNilNJDwJRMKRZs4UYHaXSDKdgmksD5CX2ttjkKKr6dd8d7n9zEO9KbLbjJ7U6oPwFnei"; +moduleBuffer += "JDzfhrd4FMBYd2DFaHGyLxpLGSFnq4hR5LW/O7CepOUXcL4X5XGHijAXyan2bkqKdlee+JI4KbCDhGtTccieIPM+jt/D3RXkSQZ+"; +moduleBuffer += "ked5UXN8zilf+qkXZ29auJsqxLuriDhcnOgLLLSWFkfnoe6wPZUleBz7EnI3RRteg71iZ3tRrSrKEyPUzpm3shXH5HSGkdMZZk4F"; +moduleBuffer += "rZy67X3nDBdfDXQOSjniaz6H5JKFm9ddR3ye3dWS313NXtQsFeUJaJ5MOUC9qMWkXB4YOf22j0TVXaWdBKVIqAK9NlxI8mJEnFKg"; +moduleBuffer += "BmJcXv9l84bYiLwejIixWGrucOJaCe5DXw7vppIzPRhedWd4UdNV1LnqZZp68XYq+qoXtXYTp34RHd1da5wiZn+qAl7j2qjjE/BE"; +moduleBuffer += "Eb9IfHMvaibG53X/sXndX5TX5QlxAtYml1i5tiIRIupuK9/kwfCa0ehFTVVRU9TLOerlbPXibTCoHUkSg3FD7wtGSXftY3nE4/V+"; +moduleBuffer += "c79HKCqCJ6IoKb6exR1q8a1PQUPiG3l4KsnDUzIPN0ViTOD0JacRfIzioaLbNjV4MLzWTfaiJqmos9RLvXqZqF4mqBdvla86QHyF"; +moduleBuffer += "CqQJo/YLR1x3zWWx05eZvNZfQIhMwhMRWeJX/Xgl6htqJV4hTgMg83gpwSslY18bhWcEOag18lBbkofOpDi+zfFZcLihwggNRdVu"; +moduleBuffer += "oxCy/9uD4TX0O17UmSrqv9TLt9XLGerldPVynHrxhFpv4MKaDxaWbYFa0AwlvnCM5/VBAPe0PMlqnvwJryX+a9J/LfJfE/5rxH+N"; +moduleBuffer += "+69R/zXmv1r+q+m/qg7nx4VERRdmP9EvvZDWWfK1p/eq0pX5MR9zTK+8NAPyYorzYvrmxfTPi6nNixF5MSk/Jr7gdrdytnOBqLh9"; +moduleBuffer += "FoyguS3O90Tq9lnNeMlCFxeIEoj+nhAUU0MxSYqppZiBFFNEMf0pRlBMgmL6Ukw1xUQopphiKikmTjEDKKacYqIU04tibIqJUUwZ"; +moduleBuffer += "xaQoxqKYnhQTpxiTYvpRjEUxBsWkKYYv3b1lSVUDCM3XR2p14ruseVBQ1/WBxOer64qGrj6rruuAXG0MqOc3SR3jHlOpY8yTtyhD"; +moduleBuffer += "TfGUKGQFuW6GUqLYds3agBKFEdI6RSUKI6hYaLrr0RLUN6lP7zFVFem+p1A1PQ0qEdLLRSNklksOWqJsb9Ug/XpSvaV7uvCV9Dgd"; +moduleBuffer += "8piMyrnSKoIuNGnmSU+ekWPhF6rwiiWN83I56BHXtO+N8Q1sVIuaAuH3I1Td11H7zBypLYaeY5u9nkXgM3Os/OJtfoS82FSQ1+sI"; +moduleBuffer += "+b4A5PW6/Q8G/AYCppiR2nLswMUmA5eGgTWpL4T3BYxWR3PXr11HpsjRDu0afrVXx5N9qYfHeJrZP5PKPwIV7FA7CPVs3MWo1X2o"; +moduleBuffer += "vSWhBZTJ6XJrqa0lK4ncrYvw05Fm3HMXnuyNarRkD0XoTUIbh2CnuvrxVckndT3qX71lbGvKUoKHvxTpt294rVOzf0TFobsUurBv"; +moduleBuffer += "uff9sVMbrNFFbTI4txrCNZp2hIYtLIeOc9FhmbQmDg9ySCXRr7ENgY2vAOCbUb2IjD/DT8reQk90UW1Q/7HBedYyZbpDvW4yIKx0"; +moduleBuffer += "qDg/aT3B22BTCGNFG9qXI000ezRqeGmuVFRV5n81unsWVwpW1RrfpkB85V5dRxwxKLxuHVJpgxj/64ZY7tcNsWRvLDva6o5ucqlj"; +moduleBuffer += "mshImzm2KlmF3ZEcZ811Nz0F2MUrCkn7vVjE1ZKEOCSI4625khh+GTkuIqwk3qveLUUQPUS1Paf58l6kOWov0hTvRZpj2CwBa6Xp"; +moduleBuffer += "TI3NvgsfaSuB1bBJzdgfMksWdKkhs2N+lzdkwsrhMHXZT6Pj9LAucjWhOu5WnOwZCUENNSjohViyH1WIvLrb49EpRZHQ7PFooqCZ"; +moduleBuffer += "8K3rF5G9fKQmrQNEIQB64bysdgZ+rZb0q7MBDE+z0Lv27i59CPpiEfyoGcDRqty0WyK0Kqy/UuZDnTLTo8o4qek1IpDMbvuUelSX"; +moduleBuffer += "+oBIc3+NZcxAy1FjFE26EMmjmw2acp++o0tzI/Z5pKr5PAYs+zyaNUjnvYm1H9EyBtrOTPaTH3wcoSEctI9Bn/swc73H8qkdAth5"; +moduleBuffer += "smXYLrxS6XZdt06zn4t6FjGmJ6tkgrhDs2OqiYea0E+uwl6nb50Gf+wygl9zQG99JQA6haD776bTqMugR/p6Wov4wd3wzjotaAQC"; +moduleBuffer += "y4EeQ1ocenwzGTKgCaWGpBSN7B0QnD6yIpajM/lqHvlW+50OT70k6W57oVNzD6HK0CRdaHbqyblyJ538ckh9EtU4fx4zLRBf9Bnu"; +moduleBuffer += "MhgF+MVkWzB8ryP3FjhddNUkELLXYNKs6ppj0jp0rGLbMP+7mrvsde/aEWkp46D7Szxw3WjD64HrRqsxMO9Ned3IMVBcNAbpdioT"; +moduleBuffer += "RRN8IGgfoPMdnSE4YBrteYl0nFKk81KMoosjkAKvnWmQpDgvSR2Rm2NhIvIKw166MHFJXuJKINwbi0iWg3RMqPQcxYYQx6Qjth3K"; +moduleBuffer += "BW20H4vyyDTw9ifavMiQIXwyCUpgD0N8Q1XImsxgtL9KQhRwuNszGl41Y3HGXoW33YlZGpRJGp2HnIgOvlxj4F34zj9DH0btovwO"; +moduleBuffer += "CVrSH4HT3yCsZI33Norf7AM4q0lZ6ZYTtAIHBop2PN4sFqxoYq7iCYsvQRFHxGpV87uGc1IlKczjbSG09WhkDHcRTgYZFExlV7jV"; +moduleBuffer += "yh6VRlFkY0P2LVUXv1oYdVgj2alCKJczFOw6mTRJxFBaAHmIN8dAgsFxAghDAN9nAEkmJiqpRtmZk1FJt92whwV7RKZx9Qw0BocM"; +moduleBuffer += "Oi2IuMvhDYvSKI6dBKBsCyPxFh5X+A1fyQYQ3oUablbiVeDbQbrR+VZ8JUi5zVgRVrimFknjIgQ2+ZFlROfCUL2LQR6n9MYtNj2J"; +moduleBuffer += "/k80qVlOGuxKb9szbwLot6syMWyOLmKEYIEIVr4FMLVwlOb3QJScCCHSTsoIuzqcuVJRR7Wc2ByjimyZjEBp9+Z4bva+4ey2yi7n"; +moduleBuffer += "RZuzF8rZL5zTI0vi1mwDlLKhHTSodRVOEoSHGrSTS76T8OorkFsfGmwIdQh3Uw19TSrmN8LF2xw6UFJ/dtWpMQEiBSfd5ThJJe2e"; +moduleBuffer += "oeqwUQu0iYWjU2NmpiGx/i7CM6XOgqWFFkpHyXJw7M8iZimpFz0nU+8RlRMUeLKTC/Zwi15EdTY9NaQxQ14DiUjJD1NVhgYQG80C"; +moduleBuffer += "xu+uZDLJ6PTG5ClJJ8Nv7MzYYhcYliAbZhoZ6UpxldhCWZIAJG/VDR14hXtfkPxY2Ke4wVTWKoRLZd3nlYCU4nZxElz1Iurd1V7Y"; +moduleBuffer += "Xe/l6fLeOr03TOhaciWOlt7026nb4jRe7qYrurRwpLKJdUp+SzKgS15e0cRQgOVqihX6EmMFMc/D3F4kp+A4/xHEotBtX4UUhG7v"; +moduleBuffer += "r0O0bCJftclezHWfsLybfRBqjyZnerdy5YUk7ly5RMAFjv1IHC1XVDL9oW8fXPkibeAVU5MTBu5sEFVHhdmEZgEodGIVWblg7PT0"; +moduleBuffer += "hEOoR2zWHHYEQ9FuHUoCIJSS+cJG+5oYRaOtKT0gc23Tk+UcPVPFjm6yZyr5bFkRX3kNSjnHsozkUQB/rmThFf2pvL+wi+kpaw3H"; +moduleBuffer += "NtK9I/snMb75Q6v1CoUpd55OYqN9n5FM9uBYJUYCGaoWEk+x/0kmu1xtTPIbJFwfommhTYbALou385IlC4GALqY+Ernb/71Ws7/h"; +moduleBuffer += "bUHwhaEKLoRuHXVimy2M5TVUrVbHawP7iShvWdThyotuL10DYsudNINAZ5Nx6jokEEJjPGc90UvXZ1BKqDezKgNnERkPE8/BGZ3j"; +moduleBuffer += "9XB8bTj+q4F9Ek0uhd1Ow/6QXR1l9ABjTmt9XAs/0i6JhpZHLje8i06FQS3uDtTi3YHqWUjkTya3RPXo3KD/GuzbJoeuBEfd82eh"; +moduleBuffer += "k2YXDYmas5xYldAbx5GBT+zcA8kVwNiqtC7nwgTdcQIMrdKdOPoix2v6prvhk++dCCH0ZJpsBJD4HAuzIuSJ8eql3RhLlmOs5rHN"; +moduleBuffer += "+NLkXtweH9cMcypNIvEmxxCW52bQQLHKOpHqsWQ9zXloejPmXqUCBpo7Re9fBnmNwGZEAQA6gRubjpBV2Ud1Kgi4vD0WbYAIvgYN"; +moduleBuffer += "Y7TZNZqlJMU+50zaf8QaOHTry3J1uSNp2jfpqXRSQSo5EUSkFFnDzQVGuVkQ49ypZNJdxPX1aoaXExWok8k2ZJQMBO0WCHpUwm1A"; +moduleBuffer += "MhkqdEqeV309WH1TevdDEBfNQidw1Gs0d1B92FhiUTfwuDti1MXhnkgk3cWhJp2YjiEvHAMLOhat3Tb3fL5urgNBATkBaggqghhb"; +moduleBuffer += "ZQMPsNt1lLDjfKVUxffhXAai0qSr1iiKAE0aVY1j0yYvi0XixCpcVwAIAJCKJt2Of4BYMNS9Dx7kac7t4oj3vYg9pijcEQYjSpd4"; +moduleBuffer += "WOz1IRKkdEZFgrNaTCMjcjv/vQbnl/URORNVeCZToW/QaRfMZSVqonUNHqXAumhGJq72IO79tkeZo/X0OSr7WoNvbyaSZcxaWFC5"; +moduleBuffer += "how2Jm2NrIrwRhNyVVsjYygMdTszVDL/98hNXbhT5Zv/8748gV+Kg1+4AuVC7uSp6BKfU9gro1SWqqLW5JpzKAKna49j1Mn2NWKn"; +moduleBuffer += "GvZLe/Qfh230LAWS7QeLWKWULSCzFCyejbPVBNxdJsOxSOBoHcsg86mBf0B7JGvr7sXoYMEFrjFEazfc38z9atrog4FPdAicBFOZ"; +moduleBuffer += "wTavdWT2ERTPbJfFvyHax5jmq0n3I/QC0zhE0zgLm/71UkcyMXfTChCKMuRLAFdmlAAPUIyxDm1Hj23mC80mzCogIeOXk5vZkDaZ"; +moduleBuffer += "MaX7qIYs4qtVKD2iMWFsn8CB4xhjyYEleo7HYQsdS9ZnzJOr4FMazdkaIo7eYqBTmzJkvE9Bo7lVb8pE6ea0MI8niR995LlGk5MI"; +moduleBuffer += "pjJkqgTVxiGAVFoolSlTxUWCEwCPMYMJLJnA5CrF3EgT2j82RLQR5Ht17xX6QJobUDUFHhFDexHGmHSUnsAKpFMcqo8+hPddTkBG"; +moduleBuffer += "U6vp7jGzMnhPtf8sXFi4E04kB6HRVhFt5kUripRAlUcYAxmnaOYJvR9G0UQNZZ05lqz/mm6qFfOQw84ercBYd2izMLnpJW92kN92"; +moduleBuffer += "AUeKJhn1AJQWJGORWyN3brfpFToEA+3ATnFvkMizRtBdbTK+F3EjuIaJuFvu7qJNkkg2MhyWLBHyQbEii1x9S/W84eYUirKDURMp"; +moduleBuffer += "qkZGtfeFqNMpaqCMWoxR46V3KY7aYUDUCSmqNm4oxKqoPrithLVY/gtVC7NgLU7Pr8X4UC0k/AhfNydnSva6OBnhtbiIdq+hVsEi"; +moduleBuffer += "JuYXwaWmgkVwqfFwqXj9XsTdDdAI6Z7eXsB7iTodwKmqsHMzXBJGyEYLSckVhj5Dn2sfkdF4panh7gPO2SjhwFzu7lrciTZRkjhk"; +moduleBuffer += "3LktUurnOdDbSxwdzLHsZj8HzXY/AAErWerPmnJiLw3DeCaRvAWtLBhyX5CvqUOnidAyh7yg8VrH8IxhmwjZxPkYzQwAJTh86Ic+"; +moduleBuffer += "NpocmolMXgSZgjKbnNlkW9Amr3/IzgDOXMF1DwoXh7F/3YGN7N5xiEBzVfgGq+smdlUs6PQyQp4STfJtKY2INOKpDboZo5Q4fwGQ"; +moduleBuffer += "gMErqOY4ngNwlarxKpYsNHhh8lFs+2EyrRBXYYPW4rz5UqfkahFc1rkGr5V2/H6dXCsZ5CXa7cW7E73wgJxyNfI6EVdEtGOBY1yw"; +moduleBuffer += "mL71ZTQZGCMJAG0LsHis47YhCWyaPSaZHKUR5yn4EaUmxLTVhMcl5iwOIXO/BS1G6MRn3XJe/aIwj2EUDojxg3xQKtkzsmagoEU6"; +moduleBuffer += "UZjdYbmxRmTDuGbNvn/JwqfvvP2PD7/Lxtqzv79k3TXrn//3T2+bi8eLxGdreDNx5YtrcC0huTfaC4iSMJIsRqhssdmNHO8FP0ZX"; +moduleBuffer += "RceHqBYyXRFnOqdzcPs3uk/1i5HqqYaXwLobQM3hFv09RpDb9ePVKJIbBHYjRQQtBqvSVAoYNbYWXrXT2Ut2663z11z98k2X/F42"; +moduleBuffer += "++GNmx546oNb/3Uytpo65u0HV9z/dMcLH/xZpth5yXUPX/23xx59gDqmVJ3+Ukl45kOZ/rpyzR+uuOXXb66cy5nWr7/hgQfbf/sM"; +moduleBuffer += "9q4WFITiVH3q3sWfhM4p7DDk86gokrJqaL8b0FgKcqOcfQbpNP9QP3DTYUE6oCopdxztG4tc6LezpHVtWtz5gnRQjJZLOxakcXEH"; +moduleBuffer += "srTO4rixF2Kyd+5j8dFOPHiyQ1Oh5nYy5RZLoQ11HNZZyQfRrhWFM9KVj9RxYIe3wbkM/dl6scrCFcwN5OX2X3zom4nwCpEWgDhk"; +moduleBuffer += "IigpaF+jwYPmq1zNvi7Gu/YxcgQv8uzQx5TBeLxMjn62TLXj6/sGoC2el2NGci5udqjaQ6Wk8Yy4O2JaJkX1wJkOqpRiE67kmwJ9"; +moduleBuffer += "QWaUl7Y4+tUIOjRg5x/kfWANeYCz0bEuWVylOpNl3wSsrALeB6yA9wGTvQ/EyK6IxRWPo73+YoASR3v9FkOJi2K01x/HsuKevf44"; +moduleBuffer += "H/8b3okTuy1J0ZqO+tCeT/ZVybKtsuwPaySXDBYeVjUST0kRbegxBK36JhvZ7HdMGm5L0AGw9DsQcu7ArgqgL1w8yH0xht7Lud4m"; +moduleBuffer += "1lt6KzC53uTTwPTqHfJnQJSM5TQButkVvdVIeGMsszsDdndAUDy3ABYAD/k7kG4BYox61eYxaT23zuRTBvqLms342xbFhbKdKTLI"; +moduleBuffer += "rUzKSXP9ErC+KJL4S7BvF4W/BBaMFiTTVH6M8Rfuh9ge+yHm9YPvDxkIuWBPxPbUE7FgT3APSAqKMP7IA6nVSCaXGSq5BGKJOveD"; +moduleBuffer += "8sdQ8EOS/NYN9HPGc0FSTiJYr6IRrignQPOTXNEkVjQiF9IIK6lgRUTKHdGE49MdgWpRRpKUtUiDJclnO8TGOoir2c8mfDZ1mWJT"; +moduleBuffer += "fNZmv2UmUzy/kZU9NfNKue9Dw7ODxX5L4uyVQ01zWCugVLId946BqIujIyJ8sdiNNGKT/W+QcyVTndIK8kuScnc83SkNDkXcas8h"; +moduleBuffer += "ELqdQYdAsOREVR3cMeiCJR0ZyIIp2YmjeEWmP+kn7iTQ0QtOM2hKmUhLlxpaJspXuu+8EmtA06UXpn3buO/ckkDj3jkZnMI5RyRI"; +moduleBuffer += "AEyrr0AwyeSnLyPJLlbY3qPn24hcrJRj8ggfPChJhRT17Jv1nIg39SAetxv+ZzRiiekVLskbo2Jja3w2JqWeEH1coegDLerqHklA"; +moduleBuffer += "6E49QCCsDHUy0Q7yW1T/8bj2TcS1K2mDWZ4E4yEqQL8P5hIqmjn9UNw9KVYUB/PN71AsdG9EHw4HC2bN+HmwyZ836slHDPIBT1kg"; +moduleBuffer += "mqhRzmJy4ayjpSQgUTraAtKdlSaLs5QdvQRqGc0cTdsF7ido2v52twRdddQ1Q8+9pCE9F42tGkmSN+AadW7tU+HHWpCxgCEn2XXg"; +moduleBuffer += "7kEM3yMEWkKj74+LdZZZ2nV3+W2wmrvVonNj3V0JIdfgAiAp6V3Y50sf858mq88HEGH270DKtn+cwL7V3U0/70TlG5ABj0QrYv7x"; +moduleBuffer += "J3F+2njT7UdQWL4zIZRhXxQApGVb+6oEQ30oygGC+uxqBfVuHa2C4UFSRgv60qAtQwOkH4fPUvVGtLdu8hG/b8nM8i2ZKbU/wdKU"; +moduleBuffer += "tGRGWguWb8mMPfa4O59cKycWXWnheWo96GFHmNILBvQUjkXW1UPdNsKbe4i9JsZTo+7+UcMAfQDuE3hP4Tu1d+ULqr0U3PyaCiZ5"; +moduleBuffer += "t3AXrH34U/vW4Cdqxcux5EgSQGvlqZNnK9bATsLJ3yFFCZYVb4fa2ldG5ekJd/5vsPPvlJh4RAYOx6MsGiZhoCTdCz7yduMITwvA"; +moduleBuffer += "+65uytNMgw51ab+dvO4ErMmhMGWv5G039Q3wgzlZK1BqUloRVpegw0q0qdq1FGVugxBO+09J+92o0pS8PypJkGuM255a0AOm/w9F"; +moduleBuffer += "f+9AqAXNwbrxcVXocCeuG6YVicbirF9Fa9vxfIJ4Jjw61+A68HRY3ejDjckQ8byGnh80OuQ+wphIbxs1MtCPPQRc2n4uThaaJbBR"; +moduleBuffer += "6thxK7bit2TbX3OLCQrKE1jKBq8Ug0pBLAA/G0/QRzWiD4pAOX7hgRJjVGKtZqHNfN4V4BJThQrcWaBAe98KjCblZgQXA/BP9btt"; +moduleBuffer += "wdpwtyH8yuEBUON9+CGotEmGFMQdJzz4vQo1Y8na/GaIfWuGJW1pT/Erv8ODag0PJzYxcc0+tLlmb9pMuhR1+wC1bm+g4mY2aRV7"; +moduleBuffer += "W2rYNFIV36grDQQaN3Vy2BD5oNe40UxKkZFajPu6Gh5X/byLD9exr3FHyAjsM/K+UExuPXbq83jOQMqn2xT+kh71dRbpUs+KIW/0"; +moduleBuffer += "IOv5kLsFwx0nJzXadLFXkyCjuzuh31zDPo8kAnfXWjqMghzeLCrna5TKLNyvSKmVuv33aHK1ocflOt30tfNZVI07uJFn0iwHBW3X"; +moduleBuffer += "0PUIidbA9dxb0BwvrHwtvK6AWzFTcNV+BKAuRtcSeNmjo/i/BFW5lume5zqeLMnx0xrdGM0mNtXCxnf8ZFEi6fjJkLo2NcZyPWOw"; +moduleBuffer += "PLNMVwsWnfUotqKcYv+LdN0PyxAPrKMNRvTaRxVKUt0c9A9J9TOxOSbtSzqRdNB+pyX9G6J7SExKmESSINbJtwWGSf9aHiPhvQuD"; +moduleBuffer += "tzNIBCxptJfEFK+V7HEE4mSHHprT63KmdNfgiRyPVHBBwZO4CZN4YP5OMW3hJuZdm9ewegvSFhLb6xqrZWnkVaWS3tjvCusXyGGu"; +moduleBuffer += "u/dBTrcPMF7W1TJCYDfmgt20F2BJoXATgi0nvWlJu28UHo3e+T+1t9tGblu67lM2cgfkBHF8tVQ4vHYZBAdhUC9Y0MZlOQXN1/dY"; +moduleBuffer += "kNfOK3UlKYQkO9qhl9IB2jQFQjwZJUCIj6i7EyiLSVu8rtnqLSqVBGEFJAjTkyBMliBeeGuNlCDi+RIEUV4chJqXAwIbvM8vhBPm"; +moduleBuffer += "TBprBZPWMe4UX3VTFy/IcBCkqAeGqLMmPKgRsns4ajlGYT8ZU1TPVZJAGd71VH2WYHFwuZEcRcNC6Gp5j3OPoBNmWl2YtMWIdulx"; +moduleBuffer += "9UjHfTB0tTQaOzZYktz+0ZqgJImLcNXqOL+nOH6LFgjspECRWvCdltwU05OkpkkbeDu8tf36Ev9gwsSIzhL/ZIIiVpX4RxMmWdOm"; +moduleBuffer += "t5Ul8G0xuhOzb48JM7scOQgsfDcX48qJj2ZeKCZHUCvR29bGYty2KUaZ0uBNgo3FjfYP49T29Rpu6mwpVnevaKPI8hfWyFsR0saS"; +moduleBuffer += "Rjx6M3GraWPxcGMEfqQNA5ALEcPjuUBMVsfToWXKg9ZxeKhLEinKJNDzqHdptDayOjqt3lEx4+I4cwtSgTWlfihWeSM5neN6oxbT"; +moduleBuffer += "j9eSXwFIMj5DuyInMZ3yRoHpLoE+1GQfohVvd3kgogYj7vAjoEHaYhs4slp2uu2pMXQ2jvqgjb5jTFjNoM8Fr6i60DeTPADrXmgH"; +moduleBuffer += "sCkD2JpmqmkJRiDtyqG/8HDOjeS2BZ7klAueaTRhTtjLJPAJ4SJ3l048kjY/LCBj8kwDxaZD0GA8zpoD6+UMTE8Z6HL2GaOKRqrR"; +moduleBuffer += "uAqO4ZUPSHPwNJmA2afhvraCRqr4QMZn4XEz/BIOHHQBiO870pQR3gNZ8LTeShkRWVyKwTppFL/wmmSyBUYaO3Cx7wXZwP53HHc1"; +moduleBuffer += "UXhtEhSKkYIPvRq4jEFXgqk8HGj0T2hSIZ1LQ16/BUZ5oGm4MrJPw/k6KjvfwxFtlqFGLqVjjLv6HEgwrdE+KykXUbgBhAkoHxVv"; +moduleBuffer += "kF8iNdn8XperUOinq3WWnxZctxY/PWQmlxph5yHha6OkDtUcvhZKV+aGQJlDGu1dcdosU9qRpqcdiZQt30hPEjWdGTRg2hgdCFLf"; +moduleBuffer += "4IJKqodBgbP4/oelWhJRKfBA33PS0kY1DN5gPeb7dCAcvMBK6y6elalOsBpW3mmotl44zrvKMiz9PHjT5MmqC3V7lcFzLEjo9t8N"; +moduleBuffer += "P8l3SK03qCRMijx0KYfm68d/CaMg7e0RbPoNBO3A9B1HcSnN0zc6toDQD029iNyvWnSKFLhF67JukbvSnIY0DhS70pwuM/4U+6ua"; +moduleBuffer += "XMLxQTf3QvkAzxsz+kd28HiI8zkJ+4kYOk0E0TkrFg5Ht380swNHhEydS+Ud1CjKlKg6B8M/xo2MIKXEcElCZU9Dh1O0YYpjYxuK"; +moduleBuffer += "0ohm6LYr0BsvpMARR3527SuLYCSl7Ft1wipWfC4lIJdVK02ccxLI9BLE9OJME1AX9sPC2wsobNCeUJF3N9eU26gm6+Ba3FQ6fjKR"; +moduleBuffer += "dgElXFN7uUV+AxyKrCSvevYmHanGPgq3nBNQ7UfR4+IW8iLx/w8ySO08hJAAMlTf5yHlfxQyaAht7Vrr77pp7ub1a+Wi8EHD05c3"; +moduleBuffer += "aZmHXrfHOXQ0wB4mTfJoJUwQwixW47XH8bOdvR0I1LaCXM0jNfKw6kbneBEGRaT8CFK9cXvMcWOzgLOi3zDXYk0dPT/TFkqQCxME"; +moduleBuffer += "YeQBwRy6StPJIA1WaNPxXU+yKotUHyBxEZew9hV0KkebnXxDmb3Qb4C+sf8QkVcdUVeRdqiJgaFOojyaURug6AT4miJ+Rw/Av47z"; +moduleBuffer += "KnzjknW8Cp9/ipGY2wfZxhadPH3SQaCLG9TkrinhLgB5QwOy72RnsVBSDCT9JC2jk0ioCVbpgpUH4DmB+gMbcMTjhZeNFEGb3Sgs"; +moduleBuffer += "oq5Rwt0A9ViArQJxAZaJZivpDxMbEfKC4Q7pLzxBfuUHm5UZIeBhZ3rjI57phw8tM5Cr58QxRR8BjxGZXviwM+X4qMv0wEc8U4GP"; +moduleBuffer += "mkwJPrRMGdQcXoSTHm6OgPey4WYdPEqGmyfAo4Kcx4seqMqli3JU39JFL1Rq00UfVPkiFaUo3xCM0JE87uqS409TsPtkSwzM3rT5"; +moduleBuffer += "pgcue++Hj67V2uyn8JDJFBnsP3ipcXpxyX245DSXXMYll3DJFVxyDy65HEuOSkU4S/TLPv3UwzdceeVzS/8eAF+uwPdg8OUMvheD"; +moduleBuffer += "78Pg0wy+jMGXMPiKMPje2ecWPnX9xfPX3PCkdqEHvkKBL2HwFQy+B4MvZ/C9GHwfBp9m8GVh8CLbtX7Te7f/cOGtPX3oZYjTEZkU"; +moduleBuffer += "Puoyxfioydj4EJlSVfKnw5hfcml21V9v+slvnlr58yMLYKX/Z8SKnb1u+bUrlz7StfP3e8ZK/33GSnH29S0/+f6vfn7DlrcLYSXT"; +moduleBuffer += "DVb67wVWUtltHz1x1023bvv7C1oOWk7POPgYnxmAjxNgkMFjdKZnYbRkukFL/4Jo6Zl95MP33vzgrqt3HeiXXKKgVzH0kkJoyewF"; +moduleBuffer += "WnplH3ltzc+v2vK7NT32iJUqhl5SCCuZglgZkF30+pX/3PrrPy4Z2JaPlOpukFLF0Eu6Q4qT/dNfPv7Fw6tumP9igKTS2P/nM25m"; +moduleBuffer += "Av3CY0qmPz4mZjKq6EouOs1FV3eDlCouuiRcdCb7zpV/+/Gzd1/72ruBoneDlUoGn2bw1XuBlf7ZZ5+/9fZlnb9d/EmA3Dy09O0G"; +moduleBuffer += "LZUMPs3gqwuipU/2qVf+/NxlP//4iq2FBksYL327wUslg0+HwZdlt//ylXn3PnfpL4++MIAWhA1MRxcDGX4/ht+b4YvQFDmA4fcJ"; +moduleBuffer += "4F1X8O2HzbxspZzN5mwOZ8swR7LRcbm0hkF5kQcOwkclMEu0MQGsU0dWOJARslvK6LsXlDEwe/dfH1zwxuO3/rLKb7zIoTsRIvmC"; +moduleBuffer += "hNG3IGH0zl5/37qHl/3ob8ttH3rvHLroHSI7EaLqbumiX/ZXP79387ZVb24p8Ym6SkHvx9CrQmTRO0R1IkTUOWQxKPv6ql8+/PgD"; +moduleBuffer += "d8wPTAY9mCyqGYcnMA4RYjFDTOVPjQpeTCKzDgcGsscKzjaCs2ElezLIXgyyjEEOZJAVhTpYgqShjPVKc1+N4EbVMdWewL0QoIje"; +moduleBuffer += "oeEgwu2uyH4w764nPrjsqfdr2/IpojhEEZLeejD0fgy9KkQRvcPQy7OXPrH0g9uuvvHBJwMzkUcSdogkikMkIQmuB4Pvx+CrwuDT"; +moduleBuffer += "2Rf++f2/PvXQzzZt1grQRGmIJuwQTRSHaEJSXI8w+JLsr25/dMkdS/+06x8B8NXc+SnG4AjGYB1PCyfw+B7NNdC4DBzLIU5RUhir"; +moduleBuffer += "vfxJaAADdkJsub8H2C40S/cqDNVhqAOY7kZwY+t8ipa0YodopbggrfTIvti5ddFzL7615U2twPQRJpYUg68OTYGSWOyCxNIru2Pp"; +moduleBuffer += "L65c8cvL33xJKzB/dEcsKQZfzeBLCxLLgOyah3+86h/z7//42QD4T0EsKQZfncvvl/1p3YJ531/+284A+ACxSCmvPxfQJyQMlYfm"; +moduleBuffer += "vwFcgFMYof0ZZCYPSEloxEiZp7+alPQAkDpcSeGk1OdzoIpM9pEtr1654eKPfnSk3+5iEeYpxZ+WKPpnX7nnxTfnv7T0roN86LYI"; +moduleBuffer += "8xQ7xFOK954m+mTfmXd5+0//uuT1qD/AvTWL5CmlIZ5ih3hKcXckUZbdsfmBjTvuevKqch96itHXU3QnTiC6YgGEjcZRhvJ7bx72"; +moduleBuffer += "AZnHYSAZBtI7gCK8qmyEsF7FWK/2p65UiG+UhviGHeIbxbm8ftdr6+9/YePaVw5s2xPWJaNLhfhGaYhv2LnrzNuuXPrHjtvXXza0"; +moduleBuffer += "bd+w3jPEmSXbKA1Dr86+/eLi3z36m6XXPK19JrT3ZPCpMPiq7Gtv/m77Azdduuy3WkG8V4Qk5HRIQg6v96oDVJsjYoazSQGqF2cr"; +moduleBuffer += "CwylfOmynKXLCpYu0yxdlnwONFGS/cPjD7+6/q/LOl7XvgCiSGfveP0Pf773pUt+FWTHnxtVVGR/ctMTnUtffvqnHwcm8M+NKsqz"; +moduleBuffer += "j179z1fufuf9x4J7AAGq6BESBwcwSIdBisD80q2E2Z3gEF4d7bWE+VmpoiK77F8PLXnrrY7lrwYa7uRQhfNpqaI8+8kN/7y+6/43"; +moduleBuffer += "3g1KDQNyqGJAiCqcvaeKdPadjdfvfPeK618+qgB36xciaUkUA0JE4XRHFCXZjZeuePrZp956YkQeTdiie5nhMwmYfUL7PuHl6j4K"; +moduleBuffer += "mGUMtQ+jJp9UikOkMiBEKk6ugLntlbXr/7Tr0fuHFhiBlaERaBeilOIQpQzIky9X/OWFBx965N7BPnRvJ0wSSs8QoZSGxKAwoRTn"; +moduleBuffer += "ihK/+81DXT979t2dyb0llJ4hQikNiUGpXFFi1c3vXH3p5Xf8ys5jKTZjMH+hVlVIuAyKGd2uFsJAwsJlUELNFy7783yU2TuK6Bmi"; +moduleBuffer += "iJzhNyC7/sanHnvrppXP9y7AqfeZInrmyuy//d38H3Rc/MrSfm2fP0Vkste99NCup/9y/S2FRKTPShH9s3dc8faiP1zzi02HFaSI"; +moduleBuffer += "8HZ+cDWwD8JlWWjQ7rVw+Vmx3jv75/tuvXv1NZdefuQXgHWRferq+T+5+4mfbX9G+wLQXp1977EfPfTPJ375zCuFpKDPiveq7M1/"; +moduleBuffer += "f/JXD3+89Npt+dKlLbqXLsOLhU8pXfbfd+ly4OdAFAOzu15/5J3XX93y+PuFdrVLQ7va+04V6eyWP2xe8v7bm57fGdqvl+B7hnZe"; +moduleBuffer += "S0PdszdUUZG9/M6Hd/zqoz8u/VDb4zK5Z2jrtTQktxWmivLsVYveuevjR36z7L186dIWudJln9DxyF5Ll2GpIbzfVbUP+5e7FRkK"; +moduleBuffer += "Su3p0Aq+JLdfN617b+ur7Z3L39EKnEB1RxUFpfZ0br9eO++DH67909aXXtEu/CxUUVg27pN967I3/jLv4msvXRMA30uBLw7tL+47"; +moduleBuffer += "VZRlX/z9/Vuf++ONjwe2Znr4W1J72GbMEy/3WnYIy617EC+73+7K+DScCu11F4coem9oZUB26+o37r7itpXbD98jqaRCe93FoQmw"; +moduleBuffer += "MKk42X99uOvvl7353Oqh+0gpqZBsVVxI2hZ29k937lr840e3XFnxmQglVXCnO5Nd8GrXoosX37WmKI9Q+ou9Ei/7hAgxUxiZgkH2"; +moduleBuffer += "zgPSnaCRK14GBI3+n5EiemcffO3Vxbd/cN3OaAGWkgpRRP99pgiRve2em655edVr9xQV4CilIYpIFdoF6pYiqrN3L936z6fa37ih"; +moduleBuffer += "tG1PFFEaoohUiCL6F6SIquzSy/++5Lk31q6qyjsP6y88ScLOlyTyxcueLF5K4SQgXmZC28t2gC/ni5eVjPW+e8B6aQjrqYJYt7Pz"; +moduleBuffer += "PrxiyfMfv/p2TQGsZ/Ya66UFsd4z++Mnls2/752fvX5oAaz3DmE9s89Y75td/dFtd9+45hfPjiqA9VQI671DWM/sBdYrsxt+0rnl"; +moduleBuffer += "iZ2/v3ydVhDtYeEyvCEhQhvuUsqqLCBchrOFd7qqAps8+cKlw8LlABYuy1m4LMsjiVSIJHqHSCJTkCTKsvd3/Ov326/94E8bAg0v"; +moduleBuffer += "U/0aFnzCNJEK0UTv3YgRP9t19Z+fvffJ3xTUL+quV8NEkSpIFAOy2z945Xf3fvDK668VEo3TIYoOD8GwJFiYKpzstSuvf77rnvk3"; +moduleBuffer += "bffA16C+HmnlUWFtqGgeF6SnF2/DS4ZxQZp8dhveZYyLMgxUtuFVnbggVT9BTg7iIk0qfhCogQDp+9W1YU3jghUD26j2fNFSoLlS"; +moduleBuffer += "M8I2TwzS+cV7Gk5ZdsR8wGH7x+al2Zr58/C1fVfs0mwlxba37yy5NBufPw8/xBfICHivXMDpML5mAWWHtxEL5s2bh+1BnV9SZCdl"; +moduleBuffer += "flHESotSnzLhbtHVhSK04nDcHi/a6XzxzCh00U53N+FNsQPwppiZfztu0fWf4j4aXUC76vruL6BtzoX8/X24gOZfEv2BGQg8aSRf"; +moduleBuffer += "jHTbF3v3j+43Yif1VFfKE0XJVLq4xC7tUVZe0ZP67f1boIExbGBPDH7oBSsweMmtECzCYDkGF2EwhcEyDC7BIJrfSvXA4DIMlmKw"; +moduleBuffer += "FIMrvK82Bu/xQJGblIe8YDEGH8VgHINpDD6NQRODKbrFiUG8eZAiE3SvYrAEg0UY3O59TWDwXxgsxiCZj//+bRBMYBBNVbqLb1MN"; +moduleBuffer += "jNIFw9sUqAgGb7tNgSLPCvd6eVEXulYzyB4+vOh8E/n923JM1P1IWtBfrJOROteU1stds9XdCImVnbqA7boY3ySmGxyS7AqUtPz2"; +moduleBuffer += "z78kvWBJXZ9/SR7B410TtC/Xf5Z31VlTV52Z9l+NBwI3mMnnjW7vohYk94RH7vJ2qh4es/PW54zZG/Y8Zpm0FkFOt9ojrTsw2M8j"; +moduleBuffer += "rccwmPFI600M9vRI6yMM9vBI60dPQLBWkpburn4idO/1zxisKTDtGNyE+57MacLyTzXtfGgFAt9PBAKvxdnV0qIXoCI3vhB2tVTh"; +moduleBuffer += "9pKulh400HwcoSd0Z5w8SBh4z6oOQjVsbY0vM7hz+X4osqCIfUdEXQLDq4mufnxaU6r8DKaSwZRzKGXMJXV5vHAOeQ2+jOyY7EjH"; +moduleBuffer += "wnte+FLpRNCUpbSkqc9Ko9Ebvp1g4RV/w6XuMtwFL63jqmI/HgYRZFwS4Qu6Z4lv1ZKYsR3QjWwEeO7x0MXRk5vRdwpWbIQP8yoP"; +moduleBuffer += "pjUcHep4GaEWSVdXV+RpMEg7VdVBW0O2CFvAl7fgDmdbQu5976zT+JIIBbs+CAXXL+zyg7rbubBLXjCRhrA3sZsKR3MfB9hVpZom"; +moduleBuffer += "wW6+VWUsIus28H5esiuhx9kqkYH3ENE0MpqzIbmB7u3F8A5KhKy4u+TxaJYTbcokMIPbhsbC6W5qFEYlREXJopG855+J4ytdodPJ"; +moduleBuffer += "wjw+LGmKFO1jOXG8qeOaY8lsFd55lInxcmajslkK4gBasfPDZhOZK/XCFgGXQYYjyKyzRjcBIyLaBMQCdYUvgEmBppANvFWbQD81"; +moduleBuffer += "5iy2Aj2OXJ6YrY7lVs7CqmOOBELTKQ/GgnxD44CIm8wBWKKole0BWSI+h+2XUx4EOZaNMTF0DWX8RvrmZ9fVLaRQHrQ0Zs5Ck0No"; +moduleBuffer += "nRkvahqjCQV4dYrELYN9BMSaCB14KSN2Mlp1RkMLMNlH0VwgjUHDs/0qDb3K26CBq9qIOjcG5YaSYzrK46MBw0E0YDiAJrJ5Z/nh"; +moduleBuffer += "CIYjfjiK4agfjmE41uhVL87Vi9PtqzFUNSuAPBQ0DaTLaABr1skKaybiJ+phrZGwZgaxZppk7U1E50gfTYA6hTC8TIZW+/Dyq481"; +moduleBuffer += "C/uUvYBaQVTlpg7gC2pJWWHIQDWRpiJubBbOXtS7umwtmuFFfDMyTESGKQExMvRQckKGnoMMPQcZeg4y9Bxk6DnI0HOQofvIwBty"; +moduleBuffer += "VD1ChjbG65FIE7YZiRlbjL5k/OHNJOU3sMnR/SbRGNcU9dMY13PGuJ4zxvW8Me73nhwtFo9xZStgkG7r/muU58d3f9HJIisHt2AQ"; +moduleBuffer += "eXTyJN9nJ3NdtKywZcdaaVlBJ8sKyC2Q+XZSPDNdaTwB5Jzn4kK64CkM7KXdAHupe2BU0b++2Mliq7yK+6KqNxtW2Bxu1TtStubg"; +moduleBuffer += "T9+jK3Aq+BEm9i1/bXwZghV+3lc6WUxPxlF2ezt+HPUhWqX5MEHX68i6cJfhRf8r4b3+O8HLOzJcnFZp0fIeQQMWc6R6GZW8JmqY"; +moduleBuffer += "c3vJe9zSYezhaLwaftrwt4Z+6HUg/dCroB96raYfeq2kH3otpx96temHXlP0Q69x+qFXS/7wDIAPHMbm2BVt0q82e99mn9zsebuA"; +moduleBuffer += "R/UU/abpt9jzs50NudUu9l/T/mtqH/xuxwt62I4WdMxtrVA+qm3foXap/9pjL3xrl+elqciLyffRne+RuzIvpndeTJ+8mKo839o6"; +moduleBuffer += "OdHW0be2Kaqkb23cPC2GaFP0kb61MSZNMb2lb22MSVFMpfStjTFJiuklfWtjTBHF9JS+tTEmQTEV0rc2xsQpplz61qatW4pRvrUx"; +moduleBuffer += "JkoxPaRvbYyJUEyp9K1NRu8xwvZcaxvoWtsIWVx5y1JvDxtsCmXZVWs1+4kIL6r+gf6tk3/W+dqwGkGeDQPDs2tgeLYODOn/CQTc"; +moduleBuffer += "jOX7sz4et1ek9wuLBoJb2QpcqP1jc5Ybb21GZjyHQmh/YE4z9zvdIAcBBt6GoA2RRVexDREpcQX8X6PpeDMeMB3PNg00adPAkDYN"; +moduleBuffer += "NGnTwJA2DWiiD3YItFy+/THmGzdYz9N9rTYa5WqZ4B5pJHbX9dxjMvo6Q6YdH0h7vxGYs36dMGouUj16kLyIXXmyNdqtZAc0lSQN"; +moduleBuffer += "u5Xufc+tle4MDqJviNiDyDiQu+TZtbhG1sRB5HoHHxYZDRqCptM69UxPfC5B0UzDW21F+MCrhhrrZ8JjlY5S2WBzsZ6pxOcU6FIN"; +moduleBuffer += "jwaSZMcu0xsfK/VMCp8L9EwffE7MVOEDT3rQmF6mLz7u0DP98NmuZ9L4PD3Tnwy4oXSEm8ECH8v1TCk+z89k8DE+45DpuMwANsYY"; +moduleBuffer += "o53PIejpifaRBwPxHAxxB7s1eC36IETbwZLIDkZh4WCJ+FJxEJTRITIdwukQAzpErMMZKFIYW9kh+nSIqg5R3SH6djiDsvrCDqeH"; +moduleBuffer += "iHZkhyx0DhA9MU1NhzA7RFGH6NUh7A6nWPTDWLtDpDtE/w5IK0QHTLWYM4qgD8zO7bgUqBgSiQ4BJVgdItkhenfAWmYgJYuJnh3Z"; +moduleBuffer += "4oVODdSDDSP1EP06ssZCpwxmaH2hGNThlEOe7PCFUFxfmFIhrqTDqejIHr0QigL4HXg02amjNA7tyg5eCMBLRBl/GjQcUCfQCndR"; +moduleBuffer += "R/bAhQ7u40b4U9lwQJhAsztxqmZxB6q23IFRcSgbo6Cg4uGADBwyorwjO2IhiDlR6LfsQAQVg07IVi0EBkQA7eFAQ5C0AjoyW4LV"; +moduleBuffer += "SMAQp08lw4FyqHH9O7JFC50iFNb4U5/hQC9UjSIqMw6dMxyoA6KKZM0SHXimcz61sLQj2wNrUQF4ykahbIApOqBXgPURvKLh5kzc"; +moduleBuffer += "HIL+z8YXwlSSVJWg0x60fAot6b3QoVUYf4njdjnmsVR5tGmPaaltgAAngRvswCAFdP1RCDcGVJAtx7qUA0az1QCRodGlb+CqokdH"; +moduleBuffer += "tnahg4Y7ZTlJ3LLHVjgdWXOhk4YSU/yFboEh9DSTDBAQbqEjFKo9UI4zAHfYNSitsiNbgTU4UNRw7t5sQKsCyDd7MNaoRpXYlw0R"; +moduleBuffer += "mhLKAR2OYAOCg6H1B1AacSCQITvmI7HahmlgIIz6QTDiS2C0l8JQL4OBHYfRHIExWwxDM5FxyKyM2wWzjrtGcxc8v1b6yzooNEc+"; +moduleBuffer += "bqq3t43klSZ7It5hKe4AwqZl36LDDN+JSwL7JDQbIyjkwGTr7vgnT+IG3fnnz40u7ujUue07/W9obAE/wlN+XRz4iqZSTmL7TfLr"; +moduleBuffer += "8sDXTvm10/u6MvB1h/y6w/vaGfiKVkDwKzzl142Brxvl143e1y2Br+0mf4Wn/Loj8HWl/LrS+9r+r0B75dct3tfFga+LLdley2uv"; +moduleBuffer += "/EpGyCxpG4msgEjp94zkW731NCKn0/KEX/sUYo4OneDb36BtIzIljvFsbCFK72hlIoZWGDERWiqnxMt1NJ8YkyHoXgdd7VBeeEdr"; +moduleBuffer += "KRZ9aTfQgIohYpzLQGMOCUiHFoZ3Ij/vNNC4VJFIUoIt6GaKPlJmE+sXl9+WQ6gYQkUQKsIzaC7a9HPERLHMCX0HaVIMBQ3NQ6Hf"; +moduleBuffer += "gCkrTt9TENqJXhRS+EhDI3bi6jxNNeKKYXvhgY3aablxWsHTPqC7HK26U0tJvlhlkQAhZR/4WRmIIAnjDj8ChZPlFhuA0pvQgnqS"; +moduleBuffer += "VuxEa1BO4osuZ3TTfimmfT81R5YT+6LLwSG5P8oBUsVyir5wctP3D346ud++8OGzxdgf5ehYRvEXjhtz/9CA7LOSL7wcfT+1R9s/"; +moduleBuffer += "tNbO7bG/8LGzX2iaePf+mdvM/TTn6Pup3/Yvfv6vnP/DD5YT+aLLEfuxGDo03oLrl3+y32QhfI+PDMH3+KjCyuOjDGMJsvBOSykg"; +moduleBuffer += "uNs+BKD3WLQEQgUwtVL9foKi0AOTfEkdl4yRO7smdeAwSLfLA++HeCcOK5T/knek7lFyYUQ32Yu7oJVVSGNEkxojUouM3cbQniwe"; +moduleBuffer += "biGgxR/RYckvUDPmFnxnS7LuVfBub8BTsMEjtTJ3lfpU1ujewZ/cO7u6EH4ft9zV7afJ7LJFneUum9el1WjaEXKP070KwmgumcKL"; +moduleBuffer += "/IDhlvNmNOtBYKjc3YBFxTDU6K7mouw7LTyNrzHK0WslOf2sxBMyezsrLmE79ZFanDJhs9Ch9G+5yr5DaUygkR9H3P4cqSWEcl9P"; +moduleBuffer += "3cHt+qHhmLVanPzHm3SyTU7k6RzahQftkOrku8hy9TFoG7dWS5D9YPJOWKtVuxa6NKI6LLitC/o/UAfUkUA6hLqwP2LKhX403R/f"; +moduleBuffer += "RGl9T9cO1pjtE7PzYLLNrnEj0SDhS9jCCOLOVAjSvIYAgmRPau7mQDfyUSa5UtRwl193d2GyaB4E95KPETwjYjtC+IuRQSJiS6Hc"; +moduleBuffer += "IYD7Xe+tY0c+RM1ArYZ6MdVLRL1UAqGzN1ED0t9wszUbPcR0askHosO+2dLQ3DKsfnrLjOnDhk6qbz5nxrDmhnOmtrQ2XzCspXnS"; +moduleBuffer += "sKnTJzecP3RSc31rQ8vQqTNqjzj7kOGTDz30rLPqDzm8ru6Qs4dNnnpOQ0trbd3QQ+qGDqcsk2Y0N0yonzl12KTWCXPqm6fWnzWt"; +moduleBuffer += "YSgU8pmLaq6fPnnCpCn18D+U96Whh1C2c2a3tgB4TWvSbG2Cpmm3wN+BGv5nQ5ymtcHfQPj77BU4a9qMSU21Z80+++yGZm7xYZRx"; +moduleBuffer += "2tSzoAbbobyJUM7puqb1g6cK3yTro8JYv8qcsAiE74a/8pxwn0D4+pz8GO6fEx4UCK/OgVero76VHx6RU9/D9TD8BIQPCISTEB6a"; +moduleBuffer += "E+4RCFdAeEhOuGcgHIHwoTnhI3PCPfPw1Ty7pXX2zGGtM2ZMA/xPnd4ybPrUc6a0Trugtr6+edKUIw6rrZ85c1pD7eT65vOmTkeU"; +moduleBuffer += "DMMs+EQU4TtGNtcDspFCGeOtDc3DWpvrp7a20Ht964xmoqVlhq19F+rwXAzaD89zp04WR4tpDdPhvca0Ic7tmg8j6OJSqKyGf5Pq"; +moduleBuffer += "p01rmCwmfqOhZfa01pEjZ08/r7l+Zs3giWLGdFE/XUw8rrl5ophTP212A9FmHP4s+DM+F8psmVL/JabIEZShpRWSUksWQG2/rTHG"; +moduleBuffer += "v6T54YOx3JxwyRfa69BBMyZx7aZNnYS1K7dsbRqUeQP89Ya/nqlTPlr8/XvP/OCTOdeds6vX+Wtu/HL541ePqxjz5sb3nm68e8fo"; +moduleBuffer += "91/JbJj+zNuzP0z+1D1P7zHLeTP14o/vevDyjyov6DPJWfTMoNhpZRPOePWqr48eP/j0u77eeYa24phF1cWNN8XH7zp6dfKjT7C3"; +moduleBuffer += "E3MMLdWV1N5/68HTHz/ltCUnTDjutG/MPOX0Z847d/u3brq2T+zMH29t//e6//5HhSZxhH8m/J3afMHxzTPOPQWrD+ic0fx5TCkt"; +moduleBuffer += "Z8+eVnvo0MPl7CmpsXXquQ0TJjVfMLMV+unUsScfd9K4Y0+ckD3plEMO/dKIQyacPu74kSec+JXja085wT209tDDj5gALEk7B+ro"; +moduleBuffer += "ytlBhY+Fv2r4mzn7LKi2aGq4QExtEa1TGsTUyQ3TW6e2XiBmzpg6vVWl/2/4OyqQH2fUHoHwWXI2VeGL4O+QQHgBjvjPabYt3DUt"; +moduleBuffer += "U8+ZUD/7HOiXM6O2Nlnj2QLrCN0z4ZSxY7xuGnPohNNP/spI6CPqolNOOe2bE74xboL7zTETNJV3iOwfFa7dN1jjx42fABWaXt86"; +moduleBuffer += "u7mhcM/uJaSvffOkCZ/LRHBocCJQzJjmgititvYdbBv8lcHfOW8kGjvuPueh5vemjxr5wbhb536j+OuLpkSW/vz3l/bv/fSW//rs"; +moduleBuffer += "1fluQ/OMSTNmXgBVGj70S4cHuKWI29qZUIdRyULzzv9uSeSf8bAksii+fyWR8xNhSUSFlSSiwkoSCYZFIKwkkWC4TyB8fU5+JYkE"; +moduleBuffer += "w4MC4dU58JQkosIjcuqrJBEVVpKICitJJBjuEQgrSSQY7hkIK0kkGD4yJ/yflkRqkruXRO5LkiSy8VqQRDotXXKq/6mSSHkqLImo"; +moduleBuffer += "sJJEguH9LYksT4UlEfzPLrrKuOlH737Q55r7vn/Ahx/c2/76QUf/6sd33PiXu0f1uf66q5Y0HTGpctKvz5nx0urxx155xcWR6D8G"; +moduleBuffer += "/HR25523rpv49OrrH13+s+j58/9UedE9Xz7nXrdjw/19qsZ0VLxb/Pb9a997e2JL4qArS7960tiJO4taTvr2siP+u/+/28749qSi"; +moduleBuffer += "n03reOPNCWPT0//yq3ceumnQOztm3/nb2Osvt190+UeXat9ZOfm1K3d1rthcX35w0YE/q1z+1tYvN961Yv7Im4964mtnjr3g7SdH"; +moduleBuffer += "3TL+9F5vvlv1h0k3rj1436Udt2sZENLT6f8tIk99cVjkUeG9FXlUeiXyqLASeVRYiTwqrEQeFd6fIk9byR5EnkN2L/KovErkUeHd"; +moduleBuffer += "ijyFYX0akacwpP0g8txj/88ReUaXdifyfDET3KQZwAwmtU6dAfDOam1uaBh2bv3MYYCr5guof+6COl0CdZml086hVt8CdcLk4uz6"; +moduleBuffer += "qcBGRgJmzxejxLHuePfYsaee8Z+p8/QZk5mHaBN72NqF8LzWYHaYX9+Gyec0DJ3SgPUQRx0lWhqmna2CteIQlf8XMr8K37tbeFCj"; +moduleBuffer += "ocBuawYjtMktrRxQ+YYBW44E4PwCJs4BQbg54XcsOZfsVb2p3X7lA3B2mFzf/xA+6udMPUfxdW1Hma1dDM/ToQ/rNBYhP/s4Oqdh"; +moduleBuffer += "ekPz1Em19c3N9TiYDjlMzok8mHDeLbe1ehxPEneIh5TkXVH4i5Fw4y77GXC1Rw0UjwjD4itTW2ZOqwemcC70xbkwFuoJEc0NMKFN"; +moduleBuffer += "B8kJZKQGZHVi9vSG82dCyxsmT7tgv0gjrc1Tp+Ms/18VtnYu1LW9SNOK4UmcF54q/nJoalUgfFlO+ByLZ/QlvXYaj35ruXbD1ZcZ"; +moduleBuffer += "I349zdy11DDXrL3RPHNw1PjWPX8zNv/rIuO6Gf20VS/Y5scD3te7rnP1ip84+n29PtIOys4zO38zzphzdal58wHnGfcX99B0zV2w"; +moduleBuffer += "AnrTHVV+Z+ULdW9eoN//9oRdVz842x501nkHt3x4wWPfHH7rnAmLK4u+dfUzp53y7qtnbu394NZVX/3hoPcyry6Yv+35ju8sGFT5"; +moduleBuffer += "yawOAPQCAvqF8UngP7wTgJLX1OkgnYKc63EZFXFuQ0tL/TkNgpd602cImPubG1rEzOYZc4ADTT5p7KkTTvjKhBOPO2PC2K9MGI+8"; +moduleBuffer += "Znd8J5z0xO6STqqfPn1Gq5jcABQwFerx3d3UB6Xyc1qnqI/NYtKMGc2Tp0ITGo6bNLml/lu4BJ3eimVh1TTtsV42EeuT8jmHE0hm"; +moduleBuffer += "evbUhuaG6bPPFcHMmrtoJfTbH4mcgTo0oJnZk1rFqSA8HYuy07FTZ06BmaXh/FZx3tTWKeIw0cBEjhJ4pa0dJKVbJfUnP5fBOqel"; +moduleBuffer += "paW2uaX2MFgMS7m/oZVG6emVLNVfru2/CWtOAzxh4E44G0TXCbicmjAd8NMwGWrUBfVpl8JAhFZLM+snoeAyY05D89nTZpyHQm9v"; +moduleBuffer += "WyvV3OX3Qk/X7bsYveW+T5dv+f2Qb4WlemysFNVU+Hj4K/1csLXXOyXa6Kr9u3Oxuiq8MxEMi0BY7UwEw30C4etz8qudiWB4UCCs"; +moduleBuffer += "diJUWO1EqLDaifjs7T+vvuXc2rMgGfA3aP+hQ488XGJgOhBgK69IaRtpdTX3fbXOTKAkwN5sSQvA3jY9CFRzTwzngx7/S9jbtX3D"; +moduleBuffer += "7K0sMB+Va/u0g0GcUcFTbFGFL8sJK7b4Ba85tHn9eNGxSLaN5tsnVr+Hi48v3/7kPFyAHLzzqo9xEfL3I/pOwIXIc5e8sQIXI/2n"; +moduleBuffer += "HX0wLkiaHnY/xEXJBZmLymhhcsxZ004Zf9JRB7Q2NNCzZfpMes6eBEIivvE5FP6X+xzR36b3I+GJQtFoeGJ/nyCf4+GJvGRKa+vM"; +moduleBuffer += "lpHDhjVNboFF3NlD68+dPHTSjHO1ZfC9F/bbnEkNTcPmHIK7Nav72zSfnzx1Wj3uRW2EMM6nPPfPmQDVo87YAvGIYxxFuOhU4XoZ"; +moduleBuffer += "/kbDzBnNwFzrW+vF5BnAy5HVnlvfOmnKUCFOnQLLSxIEgSKAoqdPnjoJcQJLzvpWWndiviECiHQaMl9cKUyf1DBEAHV7wkOLABlB"; +moduleBuffer += "nFU/GcRp/IpZ/I+qPjdLXqjCV8kZAvuNZJP/+vgT45aHT4lsujER33Tkl0648PrBp9z+dksBxjt7znktk6bA0Puz4H7fKp+vy+cb"; +moduleBuffer += "8IxqbufaT8cn2rs+Xb7ORyHfExGUsrAWxgmm9u9fzzv9g3Grt78zbtF1MyKP3nXGPQMrW6bMmD1t8vQDW8VZDQJXs/tx0vu7w3Pe"; +moduleBuffer += "VqhgOm+k7t+d12kDwjuv+3M/cueA8H7k5zBjzT6rFapz6NAj5GkFM1wlrNJkOlIMEYolCO3pgTbxnM3wxJGhkrKUK7SdOd9nT2+a"; +moduleBuffer += "PuO86UJJsRMnBqEB/xxkE88aDE/kY/AZRjAMTRyeIMvLfC0q3QnwrJQjUM1krVDWGfC8j5Z87oangKKbg8fv/4+994CPquj6x29C"; +moduleBuffer += "X1po0mWRTgjZ3fRI25pstmRrGmjYcrdka7ZkN0HpXRQQkCJNOgiKCAoKUqUoTYpSgihNOghIh/xn7ty7uVlA5XlC3t/7+b/4GbPf"; +moduleBuffer += "e+fOnZl75syZc86cyXTDyY6aMvJ9Fo8rQE0czIFylxMnJ47yyY8ZEus9TJff5/YDzlLsBp0R0TmKWLs/K/9j3N17wZuhfQCIHdxj"; +moduleBuffer += "EEDjBDHbgLXN0H1Qkqvx3381izHGhhd7Ywx+TxHujSHGEbsni/yERlCfIjzW4TKieWdoZzTPwUX4azTMJnkbheNIaeIlLJMvYVp9"; +moduleBuffer += "CcvpS+gJX0LR+RJ6zIhXNrA6dEWUuolUTjC7RGESkIpA+gSkvSDdA6lSlMZsTj5Ukbvtfi9gr8k92UgqMaEpGFvUFSlKllUDcz05"; +moduleBuffer += "71KSZFsMSbpAklx/CFDtHxGQjtv9L5EkA90qSpIvY/viLjsC2ruuOtVeSslClUlJkxR+PwxT0uTz31mR9VR4sxEnrBzlyj+e3Usu"; +moduleBuffer += "73nwWxIkG/rFWdsdSWffkX9foCUoL6QSaBr3GPF8PWDMgJwSerJodA2mbJ/V6UeUoLf6QkIZQQ7l0wlaQ8aQkwUQJ3EzqCjFck1+"; +moduleBuffer += "D+T9TH0xlOaszhc9wAJ9EJ+QmJScotMbjLipMppmYCPVPJGfMFegUXIkGo1YG0kPD7ojKX48hkYwhUdjUDbhjj0OqAcMFu4x+KMZ"; +moduleBuffer += "NUu1JxOX+MuddILMNRv+iHpG20VERqm7JxL0HaHoZLpM1AQbx6lCwQuPqbjY1IFZsdCPA3G5kqiJmLY47ARy4oqFPAV5S2CXY5C7"; +moduleBuffer += "xLTqaBFO4RnVEavSMQELseOwa7xg8mXG6cACwY0UAhQbg13+BmJji06BHp1DzM0d/pewsbM9K7KxqhQ1B8ZWFDWfY+X9HzEr/B6L"; +moduleBuffer += "rAo7MeS0QvURxZYp/H4YptgyhX8kcToO3tyDCUdEe1KaJAZsZam1XjwJc4j2HGRFEZbk4gg4CXP3nqEEyE4YtzQEOmPcqyHQBeM+"; +moduleBuffer += "DoGuGHfCWQp0AwwlBLpj3JUhEI1xN0IQB0GPl50S78NHS4mCYihaANJjDU5USAR/seL41dIpk1ORTqmpBsnqFZcaszloEb+Cg5Ym"; +moduleBuffer += "VN35QpVGLBLzuRphJWhRCQVmUs8UIjtglchIeZKDppFoDC1hKdwDe96S9r9/sc7rBHInyazzXSZIbJq4KMwARQZSwKvsd3pwHbiA"; +moduleBuffer += "uPfuONS+97DKWqo+t30+smlYfHwU4bEhBx8VKqX2xnDnFI5tVPsqR1pybFW3ez0jmS0/Zt4KnBk/Zep1SdLZqczIdnfaR3/1YHPm"; +moduleBuffer += "QEmj2vsw7sjLgMgbUYqdMtLoBOboHVfoM3nYzfvw5rVKWDAQwp8LzMpmIHoQ8hWaFP0AIjJCkwKG3U+IwgrA22dhSNvbdd0Wscl/"; +moduleBuffer += "sHfy/p/nnwmeZTplrTWPU2ePKWuwMHfkaI0x+le5rsO92GFNms3ttm1VquzpomqSVb2rd1i5fO2gzcs2f6JYPaJn1h+r3jtedsfS"; +moduleBuffer += "UrV9Z79l1pTOkUNPXfq+Wd62T4PRz2n1yOug1QMfgwvVyDEEfz8q+/t/L/9NdtwA77lEaLGr0r6xO6lq7RuC5Ir2BQpXnn3h7zXT"; +moduleBuffer += "O5Iraqarsq/jU6q2r1enVLQl0TGThilbEh23ouE5Yc9TtiQ67kTDlC2JwtS3pnDlfWuPF7ofp/RMRIzSbnZ5rD6Lwxvr9pKi9epU"; +moduleBuffer += "tPLvEoFc1CgcH4GsnxROiagseniBOgSUL3iTrhHhTroPRvz7KZUz4v+e6pv2etYec2xuja1vzfn2x1pH30ns3m2WvvkpNysvIndy"; +moduleBuffer += "Sm6De8euxjZj191SZu4cZ27ULMcyJmPtB0snPjDW71nv5KLMh9+1TV+X9qqpd3evitRIeGAyHUBGgmp5aPrw6hw4tVbUIS88Ygn5"; +moduleBuffer += "6l1v9L0R1QyIfNXLlX/W0h/p/T+npR/Y51mv4f+WrpBGiOlz0fXN5cYsJnRpYHqBUK/zeFMBG2P2jSJ84CtjmV4Ehi1YpKNli9Xj"; +moduleBuffer += "COhA75v9gL/HQinbG0sa9XL6Ik4ONe9wAa51Qh4P61xeY0KzAyp4BOSFy7Pnt4vmoosahhvYoUex++BZ6J+fxRdKyo2DsC8QtftA"; +moduleBuffer += "vtBiHpoRwUPx/aKQR/l/3R9Ov4MS0sAkRyzp0AAFF/0hrRHUtVNKCHYY5pDXDoI6QZ17POT+GHK0THrFM4COtAnU46KxGkXyPgoj"; +moduleBuffer += "74GKuFPVjGVi+FBWi/ng/S44bqohJQ4d96Th0mpo1qZj+J0toG/hPgboFNk2DD87LiqzPV6fEX0kF12Z5eYhtcPqiKpX5dzkPcuP"; +moduleBuffer += "epC02JvElHN/H4xc3tsAkbldXiscRlyKgBQ6D5hdAJ/1yqxeL1iPVHi2L0hcsCyT4MUynd3k8jhwI/1+P5AyrUYtMgi6rMawd0Pd"; +moduleBuffer += "qJSYuASAsqEFXURwBxH4n9zlE7n8zgrl8cKehw7+YrBQgvo8H04t/PPBXKgz+Pw6ez7aHhPKL4D5XWIwmExWJ5g90LsrlikEyacz"; +moduleBuffer += "y11Og87pcloBhwVNCDVPjfsEfred0HSD35keaHtzmjNJpzH41x4qlSoTemwpcIcC9zhgL7qcAtxpxY0qYvWs0ZllLiNOdhJAcr9D"; +moduleBuffer += "j3vESK1B1A0uuaB8lAYSyKANqSepv6i5FdqRTuUlioWsVANmTTuoK+hr8F6opTB6cAcgPuqzhp6FHmdanyk5K7Q3qPxeBvwOkDFn"; +moduleBuffer += "Bpy4kfJ0BHICtKmG5ZWApHY5KkF1rLcSapUYds84UmEPDQMep84OR9tVIVIUQ75Qh6xDV7LPpGF1kkG6o8hbHDKduEOEHgP/8YRp"; +moduleBuffer += "YjmTpiYirjJkYnFabgmfz+NJzNyAmMc1iwVcJZcrE+am8dWFaWqxPk6gFPL4BdwEFzc5IFDmZuSK88TcbK2AxxXzGTwl35Iu4Op4"; +moduleBuffer += "ZluhxWZNSwmweFyl+ZmMIJ8VvkAmkQm4ZiFPlu4NigRcNYNnlmfxuF4Zn5Xlz+PY/XnZWcW67ASnTOkN8JW5giylMk0YyMjSlgi1"; +moduleBuffer += "Mp44jcvWCnmBgFTLEfmNaUIzQ8kJWgwOYZBfws1AhZllXJucJ1MlB9JRARIBL4+Xl55n0Tvk9jw+T67Llhfri3nCvJw8NyOXk1Ui"; +moduleBuffer += "U4kDQi6RWSDg2nlam9enybZ7c7PjA+kWg1xWwA3KBOJimcZQLCvhsrPBNblAS1xjhC4W8JJkKmVAaCYKkgq4PpHeYXTrHVl2gwM0"; +moduleBuffer += "rUQoBVVDTbDI+FlZMnofGGR8ttyid6osYqHcm5uTYaH1AfgsGQKlRmiS8VhEAXxzIFuZreLkZicUMPKylWZQ3QKDI9msSsvigPbZ"; +moduleBuffer += "DSVCtYzHJTJzA4EMZVaGVKplu/VpIj/47HxxAVdOfTUG+mxCEZebyeeak7kwA98sAb+FXJbUmMBRZWQacWuGvVDCyTB6sxyCJJHN"; +moduleBuffer += "53f5sgM5bJPczMiOZ+fkpuSUsNOFFrXWYZGWpPD9KYJ0lb3InKGWB/V4bq7XmWEqKi4IsmUmLSsrwWeTWLVsIe6Vi3w6Btum4bK8"; +moduleBuffer += "JXKr15hrSLF6C21JjhxNQrTElKbSmwzxWbEpJSqxQZhcYE+XJ7LV7AJ/ck5KXHSiMSjQetI4DHVJsDAjnmcpLM51aAUevyInQ50T"; +moduleBuffer += "X6Q1sNiKpIKUZJm7MFOdkuDJVBnT0nFxAkeuK0lwcHjRmdFFBV4+i5HIMsYlFeSmSEW4P1MRLwN8MLnQbLJy1Ak2SaE5VidK1Cl8"; +moduleBuffer += "fm6eMkuV5I+TiHJzFAkpOY4Ms8/gMrMSGGaHmKWJzbT6pBZ/SVaRO88gdVtYLqMlli1W5BQG46JlzgJBShI3yZTjLkwzxhYnS4I5"; +moduleBuffer += "SQU2r0ZYws00M/QSLq5zxNkd0XHFErFBkyuze1WyHIWhQK4XFzm8vGKbIDY2qHZa/V5/Os9mdtqFcmF2kK016JVKj5cRbc4S2PxZ"; +moduleBuffer += "CovXWSJWyc25RbL45NzoJGmaNSPX6XEIk4MGDx7Ebbygp0jHyUrRZCgLnfI4ZUKczZdQZGUorXHRZr7JYQvwWSKWz+oR5+mlthyF"; +moduleBuffer += "RxEoyWPJUnB50CIuVus5TneGyewsLElIELP8cXEBS7yHlSdXMnBNminAipPxtL5if0ka7k2zGQLRdlehTFfILlTF+wrS9IrcIL/I"; +moduleBuffer += "zS9Mis40u/l8l0xu9XH8UleKjJ3MMKWXsFn2TJkm2ZnN1Rap8kQlPjyH74hOUqQbcxV2hzKgDcRJi3BnRqxYmuNSKtJNels6i1+s"; +moduleBuffer += "MFns7AJGtiVDlKfz8rlgQHN18mhZeiAggCNSxVJwlemxgM4hB0ojB5JRYFZm83hqkYfnUSljTWKGR5SjDarYPLWkKAsXerTaEq4C"; +moduleBuffer += "jtB0FRhOpmQhT8MVwIJkAhdRQHpAWSITCAPSRK7PxfenMSTZFpYxnVeSaU0GnawqAeyMlWdNsOizlf5cTopPGpdXkJftLTIWCItI"; +moduleBuffer += "JlOUG5fhpZgu45+47j8xXcaLuC43HvB+JT/RwbIJ3IklRfGZBSZzcXSJHcct3mCiy85yGcxZuJ0h1Lj07mC00M/3FmaJVAoJuyCP"; +moduleBuffer += "7XXH2ouNKdEsk5LlSUx0Jtl0ZpUtnq+LSzEnJmanaTJkeIaxMNdjDTDUmoICAV+SpVDj3uycXEUWt1gApK8EJ6compdrdedlW9xF"; +moduleBuffer += "hW6dNTNamCZJEPMU0QlJyUo8O9ardtk8EoYxXSflBtM4UktesCBFJ0qKMxXykzK5GXkJOoXLGYhXCTkpKaIsncfC1gQ5uCYuoDbb"; +moduleBuffer += "BGa/j6/hsXMLGSWaBIE/UMTFow0uDl+cJQYfSefI9atFBQo5i8c3uwrsSVnReo3Ln2SUeQvF/lhNdqxHwc9JiRVqDW6GJE1SqFDG"; +moduleBuffer += "KaLlKR62pUAoymW77TxzSpwvIS4z0xWfkiYXR2exS4pyFFJxYlAsyvJaoh0+F0flMwtzYnGG2yGTaOTyRLc3OxlwkiQD26LJ9skT"; +moduleBuffer += "ZXqVX8kqcgDOE8vxSXgijiVZk65Pic8sKkpPd4kEbj1fKLUXMtKd4lxLsJiVK8lJA5MiW15g0kqDHo8jmAXmJYMzQZicZjQ6iuS6"; +moduleBuffer += "RMD0kr2GDJ1ZaGXHOSxp/viMQgsjTqmN85qSrVq11sNKCSoFgXRfplKbJS4Mxjt0vDwFz6eWmaILtQJfQY5aXZhsN2UbjMl6qSfF"; +moduleBuffer += "YfRqnYyMvAxWtM+vkEkcPKc6PTmRZbdLbNFZ7iyl11yoLxGIizKlRYLEbLbWUchJ0LuC/NyMaI2f59LFe6PT0xn8LCu3yKxJsYEl"; +moduleBuffer += "Ha+QbYy2FhUkem229KC/xBDU29jBosS8tKDHh2cEs9KTJPacpFyVMS8R56okASkez+CK8sD05ZLwlb17MwihRSgXPCvI/JOQY9UA"; +moduleBuffer += "IUdgpQs5vP8Tcl4k5JiL5QJxIEzIIS/+Py3kALki+z8ScpxajtHjkWtMeotcKbbbTdHZnOJoVSZfry4RG9k6SZ7Jx+BoUkoK8pSZ"; +moduleBuffer += "JQVpBoOdnWRlO8SSbHuSXGPgsbJyc3xxGcE8dUlmXoG3QCrP4grlHFlaQYoGLI2k0Uo8wJDk5bAyHEqhP7fAEZ0tsXmlvqDZKHWn"; +moduleBuffer += "CJOEefKAXFCYxfawClWKBB8vOTPbVqzUi41S3B+v45ckFcSqGXa2yAYXK0UpXr0orcSXZAg4C0qsKY4kp6vQa4v2q7J47rhosTMu"; +moduleBuffer += "QakwGgqSc012ocOZzpMX+bWCDAtDys+QZSdLMgsUidHRCoveG2flW30ZBq5c6MuOL9TIRS5Jdhw/3a43qPkFGlmyxCvXa4Nx3GTc"; +moduleBuffer += "liDMkjLAzJXOdvtShHEak1uVmFNsUkqcuYk2e4JOKFYEjNlxuChXV8gXKTxiV4pbqUnM9gvUivgMwBj0eU6cIZGI9XkFJTm2DF+c"; +moduleBuffer += "XJkWxxH6bbliB0+foubbHCnRJnWCNE9kTnEVlPj1spy4aLmN51LniJMyFUXOdFmQUeB3pzgCCV48EXCypLRCN5/L0ciL3S67w6+M"; +moduleBuffer += "NnB1waykjMJ0YbLRnuLONkXnxuk8+ugUq1XED4h88XYG154RSBCw+BqVhs/OTcjNFgl4fA83tijN6dA4C9OS+dEFBVquOslQUKBK"; +moduleBuffer += "LozPVFiKBY4MlcKp48fmpSUw/AqWhFWSmObKjI3z486UQKHXwven42apxp2JpwszVBKPUuSJV2SJA1mZPFY0rs9MEJldxZmB+Dhn"; +moduleBuffer += "sYghSNBKeIKgkBfPk7hiWX6uVZIuVRUVmaX6TJVemyzhqsRettBVKCxwiJK1Po9DmZ3FsWgLAiWFgaJ0EQO3JnsUQRkp5GTyXCV8"; +moduleBuffer += "nkvANRJyijJeKDIrtZnJef40vkcQq2Fb84RWfXySMV0q1SQXxZoDjPQAIREV8HjmgMjF1Vp0AR1LqwByZzCLLdMalVqrh51jkbBF"; +moduleBuffer += "MjTUVSwNkp7MAR5gbYxYyEgF3Ez0xmQkGXFBjZTKQCZ6wMQTyAIyDbfIxeeYJfG5bl26imVIlyVKi1M8jLx0uRvwAYfUIfLl8RMK"; +moduleBuffer += "9BxWkRGwLl1xCkemTgHsK2jRW1PAcA8EVObcDIkrT2wpMsjBCAbs1WFmCErg2LabLTYzL08pEwK2LuJKhAYZz1WRrQuel08sYIBx"; +moduleBuffer += "H3AFYJWFArMZNEdsxrVKtYFrirMLcgvN2Vp2ls8u0DvE8mQ1x8hPsDmUJd682HQft0DplAoZCjG7wBJnztBLg9JEsylOklwQNPhK"; +moduleBuffer += "MrOdtlyD3miSZWZ6OMkSTVyCWMdVcVge3CZRidw+TboFjxaIPIw4rqgkTyoQJBmyJZyU2DS3wupTZAgk/CJxEjdea2YlemxJGawS"; +moduleBuffer += "Hs42lcQW4vFWTqyIzfEUmQL8tFyLgaEKKoqTlKK4wmSTKjGNn2HksbXKBLU9wC8QBQXxfrxEqyrxie1iboHM5ksSiIokKks0p0QS"; +moduleBuffer += "neC2Z6WlMUTeAkGGT1bC8RtTilnuokxhfEGcMT1BnJ1SkBbUqdPUvkK5R6d3Ot0iTlyiUONhx+ri4/TJIpFEmqCUMxy+5CxPStCZ"; +moduleBuffer += "o3KXOAv5qqLCAk+0LcujTzTaTX6N3W7NwZUamZ3nUmWLMjJV0mSugZcRTMuLl3AcOYCpApldm6CR4pYESY40RZ6dpIst5GaKtV6O"; +moduleBuffer += "yJppKfT4SriWDJU5RVyQrLQpUxS2aIMkrSSQKLTHaeJsoBOF5sQSW9BRJPPr9HmZXqPEpLJlmyzpnDyJQWMXmBzp7HRWSSFLydGn"; +moduleBuffer += "xfmLdFlGK98HhDmpPbuYF5ecwVBzTHKvKlZRnOhL0HuEGXyRvKhEJ7AVJ0pwfrzV5Yw1ZJm1OmtSSYk6Tp+mzC6RCCTauAR1oVzL"; +moduleBuffer += "ybYpGOLkID+Pxcr2ia0SiciZk61VBovsEofDnMcT5ypwFrtEwJIn63yioCPbqnaaMuyJKSxeiifDLVfBJYeuIMjPjlPj1oA30cPO"; +moduleBuffer += "c0T7+P4svcwq97nVKRpLgTwn3l+EJ/gsxSYhR2B2BVWiolw23+sSJcj+Riiq0310+uh79SMiGBj32y+2YnU/7uB3ev1uaFHAabuQ"; +moduleBuffer += "mSH9eirz25woQl1NeSGp1FyaMSOVeS4HbV4oN3sgByGmT+/NN8Ct/yZClwgtdwKhClo7sOq5UTBGa4UyQy8HOZJz0TYsNbiGe5j0"; +moduleBuffer += "UkLGEeoZ4n84Ts9EvCMHlJFCe4dCKCOuzwbX69OuU3VaS16vSkeBvblV6yiQnlfREYCOW9Ew5QhAx+3CcCcaphwBKEw5AlC48hwB"; +moduleBuffer += "nuMxRTpQx5KWqq79UawXMUbbFkiqRuWVUocXO1av7F/uWN0gDLej0ZxPZw7d20r2JV2FS5kdiO12ror3MkFS2AzeZAV8r5D0osoC"; +moduleBuffer += "bYKM6dX6F4wbUNG94L81AVMOaGwy6ci/VTkGFW9V7Rjc+1ZFZx06ZtIwNUbpuBUNzwl7nhqjdNyJhqkxSmFqjFKYGqPwH2WOUYTR"; +moduleBuffer += "pRLSpbMYkC/hRftKqe3e25XvyoLc0GEkJziDoLHo95mSqXHpT2YGLGAaYxLWI5hVj+yXngrPgPYzTS4Pk9iNQr/BQ0YcYpKC20rJ"; +moduleBuffer += "qZVJ7AtITRWU+wN4UlNp3gH5OtCp0NEFegrYrQ6rj2kB06Uex6G9X2ew4KGiDTon0+W0F1OzLOUP62XqnEa4W4DcMmzRFYEplwlt"; +moduleBuffer += "Y4TLAlG0zoLrjHB3AYxAZnWhzQBg9ls3EG24gRMhxTN3g2tw3y3N35gFdxuze4C2+52E9zGVtxTkbUnDVBYKR+nQ9mt6/yAPB7KD"; +moduleBuffer += "iMb/i05iOnCfxWXsCsqD5r+uQIjQYOVuCFqQsjBk7q/SbQ3gfVN1Fb30q+L9Hl0gvwg3oKCD+igM2oKjIysteMY/el9P1Ved93Vt"; +moduleBuffer += "Q9V6X/sMFb2vq8TNpop9UsTGii4pdNyThimXFDp+1vXoFW8UN1Z0+ThnqOgOQ8c9KT5E8oXcsHns/w2XkHLp7hnZjhTnaDWhvyqU"; +moduleBuffer += "HwbLURBrMVCbv/cwCT3TP6w+/39zMYFxCavcxQS6jkA/EUrQcOuMhHiBomdg3SxRxDZ22n5ZYmpOB9ehOxvoELS0Dd3BsIHgHtzt"; +moduleBuffer += "RUXmAsOOaXc5ze+Qz1idcH8/5UYLxAkgREwF96BM6XR7AKF4Q3f79GZyVpP3YDkmPMAkswBhwWwtAnII6X8L1vcoTAlc0TuJVbgN"; +moduleBuffer += "LwbP7QXPJ2DlaxzieXK3VT1rFCHDhaKJuYx+u9+LdbWiwArUdfApQEc5ff2sVBvQdYMLN4H2W8EtLIcsiywDtRtwYzj2fVYUUIHU"; +moduleBuffer += "T1DFEXm8DsBTwL1JViSrPC8PVc5aa0V5hnLFofr+NyvadWXX6XF7qOcx7D55PfwzU9QcVYC+M3UfvM5PRizDWAWo7iEdDdyJc2Qr"; +moduleBuffer += "Vndr414kSb1FVofCb5PXfAXIO2gghpZQcPOdgSAnr8FjJeipazcoqBpxtwcntjC/yfR7cWq/KD3S8rGCqOd4F78an/2rBcgjEy6B"; +moduleBuffer += "a9PwLow8R4PEuzG0BKDwvrD8v2JoCqDwWQxtQIvASAagQN9BTYw2QWiQZdGGlQwNI43LJQWfUgwHD2Cf6cSwkaOxAO6pIRGBvyI8"; +moduleBuffer += "oCCuUS+AgPwtQ4RJIiFJXyTkl1MymQ++EZId4uNUdupdz1yVkiRKZzWQwcFpgx12PTSdiEn6lUJ6DTWR6hrAwUnApeixqn1jMeyy"; +moduleBuffer += "vaIoQsc9aZgSRei4qkWR2Y6KoohCwld3YDO5anlPNrWmauFE7JS8h7bCmT06twUyHcRGKPZC5ilCkz66Sx+TdicakwaL32lDKzmK"; +moduleBuffer += "c4PZNQZGLsKGOpH3+XPC2sKByuzVGxZWCSt2SJVgzRHD7smOIz3oqTil25wo7O+Nms/bofAKPdNdSPSDyxAmDUO+wqCxcep6SiTy"; +moduleBuffer += "tKVwaiTyWKfwm5FIVULhC5GkxzuJ/wjLfykSqVooHKxVsR4ltRD/ovA7tZCqhcIjaqElBoVH1UL8i8KDa6ElHYUb1kbYaIWxQJn6"; +moduleBuffer += "YiJ4VXtskhtNp1Q+c51X/h1obB3wWPA51rvR2IDtbVVl7/Za4CoxvhC9G/YNDIhA4cYkXdB5owmD6gizFhQLw6QR96gN31CSe4nN"; +moduleBuffer += "5HwysGZmeVzN8vdAGZYLOQjID6Zal78ygpb8zRgUedAYVEUgvvm8qJ9UHm4E2qFB4f3VyZAYz/AQJx7IByVBQRFwESr/zOqITinc"; +moduleBuffer += "vlaVxTJDswfcHwVV/t4ozA3e+2cNtPePzjuXeYmTI3b/ASSp1Y1fITU6XE4fEWl8txcpRSAVwp2HFIazWheSEimOJPWhcAPhf6ln"; +moduleBuffer += "OGFlQH/zzjQMfb8b0jA0cHSnYbjY7BaGBTQMuWBzGuaH5ReFlT+cHNkUnoshSY3C8NyVejS8OAyvCnvfWgwFPqHwFgxxRgovI0cy"; +moduleBuffer += "HcfR8HIM7fd5lmIdPeGw7s96i9mZyYZhxtn0NtQI4wYFYVRzzl9ZUvC/55z3/f8TnBPMIeDdviL0bkijMKA4haECpTENwz1fKTQM"; +moduleBuffer += "6akdDasxJIlTGI7K12l4EFkGhWHYk5Y0PDwMQ1qvuu/gtcDNFkMD6N2tsMpSNP77GexxoOIMRmFqBqPT6NhgVdKo1w/nl9nB8r6B"; +moduleBuffer += "icKtScxHAQTh1miPzgAkVLTZUQdEVYMOrjj1cBlKLLM90E4BptKeXYujCGmKKiuaHJ8U5oe9S0DiZ8e8Lt9i7Wn15uMOt68Y2gZC"; +moduleBuffer += "z6SHlSkJw2qSz1FYQ2J6f98vfuX9XUGqrVeCpDhl7crasf5vvrNDB80JI0vKvyvkz+BtnnIRgmn0E3Y0B5CMrEiPBz4D5B3Ucx3I"; +moduleBuffer += "b0RhAVkWhWFksddoeEwYnkHSPIVnhuFFYfirsPd9GYYPk3yHwkfC8LEwfJzEVcl37g+qyHeMuNcHQ+pbCYHTyPS6/B4DzkSBzJB9"; +moduleBuffer += "z2iFNmaovUIaJq/vHTSW4D9qbrOFYfgOKSGJwpUkWPabndj7P6fGTbvQpMmonMyvZbfOL2Ue2l138JrZyRh30kMgOLG83b7fW9Dy"; +moduleBuffer += "6tWSpavT19RvlXM6JunOMJlh14vComDcm/C554Wemf8IFkhdwMgMT/8hzgrGHfoYPLehTlVGpcEGo6g040mO/NK9gFVUJZ/etKOb"; +moduleBuffer += "/vTsY5NYI4P7atxc+XPP9vc+ZS44H58+pnrbmqxSqkNgr0FTImGigJrbfJ8rH+2EJ3ldFcVbtXESEkFP1ByCTItQtn92p+8re7sb"; +moduleBuffer += "vR2Mykp//793D6k+tGrdQ4YOregeQsdMGqbcQ+i4FQ3PCXuecg+h4040TLmHUJhyD6Ew5R5CmgGoqeC/7w7cbocqagOiBdgh1MEa"; +moduleBuffer += "kPI5xFX002TF7cZYPOiGZ1I6vGiMThwWhQ0B9Sohx1g6hx+TmSVUqcV5whiBWhPzPxiygz2cHrGDu2PUNqwujE9DEDOdOUBFJnn+"; +moduleBuffer += "nNjpQ+FZuVNHb0MBNUeOIX9Mgj+eE1lzB7w+rNorD6k0ouIJY/Dfqz9l7OUCQ+eMRF4YRRhS0VE4G0OBKCg8jGQndNyahqHa5g0a"; +moduleBuffer += "tmJInULHXWgYTqotMe7Y97aRs95j2leqhnEXwRulNaqTd/5pJqhSJ9RRVeyEOroih6NjJg2HnFRHhzmpjg5zUh0d5qQ6OsxJdXSY"; +moduleBuffer += "k+roMCfV0ZXtpPqfs7TYoIMg5PQxUdgIUJcghnRAFJ6MIbkXq4xw3n8z2K+PefmhDkS7ySSjWjn5+Yxq/ofg+oOIyomE9e/luI7j"; +moduleBuffer += "KkYXrMp3zx9HlyG5G6eCHhhXCV8PCkeIspD+V0esJXBAdTQiI2rQazyqQTbZegr3RzX6bRqoUTdKIansZHi87YcNt0fObb501cML"; +moduleBuffer += "G+miLPwLPu6yj8AD0mUfsgfrzpcW8w68dzjrXe+vZD44FQ+Ff6kgivDiI5qA/wSk6lj5qoAU7qeDMmtTqwXwDojrh/HQLfBit3/L"; +moduleBuffer += "QkFN70x/Phkum0HS6doZz89wEV5n/lNfADqfCfL9FUmX8V9lXLn1EypG2q/SMfR+xbXQf/9uW4iC48MpGK11YgNWIx6HYgpj899H"; +moduleBuffer += "E+0lkgOCr7dlNuj9ORFcbuLBCW8f2vzm/PTPL5R+9k34UrIqe2ngBxV7CYZDn1tJI/5v+itsxLeZiGoxm6wFheejEb9lHqiRmBrx"; +moduleBuffer += "/9R985mtLaLYS6fbKhZle53Zb4XdHlILjN5PQIHmyuHqf9NKh5+IhcOdtIAcvr/BHyz26pPCWcwpF4f8cLGw6fgVvZtdGfnhuUn2"; +moduleBuffer += "i/tsR5a2PzSatf3cZsbyIRpX17ENIn4ezD8HpqGF4LlNEYVDdoz/bG1hs501/5qzsnbjN3aEZeyR9UXvZfvwXxzxvlrfM7qOD++Z"; +moduleBuffer += "AyMar4vafeC3bSm7Pni8YeiyRR9fCzw5ezyv3YGFfb9UzV45chIyOBgikGBFYWMYzopAgg+Fs8Mw3CZRh4blBOauXkx2Qyn1Y+US"; +moduleBuffer += "yCCvR0yLaMPoH9lkwEzsZ8mRCPHN2RGp9etXu1wsiNzAbYO9g0dH5n3zOnF6y1LwwKU61PYYN0kSlczPXrhdZvYUxM+gNrA7DY/D"; +moduleBuffer += "UFBu+nYZ6h61XYbCkMabkvWm3D0Lw9rxXHfPsDzwPIwXbbmBdX3hlpsXu42Ge4j+By6iL3IALc/rw17eBdQfVsb/31xA4eLwb1xA"; +moduleBuffer += "X9bj8+9dPrF/ZrGvUmbApleUGcq3WaYSQ4I5iFQspzJhbQmryZjp6IS7CdORNRo2hflu+e7Q0LaR6WiLSFX6Xm2Z/u+D4/eagdwx"; +moduleBuffer += "M2ZQwfG591cDjjeZWIEEX2nN/zme69AZFbRDU9eAmvWDFYMXX8L9hKRwchByH8ByttRlVcpJDya/HRBVAqlBsOB2NygT1r5kJlog"; +moduleBuffer += "QqMNNNJSGC6oG9Ew/Az0I9UgEUHTkcsNewIeYMbEas9CrmtUHsJz2Qs+5qyKXsDPHJLs9rhcJnH4XdKpmn6dGXKrJo5RDh2D4jIA"; +moduleBuffer += "ockD+pk0aIGpyoP7iEwAUjuPaG7XxE7hjaBezZ4hnlerpCmdVbVKmpyPKypdKEwpUShMKVEoXHlKFItDZ4D14lTgaPfBe3LIfoBG"; +moduleBuffer += "Rgp7Sdp71TpQ9+yKipFXr//89zSCzalaGnlnDvrm0OkH6kIpTCn26JhJw5Rij45b0fCcsOcpxR4dd6JhiiYpTNEkhSma/H8psPhX"; +moduleBuffer += "cysGFqc7GnSdR7is7fgOMPJV1eCMMKhyRpTNaEIjiv4VpfPQCIokA+MrVBLkYmz1MgGlecBsilF5oPsVFBBCXu82NOu86lF3cV5V"; +moduleBuffer += "j7rnHPMOZw5QneB85OwIBW/oIkLHLTHu463gq30SQZzHjjt9Hpe7OOSfAnI8nl9Zc4cHqoxhN4FuS6zwRdt8gmo0LwLZOOCOOGqH"; +moduleBuffer += "7GCQCB0dxl22HS7+GkL6gtaP/w2nh/3xScXTw6iDDKnr1IlZFH4/DIcOMoTn/hIbkMnj4ZBXBdzc9Jzx/2oF2o0Lni/QwrVHJR5N"; +moduleBuffer += "B3VVMSVWc4nOTByPR59UMdlCtNd1M6lpoPA3JAVR+JcIRPNVvbe6dGHF7zmcRtHQLDKSoOiq33PtW1RxzzWdi99Z9Dx3sVdfp9qL"; +moduleBuffer += "K3sf+HPPyCROABu7GHGaPpHIdZTCfSMR3dCOHsadROABQrbncVXCZ2MA6JzFoTgMPlNMMjwsExFB6LLTimIggP8RaiSYBUZnoIYJ"; +moduleBuffer += "NZd7ALYCud6hc4dfqmrfdGz6EuScvrwm9hzO/+or0GIpev/QWpRKGv0bPhT9HY/+DiX+A3/fI69HoCGFDSOv1yHzjSefH0v+rYPu"; +moduleBuffer += "w402xN/3SPweuj10HPlcNfJvJPmXfM1QBvmDfH4o9T4yw1CqHrXJ65WgYsYNBp0NShukHp/aO4HlLEPKktsY4jNcpgcqz8A06wfE"; +moduleBuffer += "ZgYrRx/ltyoR8vlcSb4oX5WplQvy+eD/GioWSCiiVntamdexqj+2pcVy+tzC3X0YzPgXIz+9XFZWtnnI9bIyzcqyshW1xvVe2XtZ"; +moduleBuffer += "/N7jnwt+7/X7obbHE64cmnTt0s4PlzzI/6BEMLTm8hWEZWxDWZn6i6dln77e8e7qu/MPscybG4+6PVISMP6yUsL/amlryawLQ1Iu"; +moduleBuffer += "N4po9SrPmDSz0ZeC/56UQeVTnaJIrN6OutidK9/k7FJnz0jPF2ar3Oqc/QHH1awF01vVGjDl3NCH29++26zrCiRzz4xAI+F2GZxD"; +moduleBuffer += "uqxgYPGPOdhe9ZChDFvJpYlpv3T85sJ3gw9/EftpcPOb3j0fDP51RG+l8Oc6F43ji1sn/snqnrd/8Ken1t++F2i2M/WHZa99HPnE"; +moduleBuffer += "dz+2YJuzjXug6evExIG61h0/XdS6Bsb97WdooHjZemLcLb+A50ZVgx6oVCgV+rG56NwYDNv7KTpf/hj4C732KZWHk9B8wpzo1GEY"; +moduleBuffer += "qyaNrfC4CuAppEU4XUt281N0YsuOT1GIFjFN/Hj2SQyLXxlVWQvt5+ssq3J8gHasW1lR/CJCBKyscH7XspPga8yoBAve35A15z8n"; +moduleBuffer += "a4x7sxRUcH7kslWIvkXkYUV03JSG08LuQ9yMhk+S44PC5/7D8fKy+XtqoRahSMDE0vmzsPWlue85M/ZfGuza2X/5lq9Z1b74WvP6"; +moduleBuffer += "o8df9NP9vrbukDrfDav2svlBR53+z8bj6t+JDh6gfQAY4ZUxD8smnjhf5sIPpR4WTvEdbHinCK9puKA8fnjoJW7vVt1+rV/96btS"; +moduleBuffer += "U7Pan62Ajgp/8Z+UpV27VfY1xzrn0gJx6sVaJd9yRrBvL7tq3XJn/uvvN71RM7KsT+cvGdWjCM+xgyv37Z2we87M43M2qwxf7+n+"; +moduleBuffer += "w7r9kzbe2ehb9+cw99Ku7dae4DV+fV/TlTtjm3R4AzLmj87OmFl/X2zc5swd0rJWvTZJ6uX80Lm48+TZto/u3PtsieyzbpOzW8ZO"; +moduleBuffer += "7WmN+jIzTavV9ppUo5Fw/7S9M/J/ffjbjZ45H8zTH/z2s69E43aqf73Q4KeMElGN1DMj7ogKG9zPW79ixYpt3R5eb3DWEtdks/DR"; +moduleBuffer += "gZqekgW7BvD2CPZXvz5nxH5j/PkBn1SftnLOur9+mFgX4w49BzrqZgRP1aQahqWeHxV5/9eG9WpHbLrb7+zJuWP/iKjJ7qxMUtb9"; +moduleBuffer += "VLCrefaMnyPNmsvFl9YyG6+Zcx+QyuU3FjGSC09zdjudS9b17je1tfMb79Sl6l6b/fGMHlzr4sO9f8os9b19csBL59e//VubXYV3"; +moduleBuffer += "0/qk1GxcK/tUzQWFT2533zf0Hf1B+9zL1YZVv5t0cPfK14Tfcy8z62gnDm3ysvkx7vwLUOsecbBQCnr4fP7CFQUdTpX1HdPigXNN"; +moduleBuffer += "S5GtQCgeU3vk2G3tv/90QuTSfYldN+U9WRoVt4uxvTAX5K/H+GzF3HaAl5+cXlzcdmrsoy/aOLk3eLU+Onwnq8a2M/2wr99MGXZe"; +moduleBuffer += "F5zT9GLyEvBFbn2u1K6bfL1sHn/CO0nH6y1MWLdgEb86T/D7pDNa0bDDptZT3171VD12pqHGtU67CtvsWtHvg7MjS7TaOi23f8qd"; +moduleBuffer += "yKjR/NgXriG7j4wyHss9OOp+8Vqn9VDkUI6v1QdARthykWjI9E+bANJKbdenbGFb3eP+t2qvaZn8Y3bSDy2uTnAldjH2Gbd62sDd"; +moduleBuffer += "g6ZXUy1P6fvFnLvVX3Ysvqs9Bsof6z9dVtdpLLvN/aGAt/LQxS/u3f/qJGdfK9+X7XJi0jf8deLSerbvm9/UQ177D8bsZdCQgd8F"; +moduleBuffer += "Hm8aeffYR2cOmt68c4617onqo6SysRktfq9+8eHVDj9mL7+ycNXcs4cabj/6PfvtGrtrv2x+0GFXiA6ruXYyIBnG5ifJRe8d0jpk"; +moduleBuffer += "1/OY+R88GD7naItWbQctKFkw+oMph9as2R45ZGidurwm79bztVGDL//gl2UrTqTfKzvQXvTdx/bRP83KUx5qH9l+gTv9z+4Lt1i/"; +moduleBuffer += "rJ/xeVZZtx17v4hM+mAl+PI1zmRpiy21sNLHp5KajW8V8VE9Zz/Dn4blNdtcGLZsuPRO/YgrE4c27CzMbD7gtjn2k03uRZ3Wdok7"; +moduleBuffer += "k/x0y/vmmztvHTy8p+eMvP5T9mjbGM2+m2e23O2imbSiq/PtdxqBDrsGO+x0XtHDsjJ9hP/RCCz98qCJjRIv5b7Rq3XWUf/u5Vvn"; +moduleBuffer += "/d5oYFEi9rhP4Q/KRie4vefvrPay+UGHXSc67PvIN5+Ula1+65snV3I6/NXkl1avyZbpai15O2PHEvlCf49vP260tX2udyfj7qOV"; +moduleBuffer += "m5ocP9vg+7JUQAFfmFjYVeMfWNMfa/602LXu7T5Ll9d5Or/JnpHjmgxZFXzE+L2RauLkPg3m8GpcWLEDUJhMfaDMLG1eNl3dtlPd"; +moduleBuffer += "MVe8tzY3qzNGVTj81ontMXN/+GZ2akp69vWHJ33fNf0PKOwmaMju0LQL3drg3taB/yC1SdcjqS1n/b+Q2jjPl9rc65HUJlj/QqmN"; +moduleBuffer += "Q5fa1q5/xVIbmLhK11e0NL98h469Bzr0aOSrFLTcOith2oPi1thvo4it/m9EIDsmhTuQ9gIKd4xAoiGFO0UgewWFO4fhLmG4axju"; +moduleBuffer += "Foa7h+HoMNwjDFP2Dgq3r4achEP3w3BSdUKMHfoQrv4iHLNv3Z50aeaeDgM+HPPjNXv0xBSN56Omh2s0Ksudd/x4eq1X2fvIrw+J"; +moduleBuffer += "usxNaHvjV6TdgcJfk9IqhdeT0imFN5B4omotd6MzLVe19TF/Tb2F33s27e2XciE+eqy74w+dJjV/HePOeAwafKz1y9JhmybY57e/"; +moduleBuffer += "aiGbcObplOntH7b8rOUQ0Z+juvat/mXZrfjLpR002JayQzn9f7rzHZPB/K5Jnfc2nRyQPGrcuBWm47t6nSvuldph350pv09vtqqD"; +moduleBuffer += "Sfb6jaTRg4bXP3Q9Zk2jVSPHzPx+UJ1aElPd9NQc3uKdlvOdt1gLHy9Zd0zOvrGg/x83I5VbJmv6F2Pd33XPdJ7uqB34y+vNRtbi"; +moduleBuffer += "drnn7tpeLm7PWrQp9vzHn/aWnp1anP1X54GbbnS/+HRO9XEqRdfgqRP4lVYRl9lHpjQQypb+LAlcnzTqi83c8W1OlBjvdPpSPa5V"; +moduleBuffer += "wwFDz7Vu31EaNbHkcsvDKZNfuxut/mBVg1t1vu6ceOfMlFOOTb/s/WRWj/TFm+6MaGEQcpqe3DL43t6pjJ7z0rMapMd0Xd1tXOLa"; +moduleBuffer += "HzffafEkpp96z83vO1zK3J9jLeOXGE4vjuldP6VHw18e/D5jwOmD09d4FltnHCt7erFT7K6yQOMly2o2FN+8UzzsCWvosqn3R0UZ"; +moduleBuffer += "3/tCwzrRGK8/tgY+ZPGZP7FzA2/55n/b9WD7u8X6r2vXXX00+I3Qc8FvbNFu1jdZI9e++eWFu5vHBn8c3XDhhlHNzlx/qr1ROntJ"; +moduleBuffer += "jZWLT886NfNCnVqFf23O3n6+/pqoVrbP1tZnvL/vyy/N32adyVwzR56ddWR8MfeJIn8yv7rf8N6v9yQT6uzqdvzdwbrVF/xeNe9I"; +moduleBuffer += "kvPp3PSSJid+/bztlXeK+q766ca5A783HGI6psxoM7ztZsnpzBqDit7HFd1Peo5+mb3g4eTN49M+NSaN+Nl66UqdqO5N3VxR7Hes"; +moduleBuffer += "kysiMr94q7Cfa1TBZy2ED1Y/CczXb5jf5MSNhr7lSwTf/9xnQpZsa58m700atL3v2tcm5Xbbk1p3dn6jVVPsK/CI41trLn5zVpcO"; +moduleBuffer += "Bc3xqYwfDnxYdlOb9EVGtzenfOZWtDnhaCRkXpV+yBJe2//nsGs/j4ir/fjqPMGSbaNm3IwLHN6ric7gbU0e82TeieZPHn7J6bL0"; +moduleBuffer += "0fzGFsn5xMzEsjMdaph6be3WkHszOLzRXvHZR9U5sRPfGHNEofx11shOh/ec3tZs9s/Ry/nnBnE3CoI92tQT1LozUhnZeFCNHws+"; +moduleBuffer += "w4fktGP2U3JuCJqKT7gb/zHtwSNeAd8zsOaJvWtsLRpmTqrta7bl7jVDrw1NmC2b7ntj9ORHa0/90IdnlGZ0fnSvS7cOV+pu6516"; +moduleBuffer += "/67sAWvs7aG/dDxy7bMr3049GtNvb82JfdcoGxW1O/Jly2w+3nE5Z0OPnWMvJt4xntuZfe+T5e7Tw6S5/d9fGGetaVqb5Bniqndv"; +moduleBuffer += "d1HQV7uX9ebQAw/qjtrzRsetig0nCid90OHzQW1+1m8c1+GdoyeOnbFtfOOTpivGWCc3f/Jak9n8srOtl54u9Kd2xGcO2/eXvtvd"; +moduleBuffer += "e7vaJE69PWvFTs6dLtt+b3F927fx37K//6ZHVL1am1cO2tO0aOaWDydv8Bju67b3TWj6eNqE/rHiMd3tNaN/aDTGurn/xOavXfzt"; +moduleBuffer += "zs1fSpc0fll+YvaMOHN7SFa0eWnOhuy5srZe76bqlydG7j992F6XsZC9d0pn6/AlLQa9G1Wt+xFBLVb9vmLe4nzttpnB+750sGh+"; +moduleBuffer += "On7g9InvDbz51m5xdA1O8m9NFx19d9qSzga3VsjddnzV+4zUuwO6f8g73uTd1zs7z8YNTni/dtbIdxbUOHBT8c0fbTdh2K/tJsSq"; +moduleBuffer += "dx0cUaPb5vdu173X5NtNn2+e9iR7QK3mmreX5C7s6qibeHft/hEpasfgB3fn/f75veiWCuFEEaD29+ac2/dV3b7K8WW79HVzn+z/"; +moduleBuffer += "wXNWKmFjy9ZP3c+5YcvvXTht/sjTjsntZ6yW7r9sfH9sa7xX+9HVTm1s3YjNYC8ePq7pib+2ZHxy6VAHzZ7Zqx4sPden67QtzhW1"; +moduleBuffer += "JrfpGdmu/4Epzcdeyzv9JEJxfOkvqz2L8ZapaSOGxQw4s+ndMT/+ceXxttXjZhXZD6+p8Wiu82Lrjxp/0+7X01u7tb5Sq+O+Hfc8"; +moduleBuffer += "036bMllRXDTpQ3niOuXnlsEi66iG8X+lTF327iKj7NzwoZMf3inOs15YGH2UocmvLx/ZrenkuDU25UJl34Mmp7pf1uCc3sPjly5f"; +moduleBuffer += "eGj0wyTttT9XHW2wfIr37QLO7NlNW33YuNfq76JFzTO6MB7+Nav02pXEi5s+0M4SfZbZ6s/7c4360l7R+O/YsB9PTN6m36Rv0bnH"; +moduleBuffer += "n+N+WL+nRubKDcsbvjY1osfDYkteb2PBnN9FY0/1NzXdfLfv5+r6bb89rx+3Zvvvuxo37zO+7qTNb6/bEfFhq6uB0qd3ZK0uR52s"; +moduleBuffer += "1U6W22rHWz89qj9ZnRF3K21a8qLCnNdmzONGMh8La2Gfv7b2r4NLXp/TJ+sDVc3UouZ9it658e3cZjc/EEY0+fajdrynohGHOp6d"; +moduleBuffer += "PXxQTP1mop+T19nqTEkd3nZay87dXYsylbmXvzRNjK1zr3rSBcNfD4/fktqbSDzizQcPHMi1Vhep+zkl7/suTzwa2WN2rUuTcz92"; +moduleBuffer += "TMXFNbnXf//20J9s8/zWfReaz0y/Xyu/QfuWdbo1j5qumPHu1iXdx3TPMjZ+Tb33eqTir7KSs5/XSrZ8dz44ya9Ztnf8yWYxG3Zs"; +moduleBuffer += "aNJ23U9jHFFtos+nzUmwXxkoM0SNz7/RYnD/OWPnFz481aHJ4+9LC/t4rAPqf41l31H9Obno3Osz3mM82pCgzexVoGt0/OQ0b7V8"; +moduleBuffer += "1wl8wNnvpfm3cjrvXPj0tKJPUa2sDotL4wr6PLUNundjVcPZNdx3HF9diuaZDy/M3bqgY1L3ej+VfPdWI9nY8z3xDMNXd1odW7/m"; +moduleBuffer += "vafVubOfZi1Yui1i9EL/mzfuD7rVt9aeIl/ie+Py5bETbD3TO9as3ejpz9/+tnu8gF00ZOvq3E2be7939J1qjXZeNy/oOXkXG/t6"; +moduleBuffer += "X34b1+a2XzwZ/c3ZzPqHFy249N1E1We9Zq1aXvDxhb1fPJoaY/h2Cr/6xV3rrt+469yp/dZzaty2jjPazmj556FFXxTubVnn0Yqt"; +moduleBuffer += "mVFdl/COR5wWNzji4QTqpNrr3LmxKv9Ko42zbnbNHstYXMqReq3NPAvbPfqyJn65UP/1jg88+2dql5qOXPtKmm88Mqxe/3Pv9W/w"; +moduleBuffer += "50wuq/jiF9POGU+UnYv7+GmfhB93djSu6Pho7lzc14FhiXv/Zk2ftE9kMK7+4sO+qx9+tnbw9PiV81as5W4fUzRp7rhqF/pf2TRg"; +moduleBuffer += "6d7jm6tNeWhbntBNmrXuyZnCuO23G/RceVd8pN2lwayShA0DNh09P7SJreXiCamBDgflzT2fPDm46rOipQ3f3mAve+dqvUVH36jf"; +moduleBuffer += "ctSTUR/+1uXeoHHNWcu0c0o/mxqssemY2H//2KTeupYjmzPE4FVvX3o8d0ffW5+Vmau3zk9+p2Bu0dZqbbZcrj9lY/G6s9c65O3S"; +moduleBuffer += "aYT1OgyYO5zp3KfuHni94QfDywY1Fi+9UdCIsVXQZXNUmygNuyC1xvt/fht5t/PNubevzlcrSz8Sz8EeH6696WidSGxDr1/qpZ3L"; +moduleBuffer += "n9vi0NvZn9g1mwZrW9duOyPv3XPtfzjyVaev1mTvZY56o/o3n6y+PSRq24hx3hk/D5tTvOPkqSYJ4hEpPeex67QfsHpTj2lzq00x"; +moduleBuffer += "3luwPPCN1mysvfP02epPevqC7/YcMe1Rg7c/3yvf9qDBy/L/V7nmmrG7sncEvVh4N7mR4L7iJc1Hlj1ondsuv/3hHwrX8bfFuNvc"; +moduleBuffer += "GLh2b92o6ZmZY2N80ckLkzl9epwcO3F/30/6NjxXtuDDGZ8v8GLKFX/NarACj93+2sjXY6Si0WfYm76efH7A+nfkt9ZNbvN7l4QW"; +moduleBuffer += "j20nnEldR7WtdX67VtPst0/eeFponfnIFePr/2Wf5bN2fD/z1yYD0yYUnm+/YHuXPmPGHlPlnVvn+cGWPJ6r6ze8ZmkZdCC0j22L"; +moduleBuffer += "TWK9j7kbbu+ac615R3OgX/NS/qUOK+e0b9Zkduu+WsXFrxjfxRZOqCVqHt8mvt3pO39W/6nOkgtFjKNfTZPa086/v2XEnCnLx14x"; +moduleBuffer += "x0xruW5Un+JZK87+8OH5iTMaVd+D9ALryQUOhTeQCxwKf0MuaCj8bRjeGIY3kfi3T6THbSvTr91ftbTa6yPy2ae6va3rnqCepWv+"; +moduleBuffer += "+odvy7fEd03z4AlHGneSveWfPDB+CeNlzXjQFkHfCfKyz78snby8vmD+jO1Y3e8F2qNwH1JZaVnZ8pyyMm3DxoNyBimsM77MH7et"; +moduleBuffer += "eNviN9fYfl7c/uTh9zvJbm9u89dYrH7XblXuBICp9la0whMhipjFMQaXy2OEUV4q4zCNF2y0ubAXMYmmkcgvUi3khwUrxTDFPhRN"; +moduleBuffer += "mrj3nGCllNcAtbWZSew2YyIvDGoLHMpKFFEhlin5LJ2YiJCnyRVrcWQfLWRqclgtbHgxE0Z0YzqoLSRktlAcHWb5CeflmcpPqipv"; +moduleBuffer += "a6/9qK3POSS9QhloF0/Fjhq8H50SpVZIxP9YQz/aRRJLP2OrvLqZYkEqcwMorwPZP/Fk/0DPCuqsefp2mso5aP45px7onDBwIeVl"; +moduleBuffer += "w5UDYql3IIrYIFwrAp2eBP9R26vGhX3P526v+pdbkcaHlVU5W5HQ//9m+1GFd/bDwrZjvdTmpMrfngQ9Z6o8Qn3Yd4Cn7rzK0zyC"; +moduleBuffer += "PyGeBPe6VNKpa895V6wbd6D3nfsJeRBDM38zGoYBKVvS8HYMebLxMjOlQq5cLNcI04QqnljDVGtUYnlaJl8jpH7LtVJpJi9DyNcw"; +moduleBuffer += "xQKhHB61J1SphFypUK6VCVVcjVCg1YiS1YQPm1qo1ArlfKFaqAFfHvqGo+sK8D8f9OBHUINDug8ikGU14q4QEnMT0A+thg9HVhoR"; +moduleBuffer += "hh+ejGOEMMvqtYaK4ckU6AeMXG6FNgCDywn60g/JqNdh5JkoPIy2RXEVCik8JFCcKWf2f4tJbAEbeBjxOQf4C+nSfRhtBeNngh7J"; +moduleBuffer += "0cSoFUI+PFqQCZjEhMPkSQRheRUqcRboBJgFW0++MzwPoN2urGAqs/QwEhLPHEZbyqj7VeENoncFcRh14/Fh5AoyvVZlBdz7e5oM"; +moduleBuffer += "HkE09yZ8Fw3DQA2v0TCMNdOdhuEej840DD1jX8XpeoQxKR+wFRwF1+l6FHkBw/HS6RW873mn+c04ik7z6xmB9pHR8bNBUl+tt1Cb"; +moduleBuffer += "nyu6CsF/1JwNA7O8aM4On9/C+fcr6Ue91ZcfcqGmpvZyPvYbaAs8JkIdQQaUwcrn9w/D6vjfzO9TsP+bz6diVbDdOOzehDD8MUg8"; +moduleBuffer += "nRdPjOdbdDA0K+6h9rGDvzq312+Hx4Jo8KAvnWifwOqFIyCAG4lDI8jt6ICFOcAkA/6WPwU6hge/Oxg0CpfX99wbFeoCt+yXd4am"; +moduleBuffer += "2I0Tr6AuhDyUmTofPJ0V7YQA+P5xNCcZ4WoJnmBHri6iTqCw96E9peSGm64n0P5REzzRD/rlmhB59juBtgUjyR6+gTpDx+plWkPE"; +moduleBuffer += "mlpub+/BRJ+KieWAZyEvHn4CzWfi2MzQ2mD2iShyrytFvZTzuTHUmatBnjZEHnJvFZUF2uzB9SMn0P4gVDe0RYUi+NChf0byLF2Q"; +moduleBuffer += "784JNG8+BH/hHrnQ2gMuL+CYPhlFeuI/uxQhFiBwzJ1Ep90A0YSZKYJbYnyQdzKN1JgB9ywV87jIIRRa3004iepNsu9QfMCVJ9E3"; +moduleBuffer += "eG5flx+cg+0A+WDgaIVQFurPqydRf7pDA5BpJEYgJI5SdFoOmlOff6AgdPnHvbClIcrA2oDnYsv7A4aWgKcR4ZrSinuN4XXkkIFh"; +moduleBuffer += "9lIk39B2M5Q3B2SEnTgW5IHzEY1ksJWliEbWlSKZxgzqtxv8rv6C7xFWKAtuUD8C8sO51keyBbTC1Pmo/RS0Hk1lkvyC9DTpQf5l"; +moduleBuffer += "0vlH9VNRRGgN9inkOJJyCrW7nG7Ka0HsLicJ03gKOZBQp9qQvKPi3vOIelhEO8IJ5k36eJ8TxovmknyLmFOI5/P97nyfi/ju+ZVy"; +moduleBuffer += "SknFCTHgITbhU/P4n6fQcUlw51DH5/BN1BpqOgtn/3yX0wndalxOFW7yeyte8OK+dMADtU7i1E4o1stxXwDMnLQr5fm5euLDgzeR"; +moduleBuffer += "13Aj12gEcwhoP/wBbnCLwHenlSMARMPzuGy4U2F141w7pP9iYRB0jTcbbmrjwR278DmBFXIXl6dY7C3/HfoBcgihBgrOZZlOezGc"; +moduleBuffer += "v73FYKw4yn9JXS632qcLvRreSdc5jXZqaz1xSBL5G05XUBwwZvp92bC783CPSw1eBQhT5LfbwQvVOG6DLSl/g9Lv8umEQQMOpkRC"; +moduleBuffer += "hKDONwIdScSk4Pm9oHG4we+jHoRXBKDSsJl8j8vrxb0CvAhGRAbPynTOYqnVaaPOXoIPOHUOnDrWSAq6KXT6EaAIj98NulxbPgTL"; +moduleBuffer += "ZyWhywRakmmS4Q7Yh06Fx2X2gHGWCRiLR+uEXBHqcUogM4LjCI4hyI8akqkxiaGjVx3yPuRl8Dia+rS/9ch8MD+ck14jr8G8tcln"; +moduleBuffer += "65KpOXmvHpm/NvlMPfKdTWh569PeV4PERb9GYYNB+gCkeSB9BtImkA6A9BtIV0H6C6QapwFPAKkVSF1AYoPUB6QMkPqD5ABpEEiT"; +moduleBuffer += "QZoD0jKQVoO0AaQdIB0A6QJIt0B6Csv6LQprAVJnkDggcUHSgJQPUgFIAZCGgzQBpMkgVfXhUzd/R0dJNWQgv6pKMKIQkpbBF8Pu"; +moduleBuffer += "mRjaLwd5M6H9cJ9B/Od8BNrXTsfxYZhPw5cj0DqQwmci0G5sOm5Lw1sjUPB2Cu8n6ZCOO9DwkbD7EL8RhpNo+CSG1oEUhkfLNA3D"; +moduleBuffer += "7cJwLA1DPWeXMAz91qAMgGTVcp3tzbNoDob3DJQEG6Z4DskOcFsgTpNqmT4g1sK7FkJa8NLkMXh4kkrET4pPTIYZYBQZJjrVj5QE"; +moduleBuffer += "4FVSRKNdcZOCcLmwRAkOxPzcVa6VEpNvtwp1Ak/F4HTxmKmnBOcK2cAM8oJ8NBGkYnUpYRV2xhvgo9U9H0XoCNjnkR6FvjNVcP5/"; +moduleBuffer += "ZmdqzvmKO1Nj4D+eME0sZ1ZCPEzcEeMxGeCHJGZ+NOrMHp3DQXkcnj2P1rzzSbp/JeOcFg4w5wKKPwGP4SNiC5N4AMmv6bg9DUMd"; +moduleBuffer += "S7cw3IiGt4eV9yvJ++m4Ew3/hqFwanTcjIZ/IsctHUPaAVJ73pYyDNOVfAP+z0qpgUVEw9NvI2L7wf+3rIlFxK0ri+j9Z1lEn2qv"; +moduleBuffer += "pjd1djeQmXAUL27JH6h+Xcj2UbhrGO4WhruHYajnqEPDMWG4ZxhWYGi+pbAyDKvCsCbseW0YzgrD2SSmjQfip1AuqISB8fdz0eOL"; +moduleBuffer += "iPfGk0ZlOo6hYRHpA03HnatgDM2+VB7DBfZRSJOF5gfEmcMuUo9DCqaOdPukUupKKNFjXFYj/WBTj4E8zjT9MtLHwjkyloZ7kRis"; +moduleBuffer += "t8ttg7T7UH9bOQcNPa9+yFfk4mW0M38ahmRMCi8jx36mHu4VKDeEQiOA8QpaY/uvoDmE0svA8TGJvIZhFddOXI+BFL5BvwAAxG2e"; +moduleBuffer += "1Qw/DJuTHJYf6j4FVrPVJ6ygDyMWJqE1mNDp8pstoCRvSDPm8qF1rc6D1DpwrR+aFmHoGjgeryJ9SFUGf+11FYVZbUiO5zQUA4gL"; +moduleBuffer += "N4CkphIRYeA6FKzHDbi1CK7TcRRnxcvU+33lTVgPyoHzwXHwt3JOnv+naETg3zXkXOKMQOuFqvaQ8F1D/hHM2pUVtQLFx7HARTdo"; +moduleBuffer += "cRzpOWX2+4jRCunvzjXEyy5gsM3cm6XbsboPakKqXojBCHzEUVY6A1hbAlpjaixwrc2Uugw6O5Nc2ZIqEjJ6HJDedCb4geHJPdDU"; +moduleBuffer += "BiS3V9ePXp+RuOgj6hVrh/WCLfvuehQRALU6aSHJVDOFlBTd70YUsSIk9c2hG5obSINqxn2w21yOVDCooIIOLsZ9z4Q1AJKq05UK"; +moduleBuffer += "pGgUQwcFCAJdhGwDRWS30GRVcNlPCLJq3KAiXsB3uYt5cBSnMq2ghuA66ENfMdME3S+gtoHQ4fo9uMpnB+NIRdYqG3x2V8DLRPoD"; +moduleBuffer += "psnvNIQUvjCzQMWVC1JJ/S91PhXOhMpi8Ca+Qgva4gVfzG614fZiKrvVGfpeFRuajeuZKCAsk6sQw37wO3WURoYPpFz42WEmeBcx"; +moduleBuffer += "ip6gw1BtCbW8l6wL7FaikXgqMyuYDRroZarkaegkdJzqYag0tiKTrhzM0D0LvGSpTL7L4XA5M9S0B55TFeohWnXQ9xRZ7XZ1sdNA"; +moduleBuffer += "1obKJ6TKK2emRkJFZC8u74QeTC+OMy0+n9ubGhtrdBHTXWyIVDo4QWEF3hjcG4PKiiGfxFDkNwMZUBdKbZ3J2YZDSl1wVoScri2B"; +moduleBuffer += "uXfOghEYxyZvwugHkJXbAXFOAWkDSPtAKgOpx80orD9I74A0EyTu6nPbYZTtneD3PZA6/hmFaf4MVyX8J2wEtAwQG8FBkiqetArP"; +moduleBuffer += "tiRJHw4WrN+tKCwPXDvWgog0uuM8qNG0av/b2Unj2xXZyX/fo8QJLnqQDcxKRCiqlAQy5BsRigvNCwSTnnobBTRsE4EUXQa7ywsD"; +moduleBuffer += "fAJ5z2UD49sDB5QXMBxArqHe0uOEmtzjcrtxY4aXGIVAmuHdQQrvjDtQcOGeuwi+zqn2/9u/zpo7Fb+OxmOF6g4X02sBtbQRAc2o"; +moduleBuffer += "4xapk4Dj/4p6TnjIV7/8H/gXWv5/VWm+yv+ekn77C1HSb6QY+2UVtd/gstuRrt8bq/d5cDwWcktQo2cPrwTZe4LlTNdu8LBao9eH"; +moduleBuffer += "AKjnwLtRRAi/2FqvWjR7/ndrca+i2oa+rNoI0iYMnby+OezeFgxFa98Wdh2qL/xgotOR0b0I8y4hmepBI2Bw3oEDb91DKqpH99Ay"; +moduleBuffer += "gzIrDgS/692veM9kd+kIvRdyRh3Y9T4yaVH3y9WFA7H0+8ikSN1DNWBiRnC9FlkvNM4zUbxg4rcTDxCaNjTQqWBjDp0bd/od5CMe"; +moduleBuffer += "q87pozKSEHwYewighykERCNAnOBJt85pNVRSjDbiXCwOO4Fc5JP67Sv30TLzSm2kpqDaTv0dCHnZwHJseYBMyhSGwb9dJmjQpC0B"; +moduleBuffer += "Wf5k+lJuB6RLSEuG2DgTW4+zcUMSbogzJuPJLD2uj0tm43gyh50Yr2PpdHEGXVJS0t+G5VkN6pCBlbvaVELZoXCC9R5GEee/UsEE"; +moduleBuffer += "//uyy0eLBZQtpY2V3Vh5oMI9IP0A0o/UO8EncntjjXYHURLBwNCSnbr0XD7hJoKz9umNgrRGMx1WZz60tkPdNlYK3g95xrLqiMe+"; +moduleBuffer += "6PFe5Y/rguWPh57/rDoyGXGJCRGF2Qy5gDt9UFIPOVQ8Y543hAycYIYmTKQVrnhxn8Xl9QH5NWQSdSILI/0S7REdMpOS4TqRnVRn"; +moduleBuffer += "NEJzHFSXgxdQiJjDKaGYKtQIPWsIkynTbXXjZPV1yHQKVt3QdlruOhIgQoMSgY+J0kiB2OUptnrpKPSDeCnhzg8LjHE5gTBiCpk4"; +moduleBuffer += "4djykvKDAzda/Q7aPbvL5WYSOn9UGny/HfprMrviPc09wSrHYYezOMzXzQtNsUyqUYRPi4WwxlYIm17uwE43SMD1j5Hp8vsISziz"; +moduleBuffer += "BPe4nK5QvbxALgBfBbfB2PJ+p5e00xLvoNW2EFprQX8hcy1RAcKBg5AuSIMtU+/3FuMhiy2qJrxmJG22BmizjTESJlsm0TgXVIhA"; +moduleBuffer += "Ky0szKFzFhOXQy5rJtKGqyNtuOAuoB3Kc6T8u1nLDbo0n4pnA1DC8kBHwJ8OwrZL2GWQcdcFjbvIDuOnm3jRpUwyQBfF8/bCuQXM"; +moduleBuffer += "5hjJF2HaBxL0kqOPe2hmI100JOAWFbM2NB8ewCqWexAkPmAPLgeyCHV1eUnbULfQGKxVhuaxxmWkeYdoCpPgGqg/QgFHyJGPYT3K"; +moduleBuffer += "SNeiMuQSRMmUFKsZWIbmTQOpaqW34aewOfxQGIbnK0Pz4FGQfgbpFwyZEuE9eLYyPE/5BIZMhjxXsJex2MnkOov7/J+Txf85Wfwb"; +moduleBuffer += "J4vyce71E1OSyW+nXC4ak7QGUxMSUycFN8PK3SmakakheQ/mhQqJZFLGoNwrIO0zyPKak/cakGU2JWm+NXkN5nmNLLcu+ZtyvahL"; +moduleBuffer += "vmPGoyhsGUgbQPoRpJMgXQHpKUhRj6OwtiBFg9QPJClI2SDZQRoG0iSQ5oL0BUi/gNTwSRTWFaS+IElA0oD0NkhOkEaBNBeklSBt"; +moduleBuffer += "AGkfSEdBugnSU5AaPAXrPpBSQBKAlAeSGSQPSO8+jfpf48ZyDvCpqyA9JvhYI6wNSNEg9QZJDlIeSAaQvCANBmksSNNAmgfSSpDW"; +moduleBuffer += "g7QHpJMgXQKpDKS6EY2w10B6HaQuIHFA6g2SBqSBINlBGgzSaJCmgjQfpM9B2gbSPpCOgXQepJsgPQSpDCSK0ZfS+OgpDJlnT0M+"; +moduleBuffer += "S67HQ76S4Npv1RsR/fg82fIxuAfpj5ItnyfbMms0IvoPuoo0x7h7x+/A6m6pB2eI3+AT0JnPofMRqyXiSJp/jvUesOBOwsICuDTu"; +moduleBuffer += "sRcTx6T4oPsDpf8tr4fJgQy1K0AtIKUMJg83oGpFSdzPSqWAN9mBcAGkWlbIPgDWVrFGa3E+sb4jyn0AyoGjUUpSFIXlJN7qujUa"; +moduleBuffer += "GvaH3Vg5qj/XEXMddHlEu4LNxmvJzmvTl56486DvpWqZLbCIPtN61pl5utqT5GYNY8/5Olz968Dh2qXVd5xYvW9jyyFxS6p1bndJ"; +moduleBuffer += "Duoe8U7PGf3HHP7OM+/4sTGxzRrvVPxqczszDjQ8Nu2os3BN59Wmnas6JjZrm3eY16uBpsywxavd2/zGA/xW143ae7tKh5Zec97Z"; +moduleBuffer += "f6M0/566BlahWSa7j2PEiQ8HeVxxrBGwcJfzufK+sScQinzMPkwWdrBmI0KNWkSOhudmtjr9XiI3Fsof+Jv8cJc3zE7lDb4wr95v"; +moduleBuffer += "IhUU4DPJuDn5anFavkCcJtaoae8aRD5P4W3kt6HwI3IUUxgeO5H4oraAhvc0WHCDDTfme/36rmTzuvW0evO96LQqqpySv+sTejlg"; +moduleBuffer += "rdAVNZteTKic4rD6142oiOuF4fphGO6U7Ujv+whk4KfwSLK9FDZFVOwPKRnci8INw8pvQOLTwla9qx1odWHro71PAcR+2DlrV/On"; +moduleBuffer += "7k9LHx0hcGbpxu8efxEou/uolMD1frZxb0zO+q7R43ME7vV4yKRV7Q6+3+PxVQKPmKVldx2gPCx6fIfA6/YsWTVxZeEc3ePHBP7x"; +moduleBuffer += "vesdAm/MvjzocXXiAFSHOthvsnjvZx89rkfg7P1fvVXcuNfwLx43JXBS1iNZ4tSobT8+bkPgzBnpya7LH0268LgjgXelDu/04yjf"; +moduleBuffer += "L9iTHgS+M33z9H0HRs9v/SSewOdXdm8+gxF/I+FJLwJ/sCah+yNz8hrFEwGB3+y789DpI7tH2p5ICfzNvsOtughOfT/qiYbAH+3p"; +moduleBuffer += "9O3+ebYp858MIPDIxfp3O9pXnvzmiZHAd0/k188xfbrw6BM7gTv/uf3XKffP3L7xxEfg9UPLVixbtW4d4+k7BH4v4x17jXz9mE5P"; +moduleBuffer += "RxJYzdoaP7Bs456+TycQWNv5m8kTRsk/yns6lcCbBndzdww8OO17OpvAE9efXz9v0+klE58uIvDUd31jD+Qvv7/86UoCH/h42cQp"; +moduleBuffer += "bsGGHU/XEtjWrOHm+zdrjz/9dCOBv2KzcW2n1fsePN1B4JVDBh3ceabvzKZlewlc883o7juiBpzrWXaEwIc/9Fpnduy4QlxWSuAG"; +moduleBuffer += "P2Ajbq0b88RQdo7AV1o1+tBY+/zGwWVXCbx3rMJVZ+/GCTPL7hC4B97yTE7zr3/6suxxGcb9aDqYSGr0m72/rDrGXQTB2mZRi49c"; +moduleBuffer += "vEiE+IX/9Cu/vxJcVY08i3Fknan3gyl9h71OOCBi2JfNau0ZtH/6lmTS4do94PKg/ZzBE9WEMw6GWYZe+nRR8qGjDsIBEsOEb8xq"; +moduleBuffer += "3rlL5ryxhPMEhnV5tOMIe4Hh2gJigxAMTbx7QjL+6+pNxFwA1hX4p60+qL1rxDHC+QbDZrUt5D1o+9aOW4STA4bl/NF6SQ+r7MP6"; +moduleBuffer += "EWhrzuX33a2M1yNOdIlA22kzAjdmzVzoWMCL8BF4lO3dtYOCdW4NiHiHwIEWp4o/OadZG4gYSeBt33/c/8PR/Ud/GIE22vR+66Pd"; +moduleBuffer += "36sTdq+MmIraO3/6wwFru0/bFTGbwGfz58/cNE/06+8RiwjcaULKyfhtHy9+HLGSwAPmzVjombXz7muRawm8/7tLGvXm0q/ZkRsJ"; +moduleBuffer += "fIb7xq3mtx+PlUbuIPDi4IDDH+9n7jVF7iXwaXX7QbfzXpsxLPIIgVNZ7aaXrpt/5uPIUgJ/9OXZAeqfji/7KvIcgXsJli46/v8V"; +moduleBuffer += "96ThURXZ3lru2ntIurN0khuGJWvn9t6dQAgIIcFMABEiJJB0SIcXBMLLoqhPvR2iM7JFnHnqxzbgMCCLoPP50AGUWSQub4bg+xQV"; +moduleBuffer += "RYiDH76HD3BGZuYTJa/q3u6QZNT5MT/e5QvVp6pOLadOVZ1z7qlb/7b1xmn4uQZbp+/eW119z7HL8EsNTt9WfuTqpgPrOfS1Bhf2"; +moduleBuffer += "1O6xXs0+LSOsqaB57s3//elu69ZSpAkXzHbjtl03tlovzUfJevqXpU0fyLkHVyOnBj/Sv/f+JbdPV9ejcRpcdO4gKr+Yc+IXqFCD"; +moduleBuffer += "ewenLynetmzTr5FPg6e+vGHbdof3nbNokgbvy/jji098mLbjOpquwR/ce/7oqhNPXrbgag3+/t11WXtrR5cmQShmmybzU3s6ldkT"; +moduleBuffer += "8D5GX1UT8P5R8IFR8CHm+3cbuSCxtU6Sc93ypElywJ03DP/wqPKk+Ce2E7AproMn4PJR8HOj8A9+Z3ty6LZN9jnNQpU7vA0fgX/Q"; +moduleBuffer += "h2FNT+CcAyPr/TgO00GgMjqdXZ8hwk9kq9r5KGDKp1kY9cmnGWbgOsu8taU0geeFI/sbgCP7t2IU/EeoS3kJ+CqBZw2Dfx+Hv5UP"; +moduleBuffer += "4m7eIatNkz6PfSetCKnqlMVEGmqaqEwcyn/8O/OvjrR3dtySicjSlcB5JY7jUlxFBTWRmtZVLco/kKhWRtbo7rmJMh6KX6ISH4Wh"; +moduleBuffer += "K9qNNpv2rmIMCWmcy6W4PV6fPxAMhSNNS5ujLdPaiOh+r6Z/6D9/2NWpQQmjZ5MWG7+SqpaUQ/WwROJKzRAwMlMnyZPO3LL/1yXu"; +moduleBuffer += "p9Rfk4y+n1JupGdh4/dTjnzVQcaKlEW1Au2dhhy3xWkOzh0lmqZByED9GzSnKArrGUkM0f0ILm0zTrINHVtN2M3+h/xNnpwzmSg4"; +moduleBuffer += "RNYbJkk3roi2dMpyO30v1hgnviTLNLZElvR40snbknStZR4JqY66nISUB0ciUow4KklL4GyIh9viOAlcmilBszdIHEyMYbzNl8kf"; +moduleBuffer += "XYH/l9ZDnwfkQvKfVCg9KD+Ym0vCxUMsTbQrytbaOmYYo2tU9Gg9bauyRlEUt+JRvIpP8SsBJaiElLBbcbvdHrfX7XP73QF30B1y"; +moduleBuffer += "hz2Kx+3xeLwen8fvCXiCnpAn7FW8bq/H6/X6vH5vwBv0hrxhn+Jz+zw+r8/n8/sCvqAv5Av7Fb/b7/F7/T6/3x/wB/0hfzigBNwB"; +moduleBuffer += "T8Ab8AX8gUAgGAgFwkEl6A56gt6gL+gPBoLBYCgYDikhd8gT8oZ8IX8oEAqGQqFwmDQxTKoPk6LDBC1Mo/7JZwS59JnfElnREe1s"; +moduleBuffer += "p2dkS5J1uu0VddtPAn5e1N+ft0dWUYN4J5nYcbZLMKieQg/D6VeFkaj4sYA1yTovriPh2KEyqLlZL+F4ss4biXQdX0/Tauqg5/l0"; +moduleBuffer += "F0AyByjAfETyUhvKn0io2Wp167qOGq+XLBtDxx41ntdcEei3hDQ72Yis1hSbtt+NT6G2kltrx8gLl4auURpmPG5vWxlv67+k6GtA"; +moduleBuffer += "d4re31snZePoI24sG47JMLsJDnXDBv/PDzN1y3NEePXC733QqAfTh5n6PkX9rb3O5XItbooua11FX6PRcc6lP/J0UwmlO7WRNDae"; +moduleBuffer += "s+vr3GUS0rl+1a7zwaBdp71GrjiTxf2/ItrZlqHTHqVya6d+JrmjtTkqy7n6mOTR8WlkZIdNs40VOPQ9cC4JqS1tIQm5YfXQEkas"; +moduleBuffer += "sjr6EP6PHTqvJfLfctDsbE/snS879HnyBaO7zw/liV/JVbw68RmT+IVtJD916qL8EhgGUxmB8h/DAYAAhizPQ0EQocQaoBlbgQ0m"; +moduleBuffer += "sWOcySAFOmCayclmCtlgHFiO74aH0QvwOOyHb8N3jO+KZ+B78Cy4wA7AS/gzeEW+hv8Gv8I3gHFiaVnN7N4dO372wPqfPPnML48+"; +moduleBuffer += "+gLHi4HJZQv+fPptnJwaCC6ofXj/ocOv+C8k/eixTTuwyWxLynP7SmZUVM2qmd0cXbdhY++R3/zutb7/PFN/5KUMJy9IhmRHIFzy"; +moduleBuffer += "7L73PxCDj29+lpdKy1pae5+wtTWcuHJ1UdOXXw/Ou3PLVlfxxNz523fu+vnuvc8+d/T4a5zBmJJZMmXG3D17f/+HnXxa+tjxZVMu"; +moduleBuffer += "fX518GQfln8wfkKuN1RSOat6zrz5C+5aVL+kcWm05e6ONQ8+vG73/sPP//r0ocOr2s59/JMlYx9gES5CLQgUu9TuTOS2OPE4MYst"; +moduleBuffer += "YKdjc766nxuHx+FcwWeoQT5jLCjaJSG1dEYYLRVExc7moAwWlIfw7WwxlniRL5cnYqMYQCVsOo+N/JyqoNfk5V2CxE1AmQJUT99h"; +moduleBuffer += "RcFCId+ePsGZ7BBrSFXTTWm8xFUKE8Uuw7SyfK6Ulbi5HGCtiDUsFGBmU1alIKl7loydYZA405gSTuKSnYXYof5qUvM8Y6UoVczI"; +moduleBuffer += "qBTmmap4ST0y1ixxFVImmlkVRGZSa5iXYoE0vhRlzgcWj2nt1pYug/rauuqlph7Fapd6t7LdM7f8quTRvu4wn4/ruQlShZTLjok9"; +moduleBuffer += "X6L21UVvx2HeVk4556m/CT1n8qRnLsW8FpDJmbEQ2/AYvps1IZG39jaqX3GxF6tnip2T1L9IHcLqlIr7k43JxloxTf1RbCZ6ZJol"; +moduleBuffer += "pWdONsep7xawZTlgdRFKxzBWnm0rYUHsdL56pgCD2AX1r3nVWMJwrW169WT1t5M4gOezGT4YMxfiZuMCST0UyjQVYpGHZk7dsvZ9"; +moduleBuffer += "bEMmdC9u4IwYWIw4RPqbKxRiWBa705iJJDbEOzmRV7/q4RiAWJbjIM8JvGiTnIY0Y7rJajZasBUlJY0R7cCBU0EaSuczgBNm22VU"; +moduleBuffer += "gIoMLqBgN/SAvXgf3I8PCF/BG+w38CYaFJ9bc9/6jc8otXet3/C485zZcnv1ja9dxVPqFzd80rNx0+Yn9r1w9NjJvjff+vjip4MM"; +moduleBuffer += "1iZAsKR0ctWsxT2bSOKLR4/1vXWq/+KnzND0KKXzY0lztGfz1u1vnuo32fJIVFVtXf2Shuboxs37CMrJN89f/PSayTajqjmq9vzy"; +moduleBuffer += "+Ksn3n3v2hdrH1m/e8+rJ06+3n/2w8qnX/lD36n+qprZtQuXNDy2qfeFIy+d+E3f6+/Z7I66+r/89eaguvJfPz5vzl7V5sxsePCh"; +moduleBuffer += "Q4d/eOy43ZGVXTGzZjadJA89/B8n33n3o2tfXG/v6O3senKCq3jv4ZdOvN7/3vktTPlTTyu92af6/+udU4M1sxfV8YLFOrH4ytVV"; +moduleBuffer += "bcHJU6bNeHzzvGVdb7x5+u33P7h0c5CRG8Z2n8fd04UMzNliB83qATZbiDlRmgBwMfZhHgGe423SHEsSP59H2CmJSEA8onuDEbPI"; +moduleBuffer += "wAFzClvDZ/C1POQcxjn4NlREVjQbZzGW4MzxDfJKvHy8+gbb/TxK57q/QQt5u5gqUrZbTqZIOreQL2ArpEJMmAO5DYU4nTMg9SBJ"; +moduleBuffer += "KnarXwqTkAWVsSGhgO0etKUKxbYilGPJsagbcPcWuyHlxz9li9lSwmipovrq2E6jeiY9ZmXVAfFPO1BQjNUnqy8L6rmUUiRxIaFC"; +moduleBuffer += "MHKdhiy0CC8U1bWpTskuVmN1HXdgt9GB3btw7OwE3siy6h5r7DoP5HyOpG7E6qsoA1lMf7fQx8MG6lagr/UnM3WZnOpnucNg6gtr"; +moduleBuffer += "H62TNbUuS8iwQpa+7+wHuoz89/rRqjZdB/kWDZUeG6HKte9b1Cr9NX6ZrEQ6O6naS70gm1vvoVto032a8wPTnaW/OaDfaFmLZWYz"; +moduleBuffer += "28gsHrOTSXLI2Ua5MftqoVyQr+wsaNvTWAifvVCYdeNCEXNTDuwYbAx8AwYCQMoJjjMNBA+YI+Hi1IGw4hyY9eesgZpy3647siID"; +moduleBuffer += "864tj9w5u23gzu3HI/OZ/siC6Nu7FjBnc2qZC7vuOvRJzqLPLw7Unf4sUi8zV+qvgYcXM6uJSldEBBRI/oFKg5JiBVHCWBAC/AOQ"; +moduleBuffer += "lVFnKBFFkIqBSLZNtgCVivmpQA4SBCwQBuIlmAlKKDoWSBYJpgMIw2R/xVSYAVkQAQOFWZIBJEM72X1LaF0kN48kmAVKCa6RYOaS"; +moduleBuffer += "4kmpiCWszEODVippA0Bx2AnD8FYtmaASYEAKBwKYCyBvFJoAFA18FczQpK2gGZAaWQMYJ4IWDDhSFEyDGFmxifzkgAUQ+mMnyoRZ"; +moduleBuffer += "sBwCXgDQIAIyjUAXHAvuQRiKgEMfkgaQ1vK0RChwEgRKthsrEkYTRCOUMeRCQGsEmS8QPo2ACfC0MgT7yhnwuxwGbQSNMsO1QgYD"; +moduleBuffer += "SYZzIENlD5AGWfAUTE8ygQlCmgGAQqQASjBIJI7bOCoHGkm/ioGXdB9ClvQ7HwrgCiUbIAxrtdKveoBPwL+zDCK9xLkIg1+QOqay"; +moduleBuffer += "DJyNKwxu/AAIWPJITyXkJuXyYDIaxwKhDBihTyQ0wxA0IIgJWcB2gIQUjbb6OJh5xN4GCIkoOyBMOmeG8wXaSQeltB5PeOUyaTFH"; +moduleBuffer += "wgyaSmKWazSKapwAWEYE8DqQMAaPk/oxkKVcThs7DiIXGQKGJ2QCd9hJ00gZ93OIlknoXEkrAgwZbx/LIgfpLWdhjAgxZM1hwBQ8"; +moduleBuffer += "l3AT6bsLOhgWcYIA+Sz8U8QEsUcAZmBngYWUbNNKZZvBToIzGTP4JqlvJc80qteYqdteI6I0QMxaIK5ub2vuWhpt74DCCqI5dUWW"; +moduleBuffer += "RQG+o6ujkzGSJPquP9pc1HQfYjU3vfFuV8jnUoriTq5y7pDbnkw0W1+RWynyhPK4eyMrSHZOcXk8LsU43E84SfcTJoiRUHMkuLQp"; +moduleBuffer += "lMdUWfSDLg0t0UhnV3u0AxdYdCtItGjZirYmoj8WCB1k5SqKrukssLRHW6LtVMcpos6eHQWSds5Es3X8H31o0No="; +function getModule() { + let module2 = pako.inflate(new Uint8Array(Buffer.from(moduleBuffer, "base64"))); + return Uint8Array.from(module2); +} +var wasm; +var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => { + throw Error("TextDecoder not available"); +} }; +if (typeof TextDecoder !== "undefined") { + cachedTextDecoder.decode(); +} +var cachedUint8ArrayMemory0 = null; +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} +var WASM_VECTOR_LEN = 0; +var cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => { + throw Error("TextEncoder not available"); +} }; +var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} : function(arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}; +function passStringToWasm0(arg, malloc, realloc) { + if (realloc === void 0) { + const buf = cachedTextEncoder.encode(arg); + const ptr2 = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr2; + } + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + const mem = getUint8ArrayMemory0(); + let offset = 0; + for (; offset < len; offset++) { + const code9 = arg.charCodeAt(offset); + if (code9 > 127) + break; + mem[ptr + offset] = code9; + } + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + WASM_VECTOR_LEN = offset; + return ptr; +} +function isLikeNone(x) { + return x === void 0 || x === null; +} +var cachedDataViewMemory0 = null; +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} +function debugString(val) { + const type = typeof val; + if (type == "number" || type == "boolean" || val == null) { + return `${val}`; + } + if (type == "string") { + return `"${val}"`; + } + if (type == "symbol") { + const description = val.description; + if (description == null) { + return "Symbol"; + } else { + return `Symbol(${description})`; + } + } + if (type == "function") { + const name = val.name; + if (typeof name == "string" && name.length > 0) { + return `Function(${name})`; + } else { + return "Function"; + } + } + if (Array.isArray(val)) { + const length = val.length; + let debug = "["; + if (length > 0) { + debug += debugString(val[0]); + } + for (let i2 = 1; i2 < length; i2++) { + debug += ", " + debugString(val[i2]); + } + debug += "]"; + return debug; + } + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + return toString.call(val); + } + if (className == "Object") { + try { + return "Object(" + JSON.stringify(val) + ")"; + } catch (_) { + return "Object"; + } + } + if (val instanceof Error) { + return `${val.name}: ${val.message} +${val.stack}`; + } + return className; +} +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_export_2.set(idx, obj); + return idx; +} +function passArrayJsValueToWasm0(array, malloc) { + const ptr = malloc(array.length * 4, 4) >>> 0; + const mem = getDataViewMemory0(); + for (let i2 = 0; i2 < array.length; i2++) { + mem.setUint32(ptr + 4 * i2, addToExternrefTable0(array[i2]), true); + } + WASM_VECTOR_LEN = array.length; + return ptr; +} +function takeFromExternrefTable0(idx) { + const value = wasm.__wbindgen_export_2.get(idx); + wasm.__externref_table_dealloc(idx); + return value; +} +function ecdsaCombine(variant, presignature, signature_shares) { + const ptr0 = passArrayJsValueToWasm0(signature_shares, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.ecdsaCombine(variant, presignature, ptr0, len0); + if (ret[2]) { + throw takeFromExternrefTable0(ret[1]); + } + return takeFromExternrefTable0(ret[0]); +} +function ecdsaVerify(variant, message_hash, public_key, signature2) { + const ret = wasm.ecdsaVerify(variant, message_hash, public_key, signature2); + if (ret[1]) { + throw takeFromExternrefTable0(ret[0]); + } +} +function ecdsaDeriveKey(variant, id2, public_keys) { + const ptr0 = passArrayJsValueToWasm0(public_keys, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.ecdsaDeriveKey(variant, id2, ptr0, len0); + if (ret[2]) { + throw takeFromExternrefTable0(ret[1]); + } + return takeFromExternrefTable0(ret[0]); +} +function passArray8ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 1, 1) >>> 0; + getUint8ArrayMemory0().set(arg, ptr / 1); + WASM_VECTOR_LEN = arg.length; + return ptr; +} +function sevSnpGetVcekUrl(attestation_report) { + let deferred3_0; + let deferred3_1; + try { + const ptr0 = passArray8ToWasm0(attestation_report, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.sevSnpGetVcekUrl(ptr0, len0); + var ptr2 = ret[0]; + var len2 = ret[1]; + if (ret[3]) { + ptr2 = 0; + len2 = 0; + throw takeFromExternrefTable0(ret[2]); + } + deferred3_0 = ptr2; + deferred3_1 = len2; + return getStringFromWasm0(ptr2, len2); + } finally { + wasm.__wbindgen_free(deferred3_0, deferred3_1, 1); + } +} +function sevSnpVerify(attestation_report, attestation_data, signatures, challenge, vcek_certificate) { + const ptr0 = passArray8ToWasm0(attestation_report, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passArrayJsValueToWasm0(signatures, wasm.__wbindgen_malloc); + const len1 = WASM_VECTOR_LEN; + const ptr2 = passArray8ToWasm0(challenge, wasm.__wbindgen_malloc); + const len2 = WASM_VECTOR_LEN; + const ptr3 = passArray8ToWasm0(vcek_certificate, wasm.__wbindgen_malloc); + const len3 = WASM_VECTOR_LEN; + const ret = wasm.sevSnpVerify(ptr0, len0, attestation_data, ptr1, len1, ptr2, len2, ptr3, len3); + if (ret[1]) { + throw takeFromExternrefTable0(ret[0]); + } +} +function blsCombine(variant, signature_shares) { + const ptr0 = passArrayJsValueToWasm0(signature_shares, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.blsCombine(variant, ptr0, len0); + if (ret[2]) { + throw takeFromExternrefTable0(ret[1]); + } + return takeFromExternrefTable0(ret[0]); +} +function blsVerify(variant, public_key, message, signature2) { + const ret = wasm.blsVerify(variant, public_key, message, signature2); + if (ret[1]) { + throw takeFromExternrefTable0(ret[0]); + } +} +function blsEncrypt(variant, encryption_key, message, identity) { + const ret = wasm.blsEncrypt(variant, encryption_key, message, identity); + if (ret[2]) { + throw takeFromExternrefTable0(ret[1]); + } + return takeFromExternrefTable0(ret[0]); +} +function blsDecrypt(variant, ciphertext, decryption_key) { + const ret = wasm.blsDecrypt(variant, ciphertext, decryption_key); + if (ret[2]) { + throw takeFromExternrefTable0(ret[1]); + } + return takeFromExternrefTable0(ret[0]); +} +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e2) { + const idx = addToExternrefTable0(e2); + wasm.__wbindgen_exn_store(idx); + } +} +async function __wbg_load(module2, imports) { + if (typeof Response === "function" && module2 instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === "function") { + try { + return await WebAssembly.instantiateStreaming(module2, imports); + } catch (e2) { + if (module2.headers.get("Content-Type") != "application/wasm") { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e2); + } else { + throw e2; + } + } + } + const bytes = await module2.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + } else { + const instance = await WebAssembly.instantiate(module2, imports); + if (instance instanceof WebAssembly.Instance) { + return { instance, module: module2 }; + } else { + return instance; + } + } +} +function __wbg_get_imports() { + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbindgen_error_new = function(arg0, arg1) { + const ret = new Error(getStringFromWasm0(arg0, arg1)); + return ret; + }; + imports.wbg.__wbindgen_string_get = function(arg0, arg1) { + const obj = arg1; + const ret = typeof obj === "string" ? obj : void 0; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }; + imports.wbg.__wbindgen_is_string = function(arg0) { + const ret = typeof arg0 === "string"; + return ret; + }; + imports.wbg.__wbindgen_is_object = function(arg0) { + const val = arg0; + const ret = typeof val === "object" && val !== null; + return ret; + }; + imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) { + const ret = arg0 == arg1; + return ret; + }; + imports.wbg.__wbindgen_boolean_get = function(arg0) { + const v = arg0; + const ret = typeof v === "boolean" ? v ? 1 : 0 : 2; + return ret; + }; + imports.wbg.__wbindgen_number_get = function(arg0, arg1) { + const obj = arg1; + const ret = typeof obj === "number" ? obj : void 0; + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); + }; + imports.wbg.__wbindgen_as_number = function(arg0) { + const ret = +arg0; + return ret; + }; + imports.wbg.__wbg_String_b9412f8799faab3e = function(arg0, arg1) { + const ret = String(arg1); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }; + imports.wbg.__wbindgen_number_new = function(arg0) { + const ret = arg0; + return ret; + }; + imports.wbg.__wbindgen_string_new = function(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return ret; + }; + imports.wbg.__wbg_String_88810dfeb4021902 = function(arg0, arg1) { + const ret = String(arg1); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }; + imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) { + const ret = arg0.crypto; + return ret; + }; + imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) { + const ret = arg0.process; + return ret; + }; + imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) { + const ret = arg0.versions; + return ret; + }; + imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) { + const ret = arg0.node; + return ret; + }; + imports.wbg.__wbg_require_cca90b1a94a0255b = function() { + return handleError(function() { + const ret = module.require; + return ret; + }, arguments); + }; + imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) { + const ret = arg0.msCrypto; + return ret; + }; + imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { + return handleError(function(arg0, arg1) { + arg0.randomFillSync(arg1); + }, arguments); + }; + imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { + return handleError(function(arg0, arg1) { + arg0.getRandomValues(arg1); + }, arguments); + }; + imports.wbg.__wbg_length_f217bbbf7e8e4df4 = function(arg0) { + const ret = arg0.length; + return ret; + }; + imports.wbg.__wbg_new_034f913e7636e987 = function() { + const ret = new Array(); + return ret; + }; + imports.wbg.__wbg_newnoargs_1ede4bf2ebbaaf43 = function(arg0, arg1) { + const ret = new Function(getStringFromWasm0(arg0, arg1)); + return ret; + }; + imports.wbg.__wbg_next_13b477da1eaa3897 = function(arg0) { + const ret = arg0.next; + return ret; + }; + imports.wbg.__wbindgen_is_function = function(arg0) { + const ret = typeof arg0 === "function"; + return ret; + }; + imports.wbg.__wbg_value_2ab8a198c834c26a = function(arg0) { + const ret = arg0.value; + return ret; + }; + imports.wbg.__wbg_iterator_695d699a44d6234c = function() { + const ret = Symbol.iterator; + return ret; + }; + imports.wbg.__wbg_self_bf91bf94d9e04084 = function() { + return handleError(function() { + const ret = self.self; + return ret; + }, arguments); + }; + imports.wbg.__wbg_window_52dd9f07d03fd5f8 = function() { + return handleError(function() { + const ret = window.window; + return ret; + }, arguments); + }; + imports.wbg.__wbg_globalThis_05c129bf37fcf1be = function() { + return handleError(function() { + const ret = globalThis.globalThis; + return ret; + }, arguments); + }; + imports.wbg.__wbg_global_3eca19bb09e9c484 = function() { + return handleError(function() { + const ret = global.global; + return ret; + }, arguments); + }; + imports.wbg.__wbindgen_is_undefined = function(arg0) { + const ret = arg0 === void 0; + return ret; + }; + imports.wbg.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) { + const ret = arg0[arg1 >>> 0]; + return ret; + }; + imports.wbg.__wbg_set_425e70f7c64ac962 = function(arg0, arg1, arg2) { + arg0[arg1 >>> 0] = arg2; + }; + imports.wbg.__wbg_from_91a67a5f04c98a54 = function(arg0) { + const ret = Array.from(arg0); + return ret; + }; + imports.wbg.__wbg_isArray_6f3b47f09adb61b5 = function(arg0) { + const ret = Array.isArray(arg0); + return ret; + }; + imports.wbg.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) { + let result; + try { + result = arg0 instanceof ArrayBuffer; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }; + imports.wbg.__wbg_call_a9ef466721e824f2 = function() { + return handleError(function(arg0, arg1) { + const ret = arg0.call(arg1); + return ret; + }, arguments); + }; + imports.wbg.__wbg_call_3bfa248576352471 = function() { + return handleError(function(arg0, arg1, arg2) { + const ret = arg0.call(arg1, arg2); + return ret; + }, arguments); + }; + imports.wbg.__wbg_next_b06e115d1b01e10b = function() { + return handleError(function(arg0) { + const ret = arg0.next(); + return ret; + }, arguments); + }; + imports.wbg.__wbg_done_983b5ffcaec8c583 = function(arg0) { + const ret = arg0.done; + return ret; + }; + imports.wbg.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) { + const ret = Number.isSafeInteger(arg0); + return ret; + }; + imports.wbg.__wbg_entries_c02034de337d3ee2 = function(arg0) { + const ret = Object.entries(arg0); + return ret; + }; + imports.wbg.__wbg_buffer_ccaed51a635d8a2d = function(arg0) { + const ret = arg0.buffer; + return ret; + }; + imports.wbg.__wbg_newwithbyteoffsetandlength_7e3eb787208af730 = function(arg0, arg1, arg2) { + const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0); + return ret; + }; + imports.wbg.__wbg_new_fec2611eb9180f95 = function(arg0) { + const ret = new Uint8Array(arg0); + return ret; + }; + imports.wbg.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) { + let result; + try { + result = arg0 instanceof Uint8Array; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }; + imports.wbg.__wbg_newwithlength_76462a666eca145f = function(arg0) { + const ret = new Uint8Array(arg0 >>> 0); + return ret; + }; + imports.wbg.__wbg_subarray_975a06f9dbd16995 = function(arg0, arg1, arg2) { + const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0); + return ret; + }; + imports.wbg.__wbg_length_9254c4bd3b9f23c4 = function(arg0) { + const ret = arg0.length; + return ret; + }; + imports.wbg.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) { + arg0.set(arg1, arg2 >>> 0); + }; + imports.wbg.__wbg_get_ef828680c64da212 = function() { + return handleError(function(arg0, arg1) { + const ret = Reflect.get(arg0, arg1); + return ret; + }, arguments); + }; + imports.wbg.__wbindgen_debug_string = function(arg0, arg1) { + const ret = debugString(arg1); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }; + imports.wbg.__wbindgen_throw = function(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); + }; + imports.wbg.__wbindgen_memory = function() { + const ret = wasm.memory; + return ret; + }; + imports.wbg.__wbindgen_init_externref_table = function() { + const table = wasm.__wbindgen_export_2; + const offset = table.grow(4); + table.set(0, void 0); + table.set(offset + 0, void 0); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; + }; + return imports; +} +function __wbg_init_memory(imports, memory) { +} +function __wbg_finalize_init(instance, module2) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module2; + cachedDataViewMemory0 = null; + cachedUint8ArrayMemory0 = null; + wasm.__wbindgen_start(); + return wasm; +} +function initSync(module2) { + if (wasm !== void 0) + return wasm; + if (typeof module2 !== "undefined") { + if (Object.getPrototypeOf(module2) === Object.prototype) { + ({ module: module2 } = module2); + } else { + console.warn("using deprecated parameters for `initSync()`; pass a single object instead"); + } + } + const imports = __wbg_get_imports(); + __wbg_init_memory(imports); + if (!(module2 instanceof WebAssembly.Module)) { + module2 = new WebAssembly.Module(module2); + } + const instance = new WebAssembly.Instance(module2, imports); + return __wbg_finalize_init(instance, module2); +} +async function __wbg_init(module_or_path) { + if (wasm !== void 0) + return wasm; + if (typeof module_or_path !== "undefined") { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({ module_or_path } = module_or_path); + } else { + console.warn("using deprecated parameters for the initialization function; pass a single object instead"); + } + } + const imports = __wbg_get_imports(); + __wbg_init_memory(imports); + const { instance, module: module2 } = await __wbg_load(await module_or_path, imports); + return __wbg_finalize_init(instance, module2); +} + +// packages/wasm/src/index.ts +var loadingPromise = null; +var wasmSdkInstance; +async function initWasm() { + return initSync(getModule()); +} +async function loadModules() { + if (wasmSdkInstance) { + return wasmSdkInstance; + } + if (loadingPromise) { + return loadingPromise; + } + loadingPromise = initWasm(); + try { + wasmSdkInstance = await loadingPromise; + } finally { + loadingPromise = null; + } + return; +} +async function blsCombine2(variant, signature_shares) { + await loadModules(); + return blsCombine(variant, signature_shares); +} +async function blsDecrypt2(variant, ciphertext, decryption_key) { + await loadModules(); + return blsDecrypt(variant, ciphertext, decryption_key); +} +async function blsEncrypt2(variant, encryption_key, message, identity) { + await loadModules(); + return blsEncrypt(variant, encryption_key, message, identity); +} +async function blsVerify2(variant, public_key, message, signature2) { + await loadModules(); + return blsVerify(variant, public_key, message, signature2); +} +async function ecdsaCombine2(variant, presignature, signature_shares) { + await loadModules(); + return ecdsaCombine(variant, presignature, signature_shares); +} +async function ecdsaDeriveKey2(variant, id2, public_keys) { + await loadModules(); + return ecdsaDeriveKey(variant, id2, public_keys); +} +async function ecdsaVerify2(variant, message_hash, public_key, signature2) { + await loadModules(); + return ecdsaVerify(variant, message_hash, public_key, signature2); +} +async function sevSnpGetVcekUrl2(attestation_report) { + await loadModules(); + return sevSnpGetVcekUrl(attestation_report); +} +async function sevSnpVerify2(attestation_report, attestation_data, signatures, challenge, vcek_certificate) { + await loadModules(); + return sevSnpVerify( + attestation_report, + attestation_data, + signatures, + challenge, + vcek_certificate + ); +} + +// packages/crypto/src/lib/crypto.ts +var LIT_CORS_PROXY = `https://cors.litgateway.com`; +var encrypt2 = async (publicKeyHex, message, identity) => { + const publicKey = Buffer.from(publicKeyHex, "hex"); + if (publicKeyHex.replace("0x", "").length !== 96) { + throw new InvalidParamType( + { + info: { + publicKeyHex + } + }, + `Invalid public key length. Expecting 96 characters, got ${publicKeyHex.replace("0x", "").length} instead.` + ); + } + return Buffer.from( + await blsEncrypt2("Bls12381G2", publicKey, message, identity) + ).toString("base64"); +}; +var verifyAndDecryptWithSignatureShares = async (publicKeyHex, identity, ciphertextBase64, shares) => { + const publicKey = Buffer.from(publicKeyHex, "hex"); + const signature2 = await doCombineSignatureShares(shares); + await blsVerify2("Bls12381G2", publicKey, identity, signature2); + return doDecrypt(ciphertextBase64, signature2); +}; +var combineSignatureShares = async (shares) => { + const signature2 = await doCombineSignatureShares(shares); + return Buffer.from(signature2).toString("hex"); +}; +var verifySignature = async (publicKeyHex, message, signature2) => { + const publicKey = Buffer.from(publicKeyHex, "hex"); + await blsVerify2("Bls12381G2", publicKey, message, signature2); +}; +var ecdsaSigntureTypeMap = { + [LIT_CURVE.EcdsaCaitSith]: "K256", + [LIT_CURVE.EcdsaK256]: "K256", + [LIT_CURVE.EcdsaCAITSITHP256]: "P256" +}; +var combineEcdsaShares = async (sigShares) => { + const validShares = sigShares.filter((share) => share.signatureShare); + const anyValidShare = validShares[0]; + if (!anyValidShare) { + throw new NoValidShares( + { + info: { + shares: sigShares + } + }, + "No valid shares to combine" + ); + } + const variant = ecdsaSigntureTypeMap[anyValidShare.sigType]; + const presignature = Buffer.from(anyValidShare.bigR, "hex"); + const signatureShares = validShares.map( + (share) => Buffer.from(share.signatureShare, "hex") + ); + const [r3, s2, v] = await ecdsaCombine2(variant, presignature, signatureShares); + const publicKey = Buffer.from(anyValidShare.publicKey, "hex"); + const messageHash = Buffer.from(anyValidShare.dataSigned, "hex"); + await ecdsaVerify2(variant, messageHash, publicKey, [r3, s2, v]); + const signature2 = (0, import_utils12.splitSignature)(Buffer.concat([r3, s2, Buffer.from([v])])); + return { + r: signature2.r.slice("0x".length), + s: signature2.s.slice("0x".length), + recid: signature2.recoveryParam + }; +}; +var computeHDPubKey = async (pubkeys, keyId, sigType) => { + const variant = ecdsaSigntureTypeMap[sigType]; + switch (sigType) { + case LIT_CURVE.EcdsaCaitSith: + case LIT_CURVE.EcdsaK256: + pubkeys = pubkeys.map((value) => { + return value.replace("0x", ""); + }); + keyId = keyId.replace("0x", ""); + const preComputedPubkey = await ecdsaDeriveKey2( + variant, + Buffer.from(keyId, "hex"), + pubkeys.map((hex) => Buffer.from(hex, "hex")) + ); + return Buffer.from(preComputedPubkey).toString("hex"); + default: + throw new InvalidParamType( + { + info: { + sigType + } + }, + `Non supported signature type` + ); + } +}; +var generateSessionKeyPair = () => { + const keyPair2 = nacl2.sign.keyPair(); + const sessionKeyPair = { + publicKey: uint8arrayToString(keyPair2.publicKey, "base16"), + secretKey: uint8arrayToString(keyPair2.secretKey, "base16") + }; + return sessionKeyPair; +}; +function doDecrypt(ciphertextBase64, signature2) { + console.log("signature from encrypt op: ", signature2); + const ciphertext = Buffer.from(ciphertextBase64, "base64"); + return blsDecrypt2("Bls12381G2", ciphertext, signature2); +} +function doCombineSignatureShares(shares) { + const sigShares = shares.map((s2) => Buffer.from(s2.ProofOfPossession, "hex")); + const signature2 = blsCombine2("Bls12381G2", sigShares); + return signature2; +} +async function getAmdCert(url) { + const proxyUrl = `${LIT_CORS_PROXY}/${url}`; + log( + `[getAmdCert] Fetching AMD cert using proxy URL ${proxyUrl} to manage CORS restrictions and to avoid being rate limited by AMD.` + ); + async function fetchAsUint8Array(targetUrl) { + const res = await fetch(targetUrl); + if (!res.ok) { + throw new NetworkError( + { + info: { + targetUrl + } + }, + `[getAmdCert] HTTP error! status: ${res.status}` + ); + } + const arrayBuffer = await res.arrayBuffer(); + return new Uint8Array(arrayBuffer); + } + try { + return await fetchAsUint8Array(proxyUrl); + } catch (e2) { + log(`[getAmdCert] Failed to fetch AMD cert from proxy:`, e2); + } + log("[getAmdCert] Attempting to fetch directly without proxy."); + try { + return await fetchAsUint8Array(url); + } catch (e2) { + log("[getAmdCert] Direct fetch also failed:", e2); + throw e2; + } +} +var checkSevSnpAttestation = async (attestation, challengeHex, url) => { + const noonce = Buffer.from(attestation.noonce, "base64"); + const challenge = Buffer.from(challengeHex, "hex"); + const data = Object.fromEntries( + Object.entries(attestation.data).map(([k, v]) => [ + k, + Buffer.from(v, "base64") + ]) + ); + const signatures = attestation.signatures.map( + (s2) => Buffer.from(s2, "base64") + ); + const report = Buffer.from(attestation.report, "base64"); + if (!noonce.equals(challenge)) { + throw new NetworkError( + { + info: { + attestation, + challengeHex, + noonce, + challenge + } + }, + `Attestation noonce ${noonce} does not match challenge ${challenge}` + ); + } + const parsedUrl = new URL(url); + const ipWeTalkedTo = parsedUrl.hostname; + let portWeTalkedTo = parsedUrl.port; + if (portWeTalkedTo === "") { + if (url.startsWith("https://")) { + portWeTalkedTo = "443"; + } else if (url.startsWith("http://")) { + portWeTalkedTo = "80"; + } else { + throw new NetworkError( + { + info: { + url + } + }, + `Unknown port in URL ${url}` + ); + } + } + const ipAndAddrFromReport = data["EXTERNAL_ADDR"].toString("utf8"); + const ipFromReport = ipAndAddrFromReport.split(":")[0]; + const portFromReport = ipAndAddrFromReport.split(":")[1]; + if (ipWeTalkedTo !== ipFromReport) { + throw new NetworkError( + { + info: { + attestation, + ipWeTalkedTo, + ipFromReport + } + }, + `Attestation external address ${ipFromReport} does not match IP we talked to ${ipWeTalkedTo}` + ); + } + if (portWeTalkedTo !== portFromReport) { + throw new NetworkError( + { + info: { + attestation, + portWeTalkedTo, + portFromReport + } + }, + `Attestation external port ${portFromReport} does not match port we talked to ${portWeTalkedTo}` + ); + } + let vcekCert; + const vcekUrl = await sevSnpGetVcekUrl2(report); + if (globalThis.localStorage) { + log("Using local storage for certificate caching"); + vcekCert = localStorage.getItem(vcekUrl); + if (vcekCert) { + vcekCert = uint8arrayFromString(vcekCert, "base64"); + } else { + vcekCert = await getAmdCert(vcekUrl); + localStorage.setItem(vcekUrl, uint8arrayToString(vcekCert, "base64")); + } + } else { + const cache = globalThis.amdCertStore ??= {}; + cache[vcekUrl] ??= await getAmdCert(vcekUrl); + vcekCert = cache[vcekUrl]; + } + if (!vcekCert || vcekCert.length === 0 || vcekCert.length < 256) { + throw new UnknownError( + { + info: { + attestation, + report, + vcekUrl + } + }, + "Unable to retrieve VCEK certificate from AMD" + ); + } + return sevSnpVerify2(report, data, signatures, challenge, vcekCert); +}; + +// packages/core/src/lib/endpoint-version.ts +init_shim(); +var composeLitUrl = (params) => { + try { + new URL(params.url); + } catch (error) { + throw new Error(`[composeLitUrl] Invalid URL: "${params.url}"`); + } + const version28 = params.endpoint.version; + return `${params.url}${params.endpoint.path}${version28}`; +}; + +// packages/core/src/lib/lit-core.ts +var EPOCH_PROPAGATION_DELAY = 45e3; +var BLOCKHASH_SYNC_INTERVAL = 3e4; +var NETWORKS_REQUIRING_SEV = [ + LIT_NETWORK.DatilTest, + LIT_NETWORK.Datil +]; +var FALLBACK_RPC_URLS = [ + "https://ethereum-rpc.publicnode.com", + "https://eth.llamarpc.com", + "https://eth.drpc.org", + "https://eth.llamarpc.com" +]; +var LitCore = class { + config = { + alertWhenUnauthorized: false, + debug: true, + connectTimeout: 2e4, + checkNodeAttestation: false, + litNetwork: LIT_NETWORK.Custom, + minNodeCount: 2, + // Default value, should be replaced + bootstrapUrls: [], + // Default value, should be replaced + nodeProtocol: null + }; + connectedNodes = /* @__PURE__ */ new Set(); + serverKeys = {}; + ready = false; + subnetPubKey = null; + networkPubKey = null; + networkPubKeySet = null; + hdRootPubkeys = null; + latestBlockhash = null; + lastBlockHashRetrieved = null; + _networkSyncInterval = null; + _stakingContract = null; + _stakingContractListener = null; + _connectingPromise = null; + _epochCache = { + currentNumber: null, + startTime: null + }; + _blockHashUrl = "https://block-indexer.litgateway.com/get_most_recent_valid_block"; + // ========== Constructor ========== + constructor(config2) { + if (!(config2.litNetwork in LIT_NETWORKS)) { + const validNetworks = Object.keys(LIT_NETWORKS).join(", "); + throw new InvalidParamType( + {}, + 'Unsupported network has been provided please use a "litNetwork" option which is supported (%s)', + validNetworks + ); + } + switch (config2?.litNetwork) { + case LIT_NETWORK.DatilDev: + this.config = { + ...this.config, + checkNodeAttestation: NETWORKS_REQUIRING_SEV.includes( + config2?.litNetwork + ), + ...config2 + }; + break; + default: + this.config = { + ...this.config, + ...config2 + }; + } + this.setCustomBootstrapUrls(); + setMiscLitConfig(this.config); + bootstrapLogManager( + "core", + this.config.debug ? LogLevel.DEBUG : LogLevel.OFF + ); + if (this.config.storageProvider?.provider) { + log( + "localstorage api not found, injecting persistence instance found in config" + ); + Object.defineProperty(globalThis, "localStorage", { + value: this.config.storageProvider?.provider + }); + } else if (isNode() && !globalThis.localStorage && !this.config.storageProvider?.provider) { + log( + "Looks like you are running in NodeJS and did not provide a storage provider, your sessions will not be cached" + ); + } + } + // ========== Logger utilities ========== + getLogsForRequestId = (id2) => { + return globalThis.logManager.getLogsForId(id2); + }; + getRequestIds = () => { + return globalThis.logManager.LoggerIds; + }; + /** + * Retrieves the validator data including staking contract, epoch, minNodeCount, and bootstrapUrls. + * @returns An object containing the validator data. + * @throws Error if minNodeCount is not provided, is less than or equal to 0, or if bootstrapUrls are not available. + */ + async _getValidatorData() { + const { stakingContract, epochInfo, minNodeCount, bootstrapUrls } = await LitContracts.getConnectionInfo({ + litNetwork: this.config.litNetwork, + networkContext: this.config.contractContext, + rpcUrl: this.config.rpcUrl, + nodeProtocol: this.config.nodeProtocol + }); + if (!minNodeCount) { + throw new InvalidArgumentException( + {}, + `minNodeCount is %s, which is invalid. Please check your network connection and try again.`, + minNodeCount + ); + } + if (!Array.isArray(bootstrapUrls) || bootstrapUrls.length <= 0) { + throw new InitError( + {}, + `Failed to get bootstrapUrls for network %s`, + this.config.litNetwork + ); + } + log("[_getValidatorData] epochInfo: ", epochInfo); + log("[_getValidatorData] minNodeCount: ", minNodeCount); + log("[_getValidatorData] Bootstrap urls: ", bootstrapUrls); + log("[_getValidatorData] stakingContract: ", stakingContract.address); + return { + stakingContract, + epochInfo, + minNodeCount, + bootstrapUrls + }; + } + // ========== Scoped Class Helpers ========== + async _handleStakingContractStateChange(state) { + log(`New state detected: "${state}"`); + const validatorData = await this._getValidatorData(); + if (state === STAKING_STATES.Active) { + this._epochState = await this._fetchCurrentEpochState( + validatorData.epochInfo + ); + if (CENTRALISATION_BY_NETWORK[this.config.litNetwork] !== "centralised") { + try { + log( + "State found to be new validator set locked, checking validator set" + ); + const existingNodeUrls = [...this.config.bootstrapUrls]; + const delta = validatorData.bootstrapUrls.filter( + (item) => existingNodeUrls.includes(item) + ); + if (delta.length > 1) { + log( + "Active validator sets changed, new validators ", + delta, + "starting node connection" + ); + } + await this.connect(); + } catch (err) { + const { message = "" } = err; + logError( + "Error while attempting to reconnect to nodes after epoch transition:", + message + ); + } + } + } + } + /** + * Sets up a listener to detect state changes (new epochs) in the staking contract. + * When a new epoch is detected, it triggers the `setNewConfig` function to update + * the client's configuration based on the new state of the network. This ensures + * that the client's configuration is always in sync with the current state of the + * staking contract. + * + * @returns {Promise} A promise that resolves when the listener is successfully set up. + */ + _listenForNewEpoch() { + if (this._stakingContractListener) { + return; + } + if (this._stakingContract) { + log( + "listening for state change on staking contract: ", + this._stakingContract.address + ); + this._stakingContractListener = (state) => { + this._handleStakingContractStateChange(state); + }; + this._stakingContract.on("StateChanged", this._stakingContractListener); + } + } + /** + * Stops internal listeners/polling that refresh network state and watch for epoch changes. + * Removes global objects created internally + */ + async disconnect() { + this.ready = false; + this._stopListeningForNewEpoch(); + setMiscLitConfig(void 0); + } + // _stopNetworkPolling() { + // if (this._networkSyncInterval) { + // clearInterval(this._networkSyncInterval); + // this._networkSyncInterval = null; + // } + // } + _stopListeningForNewEpoch() { + if (this._stakingContract && this._stakingContractListener) { + this._stakingContract.off("StateChanged", this._stakingContractListener); + this._stakingContractListener = null; + } + } + /** + * + * Set bootstrapUrls to match the network litNetwork unless it's set to custom + * + * @returns { void } + * + */ + setCustomBootstrapUrls = () => { + if (this.config.litNetwork === LIT_NETWORK.Custom) + return; + const hasNetwork = this.config.litNetwork in LIT_NETWORKS; + if (!hasNetwork) { + throw new LitNodeClientBadConfigError( + {}, + "the litNetwork specified in the LitNodeClient config not found in LIT_NETWORKS" + ); + } + this.config.bootstrapUrls = LIT_NETWORKS[this.config.litNetwork]; + }; + /** + * Return the latest blockhash from the nodes + * @returns { Promise } latest blockhash + */ + getLatestBlockhash = async () => { + await this._syncBlockhash(); + if (!this.latestBlockhash) { + throw new InvalidEthBlockhash( + {}, + `latestBlockhash is not available. Received: "%s"`, + this.latestBlockhash + ); + } + return this.latestBlockhash; + }; + /** + * + * Connect to the LIT nodes + * + * @returns { Promise } A promise that resolves when the nodes are connected. + * + */ + async connect() { + if (this._connectingPromise) { + return this._connectingPromise; + } + this._connectingPromise = this._connect(); + await this._connectingPromise.finally(() => { + this._connectingPromise = null; + }); + } + async _connect() { + this._stopListeningForNewEpoch(); + if (!this.config.contractContext) { + this.config.contractContext = await LitContracts.getContractAddresses( + this.config.litNetwork, + new ethers_exports.providers.StaticJsonRpcProvider({ + url: this.config.rpcUrl || RPC_URL_BY_NETWORK[this.config.litNetwork], + skipFetchSetup: true + }) + ); + } else if (!this.config.contractContext.Staking && !this.config.contractContext.resolverAddress) { + throw new InitError( + { + info: { + contractContext: this.config.contractContext, + litNetwork: this.config.litNetwork, + rpcUrl: this.config.rpcUrl + } + }, + 'The provided contractContext was missing the "Staking" contract' + ); + } + if (this.config.contractContext) { + const logAddresses = Object.entries(this.config.contractContext).reduce( + (output, [key2, val]) => { + output[key2] = val.address; + return output; + }, + {} + ); + if (this.config.litNetwork === LIT_NETWORK.Custom) { + log("using custom contracts: ", logAddresses); + } + } + const validatorData = await this._getValidatorData(); + this._stakingContract = validatorData.stakingContract; + this.config.minNodeCount = validatorData.minNodeCount; + this.config.bootstrapUrls = validatorData.bootstrapUrls; + this._epochState = await this._fetchCurrentEpochState( + validatorData.epochInfo + ); + const { connectedNodes, serverKeys, coreNodeConfig } = await this._runHandshakeWithBootstrapUrls(); + Object.assign(this, { ...coreNodeConfig, connectedNodes, serverKeys }); + this._listenForNewEpoch(); + this.ready = true; + log(`\u{1F525} lit is ready. "litNodeClient" variable is ready to use globally.`); + log("current network config", { + networkPubkey: this.networkPubKey, + networkPubKeySet: this.networkPubKeySet, + hdRootPubkeys: this.hdRootPubkeys, + subnetPubkey: this.subnetPubKey, + latestBlockhash: this.latestBlockhash + }); + if (isBrowser()) { + document.dispatchEvent(new Event("lit-ready")); + } + } + async _handshakeAndVerifyNodeAttestation({ + url, + requestId + }) { + const challenge = this.getRandomHexString(64); + const handshakeResult = await this.handshakeWithNode( + { url, challenge }, + requestId + ); + const keys = { + serverPubKey: handshakeResult.serverPublicKey, + subnetPubKey: handshakeResult.subnetPublicKey, + networkPubKey: handshakeResult.networkPublicKey, + networkPubKeySet: handshakeResult.networkPublicKeySet, + hdRootPubkeys: handshakeResult.hdRootPubkeys, + latestBlockhash: handshakeResult.latestBlockhash + }; + if (keys.serverPubKey === "ERR" || keys.subnetPubKey === "ERR" || keys.networkPubKey === "ERR" || keys.networkPubKeySet === "ERR") { + logErrorWithRequestId( + requestId, + 'Error connecting to node. Detected "ERR" in keys', + url, + keys + ); + } + log(`Handshake with ${url} returned keys: `, keys); + if (!keys.latestBlockhash) { + logErrorWithRequestId( + requestId, + `Error getting latest blockhash from the node ${url}.` + ); + } + if (this.config.checkNodeAttestation || NETWORKS_REQUIRING_SEV.includes(this.config.litNetwork)) { + const attestation = handshakeResult.attestation; + if (!attestation) { + throw new InvalidNodeAttestation( + {}, + `Missing attestation in handshake response from %s`, + url + ); + } + log("Checking attestation against amd certs..."); + try { + await checkSevSnpAttestation(attestation, challenge, url); + log(`Lit Node Attestation verified for ${url}`); + } catch (e2) { + throw new InvalidNodeAttestation( + { + cause: e2 + }, + `Lit Node Attestation failed verification for %s - %s`, + url, + e2.message + ); + } + } else if (this.config.litNetwork === LIT_NETWORK.Custom) { + log( + `Node attestation SEV verification is disabled. You must explicitly set "checkNodeAttestation" to true when using 'custom' network` + ); + } + return keys; + } + /** Handshakes with all nodes that are in `bootstrapUrls` + * @private + * + * @returns {Promise<{connectedNodes: Set, serverKeys: {}}>} Returns a set of the urls of nodes that we + * successfully connected to, an object containing their returned keys, and our 'core' config (most common values for + * critical values) + */ + async _runHandshakeWithBootstrapUrls() { + const requestId = this._getNewRequestId(); + const connectedNodes = /* @__PURE__ */ new Set(); + const serverKeys = {}; + let timeoutHandle; + await Promise.race([ + new Promise((_resolve, reject) => { + timeoutHandle = setTimeout(() => { + const msg = `Error: Could not handshake with nodes after timeout of ${this.config.connectTimeout}ms. Could only connect to ${Object.keys(serverKeys).length} of ${this.config.bootstrapUrls.length} nodes. Please check your network connection and try again. Note that you can control this timeout with the connectTimeout config option which takes milliseconds.`; + try { + throw new InitError({}, msg); + } catch (e2) { + logErrorWithRequestId(requestId, e2); + reject(e2); + } + }, this.config.connectTimeout); + }), + Promise.all( + this.config.bootstrapUrls.map(async (url) => { + serverKeys[url] = await this._handshakeAndVerifyNodeAttestation({ + url, + requestId + }); + connectedNodes.add(url); + }) + ).finally(() => { + clearTimeout(timeoutHandle); + }) + ]); + const coreNodeConfig = this._getCoreNodeConfigFromHandshakeResults({ + serverKeys, + requestId + }); + return { connectedNodes, serverKeys, coreNodeConfig }; + } + _getCoreNodeConfigFromHandshakeResults({ + serverKeys, + requestId + }) { + const latestBlockhash = mostCommonString( + Object.values(serverKeys).map( + (keysFromSingleNode) => keysFromSingleNode.latestBlockhash + ) + ); + if (!latestBlockhash) { + logErrorWithRequestId( + requestId, + "Error getting latest blockhash from the nodes." + ); + throw new InvalidEthBlockhash( + { + info: { + requestId + } + }, + `latestBlockhash is not available. Received: "%s"`, + latestBlockhash + ); + } + return { + subnetPubKey: mostCommonString( + Object.values(serverKeys).map( + (keysFromSingleNode) => keysFromSingleNode.subnetPubKey + ) + ), + networkPubKey: mostCommonString( + Object.values(serverKeys).map( + (keysFromSingleNode) => keysFromSingleNode.networkPubKey + ) + ), + networkPubKeySet: mostCommonString( + Object.values(serverKeys).map( + (keysFromSingleNode) => keysFromSingleNode.networkPubKeySet + ) + ), + hdRootPubkeys: mostCommonString( + Object.values(serverKeys).map( + (keysFromSingleNode) => keysFromSingleNode.hdRootPubkeys + ) + ), + latestBlockhash, + lastBlockHashRetrieved: Date.now() + }; + } + _getProviderWithFallback = async () => { + for (const url of FALLBACK_RPC_URLS) { + try { + const provider = new ethers_exports.providers.JsonRpcProvider({ + url, + // https://docs.ethers.org/v5/api/utils/web/#ConnectionInfo + timeout: 6e4 + }); + await provider.getBlockNumber(); + return provider; + } catch (error) { + logError(`RPC URL failed: ${url}`); + } + } + return null; + }; + /** + * Fetches the latest block hash and log any errors that are returned + * @returns void + */ + async _syncBlockhash() { + const currentTime = Date.now(); + const blockHashValidityDuration = BLOCKHASH_SYNC_INTERVAL; + if (this.latestBlockhash && this.lastBlockHashRetrieved && currentTime - this.lastBlockHashRetrieved < blockHashValidityDuration) { + log("Blockhash is still valid. No need to sync."); + return; + } + log( + "Syncing state for new blockhash ", + "current blockhash: ", + this.latestBlockhash + ); + return fetch(this._blockHashUrl).then(async (resp) => { + const blockHashBody = await resp.json(); + this.latestBlockhash = blockHashBody.blockhash; + this.lastBlockHashRetrieved = Date.now(); + log("Done syncing state new blockhash: ", this.latestBlockhash); + if (!this.latestBlockhash) { + throw new Error( + `Error getting latest blockhash. Received: "${this.latestBlockhash}"` + ); + } + }).catch(async (err) => { + logError( + "Error while attempting to fetch new latestBlockhash:", + err instanceof Error ? err.message : err.messages, + "Reason: ", + err instanceof Error ? err : err.reason + ); + log( + "Attempting to fetch blockhash manually using ethers with fallback RPC URLs..." + ); + const provider = await this._getProviderWithFallback(); + if (!provider) { + logError( + "All fallback RPC URLs failed. Unable to retrieve blockhash." + ); + return; + } + try { + const latestBlock = await provider.getBlock("latest"); + this.latestBlockhash = latestBlock.hash; + this.lastBlockHashRetrieved = Date.now(); + log( + "Successfully retrieved blockhash manually: ", + this.latestBlockhash + ); + } catch (ethersError) { + logError("Failed to manually retrieve blockhash using ethers"); + } + }); + } + /** Currently, we perform a full sync every 30s, including handshaking with every node + * However, we also have a state change listener that watches for staking contract state change events, which + * _should_ be the only time that we need to perform handshakes with every node. + * + * However, the current block hash does need to be updated regularly, and we currently update it only when we + * handshake with every node. + * + * We can remove this network sync code entirely if we refactor our code to fetch latest blockhash on-demand. + * @private + */ + // private _scheduleNetworkSync() { + // if (this._networkSyncInterval) { + // clearInterval(this._networkSyncInterval); + // } + // this._networkSyncInterval = setInterval(async () => { + // if ( + // !this.lastBlockHashRetrieved || + // Date.now() - this.lastBlockHashRetrieved >= BLOCKHASH_SYNC_INTERVAL + // ) { + // await this._syncBlockhash(); + // } + // }, BLOCKHASH_SYNC_INTERVAL); + // } + /** + * + * Get a new random request ID + * + * @returns { string } + * + */ + _getNewRequestId() { + return Math.random().toString(16).slice(2); + } + /** + * + * Get a random hex string for use as an attestation challenge + * + * @returns { string } + */ + getRandomHexString(size) { + return [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join(""); + } + /** + * Handshake with Node + * + * @param { HandshakeWithNode } params + * @param { string } requestId + * @returns { Promise } + * + */ + handshakeWithNode = async (params, requestId) => { + const { url } = params; + const urlWithPath = composeLitUrl({ + url, + endpoint: LIT_ENDPOINT.HANDSHAKE + }); + log(`handshakeWithNode ${urlWithPath}`); + const data = { + clientPublicKey: "test", + challenge: params.challenge + }; + return await this.sendCommandToNode({ + url: urlWithPath, + data, + requestId + }); + }; + async _fetchCurrentEpochState(epochInfo) { + if (!this._stakingContract) { + throw new InitError( + {}, + "Unable to fetch current epoch number; no staking contract configured. Did you forget to `connect()`?" + ); + } + if (!epochInfo) { + log( + "epochinfo not found. Not a problem, fetching current epoch state from staking contract" + ); + try { + const validatorData = await this._getValidatorData(); + epochInfo = validatorData.epochInfo; + } catch (error) { + throw new UnknownError( + {}, + "[_fetchCurrentEpochNumber] Error getting current epoch number: %s", + error + ); + } + } + const startTime = epochInfo.endTime - epochInfo.epochLength; + return { + currentNumber: epochInfo.number, + startTime + }; + } + get currentEpochNumber() { + if (this._epochCache.currentNumber && this._epochCache.startTime && Math.floor(Date.now() / 1e3) < this._epochCache.startTime + Math.floor(EPOCH_PROPAGATION_DELAY / 1e3) && this._epochCache.currentNumber >= 3) { + return this._epochCache.currentNumber - 1; + } + return this._epochCache.currentNumber; + } + set _epochState({ + currentNumber, + startTime + }) { + this._epochCache.currentNumber = currentNumber; + this._epochCache.startTime = startTime; + } + // ==================== SENDING COMMAND ==================== + /** + * + * Send a command to nodes + * + * @param { SendNodeCommand } + * + * @returns { Promise } + * + */ + sendCommandToNode = async ({ + url, + data, + requestId + }) => { + data = { ...data, epoch: this.currentEpochNumber }; + if (data.sessionSigs) { + delete data.sessionSigs; + } + logWithRequestId( + requestId, + `sendCommandToNode with url ${url} and data`, + data + ); + const req = { + method: "POST", + headers: { + "Content-Type": "application/json", + Accept: "application/json", + "X-Lit-SDK-Version": version, + "X-Lit-SDK-Type": "Typescript", + "X-Request-Id": "lit_" + requestId + }, + body: JSON.stringify(data) + }; + return sendRequest(url, req, requestId); + }; + /** + * + * Get and gather node promises + * + * @param { any } callback + * + * @returns { Array> } + * + */ + getNodePromises = (callback) => { + const nodePromises = []; + for (const url of this.connectedNodes) { + nodePromises.push(callback(url)); + } + return nodePromises; + }; + getRandomNodePromise(callback) { + const randomNodeIndex = Math.floor( + Math.random() * this.connectedNodes.size + ); + const nodeUrlsArr = Array.from(this.connectedNodes); + return [callback(nodeUrlsArr[randomNodeIndex])]; + } + /** + * Retrieves the session signature for a given URL from the sessionSigs map. + * Throws an error if sessionSigs is not provided or if the session signature for the URL is not found. + * + * @param sessionSigs - The session signatures map. + * @param url - The URL for which to retrieve the session signature. + * @returns The session signature for the given URL. + * @throws An error if sessionSigs is not provided or if the session signature for the URL is not found. + */ + getSessionSigByUrl = ({ + sessionSigs, + url + }) => { + if (!sessionSigs) { + throw new InvalidArgumentException( + {}, + "You must pass in sessionSigs. Received: %s", + sessionSigs + ); + } + const sigToPassToNode = sessionSigs[url]; + if (!sessionSigs[url]) { + throw new InvalidArgumentException( + {}, + "You passed sessionSigs but we could not find session sig for node %s", + url + ); + } + return sigToPassToNode; + }; + validateAccessControlConditionsSchema = async (params) => { + const { + accessControlConditions, + evmContractConditions, + solRpcConditions, + unifiedAccessControlConditions + } = params; + if (accessControlConditions) { + await validateAccessControlConditionsSchema(accessControlConditions); + } else if (evmContractConditions) { + await validateEVMContractConditionsSchema(evmContractConditions); + } else if (solRpcConditions) { + await validateSolRpcConditionsSchema(solRpcConditions); + } else if (unifiedAccessControlConditions) { + await validateUnifiedAccessControlConditionsSchema( + unifiedAccessControlConditions + ); + } + return true; + }; + /** + * + * Get hash of access control conditions + * + * @param { MultipleAccessControlConditions } params + * + * @returns { Promise } + * + */ + getHashedAccessControlConditions = async (params) => { + let hashOfConditions; + const { + accessControlConditions, + evmContractConditions, + solRpcConditions, + unifiedAccessControlConditions + } = params; + if (accessControlConditions) { + hashOfConditions = await hashAccessControlConditions( + accessControlConditions + ); + } else if (evmContractConditions) { + hashOfConditions = await hashEVMContractConditions(evmContractConditions); + } else if (solRpcConditions) { + hashOfConditions = await hashSolRpcConditions(solRpcConditions); + } else if (unifiedAccessControlConditions) { + hashOfConditions = await hashUnifiedAccessControlConditions( + unifiedAccessControlConditions + ); + } else { + return; + } + return hashOfConditions; + }; + /** + * Handle node promises + * + * @param { Array> } nodePromises + * + * @param { string } requestId requestId to be logged in case of error + * @param { number } minNodeCount number of nodes we need valid results from in order to resolve + * @returns { Promise | RejectedNodePromises> } + */ + handleNodePromises = async (nodePromises, requestId, minNodeCount) => { + async function waitForNSuccessesWithErrors(promises, n2) { + let responses = 0; + const successes2 = []; + const errors2 = []; + return new Promise((resolve) => { + promises.forEach((promise) => { + promise.then((result) => { + successes2.push(result); + if (successes2.length >= n2) { + resolve({ successes: successes2, errors: errors2 }); + } + }).catch((error) => { + errors2.push(error); + }).finally(() => { + responses++; + if (responses === promises.length) { + resolve({ successes: successes2, errors: errors2 }); + } + }); + }); + }); + } + const { successes, errors } = await waitForNSuccessesWithErrors( + nodePromises, + minNodeCount + ); + if (successes.length >= minNodeCount) { + return { + success: true, + values: successes + }; + } + const mostCommonError = JSON.parse( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + mostCommonString(errors.map((r3) => JSON.stringify(r3))) + ); + logErrorWithRequestId( + requestId || "", + `most common error: ${JSON.stringify(mostCommonError)}` + ); + return { + success: false, + error: mostCommonError + }; + }; + /** + * Throw node error + * + * @param { RejectedNodePromises } res + * @param { string } requestId + * + * @returns { never } + * + */ + _throwNodeError = (res, requestId) => { + if (res.error) { + if ((res.error.errorCode && res.error.errorCode === LIT_ERROR_CODE.NODE_NOT_AUTHORIZED || res.error.errorCode === "not_authorized") && this.config.alertWhenUnauthorized) { + log("You are not authorized to access this content"); + } + throw new NodeError( + { + info: { + requestId, + errorCode: res.error.errorCode, + message: res.error.message + }, + cause: res.error + }, + "There was an error getting the signing shares from the nodes. Response from the nodes: %s", + JSON.stringify(res) + ); + } else { + throw new UnknownError( + { + info: { + requestId + } + }, + `There was an error getting the signing shares from the nodes. Response from the nodes: %s`, + JSON.stringify(res) + ); + } + }; + /** + * + * Get different formats of access control conditions, eg. evm, sol, unified etc. + * + * @param { SupportedJsonRequests } params + * + * @returns { FormattedMultipleAccs } + * + */ + getFormattedAccessControlConditions = (params) => { + const { + accessControlConditions, + evmContractConditions, + solRpcConditions, + unifiedAccessControlConditions + } = params; + let formattedAccessControlConditions; + let formattedEVMContractConditions; + let formattedSolRpcConditions; + let formattedUnifiedAccessControlConditions; + let error = false; + if (accessControlConditions) { + formattedAccessControlConditions = accessControlConditions.map( + (c) => canonicalAccessControlConditionFormatter(c) + ); + log( + "formattedAccessControlConditions", + JSON.stringify(formattedAccessControlConditions) + ); + } else if (evmContractConditions) { + formattedEVMContractConditions = evmContractConditions.map( + (c) => canonicalEVMContractConditionFormatter(c) + ); + log( + "formattedEVMContractConditions", + JSON.stringify(formattedEVMContractConditions) + ); + } else if (solRpcConditions) { + formattedSolRpcConditions = solRpcConditions.map( + (c) => canonicalSolRpcConditionFormatter(c) + ); + log( + "formattedSolRpcConditions", + JSON.stringify(formattedSolRpcConditions) + ); + } else if (unifiedAccessControlConditions) { + formattedUnifiedAccessControlConditions = unifiedAccessControlConditions.map( + (c) => canonicalUnifiedAccessControlConditionFormatter(c) + ); + log( + "formattedUnifiedAccessControlConditions", + JSON.stringify(formattedUnifiedAccessControlConditions) + ); + } else { + error = true; + } + return { + error, + formattedAccessControlConditions, + formattedEVMContractConditions, + formattedSolRpcConditions, + formattedUnifiedAccessControlConditions + }; + }; + /** + * Calculates an HD public key from a given keyId + * The curve type or signature type is assumed to be k256 unless provided + * @param keyId + * @param {LIT_CURVE_VALUES} sigType + * @returns {string} public key + */ + computeHDPubKey = async (keyId, sigType = LIT_CURVE.EcdsaCaitSith) => { + if (!this.hdRootPubkeys) { + logError("root public keys not found, have you connected to the nodes?"); + throw new LitNodeClientNotReadyError( + {}, + "root public keys not found, have you connected to the nodes?" + ); + } + return await computeHDPubKey( + this.hdRootPubkeys, + keyId, + sigType + ); + }; + /** + * Calculates a Key Id for claiming a pkp based on a user identifier and an app identifier. + * The key Identifier is an Auth Method Id which scopes the key uniquely to a specific application context. + * These identifiers are specific to each auth method and will derive the public key portion of a pkp which will be persisted + * when a key is claimed. + * | Auth Method | User ID | App ID | + * |:------------|:--------|:-------| + * | Google OAuth | token `sub` | token `aud` | + * | Discord OAuth | user id | client app identifier | + * | Stytch OTP |token `sub` | token `aud`| + * | Lit Actions | user defined | ipfs cid | + * *Note* Lit Action claiming uses a different schema than other auth methods + * + * @param {string} userId user identifier for the Key Identifier + * @param {string} appId app identifier for the Key Identifier + * @param {boolean} isForActionContext should be set for true if using claiming through actions + * + * @returns {string} public key of pkp when claimed + */ + computeHDKeyId(userId, appId, isForActionContext = false) { + if (!isForActionContext) { + return ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${userId}:${appId}`) + ); + } else { + return ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${appId}:${userId}`) + ); + } + } +}; + +// packages/lit-node-client-nodejs/src/lib/helpers/encode-code.ts +init_shim(); +var encodeCode = (code9) => { + const _uint8Array = uint8arrayFromString(code9, "utf8"); + const encodedJs = uint8arrayToString(_uint8Array, "base64"); + return encodedJs; +}; + +// packages/lit-node-client-nodejs/src/lib/helpers/get-bls-signatures.ts +init_shim(); +function getBlsSignatures(responseData) { + if (!responseData) { + throw new Error("[getBlsSignatures] No data provided"); + } + const signatureShares = responseData.map((s2) => ({ + ProofOfPossession: s2.signatureShare.ProofOfPossession + })); + log(`[getBlsSignatures] signatureShares:`, signatureShares); + if (!signatureShares || signatureShares.length <= 0) { + throw new Error("[getBlsSignatures] No signature shares provided"); + } + return signatureShares; +} + +// packages/lit-node-client-nodejs/src/lib/helpers/get-claims.ts +init_shim(); +var getClaims = (claims) => { + const keys = Object.keys(claims[0]); + const signatures = {}; + const claimRes = {}; + for (let i2 = 0; i2 < keys.length; i2++) { + const claimSet = claims.map( + (c) => c[keys[i2]] + ); + signatures[keys[i2]] = []; + claimSet.map((c) => { + const sig = ethers_exports.utils.splitSignature(`0x${c.signature}`); + const convertedSig = { + r: sig.r, + s: sig.s, + v: sig.v + }; + signatures[keys[i2]].push(convertedSig); + }); + claimRes[keys[i2]] = { + signatures: signatures[keys[i2]], + derivedKeyId: claimSet[0].derivedKeyId + }; + } + return claimRes; +}; + +// packages/lit-node-client-nodejs/src/lib/helpers/get-claims-list.ts +init_shim(); +var getClaimsList = (responseData) => { + const claimsList = responseData.map((r3) => { + const { claimData } = r3; + if (claimData) { + for (const key2 of Object.keys(claimData)) { + for (const subkey of Object.keys(claimData[key2])) { + if (typeof claimData[key2][subkey] == "string") { + claimData[key2][subkey] = claimData[key2][subkey].replaceAll( + '"', + "" + ); + } + } + } + return claimData; + } + return null; + }).filter((item) => item !== null); + return claimsList; +}; + +// packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts +init_shim(); +var import_utils13 = __toESM(require_utils2()); +var getFlattenShare = (share) => { + const flattenObj = Object.values(share).map((item) => { + if (item === null || item === void 0) { + return null; + } + const typedItem = item; + const requiredShareProps = [ + "sigType", + "dataSigned", + "signatureShare", + "shareIndex", + "bigR", + "publicKey" + ]; + const requiredSessionSigsShareProps = [ + ...requiredShareProps, + "siweMessage" + ]; + const requiredSignatureShareProps = [ + ...requiredShareProps, + "sigName" + ]; + const hasProps = (props) => { + return props.every( + (prop) => typedItem[prop] !== void 0 && typedItem[prop] !== null + ); + }; + if (hasProps(requiredSessionSigsShareProps) || hasProps(requiredSignatureShareProps)) { + const bigR = typedItem.bigR ?? typedItem.bigr; + typedItem.signatureShare = (typedItem.signatureShare ?? "").replaceAll( + '"', + "" + ); + typedItem.bigR = (bigR ?? "").replaceAll('"', ""); + typedItem.publicKey = (typedItem.publicKey ?? "").replaceAll('"', ""); + typedItem.dataSigned = (typedItem.dataSigned ?? "").replaceAll('"', ""); + return typedItem; + } + return null; + }); + const flattenShare = flattenObj.filter( + (item) => item !== null + )[0]; + if (flattenShare === null || flattenShare === void 0) { + return share; + } + return flattenShare; +}; +var getSignatures = async (params) => { + const { networkPubKeySet, minNodeCount, signedData, requestId } = params; + const initialKeys = [...new Set(signedData.flatMap((i2) => Object.keys(i2)))]; + for (const signatureResponse of signedData) { + for (const sigName of Object.keys(signatureResponse)) { + const requiredFields = ["signatureShare"]; + for (const field of requiredFields) { + if (!signatureResponse[sigName][field]) { + logWithRequestId( + requestId, + `invalid field ${field} in signature share: ${sigName}, continuing with share processing` + ); + delete signatureResponse[sigName]; + } else { + let share = getFlattenShare(signatureResponse[sigName]); + share = { + sigType: share.sigType, + signatureShare: share.signatureShare, + shareIndex: share.shareIndex, + bigR: share.bigR, + publicKey: share.publicKey, + dataSigned: share.dataSigned, + sigName: share.sigName ? share.sigName : "sig" + }; + signatureResponse[sigName] = share; + } + } + } + } + const validatedSignedData = signedData; + const signatures = {}; + const allKeys = [ + ...new Set(validatedSignedData.flatMap((i2) => Object.keys(i2))) + ]; + if (allKeys.length !== initialKeys.length) { + throw new NoValidShares( + {}, + "total number of valid signatures does not match requested" + ); + } + for (const key2 of allKeys) { + const shares = validatedSignedData.map((r3) => r3[key2]).filter((r3) => r3 !== void 0); + shares.sort((a2, b) => a2.shareIndex - b.shareIndex); + const sigName = shares[0].sigName; + logWithRequestId( + requestId, + `starting signature combine for sig name: ${sigName}`, + shares + ); + logWithRequestId( + requestId, + `number of shares for ${sigName}:`, + signedData.length + ); + logWithRequestId( + requestId, + `validated length for signature: ${sigName}`, + shares.length + ); + logWithRequestId( + requestId, + "minimum required shares for threshold:", + minNodeCount + ); + if (shares.length < minNodeCount) { + logErrorWithRequestId( + requestId, + `not enough nodes to get the signatures. Expected ${minNodeCount}, got ${shares.length}` + ); + throw new NoValidShares( + { + info: { + requestId, + shares: shares.length, + minNodeCount + } + }, + "The total number of valid signatures shares %s does not meet the threshold of %s", + shares.length, + minNodeCount + ); + } + const sigType = mostCommonString(shares.map((s2) => s2.sigType)); + if (networkPubKeySet === null) { + throw new ParamNullError( + { + info: { + requestId + } + }, + "networkPubKeySet cannot be null" + ); + } + if (sigType !== LIT_CURVE.EcdsaCaitSith && sigType !== LIT_CURVE.EcdsaK256 && sigType !== LIT_CURVE.EcdsaCAITSITHP256) { + throw new UnknownSignatureType( + { + info: { + requestId, + signatureType: sigType + } + }, + "signature type is %s which is invalid", + sigType + ); + } + const signature2 = await combineEcdsaShares(shares); + if (!signature2.r) { + throw new UnknownSignatureError( + { + info: { + requestId, + signature: signature2 + } + }, + "signature could not be combined" + ); + } + const encodedSig = (0, import_utils13.joinSignature)({ + r: "0x" + signature2.r, + s: "0x" + signature2.s, + v: signature2.recid + }); + signatures[key2] = { + ...signature2, + signature: encodedSig, + publicKey: mostCommonString(shares.map((s2) => s2.publicKey)), + dataSigned: mostCommonString(shares.map((s2) => s2.dataSigned)) + }; + } + return signatures; +}; + +// packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts +init_shim(); +var normalizeArray = (toSign) => { + const arr = []; + const uint8Array = new Uint8Array(toSign); + for (let i2 = 0; i2 < uint8Array.length; i2++) { + arr.push(uint8Array[i2]); + } + return arr; +}; + +// packages/lit-node-client-nodejs/src/lib/helpers/normalize-params.ts +init_shim(); +var normalizeJsParams = (jsParams) => { + for (const key2 of Object.keys(jsParams)) { + const value = jsParams[key2]; + if (ArrayBuffer.isView(value)) { + jsParams[key2] = Array.from( + new Uint8Array(value.buffer, value.byteOffset, value.byteLength) + ); + } else if (value instanceof ArrayBuffer) { + jsParams[key2] = Array.from(new Uint8Array(value)); + } + } + return jsParams; +}; + +// packages/lit-node-client-nodejs/src/lib/helpers/parse-as-json-or-string.ts +init_shim(); +var parseAsJsonOrString = (responseString) => { + try { + return JSON.parse(responseString); + } catch (e2) { + log( + "[parseResponses] Error parsing response as json. Swallowing and returning as string.", + responseString + ); + return responseString; + } +}; + +// packages/lit-node-client-nodejs/src/lib/helpers/parse-pkp-sign-response.ts +init_shim(); +var snakeToCamel = (s2) => s2.replace(/(_\w)/g, (m) => m[1].toUpperCase()); +var convertKeysToCamelCase = (obj) => Object.keys(obj).reduce( + (acc, key2) => ({ + ...acc, + [snakeToCamel(key2)]: obj[key2] + }), + {} +); +var cleanStringValues = (obj) => Object.keys(obj).reduce( + (acc, key2) => ({ + ...acc, + [key2]: typeof obj[key2] === "string" ? obj[key2].replace(/"/g, "") : obj[key2] + }), + {} +); +var parsePkpSignResponse = (responseData) => responseData.map(({ signatureShare }) => { + delete signatureShare.result; + const camelCaseShare = convertKeysToCamelCase(signatureShare); + const cleanedShare = cleanStringValues(camelCaseShare); + if (cleanedShare.digest) { + cleanedShare.dataSigned = cleanedShare.digest; + } + return { signature: cleanedShare }; +}); + +// packages/lit-node-client-nodejs/src/lib/helpers/process-lit-action-response-strategy.ts +init_shim(); +var _findFrequency = (responses) => { + const sorted = responses.sort( + (a2, b) => responses.filter((v) => v === a2).length - responses.filter((v) => v === b).length + ); + return { min: sorted[0], max: sorted[sorted?.length - 1] }; +}; +var processLitActionResponseStrategy = (responses, strategy) => { + const executionResponses = responses.map((nodeResp) => { + return nodeResp.response; + }); + const copiedExecutionResponses = executionResponses.map((r3) => { + return "" + r3; + }); + if (strategy.strategy === "custom") { + try { + if (strategy.customFilter) { + const customResponseFilterResult = strategy?.customFilter(executionResponses); + return customResponseFilterResult; + } else { + logError( + "Custom filter specified for response strategy but none found. using most common" + ); + } + } catch (e2) { + logError( + "Error while executing custom response filter, defaulting to most common", + e2.toString() + ); + } + } + let respFrequency = _findFrequency(copiedExecutionResponses); + if (strategy?.strategy === "leastCommon") { + log( + "strategy found to be most common, taking most common response from execution results" + ); + return respFrequency.min; + } else if (strategy?.strategy === "mostCommon") { + log( + "strategy found to be most common, taking most common response from execution results" + ); + return respFrequency.max; + } else { + log( + "no strategy found, using least common response object from execution results" + ); + respFrequency.min; + } +}; + +// packages/lit-node-client-nodejs/src/lib/helpers/remove-double-quotes.ts +init_shim(); +var removeDoubleQuotes = (obj) => { + for (const key2 of Object.keys(obj)) { + const value = obj[key2]; + for (const subkey of Object.keys(value)) { + if (typeof value[subkey] === "string") { + value[subkey] = value[subkey].replaceAll('"', ""); + } + } + } + return obj; +}; + +// packages/lit-node-client-nodejs/src/lib/helpers/validate-bls-session-sig.ts +init_shim(); +import { SiweError, SiweErrorType } from "siwe"; +var LIT_SESSION_SIGNED_MESSAGE_PREFIX = "lit_session:"; +var blsSessionSigVerify = async (verifier, networkPubKey, authSig, authSigSiweMessage) => { + let sigJson = JSON.parse(authSig.sig); + const eip191Hash = ethers_exports.utils.hashMessage(authSig.signedMessage); + const prefixedStr = LIT_SESSION_SIGNED_MESSAGE_PREFIX + eip191Hash.replace("0x", ""); + const prefixedEncoded = ethers_exports.utils.toUtf8Bytes(prefixedStr); + const shaHashed = ethers_exports.utils.sha256(prefixedEncoded).replace("0x", ""); + const signatureBytes = Buffer.from(sigJson.ProofOfPossession, `hex`); + const checkTime = /* @__PURE__ */ new Date(); + if (!authSigSiweMessage.expirationTime || !authSigSiweMessage.issuedAt) { + throw new Error( + "Invalid SIWE message. Missing expirationTime or issuedAt." + ); + } + const expirationDate = new Date(authSigSiweMessage.expirationTime); + if (checkTime.getTime() >= expirationDate.getTime()) { + throw new SiweError( + SiweErrorType.EXPIRED_MESSAGE, + `${checkTime.toISOString()} < ${expirationDate.toISOString()}`, + `${checkTime.toISOString()} >= ${expirationDate.toISOString()}` + ); + } + const issuedAt = new Date(authSigSiweMessage.issuedAt); + if (checkTime.getTime() < issuedAt.getTime()) { + throw new SiweError( + SiweErrorType.NOT_YET_VALID_MESSAGE, + `${checkTime.toISOString()} >= ${issuedAt.toISOString()}`, + `${checkTime.toISOString()} < ${issuedAt.toISOString()}` + ); + } + await verifier(networkPubKey, Buffer.from(shaHashed, "hex"), signatureBytes); +}; + +// packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +var _LitNodeClientNodeJs = class extends LitCore { + defaultAuthCallback; + // ========== Constructor ========== + constructor(args) { + if (!args) { + throw new ParamsMissingError({}, "must provide LitNodeClient parameters"); + } + super(args); + if (args !== void 0 && args !== null && "defaultAuthCallback" in args) { + this.defaultAuthCallback = args.defaultAuthCallback; + } + } + // ========== Rate Limit NFT ========== + // TODO: Add support for browser feature/lit-2321-js-sdk-add-browser-support-for-createCapacityDelegationAuthSig + createCapacityDelegationAuthSig = async (params) => { + if (!params.dAppOwnerWallet) { + throw new InvalidParamType( + { + info: { + params + } + }, + "dAppOwnerWallet must exist" + ); + } + if (!params.delegateeAddresses || params.delegateeAddresses.length === 0) { + log( + `[createCapacityDelegationAuthSig] 'delegateeAddresses' is an empty array. It means that no body can use it. However, if the 'delegateeAddresses' field is omitted, It means that the capability will not restrict access based on delegatee list, but it may still enforce other restrictions such as usage limits (uses) and specific NFT IDs (nft_id).` + ); + } + const dAppOwnerWalletAddress = ethers_exports.utils.getAddress( + await params.dAppOwnerWallet.getAddress() + ); + if (!this.ready) { + await this.connect(); + } + const siweMessage = await createSiweMessageWithCapacityDelegation({ + uri: "lit:capability:delegation", + litNodeClient: this, + walletAddress: dAppOwnerWalletAddress, + nonce: await this.getLatestBlockhash(), + expiration: params.expiration, + domain: params.domain, + statement: params.statement, + // -- capacity delegation specific configuration + uses: params.uses, + delegateeAddresses: params.delegateeAddresses, + capacityTokenId: params.capacityTokenId + }); + const authSig = await generateAuthSig({ + signer: params.dAppOwnerWallet, + toSign: siweMessage + }); + return { capacityDelegationAuthSig: authSig }; + }; + // ========== Scoped Class Helpers ========== + /** + * + * we need to send jwt params iat (issued at) and exp (expiration) because the nodes may have different wall clock times, the nodes will verify that these params are withing a grace period + * + */ + getJWTParams = () => { + const now2 = Date.now(); + const iat = Math.floor(now2 / 1e3); + const exp = iat + 12 * 60 * 60; + return { iat, exp }; + }; + // ==================== SESSIONS ==================== + /** + * Try to get the session key in the local storage, + * if not, generates one. + * @return { SessionKeyPair } session key pair + */ + getSessionKey = () => { + const storageKey = LOCAL_STORAGE_KEYS.SESSION_KEY; + const storedSessionKeyOrError = getStorageItem(storageKey); + if (storedSessionKeyOrError.type === EITHER_TYPE.ERROR || !storedSessionKeyOrError.result || storedSessionKeyOrError.result === "") { + console.warn( + `Storage key "${storageKey}" is missing. Not a problem. Continue...` + ); + const newSessionKey = generateSessionKeyPair(); + try { + localStorage.setItem(storageKey, JSON.stringify(newSessionKey)); + } catch (e2) { + log( + `[getSessionKey] Localstorage not available.Not a problem. Continue...` + ); + } + return newSessionKey; + } else { + return JSON.parse(storedSessionKeyOrError.result); + } + }; + /** + * Check if a given object is of type SessionKeyPair. + * + * @param obj - The object to check. + * @returns True if the object is of type SessionKeyPair. + */ + isSessionKeyPair(obj) { + return typeof obj === "object" && "publicKey" in obj && "secretKey" in obj && typeof obj.publicKey === "string" && typeof obj.secretKey === "string"; + } + /** + * Generates wildcard capability for each of the LIT resources + * specified. + * @param litResources is an array of LIT resources + * @param addAllCapabilities is a boolean that specifies whether to add all capabilities for each resource + */ + static async generateSessionCapabilityObjectWithWildcards(litResources, addAllCapabilities) { + const sessionCapabilityObject = new RecapSessionCapabilityObject({}, []); + const _addAllCapabilities = addAllCapabilities ?? false; + if (_addAllCapabilities) { + for (const litResource of litResources) { + sessionCapabilityObject.addAllCapabilitiesForResource(litResource); + } + } + return sessionCapabilityObject; + } + // backward compatibility + async generateSessionCapabilityObjectWithWildcards(litResources) { + return await _LitNodeClientNodeJs.generateSessionCapabilityObjectWithWildcards( + litResources + ); + } + // backward compatibility + getExpiration = () => { + return _LitNodeClientNodeJs.getExpiration(); + }; + /** + * + * Get the signature from local storage, if not, generates one + * + */ + getWalletSig = async ({ + authNeededCallback, + chain, + sessionCapabilityObject, + switchChain, + expiration, + sessionKeyUri, + nonce, + resourceAbilityRequests, + litActionCode, + litActionIpfsId, + jsParams, + sessionKey + }) => { + let walletSig; + const storageKey = LOCAL_STORAGE_KEYS.WALLET_SIGNATURE; + const storedWalletSigOrError = getStorageItem(storageKey); + log(`getWalletSig - flow starts + storageKey: ${storageKey} + storedWalletSigOrError: ${JSON.stringify(storedWalletSigOrError)} + `); + if (storedWalletSigOrError.type === EITHER_TYPE.ERROR || !storedWalletSigOrError.result || storedWalletSigOrError.result == "") { + log("getWalletSig - flow 1"); + console.warn( + `Storage key "${storageKey}" is missing. Not a problem. Continue...` + ); + if (authNeededCallback) { + log("getWalletSig - flow 1.1"); + const body = { + chain, + statement: sessionCapabilityObject?.statement, + resources: sessionCapabilityObject ? [sessionCapabilityObject.encodeAsSiweResource()] : void 0, + ...switchChain && { switchChain }, + expiration, + uri: sessionKeyUri, + sessionKey, + nonce, + // for recap + ...resourceAbilityRequests && { resourceAbilityRequests }, + // for lit action custom auth + ...litActionCode && { litActionCode }, + ...litActionIpfsId && { litActionIpfsId }, + ...jsParams && { jsParams } + }; + log("callback body:", body); + walletSig = await authNeededCallback(body); + } else { + log("getWalletSig - flow 1.2"); + if (!this.defaultAuthCallback) { + log("getWalletSig - flow 1.2.1"); + throw new ParamsMissingError( + {}, + "No authNeededCallback nor default auth callback provided" + ); + } + log("getWalletSig - flow 1.2.2"); + walletSig = await this.defaultAuthCallback({ + chain, + statement: sessionCapabilityObject.statement, + resources: sessionCapabilityObject ? [sessionCapabilityObject.encodeAsSiweResource()] : void 0, + switchChain, + expiration, + uri: sessionKeyUri, + nonce + }); + } + log("getWalletSig - flow 1.3"); + const storeNewWalletSigOrError = setStorageItem( + storageKey, + JSON.stringify(walletSig) + ); + if (storeNewWalletSigOrError.type === "ERROR") { + log("getWalletSig - flow 1.4"); + console.warn( + `Unable to store walletSig in local storage. Not a problem. Continue...` + ); + } + } else { + log("getWalletSig - flow 2"); + try { + walletSig = JSON.parse(storedWalletSigOrError.result); + log("getWalletSig - flow 2.1"); + } catch (e2) { + console.warn("Error parsing walletSig", e2); + log("getWalletSig - flow 2.2"); + } + } + log("getWalletSig - flow 3"); + return walletSig; + }; + _authCallbackAndUpdateStorageItem = async ({ + authCallbackParams, + authCallback + }) => { + let authSig; + if (authCallback) { + authSig = await authCallback(authCallbackParams); + } else { + if (!this.defaultAuthCallback) { + throw new ParamsMissingError( + {}, + "No authCallback nor default auth callback provided" + ); + } + authSig = await this.defaultAuthCallback(authCallbackParams); + } + const storeNewWalletSigOrError = setStorageItem( + LOCAL_STORAGE_KEYS.WALLET_SIGNATURE, + JSON.stringify(authSig) + ); + if (storeNewWalletSigOrError.type === EITHER_TYPE.SUCCESS) { + return authSig; + } + console.warn( + `Unable to store walletSig in local storage. Not a problem. Continuing to remove item key...` + ); + const removeWalletSigOrError = removeStorageItem( + LOCAL_STORAGE_KEYS.WALLET_SIGNATURE + ); + if (removeWalletSigOrError.type === EITHER_TYPE.ERROR) { + console.warn( + `Unable to remove walletSig in local storage. Not a problem. Continuing...` + ); + } + return authSig; + }; + /** + * + * Check if a session key needs to be resigned. These are the scenarios where a session key needs to be resigned: + * 1. The authSig.sig does not verify successfully against the authSig.signedMessage + * 2. The authSig.signedMessage.uri does not match the sessionKeyUri + * 3. The authSig.signedMessage does not contain at least one session capability object + * + */ + checkNeedToResignSessionKey = async ({ + authSig, + sessionKeyUri, + resourceAbilityRequests + }) => { + const authSigSiweMessage = new SiweMessage4(authSig.signedMessage); + if (authSig.algo === `ed25519` || authSig.algo === void 0) { + try { + await authSigSiweMessage.verify( + { signature: authSig.sig }, + { suppressExceptions: false } + ); + } catch (e2) { + log(`Error while verifying BLS signature: `, e2); + return true; + } + } else if (authSig.algo === `LIT_BLS`) { + try { + await blsSessionSigVerify( + verifySignature, + this.networkPubKey, + authSig, + authSigSiweMessage + ); + } catch (e2) { + log(`Error while verifying bls signature: `, e2); + return true; + } + } else { + throw new InvalidSignatureError( + { + info: { + authSig, + resourceAbilityRequests, + sessionKeyUri + } + }, + "Unsupported signature algo for session signature. Expected ed25519 or LIT_BLS received %s", + authSig.algo + ); + } + if (authSigSiweMessage.uri !== sessionKeyUri) { + log("Need retry because uri does not match"); + return true; + } + if (!authSigSiweMessage.resources || authSigSiweMessage.resources.length === 0) { + log("Need retry because empty resources"); + return true; + } + const authSigSessionCapabilityObject = decode3( + authSigSiweMessage.resources[0] + ); + for (const resourceAbilityRequest of resourceAbilityRequests) { + if (!authSigSessionCapabilityObject.verifyCapabilitiesForResource( + resourceAbilityRequest.resource, + resourceAbilityRequest.ability + )) { + log("Need retry because capabilities do not match", { + authSigSessionCapabilityObject, + resourceAbilityRequest + }); + return true; + } + } + return false; + }; + // ==================== API Calls to Nodes ==================== + /** + * + * Combine Shares from network public key set and signature shares + * + * @param { NodeBlsSigningShare } signatureShares + * + * @returns { string } final JWT (convert the sig to base64 and append to the jwt) + * + */ + combineSharesAndGetJWT = async (signatureShares, requestId = "") => { + if (!signatureShares.every( + (val, i2, arr) => val.unsignedJwt === arr[0].unsignedJwt + )) { + const msg = "Unsigned JWT is not the same from all the nodes. This means the combined signature will be bad because the nodes signed the wrong things"; + logErrorWithRequestId(requestId, msg); + } + signatureShares.sort((a2, b) => a2.shareIndex - b.shareIndex); + const signature2 = await combineSignatureShares( + signatureShares.map((s2) => s2.signatureShare) + ); + logWithRequestId(requestId, "signature is", signature2); + const unsignedJwt = mostCommonString( + signatureShares.map((s2) => s2.unsignedJwt) + ); + const finalJwt = `${unsignedJwt}.${uint8arrayToString( + uint8arrayFromString(signature2, "base16"), + "base64urlpad" + )}`; + return finalJwt; + }; + _decryptWithSignatureShares = (networkPubKey, identityParam, ciphertext, signatureShares) => { + const sigShares = signatureShares.map((s2) => s2.signatureShare); + return verifyAndDecryptWithSignatureShares( + networkPubKey, + identityParam, + ciphertext, + sigShares + ); + }; + // ========== Promise Handlers ========== + getIpfsId = async ({ + dataToHash, + sessionSigs + }) => { + const res = await this.executeJs({ + ipfsId: LIT_ACTION_IPFS_HASH, + sessionSigs, + jsParams: { + dataToHash + } + }).catch((e2) => { + logError("Error getting IPFS ID", e2); + throw e2; + }); + let data; + if (typeof res.response === "string") { + try { + data = JSON.parse(res.response).res; + } catch (e2) { + data = res.response; + } + } + if (!data.success) { + logError("Error getting IPFS ID", data.data); + } + return data.data; + }; + /** + * Run lit action on a single deterministicly selected node. It's important that the nodes use the same deterministic selection algorithm. + * + * Lit Action: dataToHash -> IPFS CID + * QmUjX8MW6StQ7NKNdaS6g4RMkvN5hcgtKmEi8Mca6oX4t3 + * + * @param { ExecuteJsProps } params + * + * @returns { Promise | RejectedNodePromises> } + * + */ + runOnTargetedNodes = async (params) => { + log("running runOnTargetedNodes:", params.targetNodeRange); + if (!params.targetNodeRange) { + throw new InvalidParamType( + { + info: { + params + } + }, + "targetNodeRange is required" + ); + } + const ipfsId = await this.getIpfsId({ + dataToHash: params.code, + sessionSigs: params.sessionSigs + }); + const randomSelectedNodeIndexes = []; + let nodeCounter = 0; + while (randomSelectedNodeIndexes.length < params.targetNodeRange) { + const str = `${nodeCounter}:${ipfsId.toString()}`; + const cidBuffer = Buffer.from(str); + const hash3 = (0, import_utils14.sha256)(cidBuffer); + const hashAsNumber = BigNumber.from(hash3); + const nodeIndex = hashAsNumber.mod(this.config.bootstrapUrls.length).toNumber(); + log("nodeIndex:", nodeIndex); + if (!randomSelectedNodeIndexes.includes(nodeIndex) && nodeIndex < this.config.bootstrapUrls.length) { + randomSelectedNodeIndexes.push(nodeIndex); + } + nodeCounter++; + } + log("Final Selected Indexes:", randomSelectedNodeIndexes); + const requestId = this._getNewRequestId(); + const nodePromises = []; + for (let i2 = 0; i2 < randomSelectedNodeIndexes.length; i2++) { + const nodeIndex = randomSelectedNodeIndexes[i2]; + const url = this.config.bootstrapUrls[nodeIndex]; + log(`running on node ${nodeIndex} at ${url}`); + const sessionSig = this.getSessionSigByUrl({ + sessionSigs: params.sessionSigs, + url + }); + const reqBody = { + ...params, + targetNodeRange: params.targetNodeRange, + authSig: sessionSig + }; + const singleNodePromise = this.sendCommandToNode({ + url, + data: params, + requestId + }); + nodePromises.push(singleNodePromise); + } + return await this.handleNodePromises( + nodePromises, + requestId, + params.targetNodeRange + ); + }; + // ========== Scoped Business Logics ========== + /** + * Retrieves the fallback IPFS code for a given IPFS ID. + * + * @param gatewayUrl - the gateway url. + * @param ipfsId - The IPFS ID. + * @returns The base64-encoded fallback IPFS code. + * @throws An error if the code retrieval fails. + */ + async _getFallbackIpfsCode(gatewayUrl, ipfsId) { + const allGateways = gatewayUrl ? [gatewayUrl, ...FALLBACK_IPFS_GATEWAYS] : FALLBACK_IPFS_GATEWAYS; + log( + `Attempting to fetch code for IPFS ID: ${ipfsId} using fallback IPFS gateways` + ); + for (const url of allGateways) { + try { + const response = await fetch(`${url}${ipfsId}`); + if (!response.ok) { + throw new Error( + `Failed to fetch code from IPFS gateway ${url}: ${response.status} ${response.statusText}` + ); + } + const code9 = await response.text(); + const codeBase64 = Buffer.from(code9).toString("base64"); + return codeBase64; + } catch (error) { + console.error(`Error fetching code from IPFS gateway ${url}`); + } + } + throw new Error("All IPFS gateways failed to fetch the code."); + } + async executeJsNodeRequest(url, formattedParams, requestId) { + const sessionSig = this.getSessionSigByUrl({ + sessionSigs: formattedParams.sessionSigs, + url + }); + const reqBody = { + ...formattedParams, + authSig: sessionSig + }; + const urlWithPath = composeLitUrl({ + url, + endpoint: LIT_ENDPOINT.EXECUTE_JS + }); + return this.generatePromise(urlWithPath, reqBody, requestId); + } + /** + * + * Execute JS on the nodes and combine and return any resulting signatures + * + * @param { JsonExecutionSdkParams } params + * + * @returns { ExecuteJsResponse } + * + */ + executeJs = async (params) => { + if (!this.ready) { + const message = "[executeJs] LitNodeClient is not ready. Please call await litNodeClient.connect() first."; + throw new LitNodeClientNotReadyError({}, message); + } + const paramsIsSafe = safeParams({ + functionName: "executeJs", + params + }); + if (!paramsIsSafe) { + throw new InvalidParamType( + { + info: { + params + } + }, + "executeJs params are not valid" + ); + } + const checkedSessionSigs = validateSessionSigs(params.sessionSigs); + if (checkedSessionSigs.isValid === false) { + throw new InvalidSessionSigs( + {}, + `Invalid sessionSigs. Errors: ${checkedSessionSigs.errors}` + ); + } + let formattedParams = { + ...params, + ...params.jsParams && { jsParams: normalizeJsParams(params.jsParams) }, + ...params.code && { code: encodeCode(params.code) } + }; + const overwriteCode = params.ipfsOptions?.overwriteCode || GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[this.config.litNetwork]; + if (overwriteCode && params.ipfsId) { + const code9 = await this._getFallbackIpfsCode( + params.ipfsOptions?.gatewayUrl, + params.ipfsId + ); + formattedParams = { + ...params, + code: code9, + ipfsId: void 0 + }; + } + const requestId = this._getNewRequestId(); + const getNodePromises = async () => { + if (params.useSingleNode) { + return this.getRandomNodePromise( + (url) => this.executeJsNodeRequest(url, formattedParams, requestId) + ); + } + return this.getNodePromises( + (url) => this.executeJsNodeRequest(url, formattedParams, requestId) + ); + }; + const nodePromises = await getNodePromises(); + const res = await this.handleNodePromises( + nodePromises, + requestId, + params.useSingleNode ? 1 : this.connectedNodes.size + ); + if (!res.success) { + this._throwNodeError(res, requestId); + } + const responseData = res.values; + logWithRequestId( + requestId, + "executeJs responseData from node : ", + JSON.stringify(responseData, null, 2) + ); + const mostCommonResponse = findMostCommonResponse( + responseData + ); + const responseFromStrategy = processLitActionResponseStrategy( + responseData, + params.responseStrategy ?? { strategy: "leastCommon" } + ); + mostCommonResponse.response = responseFromStrategy; + const isSuccess = mostCommonResponse.success; + const hasSignedData = Object.keys(mostCommonResponse.signedData).length > 0; + const hasClaimData = Object.keys(mostCommonResponse.claimData).length > 0; + if (isSuccess && !hasSignedData && !hasClaimData) { + return mostCommonResponse; + } + if (!hasSignedData && !hasClaimData) { + return { + claims: {}, + signatures: null, + decryptions: [], + response: mostCommonResponse.response, + logs: mostCommonResponse.logs + }; + } + const signedDataList = responseData.map((r3) => { + return removeDoubleQuotes(r3.signedData); + }); + logWithRequestId( + requestId, + "signatures shares to combine: ", + signedDataList + ); + const signatures = await getSignatures({ + requestId, + networkPubKeySet: this.networkPubKeySet, + minNodeCount: params.useSingleNode ? 1 : this.config.minNodeCount, + signedData: signedDataList + }); + const parsedResponse = parseAsJsonOrString(mostCommonResponse.response); + const mostCommonLogs = mostCommonString( + responseData.map((r3) => r3.logs) + ); + const claimsList = getClaimsList(responseData); + const claims = claimsList.length > 0 ? getClaims(claimsList) : void 0; + const returnVal = { + claims, + signatures, + // decryptions: [], + response: parsedResponse, + logs: mostCommonLogs + }; + log("returnVal:", returnVal); + return returnVal; + }; + /** + * Generates a promise by sending a command to the Lit node + * + * @param url - The URL to send the command to. + * @param params - The parameters to include in the command. + * @param requestId - The ID of the request. + * @returns A promise that resolves with the response from the server. + */ + generatePromise = async (url, params, requestId) => { + return await this.sendCommandToNode({ + url, + data: params, + requestId + }); + }; + /** + * Use PKP to sign + * + * @param { JsonPkpSignSdkParams } params + * @param params.toSign - The data to sign + * @param params.pubKey - The public key to sign with + * @param params.sessionSigs - The session signatures to use + * @param params.authMethods - (optional) The auth methods to use + */ + pkpSign = async (params) => { + const requiredParamKeys = ["toSign", "pubKey"]; + requiredParamKeys.forEach((key2) => { + if (!params[key2]) { + throw new ParamNullError( + { + info: { + params, + key: key2 + } + }, + `"%s" cannot be undefined, empty, or null. Please provide a valid value.`, + key2 + ); + } + }); + if (!params.sessionSigs && (!params.authMethods || params.authMethods.length <= 0)) { + throw new ParamNullError( + { + info: { + params + } + }, + "Either sessionSigs or authMethods (length > 0) must be present." + ); + } + const requestId = this._getNewRequestId(); + const checkedSessionSigs = validateSessionSigs(params.sessionSigs); + if (checkedSessionSigs.isValid === false) { + throw new InvalidSessionSigs( + {}, + `Invalid sessionSigs. Errors: ${checkedSessionSigs.errors}` + ); + } + const nodePromises = this.getNodePromises((url) => { + const sessionSig = this.getSessionSigByUrl({ + sessionSigs: params.sessionSigs, + url + }); + const reqBody = { + toSign: normalizeArray(params.toSign), + pubkey: hexPrefixed(params.pubKey), + authSig: sessionSig, + // -- optional params + ...params.authMethods && params.authMethods.length > 0 && { + authMethods: params.authMethods + } + }; + logWithRequestId(requestId, "reqBody:", reqBody); + const urlWithPath = composeLitUrl({ + url, + endpoint: LIT_ENDPOINT.PKP_SIGN + }); + return this.generatePromise(urlWithPath, reqBody, requestId); + }); + const res = await this.handleNodePromises( + nodePromises, + requestId, + this.connectedNodes.size + ); + if (!res.success) { + this._throwNodeError(res, requestId); + } + const responseData = res.values; + logWithRequestId( + requestId, + "responseData", + JSON.stringify(responseData, null, 2) + ); + const signedDataList = parsePkpSignResponse(responseData); + const signatures = await getSignatures({ + requestId, + networkPubKeySet: this.networkPubKeySet, + minNodeCount: this.config.minNodeCount, + signedData: signedDataList + }); + logWithRequestId(requestId, `signature combination`, signatures); + return signatures.signature; + }; + /** + * + * Encrypt data using the LIT network public key. + * + * @param { EncryptSdkParams } params + * @param params.dataToEncrypt - The data to encrypt + * @param params.accessControlConditions - (optional) The access control conditions for the data + * @param params.evmContractConditions - (optional) The EVM contract conditions for the data + * @param params.solRpcConditions - (optional) The Solidity RPC conditions for the data + * @param params.unifiedAccessControlConditions - (optional) The unified access control conditions for the data + * + * @return { Promise } The encrypted ciphertext and the hash of the data + * + * @throws { Error } if the LIT node client is not ready + * @throws { Error } if the subnetPubKey is null + */ + encrypt = async (params) => { + if (!this.ready) { + throw new LitNodeClientNotReadyError( + {}, + "6 LitNodeClient is not ready. Please call await litNodeClient.connect() first." + ); + } + if (!this.subnetPubKey) { + throw new LitNodeClientNotReadyError({}, "subnetPubKey cannot be null"); + } + const paramsIsSafe = safeParams({ + functionName: "encrypt", + params + }); + if (!paramsIsSafe) { + throw new InvalidArgumentException( + { + info: { + params + } + }, + "You must provide either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions" + ); + } + await this.validateAccessControlConditionsSchema(params); + const hashOfConditions = await this.getHashedAccessControlConditions(params); + if (!hashOfConditions) { + throw new InvalidArgumentException( + { + info: { + params + } + }, + "You must provide either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions" + ); + } + const hashOfConditionsStr = uint8arrayToString( + new Uint8Array(hashOfConditions), + "base16" + ); + const hashOfPrivateData = await crypto.subtle.digest( + "SHA-256", + params.dataToEncrypt + ); + const hashOfPrivateDataStr = uint8arrayToString( + new Uint8Array(hashOfPrivateData), + "base16" + ); + const identityParam = this._getIdentityParamForEncryption( + hashOfConditionsStr, + hashOfPrivateDataStr + ); + const ciphertext = await encrypt2( + this.subnetPubKey, + params.dataToEncrypt, + uint8arrayFromString(identityParam, "utf8") + ); + return { ciphertext, dataToEncryptHash: hashOfPrivateDataStr }; + }; + /** + * + * Decrypt ciphertext with the LIT network. + * + */ + decrypt = async (params) => { + const { sessionSigs, authSig, chain, ciphertext, dataToEncryptHash } = params; + if (!this.ready) { + throw new LitNodeClientNotReadyError( + {}, + "6 LitNodeClient is not ready. Please call await litNodeClient.connect() first." + ); + } + if (!this.subnetPubKey) { + throw new LitNodeClientNotReadyError({}, "subnetPubKey cannot be null"); + } + const paramsIsSafe = safeParams({ + functionName: "decrypt", + params + }); + if (!paramsIsSafe) { + throw new InvalidArgumentException( + { + info: { + params + } + }, + "Parameter validation failed." + ); + } + const hashOfConditions = await this.getHashedAccessControlConditions(params); + if (!hashOfConditions) { + throw new InvalidArgumentException( + { + info: { + params + } + }, + "You must provide either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions" + ); + } + const hashOfConditionsStr = uint8arrayToString( + new Uint8Array(hashOfConditions), + "base16" + ); + const { + error, + formattedAccessControlConditions, + formattedEVMContractConditions, + formattedSolRpcConditions, + formattedUnifiedAccessControlConditions + } = this.getFormattedAccessControlConditions(params); + if (error) { + throw new InvalidArgumentException( + { + info: { + params + } + }, + "You must provide either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions" + ); + } + const identityParam = this._getIdentityParamForEncryption( + hashOfConditionsStr, + dataToEncryptHash + ); + log("identityParam", identityParam); + const requestId = this._getNewRequestId(); + const nodePromises = this.getNodePromises((url) => { + const authSigToSend = sessionSigs ? sessionSigs[url] : authSig; + if (!authSigToSend) { + throw new InvalidArgumentException( + { + info: { + params + } + }, + "authSig is required" + ); + } + const reqBody = { + accessControlConditions: formattedAccessControlConditions, + evmContractConditions: formattedEVMContractConditions, + solRpcConditions: formattedSolRpcConditions, + unifiedAccessControlConditions: formattedUnifiedAccessControlConditions, + dataToEncryptHash, + chain, + authSig: authSigToSend, + epoch: this.currentEpochNumber + }; + const urlWithParh = composeLitUrl({ + url, + endpoint: LIT_ENDPOINT.ENCRYPTION_SIGN + }); + return this.generatePromise(urlWithParh, reqBody, requestId); + }); + const res = await this.handleNodePromises( + nodePromises, + requestId, + this.config.minNodeCount + ); + if (!res.success) { + this._throwNodeError(res, requestId); + } + const signatureShares = res.values; + logWithRequestId(requestId, "signatureShares", signatureShares); + const decryptedData = await this._decryptWithSignatureShares( + this.subnetPubKey, + uint8arrayFromString(identityParam, "utf8"), + ciphertext, + signatureShares + ); + return { decryptedData }; + }; + getLitResourceForEncryption = async (params) => { + const hashOfConditions = await this.getHashedAccessControlConditions(params); + if (!hashOfConditions) { + throw new InvalidArgumentException( + { + info: { + params + } + }, + "You must provide either accessControlConditions or evmContractConditions or solRpcConditions or unifiedAccessControlConditions" + ); + } + const hashOfConditionsStr = uint8arrayToString( + new Uint8Array(hashOfConditions), + "base16" + ); + const hashOfPrivateData = await crypto.subtle.digest( + "SHA-256", + params.dataToEncrypt + ); + const hashOfPrivateDataStr = uint8arrayToString( + new Uint8Array(hashOfPrivateData), + "base16" + ); + return new LitAccessControlConditionResource( + `${hashOfConditionsStr}/${hashOfPrivateDataStr}` + ); + }; + _getIdentityParamForEncryption = (hashOfConditionsStr, hashOfPrivateDataStr) => { + return new LitAccessControlConditionResource( + `${hashOfConditionsStr}/${hashOfPrivateDataStr}` + ).getResourceKey(); + }; + /** ============================== SESSION ============================== */ + /** + * Sign a session public key using a PKP, which generates an authSig. + * @returns {Object} An object containing the resulting signature. + */ + signSessionKey = async (params) => { + log(`[signSessionKey] params:`, params); + if (!this.ready) { + throw new LitNodeClientNotReadyError( + {}, + "[signSessionKey] ]LitNodeClient is not ready. Please call await litNodeClient.connect() first." + ); + } + const _expiration = params.expiration || new Date(Date.now() + 24 * 60 * 60 * 1e3).toISOString(); + const sessionKey = params.sessionKey ?? this.getSessionKey(); + const sessionKeyUri = LIT_SESSION_KEY_URI + sessionKey.publicKey; + log( + `[signSessionKey] sessionKeyUri is not found in params, generating a new one`, + sessionKeyUri + ); + if (!sessionKeyUri) { + throw new InvalidParamType( + { + info: { + params + } + }, + "[signSessionKey] sessionKeyUri is not defined. Please provide a sessionKeyUri or a sessionKey." + ); + } + const pkpEthAddress = function() { + params.pkpPublicKey = hexPrefixed(params.pkpPublicKey); + if (params.pkpPublicKey) + return computeAddress(params.pkpPublicKey); + return "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; + }(); + let siwe_statement = "Lit Protocol PKP session signature"; + if (params.statement) { + siwe_statement += " " + params.statement; + log(`[signSessionKey] statement found in params: "${params.statement}"`); + } + let siweMessage; + const siweParams = { + domain: params?.domain || globalThis.location?.host || "litprotocol.com", + walletAddress: pkpEthAddress, + statement: siwe_statement, + uri: sessionKeyUri, + version: "1", + chainId: params.chainId ?? 1, + expiration: _expiration, + nonce: await this.getLatestBlockhash() + }; + if (params.resourceAbilityRequests) { + siweMessage = await createSiweMessageWithRecaps({ + ...siweParams, + resources: params.resourceAbilityRequests, + litNodeClient: this + }); + } else { + siweMessage = await createSiweMessage(siweParams); + } + const body = { + sessionKey: sessionKeyUri, + authMethods: params.authMethods, + ...params?.pkpPublicKey && { pkpPublicKey: params.pkpPublicKey }, + siweMessage, + curveType: LIT_CURVE.BLS, + // -- custom auths + ...params?.litActionIpfsId && { + litActionIpfsId: params.litActionIpfsId + }, + ...params?.litActionCode && { code: params.litActionCode }, + ...params?.jsParams && { jsParams: params.jsParams }, + ...this.currentEpochNumber && { epoch: this.currentEpochNumber } + }; + log(`[signSessionKey] body:`, body); + const requestId = this._getNewRequestId(); + logWithRequestId(requestId, "signSessionKey body", body); + const nodePromises = this.getNodePromises((url) => { + const reqBody = body; + const urlWithPath = composeLitUrl({ + url, + endpoint: LIT_ENDPOINT.SIGN_SESSION_KEY + }); + return this.generatePromise(urlWithPath, reqBody, requestId); + }); + let res; + try { + res = await this.handleNodePromises( + nodePromises, + requestId, + this.config.minNodeCount + ); + log("signSessionKey node promises:", res); + } catch (e2) { + throw new UnknownError( + { + info: { + requestId + }, + cause: e2 + }, + "Error when handling node promises" + ); + } + logWithRequestId(requestId, "handleNodePromises res:", res); + if (!this._isSuccessNodePromises(res)) { + this._throwNodeError(res, requestId); + return {}; + } + const responseData = res.values; + logWithRequestId( + requestId, + "[signSessionKey] responseData", + JSON.stringify(responseData, null, 2) + ); + let curveType = responseData[0]?.curveType; + if (curveType === "ECDSA") { + throw new Error( + "The ECDSA curve type is not supported in this version. Please use version 6.x.x instead." + ); + } + log(`[signSessionKey] curveType is "${curveType}"`); + const signedDataList = responseData.map((s2) => s2.dataSigned); + if (signedDataList.length <= 0) { + const err = `[signSessionKey] signedDataList is empty.`; + log(err); + throw new InvalidSignatureError( + { + info: { + requestId, + responseData, + signedDataList + } + }, + err + ); + } + logWithRequestId( + requestId, + "[signSessionKey] signedDataList", + signedDataList + ); + const validatedSignedDataList = responseData.map((data) => { + const requiredFields = [ + "signatureShare", + "curveType", + "shareIndex", + "siweMessage", + "dataSigned", + "blsRootPubkey", + "result" + ]; + for (const field of requiredFields) { + const key2 = field; + if (data[key2] === void 0 || data[key2] === null || data[key2] === "") { + log( + `[signSessionKey] Invalid signed data. "${field}" is missing. Not a problem, we only need ${this.config.minNodeCount} nodes to sign the session key.` + ); + return null; + } + } + if (!data.signatureShare.ProofOfPossession) { + const err = `[signSessionKey] Invalid signed data. "ProofOfPossession" is missing.`; + log(err); + throw new InvalidSignatureError( + { + info: { + requestId, + responseData, + data + } + }, + err + ); + } + return data; + }).filter((item) => item !== null); + logWithRequestId( + requestId, + "[signSessionKey] requested length:", + signedDataList.length + ); + logWithRequestId( + requestId, + "[signSessionKey] validated length:", + validatedSignedDataList.length + ); + logWithRequestId( + requestId, + "[signSessionKey] minimum required length:", + this.config.minNodeCount + ); + if (validatedSignedDataList.length < this.config.minNodeCount) { + throw new InvalidSignatureError( + { + info: { + requestId, + responseData, + validatedSignedDataList, + minNodeCount: this.config.minNodeCount + } + }, + `[signSessionKey] not enough nodes signed the session key. Expected ${this.config.minNodeCount}, got ${validatedSignedDataList.length}` + ); + } + const blsSignedData = validatedSignedDataList; + const sigType = mostCommonString(blsSignedData.map((s2) => s2.curveType)); + log(`[signSessionKey] sigType:`, sigType); + const signatureShares = getBlsSignatures(blsSignedData); + log(`[signSessionKey] signatureShares:`, signatureShares); + const blsCombinedSignature = await combineSignatureShares(signatureShares); + log(`[signSessionKey] blsCombinedSignature:`, blsCombinedSignature); + const publicKey = removeHexPrefix(params.pkpPublicKey); + log(`[signSessionKey] publicKey:`, publicKey); + const dataSigned = mostCommonString(blsSignedData.map((s2) => s2.dataSigned)); + log(`[signSessionKey] dataSigned:`, dataSigned); + const mostCommonSiweMessage = mostCommonString( + blsSignedData.map((s2) => s2.siweMessage) + ); + log(`[signSessionKey] mostCommonSiweMessage:`, mostCommonSiweMessage); + const signedMessage = normalizeAndStringify(mostCommonSiweMessage); + log(`[signSessionKey] signedMessage:`, signedMessage); + const signSessionKeyRes = { + authSig: { + sig: JSON.stringify({ + ProofOfPossession: blsCombinedSignature + }), + algo: "LIT_BLS", + derivedVia: "lit.bls", + signedMessage, + address: computeAddress(hexPrefixed(publicKey)) + }, + pkpPublicKey: publicKey + }; + return signSessionKeyRes; + }; + _isSuccessNodePromises = (res) => { + return res.success; + }; + getSignSessionKeyShares = async (url, params, requestId) => { + log("getSignSessionKeyShares"); + const urlWithPath = composeLitUrl({ + url, + endpoint: LIT_ENDPOINT.SIGN_SESSION_KEY + }); + return await this.sendCommandToNode({ + url: urlWithPath, + data: params.body, + requestId + }); + }; + /** + * + * Retrieves or generates sessionSigs (think access token) for accessing Lit Network resources. + * + * How this function works on a high level: + * 1. Generate or retrieve [session keys](https://v6-api-doc-lit-js-sdk.vercel.app/interfaces/types_src.SessionKeyPair.html) (a public and private key pair) + * 2. Generate or retrieve the [`AuthSig`](https://v6-api-doc-lit-js-sdk.vercel.app/interfaces/types_src.AuthSig.html) that specifies the session [abilities](https://v6-api-doc-lit-js-sdk.vercel.app/enums/auth_helpers_src.LitAbility.html) + * 3. Sign the specific resources with the session key + * + * The process follows these steps: + * 1. Retrieves or generates a session key pair (Ed25519) for the user's device. The session key is either fetched from local storage or newly created if not found. The key does not expire. + * 2. Generates an authentication signature (`authSig`) by signing an ERC-5573 “Sign-in with Ethereum” message, which includes resource ability requests, capabilities, expiration, the user's device session public key, and a nonce. The `authSig` is retrieved from local storage, and if it has expired, the user will be prompted to re-sign. + * 3. Uses the session private key to sign the session public key along with the resource ability requests, capabilities, issuedAt, and expiration details. This creates a device-generated signature. + * 4. Constructs the session signatures (`sessionSigs`) by including the device-generated signature and the original message. The `sessionSigs` provide access to Lit Network features such as `executeJs` and `pkpSign`. + * + * See Sequence Diagram: https://www.plantuml.com/plantuml/uml/VPH1RnCn48Nl_XLFlT1Av00eGkm15QKLWY8K9K9SO-rEar4sjcLFalBl6NjJAuaMRl5utfjlPjQvJsAZx7UziQtuY5-9eWaQufQ3TOAR77cJy407Rka6zlNdHTRouUbIzSEtjiTIBUswg5v_NwMnuAVlA9KKFPN3I0x9qSSj7bqNF3iPykl9c4o9oUSJMuElv2XQ8IHAYRt3bluWM8wuVUpUJwVlFjsP8JUh5B_1DyV2AYdD6DjhLsTQTaYd3W3ad28SGWqM997fG5ZrB9DJqOaALuRwH1TMpik8tIYze-E8OrPKU5I6cMqtem2kCqOhr4vdaRAvtSjcoMkTo68scKu_Vi1EPMfrP_xVtj7sFMaHNg-6GVqk0MW0z18uKdVULTvDWtdqko28b7KktvUB2hKOBd1asU2QgDfTzrj7T4bLPdv6TR0zLwPQKkkZpIRTY4CTMbrBpg_VKuXyi49beUAHqIlirOUrL2zq9JPPdpRR5OMLVQGoGlLcjyRyQNv6MHz4W_fG42W--xWhUfNyOxiLL1USS6lRLeyAkYLNjrkVJuClm_qp5I8Lq0krUw7lwIt2DgY9oiozrjA_Yhy0 + * + * Note: When generating session signatures for different PKPs or auth methods, + * be sure to call disconnectWeb3 to clear auth signatures stored in local storage + * + * @param { GetSessionSigsProps } params + * + * An example of how this function is used can be found in the Lit developer-guides-code repository [here](https://github.com/LIT-Protocol/developer-guides-code/tree/master/session-signatures/getSessionSigs). + * + */ + getSessionSigs = async (params) => { + const sessionKey = params.sessionKey ?? this.getSessionKey(); + const sessionKeyUri = this.getSessionKeyUri(sessionKey.publicKey); + const sessionCapabilityObject = params.sessionCapabilityObject ? params.sessionCapabilityObject : await this.generateSessionCapabilityObjectWithWildcards( + params.resourceAbilityRequests.map((r3) => r3.resource) + ); + const expiration = params.expiration || _LitNodeClientNodeJs.getExpiration(); + let authSig = await this.getWalletSig({ + authNeededCallback: params.authNeededCallback, + chain: params.chain || "ethereum", + sessionCapabilityObject, + switchChain: params.switchChain, + expiration, + sessionKey, + sessionKeyUri, + nonce: await this.getLatestBlockhash(), + // -- for recap + resourceAbilityRequests: params.resourceAbilityRequests, + // -- optional fields + ...params.litActionCode && { litActionCode: params.litActionCode }, + ...params.litActionIpfsId && { + litActionIpfsId: params.litActionIpfsId + }, + ...params.jsParams && { jsParams: params.jsParams } + }); + const needToResignSessionKey = await this.checkNeedToResignSessionKey({ + authSig, + sessionKeyUri, + resourceAbilityRequests: params.resourceAbilityRequests + }); + if (needToResignSessionKey) { + log("need to re-sign session key. Signing..."); + authSig = await this._authCallbackAndUpdateStorageItem({ + authCallback: params.authNeededCallback, + authCallbackParams: { + chain: params.chain || "ethereum", + statement: sessionCapabilityObject.statement, + resources: [sessionCapabilityObject.encodeAsSiweResource()], + switchChain: params.switchChain, + expiration, + sessionKey, + uri: sessionKeyUri, + nonce: await this.getLatestBlockhash(), + resourceAbilityRequests: params.resourceAbilityRequests, + // -- optional fields + ...params.litActionCode && { litActionCode: params.litActionCode }, + ...params.litActionIpfsId && { + litActionIpfsId: params.litActionIpfsId + }, + ...params.jsParams && { jsParams: params.jsParams } + } + }); + } + if (authSig.address === "" || authSig.derivedVia === "" || authSig.sig === "" || authSig.signedMessage === "") { + throw new WalletSignatureNotFoundError( + { + info: { + authSig + } + }, + "No wallet signature found" + ); + } + const sessionExpiration = expiration ?? new Date(Date.now() + 1e3 * 60 * 5).toISOString(); + const capabilities = params.capacityDelegationAuthSig ? [ + ...params.capabilityAuthSigs ?? [], + params.capacityDelegationAuthSig, + authSig + ] : [...params.capabilityAuthSigs ?? [], authSig]; + const signingTemplate = { + sessionKey: sessionKey.publicKey, + resourceAbilityRequests: params.resourceAbilityRequests, + capabilities, + issuedAt: (/* @__PURE__ */ new Date()).toISOString(), + expiration: sessionExpiration + }; + const signatures = {}; + this.connectedNodes.forEach((nodeAddress) => { + const toSign = { + ...signingTemplate, + nodeAddress + }; + const signedMessage = JSON.stringify(toSign); + const uint8arrayKey = uint8arrayFromString( + sessionKey.secretKey, + "base16" + ); + const uint8arrayMessage = uint8arrayFromString(signedMessage, "utf8"); + const signature2 = nacl2.sign.detached(uint8arrayMessage, uint8arrayKey); + signatures[nodeAddress] = { + sig: uint8arrayToString(signature2, "base16"), + derivedVia: "litSessionSignViaNacl", + signedMessage, + address: sessionKey.publicKey, + algo: "ed25519" + }; + }); + log("signatures:", signatures); + try { + const formattedSessionSigs = formatSessionSigs( + JSON.stringify(signatures) + ); + log(formattedSessionSigs); + } catch (e2) { + log("Error formatting session signatures: ", e2); + } + return signatures; + }; + /** + * Retrieves the PKP sessionSigs. + * + * @param params - The parameters for retrieving the PKP sessionSigs. + * @returns A promise that resolves to the PKP sessionSigs. + * @throws An error if any of the required parameters are missing or if `litActionCode` and `ipfsId` exist at the same time. + */ + getPkpSessionSigs = async (params) => { + const chain = params?.chain || "ethereum"; + const pkpSessionSigs = this.getSessionSigs({ + chain, + ...params, + authNeededCallback: async (props) => { + if (!props.expiration) { + throw new ParamsMissingError( + { + info: { + props + } + }, + "[getPkpSessionSigs/callback] expiration is required" + ); + } + if (!props.resources) { + throw new ParamsMissingError( + { + info: { + props + } + }, + "[getPkpSessionSigs/callback]resources is required" + ); + } + if (!props.resourceAbilityRequests) { + throw new ParamsMissingError( + { + info: { + props + } + }, + "[getPkpSessionSigs/callback]resourceAbilityRequests is required" + ); + } + if (props.litActionCode && props.litActionIpfsId) { + throw new UnsupportedMethodError( + { + info: { + props + } + }, + "[getPkpSessionSigs/callback]litActionCode and litActionIpfsId cannot exist at the same time" + ); + } + const overwriteCode = params.ipfsOptions?.overwriteCode || GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[this.config.litNetwork]; + if (overwriteCode && props.litActionIpfsId) { + const code9 = await this._getFallbackIpfsCode( + params.ipfsOptions?.gatewayUrl, + props.litActionIpfsId + ); + props = { + ...props, + litActionCode: code9, + litActionIpfsId: void 0 + }; + } + const authMethods = params.authMethods || []; + const response = await this.signSessionKey({ + sessionKey: props.sessionKey, + statement: props.statement || "Some custom statement.", + authMethods: [...authMethods], + pkpPublicKey: params.pkpPublicKey, + expiration: props.expiration, + resources: props.resources, + chainId: 1, + // -- required fields + resourceAbilityRequests: props.resourceAbilityRequests, + // -- optional fields + ...props.litActionCode && { litActionCode: props.litActionCode }, + ...props.litActionIpfsId && { + litActionIpfsId: props.litActionIpfsId + }, + ...props.jsParams && { jsParams: props.jsParams } + }); + return response.authSig; + } + }); + return pkpSessionSigs; + }; + /** + * Retrieves session signatures specifically for Lit Actions. + * Unlike `getPkpSessionSigs`, this function requires either `litActionCode` or `litActionIpfsId`, and `jsParams` must be provided. + * + * @param params - The parameters required for retrieving the session signatures. + * @returns A promise that resolves with the session signatures. + */ + getLitActionSessionSigs = async (params) => { + if (!params.litActionCode && !params.litActionIpfsId) { + throw new InvalidParamType( + { + info: { + params + } + }, + 'Either "litActionCode" or "litActionIpfsId" must be provided.' + ); + } + if (!params.jsParams) { + throw new ParamsMissingError( + { + info: { + params + } + }, + "'jsParams' is required." + ); + } + return this.getPkpSessionSigs(params); + }; + /** + * + * Get Session Key URI eg. lit:session:0x1234 + * + * @param publicKey is the public key of the session key + * @returns { string } the session key uri + */ + getSessionKeyUri = (publicKey) => { + return LIT_SESSION_KEY_URI + publicKey; + }; + /** + * Authenticates an Auth Method for claiming a Programmable Key Pair (PKP). + * A {@link MintCallback} can be defined for custom on chain interactions + * by default the callback will forward to a relay server for minting on chain. + * @param {ClaimKeyRequest} params an Auth Method and {@link MintCallback} + * @returns {Promise} + */ + async claimKeyId(params) { + if (!this.ready) { + const message = "LitNodeClient is not ready. Please call await litNodeClient.connect() first."; + throw new LitNodeClientNotReadyError({}, message); + } + if (params.authMethod.authMethodType == AUTH_METHOD_TYPE.WebAuthn) { + throw new LitNodeClientNotReadyError( + {}, + "Unsupported auth method type. Webauthn, and Lit Actions are not supported for claiming" + ); + } + const requestId = this._getNewRequestId(); + const nodePromises = this.getNodePromises((url) => { + if (!params.authMethod) { + throw new ParamsMissingError( + { + info: { + params + } + }, + "authMethod is required" + ); + } + const reqBody = { + authMethod: params.authMethod + }; + const urlWithPath = composeLitUrl({ + url, + endpoint: LIT_ENDPOINT.PKP_CLAIM + }); + return this.generatePromise(urlWithPath, reqBody, requestId); + }); + const responseData = await this.handleNodePromises( + nodePromises, + requestId, + this.connectedNodes.size + ); + if (responseData.success) { + const nodeSignatures = responseData.values.map((r3) => { + const sig = ethers_exports.utils.splitSignature(`0x${r3.signature}`); + return { + r: sig.r, + s: sig.s, + v: sig.v + }; + }); + logWithRequestId( + requestId, + `responseData: ${JSON.stringify(responseData, null, 2)}` + ); + const derivedKeyId = responseData.values[0].derivedKeyId; + const pubkey = await this.computeHDPubKey(derivedKeyId); + logWithRequestId( + requestId, + `pubkey ${pubkey} derived from key id ${derivedKeyId}` + ); + const relayParams = params; + let mintTx = ""; + if (params.mintCallback && "signer" in params) { + mintTx = await params.mintCallback( + { + derivedKeyId, + authMethodType: params.authMethod.authMethodType, + signatures: nodeSignatures, + pubkey, + signer: params.signer, + ...relayParams + }, + this.config.litNetwork + ); + } else { + mintTx = await defaultMintClaimCallback( + { + derivedKeyId, + authMethodType: params.authMethod.authMethodType, + signatures: nodeSignatures, + pubkey, + ...relayParams + }, + this.config.litNetwork + ); + } + return { + signatures: nodeSignatures, + claimedKeyId: derivedKeyId, + pubkey, + mintTx + }; + } else { + throw new UnknownError( + { + info: { + requestId, + responseData + } + }, + `Claim request has failed. Request trace id: lit_%s`, + requestId + ); + } + } +}; +var LitNodeClientNodeJs = _LitNodeClientNodeJs; +/** + * + * Get expiration for session default time is 1 day / 24 hours + * + */ +__publicField(LitNodeClientNodeJs, "getExpiration", () => { + return new Date(Date.now() + 1e3 * 60 * 60 * 24).toISOString(); +}); + +// packages/lit-node-client/src/lib/lit-node-client.ts +var LitNodeClient = class extends LitNodeClientNodeJs { + constructor(args) { + super({ + ...args, + defaultAuthCallback: checkAndSignAuthMessage + }); + this._overrideConfigsFromLocalStorage(); + } + /** + * + * (Browser Only) Get the config from browser local storage and override default config + * + * @returns { void } + * + */ + _overrideConfigsFromLocalStorage = () => { + if (isNode()) + return; + const storageKey = "LitNodeClientConfig"; + const storageConfigOrError = getStorageItem(storageKey); + if (storageConfigOrError.type === EITHER_TYPE.ERROR) { + log(`Storage key "${storageKey}" is missing. `); + return; + } + const storageConfig = JSON.parse(storageConfigOrError.result); + this.config = { ...this.config, ...storageConfig }; + }; +}; + +// local-tests/setup/tinny-person.ts +init_shim(); + +// packages/lit-auth-client/src/index.ts +init_shim(); + +// packages/lit-auth-client/src/lib/providers/AppleProvider.ts +init_shim(); + +// packages/lit-auth-client/src/lib/utils.ts +init_shim(); +import * as cbor from "cbor-web"; + +// packages/lit-auth-client/src/lib/providers/DiscordProvider.ts +init_shim(); + +// packages/lit-auth-client/src/lib/providers/BaseProvider.ts +init_shim(); +import depd6 from "depd"; + +// packages/lit-auth-client/src/lib/validators.ts +init_shim(); +var validateMintRequestBody = (customArgs) => { + let isValid = true; + const validKeys = [ + "keyType", + "permittedAuthMethodTypes", + "permittedAuthMethodIds", + "permittedAuthMethodPubkeys", + "permittedAuthMethodScopes", + "addPkpEthAddressAsPermittedAddress", + "sendPkpToItself" + ]; + for (const key2 of Object.keys(customArgs)) { + if (!validKeys.includes(key2)) { + console.error( + `Invalid key found: ${key2}. This key is not allowed. Valid keys are: ${validKeys.join( + ", " + )}` + ); + isValid = false; + } + } + if (customArgs.keyType !== void 0 && typeof customArgs.keyType !== "number") { + console.error("Invalid type for keyType: expected a number."); + isValid = false; + } + if (customArgs.permittedAuthMethodTypes !== void 0 && (!Array.isArray(customArgs.permittedAuthMethodTypes) || !customArgs.permittedAuthMethodTypes.every( + (type) => typeof type === "number" + ))) { + console.error( + "Invalid type for permittedAuthMethodTypes: expected an array of numbers." + ); + isValid = false; + } + if (customArgs.permittedAuthMethodIds !== void 0 && (!Array.isArray(customArgs.permittedAuthMethodIds) || !customArgs.permittedAuthMethodIds.every((id2) => typeof id2 === "string"))) { + console.error( + "Invalid type for permittedAuthMethodIds: expected an array of strings." + ); + isValid = false; + } + if (customArgs.permittedAuthMethodPubkeys !== void 0 && (!Array.isArray(customArgs.permittedAuthMethodPubkeys) || !customArgs.permittedAuthMethodPubkeys.every( + (pubkey) => typeof pubkey === "string" + ))) { + console.error( + "Invalid type for permittedAuthMethodPubkeys: expected an array of strings." + ); + isValid = false; + } + if (customArgs.permittedAuthMethodScopes !== void 0 && (!Array.isArray(customArgs.permittedAuthMethodScopes) || !customArgs.permittedAuthMethodScopes.every( + (scope) => Array.isArray(scope) && scope.every((s2) => typeof s2 === "number") + ))) { + console.error( + "Invalid type for permittedAuthMethodScopes: expected an array of arrays of numberr." + ); + isValid = false; + } + if (customArgs.addPkpEthAddressAsPermittedAddress !== void 0 && typeof customArgs.addPkpEthAddressAsPermittedAddress !== "boolean") { + console.error( + "Invalid type for addPkpEthAddressAsPermittedAddress: expected a boolean." + ); + isValid = false; + } + if (customArgs.sendPkpToItself !== void 0 && typeof customArgs.sendPkpToItself !== "boolean") { + console.error("Invalid type for sendPkpToItself: expected a boolean."); + isValid = false; + } + return isValid; +}; + +// packages/lit-auth-client/src/lib/providers/BaseProvider.ts +var deprecated6 = depd6("lit-js-sdk:auth-browser:base-provider"); +var BaseProvider2 = class { + /** + * Relay server to subsidize minting of PKPs + */ + relay; + /** + * Client to connect to Lit nodes + */ + litNodeClient; + constructor(options) { + this.relay = options.relay; + this.litNodeClient = options.litNodeClient; + } + /** + * Mint a new PKP for the given auth method through the relay server + * + * @param {AuthMethod} authMethod - Auth method object + * @param {MintRequestBody} [customArgs] - Extra data to overwrite default params + * + * @returns {Promise} - Mint transaction hash + */ + async mintPKPThroughRelayer(authMethod, customArgs) { + const data = await this.prepareRelayRequestData(authMethod); + if (customArgs && !validateMintRequestBody(customArgs)) { + throw new InvalidArgumentException( + { + info: { + customArgs + } + }, + "Invalid mint request body" + ); + } + const body = this.prepareMintBody( + data, + customArgs ?? {} + ); + const mintRes = await this.relay.mintPKP(body); + if (!mintRes || !mintRes.requestId) { + throw new UnknownError( + { + info: { + mintRes + } + }, + "Missing mint response or request ID from relay server" + ); + } + return mintRes.requestId; + } + /** + * @deprecated - Use {@link fetchPKPs} instead + * Fetch PKPs associated with given auth method from relay server + * + * @param {AuthMethod} authMethod - Auth method object + * + * @returns {Promise} - Array of PKPs + */ + async fetchPKPsThroughRelayer(authMethod) { + deprecated6("fetchPKPsThroughRelayer is deprecated. Use fetchPKPs instead."); + const data = await this.prepareRelayRequestData(authMethod); + const body = this.prepareFetchBody(data); + const fetchRes = await this.relay.fetchPKPs(body); + if (!fetchRes || !fetchRes.pkps) { + throw new ParamsMissingError( + { + info: { + fetchRes + } + }, + "Missing PKPs in fetch response from relay server" + ); + } + return fetchRes.pkps; + } + /** + * Fetch PKPs associated with given auth method type and id from pkp contract + * + * @param {AUTH_METHOD_TYPE} authMethodType - Auth method type + * @param {string} authMethodId - Auth method id + * + * @returns {Promise} - Array of PKPs + */ + async getPKPsForAuthMethod({ + authMethodType, + authMethodId + }) { + if (!authMethodType || !authMethodId) { + throw new InvalidArgumentException( + { + info: { + authMethodType, + authMethodId + } + }, + "Auth method type and id are required to fetch PKPs by auth method" + ); + } + const litContracts = new LitContracts({ + randomPrivatekey: true, + network: this.litNodeClient.config.litNetwork + }); + try { + await litContracts.connect(); + } catch (err) { + throw new UnknownError( + { + cause: err + }, + "Unable to connect to LitContracts" + ); + } + try { + const pkpPermissions = litContracts.pkpPermissionsContract; + const tokenIds = await pkpPermissions.read.getTokenIdsForAuthMethod( + authMethodType, + authMethodId + ); + const pkps = []; + for (const tokenId of tokenIds) { + const pubkey = await pkpPermissions.read.getPubkey(tokenId); + if (pubkey) { + const ethAddress = ethers_exports.utils.computeAddress(pubkey); + pkps.push({ + tokenId: tokenId.toString(), + publicKey: pubkey, + ethAddress + }); + } + } + return pkps; + } catch (err) { + throw new UnknownError( + { + cause: err + }, + "Unable to get PKPs for auth method" + ); + } + } + /** + * Fetch PKPs associated with given auth method from pkp contract + * + * @param {AuthMethod} authMethod - Auth method object + * + * @returns {Promise} - Array of PKPs + */ + async fetchPKPs(authMethod) { + const authMethodId = await this.getAuthMethodId(authMethod); + const authMethodType = authMethod.authMethodType; + const pkps = await this.getPKPsForAuthMethod({ + authMethodType, + authMethodId + }); + return pkps; + } + /** + * Generate session sigs for given auth method and PKP + * + * @param {BaseProviderSessionSigsParams} params + * @param {string} params.pkpPublicKey - Public key of PKP to auth with + * @param {AuthMethod} params.authMethod - Auth method verifying ownership of PKP + * @param {GetSessionSigsProps} params.sessionSigsParams - Params for getSessionSigs function + * @param {LitNodeClient} [params.litNodeClient] - Lit Node Client to use. If not provided, will use an existing Lit Node Client or create a new one + * + * @returns {Promise} - Session sigs + */ + async getSessionSigs(params) { + if (params.litNodeClient && params.litNodeClient instanceof LitNodeClient) { + this.litNodeClient = params.litNodeClient; + } + if (!this.litNodeClient.ready) { + await this.litNodeClient.connect(); + } + let authNeededCallback = params.sessionSigsParams.authNeededCallback; + const sessionKey = params.sessionSigsParams.sessionKey || this.litNodeClient.getSessionKey(); + if (!authNeededCallback) { + const nodeClient = this.litNodeClient; + authNeededCallback = async (authCallbackParams) => { + let chainId = 1; + try { + const chainInfo = ALL_LIT_CHAINS[authCallbackParams.chain]; + chainId = chainInfo.chainId; + } catch { + } + let response; + const commonData = { + sessionKey, + statement: authCallbackParams.statement, + pkpPublicKey: params.pkpPublicKey, + expiration: authCallbackParams.expiration, + resources: authCallbackParams.resources, + chainId, + ...params.resourceAbilityRequests && { + resourceAbilityRequests: params.resourceAbilityRequests + } + }; + if (params.authMethod.authMethodType === AUTH_METHOD_TYPE.EthWallet) { + const authSig = JSON.parse(params.authMethod.accessToken); + response = await nodeClient.signSessionKey({ + ...commonData, + authSig, + authMethods: [] + }); + } else { + response = await nodeClient.signSessionKey({ + ...commonData, + authMethods: [params.authMethod] + }); + } + return response.authSig; + }; + } + const sessionSigs = await this.litNodeClient.getSessionSigs({ + ...params.sessionSigsParams, + sessionKey, + authNeededCallback + }); + return sessionSigs; + } + /** + * Authenticates an auth Method for claiming a Programmable Key Pair (PKP). + * Uses the underyling {@link litNodeClient} instance to authenticate a given auth method + * @param claimRequest + * @returns {Promise} - Response from the network for the claim + */ + async claimKeyId(claimRequest) { + if (!this.litNodeClient.ready) { + await this.litNodeClient.connect(); + } + const res = await this.litNodeClient.claimKeyId(claimRequest); + return res; + } + /** + * Calculates a public key for a given `key identifier` which is an `Auth Method Identifier` + * the Auth Method Identifier is a hash of a user identifier and app idendtifer. + * These identifiers are specific to each auth method and will derive the public key protion of a pkp which will be persited + * when a key is claimed. + * | Auth Method | User ID | App ID | + * |:------------|:-------|:-------| + * | Google OAuth | token `sub` | token `aud` | + * | Discord OAuth | user id | client app identifier | + * | Stytch OTP |token `sub` | token `aud`| + * @param userId + * @param appId + * @returns + */ + computePublicKeyFromAuthMethod = async (authMethod) => { + let authMethodId = await this.getAuthMethodId(authMethod); + authMethodId = authMethodId.slice(2); + if (!this.litNodeClient) { + throw new LitNodeClientNotReadyError( + { + info: { + authMethod, + method: "computePublicKeyFromAuthMethod" + } + }, + "Lit Node Client is not configured" + ); + } + return this.litNodeClient.computeHDPubKey(authMethodId); + }; + /** + * Generate request data for minting and fetching PKPs via relay server + * + * @param {AuthMethod} authMethod - Auth method obejct + * + * @returns {Promise} - Relay request data + */ + async prepareRelayRequestData(authMethod) { + const authMethodType = authMethod.authMethodType; + const authMethodId = await this.getAuthMethodId(authMethod); + const data = { + authMethodType, + authMethodId + }; + return data; + } + /** + * Generate request body for minting PKP using auth methods via relay server + * + * @param {IRelayRequestData} data - Data for minting PKP + * @param {number} data.authMethodType - Type of auth method + * @param {string} data.authMethodId - ID of auth method + * @param {string} [data.authMethodPubKey] - Public key associated with the auth method (used only in WebAuthn) + * @param {MintRequestBody} [customArgs] - Extra data to overwrite default params + * + * @returns {string} - Relay request body for minting PKP + */ + prepareMintBody(data, customArgs) { + const pubkey = data.authMethodPubKey || "0x"; + const defaultArgs = { + // default params + keyType: 2, + permittedAuthMethodTypes: [data.authMethodType], + permittedAuthMethodIds: [data.authMethodId], + permittedAuthMethodPubkeys: [pubkey], + permittedAuthMethodScopes: [[ethers_exports.BigNumber.from("1")]], + addPkpEthAddressAsPermittedAddress: true, + sendPkpToItself: true + }; + const args = { + ...defaultArgs, + ...customArgs + }; + const body = JSON.stringify(args); + return body; + } + /** + * Generate request body to fetch PKPs using auth method info via relay server + * + * @param {IRelayRequestData} data - Data for fetching PKP + * @param {string} data.authMethodType - Type of auth method + * @param {string} data.authMethodId - ID of auth method + * @param {string} [data.authMethodPubKey] - Public key associated with the auth method (used only in WebAuthn) + * + * @returns {string} - Relay request body to fetch PKPs + */ + prepareFetchBody(data) { + const args = { + authMethodId: data.authMethodId, + authMethodType: data.authMethodType, + authMethodPubKey: data.authMethodPubKey + }; + const body = JSON.stringify(args); + return body; + } +}; + +// packages/lit-auth-client/src/lib/providers/DiscordProvider.ts +var DiscordProvider = class extends BaseProvider2 { + /** + * The redirect URI that Lit's login server should send the user back to + */ + redirectUri; + /** + * OAuth client ID. Defaults to one used by Lit + */ + clientId; + constructor(options) { + super(options); + this.redirectUri = options.redirectUri || window.location.origin; + this.clientId = options.clientId || "1052874239658692668"; + } + /** + * Redirect user to the Lit's Discord login page + * + * @returns {Promise} - Redirects user to Lit login page + */ + async signIn() { + const loginUrl = await prepareLoginUrl("discord", this.redirectUri); + window.location.assign(loginUrl); + } + /** + * Validate the URL parameters returned from Lit's login server and return the authentication data + * + * @returns {Promise} - Auth method object that contains OAuth token + */ + async authenticate() { + if (!window.location.href.startsWith(this.redirectUri)) { + throw new UnauthorizedException( + { + info: { + url: window.location.href, + redirectUri: this.redirectUri + } + }, + `Current url does not match provided redirect uri` + ); + } + const { provider, accessToken, state, error } = parseLoginParams( + window.location.search + ); + if (error) { + throw new UnknownError( + { + info: { + error + }, + cause: new Error(error) + }, + error ?? "Received error from discord authentication" + ); + } + if (!provider || provider !== "discord") { + throw new UnauthorizedException( + { + info: { + provider, + redirectUri: this.redirectUri + } + }, + 'OAuth provider does not match "discord"' + ); + } + if (!state || decode4(decodeURIComponent(state)) !== getStateParam()) { + throw new UnauthorizedException( + { + info: { + state, + redirectUri: this.redirectUri + } + }, + "Invalid state parameter in callback URL" + ); + } + window.history.replaceState( + null, + window.document.title, + window.location.pathname + ); + if (!accessToken) { + throw new UnauthorizedException( + { + info: { + accessToken, + redirectUri: this.redirectUri + } + }, + `Missing access token in callback URL` + ); + } + const authMethod = { + authMethodType: AUTH_METHOD_TYPE.Discord, + accessToken + }; + return authMethod; + } + /** + * Sign in using popup window + * + * @param baseURL + */ + async signInUsingPopup(baseURL) { + const width = 500; + const height = 600; + const left = window.screen.width / 2 - width / 2; + const top = window.screen.height / 2 - height / 2; + const url = await prepareLoginUrl("discord", this.redirectUri, baseURL); + const popup = window.open( + `${url}&caller=${window.location.origin}`, + "popup", + `toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, width=${width}, height=${height}, top=${top}, left=${left}` + ); + if (!popup) { + throw new UnknownError({}, "Failed to open popup window"); + } + return new Promise((resolve, reject) => { + const interval = setInterval(() => { + if (popup.closed) { + clearInterval(interval); + reject(new Error("User closed popup window")); + } + }, 1e3); + window.addEventListener("message", (event) => { + if (event.origin !== (baseURL || LIT_LOGIN_GATEWAY)) { + return; + } + const { provider, token, error } = event.data; + if (error) { + clearInterval(interval); + reject(new Error(error)); + } + if (provider === "discord" && token) { + clearInterval(interval); + popup.close(); + resolve({ + authMethodType: AUTH_METHOD_TYPE.Discord, + accessToken: token + }); + } + }); + }); + } + /** + * Get auth method id that can be used to look up and interact with + * PKPs associated with the given auth method + * + * @param {AuthMethod} authMethod - Auth method object + * + * @returns {Promise} - Auth method id + */ + async getAuthMethodId(authMethod) { + const userId = await this._fetchDiscordUser(authMethod.accessToken); + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${userId}:${this.clientId}`) + ); + return authMethodId; + } + static async authMethodId(authMethod, clientId) { + const _clientId = clientId || "1052874239658692668"; + let userId; + const meResponse = await fetch("https://discord.com/api/users/@me", { + method: "GET", + headers: { + authorization: `Bearer ${authMethod.accessToken}` + } + }); + if (meResponse.ok) { + const user = await meResponse.json(); + userId = user.id; + } else { + throw new UnknownError({}, "Unable to verify Discord account"); + } + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${userId}:${_clientId}`) + ); + return authMethodId; + } + /** + * Fetch Discord user ID + * + * @param {string} accessToken - Discord access token + * + * @returns {Promise} - Discord user ID + */ + async _fetchDiscordUser(accessToken) { + const meResponse = await fetch("https://discord.com/api/users/@me", { + method: "GET", + headers: { + authorization: `Bearer ${accessToken}` + } + }); + if (meResponse.ok) { + const user = await meResponse.json(); + return user.id; + } else { + throw new UnknownError({}, "Unable to verify Discord account"); + } + } +}; + +// packages/lit-auth-client/src/lib/providers/EthWalletProvider.ts +init_shim(); +import { SiweMessage as SiweMessage5 } from "siwe"; +var EthWalletProvider = class extends BaseProvider2 { + /** + * The domain from which the signing request is made + */ + domain; + /** + * The origin from which the signing request is made + */ + origin; + constructor(options) { + super(options); + const { domain, origin } = EthWalletProvider.getDomainAndOrigin(options); + this.domain = domain; + this.origin = origin; + } + static getDomainAndOrigin(options) { + let domain, origin; + try { + domain = options.domain || window.location.hostname; + origin = options.origin || window.location.origin; + } catch (e2) { + log( + '\u26A0\uFE0F Error getting "domain" and "origin" from window object, defaulting to "localhost" and "http://localhost"' + ); + domain = options.domain || "localhost"; + origin = options.origin || "http://localhost"; + } + return { domain, origin }; + } + /** + * Generate a wallet signature to use as an auth method + * + * @param {EthWalletAuthenticateOptions} options + * @param {string} [options.address] - Address to sign with + * @param {string} [options.chain] - Name of chain to use for signature + * @param {number} [options.expiration] - When the auth signature expires + * + * @returns {Promise} - Auth method object containing the auth signature + */ + async authenticate(options) { + if (!options) { + throw new InvalidArgumentException( + { + info: { + options + } + }, + "Options are required to authenticate with EthWalletProvider." + ); + } + return EthWalletProvider.authenticate({ + signer: options, + address: options.address, + chain: options.chain, + litNodeClient: this.litNodeClient, + expiration: options.expiration, + domain: this.domain, + origin: this.origin + }); + } + /** + * Generate a wallet signature to use as an auth method + * + * @param {EthWalletAuthenticateOptions} options + * @param {object} options.signer - Signer object + * @param {object} options.litNodeClient - LitNodeClient instance + * @param {string} [options.address] - Address to sign with + * @param {string} [options.chain] - Name of chain to use for signature + * @param {number} [options.expiration] - When the auth signature expires + * @param {string} [options.domain] - Domain from which the signing request is made + * @param {string} [options.origin] - Origin from which the signing request is made + * @returns {Promise} - Auth method object containing the auth signature + * @static + * @memberof EthWalletProvider + * + * @example + * ```typescript + * const authMethod = await EthWalletProvider.authenticate({ + * signer: wallet, + * litNodeClient: client, + * }); + * ``` + */ + static async authenticate({ + signer, + address, + chain, + litNodeClient, + expiration, + domain, + origin + }) { + chain = chain || "ethereum"; + let authSig; + address = address || await signer?.getAddress() || signer?.address; + if (!address) { + throw new InvalidArgumentException( + { + info: { + address, + signer + } + }, + `Address is required to authenticate with EthWalletProvider. Cannot find it in signer or options.` + ); + } + address = ethers_exports.utils.getAddress(address); + if (signer?.signMessage) { + const selectedChain = LIT_CHAINS[chain]; + const chainId = selectedChain?.chainId ? selectedChain.chainId : 1; + expiration = expiration || new Date(Date.now() + 1e3 * 60 * 60 * 24).toISOString(); + const { domain: resolvedDomain, origin: resolvedOrigin } = EthWalletProvider.getDomainAndOrigin({ domain, origin }); + const preparedMessage = { + domain: resolvedDomain, + uri: resolvedOrigin, + address, + version: "1", + chainId, + expirationTime: expiration, + nonce: await litNodeClient.getLatestBlockhash() + }; + const message = new SiweMessage5(preparedMessage); + const toSign = message.prepareMessage(); + const signature2 = await signer.signMessage(toSign); + authSig = { + sig: signature2, + derivedVia: "web3.eth.personal.sign", + signedMessage: toSign, + address + }; + } else { + authSig = await checkAndSignAuthMessage({ + chain, + nonce: await litNodeClient.getLatestBlockhash() + }); + } + const authMethod = { + authMethodType: AUTH_METHOD_TYPE.EthWallet, + accessToken: JSON.stringify(authSig) + }; + return authMethod; + } + /** + * Get auth method id that can be used to look up and interact with + * PKPs associated with the given auth method + * + * @param {AuthMethod} authMethod - Auth method object + * + * @returns {Promise} - Auth method id + */ + async getAuthMethodId(authMethod) { + return EthWalletProvider.authMethodId(authMethod); + } + static async authMethodId(authMethod) { + let address; + try { + address = JSON.parse(authMethod.accessToken).address; + } catch (err) { + throw new WrongParamFormat( + { + info: { + authMethod + }, + cause: err + }, + "Error when parsing auth method to generate auth method ID for Eth wallet" + ); + } + return ethers_exports.utils.keccak256(ethers_exports.utils.toUtf8Bytes(`${address}:lit`)); + } +}; + +// packages/lit-auth-client/src/lib/providers/GoogleProvider.ts +init_shim(); +import * as jose2 from "jose"; +var GoogleProvider = class extends BaseProvider2 { + /** + * The redirect URI that Lit's login server should send the user back to + */ + redirectUri; + constructor(options) { + super(options); + this.redirectUri = options.redirectUri || window.location.origin; + } + /** + * Redirect user to the Lit's Google login page + * + * @param {Function} [callback] - Optional callback to handle login URL + * @returns {Promise} - Redirects user to Lit login page + */ + async signIn(callback) { + const loginUrl = await prepareLoginUrl("google", this.redirectUri); + if (callback) { + callback(loginUrl); + } else { + window.location.assign(loginUrl); + } + } + /** + * Validate the URL parameters returned from Lit's login server and return the authentication data + * + * @returns {Promise} - Auth method object that contains OAuth token + */ + async authenticate(_, urlCheckCallback) { + const isUrlValid = urlCheckCallback ? urlCheckCallback(window.location.href, this.redirectUri) : window.location.href.startsWith(this.redirectUri); + if (!isUrlValid) { + throw new UnauthorizedException( + { + info: { + url: window.location.href, + redirectUri: this.redirectUri + } + }, + `Current url does not match provided redirect uri` + ); + } + const { provider, idToken, state, error } = parseLoginParams( + window.location.search + ); + if (error) { + throw new UnknownError( + { + info: { + error + }, + cause: new Error(error) + }, + error ?? "Received error from discord authentication" + ); + } + if (!provider || provider !== "google") { + throw new UnauthorizedException( + { + info: { + provider, + redirectUri: this.redirectUri + } + }, + 'OAuth provider does not match "google"' + ); + } + if (!state || decode4(decodeURIComponent(state)) !== getStateParam()) { + throw new UnauthorizedException( + { + info: { + state, + redirectUri: this.redirectUri + } + }, + "Invalid state parameter in callback URL" + ); + } + window.history.replaceState( + null, + window.document.title, + window.location.pathname + ); + if (!idToken) { + throw new UnauthorizedException( + { + info: { + idToken, + redirectUri: this.redirectUri + } + }, + "Missing ID token in callback URL" + ); + } + const authMethod = { + authMethodType: AUTH_METHOD_TYPE.GoogleJwt, + accessToken: idToken + }; + return authMethod; + } + /** + * Sign in using popup window + * + * @param baseURL + */ + async signInUsingPopup(baseURL) { + const width = 500; + const height = 600; + const left = window.screen.width / 2 - width / 2; + const top = window.screen.height / 2 - height / 2; + const url = await prepareLoginUrl("google", this.redirectUri, baseURL); + const popup = window.open( + `${url}&caller=${window.location.origin}`, + "popup", + `toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, width=${width}, height=${height}, top=${top}, left=${left}` + ); + if (!popup) { + throw new UnknownError({}, "Failed to open popup window"); + } + return new Promise((resolve, reject) => { + const interval = setInterval(() => { + if (popup.closed) { + clearInterval(interval); + reject(new Error("User closed popup window")); + } + }, 1e3); + window.addEventListener("message", (event) => { + if (event.origin !== (baseURL || LIT_LOGIN_GATEWAY)) { + return; + } + const { provider, token, error } = event.data; + if (error) { + clearInterval(interval); + reject(new Error(error)); + } + if (provider === "google" && token) { + clearInterval(interval); + popup.close(); + resolve({ + authMethodType: AUTH_METHOD_TYPE.GoogleJwt, + accessToken: token + }); + } + }); + }); + } + /** + * Get auth method id that can be used to look up and interact with + * PKPs associated with the given auth method + * + * @param {AuthMethod} authMethod - Auth method object + * + * @returns {Promise} - Auth method id + */ + async getAuthMethodId(authMethod) { + return GoogleProvider.authMethodId(authMethod); + } + static async authMethodId(authMethod) { + const tokenPayload = jose2.decodeJwt(authMethod.accessToken); + const userId = tokenPayload["sub"]; + const audience = tokenPayload["aud"]; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${userId}:${audience}`) + ); + return authMethodId; + } +}; + +// packages/lit-auth-client/src/lib/providers/StytchAuthFactorOtp.ts +init_shim(); + +// packages/lit-auth-client/src/lib/providers/StytchAuthFactors.ts +init_shim(); +var emailOtpAuthFactorParser2 = (parsedToken, provider) => { + const session = parsedToken[provider]; + const authFactors = session["authentication_factors"]; + let authFactor = authFactors.find((value, _index, _obj) => { + if (value.email_factor) + return value; + }); + if (!authFactor) { + throw new WrongParamFormat( + { + info: { + parsedToken, + provider + } + }, + "Could not find email authentication info in session" + ); + } + const audience = parsedToken["aud"][0]; + if (!audience) { + throw new WrongParamFormat( + { + info: { + parsedToken, + provider + } + }, + "Token does not contain an audience (project identifier), aborting" + ); + } + const userId = authFactor.email_factor.email_address; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes( + `${userId.toLowerCase()}:${audience.toLowerCase()}` + ) + ); + return authMethodId; +}; +var smsOtpAuthFactorParser2 = (parsedToken, provider) => { + const session = parsedToken[provider]; + const authFactors = session["authentication_factors"]; + let authFactor = authFactors.find((value, _index, _obj) => { + if (value.phone_number_factor) + return value; + }); + if (!authFactor) { + throw new WrongParamFormat( + { + info: { + parsedToken, + provider + } + }, + "Could not find email authentication info in session" + ); + } + const audience = parsedToken["aud"][0]; + if (!audience) { + throw new WrongParamFormat( + { + info: { + parsedToken, + provider + } + }, + "Token does not contain an audience (project identifier), aborting" + ); + } + const userId = authFactor.phone_number_factor.phone_number; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes( + `${userId.toLowerCase()}:${audience.toLowerCase()}` + ) + ); + return authMethodId; +}; +var whatsAppOtpAuthFactorParser2 = (parsedToken, provider) => { + const session = parsedToken[provider]; + const authFactors = session["authentication_factors"]; + let authFactor = authFactors.find((value, _index, _obj) => { + if (value.phone_number_factor) + return value; + }); + if (!authFactor) { + throw new WrongParamFormat( + { + info: { + parsedToken, + provider + } + }, + "Could not find email authentication info in session" + ); + } + const audience = parsedToken["aud"][0]; + if (!audience) { + throw new WrongParamFormat( + { + info: { + parsedToken, + provider + } + }, + "Token does not contain an audience (project identifier), aborting" + ); + } + const userId = authFactor.phone_number_factor.phone_number; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes( + `${userId.toLowerCase()}:${audience.toLowerCase()}` + ) + ); + return authMethodId; +}; +var totpAuthFactorParser2 = (parsedToken, provider) => { + const session = parsedToken[provider]; + const authFactors = session["authentication_factors"]; + let authFactor = authFactors.find((value, _index, _obj) => { + if (value.phone_number_factor) + return value; + }); + if (!authFactor) { + throw new WrongParamFormat( + { + info: { + parsedToken, + provider + } + }, + "Could not find email authentication info in session" + ); + } + const audience = parsedToken["aud"][0]; + if (!audience) { + throw new WrongParamFormat( + { + info: { + parsedToken, + provider + } + }, + "Token does not contain an audience (project identifier), aborting" + ); + } + const userId = authFactor.authenticator_app_factor.totp_id; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes( + `${userId.toLowerCase()}:${audience.toLowerCase()}` + ) + ); + return authMethodId; +}; + +// packages/lit-auth-client/src/lib/providers/StytchAuthFactorOtp.ts +var _StytchAuthFactorOtpProvider = class extends BaseProvider2 { + _params; + _factor; + constructor(params, config2, factor) { + super(params); + this._params = config2; + this._factor = factor; + } + /** + * Validates claims within a stytch authenticated JSON Web Token + * Will parse out the given `authentication factor` and use the transport + * for the otp code as the `user identifier` for the given auth method. + * @param options authentication option containing the authenticated token + * @returns {AuthMethod} Authentication Method for auth method type OTP + * + */ + async authenticate(options) { + return new Promise((resolve, reject) => { + if (!options) { + reject( + new Error( + "No Authentication options provided, please supply an authenticated JWT" + ) + ); + } + const accessToken = options?.accessToken; + if (!accessToken) { + reject( + new Error("No access token provided, please provide a stych auth jwt") + ); + } + const parsedToken = _StytchAuthFactorOtpProvider._parseJWT(accessToken); + const factorParser = _StytchAuthFactorOtpProvider._resolveAuthFactor( + this._factor + ); + try { + factorParser.parser(parsedToken, _StytchAuthFactorOtpProvider._provider); + } catch (e2) { + reject(e2); + } + resolve({ + authMethodType: factorParser.authMethodType, + accessToken + }); + }); + } + /** + * Get auth method id that can be used to look up and interact with + * PKPs associated with the given auth method + * + * @param {AuthMethod} authMethod - Auth method object + * + * @returns {Promise} - Auth method id + */ + async getAuthMethodId(authMethod) { + return _StytchAuthFactorOtpProvider.authMethodId(authMethod); + } + /** + * Get auth method id that can be used to look up and interact with + * PKPs associated with the given auth method. + * Will parse out the given `authentication factor` and use the transport + * for the otp code as the `user identifier` for the given auth method. + * @param {AuthMethod} authMethod - Auth method object + * + * @returns {Promise} - Auth method id + */ + static async authMethodId(authMethod) { + return new Promise((resolve, reject) => { + const accessToken = authMethod.accessToken; + const parsedToken = _StytchAuthFactorOtpProvider._parseJWT(accessToken); + let factor = "email"; + switch (authMethod.authMethodType) { + case AUTH_METHOD_TYPE.StytchEmailFactorOtp: + factor = "email"; + break; + case AUTH_METHOD_TYPE.StytchSmsFactorOtp: + factor = "sms"; + break; + case AUTH_METHOD_TYPE.StytchWhatsAppFactorOtp: + factor = "whatsApp"; + break; + case AUTH_METHOD_TYPE.StytchTotpFactorOtp: + factor = "totp"; + break; + default: + throw new InvalidArgumentException( + { + info: { + authMethodType: authMethod.authMethodType + } + }, + "Unsupport stytch auth type" + ); + } + const factorParser = this._resolveAuthFactor(factor).parser; + try { + resolve(factorParser(parsedToken, this._provider)); + } catch (e2) { + reject(e2); + } + }); + } + static _resolveAuthFactor(factor) { + switch (factor) { + case "email": + return { + parser: emailOtpAuthFactorParser2, + authMethodType: AUTH_METHOD_TYPE.StytchEmailFactorOtp + }; + case "sms": + return { + parser: smsOtpAuthFactorParser2, + authMethodType: AUTH_METHOD_TYPE.StytchSmsFactorOtp + }; + case "whatsApp": + return { + parser: whatsAppOtpAuthFactorParser2, + authMethodType: AUTH_METHOD_TYPE.StytchWhatsAppFactorOtp + }; + case "totp": + return { + parser: totpAuthFactorParser2, + authMethodType: AUTH_METHOD_TYPE.StytchTotpFactorOtp + }; + } + } + /** + * + * @param jwt token to parse + * @returns {string}- userId contained within the token message + */ + static _parseJWT(jwt) { + const parts = jwt.split("."); + if (parts.length !== 3) { + throw new WrongParamFormat( + { + info: { + jwt + } + }, + "Invalid token length" + ); + } + const body = Buffer.from(parts[1], "base64"); + const parsedBody = JSON.parse(body.toString("ascii")); + return parsedBody; + } +}; +var StytchAuthFactorOtpProvider = _StytchAuthFactorOtpProvider; +__publicField(StytchAuthFactorOtpProvider, "_provider", "https://stytch.com/session"); + +// packages/lit-auth-client/src/lib/providers/StytchOtpProvider.ts +init_shim(); +var StytchOtpProvider = class extends BaseProvider2 { + _params; + _provider = "https://stytch.com/session"; + constructor(params, config2) { + super(params); + this._params = config2; + } + /** + * Validates claims within a stytch authenticated JSON Web Token + * @param options authentication option containing the authenticated token + * @returns {AuthMethod} Authentication Method for auth method type OTP + * */ + authenticate(options) { + return new Promise((resolve, reject) => { + if (!options) { + reject( + new Error( + "No Authentication options provided, please supply an authenticated JWT" + ) + ); + } + const userId = this._params.userId ?? options.userId; + const accessToken = options?.accessToken; + if (!accessToken) { + reject( + new Error("No access token provided, please provide a stych auth jwt") + ); + } + const parsedToken = StytchOtpProvider._parseJWT(accessToken); + const audience = parsedToken["aud"][0]; + if (audience != this._params.appId) { + reject(new Error("Parsed application id does not match parameters")); + } + if (!audience) { + reject( + new Error( + "could not find project id in token body, is this a stych token?" + ) + ); + } + const session = parsedToken[this._provider]; + const authFactor = session["authentication_factors"][0]; + if (!authFactor) { + reject(new Error("Could not find authentication info in session")); + } + if (userId && userId != parsedToken["sub"]) { + reject( + new Error( + "UserId does not match token contents. is this the right token for your application?" + ) + ); + } + resolve({ + authMethodType: AUTH_METHOD_TYPE.StytchOtp, + accessToken + }); + }); + } + /** + * Get auth method id that can be used to look up and interact with + * PKPs associated with the given auth method + * + * @param {AuthMethod} authMethod - Auth method object + * + * @returns {Promise} - Auth method id + */ + async getAuthMethodId(authMethod) { + return StytchOtpProvider.authMethodId(authMethod); + } + static async authMethodId(authMethod) { + const tokenBody = StytchOtpProvider._parseJWT(authMethod.accessToken); + const userId = tokenBody["sub"]; + const orgId = tokenBody["aud"][0]; + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${userId.toLowerCase()}:${orgId.toLowerCase()}`) + ); + return authMethodId; + } + /** + * + * @param jwt token to parse + * @returns {string}- userId contained within the token message + */ + static _parseJWT(jwt) { + const parts = jwt.split("."); + if (parts.length !== 3) { + throw new WrongParamFormat( + { + info: { + jwt + } + }, + "Invalid token length" + ); + } + const body = Buffer.from(parts[1], "base64"); + const parsedBody = JSON.parse(body.toString("ascii")); + console.log("JWT body: ", parsedBody); + return parsedBody; + } +}; + +// packages/lit-auth-client/src/lib/providers/WebAuthnProvider.ts +init_shim(); +import base64url from "base64url"; +var WebAuthnProvider = class extends BaseProvider2 { + /** + * Name of relying party. Defaults to "lit" + */ + rpName; + constructor(options) { + super(options); + this.rpName = options.rpName || "lit"; + } + /** + * Generate registration options for the browser to pass to a supported authenticator + * + * @param {string} username - Username to register credential with + * + * @returns {Promise} - Options to pass to the authenticator + */ + async register(username) { + return await this.relay.generateRegistrationOptions(username); + } + /** + * Mint PKP with verified registration data + * + * @param {PublicKeyCredentialCreationOptionsJSON} options - Registration options to pass to the authenticator + * @param {MintRequestBody} [customArgs] - Extra data to overwrite default params + * + * @returns {Promise} - Mint transaction hash + */ + async verifyAndMintPKPThroughRelayer(options, customArgs) { + const { startRegistration } = await import("@simplewebauthn/browser"); + const attResp = await startRegistration(options); + const authMethodId = await this.getAuthMethodId({ + authMethodType: AUTH_METHOD_TYPE.WebAuthn, + accessToken: JSON.stringify(attResp) + }); + const authMethodPubkey = WebAuthnProvider.getPublicKeyFromRegistration(attResp); + const defaultArgs = { + keyType: 2, + permittedAuthMethodTypes: [AUTH_METHOD_TYPE.WebAuthn], + permittedAuthMethodIds: [authMethodId], + permittedAuthMethodPubkeys: [authMethodPubkey], + permittedAuthMethodScopes: [[ethers_exports.BigNumber.from("1")]], + addPkpEthAddressAsPermittedAddress: true, + sendPkpToItself: true + }; + const args = { + ...defaultArgs, + ...customArgs + }; + const body = JSON.stringify(args); + const mintRes = await this.relay.mintPKP(body); + if (!mintRes || !mintRes.requestId) { + throw new UnknownError( + { + info: { + mintRes + } + }, + "Missing mint response or request ID from relay server" + ); + } + return mintRes.requestId; + } + /** + * @override + * This method is not applicable for WebAuthnProvider and should not be used. + * Use verifyAndMintPKPThroughRelayer instead to mint a PKP for a WebAuthn credential. + * + * @throws {Error} - Throws an error when called for WebAuthnProvider. + */ + async mintPKPThroughRelayer() { + throw new RemovedFunctionError( + { + info: { + method: "mintPKPThroughRelayer" + } + }, + "Use verifyAndMintPKPThroughRelayer for WebAuthnProvider instead." + ); + } + /** + * Authenticate with a WebAuthn credential and return the relevant authentication data + * + * @returns {Promise} - Auth method object containing WebAuthn authentication data + */ + async authenticate() { + const blockHash = await this.litNodeClient.getLatestBlockhash(); + const blockHashBytes = ethers_exports.utils.arrayify(blockHash); + const rpId = getRPIdFromOrigin(window.location.origin); + const authenticationOptions = { + challenge: base64url(Buffer.from(blockHashBytes)), + timeout: 6e4, + userVerification: "required", + rpId + }; + const { startAuthentication } = await import("@simplewebauthn/browser"); + const authenticationResponse = await startAuthentication( + authenticationOptions + ); + const actualAuthenticationResponse = JSON.parse( + JSON.stringify(authenticationResponse) + ); + const userHandle = authenticationResponse.response?.userHandle; + if (userHandle) { + actualAuthenticationResponse.response.userHandle = base64url.encode(userHandle); + } + const authMethod = { + authMethodType: AUTH_METHOD_TYPE.WebAuthn, + accessToken: JSON.stringify(actualAuthenticationResponse) + }; + return authMethod; + } + /** + * Get auth method id that can be used to look up and interact with + * PKPs associated with the given auth method + * + * @param {AuthMethod} authMethod - Auth method object + * + * @returns {Promise} - Auth method id + */ + async getAuthMethodId(authMethod) { + return WebAuthnProvider.authMethodId(authMethod, this.rpName); + } + static async authMethodId(authMethod, rpName) { + let credentialId; + const rpNameToUse = rpName || "lit"; + try { + credentialId = JSON.parse(authMethod.accessToken).rawId; + } catch (err) { + throw new WrongParamFormat( + { + info: { + authMethod + }, + cause: err + }, + "Error when parsing auth method to generate auth method ID for Eth wallet" + ); + } + const authMethodId = ethers_exports.utils.keccak256( + ethers_exports.utils.toUtf8Bytes(`${credentialId}:${rpNameToUse}`) + ); + return authMethodId; + } + /** + * Parse the WebAuthn registration response to get the WebAuthn credential public key + * + * @param {RegistrationResponseJSON} attResp - WebAuthn registration response + * + * @returns {string} - WebAuthn credential public key in hex format + */ + static getPublicKeyFromRegistration(attResp) { + let publicKey; + try { + const attestationBuffer = Buffer.from( + attResp.response.attestationObject, + "base64" + ); + const authenticationResponse = parseAuthenticatorData(attestationBuffer); + const publicKeyCoseBuffer = authenticationResponse.attestedCredentialData.credentialPublicKey; + publicKey = ethers_exports.utils.hexlify( + ethers_exports.utils.arrayify(publicKeyCoseBuffer) + ); + } catch (e2) { + throw new UnknownError( + { + cause: e2 + }, + "Error while decoding WebAuthn registration response for public key retrieval. Attestation response not encoded as expected" + ); + } + return publicKey; + } +}; + +// packages/lit-auth-client/src/lib/utils.ts +var STATE_PARAM_KEY = "lit-state-param"; +var LIT_LOGIN_GATEWAY = "https://login.litgateway.com"; +async function prepareLoginUrl(provider, redirectUri, baseUrl = LIT_LOGIN_GATEWAY) { + const loginUrl = `${baseUrl}${getLoginRoute(provider)}`; + const state = encode5(await setStateParam()); + const authParams = { + app_redirect: redirectUri + }; + const queryAuthParams = createQueryParams(authParams); + return `${loginUrl}?${queryAuthParams}&state=${state}`; +} +function getLoginRoute(provider) { + switch (provider) { + case "google": + return "/auth/google"; + case "discord": + return "/auth/discord"; + default: + throw new InvalidArgumentException( + { + info: { + provider + } + }, + `No login route available for the given provider "${provider}".` + ); + } +} +function createQueryParams(params) { + const filteredParams = Object.keys(params).filter((k) => typeof params[k] !== "undefined").reduce((acc, key2) => ({ ...acc, [key2]: params[key2] }), {}); + return new URLSearchParams(filteredParams).toString(); +} +function parseLoginParams(search) { + const searchParams = new URLSearchParams(search); + const provider = searchParams.get("provider"); + const accessToken = searchParams.get("access_token"); + const idToken = searchParams.get("id_token"); + const state = searchParams.get("state"); + const error = searchParams.get("error"); + return { + provider, + accessToken, + idToken, + state, + error + }; +} +async function setStateParam() { + const state = Math.random().toString(36).substring(2, 17); + sessionStorage.setItem(STATE_PARAM_KEY, state); + return state; +} +function getStateParam() { + return sessionStorage.getItem(STATE_PARAM_KEY); +} +function encode5(value) { + return window.btoa(value); +} +function decode4(value) { + return window.atob(value); +} +function getRPIdFromOrigin(origin) { + const newOrigin = origin.replace(/(^\w+:|^)\/\//, ""); + return newOrigin.replace(/:\d+$/, ""); +} +function parseAuthenticatorData(authDataBuffer) { + try { + const authDataBufferDecoded = cbor.decode(authDataBuffer); + const authenticatorData = {}; + const authData = authDataBufferDecoded.authData; + authenticatorData.rpIdHash = authData.slice(0, 32); + authenticatorData.flags = authData[32]; + authenticatorData.signCount = authData[33] << 24 | authData[34] << 16 | authData[35] << 8 | authData[36]; + if (authenticatorData.flags & 64) { + const attestedCredentialData = {}; + attestedCredentialData["aaguid"] = unparse(authData.slice(37, 53)); + attestedCredentialData["credentialIdLength"] = authData[53] << 8 | authData[54]; + attestedCredentialData["credentialId"] = authData.slice( + 55, + 55 + attestedCredentialData["credentialIdLength"] + ); + let publicKeyCoseBufferCbor = authData.slice( + 55 + attestedCredentialData["credentialIdLength"], + authData.length + ); + const publicKey = cbor.decode(publicKeyCoseBufferCbor); + publicKeyCoseBufferCbor = cbor.encode(publicKey); + attestedCredentialData["credentialPublicKey"] = publicKeyCoseBufferCbor; + authenticatorData.attestedCredentialData = attestedCredentialData; + } + if (authenticatorData.flags & 128) { + let extensionDataCbor; + if (authenticatorData.attestedCredentialData) { + extensionDataCbor = cbor.decode( + // decodeAllSync( + authData.slice( + 55 + authenticatorData.attestedCredentialData.credentialIdLength, + authData.length + ) + ); + extensionDataCbor = extensionDataCbor[1]; + } else { + extensionDataCbor = cbor.decode(authData.slice(37, authData.length)); + } + authenticatorData.extensionData = cbor.encode(extensionDataCbor).toString("base64"); + } + return authenticatorData; + } catch (e2) { + throw new UnknownError( + { + info: { + authDataBuffer + }, + cause: e2 + }, + "Authenticator Data could not be parsed" + ); + } +} +function unparse(buf) { + const _byteToHex = []; + const _hexToByte = {}; + for (let it = 0; it < 256; it++) { + _byteToHex[it] = (it + 256).toString(16).substr(1); + _hexToByte[_byteToHex[it]] = it; + } + let i2 = 0; + const bth = _byteToHex; + return bth[buf[i2++]] + bth[buf[i2++]] + bth[buf[i2++]] + bth[buf[i2++]] + "-" + bth[buf[i2++]] + bth[buf[i2++]] + "-" + bth[buf[i2++]] + bth[buf[i2++]] + "-" + bth[buf[i2++]] + bth[buf[i2++]] + "-" + bth[buf[i2++]] + bth[buf[i2++]] + bth[buf[i2++]] + bth[buf[i2++]] + bth[buf[i2++]] + bth[buf[i2++]]; +} +function log2(...args) { + const logger48 = getLoggerbyId("auth-client"); + logger48.debug(...args); +} +async function getAuthIdByAuthMethod2(authMethod) { + let authId; + switch (authMethod.authMethodType) { + case AUTH_METHOD_TYPE.EthWallet: + authId = await EthWalletProvider.authMethodId(authMethod); + break; + case AUTH_METHOD_TYPE.Discord: + authId = await DiscordProvider.authMethodId(authMethod); + break; + case AUTH_METHOD_TYPE.WebAuthn: + authId = await WebAuthnProvider.authMethodId(authMethod); + break; + case AUTH_METHOD_TYPE.GoogleJwt: + authId = await GoogleProvider.authMethodId(authMethod); + break; + case AUTH_METHOD_TYPE.StytchOtp: + authId = await StytchOtpProvider.authMethodId(authMethod); + break; + case AUTH_METHOD_TYPE.StytchEmailFactorOtp: + case AUTH_METHOD_TYPE.StytchSmsFactorOtp: + case AUTH_METHOD_TYPE.StytchTotpFactorOtp: + case AUTH_METHOD_TYPE.StytchWhatsAppFactorOtp: + authId = await StytchAuthFactorOtpProvider.authMethodId(authMethod); + break; + default: + log2(`unsupported AuthMethodType: ${authMethod.authMethodType}`); + throw new InvalidArgumentException( + { + info: { + authMethod + } + }, + `Unsupported auth method type: ${authMethod.authMethodType}` + ); + } + return authId; +} + +// packages/lit-auth-client/src/lib/providers/AppleProvider.ts +import * as jose3 from "jose"; + +// packages/lit-auth-client/src/lib/relay.ts +init_shim(); +var LitRelay = class { + /** URL for Lit's relay server */ + static getRelayUrl(litNetwork) { + const relayerUrl = RELAYER_URL_BY_NETWORK[litNetwork]; + if (!relayerUrl) { + throw new WrongNetworkException( + { + info: { + litNetwork + } + }, + `Relay URL not found for network ${litNetwork}` + ); + } + return relayerUrl; + } + /** + * URL for Lit's relay server + */ + relayUrl; + /** + * API key for Lit's relay server + */ + relayApiKey; + /** + * Route for minting PKP + */ + mintRoute = "/mint-next-and-add-auth-methods"; + /** + * Route for fetching PKPs + */ + fetchRoute = "/fetch-pkps-by-auth-method"; + /** + * Create a Relay instance + * + * @param {LitRelayConfig} config + * @param {string} [config.relayApiKey] - API key for Lit's relay server + * @param {string} [config.relayUrl] - URL for Lit's relay server. If not provided, will default to the last dev relay server. + */ + constructor(config2) { + this.relayUrl = config2.relayUrl || LitRelay.getRelayUrl(LIT_NETWORK.DatilDev); + this.relayApiKey = config2.relayApiKey || ""; + log2("Lit's relay server URL:", this.relayUrl); + } + /** + * Mint a new PKP for the given auth method + * + * @param {string} body - Body of the request + * + * @returns {Promise} Response from the relay server + */ + async mintPKP(body) { + const response = await fetch(`${this.relayUrl}${this.mintRoute}`, { + method: "POST", + headers: { + "api-key": this.relayApiKey, + "Content-Type": "application/json" + }, + body + }); + if (response.status < 200 || response.status >= 400) { + log2("Something wrong with the API call", await response.json()); + const err = new Error("Unable to mint PKP through relay server"); + throw err; + } else { + const resBody = await response.json(); + log2("Successfully initiated minting PKP with relayer"); + return resBody; + } + } + /** + * Mints a new pkp with all AuthMethods provided. Allows for permissions and flags to be set separately. + * If no permissions are provided then each auth method will be assigned `1` for sign anything + * If no flags are provided then `sendPkpToitself` will be false, and `addPkpEthAddressAsPermittedAddress` will be true + * It is then up to the implementor to transfer the pkp nft to the pkp address. + * **note** When adding permissions, each permission should be added in the same order the auth methods are ordered + * + * @throws {Error} - Throws an error if no AuthMethods are given + * @param {AuthMethod[]} authMethods - AuthMethods authentication methods to be added to the pkp + * @param {{ pkpPermissionScopes?: number[][]; sendPkpToitself?: boolean; addPkpEthAddressAsPermittedAddress?: boolean;}} options + * + * @returns {Promise<{pkpTokenId?: string; pkpEthAddress?: string; pkpPublicKey?: string}>} pkp information + */ + async mintPKPWithAuthMethods(authMethods, options) { + if (authMethods.length < 1) { + throw new InvalidParamType( + { + info: { + authMethods, + options + } + }, + "Must provide at least one auth method" + ); + } + if (!options.pkpPermissionScopes || options.pkpPermissionScopes.length < 1) { + options.pkpPermissionScopes = []; + for (let i2 = 0; i2 < authMethods.length; i2++) { + options.pkpPermissionScopes.push([ + ethers_exports.BigNumber.from("1").toNumber() + ]); + } + } + const reqBody = { + keyType: 2, + permittedAuthMethodTypes: authMethods.map((value) => { + return value.authMethodType; + }), + permittedAuthMethodScopes: options.pkpPermissionScopes, + addPkpEthAddressAsPermittedAddress: options.addPkpEthAddressAsPermittedAddress ?? true, + sendPkpToItself: options.sendPkpToitself ?? false + }; + const permittedAuthMethodIds = []; + const permittedAuthMethodPubkeys = []; + for (const authMethod of authMethods) { + const id2 = await getAuthIdByAuthMethod2(authMethod); + permittedAuthMethodIds.push(id2); + if (authMethod.authMethodType === AUTH_METHOD_TYPE.WebAuthn) { + permittedAuthMethodPubkeys.push( + WebAuthnProvider.getPublicKeyFromRegistration( + JSON.parse(authMethod.accessToken) + ) + ); + } else { + permittedAuthMethodPubkeys.push("0x"); + } + } + reqBody.permittedAuthMethodIds = permittedAuthMethodIds; + reqBody.permittedAuthMethodPubkeys = permittedAuthMethodPubkeys; + const mintRes = await this.mintPKP(JSON.stringify(reqBody)); + if (!mintRes || !mintRes.requestId) { + throw new NetworkError( + { + info: { + mintRes + } + }, + `Missing mint response or request ID from mint response ${mintRes.error}` + ); + } + const pollerResult = await this.pollRequestUntilTerminalState( + mintRes.requestId + ); + return { + pkpTokenId: pollerResult.pkpTokenId, + pkpPublicKey: pollerResult.pkpPublicKey, + pkpEthAddress: pollerResult.pkpEthAddress + }; + } + /** + * Poll the relay server for status of minting request + * + * @param {string} requestId - Request ID to poll, likely the minting transaction hash + * @param {number} [pollInterval] - Polling interval in milliseconds + * @param {number} [maxPollCount] - Maximum number of times to poll + * + * @returns {Promise} Response from the relay server + */ + async pollRequestUntilTerminalState(requestId, pollInterval = 15e3, maxPollCount = 20) { + for (let i2 = 0; i2 < maxPollCount; i2++) { + const response = await fetch( + `${this.relayUrl}/auth/status/${requestId}`, + { + method: "GET", + headers: { + "api-key": this.relayApiKey + } + } + ); + if (response.status < 200 || response.status >= 400) { + log2("Something wrong with the API call", await response.json()); + const err2 = new Error( + `Unable to poll the status of this mint PKP transaction: ${requestId}` + ); + throw err2; + } + const resBody = await response.json(); + log2("Response OK", { body: resBody }); + if (resBody.error) { + log2("Something wrong with the API call", { + error: resBody.error + }); + const err2 = new Error(resBody.error); + throw err2; + } else if (resBody.status === "Succeeded") { + log2("Successfully authed", { ...resBody }); + return resBody; + } + await new Promise((r3) => setTimeout(r3, pollInterval)); + } + const err = new Error("Polling for mint PKP transaction status timed out"); + throw err; + } + /** + * Fetch PKPs associated with the given auth method + * + * @param {string} body - Body of the request + * + * @returns {Promise} Response from the relay server + */ + async fetchPKPs(body) { + const response = await fetch(`${this.relayUrl}${this.fetchRoute}`, { + method: "POST", + headers: { + "api-key": this.relayApiKey, + "Content-Type": "application/json" + }, + body + }); + if (response.status < 200 || response.status >= 400) { + console.warn("Something wrong with the API call", await response.json()); + const err = new Error("Unable to fetch PKPs through relay server"); + throw err; + } else { + const resBody = await response.json(); + console.log("Successfully fetched PKPs with relayer"); + return resBody; + } + } + /** + * Generate options for registering a new credential to pass to the authenticator + * + * @param {string} [username] - Optional username to associate with the credential + * + * @returns {Promise} Registration options for the browser to pass to the authenticator + */ + async generateRegistrationOptions(username) { + let url = `${this.relayUrl}/auth/webauthn/generate-registration-options`; + if (username && username !== "") { + url = `${url}?username=${encodeURIComponent(username)}`; + } + const response = await fetch(url, { + method: "GET", + headers: { + "api-key": this.relayApiKey + } + }); + if (response.status < 200 || response.status >= 400) { + const err = new Error( + `Unable to generate registration options: ${response}` + ); + throw err; + } + const registrationOptions = await response.json(); + return registrationOptions; + } + /** + * returns the relayUrl + */ + getUrl() { + return this.relayUrl; + } +}; + +// local-tests/setup/tinny-person.ts +var TinnyPerson = class { + privateKey; + wallet; + siweMessage; + authSig; + authMethod; + contractsClient; + // public capacityTokenId: string; + // public capacityDelegationAuthSig: AuthSig; + pkp; + authMethodOwnedPkp; + // Pass this to data to sign + loveLetter = ethers_exports.utils.arrayify( + ethers_exports.utils.keccak256([1, 2, 3, 4, 5]) + ); + provider; + envConfig; + constructor({ + privateKey, + envConfig + }) { + this.envConfig = envConfig; + this.privateKey = privateKey; + this.provider = new ethers_exports.providers.StaticJsonRpcProvider({ + url: this.envConfig.rpc, + skipFetchSetup: true + }); + this.wallet = new ethers_exports.Wallet(privateKey, this.provider); + } + async getAuthMethodId() { + return EthWalletProvider.authMethodId(this.authMethod); + } + /** + * FIXME: Enabling this is causing the test to fail + * Switches the current wallet to a new funding wallet by creating a new funding wallet, + * funding it with a small amount of ethers, and updating the current wallet to the new one. + * + * @private + * @returns {Promise} A promise that resolves once the wallet has been switched. + */ + async _switchWallet() { + const fundingWallet = ethers_exports.Wallet.createRandom().connect(this.provider); + if (this.envConfig.network != LIT_NETWORK.Custom) { + const balance = await this.wallet.getBalance(); + console.log( + "[\u{10B3A}\u{1F9EA} Tinny Person\u{10B3A}] Wallet balance:", + ethers_exports.utils.formatEther(balance) + ); + const transferTx = await this.wallet.sendTransaction({ + to: fundingWallet.address, + value: ethers_exports.utils.parseEther("0.00001") + }); + const transferReciept = await transferTx.wait(); + console.log( + "[\u{10B3A}\u{1F9EA} Tinny Person\u{10B3A}] Transfered Assets for person tx: ", + transferReciept.transactionHash + ); + this.wallet = fundingWallet; + } + } + async spawn() { + console.log("[\u{10B3A}\u{1F9EA} Tinny Person\u{10B3A}] Spawning person:", this.wallet.address); + this.siweMessage = await createSiweMessage({ + nonce: await this.envConfig.litNodeClient.getLatestBlockhash(), + walletAddress: this.wallet.address + }); + this.authSig = await generateAuthSig({ + signer: this.wallet, + toSign: this.siweMessage + }); + console.log( + "[\u{10B3A}\u{1F9EA} Tinny Person\u{10B3A}] Crafting an authMethod from the authSig for the eth wallet auth method..." + ); + this.authMethod = await EthWalletProvider.authenticate({ + signer: this.wallet, + litNodeClient: this.envConfig.litNodeClient + }); + if (this.envConfig.network === LIT_NETWORK.Custom) { + const networkContext = this.envConfig.contractContext; + this.contractsClient = new LitContracts({ + signer: this.wallet, + debug: this.envConfig.processEnvs.DEBUG, + rpc: this.envConfig.processEnvs.LIT_RPC_URL, + // anvil rpc + customContext: networkContext, + network: LIT_NETWORK.Custom + }); + } else { + this.contractsClient = new LitContracts({ + signer: this.wallet, + debug: this.envConfig.processEnvs.DEBUG, + network: this.envConfig.network + }); + } + await this.contractsClient.connect(); + console.log("[\u{10B3A}\u{1F9EA} Tinny Person\u{10B3A}] Minting a PKP..."); + const walletMintRes = await this.contractsClient.pkpNftContractUtils.write.mint(); + this.pkp = walletMintRes.pkp; + console.log( + "[\u{10B3A}\u{1F9EA} Tinny Person\u{10B3A}] Minting a PKP with eth wallet auth method..." + ); + this.authMethodOwnedPkp = (await this.contractsClient.mintWithAuth({ + authMethod: this.authMethod, + scopes: [AUTH_METHOD_SCOPE.SignAnything] + })).pkp; + console.log( + "[\u{10B3A}\u{1F9EA} Tinny Person\u{10B3A}] \u{1F423} TinnyPerson spawned:", + this.wallet.address + ); + } + /** + * ==================================== + * Mint a Capacity Credits NFT + * ==================================== + */ + async mintCapacityCreditsNFT() { + console.log("[\u{10B3A}\u{1F9EA} Tinny Person\u{10B3A}] Mint a Capacity Credits NFT "); + const capacityTokenId = (await this.contractsClient.mintCapacityCreditsNFT({ + requestsPerKilosecond: this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2 + })).capacityTokenIdStr; + return capacityTokenId; + } + /** + * ==================================== + * Mint a Capacity Credits NFT and get a capacity delegation authSig with it + * ==================================== + */ + async createCapacityDelegationAuthSig(addresses = []) { + console.log( + "[\u{10B3A}\u{1F9EA} Tinny Person\u{10B3A}] Mint a Capacity Credits NFT and get a capacity delegation authSig with it" + ); + const capacityTokenId = (await this.contractsClient.mintCapacityCreditsNFT({ + requestsPerKilosecond: this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2 + })).capacityTokenIdStr; + this.contractsClient.signer = this.wallet; + await this.contractsClient.connect(); + return (await this.envConfig.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: this.wallet, + capacityTokenId, + ...addresses.length && { delegateeAddresses: addresses } + })).capacityDelegationAuthSig; + } +}; + +// local-tests/setup/shiva-client.ts +init_shim(); +var ShivaError = class extends Error { + constructor(shivaResponse) { + let message = `An error occurred on request to testnet with id: ${shivaResponse.testnetId}`; + for (const error of shivaResponse.errors) { + message += " " + error; + } + super(message); + this.name = "ShivaError"; + this.message = message; + } +}; +var TestnetClient = class { + _id; + _info; + _processEnvs; + _currentState; + constructor(id2, envs) { + this._processEnvs = envs; + this._id = id2; + } + /** + Returns info on a given testnet instance + if information cannot be accessed we retured undefined + @returns TestNetInfo | undefined + */ + get Info() { + return this._info; + } + get ContractContext() { + const testNetConfig = this.Info; + if (!testNetConfig) { + return void 0; + } + const contractResolverAbi = testNetConfig.contractResolverAbi; + const contractResolverAddress = testNetConfig.contractAddresses[`contractResolver`]; + const networkContext = { + abi: JSON.parse(contractResolverAbi), + resolverAddress: contractResolverAddress, + provider: new ethers_exports.providers.StaticJsonRpcProvider({ + url: `http://${testNetConfig.rpcUrl}`, + skipFetchSetup: true + }), + environment: 0, + // test deployment uses env value 0 in test common + contractContext: { + Allowlist: {}, + Multisender: {}, + Staking: { + abi: JSON.parse(testNetConfig.contractAbis.staking) + }, + StakingBalances: { + abi: JSON.parse(testNetConfig.contractAbis.stakingBalances) + }, + PKPNFT: { + abi: JSON.parse(testNetConfig.contractAbis.pkpnft) + }, + PKPPermissions: { + abi: JSON.parse(testNetConfig.contractAbis.pkpPermissions) + }, + PKPHelper: { + abi: JSON.parse(testNetConfig.contractAbis.pkpHelper) + }, + LITToken: { + abi: JSON.parse(testNetConfig.contractAbis.litToken) + }, + PKPNFTMetadata: {}, + RateLimitNFT: {}, + PubkeyRouter: {} + } + }; + return networkContext; + } + /** + * Polls a given testnet for the ACTIVE state + * polls on a 500 milisecond interval + */ + async pollTestnetForActive() { + let state = "Busy"; + while (state != "Active" && state != `UNKNOWN`) { + const res = await fetch( + this._processEnvs.TESTNET_MANAGER_URL + "/test/poll/testnet/" + this._id + ); + const stateRes = await _processTestnetResponse(res); + state = stateRes.body; + console.log("found state to be", state); + await new Promise((res2, _) => { + setTimeout(() => { + res2(); + }, 500); + }); + } + return state; + } + /** + * Returns the config for a given testnet + */ + async getTestnetConfig() { + const res = await fetch( + this._processEnvs.TESTNET_MANAGER_URL + "/test/get/info/testnet/" + this._id + ); + const testnetInfoRes = await _processTestnetResponse(res); + this._info = testnetInfoRes.body; + return testnetInfoRes; + } + /** + * Will wait for the NEXT epoch and return a resposne when the epoch has fully transitioned. + * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. + */ + async transitionEpochAndWait() { + const res = await fetch( + this._processEnvs.TESTNET_MANAGER_URL + "/test/action/transition/epoch/wait/" + this._id + ); + let transitionEpochAndWaitRes = _processTestnetResponse(res); + return transitionEpochAndWaitRes; + } + /** + * Stops a random peer and waits for the next epoc to transiton. + * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. + */ + async stopRandomNetworkPeerAndWaitForNextEpoch() { + const res = await fetch( + this._processEnvs.TESTNET_MANAGER_URL + "/test/action/stop/random/wait/" + this._id + ); + return _processTestnetResponse(res); + } + /* + Stops the testnet + */ + async stopTestnet() { + console.log("stopping testnet with id:", this._id); + const res = await fetch( + this._processEnvs.TESTNET_MANAGER_URL + "/test/delete/testnet/" + this._id + ); + return _processTestnetResponse(res); + } +}; +var ShivaClient = class { + _clients; + processEnvs = { + STOP_TESTNET: process.env[`STOP_TESTNET`] === "true", + TESTNET_MANAGER_URL: process.env["TESTNET_MANAGER_URL"] || "http://0.0.0.0:8000", + USE_LIT_BINARIES: process.env[`USE_LIT_BINARIES`] === `true`, + LIT_NODE_BINARY_PATH: process.env["LIT_NODE_BINARY_PATH"] || `./../../lit-assets/rust/lit-node/target/debug/lit_node`, + LIT_ACTION_BINARY_PATH: process.env["LIT_ACTION_BINARY_PATH"] || `./../../lit-assets/rust/lit-actions/target/debug/lit_actions` + }; + constructor() { + this._clients = /* @__PURE__ */ new Map(); + console.log("Shiva environment loaded current config: ", this.processEnvs); + } + /** + * Used to start an instance of a lit network through the Lit Testnet Manager + * if an instance exists, we will just take it as we optimistically assume it will not be shut down in the test life time. + * If an instance does not exist then we create one + */ + async startTestnetManager(createReq) { + const existingTestnetResp = await fetch( + this.processEnvs.TESTNET_MANAGER_URL + "/test/get/testnets" + ); + const existingTestnets = await existingTestnetResp.json(); + if (existingTestnets.length > 0) { + this._clients.set( + existingTestnets[0], + new TestnetClient(existingTestnets[0], this.processEnvs) + ); + return this._clients.get(existingTestnets[0]); + } else { + console.log( + "lit node binary path: ", + this.processEnvs.LIT_NODE_BINARY_PATH + ); + console.log( + "lit action server binary path: ", + this.processEnvs.LIT_ACTION_BINARY_PATH + ); + let body = createReq ?? { + nodeCount: 3, + pollingInterval: "2000", + epochLength: 9e4 + }; + if (this.processEnvs.USE_LIT_BINARIES) { + body.customBuildPath = this.processEnvs.LIT_NODE_BINARY_PATH; + body.litActionServerCustomBuildPath = this.processEnvs.LIT_ACTION_BINARY_PATH; + } + console.log("Testnet create args: ", body); + const createTestnetResp = await fetch( + this.processEnvs.TESTNET_MANAGER_URL + "/test/create/testnet", + { + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(body) + } + ); + const createTestnet = await _processTestnetResponse( + createTestnetResp + ); + this._clients.set( + createTestnet.testnetId, + new TestnetClient(createTestnet.testnetId, this.processEnvs) + ); + return this._clients.get(createTestnet.testnetId); + } + } +}; +async function _processTestnetResponse(response) { + let createTestnet; + try { + createTestnet = await response.json(); + } catch (err) { + let message = await response.text(); + throw new Error("Error while performing testnet request: " + message); + } + if (response.status === 500) { + throw new ShivaError(createTestnet); + } + return createTestnet; +} + +// local-tests/setup/tinny-utils.ts +init_shim(); +import { importer } from "ipfs-unixfs-importer"; +import { Buffer as Buffer2 } from "buffer"; +async function stringToIpfsHash(input) { + const blockput = { + put: async (block) => { + return block.cid; + } + }; + const content = Buffer2.from(input); + const files = importer([{ content }], blockput); + const result = (await files.next()).value; + const ipfsHash = result.cid.toString(); + if (!ipfsHash.startsWith("Qm")) { + throw new Error("Generated hash does not start with Qm"); + } + return ipfsHash; +} +function randomSolanaPrivateKey() { + const BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + const SOLANA_PRIVATE_KEY_LENGTH = 88; + let result = ""; + const charactersLength = BASE58_ALPHABET.length; + for (let i2 = 0; i2 < SOLANA_PRIVATE_KEY_LENGTH; i2++) { + const randomIndex = Math.floor(Math.random() * charactersLength); + result += BASE58_ALPHABET.charAt(randomIndex); + } + return result; +} +function withTimeout(promise, ms) { + const timeout = new Promise( + (_, reject) => setTimeout(() => reject(new Error("Timed out")), ms) + ); + return Promise.race([promise, timeout]); +} +function isErrorWithMessage(error) { + return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string"; +} +function toErrorWithMessage(maybeError) { + if (isErrorWithMessage(maybeError)) + return maybeError; + try { + return new Error(JSON.stringify(maybeError)); + } catch { + return new Error(String(maybeError)); + } +} + +// local-tests/setup/tinny-environment.ts +console.log("checking env", process.env["DEBUG"]); +var TinnyEnvironment = class { + network; + /** + * Environment variables used in the process. + */ + processEnvs = { + MAX_ATTEMPTS: parseInt(process.env["MAX_ATTEMPTS"]) || 1, + TEST_TIMEOUT: parseInt(process.env["TEST_TIMEOUT"]) || 45e3, + NETWORK: process.env["NETWORK"] || LIT_NETWORK.Custom, + DEBUG: process.env["DEBUG"] === "true", + REQUEST_PER_KILOSECOND: parseInt(process.env["REQUEST_PER_KILOSECOND"]) || process.env["NETWORK"] === "datil-dev" ? 1 : 200, + LIT_RPC_URL: process.env["LIT_RPC_URL"], + WAIT_FOR_KEY_INTERVAL: parseInt(process.env["WAIT_FOR_KEY_INTERVAL"]) || 3e3, + BOOTSTRAP_URLS: process.env["BOOTSTRAP_URLS"]?.split(",") || [ + "http://127.0.0.1:7470", + "http://127.0.0.1:7471", + "http://127.0.0.1:7472" + ], + TIME_TO_RELEASE_KEY: parseInt(process.env["TIME_TO_RELEASE_KEY"]) || 1e4, + RUN_IN_BAND: process.env["RUN_IN_BAND"] === "true", + RUN_IN_BAND_INTERVAL: parseInt(process.env["RUN_IN_BAND_INTERVAL"]) || 5e3, + // Available Accounts + // ================== + // (1) "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" (10000.000000000000000000 ETH) + // (2) "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" (10000.000000000000000000 ETH) + // (3) "0x90F79bf6EB2c4f870365E785982E1f101E93b906" (10000.000000000000000000 ETH) + // (4) "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65" (10000.000000000000000000 ETH) + // (5) "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc" (10000.000000000000000000 ETH) + // (6) "0x976EA74026E726554dB657fA54763abd0C3a0aa9" (10000.000000000000000000 ETH) + // (7) "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955" (10000.000000000000000000 ETH) + // (8) "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f" (10000.000000000000000000 ETH) + // (9) "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720" (10000.000000000000000000 ETH) + PRIVATE_KEYS: process.env["PRIVATE_KEYS"]?.split(",") || [ + "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d", + "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a", + "0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6", + "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a", + "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba", + "0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e", + "0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356", + "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97", + "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6" + ], + KEY_IN_USE: new Array(), + NO_SETUP: process.env["NO_SETUP"] === "true", + USE_SHIVA: process.env["USE_SHIVA"] === "true", + NETWORK_CONFIG: process.env["NETWORK_CONFIG"] ?? "./networkContext.json" + }; + litNodeClient; + contractsClient; + rpc; + superCapacityDelegationAuthSig; + bareEthAuthSig; + bareSolAuthSig = { + sig: "706047fcab06ada3cbfeb6990617c1705d59bafb20f5f1c8103d764fb5eaec297328d164e2b891095866b28acc1ab2df288a8729cf026228ef3c4970238b190a", + derivedVia: "solana.signMessage", + signedMessage: "I am creating an account to use Lit Protocol at 2024-05-08T16:39:44.481Z", + address: "F7r6ENi6dqH8SnMYZdK3YxWAQ4cwfSNXZyMzbea5fbS1" + }; + bareCosmosAuthSig = { + sig: "dE7J8oaWa8zECuMpaI/IVfJXGpLAO1paGLho+/dmtaQkN7Sh1lmJLAdYqZchDyYhQcg+nqfaoEOzLig3CPlosg==", + derivedVia: "cosmos.signArbitrary", + signedMessage: "8c857343720203e3f52606409e6818284186a614e74026998f89e7417eed4d4b", + address: "cosmos14wp2s5kv07lt220rzfae57k73yv9z2azrmulku" + }; + testnet; + //=========== PRIVATE MEMBERS =========== + _shivaClient = new ShivaClient(); + _contractContext; + constructor(network) { + this.network = network || this.processEnvs.NETWORK; + if (Object.values(LIT_NETWORK).indexOf(this.network) === -1) { + throw new Error( + `Invalid network environment. Please use one of ${Object.values( + LIT_NETWORK + )}` + ); + } + this.processEnvs.KEY_IN_USE = new Array( + this.processEnvs.PRIVATE_KEYS.length + ).fill(false); + if (this.processEnvs.LIT_RPC_URL) { + this.rpc = this.processEnvs.LIT_RPC_URL; + } else if (this.network in RPC_URL_BY_NETWORK) { + this.rpc = RPC_URL_BY_NETWORK[this.network]; + } else { + const availableNetworks = Object.keys(RPC_URL_BY_NETWORK).join(", "); + throw new Error( + `No RPC URL found for network "${this.network}". Available networks are: ${availableNetworks}` + ); + } + console.log( + "[\u{10B3A}\u{1F9EA} Tinny Environment\u{10B3A}] Done configuring environment current config: ", + this.processEnvs + ); + } + world = /* @__PURE__ */ new Map(); + /** + * Retrieves an available private key from a list, marking it as in use and scheduling + * its automatic release. If no unused keys are available, it waits for a set interval + * before rechecking. + * + * This function loops until it finds an unused key, marks it, and returns the key with + * its index. If all keys are in use, it logs a wait message and pauses before retrying. + * + * Outputs: + * - privateKey: The selected private key. + * - index: The index of the selected key. + * + * Environment variables required: + * - KEY_IN_USE: Boolean array indicating key usage. + * - PRIVATE_KEYS: Array of key strings. + * - TIME_TO_RELEASE_KEY: Milliseconds until a key is automatically released. + * - WAIT_FOR_KEY_INTERVAL: Wait time in milliseconds if no keys are free. + */ + async getAvailablePrivateKey() { + while (true) { + const index = this.processEnvs.KEY_IN_USE.findIndex((used) => !used); + if (index !== -1) { + this.processEnvs.KEY_IN_USE[index] = true; + return { privateKey: this.processEnvs.PRIVATE_KEYS[index], index }; + } else { + console.log("[\u{10B3A}\u{1F9EA} Tinny Environment\u{10B3A}] No available keys. Waiting...", { + keysInUse: this.processEnvs.KEY_IN_USE + }); + await new Promise( + (resolve) => setTimeout(resolve, this.processEnvs.WAIT_FOR_KEY_INTERVAL) + ); + } + } + } + /** + * Marks a private key as available again after use. + * @param {number} index - The index of the key to mark as available. + */ + releasePrivateKeyFromUser(user) { + const index = this.processEnvs.PRIVATE_KEYS.indexOf(user.privateKey); + this.processEnvs.KEY_IN_USE[index] = false; + } + /** + * Marks a private key as available again after use. + * @param {number} index - The index of the key to mark as available. + */ + releasePrivateKey(index) { + this.processEnvs.KEY_IN_USE[index] = false; + } + /** + * Initializes the LitNodeClient based on the specified network configuration and environment variables. + * This setup differentiates between local and production environments, adjusts node attestation checks, + * and sets network-specific parameters. The function ensures the client is connected and ready before proceeding. + * + * The LitNodeClient is configured differently based on the network: + * - Custom: Uses custom settings for local testing, with node attestation disabled. + * - DatilTest (or other specified testnets): Configures for specific network environments with node attestation enabled. + * + * Logs the process and exits if the client is not ready after attempting to connect. + */ + async setupLitNodeClient() { + console.log("[\u{10B3A}\u{1F9EA} Tinny Environment\u{10B3A}] Setting up LitNodeClient"); + console.log("this.network:", this.network); + const centralisation = CENTRALISATION_BY_NETWORK[this.network]; + if (this.network === LIT_NETWORK.Custom || centralisation === "unknown") { + const networkContext = this?.testnet?.ContractContext ?? this._contractContext; + this.litNodeClient = new LitNodeClient({ + litNetwork: LIT_NETWORK.Custom, + rpcUrl: this.rpc, + debug: this.processEnvs.DEBUG, + checkNodeAttestation: false, + // disable node attestation check for local testing + contractContext: networkContext + }); + } else if (centralisation === "decentralised") { + this.litNodeClient = new LitNodeClient({ + litNetwork: this.network, + checkNodeAttestation: true, + debug: this.processEnvs.DEBUG + }); + } else if (centralisation === "centralised") { + this.litNodeClient = new LitNodeClient({ + litNetwork: this.network, + checkNodeAttestation: false, + debug: this.processEnvs.DEBUG + }); + } else { + throw new Error(`Network not supported: "${this.network}"`); + } + if (globalThis.wasmExports) { + console.warn( + "WASM modules already loaded. Will override when connect is called" + ); + } + if (globalThis.wasmECDSA) { + console.warn( + "WASM modules already loaded. wil override. when connect is called" + ); + } + if (globalThis.wasmSevSnpUtils) { + console.warn( + "WASM modules already loaded. wil override. when connect is called" + ); + } + await this.litNodeClient.connect(); + if (!this.litNodeClient.ready) { + console.error("\u274C litNodeClient not ready"); + process.exit(); + } + } + /** + * Retrieves the environment configuration. + * @returns The TinnyEnvConfig object containing the environment configuration. + */ + getEnvConfig() { + const contractContext = this?.testnet?.ContractContext ?? this._contractContext; + return { + rpc: this.rpc, + litNodeClient: this.litNodeClient, + network: this.network, + processEnvs: this.processEnvs, + contractContext + }; + } + /** + * Creates a new person with the given name. + * @param name - The name of the person. + * @returns The newly created person. + * @throws Error if the name is not provided. + */ + async createNewPerson(name) { + console.log("[\u{10B3A}\u{1F9EA} Tinny Environment\u{10B3A}] Creating new person:", name); + if (!name) { + throw new Error("Name is required"); + } + const key2 = await this.getAvailablePrivateKey(); + const privateKey = key2.privateKey; + const envConfig = this.getEnvConfig(); + const person = new TinnyPerson({ + privateKey, + envConfig + }); + await person.spawn(); + this.world.set(name, person); + return person; + } + /** + * Retrieves a person from the world by their name. + * @param name - The name of the person to retrieve. + * @returns The person object if found, or undefined if not found. + */ + getPerson(name) { + return this.world.get(name); + } + /** + * Creates a random person. + * @returns A promise that resolves to the created person. + */ + async createRandomPerson() { + return await this.createNewPerson("Alice"); + } + setUnavailable = (network) => { + if (this.processEnvs.NETWORK === network) { + throw new Error("LIT_IGNORE_TEST"); + } + }; + /** + * Init + */ + async init() { + try { + if (this.processEnvs.NO_SETUP) { + console.log("[\u{10B3A}\u{1F9EA} Tinny Environment\u{10B3A}] Skipping setup"); + return; + } + if (this.network === LIT_NETWORK.Custom && this.processEnvs.USE_SHIVA) { + this.testnet = await this._shivaClient.startTestnetManager(); + let state = await this.testnet.pollTestnetForActive(); + if (state === `UNKNOWN`) { + console.log( + "Testnet state found to be Unknown meaning there was an error with testnet creation. shutting down" + ); + throw new Error(`Error while creating testnet, aborting test run`); + } + await this.testnet.getTestnetConfig(); + } else if (this.network === LIT_NETWORK.Custom) { + const context = await Promise.resolve().then(() => __toESM(require_networkContext(), 1)); + this._contractContext = context; + } + await this.setupLitNodeClient(); + await this.setupSuperCapacityDelegationAuthSig(); + await this.setupBareEthAuthSig(); + } catch (e2) { + const err = toErrorWithMessage(e2); + console.log( + `[\u{10B3A}\u{1F9EA} Tinny Environment\u{10B3A}] Failed to init() tinny ${err.message}` + ); + console.log(err.stack); + process.exit(1); + } + } + /** + * Setup bare eth auth sig to test access control and decryption + */ + async setupBareEthAuthSig() { + const privateKey = await this.getAvailablePrivateKey(); + try { + const provider = new ethers_exports.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers_exports.Wallet(privateKey.privateKey, provider); + const toSign = await createSiweMessage({ + walletAddress: wallet.address, + nonce: await this.litNodeClient.getLatestBlockhash(), + expiration: new Date( + Date.now() + 29 * 24 * 60 * 60 * 1e3 + ).toISOString(), + litNodeClient: this.litNodeClient + }); + this.bareEthAuthSig = await generateAuthSig({ + signer: wallet, + toSign + }); + } finally { + this.releasePrivateKeyFromUser(privateKey); + } + } + //============= SHIVA ENDPOINTS ============= + /** + * Will stop the testnet that is being used in the test run. + */ + async stopTestnet() { + if (this.network === LIT_NETWORK.Custom && this._shivaClient.processEnvs.STOP_TESTNET) { + await this.testnet.stopTestnet(); + } else { + console.log("skipping testnet shutdown."); + } + } + //============= END SHIVA ENDPOINTS ============= + /** + * Sends funds from the current wallet to the specified wallet address. + * @param walletAddress - The address of the recipient wallet. + * @param amount - The amount of funds to send (default: '0.001'). + * @throws If there is an error sending the funds. + */ + getFunds = async (walletAddress, amount = "0.001") => { + const privateKey = await this.getAvailablePrivateKey(); + try { + const provider = new ethers_exports.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers_exports.Wallet(privateKey.privateKey, provider); + const tx = await wallet.sendTransaction({ + to: walletAddress, + value: ethers_exports.utils.parseEther(amount) + }); + await tx.wait(); + } catch (e2) { + throw new Error(`Failed to send funds to ${walletAddress}: ${e2}`); + } finally { + this.releasePrivateKeyFromUser({ privateKey }); + } + }; + /** + * Context: the reason this is created instead of individually is because we can't allocate capacity beyond the global + * max capacity. + */ + setupSuperCapacityDelegationAuthSig = async () => { + const privateKey = await this.getAvailablePrivateKey(); + const provider = new ethers_exports.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers_exports.Wallet(privateKey.privateKey, provider); + if (this.network === LIT_NETWORK.Custom) { + const networkContext = this?.testnet?.ContractContext ?? this._contractContext; + this.contractsClient = new LitContracts({ + signer: wallet, + debug: this.processEnvs.DEBUG, + rpc: this.rpc, + customContext: networkContext, + network: "custom" + }); + } else if (CENTRALISATION_BY_NETWORK[this.network] === "decentralised" || CENTRALISATION_BY_NETWORK[this.network] === "centralised") { + this.contractsClient = new LitContracts({ + signer: wallet, + debug: this.processEnvs.DEBUG, + network: this.network + }); + } else { + const rpc = this.rpc; + async function _switchWallet() { + const capacityCreditWallet = ethers_exports.Wallet.createRandom().connect(provider); + const balance = await wallet.getBalance(); + console.log("this.rpc:", rpc); + console.log("this.wallet.address", wallet.address); + console.log("Balance:", balance.toString()); + const transferTx = await wallet.sendTransaction({ + to: capacityCreditWallet.address, + value: ethers_exports.utils.parseEther("0.001") + }); + await transferTx.wait(); + } + this.contractsClient = new LitContracts({ + // signer: capacityCreditWallet, // disabled switch wallet for now + signer: wallet, + debug: this.processEnvs.DEBUG, + network: this.network + }); + } + if (!this.contractsClient) { + console.log("\u2757\uFE0FContracts client not initialized"); + process.exit(); + } + await this.contractsClient.connect(); + if (CENTRALISATION_BY_NETWORK[this.network] === "decentralised") { + await this.mintSuperCapacityDelegationAuthSig(wallet); + } + }; + async mintSuperCapacityDelegationAuthSig(wallet) { + console.log( + "[\u{10B3A}\u{1F9EA} Tinny Environment\u{10B3A}] Mint a Capacity Credits NFT and get a capacity delegation authSig with it" + ); + const capacityTokenId = (await this.contractsClient.mintCapacityCreditsNFT({ + requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2 + })).capacityTokenIdStr; + try { + this.superCapacityDelegationAuthSig = (await this.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: wallet, + capacityTokenId, + // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it + uses: "200" + })).capacityDelegationAuthSig; + } catch (e2) { + if (e2.message.includes(`Can't allocate capacity beyond the global max`)) { + console.log("\u2757\uFE0FSkipping capacity delegation auth sig setup.", e2); + } else { + console.log( + "\u2757\uFE0FError while setting up capacity delegation auth sig", + e2 + ); + } + } + } +}; + +// local-tests/setup/tinny-operations.ts +init_shim(); +var getFiltersFlag = () => { + const filterArg = process.argv.find((arg) => arg.startsWith("--filter=")); + return filterArg ? filterArg.replace("--filter=", "").split(",") : []; +}; +var getExcludeFlags = () => { + const filterArg = process.argv.find((arg) => arg.startsWith("--exclude=")); + return filterArg ? filterArg.replace("--exclude=", "").split(",") : []; +}; +var runInBand = async ({ + tests, + devEnv +}) => { + const filters = getFiltersFlag(); + const testsToRun = Object.entries(tests).filter( + ([testName]) => filters.length === 0 || filters.includes(testName) + ); + let skippedTests = []; + let failedTests = []; + let passedTests = []; + for (const [testName, testFunction] of testsToRun) { + const maxAttempts = devEnv.processEnvs.MAX_ATTEMPTS; + let attempts = 0; + let testPassed = false; + while (attempts < maxAttempts && !testPassed) { + const startTime = performance.now(); + try { + console.log(`Attempt ${attempts + 1} for ${testName}...`); + await testFunction(devEnv); + testPassed = true; + const endTime = performance.now(); + const timeTaken = (endTime - startTime).toFixed(2); + console.log(`${testName} - Passed (${timeTaken} ms)`); + passedTests.push(`${testName} (Passed in ${timeTaken} ms)`); + } catch (error) { + if (error.message === "LIT_IGNORE_TEST") { + skippedTests.push(`${testName} (Skipped)`); + break; + } + attempts++; + if (attempts >= maxAttempts) { + const endTime = performance.now(); + const timeTaken = (endTime - startTime).toFixed(2); + console.error( + `${testName} - Failed after ${maxAttempts} attempts (${timeTaken} ms)` + ); + console.error(`Error: ${error}`); + failedTests.push( + `${testName} (Failed in ${timeTaken} ms) - Error: ${error}` + ); + } + } + await new Promise( + (resolve) => setTimeout(resolve, devEnv.processEnvs.RUN_IN_BAND_INTERVAL) + ); + } + } + passedTests.forEach((test) => console.log(`- ${test}`)); + failedTests.forEach((test) => console.log(`- ${test}`)); + skippedTests.forEach((test) => console.log(`- ${test}`)); + console.log(); + console.log( + `Test Report: ${passedTests.length} test(s) passed, ${failedTests.length} failed, ${skippedTests.length} skipped.` + ); + if (failedTests.length > 0) { + return 1; + } else { + return 0; + } +}; +var runTestsParallel = async ({ + tests, + devEnv, + chunkSize +}) => { + const CHUNK_SIZE = chunkSize || parseInt(process.env.CHUNK_SIZE) || 5; + const filters = getFiltersFlag(); + const excludeFilters = getExcludeFlags(); + const testsToRun = Object.entries(tests).filter( + ([testName]) => (filters.length === 0 || filters.some((filter) => testName.includes(filter))) && (excludeFilters.length === 0 || !excludeFilters.some((exclude) => testName.includes(exclude))) + ); + if (!testsToRun || testsToRun.length <= 0) { + throw new Error( + "\u274C No tests to run. You might have provided an invalid filter or no tests are available." + ); + } + const runTest = async ([testName, testFunction], testIndex) => { + const maxAttempts = devEnv.processEnvs.MAX_ATTEMPTS; + const testTimeout = devEnv.processEnvs.TEST_TIMEOUT; + let attempts = 0; + let testPassed = false; + while (attempts < maxAttempts && !testPassed) { + const startTime = performance.now(); + try { + console.log( + `\x1B[90m[runTestsParallel] Attempt ${attempts + 1} for ${testIndex + 1}. ${testName}...\x1B[0m` + ); + await withTimeout(testFunction(devEnv), testTimeout); + testPassed = true; + const endTime = performance.now(); + const timeTaken = (endTime - startTime).toFixed(2); + console.log( + `\x1B[32m\u2714\x1B[90m ${testIndex + 1}. ${testName} - Passed (${timeTaken} ms)\x1B[0m` + ); + return `${testName} (Passed in ${timeTaken} ms)`; + } catch (error) { + if (error.message === "LIT_IGNORE_TEST") { + return `${testName} (Skipped)`; + } + attempts++; + const endTime = performance.now(); + const timeTaken = (endTime - startTime).toFixed(2); + if (error.message === "Timed out") { + console.error( + `\x1B[31m\u2716\x1B[90m ${testIndex + 1}. ${testName} - Timed out after ${testTimeout}ms (${timeTaken} ms)\x1B[0m` + ); + return `${testName} (Timed out in ${timeTaken} ms)`; + } + if (attempts >= maxAttempts) { + console.error( + `\x1B[31m\u2716\x1B[90m ${testIndex + 1}. ${testName} - Failed after ${maxAttempts} attempts (${timeTaken} ms)\x1B[0m` + ); + console.error( + `\x1B[31m\u274CError:\x1B[90m ${JSON.stringify(error) || error}\x1B[0m` + ); + return `${testName} (Failed in ${timeTaken} ms) - Error: ${JSON.stringify( + error + )}`; + } + } + } + }; + const results = []; + for (let i2 = 0; i2 < testsToRun.length; i2 += CHUNK_SIZE) { + const chunk = testsToRun.slice(i2, i2 + CHUNK_SIZE); + const chunkResults = await Promise.all( + chunk.map((test, index) => runTest(test, i2 + index)) + ); + await new Promise((resolve) => setTimeout(resolve, 3e3)); + results.push(...chunkResults); + } + const skippedTests = results.filter((result) => result.includes("Skipped")); + const failedTests = results.filter( + (result) => result.includes("Failed") || result.includes("Timed out") + ); + const passedTests = results.filter((result) => result.includes("Passed")); + if (skippedTests.length > 0) { + console.log(`\x1B[90mTest Report: Some tests were skipped.\x1B[0m`); + skippedTests.forEach( + (skippedTest) => console.log(`\x1B[90m- ${skippedTest}\x1B[0m`) + ); + } + if (failedTests.length > 0) { + console.log(`\x1B[31mTest Report: Some tests failed.\x1B[0m`); + failedTests.forEach( + (failedTest) => console.log(`\x1B[31m- ${failedTest}\x1B[0m`) + ); + } + if (passedTests.length > 0) { + console.log( + `\x1B[32mTest Report: ${passedTests.length} test(s) passed.\x1B[0m` + ); + passedTests.forEach( + (passedTest) => console.log(`\x1B[32m- ${passedTest}\x1B[0m`) + ); + } + if (failedTests.length > 0) { + console.log( + `\x1B[31mTest Report: ${failedTests.length} test(s) failed.\x1B[0m` + ); + return 1; + } else { + console.log("\x1B[32mTest Report: All tests passed.\x1B[0m"); + return 0; + } +}; + +// local-tests/tests.ts +var tests_exports = {}; +__export(tests_exports, { + testBatchGeneratePrivateKeys: () => testBatchGeneratePrivateKeys, + testCosmosAuthSigToEncryptDecryptString: () => testCosmosAuthSigToEncryptDecryptString, + testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs: () => testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs, + testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs: () => testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs, + testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign: () => testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign, + testEthAuthSigToEncryptDecryptString: () => testEthAuthSigToEncryptDecryptString, + testEthereumBroadcastTransactionGeneratedKey: () => testEthereumBroadcastTransactionGeneratedKey, + testEthereumBroadcastTransactionWrappedKey: () => testEthereumBroadcastTransactionWrappedKey, + testEthereumBroadcastWrappedKeyWithFetchGasParams: () => testEthereumBroadcastWrappedKeyWithFetchGasParams, + testEthereumSignMessageGeneratedKey: () => testEthereumSignMessageGeneratedKey, + testEthereumSignMessageWrappedKey: () => testEthereumSignMessageWrappedKey, + testEthereumSignTransactionWrappedKey: () => testEthereumSignTransactionWrappedKey, + testExecutJsDecryptAndCombine: () => testExecutJsDecryptAndCombine, + testExecuteJsBroadcastAndCollect: () => testExecuteJsBroadcastAndCollect, + testExecuteJsSignAndCombineEcdsa: () => testExecuteJsSignAndCombineEcdsa, + testExportWrappedKey: () => testExportWrappedKey, + testFailBatchGeneratePrivateKeysAtomic: () => testFailBatchGeneratePrivateKeysAtomic, + testFailEthereumSignTransactionWrappedKeyInvalidDecryption: () => testFailEthereumSignTransactionWrappedKeyInvalidDecryption, + testFailEthereumSignTransactionWrappedKeyWithInvalidParam: () => testFailEthereumSignTransactionWrappedKeyWithInvalidParam, + testFailEthereumSignTransactionWrappedKeyWithMissingParam: () => testFailEthereumSignTransactionWrappedKeyWithMissingParam, + testFailImportWrappedKeysWithEoaSessionSig: () => testFailImportWrappedKeysWithEoaSessionSig, + testFailImportWrappedKeysWithExpiredSessionSig: () => testFailImportWrappedKeysWithExpiredSessionSig, + testFailImportWrappedKeysWithInvalidSessionSig: () => testFailImportWrappedKeysWithInvalidSessionSig, + testFailImportWrappedKeysWithMaxExpirySessionSig: () => testFailImportWrappedKeysWithMaxExpirySessionSig, + testFailImportWrappedKeysWithSamePrivateKey: () => testFailImportWrappedKeysWithSamePrivateKey, + testGenerateEthereumWrappedKey: () => testGenerateEthereumWrappedKey, + testGenerateSolanaWrappedKey: () => testGenerateSolanaWrappedKey, + testImportWrappedKey: () => testImportWrappedKey, + testPkpEthersWithEoaSessionSigsToEthSign: () => testPkpEthersWithEoaSessionSigsToEthSign, + testPkpEthersWithEoaSessionSigsToEthSignTransaction: () => testPkpEthersWithEoaSessionSigsToEthSignTransaction, + testPkpEthersWithEoaSessionSigsToEthSignTypedData: () => testPkpEthersWithEoaSessionSigsToEthSignTypedData, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil: () => testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1: () => testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3: () => testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4: () => testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4, + testPkpEthersWithEoaSessionSigsToPersonalSign: () => testPkpEthersWithEoaSessionSigsToPersonalSign, + testPkpEthersWithEoaSessionSigsToSendTx: () => testPkpEthersWithEoaSessionSigsToSendTx, + testPkpEthersWithEoaSessionSigsToSignMessage: () => testPkpEthersWithEoaSessionSigsToSignMessage, + testPkpEthersWithEoaSessionSigsToSignWithAuthContext: () => testPkpEthersWithEoaSessionSigsToSignWithAuthContext, + testPkpEthersWithLitActionSessionSigsToEthSign: () => testPkpEthersWithLitActionSessionSigsToEthSign, + testPkpEthersWithLitActionSessionSigsToEthSignTransaction: () => testPkpEthersWithLitActionSessionSigsToEthSignTransaction, + testPkpEthersWithLitActionSessionSigsToEthSignTypedData: () => testPkpEthersWithLitActionSessionSigsToEthSignTypedData, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil: () => testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1: () => testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3: () => testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4: () => testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4, + testPkpEthersWithLitActionSessionSigsToPersonalSign: () => testPkpEthersWithLitActionSessionSigsToPersonalSign, + testPkpEthersWithLitActionSessionSigsToSendTx: () => testPkpEthersWithLitActionSessionSigsToSendTx, + testPkpEthersWithLitActionSessionSigsToSignMessage: () => testPkpEthersWithLitActionSessionSigsToSignMessage, + testPkpEthersWithPkpSessionSigsToEthSign: () => testPkpEthersWithPkpSessionSigsToEthSign, + testPkpEthersWithPkpSessionSigsToEthSignTransaction: () => testPkpEthersWithPkpSessionSigsToEthSignTransaction, + testPkpEthersWithPkpSessionSigsToEthSignTypedData: () => testPkpEthersWithPkpSessionSigsToEthSignTypedData, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil: () => testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1: () => testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3: () => testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4: () => testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4, + testPkpEthersWithPkpSessionSigsToPersonalSign: () => testPkpEthersWithPkpSessionSigsToPersonalSign, + testPkpEthersWithPkpSessionSigsToSendTx: () => testPkpEthersWithPkpSessionSigsToSendTx, + testPkpEthersWithPkpSessionSigsToSignMessage: () => testPkpEthersWithPkpSessionSigsToSignMessage, + testRelayer: () => testRelayer, + testSignMessageWithSolanaEncryptedKey: () => testSignMessageWithSolanaEncryptedKey, + testSignTransactionWithSolanaEncryptedKey: () => testSignTransactionWithSolanaEncryptedKey, + testSolAuthSigToEncryptDecryptString: () => testSolAuthSigToEncryptDecryptString, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs: () => testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign: () => testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs: () => testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign: () => testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign, + testUseCustomAuthSessionSigsToPkpSignExecuteJs: () => testUseCustomAuthSessionSigsToPkpSignExecuteJs, + testUseEoaSessionSigsToEncryptDecryptFile: () => testUseEoaSessionSigsToEncryptDecryptFile, + testUseEoaSessionSigsToEncryptDecryptString: () => testUseEoaSessionSigsToEncryptDecryptString, + testUseEoaSessionSigsToEncryptDecryptUint8Array: () => testUseEoaSessionSigsToEncryptDecryptUint8Array, + testUseEoaSessionSigsToExecuteJsClaimKeys: () => testUseEoaSessionSigsToExecuteJsClaimKeys, + testUseEoaSessionSigsToExecuteJsClaimMultipleKeys: () => testUseEoaSessionSigsToExecuteJsClaimMultipleKeys, + testUseEoaSessionSigsToExecuteJsConsoleLog: () => testUseEoaSessionSigsToExecuteJsConsoleLog, + testUseEoaSessionSigsToExecuteJsJsonResponse: () => testUseEoaSessionSigsToExecuteJsJsonResponse, + testUseEoaSessionSigsToExecuteJsSigning: () => testUseEoaSessionSigsToExecuteJsSigning, + testUseEoaSessionSigsToExecuteJsSigningInParallel: () => testUseEoaSessionSigsToExecuteJsSigningInParallel, + testUseEoaSessionSigsToPkpSign: () => testUseEoaSessionSigsToPkpSign, + testUseEoaSessionSigsToRequestSingleResponse: () => testUseEoaSessionSigsToRequestSingleResponse, + testUseInvalidLitActionCodeToGenerateSessionSigs: () => testUseInvalidLitActionCodeToGenerateSessionSigs, + testUseInvalidLitActionIpfsCodeToGenerateSessionSigs: () => testUseInvalidLitActionIpfsCodeToGenerateSessionSigs, + testUsePkpSessionSigsToEncryptDecryptFile: () => testUsePkpSessionSigsToEncryptDecryptFile, + testUsePkpSessionSigsToEncryptDecryptString: () => testUsePkpSessionSigsToEncryptDecryptString, + testUsePkpSessionSigsToExecuteJsClaimKeys: () => testUsePkpSessionSigsToExecuteJsClaimKeys, + testUsePkpSessionSigsToExecuteJsClaimMultipleKeys: () => testUsePkpSessionSigsToExecuteJsClaimMultipleKeys, + testUsePkpSessionSigsToExecuteJsConsoleLog: () => testUsePkpSessionSigsToExecuteJsConsoleLog, + testUsePkpSessionSigsToExecuteJsJsonResponse: () => testUsePkpSessionSigsToExecuteJsJsonResponse, + testUsePkpSessionSigsToExecuteJsSigning: () => testUsePkpSessionSigsToExecuteJsSigning, + testUsePkpSessionSigsToExecuteJsSigningInParallel: () => testUsePkpSessionSigsToExecuteJsSigningInParallel, + testUsePkpSessionSigsToPkpSign: () => testUsePkpSessionSigsToPkpSign, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile: () => testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString: () => testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys: () => testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys: () => testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog: () => testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse: () => testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning: () => testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel: () => testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel, + testUseValidLitActionCodeGeneratedSessionSigsToPkpSign: () => testUseValidLitActionCodeGeneratedSessionSigsToPkpSign, + testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning: () => testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning, + testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign: () => testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign, + tinnyTests: () => tinnyTests +}); +init_shim(); + +// local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.ts +init_shim(); + +// local-tests/setup/session-sigs/get-eoa-session-sigs.ts +init_shim(); +var getEoaSessionSigs = async (devEnv, person, resourceAbilityRequests) => { + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + if (centralisation === "decentralised") { + console.warn( + "Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs" + ); + } + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ]; + const sessionSigs = await devEnv.litNodeClient.getSessionSigs({ + chain: "ethereum", + resourceAbilityRequests: _resourceAbilityRequests, + authNeededCallback: async ({ + uri, + expiration, + resourceAbilityRequests: resourceAbilityRequests2 + }) => { + console.log("resourceAbilityRequests:", resourceAbilityRequests2); + if (!expiration) { + throw new Error("expiration is required"); + } + if (!resourceAbilityRequests2) { + throw new Error("resourceAbilityRequests is required"); + } + if (!uri) { + throw new Error("uri is required"); + } + const toSign = await createSiweMessageWithRecaps({ + uri, + expiration, + resources: resourceAbilityRequests2, + walletAddress: person.wallet.address, + nonce: await devEnv.litNodeClient.getLatestBlockhash(), + litNodeClient: devEnv.litNodeClient + }); + const authSig = await generateAuthSig({ + signer: person.wallet, + toSign + }); + return authSig; + }, + ...centralisation === "decentralised" && { + capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig] + } + }); + log("[getEoaSessionSigs]: ", getEoaSessionSigs); + return sessionSigs; +}; +var getEoaSessionSigsWithCapacityDelegations = async (devEnv, fromWallet, capacityDelegationAuthSig) => { + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + if (centralisation === "decentralised") { + console.warn( + "Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs" + ); + } + const sessionSigs = await devEnv.litNodeClient.getSessionSigs({ + chain: "ethereum", + resourceAbilityRequests: [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ], + authNeededCallback: async ({ + uri, + expiration, + resourceAbilityRequests + }) => { + if (!expiration) { + throw new Error("expiration is required"); + } + if (!resourceAbilityRequests) { + throw new Error("resourceAbilityRequests is required"); + } + if (!uri) { + throw new Error("uri is required"); + } + const toSign = await createSiweMessageWithRecaps({ + uri, + expiration, + resources: resourceAbilityRequests, + walletAddress: fromWallet.address, + nonce: await devEnv.litNodeClient.getLatestBlockhash(), + litNodeClient: devEnv.litNodeClient + }); + const authSig = await generateAuthSig({ + signer: fromWallet, + toSign + }); + return authSig; + }, + ...centralisation === "decentralised" && { + capabilityAuthSigs: [ + capacityDelegationAuthSig ?? devEnv.superCapacityDelegationAuthSig + ] + } + }); + log("[getEoaSessionSigs]: ", getEoaSessionSigs); + return sessionSigs; +}; + +// local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.ts +var testUseEoaSessionSigsToExecuteJsSigning = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp.publicKey + } + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + log("\u2705 testUseEoaSessionSigsToExecuteJsSigning"); +}; + +// local-tests/tests/testUseEoaSessionSigsToPkpSign.ts +init_shim(); +var testUseEoaSessionSigsToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const runWithSessionSigs = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.pkp.publicKey, + sessionSigs: eoaSessionSigs + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!runWithSessionSigs.r) { + throw new Error(`Expected "r" in runWithSessionSigs`); + } + if (!runWithSessionSigs.s) { + throw new Error(`Expected "s" in runWithSessionSigs`); + } + if (!runWithSessionSigs.dataSigned) { + throw new Error(`Expected "dataSigned" in runWithSessionSigs`); + } + if (!runWithSessionSigs.publicKey) { + throw new Error(`Expected "publicKey" in runWithSessionSigs`); + } + if (!runWithSessionSigs.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(runWithSessionSigs.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + log("\u2705 testUseEoaSessionSigsToPkpSign"); +}; + +// local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts +init_shim(); + +// local-tests/setup/session-sigs/get-pkp-session-sigs.ts +init_shim(); +var getPkpSessionSigs = async (devEnv, alice, resourceAbilityRequests, expiration) => { + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + if (centralisation === "decentralised") { + console.warn( + "Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs" + ); + } + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ]; + const pkpSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp.publicKey, + authMethods: [alice.authMethod], + expiration, + resourceAbilityRequests: _resourceAbilityRequests, + ...centralisation === "decentralised" && { + capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig] + } + }); + log("[getPkpSessionSigs]: ", pkpSessionSigs); + return pkpSessionSigs; +}; + +// local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts +var testUsePkpSessionSigsToExecuteJsSigning = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey + } + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + if (!res.signatures.sig.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + log("\u2705 res:", res); +}; + +// local-tests/tests/testUsePkpSessionSigsToPkpSign.ts +init_shim(); +var testUsePkpSessionSigsToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.authMethodOwnedPkp.publicKey, + sessionSigs: pkpSessionSigs + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + if (!res.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + log("\u2705 res:", res); +}; + +// local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts +init_shim(); + +// local-tests/setup/session-sigs/get-lit-action-session-sigs.ts +init_shim(); +var VALID_SESSION_SIG_LIT_ACTION_CODE = ` +// Works with an AuthSig AuthMethod +if (Lit.Auth.authMethodContexts.some(e => e.authMethodType === 1)) { + LitActions.setResponse({ response: "true" }); +} else { + LitActions.setResponse({ response: "false" }); +} +`; +var INVALID_SESSION_SIG_LIT_ACTION_CODE = ` +(async () => { + let utf8Encode = new TextEncoder(); + const toSign = utf8Encode.encode('This message is exactly 32 bytes'); + const sigShare = await LitActions.signEcdsa({ toSign, publicKey, sigName }); +})(); +`; +var VALID_IPFS_ID = "QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp"; +var INVALID_IPFS_ID = "QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm"; +var getLitActionSessionSigs = async (devEnv, alice, resourceAbilityRequests) => { + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + if (centralisation === "decentralised") { + console.warn( + "Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs" + ); + } + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ]; + const litActionSessionSigs = await devEnv.litNodeClient.getLitActionSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp.publicKey, + authMethods: [alice.authMethod], + resourceAbilityRequests: _resourceAbilityRequests, + litActionCode: Buffer.from(VALID_SESSION_SIG_LIT_ACTION_CODE).toString( + "base64" + ), + jsParams: { + publicKey: alice.authMethodOwnedPkp.publicKey, + sigName: "unified-auth-sig" + }, + ...centralisation === "decentralised" && { + capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig] + } + }); + return litActionSessionSigs; +}; +var getLitActionSessionSigsUsingIpfsId = async (devEnv, alice, resourceAbilityRequests) => { + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + if (centralisation === "decentralised") { + console.warn( + "Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs" + ); + } + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ]; + const litActionSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp.publicKey, + authMethods: [alice.authMethod], + resourceAbilityRequests: _resourceAbilityRequests, + litActionIpfsId: VALID_IPFS_ID, + jsParams: { + publicKey: alice.authMethodOwnedPkp.publicKey, + sigName: "unified-auth-sig" + }, + ...centralisation === "decentralised" && { + capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig] + } + }); + return litActionSessionSigs; +}; +var getInvalidLitActionSessionSigs = async (devEnv, alice) => { + const litActionSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp.publicKey, + authMethods: [alice.authMethod], + resourceAbilityRequests: [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + } + ], + litActionCode: Buffer.from(INVALID_SESSION_SIG_LIT_ACTION_CODE).toString( + "base64" + ), + jsParams: { + publicKey: alice.authMethodOwnedPkp.publicKey, + sigName: "unified-auth-sig" + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[devEnv.litNodeClient.config.litNetwork] + } + }); + return litActionSessionSigs; +}; +var getInvalidLitActionIpfsSessionSigs = async (devEnv, alice) => { + const litActionSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp.publicKey, + authMethods: [alice.authMethod], + resourceAbilityRequests: [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + } + ], + litActionIpfsId: INVALID_IPFS_ID, + jsParams: { + publicKey: alice.authMethodOwnedPkp.publicKey, + sigName: "unified-auth-sig" + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[devEnv.litNodeClient.config.litNetwork] + } + }); + return litActionSessionSigs; +}; + +// local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts +var testUseValidLitActionCodeGeneratedSessionSigsToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.authMethodOwnedPkp.publicKey, + sessionSigs: litActionSessionSigs + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + if (!res.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + log("\u2705 res:", res); +}; + +// local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts +init_shim(); +var testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ]); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey + } + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + log("\u2705 res:", res); +}; + +// local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning.ts +init_shim(); +var testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigsUsingIpfsId( + devEnv, + alice, + [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ] + ); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey + } + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log("\u2705 res:", res); + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + log("\u2705 res:", res); +}; + +// local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts +init_shim(); +var testUseEoaSessionSigsToExecuteJsSigningInParallel = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const fn = async (index) => { + log(`Index: ${index}`); + return await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp.publicKey + } + }); + }; + const res = await Promise.all([fn(1), fn(2), fn(3)]); + devEnv.releasePrivateKeyFromUser(alice); + log("res:", res); + res.forEach((r3) => { + if (!r3.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!r3.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!r3.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!r3.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + if (!r3.signatures.sig.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(r3.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); + log("\u2705 testUseEoaSessionSigsToExecuteJsSigningInParallel"); +}; + +// local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.ts +init_shim(); +var testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig([bob.wallet.address]); + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log("bobsSingleSessionSig:", bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r3) => { + const encodedRecap = r3.split(":")[2]; + const decodedRecap = Buffer.from(encodedRecap, "base64").toString(); + console.log(decodedRecap); + }); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey + } + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + if (!res.signatures.sig.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + console.log( + "\u2705 testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs" + ); +}; + +// local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.ts +init_shim(); +var testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig([bob.wallet.address]); + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log("bobsSingleSessionSig:", bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r3) => { + const encodedRecap = r3.split(":")[2]; + const decodedRecap = Buffer.from(encodedRecap, "base64").toString(); + console.log(decodedRecap); + }); + const res = await devEnv.litNodeClient.pkpSign({ + sessionSigs: bobsSessionSigs, + toSign: alice.loveLetter, + pubKey: bob.pkp.publicKey + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + if (!res.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + console.log("\u2705 res:", res); +}; + +// local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts +init_shim(); +var testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig(); + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log("bobsSingleSessionSig:", bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r3) => { + const encodedRecap = r3.split(":")[2]; + const decodedRecap = Buffer.from(encodedRecap, "base64").toString(); + console.log(decodedRecap); + }); + const runWithSessionSigs = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: bob.pkp.publicKey, + sessionSigs: bobsSessionSigs + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + if (!runWithSessionSigs.r) { + throw new Error(`Expected "r" in runWithSessionSigs`); + } + if (!runWithSessionSigs.s) { + throw new Error(`Expected "s" in runWithSessionSigs`); + } + if (!runWithSessionSigs.dataSigned) { + throw new Error(`Expected "dataSigned" in runWithSessionSigs`); + } + if (!runWithSessionSigs.publicKey) { + throw new Error(`Expected "publicKey" in runWithSessionSigs`); + } + if (!runWithSessionSigs.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(runWithSessionSigs.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } +}; + +// local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.ts +init_shim(); +var testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = (await devEnv.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: alice.wallet + })).capacityDelegationAuthSig; + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log("bobsSingleSessionSig:", bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r3) => { + const encodedRecap = r3.split(":")[2]; + const decodedRecap = Buffer.from(encodedRecap, "base64").toString(); + console.log(decodedRecap); + }); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey + } + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + if (!res.signatures.sig.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + console.log( + "\u2705 testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs" + ); +}; + +// local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.ts +init_shim(); +var testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = (await devEnv.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: alice.wallet + })).capacityDelegationAuthSig; + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log("bobsSingleSessionSig:", bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r3) => { + const encodedRecap = r3.split(":")[2]; + const decodedRecap = Buffer.from(encodedRecap, "base64").toString(); + console.log(decodedRecap); + }); + const res = await devEnv.litNodeClient.pkpSign({ + sessionSigs: bobsSessionSigs, + toSign: alice.loveLetter, + pubKey: bob.pkp.publicKey + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + if (!res.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + console.log("\u2705 res:", res); +}; + +// local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.ts +init_shim(); +var testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig(); + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log("bobsSingleSessionSig:", bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r3) => { + const encodedRecap = r3.split(":")[2]; + const decodedRecap = Buffer.from(encodedRecap, "base64").toString(); + console.log(decodedRecap); + }); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey + } + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + if (!res.signatures.sig.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + console.log( + "\u2705 testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs" + ); +}; + +// local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.ts +init_shim(); +var testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const bobsAuthMethodAuthId = await bob.getAuthMethodId(); + const scopes = await bob.contractsClient.pkpPermissionsContract.read.getPermittedAuthMethodScopes( + bob.authMethodOwnedPkp.tokenId, + AUTH_METHOD_TYPE.EthWallet, + bobsAuthMethodAuthId, + 3 + ); + if (!scopes[AUTH_METHOD_SCOPE.SignAnything]) { + throw new Error('Bob does not have the "SignAnything" scope on his PKP'); + } + const capacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig( + [bob.authMethodOwnedPkp.ethAddress] + ); + const bobPkpSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: bob.authMethodOwnedPkp.publicKey, + authMethods: [bob.authMethod], + resourceAbilityRequests: [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ], + capabilityAuthSigs: [capacityDelegationAuthSig] + }); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobPkpSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.authMethodOwnedPkp.publicKey + } + }); + console.log("\u2705 res:", res); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + if (!res.signatures.sig.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } +}; + +// local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts +init_shim(); +var testUseEoaSessionSigsToExecuteJsClaimKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log("res:", res); + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); + log("\u2705 testUseEoaSessionSigsToExecuteJsClaimKeys"); +}; + +// local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts +init_shim(); +var testUseEoaSessionSigsToExecuteJsClaimMultipleKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; + +// local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts +init_shim(); +var testUseEoaSessionSigsToExecuteJsJsonResponse = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.response) { + throw new Error(`Expected "response" in res`); + } + if (!res.response.startsWith("{")) { + throw new Error(`Expected "response" to start with {`); + } + if (!res.response.endsWith("}")) { + throw new Error(`Expected "response" to end with }`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes("hello world")) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + if (res.success !== true) { + throw new Error(`Expected "success" to be true`); + } +}; + +// local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.ts +init_shim(); +var testUseEoaSessionSigsToExecuteJsConsoleLog = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + console.log('hello world') + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log("res:", res); + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes("hello world")) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } +}; + +// local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts +init_shim(); + +// local-tests/setup/accs/accs.ts +init_shim(); +var AccessControlConditions; +((AccessControlConditions2) => { + AccessControlConditions2.getEmvBasicAccessControlConditions = ({ + userAddress + }) => { + return [ + { + contractAddress: "", + standardContractType: "", + chain: "ethereum", + method: "", + parameters: [":userAddress"], + returnValueTest: { + comparator: "=", + value: userAddress + } + } + ]; + }; + AccessControlConditions2.getSolBasicAccessControlConditions = ({ + userAddress + }) => { + return [ + { + method: "", + params: [":userAddress"], + pdaParams: [], + pdaInterface: { offset: 0, fields: {} }, + pdaKey: "", + chain: "solana", + returnValueTest: { + key: "", + comparator: "=", + value: userAddress + } + } + ]; + }; + AccessControlConditions2.getCosmosBasicAccessControlConditions = ({ + userAddress + }) => { + return [ + { + conditionType: "cosmos", + path: ":userAddress", + chain: "cosmos", + returnValueTest: { + key: "", + comparator: "=", + value: userAddress + } + } + ]; + }; +})(AccessControlConditions || (AccessControlConditions = {})); + +// packages/encryption/src/index.ts +init_shim(); + +// packages/encryption/src/lib/encryption.ts +init_shim(); +var encryptUint8Array = async (params, litNodeClient) => { + const paramsIsSafe = safeParams({ + functionName: "encryptUint8Array", + params + }); + if (paramsIsSafe.type === EITHER_TYPE.ERROR) + throw new InvalidParamType( + { + info: { + params + } + }, + "Invalid params" + ); + return litNodeClient.encrypt({ + ...params + }); +}; +var decryptToUint8Array = async (params, litNodeClient) => { + const paramsIsSafe = safeParams({ + functionName: "decrypt", + params + }); + if (paramsIsSafe.type === EITHER_TYPE.ERROR) + throw new InvalidParamType( + { + info: { + params, + function: "decryptToUint8Array" + }, + cause: paramsIsSafe.result + }, + "Invalid params" + ); + const { decryptedData } = await litNodeClient.decrypt(params); + return decryptedData; +}; +var encryptString = async (params, litNodeClient) => { + const paramsIsSafe = safeParams({ + functionName: "encryptString", + params + }); + if (paramsIsSafe.type === EITHER_TYPE.ERROR) + throw new InvalidParamType( + { + info: { + params, + function: "encryptString" + }, + cause: paramsIsSafe.result + }, + "Invalid params" + ); + return litNodeClient.encrypt({ + ...params, + dataToEncrypt: uint8arrayFromString(params.dataToEncrypt, "utf8") + }); +}; +var decryptToString = async (params, litNodeClient) => { + const paramsIsSafe = safeParams({ + functionName: "decrypt", + params + }); + if (paramsIsSafe.type === EITHER_TYPE.ERROR) + throw new InvalidParamType( + { + info: { + params, + function: "decryptToString" + }, + cause: paramsIsSafe.result + }, + "Invalid params" + ); + const { decryptedData } = await litNodeClient.decrypt(params); + return uint8arrayToString(decryptedData, "utf8"); +}; +var decryptToFile = async (params, litNodeClient) => { + const paramsIsSafe = safeParams({ + functionName: "decrypt", + params + }); + if (paramsIsSafe.type === EITHER_TYPE.ERROR) + throw new InvalidParamType( + { + info: { + params, + function: "decryptToFile" + }, + cause: paramsIsSafe.result + }, + "Invalid params" + ); + const { decryptedData } = await litNodeClient.decrypt(params); + return decryptedData; +}; + +// local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts +var testUseEoaSessionSigsToEncryptDecryptString = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address + }); + const encryptRes = await encryptString( + { + accessControlConditions: accs, + dataToEncrypt: "Hello world" + }, + devEnv.litNodeClient + ); + log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption + } + ]); + const decryptRes = await decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: "ethereum" + }, + devEnv.litNodeClient + ); + devEnv.releasePrivateKeyFromUser(alice); + if (decryptRes !== "Hello world") { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } +}; + +// local-tests/tests/testUseEoaSessionSigsToEncryptDecryptUint8Array.ts +init_shim(); +var testUseEoaSessionSigsToEncryptDecryptUint8Array = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address + }); + const message = "Hello world"; + const messageToEncrypt = uint8arrayFromString(message, "utf8"); + const encryptRes = await encryptUint8Array( + { + accessControlConditions: accs, + dataToEncrypt: messageToEncrypt + }, + devEnv.litNodeClient + ); + log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption + } + ]); + const decryptRes = await decryptToUint8Array( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: "ethereum" + }, + devEnv.litNodeClient + ); + const decryptResString = uint8arrayToString(decryptRes, "utf8"); + devEnv.releasePrivateKeyFromUser(alice); + if (decryptResString !== message) { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } +}; + +// local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts +init_shim(); +var testUsePkpSessionSigsToEncryptDecryptString = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress + }); + const encryptRes = await encryptString( + { + accessControlConditions: accs, + dataToEncrypt: "Hello world" + }, + devEnv.litNodeClient + ); + log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption + } + ]); + const decryptRes = await decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: pkpSessionSigs2, + chain: "ethereum" + }, + devEnv.litNodeClient + ); + devEnv.releasePrivateKeyFromUser(alice); + if (decryptRes !== "Hello world") { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } +}; + +// local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts +init_shim(); +var testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress + }); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const encryptRes = await encryptString( + { + accessControlConditions: accs, + dataToEncrypt: "Hello world" + }, + devEnv.litNodeClient + ); + log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + const litActionSessionSigs2 = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption + } + ]); + const decryptRes = await decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: litActionSessionSigs2, + chain: "ethereum" + }, + devEnv.litNodeClient + ); + devEnv.releasePrivateKeyFromUser(alice); + if (decryptRes !== "Hello world") { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } +}; + +// local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts +init_shim(); +var testUseInvalidLitActionCodeToGenerateSessionSigs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + await getInvalidLitActionSessionSigs(devEnv, alice); + } catch (e2) { + console.log("\u274C This error is expected", e2); + if (e2.message === "There was an error getting the signing shares from the nodes") { + console.log("\u2705 testUseInvalidLitActionCodeToGenerateSessionSigs passed"); + } else { + throw e2; + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts +init_shim(); +var testUseEoaSessionSigsToEncryptDecryptFile = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const message = "Hello world"; + const blob = new Blob([message], { type: "text/plain" }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address + }); + const encryptRes = await encryptString( + { + accessControlConditions: accs, + dataToEncrypt: "Hello world" + }, + devEnv.litNodeClient + ); + log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption + } + ]); + const decriptedFile = await decryptToFile( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: "ethereum" + }, + devEnv.litNodeClient + ); + devEnv.releasePrivateKeyFromUser(alice); + if (blobArray.length !== decriptedFile.length) { + throw new Error( + `decrypted file should match the original file but received ${decriptedFile}` + ); + } + for (let i2 = 0; i2 < blobArray.length; i2++) { + if (blobArray[i2] !== decriptedFile[i2]) { + throw new Error(`decrypted file should match the original file`); + } + } + console.log("decriptedFile:", decriptedFile); +}; + +// local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts +init_shim(); +var testUsePkpSessionSigsToExecuteJsSigningInParallel = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const fn = async (index) => { + log(`Index: ${index}`); + return await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey + } + }); + }; + devEnv.releasePrivateKeyFromUser(alice); + const res = await Promise.all([fn(1), fn(2), fn(3)]); + log("res:", res); + res.forEach((r3) => { + if (!r3.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!r3.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!r3.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!r3.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + if (!r3.signatures.sig.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(r3.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); + log("\u2705 testUsePkpSessionSigsToExecuteJsSigningInParallel"); +}; + +// local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts +init_shim(); +var testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const fn = async (index) => { + log(`Index: ${index}`); + return await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey + } + }); + }; + devEnv.releasePrivateKeyFromUser(alice); + const res = await Promise.all([fn(1), fn(2), fn(3)]); + log("res:", res); + res.forEach((r3) => { + if (!r3.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!r3.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!r3.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!r3.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + if (!r3.signatures.sig.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(r3.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); + log("\u2705 testUsePkpSessionSigsToExecuteJsSigningInParallel"); +}; + +// local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts +init_shim(); +var testUsePkpSessionSigsToExecuteJsClaimKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log("res:", res); + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; + +// local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts +init_shim(); +var testUsePkpSessionSigsToExecuteJsClaimMultipleKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; + +// local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts +init_shim(); +var testUsePkpSessionSigsToExecuteJsJsonResponse = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.response) { + throw new Error(`Expected "response" in res`); + } + if (!res.response.startsWith("{")) { + throw new Error(`Expected "response" to start with {`); + } + if (!res.response.endsWith("}")) { + throw new Error(`Expected "response" to end with }`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes("hello world")) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + if (res.success !== true) { + throw new Error(`Expected "success" to be true`); + } +}; + +// local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts +init_shim(); +var testUsePkpSessionSigsToExecuteJsConsoleLog = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + console.log('hello world') + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes("hello world")) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } +}; + +// local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts +init_shim(); +var testUsePkpSessionSigsToEncryptDecryptFile = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const message = "Hello world"; + const blob = new Blob([message], { type: "text/plain" }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress + }); + const encryptRes = await encryptString( + { + accessControlConditions: accs, + dataToEncrypt: "Hello world" + }, + devEnv.litNodeClient + ); + log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption + } + ]); + const decriptedFile = await decryptToFile( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: pkpSessionSigs2, + chain: "ethereum" + }, + devEnv.litNodeClient + ); + devEnv.releasePrivateKeyFromUser(alice); + if (blobArray.length !== decriptedFile.length) { + throw new Error( + `decrypted file should match the original file but received ${decriptedFile}` + ); + } + for (let i2 = 0; i2 < blobArray.length; i2++) { + if (blobArray[i2] !== decriptedFile[i2]) { + throw new Error(`decrypted file should match the original file`); + } + } + console.log("decriptedFile:", decriptedFile); +}; + +// local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts +init_shim(); +var testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ]); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; + +// local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts +init_shim(); +var testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; + +// local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.ts +init_shim(); +var testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + if (!res.response) { + throw new Error(`Expected "response" in res`); + } + if (!res.response.startsWith("{")) { + throw new Error(`Expected "response" to start with {`); + } + if (!res.response.endsWith("}")) { + throw new Error(`Expected "response" to end with }`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes("hello world")) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + if (res.success !== true) { + throw new Error(`Expected "success" to be true`); + } +}; + +// local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts +init_shim(); +var testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ]); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + console.log('hello world') + })();` + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log("res:", res); + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes("hello world")) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } +}; + +// local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts +init_shim(); +var testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const message = "Hello world"; + const blob = new Blob([message], { type: "text/plain" }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress + }); + const encryptRes = await encryptString( + { + accessControlConditions: accs, + dataToEncrypt: "Hello world" + }, + devEnv.litNodeClient + ); + log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption + } + ]); + const decriptedFile = await decryptToFile( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: pkpSessionSigs2, + chain: "ethereum" + }, + devEnv.litNodeClient + ); + devEnv.releasePrivateKeyFromUser(alice); + if (blobArray.length !== decriptedFile.length) { + throw new Error( + `decrypted file should match the original file but received ${decriptedFile}` + ); + } + for (let i2 = 0; i2 < blobArray.length; i2++) { + if (blobArray[i2] !== decriptedFile[i2]) { + throw new Error(`decrypted file should match the original file`); + } + } + console.log("decriptedFile:", decriptedFile); +}; + +// local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign.ts +init_shim(); +var testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + let litActionSessionSigs; + try { + litActionSessionSigs = await getLitActionSessionSigsUsingIpfsId( + devEnv, + alice + ); + } catch (e2) { + console.log("\u274C This error is NOT expected:", e2); + throw new Error(e2); + } + const res = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.authMethodOwnedPkp.publicKey, + sessionSigs: litActionSessionSigs + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log("\u2705 res:", res); + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + if (!res.signature.startsWith("0x")) { + throw new Error(`Expected "signature" to start with 0x`); + } + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + log("\u2705 res:", res); +}; + +// local-tests/tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs.ts +init_shim(); +var testUseInvalidLitActionIpfsCodeToGenerateSessionSigs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + await getInvalidLitActionIpfsSessionSigs(devEnv, alice); + } catch (e2) { + console.log("\u274C THIS IS EXPECTED: ", e2); + if (e2.message === "An error related to validation has occured.") { + console.log( + "\u2705 testUseInvalidLitActionIpfsCodeToGenerateSessionSigs is expected to have an error" + ); + } else { + throw e2; + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testSolAuthSigToEncryptDecryptString.ts +init_shim(); +var testSolAuthSigToEncryptDecryptString = async (devEnv) => { + const accs = AccessControlConditions.getSolBasicAccessControlConditions({ + userAddress: devEnv.bareSolAuthSig.address + }); + const encryptRes = await encryptString( + { + solRpcConditions: accs, + dataToEncrypt: "Hello world" + }, + devEnv.litNodeClient + ); + console.log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const decryptRes = await decryptToString( + { + solRpcConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + authSig: devEnv.bareSolAuthSig, + chain: "solana" + }, + devEnv.litNodeClient + ); + if (decryptRes !== "Hello world") { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } + console.log("\u2705 decryptRes:", decryptRes); +}; + +// local-tests/tests/testEthAuthSigToEncryptDecryptString.ts +init_shim(); +var testEthAuthSigToEncryptDecryptString = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + if (CENTRALISATION_BY_NETWORK[devEnv.network] === "decentralised") { + await alice.mintCapacityCreditsNFT(); + } + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authSig.address + }); + const encryptRes = await encryptString( + { + accessControlConditions: accs, + dataToEncrypt: "Hello world" + }, + devEnv.litNodeClient + ); + log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const decryptRes = await decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + authSig: alice.authSig, + chain: "ethereum" + }, + devEnv.litNodeClient + ); + if (decryptRes !== "Hello world") { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } + console.log("\u2705 decryptRes:", decryptRes); +}; + +// local-tests/tests/testCosmosAuthSigToEncryptDecryptString.ts +init_shim(); +var testCosmosAuthSigToEncryptDecryptString = async (devEnv) => { + console.log("\u274C\u274C THIS IS A KNOWN FAILING TEST, PLEASE IGNORE FOR NOW. \u274C\u274C"); + devEnv.setUnavailable(LIT_NETWORK.Custom); + devEnv.setUnavailable(LIT_NETWORK.DatilDev); + const accs = AccessControlConditions.getCosmosBasicAccessControlConditions({ + userAddress: devEnv.bareCosmosAuthSig.address + }); + const encryptRes = await encryptString( + { + unifiedAccessControlConditions: accs, + dataToEncrypt: "Hello world" + }, + devEnv.litNodeClient + ); + console.log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + try { + const decryptRes = await decryptToString( + { + unifiedAccessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + authSig: devEnv.bareCosmosAuthSig, + chain: "cosmos" + }, + devEnv.litNodeClient + ); + console.log("decryptRes:", decryptRes); + if (decryptRes !== "Hello world") { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } + console.log("\u2705 decryptRes:", decryptRes); + } catch (e2) { + console.log("\u274C ERROR:", e2); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToSignMessage.ts +init_shim(); + +// packages/pkp-ethers/src/index.ts +init_shim(); + +// packages/pkp-ethers/src/lib/handler.ts +init_shim(); +init_lib2(); +import { typedSignatureHash } from "@metamask/eth-sig-util"; + +// packages/pkp-ethers/src/lib/helper.ts +init_shim(); +function convertHexToUtf8(value) { + try { + if (ethers_exports.utils.isHexString(value)) { + return ethers_exports.utils.toUtf8String(value); + } + return value; + } catch (e2) { + return value; + } +} +var getTransactionToSign = (txParams) => { + const formattedTx = Object.assign({}, txParams); + if (formattedTx.gas) { + delete formattedTx.gas; + } + if (formattedTx.from) { + delete formattedTx.from; + } + return formattedTx; +}; +function isSignedTransaction(tx) { + try { + const parsedTx = ethers_exports.utils.parseTransaction(tx); + return !!parsedTx.v && !!parsedTx.r && !!parsedTx.s; + } catch (err) { + return false; + } +} + +// packages/pkp-ethers/src/lib/handler.ts +var signTypedData = async (signer, msgParams) => { + if (typeof msgParams === "string") { + msgParams = JSON.parse(msgParams); + } + const { types, domain, primaryType, message } = msgParams; + if (types["EIP712Domain"]) { + delete types["EIP712Domain"]; + } + const signature2 = await signer._signTypedData(domain, types, message); + return signature2; +}; +var signTypedDataLegacy = async (signer, msgParams) => { + const messageHash = typedSignatureHash(msgParams); + let sig; + if (signer.runLitAction) { + const _signer = signer; + sig = await _signer.runSign(ethers_exports.utils.arrayify(messageHash)); + } else { + throw new InvalidArgumentException( + { + info: { + signer, + msgParams + } + }, + "Unabled to runLitAction. This signer is not a PKPEthersWallet" + ); + } + const encodedSig = joinSignature({ + r: "0x" + sig.r, + s: "0x" + sig.s, + v: sig.recid + }); + return encodedSig; +}; +var validateAddressesMatch = (signerAddress, requestAddress) => { + if (signerAddress.toLowerCase() !== requestAddress.toLowerCase()) { + throw new UnauthorizedException( + { + info: { + signerAddress, + requestAddress + } + }, + `PKPWallet address does not match address requested` + ); + } +}; +var validateSignature = (signature2) => { + if (signature2 === null || signature2 === void 0 || signature2 === "") { + throw new InvalidParamType( + { + info: { + signature: signature2 + } + }, + "Signature is null or undefined" + ); + } +}; +function getTypedDataVersionInfo({ signer, payload }) { + if (!payload.params[0]) { + throw new InvalidParamType( + { + info: { + payload + } + }, + "signTypedDataHandler: payload.params[0] is not defined" + ); + } + const ethersIsAddress = ethers_exports.utils.isAddress(payload.params[0]); + let info; + if (ethersIsAddress) { + info = { + logMessage: "RUNNING VERSION 3 or 4", + addressIndex: 0, + msgParamsIndex: 1, + signTypedDataFn: signTypedData + }; + } else { + info = { + logMessage: "RUNNING VERSION 1", + addressIndex: 1, + msgParamsIndex: 0, + signTypedDataFn: signTypedDataLegacy + }; + } + let addressRequested = payload.params[info.addressIndex]; + validateAddressesMatch(signer.address, addressRequested); + let msgParams = payload.params[info.msgParamsIndex]; + return { addressRequested, msgParams, info }; +} +var signTypedDataHandler = async ({ + signer, + payload +}) => { + if (!signer || !payload) { + throw new ParamsMissingError( + { + info: { + signer, + payload + } + }, + `signer or payload is not defined` + ); + } + const { msgParams, info } = getTypedDataVersionInfo({ + signer, + payload + }); + const signature2 = await info.signTypedDataFn(signer, msgParams); + validateSignature(signature2); + return { signature: signature2 }; +}; +var signTransactionHandler = async ({ + signer, + payload +}) => { + const unsignedTx = payload.params[0]; + const addressRequested = unsignedTx.from; + const _signer = signer; + validateAddressesMatch(_signer.address, addressRequested); + const unsignedTxFormatted = getTransactionToSign(unsignedTx); + const signedTxSignature = await _signer.signTransaction(unsignedTxFormatted); + validateSignature(signedTxSignature); + return signedTxSignature; +}; +var sendTransactionHandler = async ({ + signer, + payload +}) => { + const unsignedTx = payload.params[0]; + const addressRequested = unsignedTx.from; + const _signer = signer; + validateAddressesMatch(_signer.address, addressRequested); + const unsignedTxFormatted = getTransactionToSign(unsignedTx); + const signedTxSignature = await _signer.signTransaction(unsignedTxFormatted); + validateSignature(signedTxSignature); + const txRes = await _signer.sendTransaction(signedTxSignature); + return txRes; +}; +var sendRawTransactionHandler = async ({ + signer, + payload +}) => { + const tx = getTransactionToSign(payload.params[0]); + const signature2 = await signer.sendTransaction(tx); + validateSignature(signature2); + return { signature: signature2 }; +}; +var signHandler = async ({ + signer, + payload +}) => { + const addressRequested = payload.params[0]; + validateAddressesMatch(signer.address, addressRequested); + const msg = convertHexToUtf8(payload.params[1]); + const signature2 = await signer.signMessage(msg); + validateSignature(signature2); + return { signature: signature2 }; +}; +var personalSignHandler = async ({ + signer, + payload, + capability +}) => { + const addressRequested = payload.params[1]; + validateAddressesMatch(signer.address, addressRequested); + const msg = convertHexToUtf8(payload.params[0]); + if (capability) { + } + const signature2 = await signer.signMessage(msg); + validateSignature(signature2); + return { signature: signature2 }; +}; +var methodHandlers = { + // signing + eth_sign: signHandler, + personal_sign: personalSignHandler, + // signing typed data - the handler will choose the correct version to use + eth_signTypedData: signTypedDataHandler, + eth_signTypedData_v1: signTypedDataHandler, + eth_signTypedData_v3: signTypedDataHandler, + eth_signTypedData_v4: signTypedDataHandler, + // sign tx + eth_signTransaction: signTransactionHandler, + // send tx + eth_sendTransaction: sendTransactionHandler, + eth_sendRawTransaction: sendRawTransactionHandler +}; +var ethRequestHandler = async ({ + signer, + payload +}) => { + if (!methodHandlers.hasOwnProperty(payload.method)) { + throw new UnsupportedMethodError( + { + info: { + payload, + signer + } + }, + `Ethereum JSON-RPC signing method "${payload.method}" is not supported` + ); + } + const fn = methodHandlers[payload.method]; + try { + const data = await fn({ signer, payload }); + if (data["signature"]) { + return data.signature; + } + if (data["txRes"]) { + await data.txRes.wait(); + return data.txRes; + } + return data; + } catch (e2) { + throw new UnknownError( + { + info: { + payload, + signer + }, + cause: e2 + }, + "Something went wrong when handling Ethereum JSON-RPC requests for the given method and payload" + ); + } +}; + +// packages/pkp-ethers/src/lib/pkp-ethers.ts +init_shim(); +init_lib7(); +init_lib2(); +init_lib12(); +init_lib22(); +init_lib24(); +init_lib5(); +init_lib(); +init_lib4(); +init_lib23(); +init_lib17(); + +// packages/pkp-base/src/index.ts +init_shim(); + +// packages/pkp-base/src/lib/pkp-base.ts +init_shim(); +import depd7 from "depd"; +var deprecated7 = depd7("lit-js-sdk:pkp-base:pkp-base"); +var compressPubKey = (pubKey) => { + const testBuffer = Buffer.from(pubKey, "hex"); + if (testBuffer.length === 64) { + pubKey = "04" + pubKey; + } + const uint8array = Buffer.from(pubKey, "hex"); + const compressedKey = publicKeyConvert(uint8array, true); + const hex = Buffer.from(compressedKey).toString("hex"); + return hex; +}; +var PKPBase = class { + rpcs; + _controllerAuthSig; + controllerAuthMethods; + controllerSessionSigs; + authContext; + uncompressedPubKey; + uncompressedPubKeyBuffer; + compressedPubKey; + compressedPubKeyBuffer; + litNodeClient; + litActionCode; + litActionIPFS; + litActionJsParams; + debug; + useAction; + // -- debug things + PREFIX = "[PKPBase]"; + orange = "\x1B[33m"; + reset = "\x1B[0m"; + get litNodeClientReady() { + return this.litNodeClient.ready; + } + /** + * @deprecated - Use a different authentication method instead. + */ + get controllerAuthSig() { + deprecated7("controllerAuthSig is deprecated."); + return this._controllerAuthSig; + } + /** + * @deprecated - Use a different authentication method instead. + */ + set controllerAuthSig(value) { + deprecated7("controllerAuthSig is deprecated."); + this._controllerAuthSig = value; + } + // Rest of the PKPBase class... + constructor(pkpBaseProp) { + const prop = { ...pkpBaseProp }; + this.debug = prop.debug || false; + if (prop.pkpPubKey.startsWith("0x")) { + prop.pkpPubKey = prop.pkpPubKey.slice(2); + } + this.setUncompressedPubKeyAndBuffer(prop); + this.setCompressedPubKeyAndBuffer(prop); + this.rpcs = prop.rpcs; + this.controllerAuthSig = prop.controllerAuthSig; + this.controllerAuthMethods = prop.controllerAuthMethods; + this.controllerSessionSigs = prop.controllerSessionSigs; + this.authContext = prop.authContext; + this.validateAuthContext(); + this.setLitAction(prop); + this.setLitActionJsParams(prop.litActionJsParams || {}); + this.litNodeClient = prop.litNodeClient; + } + /** + * Creates a new instance of the PKPBase class with the provided properties. + * + * @param { PKPBaseProp } pkpBaseProp - The properties for the PKPBase instance. + * + * @returns { PKPBase } - A new instance of the PKPBase class. + * */ + static createInstance(pkpBaseProp) { + return new PKPBase(pkpBaseProp); + } + /** + * Sets the uncompressed public key and its buffer representation. + * + * @param { PKPBaseProp } prop - The properties for the PKPBase instance. + */ + setUncompressedPubKeyAndBuffer(prop) { + try { + this.uncompressedPubKey = prop.pkpPubKey; + this.uncompressedPubKeyBuffer = Buffer.from(prop.pkpPubKey, "hex"); + } catch (e2) { + throw new UnknownError( + { + info: { + param: "pkpPubKey", + value: prop.pkpPubKey + }, + cause: e2 + }, + "Failed to set uncompressed public key and buffer" + ); + } + } + /** + * Sets the compressed public key and its buffer representation. + * + * @param {PKPBaseProp} prop - The properties for the PKPBase instance. + */ + setCompressedPubKeyAndBuffer(prop) { + try { + this.compressedPubKey = compressPubKey(prop.pkpPubKey); + this.compressedPubKeyBuffer = Buffer.from(this.compressedPubKey, "hex"); + } catch (e2) { + throw new UnknownError( + { + info: { + param: "pkpPubKey", + value: prop.pkpPubKey + }, + cause: e2 + }, + "Failed to set compressed public key and buffer" + ); + } + } + /** + * Sets the Lit action to be executed by the LitNode client. + * + * @param {PKPBaseProp} pkpBaseProp - An object containing the parameters for the Lit action. + * + * @returns {void} - If both `litActionCode` and `litActionIPFS` are present, throws an Error. Otherwise, does not return a value. + */ + setLitAction(pkpBaseProp) { + this.litActionCode = pkpBaseProp.litActionCode; + this.litActionIPFS = pkpBaseProp.litActionIPFS; + if (pkpBaseProp.litActionCode && pkpBaseProp.litActionIPFS) { + throw new InitError( + { + info: { + pkpBaseProp + } + }, + "Both litActionCode and litActionIPFS cannot be present at the same time." + ); + } + if (!pkpBaseProp.litActionCode && !pkpBaseProp.litActionIPFS) { + this.log( + "No lit action code or IPFS hash provided. Using default action." + ); + this.useAction = false; + } + } + /** + * A function that sets the value of the litActionJsParams property to the given params object. + * @template CustomType - A generic type that extends T, where T is the type of the litActionJsParams property. + * + * @param { CustomType } params - An object of type CustomType that contains the parameters to be set as litActionJsParams. + * + * @returns { void } + */ + setLitActionJsParams(params) { + this.litActionJsParams = params; + } + /** + * Initializes the PKPBase instance by connecting to the LIT node. + */ + async init() { + try { + await this.litNodeClient.connect(); + this.log("Connected to Lit Node"); + } catch (e2) { + throw new LitNodeClientNotReadyError( + { + info: { + litNodeConfig: this.litNodeClient.config + }, + cause: e2 + }, + "Failed to connect to Lit Node" + ); + } + } + validateAuthContext() { + const providedAuthentications = [ + this.controllerAuthSig, + this.controllerSessionSigs, + this.authContext + ].filter(Boolean).length; + if (providedAuthentications !== 1) { + if (this.controllerAuthSig) { + logError("controllerAuthSig is provided"); + } + if (this.controllerSessionSigs) { + logError("controllerSessionSigs is provided"); + } + if (this.authContext) { + logError("authContext is provided"); + } + throw new InitError( + { + info: { + authContext: this.authContext, + controllerAuthSig: this.controllerAuthSig, + controllerSessionSigs: this.controllerSessionSigs + } + }, + "Must specify one, and only one, authentication method " + ); + } + if (this.authContext && !this.authContext.getSessionSigsProps) { + throw new InitError( + { + info: { + authContext: this.authContext + } + }, + "authContext must be an object with getSessionSigsProps" + ); + } + } + async getSessionSigs() { + const sessionSigs = this.authContext ? await this.litNodeClient.getSessionSigs( + this.authContext.getSessionSigsProps + ) : this.controllerSessionSigs; + if (!sessionSigs) { + throw new UnknownError({}, "Could not get sessionSigs"); + } + return sessionSigs; + } + /** + * Runs the specified Lit action with the given parameters. + * + * @param {Uint8Array} toSign - The data to be signed by the Lit action. + * @param {string} sigName - The name of the signature to be returned by the Lit action. + * + * @returns {Promise} - A Promise that resolves with the signature returned by the Lit action. + * + * @throws {Error} - Throws an error if `pkpPubKey` is not provided, if `controllerAuthSig` or `controllerSessionSigs` is not provided, if `controllerSessionSigs` is not an object, if `executeJsArgs` does not have either `code` or `ipfsId`, or if an error occurs during the execution of the Lit action. + */ + async runLitAction(toSign, sigName) { + if (this.litActionCode && this.litActionIPFS) { + throw new InitError( + { + info: { + litActionCode: this.litActionCode, + litActionIPFS: this.litActionIPFS + } + }, + "litActionCode and litActionIPFS cannot exist at the same time" + ); + } + await this.ensureLitNodeClientReady(); + if (!this.uncompressedPubKey) { + throw new InitError( + {}, + "pkpPubKey (aka. uncompressedPubKey) is required" + ); + } + this.validateAuthContext(); + const controllerSessionSigs = await this.getSessionSigs(); + const executeJsArgs = { + ...this.litActionCode && { code: this.litActionCode }, + ...this.litActionIPFS && { ipfsId: this.litActionIPFS }, + sessionSigs: controllerSessionSigs, + jsParams: { + ...{ + toSign, + publicKey: this.uncompressedPubKey, + sigName + }, + ...{ + ...this.litActionJsParams + } + } + }; + if (!executeJsArgs.code && !executeJsArgs.ipfsId) { + throw new InitError( + { + info: { + litActionCode: this.litActionCode, + litActionIPFS: this.litActionIPFS + } + }, + "executeJsArgs must have either code or ipfsId" + ); + } + this.log("executeJsArgs:", executeJsArgs); + const res = await this.litNodeClient.executeJs(executeJsArgs); + const sig = res.signatures[sigName]; + this.log("res:", res); + this.log("res.signatures[sigName]:", sig); + if (sig.r && sig.s) { + sig.r = sig.r.length % 2 === 0 ? sig.r : "0" + sig.r; + sig.s = sig.s.length % 2 === 0 ? sig.s : "0" + sig.s; + } + return sig; + } + /** + * Sign the provided data with the PKP private key. + * + * @param {Uint8Array} toSign - The data to be signed. + * + * @returns {Promise} - A Promise that resolves with the signature of the provided data. + * + * @throws {Error} - Throws an error if `pkpPubKey` is not provided, if `controllerAuthSig` or `controllerSessionSigs` is not provided, if `controllerSessionSigs` is not an object, or if an error occurs during the signing process. + */ + async runSign(toSign) { + await this.ensureLitNodeClientReady(); + if (!this.uncompressedPubKey) { + throw new InitError( + {}, + "pkpPubKey (aka. uncompressedPubKey) is required" + ); + } + this.validateAuthContext(); + const controllerSessionSigs = await this.getSessionSigs(); + try { + const sig = await this.litNodeClient.pkpSign({ + toSign, + pubKey: this.uncompressedPubKey, + sessionSigs: controllerSessionSigs + }); + if (!sig) { + throw new UnknownError({}, "No signature returned"); + } + sig.r = sig.r.length % 2 === 0 ? sig.r : "0" + sig.r; + sig.s = sig.s.length % 2 === 0 ? sig.s : "0" + sig.s; + return sig; + } catch (e2) { + console.log("err: ", e2); + throw e2; + } + } + /** + * Ensures that the LitNode client is ready for use by waiting for initialization if necessary. + * If the client is already ready, this function does nothing. + * + * @returns {Promise} - A Promise that resolves when the LitNode client is ready for use. + */ + async ensureLitNodeClientReady() { + if (!this.litNodeClientReady) { + await this.init(); + } + } + /** + * Logs the provided arguments to the console, but only if debugging is enabled. + * + * @param {...any[]} args - The values to be logged to the console. + * + * @returns {void} - This function does not return a value. + */ + log(...args) { + if (this.debug) { + console.log(this.orange + this.PREFIX + this.reset, ...args); + } + } +}; + +// packages/pkp-ethers/src/lib/pkp-ethers.ts +var logger47 = new Logger(version27); +var PKPEthersWallet = class { + pkpBase; + address; + _isSigner; + rpcProvider; + provider; + // -- manual tx settings -- + manualGasPrice; + manualGasLimit; + nonce; + chainId; + get litNodeClientReady() { + return this.pkpBase.litNodeClientReady; + } + constructor(prop) { + this.pkpBase = PKPBase.createInstance(prop); + const rpcUrl = prop.rpc || RPC_URL_BY_NETWORK[prop.litNodeClient.config.litNetwork]; + if (!rpcUrl) { + throw new InitError( + { + info: { + rpcUrl, + network: prop.litNodeClient.config.litNetwork + } + }, + "No RPC URL provided, and none could be found for the provided LitNodeClient" + ); + } + this.rpcProvider = new ethers_exports.providers.StaticJsonRpcProvider({ + url: rpcUrl, + skipFetchSetup: true + }); + this.provider = prop.provider ?? this.rpcProvider; + defineReadOnly(this, "_isSigner", true); + defineReadOnly( + this, + "address", + computeAddress(this.pkpBase.uncompressedPubKeyBuffer) + ); + } + getRpc = () => { + return this.rpcProvider.connection.url; + }; + setRpc = async (rpc) => { + this.rpcProvider = new ethers_exports.providers.StaticJsonRpcProvider({ + url: rpc, + skipFetchSetup: true + }); + }; + handleRequest = async (payload) => { + return await ethRequestHandler({ + signer: this, + payload + }); + }; + request = async (payload) => { + return this.handleRequest(payload); + }; + setGasPrice = (gasPrice) => { + this.manualGasPrice = gasPrice; + }; + setGasLimit = (gasLimit) => { + this.manualGasLimit = gasLimit; + }; + setNonce = (nonce) => { + this.nonce = nonce; + }; + setChainId = (chainId) => { + this.chainId = chainId; + }; + resetManualSettings = () => { + this.manualGasPrice = void 0; + this.manualGasLimit = void 0; + this.nonce = void 0; + this.chainId = void 0; + }; + get publicKey() { + return this.pkpBase.uncompressedPubKey; + } + getAddress() { + const addr = computeAddress(this.pkpBase.uncompressedPubKeyBuffer); + return Promise.resolve(addr); + } + /** + * Initializes the PKPEthersWallet instance and its dependencies + */ + async init() { + await this.pkpBase.init(); + } + connect() { + throw new UnsupportedMethodError( + { + info: { + method: "connect" + } + }, + "Use setRPC to set a new JSON RPC provider" + ); + } + async signTransaction(transaction) { + this.pkpBase.log("signTransaction => transaction:", transaction); + await this.pkpBase.ensureLitNodeClientReady(); + const addr = await this.getAddress(); + this.pkpBase.log("signTransaction => addr:", addr); + if (this.manualGasPrice) { + transaction.gasPrice = this.manualGasPrice; + } + if (this.manualGasLimit) { + transaction.gasLimit = this.manualGasLimit; + } + if (this.nonce) { + transaction.nonce = this.nonce; + } + if (this.chainId) { + transaction.chainId = this.chainId; + } + try { + if (!transaction["gasLimit"]) { + transaction.gasLimit = await this.rpcProvider.estimateGas(transaction); + this.pkpBase.log("signTransaction => gasLimit:", transaction.gasLimit); + } + if (!transaction["nonce"]) { + transaction.nonce = await this.rpcProvider.getTransactionCount(addr); + this.pkpBase.log("signTransaction => nonce:", transaction.nonce); + } + if (!transaction["chainId"]) { + transaction.chainId = (await this.rpcProvider.getNetwork()).chainId; + this.pkpBase.log("signTransaction => chainId:", transaction.chainId); + } + if (!transaction["gasPrice"]) { + transaction.gasPrice = await this.getGasPrice(); + this.pkpBase.log("signTransaction => gasPrice:", transaction.gasPrice); + } + } catch (err) { + this.pkpBase.log( + "signTransaction => unable to populate transaction with details:", + err + ); + } + return resolveProperties(transaction).then(async (tx) => { + this.pkpBase.log("tx.from:", tx.from); + this.pkpBase.log("this.address:", this.address); + if (tx.from != null) { + if (getAddress(tx.from) !== this.address) { + logger47.throwArgumentError( + "transaction from address mismatch", + "transaction.from", + transaction.from + ); + } + delete tx.from; + } + const serializedTx = serialize(tx); + const unsignedTxn = keccak256(serializedTx); + const toSign = arrayify(unsignedTxn); + let signature2; + if (this.pkpBase.useAction) { + this.pkpBase.log("running lit action => sigName: pkp-eth-sign-tx"); + signature2 = (await this.pkpBase.runLitAction(toSign, "pkp-eth-sign-tx")).signature; + } else { + this.pkpBase.log("requesting signature from nodes"); + signature2 = (await this.pkpBase.runSign(toSign)).signature; + } + this.resetManualSettings(); + return serialize(tx, signature2); + }); + } + async signMessage(message) { + await this.pkpBase.ensureLitNodeClientReady(); + const toSign = arrayify(hashMessage(message)); + let signature2; + if (this.pkpBase.useAction) { + this.pkpBase.log("running lit action => sigName: pkp-eth-sign-message"); + signature2 = await this.runLitAction(toSign, "pkp-eth-sign-message"); + } else { + this.pkpBase.log("requesting signature from nodes"); + signature2 = await this.runSign(toSign); + } + return joinSignature({ + r: "0x" + signature2.r, + s: "0x" + signature2.s, + v: signature2.recid + }); + } + async _signTypedData(domain, types, value) { + await this.pkpBase.ensureLitNodeClientReady(); + const populated = await TypedDataEncoder.resolveNames( + domain, + types, + value, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + (name) => { + if (this.provider == null) { + throw new UnsupportedChainException( + { + info: { + operation: "resolveName", + value: name, + domain + } + }, + `cannot resolve ENS names without a provider`, + Object.keys(LIT_CHAINS) + ); + } + return this.provider.resolveName(name); + } + ); + const toSign = TypedDataEncoder.hash( + populated.domain, + types, + populated.value + ); + const toSignBuffer = arrayify(toSign); + let signature2; + if (this.pkpBase.useAction) { + this.pkpBase.log("running lit action => sigName: pkp-eth-sign-message"); + signature2 = await this.runLitAction(toSignBuffer, "pkp-eth-sign-message"); + } else { + this.pkpBase.log("requesting signature from nodes"); + signature2 = await this.runSign(toSignBuffer); + } + return joinSignature({ + r: "0x" + signature2.r, + s: "0x" + signature2.s, + v: signature2.recid + }); + } + encrypt(password, options, progressCallback) { + if (typeof options === "function" && !progressCallback) { + progressCallback = options; + options = {}; + } + if (progressCallback && typeof progressCallback !== "function") { + throw new InvalidParamType( + { + info: { + progressCallback + } + }, + "invalid callback" + ); + } + if (!options) { + options = {}; + } + return encrypt( + this, + password, + options, + progressCallback + ); + } + async sendTransaction(transaction) { + this.pkpBase.log("sendTransaction => transaction:", transaction); + let res; + let signedTxn; + try { + if (!isSignedTransaction(transaction)) { + const unsignedTxFormatted = getTransactionToSign(transaction); + signedTxn = await this.signTransaction(unsignedTxFormatted); + } else { + signedTxn = transaction; + } + res = await this.rpcProvider.sendTransaction(signedTxn); + } catch (e2) { + throw new UnknownError( + { + info: { + transaction + }, + cause: e2 + }, + "could not send transaction" + ); + } + return res; + } + /** + * Static methods to create Wallet instances. + */ + static createRandom(options) { + let entropy = randomBytes(16); + if (!options) { + options = {}; + } + if (options.extraEntropy) { + entropy = arrayify( + hexDataSlice(keccak256(concat([entropy, options.extraEntropy])), 0, 16) + ); + } + const mnemonic = entropyToMnemonic(entropy, options.locale); + return Wallet.fromMnemonic(mnemonic, options.path, options.locale); + } + static fromEncryptedJson(json, password, progressCallback) { + return decryptJsonWallet(json, password, progressCallback).then( + (account) => { + return new Wallet(account); + } + ); + } + static fromEncryptedJsonSync(json, password) { + return new Wallet(decryptJsonWalletSync(json, password)); + } + static fromMnemonic(mnemonic, path, wordlist2) { + if (!path) { + path = defaultPath; + } + return new Wallet( + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + HDNode.fromMnemonic(mnemonic, null, wordlist2).derivePath(path) + ); + } + getBalance(blockTag) { + return this.rpcProvider.getBalance(this.address, blockTag); + } + getTransactionCount(blockTag) { + return this.rpcProvider.getTransactionCount(this.address, blockTag); + } + estimateGas(transaction) { + return this.rpcProvider.estimateGas(transaction); + } + async call(transaction, blockTag = "latest") { + return this.rpcProvider.call(transaction, blockTag); + } + async getChainId() { + return (await this.rpcProvider.getNetwork()).chainId; + } + getGasPrice() { + return this.rpcProvider.getGasPrice(); + } + getFeeData() { + return this.rpcProvider.getFeeData(); + } + resolveName() { + throw new UnsupportedMethodError( + { + info: { + method: "resolveName" + } + }, + "resolveName is not available in PKPEthersWallet" + ); + } + checkTransaction() { + throw new UnsupportedMethodError( + { + info: { + method: "checkTransaction" + } + }, + "checkTransaction is not available in PKPEthersWallet" + ); + } + populateTransaction() { + throw new UnsupportedMethodError( + { + info: { + method: "populateTransaction" + } + }, + "populateTransaction is not available in PKPEthersWallet" + ); + } + _checkProvider() { + this.pkpBase.log( + "This function is not implemented yet, but will skip it for now." + ); + } + get mnemonic() { + throw new UnsupportedMethodError( + { + info: { + method: "mnemonic" + } + }, + "There's no mnemonic for a PKPWallet" + ); + } + get privateKey() { + throw new UnsupportedMethodError( + { + info: { + method: "privateKey" + } + }, + "This PKP contains no private key (can you imagine!?)" + ); + } + /** + * Runs the specified Lit action with the given parameters. + * + * @param {Uint8Array} toSign - The data to be signed by the Lit action. + * @param {string} sigName - The name of the signature to be returned by the Lit action. + * + * @returns {Promise} - A Promise that resolves with the signature returned by the Lit action. + * + * @throws {Error} - Throws an error if `pkpPubKey` is not provided, if `controllerAuthSig` or `controllerSessionSigs` is not provided, if `controllerSessionSigs` is not an object, if `executeJsArgs` does not have either `code` or `ipfsId`, or if an error occurs during the execution of the Lit action. + */ + async runLitAction(toSign, sigName) { + return this.pkpBase.runLitAction(toSign, sigName); + } + /** + * Sign the provided data with the PKP private key. + * + * @param {Uint8Array} toSign - The data to be signed. + * + * @returns {Promise} - A Promise that resolves with the signature of the provided data. + * + * @throws {Error} - Throws an error if `pkpPubKey` is not provided, if `controllerAuthSig` or `controllerSessionSigs` is not provided, if `controllerSessionSigs` is not an object, or if an error occurs during the signing process. + */ + async runSign(toSign) { + return this.pkpBase.runSign(toSign); + } +}; + +// packages/pkp-ethers/src/lib/pkp-ethers-types.ts +init_shim(); + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToSignMessage.ts +var testPkpEthersWithEoaSessionSigsToSignMessage = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs + }); + await pkpEthersWallet.init(); + try { + const signature2 = await pkpEthersWallet.signMessage(alice.loveLetter); + console.log("\u2705 signature:", signature2); + } catch (e2) { + throw new Error("\u274C Error: " + e2.message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext.ts +init_shim(); +var testPkpEthersWithEoaSessionSigsToSignWithAuthContext = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpEthersWallet = new PKPEthersWallet({ + pkpPubKey: alice.pkp.publicKey, + litNodeClient: devEnv.litNodeClient, + authContext: { + client: devEnv.litNodeClient, + getSessionSigsProps: { + authNeededCallback: async function(params) { + const toSign = await createSiweMessageWithRecaps({ + uri: params.uri, + expiration: params.expiration, + resources: params.resourceAbilityRequests, + walletAddress: alice.wallet.address, + nonce: await devEnv.litNodeClient.getLatestBlockhash(), + litNodeClient: devEnv.litNodeClient + }); + const authSig = await generateAuthSig({ + signer: alice.wallet, + toSign + }); + return authSig; + }, + resourceAbilityRequests: [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ] + } + } + }); + await pkpEthersWallet.init(); + try { + const signature2 = await pkpEthersWallet.signMessage(alice.loveLetter); + console.log("\u2705 signature:", signature2); + } catch (e2) { + throw new Error("\u274C Error: " + e2.message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSign.ts +init_shim(); +var testPkpEthersWithEoaSessionSigsToEthSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + console.log("devEnv.network:", devEnv.network); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs + }); + await pkpEthersWallet.init(); + try { + const message = "Hello world"; + const hexMsg = ethers_exports.utils.hexlify(ethers_exports.utils.toUtf8Bytes(message)); + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_sign", + params: [alice.pkp.ethAddress, hexMsg] + } + }); + const recoveredAddr = ethers_exports.utils.verifyMessage(message, signature2); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error( + `\u274C test eth_sign recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` + ); + } + console.log("\u2705 recoveredAddr:", recoveredAddr); + } catch (e2) { + throw new Error("\u274C Error: " + e2.message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToPersonalSign.ts +init_shim(); +var testPkpEthersWithEoaSessionSigsToPersonalSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs + }); + await pkpEthersWallet.init(); + try { + const message = "Free the web"; + const hexMsg = ethers_exports.utils.hexlify(ethers_exports.utils.toUtf8Bytes(message)); + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "personal_sign", + params: [hexMsg, alice.pkp.ethAddress] + } + }); + const recoveredAddr = ethers_exports.utils.verifyMessage(message, signature2); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error( + `\u274C recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` + ); + } + console.log("\u2705 personal_sign recoveredAddr:", recoveredAddr); + } catch (e2) { + throw new Error("\u274C Error: " + e2.message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToSendTx.ts +init_shim(); +var testPkpEthersWithEoaSessionSigsToSendTx = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs + }); + await devEnv.getFunds(alice.pkp.ethAddress); + await pkpEthersWallet.init(); + try { + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers_exports.BigNumber.from("21000"); + const value = ethers_exports.BigNumber.from("0"); + const data = "0x"; + const tx = { + from, + to, + gasLimit, + value, + data + }; + const txRes = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_sendTransaction", + params: [tx] + } + }); + console.log("\u2705 txRes:", txRes); + } catch (e2) { + if (e2.message.includes("insufficient FPE funds")) { + console.log( + `\u{1F9EA} PKPEthersWallet should be able to send tx (insufficient FPE funds \u2757\uFE0F)` + ); + } else { + throw new Error(`\u274C Error: ${e2.toString()}`); + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithPkpSessionSigsToSignMessage.ts +init_shim(); +var testPkpEthersWithPkpSessionSigsToSignMessage = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs + }); + await pkpEthersWallet.init(); + try { + const signature2 = await pkpEthersWallet.signMessage(alice.loveLetter); + console.log("\u2705 signature:", signature2); + } catch (e2) { + throw new Error("\u274C Error: " + e2.message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSign.ts +init_shim(); +var testPkpEthersWithPkpSessionSigsToEthSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + console.log("devEnv.network:", devEnv.network); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs + }); + await pkpEthersWallet.init(); + try { + const message = "Hello world"; + const hexMsg = ethers_exports.utils.hexlify(ethers_exports.utils.toUtf8Bytes(message)); + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_sign", + params: [alice.pkp.ethAddress, hexMsg] + } + }); + const recoveredAddr = ethers_exports.utils.verifyMessage(message, signature2); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error( + `\u274C test eth_sign recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` + ); + } + console.log("\u2705 recoveredAddr:", recoveredAddr); + } catch (e2) { + throw new Error("\u274C Error: " + e2.message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithPkpSessionSigsToPersonalSign.ts +init_shim(); +var testPkpEthersWithPkpSessionSigsToPersonalSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs + }); + await pkpEthersWallet.init(); + try { + const message = "Free the web"; + const hexMsg = ethers_exports.utils.hexlify(ethers_exports.utils.toUtf8Bytes(message)); + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "personal_sign", + params: [hexMsg, alice.pkp.ethAddress] + } + }); + const recoveredAddr = ethers_exports.utils.verifyMessage(message, signature2); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error( + `\u274C recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` + ); + } + console.log("\u2705 personal_sign recoveredAddr:", recoveredAddr); + } catch (e2) { + throw new Error("\u274C Error: " + e2.message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithPkpSessionSigsToSendTx.ts +init_shim(); +var testPkpEthersWithPkpSessionSigsToSendTx = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs + }); + await devEnv.getFunds(alice.pkp.ethAddress); + await pkpEthersWallet.init(); + try { + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers_exports.BigNumber.from("21000"); + const value = ethers_exports.BigNumber.from("0"); + const data = "0x"; + const tx = { + from, + to, + gasLimit, + value, + data + }; + const txRes = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_sendTransaction", + params: [tx] + } + }); + console.log("\u2705 txRes:", txRes); + } catch (e2) { + if (e2.message.includes("insufficient FPE funds")) { + console.log( + `\u{1F9EA} PKPEthersWallet should be able to send tx (insufficient FPE funds \u2757\uFE0F)` + ); + } else { + throw new Error(`\u274C Error: ${e2.toString()}`); + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction.ts +init_shim(); +var testPkpEthersWithEoaSessionSigsToEthSignTransaction = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs + }); + await pkpEthersWallet.init(); + try { + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers_exports.BigNumber.from("21000"); + const value = ethers_exports.BigNumber.from("0"); + const data = "0x"; + const tx = { + from, + to, + gasLimit, + value, + data + }; + const rawSignedTx = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTransaction", + params: [tx] + } + }); + const parsedTransaction = ethers_exports.utils.parseTransaction(rawSignedTx); + const signature2 = ethers_exports.utils.joinSignature({ + r: parsedTransaction.r, + s: parsedTransaction.s, + v: parsedTransaction.v + }); + const rawTx = { + nonce: parsedTransaction.nonce, + gasPrice: parsedTransaction.gasPrice, + gasLimit: parsedTransaction.gasLimit, + to: parsedTransaction.to, + value: parsedTransaction.value, + data: parsedTransaction.data, + chainId: parsedTransaction.chainId + // Include chainId if the transaction is EIP-155 + }; + const txHash = ethers_exports.utils.keccak256( + ethers_exports.utils.serializeTransaction(rawTx) + ); + const { v, r: r3, s: s2 } = parsedTransaction; + const recoveredAddress = ethers_exports.utils.recoverAddress(txHash, { r: r3, s: s2, v }); + if (!parsedTransaction) { + throw new Error("\u274C parsedTransaction should not be null"); + } + if (signature2.length !== 132) { + throw new Error( + `\u274C signature should be 132 characters long, got ${signature2.length}` + ); + } + if (recoveredAddress.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddres should be ${alice.pkp.ethAddress}, got ${recoveredAddress}` + ); + } + } catch (e2) { + if (e2.message.includes("insufficient FPE funds")) { + console.log( + `\u{1F9EA} PKPEthersWallet should be able to send tx (insufficient FPE funds \u2757\uFE0F)` + ); + } else { + throw new Error(`\u274C Error: ${e2.toString()}`); + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction.ts +init_shim(); +var testPkpEthersWithPkpSessionSigsToEthSignTransaction = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs + }); + await pkpEthersWallet.init(); + try { + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers_exports.BigNumber.from("21000"); + const value = ethers_exports.BigNumber.from("0"); + const data = "0x"; + const tx = { + from, + to, + gasLimit, + value, + data + }; + const rawSignedTx = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTransaction", + params: [tx] + } + }); + const parsedTransaction = ethers_exports.utils.parseTransaction(rawSignedTx); + const signature2 = ethers_exports.utils.joinSignature({ + r: parsedTransaction.r, + s: parsedTransaction.s, + v: parsedTransaction.v + }); + const rawTx = { + nonce: parsedTransaction.nonce, + gasPrice: parsedTransaction.gasPrice, + gasLimit: parsedTransaction.gasLimit, + to: parsedTransaction.to, + value: parsedTransaction.value, + data: parsedTransaction.data, + chainId: parsedTransaction.chainId + // Include chainId if the transaction is EIP-155 + }; + const txHash = ethers_exports.utils.keccak256( + ethers_exports.utils.serializeTransaction(rawTx) + ); + const { v, r: r3, s: s2 } = parsedTransaction; + const recoveredAddress = ethers_exports.utils.recoverAddress(txHash, { r: r3, s: s2, v }); + if (!parsedTransaction) { + throw new Error("\u274C parsedTransaction should not be null"); + } + if (signature2.length !== 132) { + throw new Error( + `\u274C signature should be 132 characters long, got ${signature2.length}` + ); + } + if (recoveredAddress.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddres should be ${alice.pkp.ethAddress}, got ${recoveredAddress}` + ); + } + } catch (e2) { + if (e2.message.includes("insufficient FPE funds")) { + console.log( + `\u{1F9EA} PKPEthersWallet should be able to send tx (insufficient FPE funds \u2757\uFE0F)` + ); + } else { + throw new Error(`\u274C Error: ${e2.toString()}`); + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction.ts +init_shim(); +var testPkpEthersWithLitActionSessionSigsToEthSignTransaction = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs + }); + await pkpEthersWallet.init(); + try { + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers_exports.BigNumber.from("21000"); + const value = ethers_exports.BigNumber.from("0"); + const data = "0x"; + const tx = { + from, + to, + gasLimit, + value, + data + }; + const rawSignedTx = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTransaction", + params: [tx] + } + }); + const parsedTransaction = ethers_exports.utils.parseTransaction(rawSignedTx); + const signature2 = ethers_exports.utils.joinSignature({ + r: parsedTransaction.r, + s: parsedTransaction.s, + v: parsedTransaction.v + }); + const rawTx = { + nonce: parsedTransaction.nonce, + gasPrice: parsedTransaction.gasPrice, + gasLimit: parsedTransaction.gasLimit, + to: parsedTransaction.to, + value: parsedTransaction.value, + data: parsedTransaction.data, + chainId: parsedTransaction.chainId + // Include chainId if the transaction is EIP-155 + }; + const txHash = ethers_exports.utils.keccak256( + ethers_exports.utils.serializeTransaction(rawTx) + ); + const { v, r: r3, s: s2 } = parsedTransaction; + const recoveredAddress = ethers_exports.utils.recoverAddress(txHash, { r: r3, s: s2, v }); + if (!parsedTransaction) { + throw new Error("\u274C parsedTransaction should not be null"); + } + if (signature2.length !== 132) { + throw new Error( + `\u274C signature should be 132 characters long, got ${signature2.length}` + ); + } + if (recoveredAddress.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddres should be ${alice.pkp.ethAddress}, got ${recoveredAddress}` + ); + } + } catch (e2) { + if (e2.message.includes("insufficient FPE funds")) { + console.log( + `\u{1F9EA} PKPEthersWallet should be able to send tx (insufficient FPE funds \u2757\uFE0F)` + ); + } else { + throw new Error(`\u274C Error: ${e2.toString()}`); + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1.ts +init_shim(); +import { + SignTypedDataVersion, + recoverTypedSignature +} from "@metamask/eth-sig-util"; +var testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = [ + { + type: "string", + name: "Message", + value: "Hi, Alice!" + }, + { + type: "uint32", + name: "A number", + value: "1337" + } + ]; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData_v1", + params: [msgParams, alice.pkp.ethAddress] + } + }); + const signatureBytes = ethers_exports.utils.arrayify(signature2); + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signatureBytes, + version: SignTypedDataVersion.V1 + }); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + console.log("signature: ", signature2); + console.log("recoveredAddr: ", recoveredAddr); + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1.ts +init_shim(); +import { + SignTypedDataVersion as SignTypedDataVersion2, + recoverTypedSignature as recoverTypedSignature2 +} from "@metamask/eth-sig-util"; +var testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = [ + { + type: "string", + name: "Message", + value: "Hi, Alice!" + }, + { + type: "uint32", + name: "A number", + value: "1337" + } + ]; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData_v1", + params: [msgParams, alice.pkp.ethAddress] + } + }); + const signatureBytes = ethers_exports.utils.arrayify(signature2); + const recoveredAddr = recoverTypedSignature2({ + data: msgParams, + signature: signatureBytes, + version: SignTypedDataVersion2.V1 + }); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + console.log("signature: ", signature2); + console.log("recoveredAddr: ", recoveredAddr); + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1.ts +init_shim(); +import { + SignTypedDataVersion as SignTypedDataVersion3, + recoverTypedSignature as recoverTypedSignature3 +} from "@metamask/eth-sig-util"; +var testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = [ + { + type: "string", + name: "Message", + value: "Hi, Alice!" + }, + { + type: "uint32", + name: "A number", + value: "1337" + } + ]; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData_v1", + params: [msgParams, alice.pkp.ethAddress] + } + }); + const signatureBytes = ethers_exports.utils.arrayify(signature2); + const recoveredAddr = recoverTypedSignature3({ + data: msgParams, + signature: signatureBytes, + version: SignTypedDataVersion3.V1 + }); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + console.log("signature: ", signature2); + console.log("recoveredAddr: ", recoveredAddr); + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3.ts +init_shim(); +import { + SignTypedDataVersion as SignTypedDataVersion4, + recoverTypedSignature as recoverTypedSignature4 +} from "@metamask/eth-sig-util"; +var testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallet", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person" }, + { name: "contents", type: "string" } + ] + }, + primaryType: "Mail", + domain: { + name: "Ether Mail", + version: "1", + chainId: 80001, + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" + }, + message: { + from: { + name: "Cow", + wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" + }, + to: { + name: "Bob", + wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" + }, + contents: "Hello, Bob!" + } + }; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData_v3", + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)] + } + }); + const recoveredAddr = recoverTypedSignature4({ + data: { + // @ts-ignore + types: msgParams.types, + // @ts-ignore + domain: msgParams.domain, + // @ts-ignore + primaryType: msgParams.primaryType, + // @ts-ignore + message: msgParams.message + }, + signature: signature2, + version: SignTypedDataVersion4.V3 + }); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4.ts +init_shim(); +import { + SignTypedDataVersion as SignTypedDataVersion5, + recoverTypedSignature as recoverTypedSignature5 +} from "@metamask/eth-sig-util"; +var testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + domain: { + chainId: 80001, + name: "Ether Mail", + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", + version: "1" + }, + message: { + contents: "Hello, Bob!", + from: { + name: "Cow", + wallets: [ + "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", + "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF" + ] + }, + to: [ + { + name: "Bob", + wallets: [ + "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB", + "0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57", + "0xB0B0b0b0b0b0B000000000000000000000000000" + ] + } + ] + }, + primaryType: "Mail", + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person[]" }, + { name: "contents", type: "string" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallets", type: "address[]" } + ] + } + }; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData_v4", + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)] + } + }); + const recoveredAddr = recoverTypedSignature5({ + data: msgParams, + signature: signature2, + version: SignTypedDataVersion5.V4 + }); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData.ts +init_shim(); +var testPkpEthersWithEoaSessionSigsToEthSignTypedData = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallet", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person" }, + { name: "contents", type: "string" } + ] + }, + primaryType: "Mail", + domain: { + name: "Ether Mail", + version: "1", + chainId: 80001, + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" + }, + message: { + from: { + name: "Cow", + wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" + }, + to: { + name: "Bob", + wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" + }, + contents: "Hello, Bob!" + } + }; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData", + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)] + } + }); + const recoveredAddr = ethers_exports.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature2 + ); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil.ts +init_shim(); +var testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallet", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person" }, + { name: "contents", type: "string" } + ] + }, + primaryType: "Mail", + domain: { + name: "Ether Mail", + version: "1", + chainId: 80001, + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" + }, + message: { + from: { + name: "Cow", + wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" + }, + to: { + name: "Bob", + wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" + }, + contents: "Hello, Bob!" + } + }; + const signature2 = await signTypedData(pkpEthersWallet, msgParams); + const recoveredAddr = ethers_exports.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature2 + ); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithLitActionSessionSigsToSignMessage.ts +init_shim(); +var testPkpEthersWithLitActionSessionSigsToSignMessage = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs + }); + await pkpEthersWallet.init(); + try { + const signature2 = await pkpEthersWallet.signMessage(alice.loveLetter); + console.log("\u2705 signature:", signature2); + } catch (e2) { + throw new Error("\u274C Error: " + e2.message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSign.ts +init_shim(); +var testPkpEthersWithLitActionSessionSigsToEthSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + console.log("devEnv.network:", devEnv.network); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs + }); + await pkpEthersWallet.init(); + try { + const message = "Hello world"; + const hexMsg = ethers_exports.utils.hexlify(ethers_exports.utils.toUtf8Bytes(message)); + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_sign", + params: [alice.pkp.ethAddress, hexMsg] + } + }); + const recoveredAddr = ethers_exports.utils.verifyMessage(message, signature2); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error( + `\u274C test eth_sign recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` + ); + } + console.log("\u2705 recoveredAddr:", recoveredAddr); + } catch (e2) { + throw new Error("\u274C Error: " + e2.message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithLitActionSessionSigsToPersonalSign.ts +init_shim(); +var testPkpEthersWithLitActionSessionSigsToPersonalSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs + }); + await pkpEthersWallet.init(); + try { + const message = "Free the web"; + const hexMsg = ethers_exports.utils.hexlify(ethers_exports.utils.toUtf8Bytes(message)); + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "personal_sign", + params: [hexMsg, alice.pkp.ethAddress] + } + }); + const recoveredAddr = ethers_exports.utils.verifyMessage(message, signature2); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error( + `\u274C recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` + ); + } + console.log("\u2705 personal_sign recoveredAddr:", recoveredAddr); + } catch (e2) { + throw new Error("\u274C Error: " + e2.message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithLitActionSessionSigsToSendTx.ts +init_shim(); +var testPkpEthersWithLitActionSessionSigsToSendTx = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs + }); + await devEnv.getFunds(alice.pkp.ethAddress); + await pkpEthersWallet.init(); + try { + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers_exports.BigNumber.from("21000"); + const value = ethers_exports.BigNumber.from("0"); + const data = "0x"; + const tx = { + from, + to, + gasLimit, + value, + data + }; + const txRes = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_sendTransaction", + params: [tx] + } + }); + console.log("\u2705 txRes:", txRes); + } catch (e2) { + if (e2.message.includes("insufficient FPE funds")) { + console.log( + `\u{1F9EA} PKPEthersWallet should be able to send tx (insufficient FPE funds \u2757\uFE0F)` + ); + } else { + throw new Error(`\u274C Error: ${e2.toString()}`); + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3.ts +init_shim(); +import { + SignTypedDataVersion as SignTypedDataVersion6, + recoverTypedSignature as recoverTypedSignature6 +} from "@metamask/eth-sig-util"; +var testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallet", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person" }, + { name: "contents", type: "string" } + ] + }, + primaryType: "Mail", + domain: { + name: "Ether Mail", + version: "1", + chainId: 80001, + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" + }, + message: { + from: { + name: "Cow", + wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" + }, + to: { + name: "Bob", + wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" + }, + contents: "Hello, Bob!" + } + }; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData_v3", + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)] + } + }); + const recoveredAddr = recoverTypedSignature6({ + data: { + // @ts-ignore + types: msgParams.types, + // @ts-ignore + domain: msgParams.domain, + // @ts-ignore + primaryType: msgParams.primaryType, + // @ts-ignore + message: msgParams.message + }, + signature: signature2, + version: SignTypedDataVersion6.V3 + }); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3.ts +init_shim(); +import { + SignTypedDataVersion as SignTypedDataVersion7, + recoverTypedSignature as recoverTypedSignature7 +} from "@metamask/eth-sig-util"; +var testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallet", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person" }, + { name: "contents", type: "string" } + ] + }, + primaryType: "Mail", + domain: { + name: "Ether Mail", + version: "1", + chainId: 80001, + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" + }, + message: { + from: { + name: "Cow", + wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" + }, + to: { + name: "Bob", + wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" + }, + contents: "Hello, Bob!" + } + }; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData_v3", + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)] + } + }); + const recoveredAddr = recoverTypedSignature7({ + data: { + // @ts-ignore + types: msgParams.types, + // @ts-ignore + domain: msgParams.domain, + // @ts-ignore + primaryType: msgParams.primaryType, + // @ts-ignore + message: msgParams.message + }, + signature: signature2, + version: SignTypedDataVersion7.V3 + }); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4.ts +init_shim(); +import { + SignTypedDataVersion as SignTypedDataVersion8, + recoverTypedSignature as recoverTypedSignature8 +} from "@metamask/eth-sig-util"; +var testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + domain: { + chainId: 80001, + name: "Ether Mail", + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", + version: "1" + }, + message: { + contents: "Hello, Bob!", + from: { + name: "Cow", + wallets: [ + "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", + "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF" + ] + }, + to: [ + { + name: "Bob", + wallets: [ + "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB", + "0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57", + "0xB0B0b0b0b0b0B000000000000000000000000000" + ] + } + ] + }, + primaryType: "Mail", + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person[]" }, + { name: "contents", type: "string" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallets", type: "address[]" } + ] + } + }; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData_v4", + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)] + } + }); + const recoveredAddr = recoverTypedSignature8({ + data: msgParams, + signature: signature2, + version: SignTypedDataVersion8.V4 + }); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4.ts +init_shim(); +import { + SignTypedDataVersion as SignTypedDataVersion9, + recoverTypedSignature as recoverTypedSignature9 +} from "@metamask/eth-sig-util"; +var testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + domain: { + chainId: 80001, + name: "Ether Mail", + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", + version: "1" + }, + message: { + contents: "Hello, Bob!", + from: { + name: "Cow", + wallets: [ + "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", + "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF" + ] + }, + to: [ + { + name: "Bob", + wallets: [ + "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB", + "0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57", + "0xB0B0b0b0b0b0B000000000000000000000000000" + ] + } + ] + }, + primaryType: "Mail", + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person[]" }, + { name: "contents", type: "string" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallets", type: "address[]" } + ] + } + }; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData_v4", + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)] + } + }); + const recoveredAddr = recoverTypedSignature9({ + data: msgParams, + signature: signature2, + version: SignTypedDataVersion9.V4 + }); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData.ts +init_shim(); +var testPkpEthersWithPkpSessionSigsToEthSignTypedData = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallet", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person" }, + { name: "contents", type: "string" } + ] + }, + primaryType: "Mail", + domain: { + name: "Ether Mail", + version: "1", + chainId: 80001, + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" + }, + message: { + from: { + name: "Cow", + wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" + }, + to: { + name: "Bob", + wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" + }, + contents: "Hello, Bob!" + } + }; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData", + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)] + } + }); + const recoveredAddr = ethers_exports.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature2 + ); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData.ts +init_shim(); +var testPkpEthersWithLitActionSessionSigsToEthSignTypedData = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallet", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person" }, + { name: "contents", type: "string" } + ] + }, + primaryType: "Mail", + domain: { + name: "Ether Mail", + version: "1", + chainId: 80001, + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" + }, + message: { + from: { + name: "Cow", + wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" + }, + to: { + name: "Bob", + wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" + }, + contents: "Hello, Bob!" + } + }; + const signature2 = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: "eth_signTypedData", + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)] + } + }); + const recoveredAddr = ethers_exports.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature2 + ); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil.ts +init_shim(); +var testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallet", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person" }, + { name: "contents", type: "string" } + ] + }, + primaryType: "Mail", + domain: { + name: "Ether Mail", + version: "1", + chainId: 80001, + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" + }, + message: { + from: { + name: "Cow", + wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" + }, + to: { + name: "Bob", + wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" + }, + contents: "Hello, Bob!" + } + }; + const signature2 = await signTypedData(pkpEthersWallet, msgParams); + const recoveredAddr = ethers_exports.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature2 + ); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil.ts +init_shim(); +var testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs + }); + await pkpEthersWallet.init(); + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + { name: "verifyingContract", type: "address" } + ], + Person: [ + { name: "name", type: "string" }, + { name: "wallet", type: "address" } + ], + Mail: [ + { name: "from", type: "Person" }, + { name: "to", type: "Person" }, + { name: "contents", type: "string" } + ] + }, + primaryType: "Mail", + domain: { + name: "Ether Mail", + version: "1", + chainId: 80001, + verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" + }, + message: { + from: { + name: "Cow", + wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" + }, + to: { + name: "Bob", + wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" + }, + contents: "Hello, Bob!" + } + }; + const signature2 = await signTypedData(pkpEthersWallet, msgParams); + const recoveredAddr = ethers_exports.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature2 + ); + if (signature2.length !== 132) { + throw new Error("\u274C signature should be 132 characters long"); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error( + `\u274C recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` + ); + } + } catch (e2) { + throw new Error(`\u274C ${e2.toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs.ts +init_shim(); +var testUseCustomAuthSessionSigsToPkpSignExecuteJs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const customAuthMethod = { + authMethodType: 89989, + authMethodId: "app-id-xxx:user-id-yyy", + accessToken: "xxx" + }; + const addPermittedAuthMethodReceipt = await alice.contractsClient.addPermittedAuthMethod({ + pkpTokenId: alice.pkp.tokenId, + authMethodType: customAuthMethod.authMethodType, + authMethodId: customAuthMethod.authMethodId, + authMethodScopes: [AUTH_METHOD_SCOPE.SignAnything] + }); + console.log( + "\u2705 addPermittedAuthMethodReceipt:", + addPermittedAuthMethodReceipt + ); + const litActionCodeString = `(async () => { + const a = 1; + const b = 2; + + if (a + b === 3 && customAuthMethod.authMethodType === 89989) { + LitActions.setResponse({response:"true"}); + } else { + LitActions.setResponse({response:"false"}); + } + + console.log("Lit.Auth:", Lit.Auth); + })()`; + const IPFSID = await stringToIpfsHash(litActionCodeString); + console.log("\u2705 IPFSID:", IPFSID.toString()); + const addPermittedActionReceipt = await alice.contractsClient.addPermittedAction({ + ipfsId: IPFSID, + pkpTokenId: alice.pkp.tokenId, + authMethodScopes: [AUTH_METHOD_SCOPE.SignAnything] + }); + console.log("\u2705 addPermittedActionReceipt:", addPermittedActionReceipt); + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + const litActionSessionSigs = await devEnv.litNodeClient.getLitActionSessionSigs({ + pkpPublicKey: alice.pkp.publicKey, + resourceAbilityRequests: [ + { + resource: new LitPKPResource("*"), + ability: LIT_ABILITY.PKPSigning + }, + { + resource: new LitActionResource("*"), + ability: LIT_ABILITY.LitActionExecution + } + ], + // litActionIpfsId: IPFSID, + litActionCode: Buffer.from(litActionCodeString).toString("base64"), + jsParams: { + publicKey: `0x${alice.pkp.publicKey}`, + customAuthMethod, + sigName: "custom-auth-sig" + }, + ...centralisation === "decentralised" && { + capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig] + } + }); + try { + const res = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.pkp.publicKey, + sessionSigs: litActionSessionSigs + }); + console.log("\u2705 pkpSign res:", res); + } catch (e2) { + throw new Error(e2); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + try { + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp.publicKey + } + }); + console.log("\u2705 executeJs res:", res); + } catch (e2) { + throw new Error(e2); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testExecuteJsSignAndCombineEcdsa.ts +init_shim(); +var testExecuteJsSignAndCombineEcdsa = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = (await devEnv.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: alice.wallet + })).capacityDelegationAuthSig; + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log("bobsSingleSessionSig:", bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r3) => { + const encodedRecap = r3.split(":")[2]; + const decodedRecap = Buffer.from(encodedRecap, "base64").toString(); + console.log(decodedRecap); + }); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signAndCombineEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + Lit.Actions.setResponse({ + response: sigShare + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey + } + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + if (!res.response) { + throw new Error("Response not found, expecting signature in response"); + } + const sig = JSON.parse(res.response); + console.log("signature returned as a response", sig); + if (!sig.r) { + throw new Error("invalid signature returned from lit action"); + } + if (!sig.s) { + throw new Error("invalid signature returned from lit action"); + } + if (sig.v === void 0) { + throw new Error("invalid signature returned from lit action"); + } + console.log("\u2705 testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs"); +}; + +// local-tests/tests/testExecuteJsDecryptAndCombine.ts +init_shim(); +var testExecutJsDecryptAndCombine = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress + }); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const encryptRes = await encryptString( + { + accessControlConditions: accs, + dataToEncrypt: "Hello world" + }, + devEnv.litNodeClient + ); + log("encryptRes:", encryptRes); + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const resp = await Lit.Actions.decryptAndCombine({ + accessControlConditions, + ciphertext, + dataToEncryptHash, + authSig: null, + chain: 'ethereum', + }); + Lit.Actions.setResponse({ + response: resp + }); + })();`, + jsParams: { + accessControlConditions: accs, + dataToEncryptHash: encryptRes.dataToEncryptHash, + ciphertext: encryptRes.ciphertext + } + }); + devEnv.releasePrivateKeyFromUser(alice); + if (res.response !== "Hello world") { + throw new Error("content does not match what was expected"); + } +}; + +// local-tests/tests/testExecuteJsBroadcastAndCollect.ts +init_shim(); +var testExecuteJsBroadcastAndCollect = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress + }); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + let rand = Math.floor(Math.random() * 100); + const resp = await Lit.Actions.broadcastAndCollect({ + name: "temperature", + value: rand.toString(), + }); + Lit.Actions.setResponse({ + response: JSON.stringify(resp) + }); + })();`, + jsParams: {} + }); + devEnv.releasePrivateKeyFromUser(alice); + const response = res.response; + if (!response) { + throw new Error("Should contained broadcast data"); + } +}; + +// local-tests/tests/testRelayer.ts +init_shim(); +var testRelayer = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litRelay = new LitRelay({ + relayUrl: LitRelay.getRelayUrl(devEnv.network), + relayApiKey: "test-api-key" + }); + const ethWalletProvider = new EthWalletProvider({ + relay: litRelay, + litNodeClient: devEnv.litNodeClient + }); + const pkps = await ethWalletProvider.fetchPKPsThroughRelayer( + alice.authMethod + ); + if (pkps.length <= 0) { + throw new Error("No PKPs found"); + } else { + console.log("\u2705 1. [testRelayer] /fetch-pkps-by-auth-method works"); + } + const claimRequest = { + authMethod: alice.authMethod, + signer: alice.wallet + }; + const claimRes = await devEnv.litNodeClient.claimKeyId(claimRequest); + if (!claimRes.claimedKeyId) { + throw new Error(`Expected "claimedKeyId" in claimRes`); + } + if (!claimRes.pubkey) { + throw new Error(`Expected "pubkey" in claimRes`); + } + if (!claimRes.mintTx) { + throw new Error(`Expected "mintTx" in claimRes`); + } + claimRes.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); + log("\u2705 2. [testRelayer] Claim works"); +}; + +// local-tests/tests/wrapped-keys/testEthereumSignMessageGeneratedKey.ts +init_shim(); + +// packages/wrapped-keys/src/index.ts +init_shim(); + +// packages/wrapped-keys/src/lib/api/index.ts +init_shim(); + +// packages/wrapped-keys/src/lib/api/batch-generate-private-keys.ts +init_shim(); + +// packages/wrapped-keys/src/lib/api/utils.ts +init_shim(); + +// packages/wrapped-keys/src/lib/constants.ts +init_shim(); +var CHAIN_ETHEREUM = "ethereum"; +var LIT_PREFIX = "lit_"; +var NETWORK_EVM = "evm"; +var NETWORK_SOLANA = "solana"; + +// packages/wrapped-keys/src/lib/api/utils.ts +function getKeyTypeFromNetwork(network) { + if (network === NETWORK_EVM) { + return "K256"; + } else if (network === NETWORK_SOLANA) { + return "ed25519"; + } else { + throw new Error(`Network not implemented ${network}`); + } +} +function getFirstSessionSig(pkpSessionSigs) { + const sessionSigsEntries = Object.entries(pkpSessionSigs); + if (sessionSigsEntries.length === 0) { + throw new Error( + `Invalid pkpSessionSigs, length zero: ${JSON.stringify(pkpSessionSigs)}` + ); + } + const [[, sessionSig]] = sessionSigsEntries; + log(`Session Sig being used: ${JSON.stringify(sessionSig)}`); + return sessionSig; +} +function getPkpAddressFromSessionSig(pkpSessionSig) { + const sessionSignedMessage = JSON.parse( + pkpSessionSig.signedMessage + ); + const capabilities = sessionSignedMessage.capabilities; + if (!capabilities || capabilities.length === 0) { + throw new Error( + `Capabilities in the session's signedMessage is empty, but required.` + ); + } + const delegationAuthSig = capabilities.find(({ algo }) => algo === "LIT_BLS"); + if (!delegationAuthSig) { + throw new Error( + "SessionSig is not from a PKP; no LIT_BLS capabilities found" + ); + } + const pkpAddress = delegationAuthSig.address; + log(`pkpAddress to permit decryption: ${pkpAddress}`); + return pkpAddress; +} +function getPkpAccessControlCondition(pkpAddress) { + if (!ethers_exports.utils.isAddress(pkpAddress)) { + throw new Error( + `pkpAddress is not a valid Ethereum Address: ${pkpAddress}` + ); + } + return { + contractAddress: "", + standardContractType: "", + chain: CHAIN_ETHEREUM, + method: "", + parameters: [":userAddress"], + returnValueTest: { + comparator: "=", + value: pkpAddress + } + }; +} + +// packages/wrapped-keys/src/lib/lit-actions-client/index.ts +init_shim(); + +// packages/wrapped-keys/src/lib/lit-actions-client/batch-generate-keys.ts +init_shim(); + +// packages/wrapped-keys/src/lib/lit-actions-client/utils.ts +init_shim(); + +// packages/wrapped-keys/src/lib/lit-actions-client/code-repository.ts +init_shim(); +var litActionCodeRepository = Object.freeze({ + signTransaction: Object.seal({ + evm: "", + solana: "" + }), + signMessage: Object.seal({ + evm: "", + solana: "" + }), + generateEncryptedKey: Object.seal({ + evm: "", + solana: "" + }), + exportPrivateKey: Object.seal({ + evm: "", + solana: "" + }) +}); +var litActionCodeRepositoryCommon = { + batchGenerateEncryptedKeys: "" +}; + +// packages/wrapped-keys/src/lib/lit-actions-client/constants.ts +init_shim(); +var LIT_ACTION_CID_REPOSITORY = Object.freeze({ + signTransaction: Object.freeze({ + evm: "QmRpAgGKEmgeBRhqdC2EH17QUt6puwsbm8Z2nNneVN4uJG", + solana: "QmR1nPG2tnmC72zuCEMZUZrrMEkbDiMPNHW45Dsm2n7xnk" + }), + signMessage: Object.freeze({ + evm: "QmXi9iqJvXrHoUGSo5WREonrruDhzQ7cFr7Cry3wX2hmue", + solana: "QmcEJGVqRYtVukjm2prCPT7Fs66GpaqZwmZoxEHMHor6Jz" + }), + generateEncryptedKey: Object.freeze({ + evm: "QmeD6NYCWhUCLgxgpkgSguaKjwnpCnJ6Yf8SdsyPpK4eKK", + solana: "QmPkVD3hEjMi1T5zQuvdrFCXaGTEMHNdAhAL4WHkqxijrQ" + }), + exportPrivateKey: Object.freeze({ + evm: "QmUJ74pTUqeeHzDGdfwCph1vJVNJ1rRzJdvMiTjS1BMwYj", + solana: "QmUJ74pTUqeeHzDGdfwCph1vJVNJ1rRzJdvMiTjS1BMwYj" + }) +}); +var LIT_ACTION_CID_REPOSITORY_COMMON = Object.freeze({ + batchGenerateEncryptedKeys: "QmR8Zs7ctSEctxBrSnAYhMXFXCC1ub8K1xvMn5Js3NCSAA" +}); + +// packages/wrapped-keys/src/lib/lit-actions-client/utils.ts +function postLitActionValidation(result) { + if (!result) { + throw new Error("There was an unknown error running the Lit Action."); + } + const { response } = result; + if (!response) { + throw new Error( + `Expected "response" in Lit Action result: ${JSON.stringify(result)}` + ); + } + if (typeof response !== "string") { + throw new Error( + `Lit Action should return a string response: ${JSON.stringify(result)}` + ); + } + if (!result.success) { + throw new Error(`Expected "success" in res: ${JSON.stringify(result)}`); + } + if (response.startsWith("Error:")) { + throw new Error(`Error executing the Signing Lit Action: ${response}`); + } + return response; +} +function getLitActionCid(network, actionType) { + assertNetworkIsValid(network); + return LIT_ACTION_CID_REPOSITORY[actionType][network]; +} +function getLitActionCode(network, actionType) { + assertNetworkIsValid(network); + return litActionCodeRepository[actionType][network]; +} +function assertNetworkIsValid(network) { + const validNetworks = ["evm", "solana"]; + if (!validNetworks.includes(network)) { + throw new Error( + `Invalid network: ${network}. Must be one of ${validNetworks.join(", ")}.` + ); + } +} +function getLitActionCodeOrCid(network, actionType) { + const litActionCode = getLitActionCode(network, actionType); + if (litActionCode) { + return { litActionCode }; + } + return { litActionIpfsCid: getLitActionCid(network, actionType) }; +} +function getLitActionCodeOrCidCommon(actionType) { + const litActionCode = getLitActionCodeCommon(actionType); + if (litActionCode) { + return { litActionCode }; + } + return { litActionIpfsCid: getLitActionCidCommon(actionType) }; +} +function getLitActionCidCommon(actionType) { + return LIT_ACTION_CID_REPOSITORY_COMMON[actionType]; +} +function getLitActionCodeCommon(actionType) { + return litActionCodeRepositoryCommon[actionType]; +} + +// packages/wrapped-keys/src/lib/lit-actions-client/batch-generate-keys.ts +async function batchGenerateKeysWithLitAction(args) { + const { + accessControlConditions, + litNodeClient, + actions, + pkpSessionSigs, + litActionIpfsCid, + litActionCode + } = args; + const result = await litNodeClient.executeJs({ + useSingleNode: true, + sessionSigs: pkpSessionSigs, + ipfsId: litActionIpfsCid, + code: litActionCode, + jsParams: { + actions, + accessControlConditions + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[litNodeClient.config.litNetwork] + } + }); + const response = postLitActionValidation(result); + return JSON.parse(response); +} + +// packages/wrapped-keys/src/lib/lit-actions-client/export-private-key.ts +init_shim(); +async function exportPrivateKeyWithLitAction(args) { + const { + accessControlConditions, + litNodeClient, + pkpSessionSigs, + litActionCode, + litActionIpfsCid, + storedKeyMetadata + } = args; + const { + pkpAddress, + ciphertext, + dataToEncryptHash, + ...storeKeyMetadataMinusEncryptedAndPkp + } = storedKeyMetadata; + const result = await litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: litActionCode, + ipfsId: litActionIpfsCid, + jsParams: { + pkpAddress, + ciphertext, + dataToEncryptHash, + accessControlConditions + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[litNodeClient.config.litNetwork] + } + }); + const decryptedPrivateKey = postLitActionValidation(result); + return { + decryptedPrivateKey, + pkpAddress, + ...storeKeyMetadataMinusEncryptedAndPkp + }; +} + +// packages/wrapped-keys/src/lib/lit-actions-client/generate-key.ts +init_shim(); +async function generateKeyWithLitAction({ + litNodeClient, + pkpSessionSigs, + litActionIpfsCid, + litActionCode, + accessControlConditions, + pkpAddress +}) { + const result = await litNodeClient.executeJs({ + useSingleNode: true, + sessionSigs: pkpSessionSigs, + ipfsId: litActionIpfsCid, + code: litActionCode, + jsParams: { + pkpAddress, + accessControlConditions + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[litNodeClient.config.litNetwork] + } + }); + const response = postLitActionValidation(result); + return JSON.parse(response); +} + +// packages/wrapped-keys/src/lib/lit-actions-client/sign-message.ts +init_shim(); +async function signMessageWithLitAction(args) { + const { + accessControlConditions, + litNodeClient, + messageToSign, + pkpSessionSigs, + litActionIpfsCid, + litActionCode, + storedKeyMetadata + } = args; + const { pkpAddress, ciphertext, dataToEncryptHash } = storedKeyMetadata; + const result = await litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + ipfsId: litActionIpfsCid, + code: litActionCode, + jsParams: { + pkpAddress, + ciphertext, + dataToEncryptHash, + messageToSign, + accessControlConditions + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[litNodeClient.config.litNetwork] + } + }); + return postLitActionValidation(result); +} + +// packages/wrapped-keys/src/lib/lit-actions-client/sign-transaction.ts +init_shim(); +async function signTransactionWithLitAction({ + accessControlConditions, + broadcast, + litActionIpfsCid, + litActionCode, + litNodeClient, + pkpSessionSigs, + storedKeyMetadata: { ciphertext, dataToEncryptHash, pkpAddress }, + unsignedTransaction +}) { + const result = await litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + ipfsId: litActionIpfsCid, + code: litActionCode, + jsParams: { + pkpAddress, + ciphertext, + dataToEncryptHash, + unsignedTransaction, + broadcast, + accessControlConditions + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[litNodeClient.config.litNetwork] + } + }); + return postLitActionValidation(result); +} + +// packages/wrapped-keys/src/lib/service-client/index.ts +init_shim(); + +// packages/wrapped-keys/src/lib/service-client/client.ts +init_shim(); + +// packages/wrapped-keys/src/lib/service-client/utils.ts +init_shim(); + +// packages/wrapped-keys/src/lib/service-client/constants.ts +init_shim(); +var SERVICE_URL_BY_NETWORKTYPE = { + TestNetworks: "https://test.wrapped.litprotocol.com/encrypted", + Production: "https://wrapped.litprotocol.com/encrypted" +}; +var SERVICE_URL_BY_LIT_NETWORK = { + [LIT_NETWORK.DatilDev]: SERVICE_URL_BY_NETWORKTYPE.TestNetworks, + [LIT_NETWORK.DatilTest]: SERVICE_URL_BY_NETWORKTYPE.TestNetworks, + [LIT_NETWORK.Datil]: SERVICE_URL_BY_NETWORKTYPE.Production +}; +var LIT_SESSIONSIG_AUTHORIZATION_SCHEMA_PREFIX = "LitSessionSig:"; + +// packages/wrapped-keys/src/lib/service-client/utils.ts +function composeAuthHeader(sessionSig) { + const sessionSigUintArr = uint8arrayFromString(JSON.stringify(sessionSig)); + return `${LIT_SESSIONSIG_AUTHORIZATION_SCHEMA_PREFIX}${uint8ArrayToBase64( + sessionSigUintArr + )}`; +} +var supportedNetworks = [ + "datil-dev", + "datil-test", + "datil" +]; +function isSupportedLitNetwork2(litNetwork) { + if (!supportedNetworks.includes(litNetwork)) { + throw new Error( + `Unsupported LIT_NETWORK! (${supportedNetworks.join("|")}) are supported.` + ); + } +} +function getServiceUrl({ litNetwork }) { + isSupportedLitNetwork2(litNetwork); + return SERVICE_URL_BY_LIT_NETWORK[litNetwork]; +} +function getBaseRequestParams(requestParams) { + const { sessionSig, method, litNetwork } = requestParams; + return { + baseUrl: getServiceUrl(requestParams), + initParams: { + method, + headers: { + "x-correlation-id": requestParams.requestId, + "Content-Type": "application/json", + "Lit-Network": litNetwork, + Authorization: composeAuthHeader(sessionSig) + // As Base64 string to avoid escaping issues + } + } + }; +} +async function getResponseErrorMessage(response) { + try { + const parsedResponse = await response.json(); + if (parsedResponse.message) { + return parsedResponse.message; + } + return JSON.stringify(parsedResponse); + } catch (e2) { + return response.text(); + } +} +async function getResponseJson(response) { + try { + return await response.json(); + } catch (e2) { + return await response.text(); + } +} +function generateRequestId() { + return Math.random().toString(16).slice(2); +} +async function makeRequest({ + url, + init: init2, + requestId +}) { + try { + const response = await fetch(url, { ...init2 }); + if (!response.ok) { + const errorMessage = await getResponseErrorMessage(response); + throw new Error(`HTTP(${response.status}): ${errorMessage}`); + } + const result = await getResponseJson(response); + if (typeof result === "string") { + throw new Error(`HTTP(${response.status}): ${result}`); + } + return result; + } catch (e2) { + throw new Error( + `Request(${requestId}) for wrapped key failed. Error: ${e2.message}${e2.cause ? " - " + e2.cause : ""}` + ); + } +} + +// packages/wrapped-keys/src/lib/service-client/client.ts +async function listPrivateKeyMetadata(params) { + const { litNetwork, sessionSig, pkpAddress } = params; + const requestId = generateRequestId(); + const { baseUrl, initParams } = getBaseRequestParams({ + litNetwork, + sessionSig, + method: "GET", + requestId + }); + return makeRequest({ + url: `${baseUrl}/${pkpAddress}`, + init: initParams, + requestId + }); +} +async function fetchPrivateKey(params) { + const { litNetwork, sessionSig, id: id2, pkpAddress } = params; + const requestId = generateRequestId(); + const { baseUrl, initParams } = getBaseRequestParams({ + litNetwork, + sessionSig, + method: "GET", + requestId + }); + return makeRequest({ + url: `${baseUrl}/${pkpAddress}/${id2}`, + init: initParams, + requestId + }); +} +async function storePrivateKey(params) { + const { litNetwork, sessionSig, storedKeyMetadata } = params; + const requestId = generateRequestId(); + const { baseUrl, initParams } = getBaseRequestParams({ + litNetwork, + sessionSig, + method: "POST", + requestId + }); + const { pkpAddress, id: id2 } = await makeRequest({ + url: baseUrl, + init: { + ...initParams, + body: JSON.stringify(storedKeyMetadata) + }, + requestId + }); + return { pkpAddress, id: id2 }; +} +async function storePrivateKeyBatch(params) { + const { litNetwork, sessionSig, storedKeyMetadataBatch } = params; + const requestId = generateRequestId(); + const { baseUrl, initParams } = getBaseRequestParams({ + litNetwork, + sessionSig, + method: "POST", + requestId + }); + const { pkpAddress, ids } = await makeRequest({ + url: `${baseUrl}_batch`, + init: { + ...initParams, + body: JSON.stringify({ keyParamsBatch: storedKeyMetadataBatch }) + }, + requestId + }); + return { pkpAddress, ids }; +} + +// packages/wrapped-keys/src/lib/api/batch-generate-private-keys.ts +async function batchGeneratePrivateKeys(params) { + const { pkpSessionSigs, litNodeClient } = params; + const sessionSig = getFirstSessionSig(pkpSessionSigs); + const pkpAddress = getPkpAddressFromSessionSig(sessionSig); + const allowPkpAddressToDecrypt = getPkpAccessControlCondition(pkpAddress); + const { litActionCode, litActionIpfsCid } = getLitActionCodeOrCidCommon( + "batchGenerateEncryptedKeys" + ); + const actionResults = await batchGenerateKeysWithLitAction({ + ...params, + litActionIpfsCid: litActionCode ? void 0 : litActionIpfsCid, + litActionCode: litActionCode ? litActionCode : void 0, + accessControlConditions: [allowPkpAddressToDecrypt], + pkpSessionSigs + }); + const keyParamsBatch = actionResults.map((keyData) => { + const { generateEncryptedPrivateKey, network } = keyData; + return { + ...generateEncryptedPrivateKey, + keyType: getKeyTypeFromNetwork(network) + }; + }); + const { ids } = await storePrivateKeyBatch({ + sessionSig, + storedKeyMetadataBatch: keyParamsBatch, + litNetwork: litNodeClient.config.litNetwork + }); + const results = actionResults.map( + (actionResult, ndx) => { + const { + generateEncryptedPrivateKey: { memo, publicKey } + } = actionResult; + const id2 = ids[ndx]; + const signature2 = actionResult.signMessage?.signature; + return { + ...signature2 ? { signMessage: { signature: signature2 } } : {}, + generateEncryptedPrivateKey: { + memo, + id: id2, + generatedPublicKey: publicKey, + pkpAddress + } + }; + } + ); + return { pkpAddress, results }; +} + +// packages/wrapped-keys/src/lib/api/export-private-key.ts +init_shim(); +async function exportPrivateKey(params) { + const { litNodeClient, network, pkpSessionSigs, id: id2 } = params; + const sessionSig = getFirstSessionSig(pkpSessionSigs); + const pkpAddress = getPkpAddressFromSessionSig(sessionSig); + const storedKeyMetadata = await fetchPrivateKey({ + pkpAddress, + id: id2, + sessionSig, + litNetwork: litNodeClient.config.litNetwork + }); + const allowPkpAddressToDecrypt = getPkpAccessControlCondition( + storedKeyMetadata.pkpAddress + ); + const { litActionCode, litActionIpfsCid } = getLitActionCodeOrCid( + network, + "exportPrivateKey" + ); + return exportPrivateKeyWithLitAction({ + ...params, + litActionIpfsCid: litActionCode ? void 0 : litActionIpfsCid, + litActionCode: litActionCode ? litActionCode : void 0, + accessControlConditions: [allowPkpAddressToDecrypt], + pkpSessionSigs, + storedKeyMetadata + }); +} + +// packages/wrapped-keys/src/lib/api/generate-private-key.ts +init_shim(); +async function generatePrivateKey(params) { + const { pkpSessionSigs, network, litNodeClient, memo } = params; + const firstSessionSig = getFirstSessionSig(pkpSessionSigs); + const pkpAddress = getPkpAddressFromSessionSig(firstSessionSig); + const allowPkpAddressToDecrypt = getPkpAccessControlCondition(pkpAddress); + const { litActionCode, litActionIpfsCid } = getLitActionCodeOrCid( + network, + "generateEncryptedKey" + ); + const { ciphertext, dataToEncryptHash, publicKey } = await generateKeyWithLitAction({ + ...params, + pkpAddress, + litActionIpfsCid: litActionCode ? void 0 : litActionIpfsCid, + litActionCode: litActionCode ? litActionCode : void 0, + accessControlConditions: [allowPkpAddressToDecrypt] + }); + const { id: id2 } = await storePrivateKey({ + sessionSig: firstSessionSig, + storedKeyMetadata: { + ciphertext, + publicKey, + keyType: getKeyTypeFromNetwork(network), + dataToEncryptHash, + memo + }, + litNetwork: litNodeClient.config.litNetwork + }); + return { + pkpAddress, + id: id2, + generatedPublicKey: publicKey + }; +} + +// packages/wrapped-keys/src/lib/api/get-encrypted-key.ts +init_shim(); +async function getEncryptedKey(params) { + const { pkpSessionSigs, litNodeClient, id: id2 } = params; + const sessionSig = getFirstSessionSig(pkpSessionSigs); + const pkpAddress = getPkpAddressFromSessionSig(sessionSig); + return fetchPrivateKey({ + pkpAddress, + id: id2, + sessionSig, + litNetwork: litNodeClient.config.litNetwork + }); +} + +// packages/wrapped-keys/src/lib/api/import-private-key.ts +init_shim(); +async function importPrivateKey(params) { + const { + pkpSessionSigs, + privateKey, + publicKey, + keyType, + litNodeClient, + memo + } = params; + const firstSessionSig = getFirstSessionSig(pkpSessionSigs); + const pkpAddress = getPkpAddressFromSessionSig(firstSessionSig); + const allowPkpAddressToDecrypt = getPkpAccessControlCondition(pkpAddress); + const saltedPrivateKey = LIT_PREFIX + privateKey; + const { ciphertext, dataToEncryptHash } = await encryptString( + { + accessControlConditions: [allowPkpAddressToDecrypt], + dataToEncrypt: saltedPrivateKey + }, + litNodeClient + ); + const { id: id2 } = await storePrivateKey({ + sessionSig: firstSessionSig, + litNetwork: litNodeClient.config.litNetwork, + storedKeyMetadata: { + ciphertext, + publicKey, + keyType, + dataToEncryptHash, + memo + } + }); + return { pkpAddress, id: id2 }; +} + +// packages/wrapped-keys/src/lib/api/list-encrypted-key-metadata.ts +init_shim(); +async function listEncryptedKeyMetadata(params) { + const { pkpSessionSigs, litNodeClient } = params; + const sessionSig = getFirstSessionSig(pkpSessionSigs); + const pkpAddress = getPkpAddressFromSessionSig(sessionSig); + return listPrivateKeyMetadata({ + pkpAddress, + sessionSig, + litNetwork: litNodeClient.config.litNetwork + }); +} + +// packages/wrapped-keys/src/lib/api/sign-message-with-encrypted-key.ts +init_shim(); +async function signMessageWithEncryptedKey(params) { + const { litNodeClient, network, pkpSessionSigs, id: id2 } = params; + const sessionSig = getFirstSessionSig(pkpSessionSigs); + const pkpAddress = getPkpAddressFromSessionSig(sessionSig); + const storedKeyMetadata = await fetchPrivateKey({ + pkpAddress, + id: id2, + sessionSig, + litNetwork: litNodeClient.config.litNetwork + }); + const allowPkpAddressToDecrypt = getPkpAccessControlCondition( + storedKeyMetadata.pkpAddress + ); + const { litActionCode, litActionIpfsCid } = getLitActionCodeOrCid( + network, + "signMessage" + ); + return signMessageWithLitAction({ + ...params, + litActionIpfsCid: litActionCode ? void 0 : litActionIpfsCid, + litActionCode: litActionCode ? litActionCode : void 0, + accessControlConditions: [allowPkpAddressToDecrypt], + pkpSessionSigs, + storedKeyMetadata + }); +} + +// packages/wrapped-keys/src/lib/api/sign-transaction-with-encrypted-key.ts +init_shim(); +async function signTransactionWithEncryptedKey(params) { + const { litNodeClient, network, pkpSessionSigs, id: id2 } = params; + const sessionSig = getFirstSessionSig(pkpSessionSigs); + const pkpAddress = getPkpAddressFromSessionSig(sessionSig); + const storedKeyMetadata = await fetchPrivateKey({ + pkpAddress, + id: id2, + sessionSig, + litNetwork: litNodeClient.config.litNetwork + }); + const allowPkpAddressToDecrypt = getPkpAccessControlCondition( + storedKeyMetadata.pkpAddress + ); + const { litActionCode, litActionIpfsCid } = getLitActionCodeOrCid( + network, + "signTransaction" + ); + return signTransactionWithLitAction({ + ...params, + litActionIpfsCid: litActionCode ? void 0 : litActionIpfsCid, + litActionCode: litActionCode ? litActionCode : void 0, + storedKeyMetadata, + accessControlConditions: [allowPkpAddressToDecrypt] + }); +} + +// packages/wrapped-keys/src/lib/api/store-encrypted-key.ts +init_shim(); +async function storeEncryptedKey(params) { + const { pkpSessionSigs, litNodeClient } = params; + const sessionSig = getFirstSessionSig(pkpSessionSigs); + const { publicKey, keyType, dataToEncryptHash, ciphertext, memo } = params; + return storePrivateKey({ + storedKeyMetadata: { + publicKey, + keyType, + dataToEncryptHash, + ciphertext, + memo + }, + sessionSig, + litNetwork: litNodeClient.config.litNetwork + }); +} + +// packages/wrapped-keys/src/lib/api/store-encrypted-key-batch.ts +init_shim(); +async function storeEncryptedKeyBatch(params) { + const { pkpSessionSigs, litNodeClient, keyBatch } = params; + const sessionSig = getFirstSessionSig(pkpSessionSigs); + const pkpAddress = getPkpAddressFromSessionSig(sessionSig); + const storedKeyMetadataBatch = keyBatch.map( + ({ + keyType, + publicKey, + memo, + dataToEncryptHash, + ciphertext + }) => ({ + pkpAddress, + publicKey, + memo, + dataToEncryptHash, + ciphertext, + keyType + }) + ); + return storePrivateKeyBatch({ + storedKeyMetadataBatch, + sessionSig, + litNetwork: litNodeClient.config.litNetwork + }); +} + +// packages/wrapped-keys/src/lib/lit-actions-client/types.ts +init_shim(); + +// packages/wrapped-keys/src/index.ts +var api = { + exportPrivateKey, + generatePrivateKey, + getEncryptedKey, + listEncryptedKeyMetadata, + importPrivateKey, + signMessageWithEncryptedKey, + signTransactionWithEncryptedKey, + storeEncryptedKey, + storeEncryptedKeyBatch, + batchGeneratePrivateKeys +}; + +// local-tests/tests/wrapped-keys/testEthereumSignMessageGeneratedKey.ts +var { generatePrivateKey: generatePrivateKey2, signMessageWithEncryptedKey: signMessageWithEncryptedKey2 } = api; +var testEthereumSignMessageGeneratedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const { pkpAddress, id: id2, generatedPublicKey } = await generatePrivateKey2({ + pkpSessionSigs, + network: "evm", + litNodeClient: devEnv.litNodeClient, + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const unsignedStringMessage = "This is a test message"; + const signature2 = await signMessageWithEncryptedKey2({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "evm", + messageToSign: unsignedStringMessage, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + if (!ethers_exports.utils.isHexString(signature2)) { + throw new Error(`signature isn't hex: ${signature2}`); + } + const unsignedBinaryMessage = ethers_exports.utils.arrayify( + ethers_exports.utils.toUtf8Bytes(unsignedStringMessage) + ); + const signatureBinary = await signMessageWithEncryptedKey2({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "evm", + messageToSign: unsignedBinaryMessage, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + if (!ethers_exports.utils.isHexString(signatureBinary)) { + throw new Error(`signatureBinary isn't hex: ${signatureBinary}`); + } + if (signatureBinary !== signature2) { + throw new Error( + `signature: ${signature2} doesn't match it's signatureBinary form: ${signatureBinary}` + ); + } + log("\u2705 testEthereumSignMessageGeneratedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey.ts +init_shim(); + +// local-tests/tests/wrapped-keys/util.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/index.ts +init_shim(); +var batchGenerateEncryptedKeys2 = __toESM(require_batchGenerateEncryptedKeys()); +var exportPrivateKey3 = __toESM(require_exportPrivateKey()); +var generateEncryptedEthereumPrivateKey2 = __toESM(require_generateEncryptedEthereumPrivateKey()); +var signMessageWithEthereumEncryptedKey = __toESM(require_signMessageWithEncryptedEthereumKey()); +var signTransactionWithEthereumEncryptedKey = __toESM(require_signTransactionWithEncryptedEthereumKey()); +var generateEncryptedSolanaPrivateKey2 = __toESM(require_generateEncryptedSolanaPrivateKey()); +var signMessageWithSolanaEncryptedKey = __toESM(require_signMessageWithEncryptedSolanaKey()); +var signTransactionWithSolanaEncryptedKey = __toESM(require_signTransactionWithEncryptedSolanaKey()); + +// packages/wrapped-keys-lit-actions/src/lib/raw-action-functions/index.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/raw-action-functions/common/batchGenerateEncryptedKeys.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/internal/common/encryptKey.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/constants.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/internal/ethereum/generatePrivateKey.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/internal/ethereum/signMessage.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/internal/solana/generatePrivateKey.ts +init_shim(); +import { Keypair } from "@solana/web3.js"; + +// packages/wrapped-keys-lit-actions/src/lib/internal/solana/signMessage.ts +init_shim(); +import { Buffer as Buffer3 } from "buffer"; +import { Keypair as Keypair2 } from "@solana/web3.js"; +import nacl3 from "tweetnacl"; + +// packages/wrapped-keys-lit-actions/src/lib/raw-action-functions/common/exportPrivateKey.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/internal/common/getDecryptedKeyToSingleNode.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/abortError.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/utils.js +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/raw-action-functions/ethereum/generateEncryptedEthereumPrivateKey.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/raw-action-functions/ethereum/signMessageWithEncryptedEthereumKey.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/raw-action-functions/ethereum/signTransactionWithEncryptedEthereumKey.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/internal/ethereum/signTransaction.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/raw-action-functions/solana/generateEncryptedSolanaPrivateKey.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/raw-action-functions/solana/signMessageWithEncryptedSolanaKey.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/raw-action-functions/solana/signTransactionWithEncryptedSolanaKey.ts +init_shim(); + +// packages/wrapped-keys-lit-actions/src/lib/internal/solana/signTransaction.ts +init_shim(); +import { + clusterApiUrl, + Connection, + Keypair as Keypair3, + Transaction +} from "@solana/web3.js"; + +// local-tests/tests/wrapped-keys/util.ts +function getChainForNetwork(network) { + switch (network) { + case "datil-dev": + return { + chain: "yellowstone", + chainId: LIT_CHAINS["yellowstone"].chainId + }; + case "datil-test": + return { + chain: "yellowstone", + chainId: LIT_CHAINS["yellowstone"].chainId + }; + case "datil": + return { + chain: "yellowstone", + chainId: LIT_CHAINS["yellowstone"].chainId + }; + default: + throw new Error(`Cannot identify chain params for ${network}`); + } +} +function getGasParamsForNetwork(network) { + switch (network) { + case "datil-dev": + return { gasLimit: 5e6 }; + case "datil-test": + return { gasLimit: 5e6 }; + case "datil": + return { gasLimit: 5e6 }; + default: + throw new Error(`Cannot identify chain params for ${network}`); + } +} +function getBaseTransactionForNetwork({ + toAddress, + network +}) { + return { + toAddress, + value: "0.0001", + // in ethers (Lit tokens) + ...getChainForNetwork(network), + ...getGasParamsForNetwork(network), + dataHex: ethers_exports.utils.hexlify( + ethers_exports.utils.toUtf8Bytes("Test transaction from Alice to bob") + ) + }; +} + +// local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey.ts +var { signTransactionWithEncryptedKey: signTransactionWithEncryptedKey2, generatePrivateKey: generatePrivateKey3 } = api; +var testEthereumBroadcastTransactionGeneratedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const { pkpAddress, generatedPublicKey, id: id2 } = await generatePrivateKey3({ + pkpSessionSigs, + network: "evm", + litNodeClient: devEnv.litNodeClient, + memo: "Test key" + }); + const generatedKeysWalletAddress = ethers_exports.utils.computeAddress(generatedPublicKey); + console.log(`Sending funds to ${generatedKeysWalletAddress}`); + await devEnv.getFunds(generatedKeysWalletAddress, "0.005"); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient.config.litNetwork, + toAddress: alice.wallet.address + }); + const signedTx = await signTransactionWithEncryptedKey2({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "evm", + unsignedTransaction, + broadcast: true, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + if (!ethers_exports.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + log("\u2705 testEthereumBroadcastTransactionGeneratedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testEthereumSignMessageWrappedKey.ts +init_shim(); +var { importPrivateKey: importPrivateKey2, signMessageWithEncryptedKey: signMessageWithEncryptedKey3 } = api; +var testEthereumSignMessageWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const privateKey = ethers_exports.Wallet.createRandom().privateKey; + const { pkpAddress, id: id2 } = await importPrivateKey2({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const unsignedStringMessage = "This is a test message"; + const signature2 = await signMessageWithEncryptedKey3({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "evm", + messageToSign: unsignedStringMessage, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + if (!ethers_exports.utils.isHexString(signature2)) { + throw new Error(`signature isn't hex: ${signature2}`); + } + const unsignedBinaryMessage = ethers_exports.utils.arrayify( + ethers_exports.utils.toUtf8Bytes(unsignedStringMessage) + ); + const signatureBinary = await signMessageWithEncryptedKey3({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "evm", + messageToSign: unsignedBinaryMessage, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + if (!ethers_exports.utils.isHexString(signatureBinary)) { + throw new Error(`signatureBinary isn't hex: ${signatureBinary}`); + } + if (signatureBinary !== signature2) { + throw new Error( + `signature: ${signature2} doesn't match it's signatureBinary form: ${signatureBinary}` + ); + } + log("\u2705 testEthereumSignMessageWrappedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption.ts +init_shim(); +var testFailEthereumSignTransactionWrappedKeyInvalidDecryption = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + try { + const privateKey = ethers_exports.Wallet.createRandom().privateKey; + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + const decryptionAccessControlCondition = getPkpAccessControlCondition(alicePkpAddress); + const { ciphertext, dataToEncryptHash } = await encryptString( + { + accessControlConditions: [decryptionAccessControlCondition], + dataToEncrypt: LIT_PREFIX + privateKey + }, + devEnv.litNodeClient + ); + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + bob, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient.config.litNetwork, + toAddress: alice.wallet.address + }); + try { + const _res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigsSigning, + ipfsId: LIT_ACTION_CID_REPOSITORY.signTransaction.evm, + jsParams: { + ciphertext, + dataToEncryptHash, + unsignedTransaction, + accessControlConditions: [decryptionAccessControlCondition] + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[devEnv.litNodeClient.config.litNetwork] + } + }); + } catch (e2) { + if (e2.message.includes( + "There was an error getting the signing shares from the nodes" + )) { + console.log("\u2705 THIS IS EXPECTED: ", e2); + console.log(e2.message); + console.log( + "\u2705 testFailEthereumSignTransactionWrappedKeyInvalidDecryption is expected to have an error" + ); + } else { + throw e2; + } + } + log("\u2705 testFailEthereumSignTransactionWrappedKeyInvalidDecryption"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + } +}; + +// local-tests/tests/wrapped-keys/testEthereumSignTransactionWrappedKey.ts +init_shim(); +var { importPrivateKey: importPrivateKey3, signTransactionWithEncryptedKey: signTransactionWithEncryptedKey3 } = api; +var testEthereumSignTransactionWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const privateKey = ethers_exports.Wallet.createRandom().privateKey; + const { pkpAddress, id: id2 } = await importPrivateKey3({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient.config.litNetwork, + toAddress: alice.wallet.address + }); + const signedTx = await signTransactionWithEncryptedKey3({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "evm", + unsignedTransaction, + broadcast: false, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + if (!ethers_exports.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + log("\u2705 testEthereumSignTransactionWrappedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam.ts +init_shim(); +var { importPrivateKey: importPrivateKey4, signTransactionWithEncryptedKey: signTransactionWithEncryptedKey4 } = api; +var testFailEthereumSignTransactionWrappedKeyWithInvalidParam = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const privateKey = ethers_exports.Wallet.createRandom().privateKey; + const { pkpAddress, id: id2 } = await importPrivateKey4({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const unsignedTransaction = { + ...getBaseTransactionForNetwork({ + network: devEnv.litNodeClient.config.litNetwork, + toAddress: alice.wallet.address + }), + dataHex: "Test transaction from Alice to bob" + }; + try { + const _res = await signTransactionWithEncryptedKey4({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "evm", + unsignedTransaction, + broadcast: false, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + } catch (e2) { + if (e2.message.includes("invalid hexlify value")) { + console.log("\u2705 THIS IS EXPECTED: ", e2); + console.log(e2.message); + console.log( + "\u2705 testFailEthereumSignTransactionWrappedKeyWithInvalidParam is expected to have an error" + ); + } else { + console.log("ERROR", e2.message); + throw e2; + } + } + log("\u2705 testFailEthereumSignTransactionWrappedKeyWithInvalidParam"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam.ts +init_shim(); +var { importPrivateKey: importPrivateKey5, signTransactionWithEncryptedKey: signTransactionWithEncryptedKey5 } = api; +var testFailEthereumSignTransactionWrappedKeyWithMissingParam = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const privateKey = ethers_exports.Wallet.createRandom().privateKey; + const { pkpAddress, id: id2 } = await importPrivateKey5({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + try { + const _res = await signTransactionWithEncryptedKey5({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "evm", + unsignedTransaction: { + ...getChainForNetwork(devEnv.litNodeClient.config.litNetwork), + // @ts-expect-error This test is intentionally using the type incorrectly. + serializedTransaction: "random-value" + }, + broadcast: false, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + } catch (e2) { + if (e2.message.includes("Missing required field: toAddress")) { + console.log("\u2705 THIS IS EXPECTED: ", e2); + console.log(e2.message); + console.log( + "\u2705 testFailEthereumSignTransactionWrappedKeyWithMissingParam is expected to have an error" + ); + } else { + throw e2; + } + } + log("\u2705 testFailEthereumSignTransactionWrappedKeyWithMissingParam"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey.ts +init_shim(); +var { importPrivateKey: importPrivateKey6, signTransactionWithEncryptedKey: signTransactionWithEncryptedKey6 } = api; +var testEthereumBroadcastTransactionWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const wrappedKeysWallet = ethers_exports.Wallet.createRandom(); + const wrappedKeysWalletPrivateKey = wrappedKeysWallet.privateKey; + const wrappedKeysWalletAddress = wrappedKeysWallet.address; + console.log(`Sending funds to ${wrappedKeysWalletAddress}`); + await devEnv.getFunds(wrappedKeysWallet.address, "0.005"); + const { pkpAddress, id: id2 } = await importPrivateKey6({ + pkpSessionSigs, + privateKey: wrappedKeysWalletPrivateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient.config.litNetwork, + toAddress: alice.wallet.address + }); + const signedTx = await signTransactionWithEncryptedKey6({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "evm", + unsignedTransaction, + broadcast: true, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + if (!ethers_exports.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + log("\u2705 testEthereumBroadcastTransactionWrappedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams.ts +init_shim(); +var { importPrivateKey: importPrivateKey7, signTransactionWithEncryptedKey: signTransactionWithEncryptedKey7 } = api; +var testEthereumBroadcastWrappedKeyWithFetchGasParams = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const wrappedKeysWallet = ethers_exports.Wallet.createRandom(); + const wrappedKeysWalletPrivateKey = wrappedKeysWallet.privateKey; + const wrappedKeysWalletAddress = wrappedKeysWallet.address; + console.log(`Sending funds to ${wrappedKeysWalletAddress}`); + await devEnv.getFunds(wrappedKeysWallet.address, "0.005"); + const { pkpAddress, id: id2 } = await importPrivateKey7({ + pkpSessionSigs, + privateKey: wrappedKeysWalletPrivateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const unsignedTransaction = { + toAddress: alice.wallet.address, + value: "0.0001", + // in ethers (Lit tokens) + dataHex: ethers_exports.utils.hexlify( + ethers_exports.utils.toUtf8Bytes("Test transaction from Alice to bob") + ), + ...getChainForNetwork(devEnv.litNodeClient.config.litNetwork) + }; + const signedTx = await signTransactionWithEncryptedKey7({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "evm", + unsignedTransaction, + broadcast: true, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + if (!ethers_exports.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + log("\u2705 testEthereumBroadcastWrappedKeyWithDefaultGasParams"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testImportWrappedKey.ts +init_shim(); +var { importPrivateKey: importPrivateKey8, listEncryptedKeyMetadata: listEncryptedKeyMetadata2 } = api; +var testImportWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const privateKey = randomSolanaPrivateKey(); + const { pkpAddress, id: id2 } = await importPrivateKey8({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const keys = await listEncryptedKeyMetadata2({ + pkpSessionSigs, + litNodeClient: devEnv.litNodeClient + }); + if (keys.length !== 1 || keys[0].id !== id2) { + throw new Error( + "Keys returned by `listPrivateKeyMetadata()` do not match expected result." + ); + } + log("\u2705 testImportWrappedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testGenerateEthereumWrappedKey.ts +init_shim(); +var { generatePrivateKey: generatePrivateKey4 } = api; +var testGenerateEthereumWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const { pkpAddress, generatedPublicKey, id: id2 } = await generatePrivateKey4({ + pkpSessionSigs, + network: "evm", + litNodeClient: devEnv.litNodeClient, + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsExport = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const { decryptedPrivateKey } = await exportPrivateKey({ + pkpSessionSigs: pkpSessionSigsExport, + litNodeClient: devEnv.litNodeClient, + network: "evm", + id: id2 + }); + const wallet = new ethers_exports.Wallet(decryptedPrivateKey); + const decryptedPublicKey = wallet.publicKey; + if (decryptedPublicKey !== generatedPublicKey) { + throw new Error( + `Decrypted decryptedPublicKey: ${decryptedPublicKey} doesn't match with the original generatedPublicKey: ${generatedPublicKey}` + ); + } + log("\u2705 testGenerateEthereumWrappedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testGenerateSolanaWrappedKey.ts +init_shim(); +import { Keypair as Keypair4 } from "@solana/web3.js"; +import nacl4 from "tweetnacl"; +var { generatePrivateKey: generatePrivateKey5, signMessageWithEncryptedKey: signMessageWithEncryptedKey4, exportPrivateKey: exportPrivateKey4 } = api; +var testGenerateSolanaWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const { pkpAddress, generatedPublicKey, id: id2 } = await generatePrivateKey5({ + pkpSessionSigs, + network: "solana", + litNodeClient: devEnv.litNodeClient, + memo: "Test key" + }); + console.log(`generatedPublicKey: ${generatedPublicKey}`); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const messageToSign = "This is a test message"; + const signature2 = await signMessageWithEncryptedKey4({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "solana", + messageToSign, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + const signatureIsValidForPublicKey = nacl4.sign.detached.verify( + Buffer.from(messageToSign), + ethers_exports.utils.base58.decode(signature2), + ethers_exports.utils.base58.decode(generatedPublicKey) + ); + if (!signatureIsValidForPublicKey) + throw new Error( + `signature: ${signature2} doesn't validate for the Solana public key: ${generatedPublicKey}` + ); + const pkpSessionSigsExport = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const { decryptedPrivateKey } = await exportPrivateKey4({ + pkpSessionSigs: pkpSessionSigsExport, + litNodeClient: devEnv.litNodeClient, + network: "solana", + id: id2 + }); + const solanaKeyPair = Keypair4.fromSecretKey( + Buffer.from(decryptedPrivateKey, "hex") + ); + const decryptedPublicKey = solanaKeyPair.publicKey; + if (decryptedPublicKey.toString() !== generatedPublicKey) { + throw new Error( + `Decrypted decryptedPublicKey: ${decryptedPublicKey} doesn't match with the original generatedPublicKey: ${generatedPublicKey}` + ); + } + log("\u2705 testGenerateSolanaWrappedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey.ts +init_shim(); +var { importPrivateKey: importPrivateKey9 } = api; +var testFailImportWrappedKeysWithSamePrivateKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const privateKey = "4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB"; + try { + await importPrivateKey9({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + await importPrivateKey9({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + throw new Error( + "Expected an AlreadyExists error but the importPrivateKey succeeded!" + ); + } catch (e2) { + if (e2.message.includes( + "There is already a wrapped key stored with the same dataToEncryptHash" + )) { + console.log("\u2705 THIS IS EXPECTED: ", e2); + console.log(e2.message); + console.log( + "\u2705 testFailImportWrappedKeysWithSamePrivateKey is expected to have an error" + ); + } else { + throw e2; + } + } + console.log("\u2705 testFailImportWrappedKeysWithSamePrivateKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig.ts +init_shim(); +var { importPrivateKey: importPrivateKey10 } = api; +var testFailImportWrappedKeysWithEoaSessionSig = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const privateKey = randomSolanaPrivateKey(); + try { + await importPrivateKey10({ + pkpSessionSigs: eoaSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + } catch (e2) { + if (e2.message.includes("SessionSig is not from a PKP")) { + console.log("\u2705 THIS IS EXPECTED: ", e2); + console.log(e2.message); + console.log( + "\u2705 testFailImportWrappedKeysWithEoaSessionSig is expected to have an error" + ); + } else { + throw e2; + } + } + console.log("\u2705 testFailImportWrappedKeysWithEoaSessionSig"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig.ts +init_shim(); +var { importPrivateKey: importPrivateKey11 } = api; +var testFailImportWrappedKeysWithMaxExpirySessionSig = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + try { + const privateKey = randomSolanaPrivateKey(); + await importPrivateKey11({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + } catch (e2) { + if (e2.message.includes("Expires too far in the future")) { + console.log("\u2705 THIS IS EXPECTED: ", e2); + console.log(e2.message); + console.log( + "\u2705 testFailImportWrappedKeysWithMaxExpirySessionSig is expected to have an error" + ); + } else { + throw e2; + } + } + console.log("\u2705 testFailImportWrappedKeysWithMaxExpirySessionSig"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig.ts +init_shim(); +var { importPrivateKey: importPrivateKey12 } = api; +var testFailImportWrappedKeysWithInvalidSessionSig = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + try { + const privateKey = randomSolanaPrivateKey(); + await importPrivateKey12({ + pkpSessionSigs: tamperPkpSessionSigs(pkpSessionSigs), + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + } catch (e2) { + if (e2.message.includes("bad public key size")) { + console.log("\u2705 THIS IS EXPECTED: ", e2); + console.log(e2.message); + console.log( + "\u2705 testFailImportWrappedKeysWithInvalidSessionSig is expected to have an error" + ); + } else { + throw e2; + } + } + console.log("\u2705 testFailImportWrappedKeysWithInvalidSessionSig"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +var tamperPkpSessionSigs = (pkpSessionSig) => { + const tamperedPkpSessionSigs = {}; + for (const key2 in pkpSessionSig) { + if (pkpSessionSig.hasOwnProperty(key2)) { + const authSig = pkpSessionSig[key2]; + const updatedAuthSig = { + ...authSig, + address: authSig.address.slice(0, -1) + }; + tamperedPkpSessionSigs[key2] = updatedAuthSig; + } + } + return tamperedPkpSessionSigs; +}; + +// local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig.ts +init_shim(); +var { importPrivateKey: importPrivateKey13 } = api; +var testFailImportWrappedKeysWithExpiredSessionSig = async (devEnv) => { + const pkpSessionSigs = { + "https://207.244.70.36:8474": { + sig: "1827d1c7b79c979ce76d0b9e130f6804dbf7c7838b6dfa41d4cadf690b9a8bec23321dde6cc573e8a592c395193074ade303d94f3c198d8f0017ca0aca91bd0f", + derivedVia: "litSessionSignViaNacl", + signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8474"}`, + address: "4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b", + algo: "ed25519" + }, + "https://207.244.70.36:8473": { + sig: "762b9849d2cc77d0c75aa354c3cce63abca008a9a07ec3efc69ee8a4954650c3362b8cb83cd3d63310ad98b446be5e68cb8193f9d486453b2df72188dc698d0e", + derivedVia: "litSessionSignViaNacl", + signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8473"}`, + address: "4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b", + algo: "ed25519" + }, + "https://207.244.70.36:8475": { + sig: "5e506dc973cc1540dcb3bd1de251afa687caf277cb5f3efe107339ecf4c25607d4bdf5d8c8910874519252e026a49cc66cea0b07bc5d38342c7cb2613decbe0a", + derivedVia: "litSessionSignViaNacl", + signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8475"}`, + address: "4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b", + algo: "ed25519" + } + }; + try { + const privateKey = randomSolanaPrivateKey(); + const res = await importPrivateKey13({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + } catch (e2) { + if (e2.message.includes("Invalid sessionSig: Expired")) { + console.log("\u2705 THIS IS EXPECTED: ", e2); + console.log(e2.message); + console.log( + "\u2705 testFailImportWrappedKeysWithExpiredSessionSig is expected to have an error" + ); + } else { + throw e2; + } + } + console.log("\u2705 testFailImportWrappedKeysWithExpiredSessionSig"); +}; + +// local-tests/tests/wrapped-keys/testExportWrappedKey.ts +init_shim(); +var { exportPrivateKey: exportPrivateKey5, importPrivateKey: importPrivateKey14 } = api; +var testExportWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigsImport = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const privateKey = randomSolanaPrivateKey(); + const { pkpAddress, id: id2 } = await importPrivateKey14({ + pkpSessionSigs: pkpSessionSigsImport, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsExport = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const { decryptedPrivateKey } = await exportPrivateKey5({ + pkpSessionSigs: pkpSessionSigsExport, + litNodeClient: devEnv.litNodeClient, + network: "solana", + id: id2 + }); + if (decryptedPrivateKey !== privateKey) { + throw new Error( + `Decrypted private key: ${decryptedPrivateKey} doesn't match with the original private key: ${privateKey}` + ); + } + log("\u2705 testExportWrappedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey.ts +init_shim(); +import { Keypair as Keypair5 } from "@solana/web3.js"; +import nacl5 from "tweetnacl"; +var { importPrivateKey: importPrivateKey15, signMessageWithEncryptedKey: signMessageWithEncryptedKey5 } = api; +var testSignMessageWithSolanaEncryptedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const solanaKeypair = Keypair5.generate(); + const privateKey = Buffer.from(solanaKeypair.secretKey).toString("hex"); + const { pkpAddress, id: id2 } = await importPrivateKey15({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + keyType: "K256", + memo: "Test key" + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const messageToSign = "This is a test message"; + const signature2 = await signMessageWithEncryptedKey5({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "solana", + messageToSign, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + console.log("signature"); + console.log(signature2); + const signatureIsValidForPublicKey = nacl5.sign.detached.verify( + Buffer.from(messageToSign), + ethers_exports.utils.base58.decode(signature2), + solanaKeypair.publicKey.toBuffer() + ); + if (!signatureIsValidForPublicKey) + throw new Error( + `signature: ${signature2} doesn't validate for the Solana public key: ${solanaKeypair.publicKey.toString()}` + ); + log("\u2705 testSignMessageWithSolanaEncryptedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey.ts +init_shim(); +import { + Connection as Connection2, + Keypair as Keypair6, + LAMPORTS_PER_SOL, + PublicKey, + SystemProgram, + Transaction as Transaction2, + clusterApiUrl as clusterApiUrl2 +} from "@solana/web3.js"; +var { importPrivateKey: importPrivateKey16, signTransactionWithEncryptedKey: signTransactionWithEncryptedKey8 } = api; +var testSignTransactionWithSolanaEncryptedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const solanaKeypair = Keypair6.generate(); + const privateKey = Buffer.from(solanaKeypair.secretKey).toString("hex"); + const { pkpAddress, id: id2 } = await importPrivateKey16({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: "0xdeadbeef", + // publicKey: publicKey.toBase58(), + keyType: "K256", + memo: "Test key" + }); + const solanaConnection = new Connection2( + clusterApiUrl2("devnet"), + "confirmed" + ); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const solanaTransaction = new Transaction2(); + solanaTransaction.add( + SystemProgram.transfer({ + fromPubkey: solanaKeypair.publicKey, + toPubkey: new PublicKey(solanaKeypair.publicKey), + lamports: LAMPORTS_PER_SOL / 100 + // Transfer 0.01 SOL + }) + ); + solanaTransaction.feePayer = solanaKeypair.publicKey; + const { blockhash } = await solanaConnection.getLatestBlockhash(); + solanaTransaction.recentBlockhash = blockhash; + const serializedTransaction = solanaTransaction.serialize({ + requireAllSignatures: false, + // should be false as we're not signing the message + verifySignatures: false + // should be false as we're not signing the message + }).toString("base64"); + const unsignedTransaction = { + serializedTransaction, + chain: "devnet" + }; + const signedTx = await signTransactionWithEncryptedKey8({ + pkpSessionSigs: pkpSessionSigsSigning, + network: "solana", + unsignedTransaction, + broadcast: false, + // broadcast: true, + litNodeClient: devEnv.litNodeClient, + id: id2 + }); + const signatureBuffer = Buffer.from(ethers_exports.utils.base58.decode(signedTx)); + solanaTransaction.addSignature(solanaKeypair.publicKey, signatureBuffer); + if (!solanaTransaction.verifySignatures()) { + throw new Error( + `Signature: ${signedTx} doesn't validate for the Solana transaction.` + ); + } + log("\u2705 testSignMessageWithSolanaEncryptedKey"); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testBatchGeneratePrivateKeys.ts +init_shim(); +var import_bs58 = __toESM(require_bs58(), 1); +import nacl6 from "tweetnacl"; +var { batchGeneratePrivateKeys: batchGeneratePrivateKeys2 } = api; +async function verifySolanaSignature(solanaResult, solanaMessageToSign) { + const { + signMessage: { signature: signature2 }, + generateEncryptedPrivateKey: { generatedPublicKey } + } = solanaResult; + const signatureIsValidForPublicKey = nacl6.sign.detached.verify( + Buffer.from(solanaMessageToSign), + import_bs58.default.decode(signature2), + import_bs58.default.decode(generatedPublicKey) + ); + console.log({ signatureIsValidForPublicKey, signature: signature2 }); + if (!signatureIsValidForPublicKey) { + throw new Error( + `signature: ${signature2} doesn't validate for the Solana public key: ${generatedPublicKey}` + ); + } +} +async function verifyEvmSignature(evmResult, messageToSign) { + function verifyMessageSignature() { + try { + return ethers_exports.utils.verifyMessage( + messageToSign, + evmResult.signMessage.signature + ); + } catch (err) { + throw new Error( + `When validating signed Ethereum message is valid: ${err.message}` + ); + } + } + const walletAddress = ethers_exports.utils.computeAddress( + evmResult.generateEncryptedPrivateKey.generatedPublicKey + ); + const recoveredAddress = verifyMessageSignature(); + console.log({ + recoveredAddress, + walletAddress, + signature: evmResult.signMessage.signature + }); + if (recoveredAddress !== walletAddress) { + throw new Error( + "Recovered address from verifyMessage doesn't match the wallet address" + ); + } +} +var testBatchGeneratePrivateKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const solanaMessageToSign = "This is a test solana message"; + const evmMessageToSign = "This is a test evm message"; + const { results } = await batchGeneratePrivateKeys2({ + pkpSessionSigs: pkpSessionSigsSigning, + actions: [ + { + network: "evm", + signMessageParams: { messageToSign: evmMessageToSign }, + generateKeyParams: { memo: "Test evm key" } + }, + { + network: "solana", + signMessageParams: { messageToSign: solanaMessageToSign }, + generateKeyParams: { memo: "Test solana key" } + } + ], + litNodeClient: devEnv.litNodeClient + }); + if (results.length !== 2) { + throw new Error( + `Incorrect # of results; expected 2, got ${results.length}` + ); + } + if (results[0].generateEncryptedPrivateKey.memo !== "Test evm key" || results[1].generateEncryptedPrivateKey.memo !== "Test solana key") { + throw new Error( + "Results not in order sent; expected evm as first result, solana as second" + ); + } + if (!results[0].signMessage.signature || !results[1].signMessage.signature) { + throw new Error("Missing message signature in response"); + } + console.log("solana verify sig"); + await verifySolanaSignature(results[1], solanaMessageToSign); + console.log("evm verify sig"); + await verifyEvmSignature(results[0], evmMessageToSign); + console.log("results", results); + log("\u2705 testBatchGenerateEncryptedKeys"); + } catch (err) { + console.log(err.message, err, err.stack); + throw err; + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic.ts +init_shim(); +var { storeEncryptedKeyBatch: storeEncryptedKeyBatch2 } = api; +var testFailBatchGeneratePrivateKeysAtomic = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1e3 * 60 * 10).toISOString() + ); + const solanaMessageToSign = "This is a test solana message"; + const evmMessageToSign = "This is a test evm message"; + const sessionSig = getFirstSessionSig(pkpSessionSigsSigning); + const pkpAddress = getPkpAddressFromSessionSig(sessionSig); + const allowPkpAddressToDecrypt = getPkpAccessControlCondition(pkpAddress); + const { litActionCode, litActionIpfsCid } = getLitActionCodeOrCidCommon( + "batchGenerateEncryptedKeys" + ); + const actionResults = await batchGenerateKeysWithLitAction({ + litNodeClient: devEnv.litNodeClient, + litActionIpfsCid: litActionCode ? void 0 : litActionIpfsCid, + litActionCode: litActionCode ? litActionCode : void 0, + accessControlConditions: [allowPkpAddressToDecrypt], + actions: [ + { + network: "evm", + signMessageParams: { messageToSign: evmMessageToSign }, + generateKeyParams: { memo: "Test evm key" } + }, + { + network: "solana", + signMessageParams: { messageToSign: solanaMessageToSign }, + generateKeyParams: { memo: "Test solana key" } + } + ], + pkpSessionSigs: pkpSessionSigsSigning + }); + const keyParamsBatch = actionResults.map((keyData) => { + const { generateEncryptedPrivateKey, network } = keyData; + return { + ...generateEncryptedPrivateKey, + keyType: getKeyTypeFromNetwork(network) + }; + }); + delete keyParamsBatch[0].publicKey; + try { + await storeEncryptedKeyBatch2({ + pkpSessionSigs: pkpSessionSigsSigning, + litNodeClient: devEnv.litNodeClient, + keyBatch: keyParamsBatch + }); + throw new Error( + "storeEncryptedKeyBatch() succeeded but we expected it to fail!" + ); + } catch (err) { + if (err.message.includes( + "storeEncryptedKeyBatch() succeeded but we expected it to fail!" + ) || !err.message.includes( + 'keyParamsBatch[0]: Missing "publicKey" parameter in request' + )) { + throw err; + } + try { + const keys = await listEncryptedKeyMetadata({ + litNodeClient: devEnv.litNodeClient, + pkpSessionSigs: pkpSessionSigsSigning + }); + console.error( + "Got a value back we shouldnt have from listEncryptedKeyMetadata()", + keys + ); + throw new Error( + "Expected `listEncryptedKeyMetadata() to fail, but it didnt!`" + ); + } catch (err2) { + if (err2.message.includes("No keys exist for pkpAddress")) { + log("\u2705 testFailBatchGeneratePrivateKeysAtomic"); + } else { + throw err2; + } + } + } + } catch (err) { + console.log(err.message, err, err.stack); + throw err; + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests/testUseEoaSessionSigsToRequestSingleResponse.ts +init_shim(); +var testUseEoaSessionSigsToRequestSingleResponse = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + console.log('hello world') + })();`, + useSingleNode: true + }); + console.log("res:", res); + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes("hello world")) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + +// local-tests/tests.ts +var relayerTests = { + testRelayer +}; +var wrappedKeysTests = { + // -- valid cases + testBatchGeneratePrivateKeys, + testEthereumSignMessageGeneratedKey, + testEthereumBroadcastTransactionGeneratedKey, + testEthereumSignMessageWrappedKey, + testEthereumSignTransactionWrappedKey, + testEthereumBroadcastTransactionWrappedKey, + testEthereumBroadcastWrappedKeyWithFetchGasParams, + // -- generate wrapped keys + testGenerateEthereumWrappedKey, + testGenerateSolanaWrappedKey, + // -- import wrapped keys + testImportWrappedKey, + // -- export wrapped keys + testExportWrappedKey, + // -- solana wrapped keys + testSignMessageWithSolanaEncryptedKey, + testSignTransactionWithSolanaEncryptedKey, + // -- invalid cases + testFailEthereumSignTransactionWrappedKeyWithMissingParam, + testFailEthereumSignTransactionWrappedKeyWithInvalidParam, + testFailEthereumSignTransactionWrappedKeyInvalidDecryption, + testFailBatchGeneratePrivateKeysAtomic, + // -- import wrapped keys + testFailImportWrappedKeysWithSamePrivateKey, + testFailImportWrappedKeysWithEoaSessionSig, + testFailImportWrappedKeysWithMaxExpirySessionSig, + testFailImportWrappedKeysWithInvalidSessionSig, + testFailImportWrappedKeysWithExpiredSessionSig +}; +var eoaSessionSigsTests = { + testUseEoaSessionSigsToExecuteJsSigning, + testUseEoaSessionSigsToPkpSign, + testUseEoaSessionSigsToExecuteJsSigningInParallel, + testUseEoaSessionSigsToExecuteJsClaimKeys, + testUseEoaSessionSigsToExecuteJsClaimMultipleKeys, + testUseEoaSessionSigsToExecuteJsJsonResponse, + testUseEoaSessionSigsToExecuteJsConsoleLog, + testUseEoaSessionSigsToEncryptDecryptString, + testUseEoaSessionSigsToEncryptDecryptUint8Array, + testUseEoaSessionSigsToEncryptDecryptFile +}; +var pkpSessionSigsTests = { + testUsePkpSessionSigsToExecuteJsSigning, + testUsePkpSessionSigsToPkpSign, + testUsePkpSessionSigsToExecuteJsSigningInParallel, + testUsePkpSessionSigsToExecuteJsClaimKeys, + testUsePkpSessionSigsToExecuteJsClaimMultipleKeys, + testUsePkpSessionSigsToExecuteJsJsonResponse, + testUsePkpSessionSigsToExecuteJsConsoleLog, + testUsePkpSessionSigsToEncryptDecryptString, + testUsePkpSessionSigsToEncryptDecryptFile +}; +var litActionSessionSigsTests = { + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning, + testUseValidLitActionCodeGeneratedSessionSigsToPkpSign, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile, + // -- invalid cases + testUseInvalidLitActionIpfsCodeToGenerateSessionSigs, + // -- custom auth methods + testUseCustomAuthSessionSigsToPkpSignExecuteJs +}; +var litActionIpfsIdSessionSigsTests = { + testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign, + testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning, + // -- invalid cases + testUseInvalidLitActionCodeToGenerateSessionSigs +}; +var capacityDelegationTests = { + testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs, + testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign, + testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign +}; +var bareAuthSigTests = { + // -- eth auth sig + testEthAuthSigToEncryptDecryptString, + // -- solana auth sig + testSolAuthSigToEncryptDecryptString, + // -- cosmos auth sig + testCosmosAuthSigToEncryptDecryptString +}; +var pkpEthersTest = { + eoaSessionSigs: { + testPkpEthersWithEoaSessionSigsToSignWithAuthContext, + testPkpEthersWithEoaSessionSigsToSignMessage, + testPkpEthersWithEoaSessionSigsToEthSign, + testPkpEthersWithEoaSessionSigsToPersonalSign, + testPkpEthersWithEoaSessionSigsToSendTx, + testPkpEthersWithEoaSessionSigsToEthSignTransaction, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4, + testPkpEthersWithEoaSessionSigsToEthSignTypedData, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil + }, + pkpSessionSigs: { + testPkpEthersWithPkpSessionSigsToSignMessage, + testPkpEthersWithPkpSessionSigsToEthSign, + testPkpEthersWithPkpSessionSigsToPersonalSign, + testPkpEthersWithPkpSessionSigsToSendTx, + testPkpEthersWithPkpSessionSigsToEthSignTransaction, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4, + testPkpEthersWithPkpSessionSigsToEthSignTypedData, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil + }, + litActionSessionSigs: { + testPkpEthersWithLitActionSessionSigsToSignMessage, + testPkpEthersWithLitActionSessionSigsToEthSign, + testPkpEthersWithLitActionSessionSigsToPersonalSign, + testPkpEthersWithLitActionSessionSigsToSendTx, + testPkpEthersWithLitActionSessionSigsToEthSignTransaction, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4, + testPkpEthersWithLitActionSessionSigsToEthSignTypedData, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil + } +}; +var litActionCombiningTests = { + ecdsaSignAndCombine: { + testExecuteJsSignAndCombineEcdsa + }, + decryptAndCombine: { + testExecutJsDecryptAndCombine + }, + broadcastAndCombine: { + testExecuteJsBroadcastAndCollect + } +}; +var tinnyTests = { + // testExample, + // testBundleSpeed, + ...eoaSessionSigsTests, + ...pkpSessionSigsTests, + ...litActionSessionSigsTests, + ...litActionIpfsIdSessionSigsTests, + ...capacityDelegationTests, + ...bareAuthSigTests, + ...pkpEthersTest.eoaSessionSigs, + ...pkpEthersTest.pkpSessionSigs, + ...pkpEthersTest.litActionSessionSigs, + ...litActionCombiningTests.broadcastAndCombine, + ...litActionCombiningTests.decryptAndCombine, + ...litActionCombiningTests.ecdsaSignAndCombine, + ...relayerTests, + ...wrappedKeysTests +}; +export { + TinnyEnvironment, + runInBand, + runTestsParallel, + tests_exports as tinnyTests +}; +/*! Bundled license information: + +js-sha3/src/sha3.js: + (** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + *) + +safe-buffer/index.js: + (*! safe-buffer. MIT License. Feross Aboukhadijeh *) +*/ diff --git a/local-tests/index.ts b/local-tests/index.ts new file mode 100644 index 0000000000..64fdadc98f --- /dev/null +++ b/local-tests/index.ts @@ -0,0 +1,25 @@ +import { TinnyEnvironment } from './setup/tinny-environment'; +import { runInBand, runTestsParallel } from './setup/tinny-operations'; +import * as tinnyTests from './tests'; + +export { + TinnyEnvironment, + runInBand, + runTestsParallel, + tinnyTests +} + +// Usage +// const devEnv = new TinnyEnvironment(); + +// await devEnv.init(); + +// const testConfig = { +// tests: { +// testEthAuthSigToEncryptDecryptString, +// }, +// devEnv, +// } + +// const res = await runTestsParallel(testConfig); +// console.log("res:", res); \ No newline at end of file diff --git a/local-tests/package.json b/local-tests/package.json new file mode 100644 index 0000000000..533242ac46 --- /dev/null +++ b/local-tests/package.json @@ -0,0 +1,93 @@ +{ + "name": "tinnytest", + "version": "0.0.18", + "description": "A package to run the test script for Lit Protocol with custom commands", + "type": "module", + "main": "./index.js", + "typings": "./index.ts", + "license": "MIT", + "author": "Anson (https://github.com/ansonhkg)", + "dependencies": { + "@cosmjs/amino": "0.30.1", + "@cosmjs/crypto": "0.30.1", + "@cosmjs/encoding": "0.30.1", + "@cosmjs/proto-signing": "0.30.1", + "@cosmjs/stargate": "0.30.1", + "@cypress/code-coverage": "^3.10.0", + "@cypress/react": "^6.2.0", + "@cypress/webpack-dev-server": "^2.3.0", + "@lit-protocol/accs-schemas": "0.0.7", + "@metamask/eth-sig-util": "5.0.2", + "@mysten/sui.js": "^0.37.1", + "@playwright/test": "^1.25.2", + "@simplewebauthn/browser": "^7.2.0", + "@simplewebauthn/typescript-types": "^7.0.0", + "@spruceid/siwe-parser": "2.0.0", + "@synthetixio/js": "^2.41.0", + "@testing-library/cypress": "^8.0.3", + "@testing-library/react": "^13.4.0", + "@types/testing-library__cypress": "^5.0.9", + "@walletconnect/core": "2.9.2", + "@walletconnect/ethereum-provider": "2.9.2", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/modal": "2.6.1", + "@walletconnect/types": "2.9.2", + "@walletconnect/utils": "2.9.2", + "@walletconnect/web3wallet": "1.8.8", + "@websaam/nx-esbuild": "^0.0.1", + "ajv": "^8.12.0", + "axios": "^0.27.2", + "base64url": "^3.0.1", + "bitcoinjs-lib": "^6.1.0", + "blockstore-core": "^3.0.0", + "browserify-zlib": "^0.2.0", + "bs58": "^5.0.0", + "bytes32": "^0.0.3", + "cbor-web": "^9.0.1", + "commander": "^9.4.0", + "concurrently": "^7.4.0", + "core-js": "^3.6.5", + "cross-fetch": "3.1.4", + "crypto-browserify": "^3.12.0", + "cypress-wait-until": "^1.7.2", + "cypress-watch-and-reload": "^1.10.3", + "date-and-time": "^2.4.1", + "dotenv": "^16.0.2", + "dotenv-parse-variables": "^2.0.0", + "download": "^8.0.0", + "ethers": "^5.7.1", + "etherscan-api": "^10.2.0", + "find-config": "^1.0.0", + "g": "^2.0.1", + "https-browserify": "^1.0.0", + "jose": "^4.14.4", + "jszip": "^3.10.1", + "micromodal": "^0.4.10", + "multiformats": "^9.7.1", + "nanoid": "3.3.4", + "next": "13.3.0", + "react": "18.0.0", + "react-dom": "18.0.0", + "regenerator-runtime": "0.13.7", + "secp256k1": "^5.0.0", + "serve": "^14.0.1", + "siwe": "^2.0.5", + "siwe-recap": "0.0.2-alpha.0", + "stream-browserify": "^3.0.0", + "stream-http": "^3.2.0", + "synthetix-js": "^2.74.1", + "tslib": "^2.3.0", + "tweetnacl": "^1.0.3", + "tweetnacl-util": "^0.15.1", + "uint8arrays": "^4.0.3", + "@openagenda/verror": "^3.1.4", + "ipfs-unixfs-importer": "12.0.1", + "@solana/web3.js": "^1.95.3", + "bech32": "^2.0.0", + "pako": "^2.1.0", + "@lit-protocol/misc": "^7.0.0", + "@lit-protocol/lit-node-client": "^7.0.0", + "@lit-protocol/lit-auth-client": "^7.0.0", + "@lit-protocol/contracts": "^0.0.71" + } +} \ No newline at end of file diff --git a/local-tests/setup/accs/accs.js b/local-tests/setup/accs/accs.js new file mode 100644 index 0000000000..1f9e799a9d --- /dev/null +++ b/local-tests/setup/accs/accs.js @@ -0,0 +1,50 @@ +export var AccessControlConditions; +(function (AccessControlConditions) { + AccessControlConditions.getEmvBasicAccessControlConditions = ({ userAddress, }) => { + return [ + { + contractAddress: '', + standardContractType: '', + chain: 'ethereum', + method: '', + parameters: [':userAddress'], + returnValueTest: { + comparator: '=', + value: userAddress, + }, + }, + ]; + }; + AccessControlConditions.getSolBasicAccessControlConditions = ({ userAddress, }) => { + return [ + { + method: '', + params: [':userAddress'], + pdaParams: [], + pdaInterface: { offset: 0, fields: {} }, + pdaKey: '', + chain: 'solana', + returnValueTest: { + key: '', + comparator: '=', + value: userAddress, + }, + }, + ]; + }; + AccessControlConditions.getCosmosBasicAccessControlConditions = ({ userAddress, }) => { + return [ + { + conditionType: 'cosmos', + path: ':userAddress', + chain: 'cosmos', + returnValueTest: { + key: '', + comparator: '=', + value: userAddress, + }, + }, + ]; + }; +})(AccessControlConditions || (AccessControlConditions = {})); +//# sourceMappingURL=accs.js.map \ No newline at end of file diff --git a/local-tests/setup/session-sigs/get-eoa-session-sigs.js b/local-tests/setup/session-sigs/get-eoa-session-sigs.js new file mode 100644 index 0000000000..3f38424880 --- /dev/null +++ b/local-tests/setup/session-sigs/get-eoa-session-sigs.js @@ -0,0 +1,113 @@ +import { LitActionResource, LitPKPResource, generateAuthSig, createSiweMessageWithRecaps, } from '@lit-protocol/auth-helpers'; +import { log } from '@lit-protocol/misc'; +import { LIT_ABILITY, CENTRALISATION_BY_NETWORK, } from '@lit-protocol/constants'; +/** + * Retrieves the session signatures for an EOA in a given Tinny environment. + * + * @param devEnv - The Tinny environment object. + * @param person - The Tinny person object representing the EOA. + * @param resourceAbilityRequests - Optional. An array of resource ability requests. If not provided, default requests will be used. + * @returns A promise that resolves to the session signatures. + */ +export const getEoaSessionSigs = async (devEnv, person, resourceAbilityRequests) => { + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + if (centralisation === 'decentralised') { + console.warn('Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs'); + } + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ]; + const sessionSigs = await devEnv.litNodeClient.getSessionSigs({ + chain: 'ethereum', + resourceAbilityRequests: _resourceAbilityRequests, + authNeededCallback: async ({ uri, expiration, resourceAbilityRequests, }) => { + console.log('resourceAbilityRequests:', resourceAbilityRequests); + if (!expiration) { + throw new Error('expiration is required'); + } + if (!resourceAbilityRequests) { + throw new Error('resourceAbilityRequests is required'); + } + if (!uri) { + throw new Error('uri is required'); + } + const toSign = await createSiweMessageWithRecaps({ + uri: uri, + expiration: expiration, + resources: resourceAbilityRequests, + walletAddress: person.wallet.address, + nonce: await devEnv.litNodeClient.getLatestBlockhash(), + litNodeClient: devEnv.litNodeClient, + }); + const authSig = await generateAuthSig({ + signer: person.wallet, + toSign, + }); + return authSig; + }, + ...(centralisation === 'decentralised' && { + capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig], + }), + }); + log('[getEoaSessionSigs]: ', getEoaSessionSigs); + return sessionSigs; +}; +export const getEoaSessionSigsWithCapacityDelegations = async (devEnv, fromWallet, capacityDelegationAuthSig) => { + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + if (centralisation === 'decentralised') { + console.warn('Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs'); + } + const sessionSigs = await devEnv.litNodeClient.getSessionSigs({ + chain: 'ethereum', + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ], + authNeededCallback: async ({ uri, expiration, resourceAbilityRequests, }) => { + if (!expiration) { + throw new Error('expiration is required'); + } + if (!resourceAbilityRequests) { + throw new Error('resourceAbilityRequests is required'); + } + if (!uri) { + throw new Error('uri is required'); + } + const toSign = await createSiweMessageWithRecaps({ + uri: uri, + expiration: expiration, + resources: resourceAbilityRequests, + walletAddress: fromWallet.address, + nonce: await devEnv.litNodeClient.getLatestBlockhash(), + litNodeClient: devEnv.litNodeClient, + }); + const authSig = await generateAuthSig({ + signer: fromWallet, + toSign, + }); + return authSig; + }, + ...(centralisation === 'decentralised' && { + capabilityAuthSigs: [ + capacityDelegationAuthSig ?? devEnv.superCapacityDelegationAuthSig, + ], + }), + }); + log('[getEoaSessionSigs]: ', getEoaSessionSigs); + return sessionSigs; +}; +//# sourceMappingURL=get-eoa-session-sigs.js.map \ No newline at end of file diff --git a/local-tests/setup/session-sigs/get-lit-action-session-sigs.js b/local-tests/setup/session-sigs/get-lit-action-session-sigs.js new file mode 100644 index 0000000000..9058e6f042 --- /dev/null +++ b/local-tests/setup/session-sigs/get-lit-action-session-sigs.js @@ -0,0 +1,130 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { CENTRALISATION_BY_NETWORK, GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK, LIT_ABILITY, } from '@lit-protocol/constants'; +const VALID_SESSION_SIG_LIT_ACTION_CODE = ` +// Works with an AuthSig AuthMethod +if (Lit.Auth.authMethodContexts.some(e => e.authMethodType === 1)) { + LitActions.setResponse({ response: "true" }); +} else { + LitActions.setResponse({ response: "false" }); +} +`; +const INVALID_SESSION_SIG_LIT_ACTION_CODE = ` +(async () => { + let utf8Encode = new TextEncoder(); + const toSign = utf8Encode.encode('This message is exactly 32 bytes'); + const sigShare = await LitActions.signEcdsa({ toSign, publicKey, sigName }); +})(); +`; +/** + * https://cloudflare-ipfs.com/ipfs/QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp + */ +export const VALID_IPFS_ID = 'QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp'; +/** + * https://cloudflare-ipfs.com/ipfs/QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm + */ +export const INVALID_IPFS_ID = 'QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm'; +export const getLitActionSessionSigs = async (devEnv, alice, resourceAbilityRequests) => { + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + if (centralisation === 'decentralised') { + console.warn('Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs'); + } + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ]; + const litActionSessionSigs = await devEnv.litNodeClient.getLitActionSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp.publicKey, + authMethods: [alice.authMethod], + resourceAbilityRequests: _resourceAbilityRequests, + litActionCode: Buffer.from(VALID_SESSION_SIG_LIT_ACTION_CODE).toString('base64'), + jsParams: { + publicKey: alice.authMethodOwnedPkp.publicKey, + sigName: 'unified-auth-sig', + }, + ...(centralisation === 'decentralised' && { + capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig], + }), + }); + return litActionSessionSigs; +}; +export const getLitActionSessionSigsUsingIpfsId = async (devEnv, alice, resourceAbilityRequests) => { + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + if (centralisation === 'decentralised') { + console.warn('Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs'); + } + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ]; + const litActionSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp.publicKey, + authMethods: [alice.authMethod], + resourceAbilityRequests: _resourceAbilityRequests, + litActionIpfsId: VALID_IPFS_ID, + jsParams: { + publicKey: alice.authMethodOwnedPkp.publicKey, + sigName: 'unified-auth-sig', + }, + ...(centralisation === 'decentralised' && { + capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig], + }), + }); + return litActionSessionSigs; +}; +export const getInvalidLitActionSessionSigs = async (devEnv, alice) => { + const litActionSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp.publicKey, + authMethods: [alice.authMethod], + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + ], + litActionCode: Buffer.from(INVALID_SESSION_SIG_LIT_ACTION_CODE).toString('base64'), + jsParams: { + publicKey: alice.authMethodOwnedPkp.publicKey, + sigName: 'unified-auth-sig', + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[devEnv.litNodeClient.config.litNetwork], + }, + }); + return litActionSessionSigs; +}; +export const getInvalidLitActionIpfsSessionSigs = async (devEnv, alice) => { + const litActionSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp.publicKey, + authMethods: [alice.authMethod], + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + ], + litActionIpfsId: INVALID_IPFS_ID, + jsParams: { + publicKey: alice.authMethodOwnedPkp.publicKey, + sigName: 'unified-auth-sig', + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[devEnv.litNodeClient.config.litNetwork], + }, + }); + return litActionSessionSigs; +}; +//# sourceMappingURL=get-lit-action-session-sigs.js.map \ No newline at end of file diff --git a/local-tests/setup/session-sigs/get-pkp-session-sigs.js b/local-tests/setup/session-sigs/get-pkp-session-sigs.js new file mode 100644 index 0000000000..e41ede242e --- /dev/null +++ b/local-tests/setup/session-sigs/get-pkp-session-sigs.js @@ -0,0 +1,32 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { log } from '@lit-protocol/misc'; +import { LIT_ABILITY, CENTRALISATION_BY_NETWORK, } from '@lit-protocol/constants'; +export const getPkpSessionSigs = async (devEnv, alice, resourceAbilityRequests, expiration) => { + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + if (centralisation === 'decentralised') { + console.warn('Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs'); + } + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ]; + const pkpSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp.publicKey, + authMethods: [alice.authMethod], + expiration, + resourceAbilityRequests: _resourceAbilityRequests, + ...(centralisation === 'decentralised' && { + capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig], + }), + }); + log('[getPkpSessionSigs]: ', pkpSessionSigs); + return pkpSessionSigs; +}; +//# sourceMappingURL=get-pkp-session-sigs.js.map \ No newline at end of file diff --git a/local-tests/setup/shiva-client.js b/local-tests/setup/shiva-client.js new file mode 100644 index 0000000000..e93de08cc5 --- /dev/null +++ b/local-tests/setup/shiva-client.js @@ -0,0 +1,203 @@ +import { ethers } from 'ethers'; +class ShivaError extends Error { + constructor(shivaResponse) { + let message = `An error occurred on request to testnet with id: ${shivaResponse.testnetId}`; + for (const error of shivaResponse.errors) { + message += ' ' + error; + } + super(message); + this.name = 'ShivaError'; + this.message = message; + } +} +/** + * Client implementation for a single testnet instance managed by the Shiva tool + * Is essentially a local chain setup but allows for programmatic operations to be performed + * on the network from the implementation within this class. Each testnet is a unique network + */ +export class TestnetClient { + constructor(id, envs) { + this._processEnvs = envs; + this._id = id; + } + /** + Returns info on a given testnet instance + if information cannot be accessed we retured undefined + @returns TestNetInfo | undefined + */ + get Info() { + return this._info; + } + get ContractContext() { + const testNetConfig = this.Info; + if (!testNetConfig) { + return undefined; + } + const contractResolverAbi = testNetConfig.contractResolverAbi; + const contractResolverAddress = testNetConfig.contractAddresses[`contractResolver`]; + const networkContext = { + abi: JSON.parse(contractResolverAbi), + resolverAddress: contractResolverAddress, + provider: new ethers.providers.StaticJsonRpcProvider({ + url: `http://${testNetConfig.rpcUrl}`, + skipFetchSetup: true, + }), + environment: 0, // test deployment uses env value 0 in test common + contractContext: { + Allowlist: {}, + Multisender: {}, + Staking: { + abi: JSON.parse(testNetConfig.contractAbis.staking), + }, + StakingBalances: { + abi: JSON.parse(testNetConfig.contractAbis.stakingBalances), + }, + PKPNFT: { + abi: JSON.parse(testNetConfig.contractAbis.pkpnft), + }, + PKPPermissions: { + abi: JSON.parse(testNetConfig.contractAbis.pkpPermissions), + }, + PKPHelper: { + abi: JSON.parse(testNetConfig.contractAbis.pkpHelper), + }, + LITToken: { + abi: JSON.parse(testNetConfig.contractAbis.litToken), + }, + PKPNFTMetadata: {}, + RateLimitNFT: {}, + PubkeyRouter: {}, + }, + }; + return networkContext; + } + /** + * Polls a given testnet for the ACTIVE state + * polls on a 500 milisecond interval + */ + async pollTestnetForActive() { + let state = 'Busy'; + while (state != 'Active' && state != `UNKNOWN`) { + const res = await fetch(this._processEnvs.TESTNET_MANAGER_URL + '/test/poll/testnet/' + this._id); + const stateRes = await _processTestnetResponse(res); + state = stateRes.body; + console.log('found state to be', state); + await new Promise((res, _) => { + setTimeout(() => { + res(); + }, 500); + }); + } + return state; + } + /** + * Returns the config for a given testnet + */ + async getTestnetConfig() { + const res = await fetch(this._processEnvs.TESTNET_MANAGER_URL + + '/test/get/info/testnet/' + + this._id); + const testnetInfoRes = await _processTestnetResponse(res); + this._info = testnetInfoRes.body; + return testnetInfoRes; + } + /** + * Will wait for the NEXT epoch and return a resposne when the epoch has fully transitioned. + * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. + */ + async transitionEpochAndWait() { + const res = await fetch(this._processEnvs.TESTNET_MANAGER_URL + + '/test/action/transition/epoch/wait/' + + this._id); + let transitionEpochAndWaitRes = _processTestnetResponse(res); + return transitionEpochAndWaitRes; + } + /** + * Stops a random peer and waits for the next epoc to transiton. + * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. + */ + async stopRandomNetworkPeerAndWaitForNextEpoch() { + const res = await fetch(this._processEnvs.TESTNET_MANAGER_URL + + '/test/action/stop/random/wait/' + + this._id); + return _processTestnetResponse(res); + } + /* + Stops the testnet + */ + async stopTestnet() { + console.log('stopping testnet with id:', this._id); + const res = await fetch(this._processEnvs.TESTNET_MANAGER_URL + '/test/delete/testnet/' + this._id); + return _processTestnetResponse(res); + } +} +export class ShivaClient { + constructor() { + this.processEnvs = { + STOP_TESTNET: process.env[`STOP_TESTNET`] === 'true', + TESTNET_MANAGER_URL: process.env['TESTNET_MANAGER_URL'] || 'http://0.0.0.0:8000', + USE_LIT_BINARIES: process.env[`USE_LIT_BINARIES`] === `true`, + LIT_NODE_BINARY_PATH: process.env['LIT_NODE_BINARY_PATH'] || + `./../../lit-assets/rust/lit-node/target/debug/lit_node`, + LIT_ACTION_BINARY_PATH: process.env['LIT_ACTION_BINARY_PATH'] || + `./../../lit-assets/rust/lit-actions/target/debug/lit_actions`, + }; + this._clients = new Map(); + console.log('Shiva environment loaded current config: ', this.processEnvs); + } + /** + * Used to start an instance of a lit network through the Lit Testnet Manager + * if an instance exists, we will just take it as we optimistically assume it will not be shut down in the test life time. + * If an instance does not exist then we create one + */ + async startTestnetManager(createReq) { + const existingTestnetResp = await fetch(this.processEnvs.TESTNET_MANAGER_URL + '/test/get/testnets'); + const existingTestnets = await existingTestnetResp.json(); + if (existingTestnets.length > 0) { + this._clients.set(existingTestnets[0], new TestnetClient(existingTestnets[0], this.processEnvs)); + return this._clients.get(existingTestnets[0]); + } + else { + console.log('lit node binary path: ', this.processEnvs.LIT_NODE_BINARY_PATH); + console.log('lit action server binary path: ', this.processEnvs.LIT_ACTION_BINARY_PATH); + let body = createReq ?? { + nodeCount: 3, + pollingInterval: '2000', + epochLength: 90000, + }; + if (this.processEnvs.USE_LIT_BINARIES) { + body.customBuildPath = this.processEnvs.LIT_NODE_BINARY_PATH; + body.litActionServerCustomBuildPath = + this.processEnvs.LIT_ACTION_BINARY_PATH; + } + console.log('Testnet create args: ', body); + const createTestnetResp = await fetch(this.processEnvs.TESTNET_MANAGER_URL + '/test/create/testnet', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(body), + }); + const createTestnet = await _processTestnetResponse(createTestnetResp); + this._clients.set(createTestnet.testnetId, new TestnetClient(createTestnet.testnetId, this.processEnvs)); + return this._clients.get(createTestnet.testnetId); + } + } +} +async function _processTestnetResponse(response) { + let createTestnet; + try { + createTestnet = (await response.json()); + } + catch (err) { + let message = await response.text(); + throw new Error('Error while performing testnet request: ' + message); + } + // if we get a 500 status and the JSON parsed we know that we should + // throw the custom error type + if (response.status === 500) { + throw new ShivaError(createTestnet); + } + return createTestnet; +} +//# sourceMappingURL=shiva-client.js.map \ No newline at end of file diff --git a/local-tests/setup/tinny-config.js b/local-tests/setup/tinny-config.js new file mode 100644 index 0000000000..ed6bb29d63 --- /dev/null +++ b/local-tests/setup/tinny-config.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=tinny-config.js.map \ No newline at end of file diff --git a/local-tests/setup/tinny-environment.js b/local-tests/setup/tinny-environment.js new file mode 100644 index 0000000000..683f721c08 --- /dev/null +++ b/local-tests/setup/tinny-environment.js @@ -0,0 +1,465 @@ +import { LitNodeClient } from '@lit-protocol/lit-node-client'; +import { LitContracts } from '@lit-protocol/contracts-sdk'; +import { TinnyPerson } from './tinny-person'; +import { ethers } from 'ethers'; +import { createSiweMessage, generateAuthSig } from '@lit-protocol/auth-helpers'; +import { ShivaClient } from './shiva-client'; +import { toErrorWithMessage } from './tinny-utils'; +import { CENTRALISATION_BY_NETWORK, LIT_NETWORK, RPC_URL_BY_NETWORK, } from '@lit-protocol/constants'; +console.log('checking env', process.env['DEBUG']); +export class TinnyEnvironment { + constructor(network) { + /** + * Environment variables used in the process. + */ + this.processEnvs = { + MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS']) || 1, + TEST_TIMEOUT: parseInt(process.env['TEST_TIMEOUT']) || 45000, + NETWORK: process.env['NETWORK'] || LIT_NETWORK.Custom, + DEBUG: process.env['DEBUG'] === 'true', + REQUEST_PER_KILOSECOND: parseInt(process.env['REQUEST_PER_KILOSECOND']) || + process.env['NETWORK'] === 'datil-dev' + ? 1 + : 200, + LIT_RPC_URL: process.env['LIT_RPC_URL'], + WAIT_FOR_KEY_INTERVAL: parseInt(process.env['WAIT_FOR_KEY_INTERVAL']) || 3000, + BOOTSTRAP_URLS: process.env['BOOTSTRAP_URLS']?.split(',') || [ + 'http://127.0.0.1:7470', + 'http://127.0.0.1:7471', + 'http://127.0.0.1:7472', + ], + TIME_TO_RELEASE_KEY: parseInt(process.env['TIME_TO_RELEASE_KEY']) || 10000, + RUN_IN_BAND: process.env['RUN_IN_BAND'] === 'true', + RUN_IN_BAND_INTERVAL: parseInt(process.env['RUN_IN_BAND_INTERVAL']) || 5000, + // Available Accounts + // ================== + // (1) "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" (10000.000000000000000000 ETH) + // (2) "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" (10000.000000000000000000 ETH) + // (3) "0x90F79bf6EB2c4f870365E785982E1f101E93b906" (10000.000000000000000000 ETH) + // (4) "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65" (10000.000000000000000000 ETH) + // (5) "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc" (10000.000000000000000000 ETH) + // (6) "0x976EA74026E726554dB657fA54763abd0C3a0aa9" (10000.000000000000000000 ETH) + // (7) "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955" (10000.000000000000000000 ETH) + // (8) "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f" (10000.000000000000000000 ETH) + // (9) "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720" (10000.000000000000000000 ETH) + PRIVATE_KEYS: process.env['PRIVATE_KEYS']?.split(',') || [ + '0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', + '0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a', + '0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6', + '0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a', + '0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba', + '0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e', + '0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356', + '0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97', + '0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6', + ], + KEY_IN_USE: new Array(), + NO_SETUP: process.env['NO_SETUP'] === 'true', + USE_SHIVA: process.env['USE_SHIVA'] === 'true', + NETWORK_CONFIG: process.env['NETWORK_CONFIG'] ?? './networkContext.json', + }; + this.bareSolAuthSig = { + sig: '706047fcab06ada3cbfeb6990617c1705d59bafb20f5f1c8103d764fb5eaec297328d164e2b891095866b28acc1ab2df288a8729cf026228ef3c4970238b190a', + derivedVia: 'solana.signMessage', + signedMessage: 'I am creating an account to use Lit Protocol at 2024-05-08T16:39:44.481Z', + address: 'F7r6ENi6dqH8SnMYZdK3YxWAQ4cwfSNXZyMzbea5fbS1', + }; + this.bareCosmosAuthSig = { + sig: 'dE7J8oaWa8zECuMpaI/IVfJXGpLAO1paGLho+/dmtaQkN7Sh1lmJLAdYqZchDyYhQcg+nqfaoEOzLig3CPlosg==', + derivedVia: 'cosmos.signArbitrary', + signedMessage: '8c857343720203e3f52606409e6818284186a614e74026998f89e7417eed4d4b', + address: 'cosmos14wp2s5kv07lt220rzfae57k73yv9z2azrmulku', + }; + //=========== PRIVATE MEMBERS =========== + this._shivaClient = new ShivaClient(); + this.world = new Map(); + this.setUnavailable = (network) => { + if (this.processEnvs.NETWORK === network) { + throw new Error('LIT_IGNORE_TEST'); + } + }; + //============= END SHIVA ENDPOINTS ============= + /** + * Sends funds from the current wallet to the specified wallet address. + * @param walletAddress - The address of the recipient wallet. + * @param amount - The amount of funds to send (default: '0.001'). + * @throws If there is an error sending the funds. + */ + this.getFunds = async (walletAddress, amount = '0.001') => { + const privateKey = await this.getAvailablePrivateKey(); + try { + const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers.Wallet(privateKey.privateKey, provider); + const tx = await wallet.sendTransaction({ + to: walletAddress, + value: ethers.utils.parseEther(amount), + }); + await tx.wait(); + } + catch (e) { + throw new Error(`Failed to send funds to ${walletAddress}: ${e}`); + } + finally { + // @ts-expect-error We don't have a user, but this works + this.releasePrivateKeyFromUser({ privateKey }); + } + }; + /** + * Context: the reason this is created instead of individually is because we can't allocate capacity beyond the global + * max capacity. + */ + this.setupSuperCapacityDelegationAuthSig = async () => { + const privateKey = await this.getAvailablePrivateKey(); + const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers.Wallet(privateKey.privateKey, provider); + /** + * ==================================== + * Setup contracts-sdk client + * ==================================== + */ + if (this.network === LIT_NETWORK.Custom) { + const networkContext = this?.testnet?.ContractContext ?? this._contractContext; + this.contractsClient = new LitContracts({ + signer: wallet, + debug: this.processEnvs.DEBUG, + rpc: this.rpc, + customContext: networkContext, + network: 'custom', + }); + } + else if (CENTRALISATION_BY_NETWORK[this.network] === 'decentralised' || + CENTRALISATION_BY_NETWORK[this.network] === 'centralised') { + this.contractsClient = new LitContracts({ + signer: wallet, + debug: this.processEnvs.DEBUG, + network: this.network, + }); + } + // THE FOLLOWING WILL TECHNICALLY NEVER BE CALLED, BUT IT'S HERE FOR FUTURE REFERENCE FOR SWITCHING WALLETS + else { + const rpc = this.rpc; + async function _switchWallet() { + // TODO: This wallet should be cached somewhere and reused to create delegation signatures. + // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. + const capacityCreditWallet = ethers.Wallet.createRandom().connect(provider); + // get wallet balance + const balance = await wallet.getBalance(); + console.log('this.rpc:', rpc); + console.log('this.wallet.address', wallet.address); + console.log('Balance:', balance.toString()); + const transferTx = await wallet.sendTransaction({ + to: capacityCreditWallet.address, + value: ethers.utils.parseEther('0.001'), + }); + await transferTx.wait(); + } + // await _switchWallet(); + this.contractsClient = new LitContracts({ + // signer: capacityCreditWallet, // disabled switch wallet for now + signer: wallet, + debug: this.processEnvs.DEBUG, + network: this.network, + }); + } + if (!this.contractsClient) { + console.log('❗️Contracts client not initialized'); + process.exit(); + } + await this.contractsClient.connect(); + /** + * ==================================== + * Mint a Capacity Credits NFT and get a capacity delegation authSig with it + * ==================================== + */ + if (CENTRALISATION_BY_NETWORK[this.network] === 'decentralised') { + await this.mintSuperCapacityDelegationAuthSig(wallet); + } + }; + // -- setup network + this.network = network || this.processEnvs.NETWORK; + if (Object.values(LIT_NETWORK).indexOf(this.network) === -1) { + throw new Error(`Invalid network environment. Please use one of ${Object.values(LIT_NETWORK)}`); + } + // -- create an empty array to keep track of all keys + this.processEnvs.KEY_IN_USE = new Array(this.processEnvs.PRIVATE_KEYS.length).fill(false); + // -- setup rpc + // Priority: + // 1. Use environment variable if set + // 2. Use RPC_URL_BY_NETWORK if network is recognized + // 3. Throw error if neither condition is met + if (this.processEnvs.LIT_RPC_URL) { + // If LIT_RPC_URL is set in the environment, use it + this.rpc = this.processEnvs.LIT_RPC_URL; + } + else if (this.network in RPC_URL_BY_NETWORK) { + // If the network is recognized in RPC_URL_BY_NETWORK, use the corresponding RPC URL + this.rpc = RPC_URL_BY_NETWORK[this.network]; + } + else { + // If neither condition is met, throw an error with available options + const availableNetworks = Object.keys(RPC_URL_BY_NETWORK).join(', '); + throw new Error(`No RPC URL found for network "${this.network}". Available networks are: ${availableNetworks}`); + } + console.log('[𐬺🧪 Tinny Environment𐬺] Done configuring environment current config: ', this.processEnvs); + } + /** + * Retrieves an available private key from a list, marking it as in use and scheduling + * its automatic release. If no unused keys are available, it waits for a set interval + * before rechecking. + * + * This function loops until it finds an unused key, marks it, and returns the key with + * its index. If all keys are in use, it logs a wait message and pauses before retrying. + * + * Outputs: + * - privateKey: The selected private key. + * - index: The index of the selected key. + * + * Environment variables required: + * - KEY_IN_USE: Boolean array indicating key usage. + * - PRIVATE_KEYS: Array of key strings. + * - TIME_TO_RELEASE_KEY: Milliseconds until a key is automatically released. + * - WAIT_FOR_KEY_INTERVAL: Wait time in milliseconds if no keys are free. + */ + async getAvailablePrivateKey() { + while (true) { + const index = this.processEnvs.KEY_IN_USE.findIndex((used) => !used); // Find the first unused key + if (index !== -1) { + // If an available key is found + this.processEnvs.KEY_IN_USE[index] = true; // Mark the key as in use + // console.log('[𐬺🧪 Tinny Environment𐬺] 🔑 Selected key at index', index); // Log a message indicating that we have selected a key + return { privateKey: this.processEnvs.PRIVATE_KEYS[index], index }; // Return the key and its index + } + else { + console.log('[𐬺🧪 Tinny Environment𐬺] No available keys. Waiting...', { + keysInUse: this.processEnvs.KEY_IN_USE, + }); // Log a message indicating that we are waiting + // Wait for the specified interval before checking again + await new Promise((resolve) => setTimeout(resolve, this.processEnvs.WAIT_FOR_KEY_INTERVAL)); + } + } + } + /** + * Marks a private key as available again after use. + * @param {number} index - The index of the key to mark as available. + */ + releasePrivateKeyFromUser(user) { + const index = this.processEnvs.PRIVATE_KEYS.indexOf(user.privateKey); + this.processEnvs.KEY_IN_USE[index] = false; + // console.log( + // `[𐬺🧪 Tinny Environment𐬺] 🪽 Released key at index ${index}. Thank you for your service!` + // ); + } + /** + * Marks a private key as available again after use. + * @param {number} index - The index of the key to mark as available. + */ + releasePrivateKey(index) { + this.processEnvs.KEY_IN_USE[index] = false; + // console.log( + // `[𐬺🧪 Tinny Environment𐬺] 🪽 Released key at index ${index}. Thank you for your service!` + // ); + } + /** + * Initializes the LitNodeClient based on the specified network configuration and environment variables. + * This setup differentiates between local and production environments, adjusts node attestation checks, + * and sets network-specific parameters. The function ensures the client is connected and ready before proceeding. + * + * The LitNodeClient is configured differently based on the network: + * - Custom: Uses custom settings for local testing, with node attestation disabled. + * - DatilTest (or other specified testnets): Configures for specific network environments with node attestation enabled. + * + * Logs the process and exits if the client is not ready after attempting to connect. + */ + async setupLitNodeClient() { + console.log('[𐬺🧪 Tinny Environment𐬺] Setting up LitNodeClient'); + console.log('this.network:', this.network); + const centralisation = CENTRALISATION_BY_NETWORK[this.network]; + if (this.network === LIT_NETWORK.Custom || centralisation === 'unknown') { + const networkContext = this?.testnet?.ContractContext ?? this._contractContext; + this.litNodeClient = new LitNodeClient({ + litNetwork: LIT_NETWORK.Custom, + rpcUrl: this.rpc, + debug: this.processEnvs.DEBUG, + checkNodeAttestation: false, // disable node attestation check for local testing + contractContext: networkContext, + }); + } + else if (centralisation === 'decentralised') { + this.litNodeClient = new LitNodeClient({ + litNetwork: this.network, + checkNodeAttestation: true, + debug: this.processEnvs.DEBUG, + }); + } + else if (centralisation === 'centralised') { + this.litNodeClient = new LitNodeClient({ + litNetwork: this.network, + checkNodeAttestation: false, + debug: this.processEnvs.DEBUG, + }); + } + else { + throw new Error(`Network not supported: "${this.network}"`); + } + if (globalThis.wasmExports) { + console.warn('WASM modules already loaded. Will override when connect is called'); + } + if (globalThis.wasmECDSA) { + console.warn('WASM modules already loaded. wil override. when connect is called'); + } + if (globalThis.wasmSevSnpUtils) { + console.warn('WASM modules already loaded. wil override. when connect is called'); + } + await this.litNodeClient.connect(); + if (!this.litNodeClient.ready) { + console.error('❌ litNodeClient not ready'); + process.exit(); + } + } + /** + * Retrieves the environment configuration. + * @returns The TinnyEnvConfig object containing the environment configuration. + */ + getEnvConfig() { + const contractContext = this?.testnet?.ContractContext ?? this._contractContext; + return { + rpc: this.rpc, + litNodeClient: this.litNodeClient, + network: this.network, + processEnvs: this.processEnvs, + contractContext: contractContext, + }; + } + /** + * Creates a new person with the given name. + * @param name - The name of the person. + * @returns The newly created person. + * @throws Error if the name is not provided. + */ + async createNewPerson(name) { + console.log('[𐬺🧪 Tinny Environment𐬺] Creating new person:', name); + if (!name) { + throw new Error('Name is required'); + } + const key = await this.getAvailablePrivateKey(); + const privateKey = key.privateKey; + const envConfig = this.getEnvConfig(); + const person = new TinnyPerson({ + privateKey, + envConfig, + }); + await person.spawn(); + this.world.set(name, person); + return person; + } + /** + * Retrieves a person from the world by their name. + * @param name - The name of the person to retrieve. + * @returns The person object if found, or undefined if not found. + */ + getPerson(name) { + return this.world.get(name); + } + /** + * Creates a random person. + * @returns A promise that resolves to the created person. + */ + async createRandomPerson() { + return await this.createNewPerson('Alice'); + } + /** + * Init + */ + async init() { + try { + if (this.processEnvs.NO_SETUP) { + console.log('[𐬺🧪 Tinny Environment𐬺] Skipping setup'); + return; + } + if (this.network === LIT_NETWORK.Custom && this.processEnvs.USE_SHIVA) { + this.testnet = await this._shivaClient.startTestnetManager(); + // wait for the testnet to be active before we start the tests. + let state = await this.testnet.pollTestnetForActive(); + if (state === `UNKNOWN`) { + console.log('Testnet state found to be Unknown meaning there was an error with testnet creation. shutting down'); + throw new Error(`Error while creating testnet, aborting test run`); + } + await this.testnet.getTestnetConfig(); + } + else if (this.network === LIT_NETWORK.Custom) { + const context = await import('./networkContext.json'); + this._contractContext = context; + } + await this.setupLitNodeClient(); + await this.setupSuperCapacityDelegationAuthSig(); + await this.setupBareEthAuthSig(); + } + catch (e) { + const err = toErrorWithMessage(e); + console.log(`[𐬺🧪 Tinny Environment𐬺] Failed to init() tinny ${err.message}`); + console.log(err.stack); + process.exit(1); + } + } + /** + * Setup bare eth auth sig to test access control and decryption + */ + async setupBareEthAuthSig() { + const privateKey = await this.getAvailablePrivateKey(); + try { + const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers.Wallet(privateKey.privateKey, provider); + const toSign = await createSiweMessage({ + walletAddress: wallet.address, + nonce: await this.litNodeClient.getLatestBlockhash(), + expiration: new Date(Date.now() + 29 * 24 * 60 * 60 * 1000).toISOString(), + litNodeClient: this.litNodeClient, + }); + this.bareEthAuthSig = await generateAuthSig({ + signer: wallet, + toSign, + }); + } + finally { + // @ts-expect-error + this.releasePrivateKeyFromUser(privateKey); + } + } + //============= SHIVA ENDPOINTS ============= + /** + * Will stop the testnet that is being used in the test run. + */ + async stopTestnet() { + if (this.network === LIT_NETWORK.Custom && + this._shivaClient.processEnvs.STOP_TESTNET) { + await this.testnet.stopTestnet(); + } + else { + console.log('skipping testnet shutdown.'); + } + } + async mintSuperCapacityDelegationAuthSig(wallet) { + console.log('[𐬺🧪 Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it'); + const capacityTokenId = (await this.contractsClient.mintCapacityCreditsNFT({ + requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + })).capacityTokenIdStr; + try { + this.superCapacityDelegationAuthSig = (await this.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: wallet, + capacityTokenId: capacityTokenId, + // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it + uses: '200', + })).capacityDelegationAuthSig; + } + catch (e) { + if (e.message.includes(`Can't allocate capacity beyond the global max`)) { + console.log('❗️Skipping capacity delegation auth sig setup.', e); + } + else { + console.log('❗️Error while setting up capacity delegation auth sig', e); + } + } + } +} +//# sourceMappingURL=tinny-environment.js.map \ No newline at end of file diff --git a/local-tests/setup/tinny-operations.js b/local-tests/setup/tinny-operations.js new file mode 100644 index 0000000000..975e1e6669 --- /dev/null +++ b/local-tests/setup/tinny-operations.js @@ -0,0 +1,175 @@ +import { withTimeout } from './tinny-utils'; +/** + * Retrieves filter flags from the command line arguments to determine which tests to run. + * It parses the process arguments to find flags that specify filters, typically used to limit test execution to specific tests. + * + * @returns {string[]} An array of filter strings extracted from the command line arguments. + * + * @example + * // Assume the command line is: node script.js --filter=test1,test2 + */ +export const getFiltersFlag = () => { + const filterArg = process.argv.find((arg) => arg.startsWith('--filter=')); + return filterArg ? filterArg.replace('--filter=', '').split(',') : []; +}; +/** + * Retrieves the exclude flags from the command line arguments. + * @returns An array of strings representing the exclude flags. + */ +export const getExcludeFlags = () => { + const filterArg = process.argv.find((arg) => arg.startsWith('--exclude=')); + return filterArg ? filterArg.replace('--exclude=', '').split(',') : []; +}; +/** + * Runs the tests in the provided `tests` object in a synchronous manner. + * Each test is executed in a loop with a maximum number of attempts specified by `devEnv.processEnvs.MAX_ATTEMPTS`. + * Skipped, failed, and passed tests are tracked and logged. + * At the end, a test report is printed with the number of passed, failed, and skipped tests. + * If any test fails, the process exits with an error code. Otherwise, it exits successfully. + * + * @param {Object} options - The options object. + * @param {Object} options.tests - The tests to run. + * @param {TinnyEnvironment} options.devEnv - The development environment. + * @returns {Promise} - A promise that resolves when all tests have been executed. + */ +export const runInBand = async ({ tests, devEnv, }) => { + const filters = getFiltersFlag(); + const testsToRun = Object.entries(tests).filter(([testName]) => filters.length === 0 || filters.includes(testName)); + // Initialize arrays to keep track of skipped, failed, and passed tests + let skippedTests = []; + let failedTests = []; + let passedTests = []; + // Iterate over each test and run it in series + for (const [testName, testFunction] of testsToRun) { + const maxAttempts = devEnv.processEnvs.MAX_ATTEMPTS; + let attempts = 0; + let testPassed = false; + while (attempts < maxAttempts && !testPassed) { + const startTime = performance.now(); + try { + console.log(`Attempt ${attempts + 1} for ${testName}...`); + // @ts-ignore + await testFunction(devEnv); + testPassed = true; + const endTime = performance.now(); + const timeTaken = (endTime - startTime).toFixed(2); + console.log(`${testName} - Passed (${timeTaken} ms)`); + passedTests.push(`${testName} (Passed in ${timeTaken} ms)`); + } + catch (error) { + if (error.message === 'LIT_IGNORE_TEST') { + skippedTests.push(`${testName} (Skipped)`); + break; + } + attempts++; + if (attempts >= maxAttempts) { + const endTime = performance.now(); + const timeTaken = (endTime - startTime).toFixed(2); + console.error(`${testName} - Failed after ${maxAttempts} attempts (${timeTaken} ms)`); + console.error(`Error: ${error}`); + failedTests.push(`${testName} (Failed in ${timeTaken} ms) - Error: ${error}`); + } + } + await new Promise((resolve) => setTimeout(resolve, devEnv.processEnvs.RUN_IN_BAND_INTERVAL)); + } + } + passedTests.forEach((test) => console.log(`- ${test}`)); + failedTests.forEach((test) => console.log(`- ${test}`)); + skippedTests.forEach((test) => console.log(`- ${test}`)); + console.log(); + // Print results + console.log(`Test Report: ${passedTests.length} test(s) passed, ${failedTests.length} failed, ${skippedTests.length} skipped.`); + if (failedTests.length > 0) { + return 1; // Exit with error code if any test failed + } + else { + return 0; // Exit successfully if all tests passed + } +}; +/** + * Runs tests in parallel with a limit of 5 concurrent tests and reports the results. + * @param {Object} options - The options for running the tests. + * @param {any} options.tests - The tests to run. + * @param {TinnyEnvironment} options.devEnv - The development environment. + * @returns {Promise} - A promise that resolves to 0 if all tests passed, 1 otherwise. + */ +export const runTestsParallel = async ({ tests, devEnv, chunkSize, }) => { + const CHUNK_SIZE = chunkSize || parseInt(process.env.CHUNK_SIZE) || 5; + const filters = getFiltersFlag(); + const excludeFilters = getExcludeFlags(); + // Filter the tests based on include and exclude filters + const testsToRun = Object.entries(tests).filter(([testName]) => (filters.length === 0 || + filters.some((filter) => testName.includes(filter))) && + (excludeFilters.length === 0 || + !excludeFilters.some((exclude) => testName.includes(exclude)))); + if (!testsToRun || testsToRun.length <= 0) { + throw new Error('❌ No tests to run. You might have provided an invalid filter or no tests are available.'); + } + const runTest = async ([testName, testFunction], testIndex) => { + const maxAttempts = devEnv.processEnvs.MAX_ATTEMPTS; + const testTimeout = devEnv.processEnvs.TEST_TIMEOUT; + let attempts = 0; + let testPassed = false; + while (attempts < maxAttempts && !testPassed) { + const startTime = performance.now(); + try { + console.log(`\x1b[90m[runTestsParallel] Attempt ${attempts + 1} for ${testIndex + 1}. ${testName}...\x1b[0m`); + await withTimeout(testFunction(devEnv), testTimeout); + testPassed = true; + const endTime = performance.now(); + const timeTaken = (endTime - startTime).toFixed(2); + console.log(`\x1b[32m✔\x1b[90m ${testIndex + 1}. ${testName} - Passed (${timeTaken} ms)\x1b[0m`); + return `${testName} (Passed in ${timeTaken} ms)`; + } + catch (error) { + if (error.message === 'LIT_IGNORE_TEST') { + return `${testName} (Skipped)`; + } + attempts++; + const endTime = performance.now(); + const timeTaken = (endTime - startTime).toFixed(2); + if (error.message === 'Timed out') { + console.error(`\x1b[31m✖\x1b[90m ${testIndex + 1}. ${testName} - Timed out after ${testTimeout}ms (${timeTaken} ms)\x1b[0m`); + return `${testName} (Timed out in ${timeTaken} ms)`; + } + if (attempts >= maxAttempts) { + console.error(`\x1b[31m✖\x1b[90m ${testIndex + 1}. ${testName} - Failed after ${maxAttempts} attempts (${timeTaken} ms)\x1b[0m`); + console.error(`\x1b[31m❌Error:\x1b[90m ${JSON.stringify(error) || error}\x1b[0m`); + return `${testName} (Failed in ${timeTaken} ms) - Error: ${JSON.stringify(error)}`; + } + } + } + }; + const results = []; + for (let i = 0; i < testsToRun.length; i += CHUNK_SIZE) { + const chunk = testsToRun.slice(i, i + CHUNK_SIZE); + const chunkResults = await Promise.all(chunk.map((test, index) => runTest(test, i + index))); + // wait for 3 seconds before running the next chunk + await new Promise((resolve) => setTimeout(resolve, 3000)); + results.push(...chunkResults); + } + const skippedTests = results.filter((result) => result.includes('Skipped')); + const failedTests = results.filter((result) => result.includes('Failed') || result.includes('Timed out')); + const passedTests = results.filter((result) => result.includes('Passed')); + if (skippedTests.length > 0) { + console.log(`\x1b[90mTest Report: Some tests were skipped.\x1b[0m`); + skippedTests.forEach((skippedTest) => console.log(`\x1b[90m- ${skippedTest}\x1b[0m`)); + } + if (failedTests.length > 0) { + console.log(`\x1b[31mTest Report: Some tests failed.\x1b[0m`); + failedTests.forEach((failedTest) => console.log(`\x1b[31m- ${failedTest}\x1b[0m`)); + } + if (passedTests.length > 0) { + console.log(`\x1b[32mTest Report: ${passedTests.length} test(s) passed.\x1b[0m`); + passedTests.forEach((passedTest) => console.log(`\x1b[32m- ${passedTest}\x1b[0m`)); + } + if (failedTests.length > 0) { + console.log(`\x1b[31mTest Report: ${failedTests.length} test(s) failed.\x1b[0m`); + return 1; // Exit with error code if any test failed + } + else { + console.log('\x1b[32mTest Report: All tests passed.\x1b[0m'); + return 0; // Exit successfully if all tests passed + } +}; +//# sourceMappingURL=tinny-operations.js.map \ No newline at end of file diff --git a/local-tests/setup/tinny-person.js b/local-tests/setup/tinny-person.js new file mode 100644 index 0000000000..fe6ebf697f --- /dev/null +++ b/local-tests/setup/tinny-person.js @@ -0,0 +1,147 @@ +import { generateAuthSig, createSiweMessage, } from '@lit-protocol/auth-helpers'; +import { LitContracts } from '@lit-protocol/contracts-sdk'; +import { ethers } from 'ethers'; +import { EthWalletProvider } from '@lit-protocol/lit-auth-client'; +import { AUTH_METHOD_SCOPE, LIT_NETWORK } from '@lit-protocol/constants'; +export class TinnyPerson { + constructor({ privateKey, envConfig, }) { + // Pass this to data to sign + this.loveLetter = ethers.utils.arrayify(ethers.utils.keccak256([1, 2, 3, 4, 5])); + this.envConfig = envConfig; + this.privateKey = privateKey; + this.provider = new ethers.providers.StaticJsonRpcProvider({ + url: this.envConfig.rpc, + skipFetchSetup: true, + }); + this.wallet = new ethers.Wallet(privateKey, this.provider); + } + async getAuthMethodId() { + return EthWalletProvider.authMethodId(this.authMethod); + } + /** + * FIXME: Enabling this is causing the test to fail + * Switches the current wallet to a new funding wallet by creating a new funding wallet, + * funding it with a small amount of ethers, and updating the current wallet to the new one. + * + * @private + * @returns {Promise} A promise that resolves once the wallet has been switched. + */ + async _switchWallet() { + // Create a new funding wallet, funds it with small amount of ethers, and updates the current wallet to the new one. + const fundingWallet = ethers.Wallet.createRandom().connect(this.provider); + if (this.envConfig.network != LIT_NETWORK.Custom) { + // check balance this.wallet + const balance = await this.wallet.getBalance(); + console.log('[𐬺🧪 Tinny Person𐬺] Wallet balance:', ethers.utils.formatEther(balance)); + const transferTx = await this.wallet.sendTransaction({ + to: fundingWallet.address, + value: ethers.utils.parseEther('0.00001'), + }); + const transferReciept = await transferTx.wait(); + console.log('[𐬺🧪 Tinny Person𐬺] Transfered Assets for person tx: ', transferReciept.transactionHash); + this.wallet = fundingWallet; + } + } + async spawn() { + // await this._switchWallet(); + console.log('[𐬺🧪 Tinny Person𐬺] Spawning person:', this.wallet.address); + /** + * ==================================== + * Get Hot Wallet Auth Sig + * ==================================== + */ + this.siweMessage = await createSiweMessage({ + nonce: await this.envConfig.litNodeClient.getLatestBlockhash(), + walletAddress: this.wallet.address, + }); + this.authSig = await generateAuthSig({ + signer: this.wallet, + toSign: this.siweMessage, + }); + /** + * ==================================== + * Craft an authMethod from the authSig for the eth wallet auth method + * ==================================== + */ + console.log('[𐬺🧪 Tinny Person𐬺] Crafting an authMethod from the authSig for the eth wallet auth method...'); + this.authMethod = await EthWalletProvider.authenticate({ + signer: this.wallet, + litNodeClient: this.envConfig.litNodeClient, + }); + /** + * ==================================== + * Setup contracts-sdk client + * ==================================== + */ + if (this.envConfig.network === LIT_NETWORK.Custom) { + const networkContext = this.envConfig.contractContext; + this.contractsClient = new LitContracts({ + signer: this.wallet, + debug: this.envConfig.processEnvs.DEBUG, + rpc: this.envConfig.processEnvs.LIT_RPC_URL, // anvil rpc + customContext: networkContext, + network: LIT_NETWORK.Custom, + }); + } + else { + this.contractsClient = new LitContracts({ + signer: this.wallet, + debug: this.envConfig.processEnvs.DEBUG, + network: this.envConfig.network, + }); + } + await this.contractsClient.connect(); + /** + * ==================================== + * Mint a PKP + * ==================================== + */ + console.log('[𐬺🧪 Tinny Person𐬺] Minting a PKP...'); + const walletMintRes = await this.contractsClient.pkpNftContractUtils.write.mint(); + this.pkp = walletMintRes.pkp; + /** + * ==================================== + * Mint a PKP wiuth eth wallet auth method + * ==================================== + */ + console.log('[𐬺🧪 Tinny Person𐬺] Minting a PKP with eth wallet auth method...'); + this.authMethodOwnedPkp = (await this.contractsClient.mintWithAuth({ + authMethod: this.authMethod, + scopes: [AUTH_METHOD_SCOPE.SignAnything], + })).pkp; + console.log('[𐬺🧪 Tinny Person𐬺] 🐣 TinnyPerson spawned:', this.wallet.address); + } + /** + * ==================================== + * Mint a Capacity Credits NFT + * ==================================== + */ + async mintCapacityCreditsNFT() { + console.log('[𐬺🧪 Tinny Person𐬺] Mint a Capacity Credits NFT '); + const capacityTokenId = (await this.contractsClient.mintCapacityCreditsNFT({ + requestsPerKilosecond: this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + })).capacityTokenIdStr; + return capacityTokenId; + } + /** + * ==================================== + * Mint a Capacity Credits NFT and get a capacity delegation authSig with it + * ==================================== + */ + async createCapacityDelegationAuthSig(addresses = []) { + console.log('[𐬺🧪 Tinny Person𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it'); + const capacityTokenId = (await this.contractsClient.mintCapacityCreditsNFT({ + requestsPerKilosecond: this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + })).capacityTokenIdStr; + this.contractsClient.signer = this.wallet; + await this.contractsClient.connect(); + return (await this.envConfig.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: this.wallet, + capacityTokenId: capacityTokenId, + ...(addresses.length && { delegateeAddresses: addresses }), + })).capacityDelegationAuthSig; + } +} +//# sourceMappingURL=tinny-person.js.map \ No newline at end of file diff --git a/local-tests/setup/tinny-utils.js b/local-tests/setup/tinny-utils.js new file mode 100644 index 0000000000..bfbcef85a1 --- /dev/null +++ b/local-tests/setup/tinny-utils.js @@ -0,0 +1,69 @@ +import { importer } from 'ipfs-unixfs-importer'; +import { Buffer } from 'buffer'; +/** + * Converts a string to an IPFS hash. + * @param input - The input string to convert. + * @returns A Promise that resolves to the IPFS hash. + * @throws An error if the generated hash does not start with 'Qm'. + */ +export async function stringToIpfsHash(input) { + const blockput = { + put: async (block) => { + return block.cid; + }, + }; + // Convert the input string to a Buffer + const content = Buffer.from(input); + // Import the content to create an IPFS file + const files = importer([{ content }], blockput); + // Get the first (and only) file result + const result = (await files.next()).value; + const ipfsHash = result.cid.toString(); + if (!ipfsHash.startsWith('Qm')) { + throw new Error('Generated hash does not start with Qm'); + } + return ipfsHash; +} +export function randomSolanaPrivateKey() { + const BASE58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; + const SOLANA_PRIVATE_KEY_LENGTH = 88; + let result = ''; + const charactersLength = BASE58_ALPHABET.length; + for (let i = 0; i < SOLANA_PRIVATE_KEY_LENGTH; i++) { + const randomIndex = Math.floor(Math.random() * charactersLength); + result += BASE58_ALPHABET.charAt(randomIndex); + } + return result; +} +/** + * Wraps a promise with a timeout. + * If the promise does not resolve or reject within the specified time, it will be rejected with a "Timed out" error. + * + * @param promise - The promise to wrap with a timeout. + * @param ms - The timeout duration in milliseconds. + * @returns A new promise that resolves or rejects based on the original promise or the timeout. + */ +export function withTimeout(promise, ms) { + const timeout = new Promise((_, reject) => setTimeout(() => reject(new Error('Timed out')), ms)); + return Promise.race([promise, timeout]); +} +function isErrorWithMessage(error) { + return (typeof error === 'object' && + error !== null && + 'message' in error && + typeof error.message === 'string'); +} +// eslint-disable-next-line import/prefer-default-export +export function toErrorWithMessage(maybeError) { + if (isErrorWithMessage(maybeError)) + return maybeError; + try { + return new Error(JSON.stringify(maybeError)); + } + catch { + // fallback in case there's an error stringifying the maybeError + // like with circular references for example. + return new Error(String(maybeError)); + } +} +//# sourceMappingURL=tinny-utils.js.map \ No newline at end of file diff --git a/local-tests/test.js b/local-tests/test.js new file mode 100644 index 0000000000..eb8d4bb46e --- /dev/null +++ b/local-tests/test.js @@ -0,0 +1,25 @@ +import { TinnyEnvironment } from './setup/tinny-environment'; +import { runInBand, runTestsParallel } from './setup/tinny-operations'; +import { tinnyTests } from './tests'; +import { setLitActionsCodeToLocal } from './tests/wrapped-keys/util'; +// Use the current LIT action code to test against +setLitActionsCodeToLocal(); +(async () => { + console.log('[𐬺🧪 Tinny𐬺] Running tests...'); + const devEnv = new TinnyEnvironment(); + await devEnv.init(); + const testConfig = { + tests: tinnyTests, + devEnv, + }; + let res; + if (devEnv.processEnvs.RUN_IN_BAND) { + res = await runInBand(testConfig); + } + else { + res = await runTestsParallel(testConfig); + } + await devEnv.stopTestnet(); + process.exit(res); +})(); +//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/local-tests/test.ts b/local-tests/test.ts index e140a2d913..93bc62c67f 100644 --- a/local-tests/test.ts +++ b/local-tests/test.ts @@ -1,112 +1,7 @@ import { TinnyEnvironment } from './setup/tinny-environment'; import { runInBand, runTestsParallel } from './setup/tinny-operations'; -// import { testBundleSpeed } from './tests/test-bundle-speed'; -// import { testExample } from './tests/test-example'; -import { testUseEoaSessionSigsToExecuteJsSigning } from './tests/testUseEoaSessionSigsToExecuteJsSigning'; -import { testUseEoaSessionSigsToPkpSign } from './tests/testUseEoaSessionSigsToPkpSign'; -import { testUsePkpSessionSigsToExecuteJsSigning } from './tests/testUsePkpSessionSigsToExecuteJsSigning'; -import { testUsePkpSessionSigsToPkpSign } from './tests/testUsePkpSessionSigsToPkpSign'; -import { testUseValidLitActionCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign'; -import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning'; -import { testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning'; -import { testUseEoaSessionSigsToExecuteJsSigningInParallel } from './tests/testUseEoaSessionSigsToExecuteJsSigningInParallel'; -import { testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'; -import { testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign'; -import { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign'; -import { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs'; -import { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign'; -import { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs'; -import { testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs'; -import { testUseEoaSessionSigsToExecuteJsClaimKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimKeys'; -import { testUseEoaSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys'; -import { testUseEoaSessionSigsToExecuteJsJsonResponse } from './tests/testUseEoaSessionSigsToExecuteJsJsonResponse'; -import { testUseEoaSessionSigsToExecuteJsConsoleLog } from './tests/testUseEoaSessionSigsToExecuteJsConsoleLog'; -import { testUseEoaSessionSigsToEncryptDecryptString } from './tests/testUseEoaSessionSigsToEncryptDecryptString'; -import { testUseEoaSessionSigsToEncryptDecryptUint8Array } from './tests/testUseEoaSessionSigsToEncryptDecryptUint8Array'; -import { testUsePkpSessionSigsToEncryptDecryptString } from './tests/testUsePkpSessionSigsToEncryptDecryptString'; -import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString'; -import { testUseInvalidLitActionCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionCodeToGenerateSessionSigs'; -import { testUseEoaSessionSigsToEncryptDecryptFile } from './tests/testUseEoaSessionSigsToEncryptDecryptFile'; -import { testUsePkpSessionSigsToExecuteJsSigningInParallel } from './tests/testUsePkpSessionSigsToExecuteJsSigningInParallel'; -import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel'; -import { testUsePkpSessionSigsToExecuteJsClaimKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimKeys'; -import { testUsePkpSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys'; -import { testUsePkpSessionSigsToExecuteJsJsonResponse } from './tests/testUsePkpSessionSigsToExecuteJsJsonResponse'; -import { testUsePkpSessionSigsToExecuteJsConsoleLog } from './tests/testUsePkpSessionSigsToExecuteJsConsoleLog'; -import { testUsePkpSessionSigsToEncryptDecryptFile } from './tests/testUsePkpSessionSigsToEncryptDecryptFile'; -import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys'; -import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys'; -import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse'; -import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog'; -import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile'; -import { testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign'; -import { testUseInvalidLitActionIpfsCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs'; -import { testSolAuthSigToEncryptDecryptString } from './tests/testSolAuthSigToEncryptDecryptString'; -import { testEthAuthSigToEncryptDecryptString } from './tests/testEthAuthSigToEncryptDecryptString'; -import { testCosmosAuthSigToEncryptDecryptString } from './tests/testCosmosAuthSigToEncryptDecryptString'; -import { testPkpEthersWithEoaSessionSigsToSignMessage } from './tests/testPkpEthersWithEoaSessionSigsToSignMessage'; -import { testPkpEthersWithEoaSessionSigsToSignWithAuthContext } from './tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext'; -import { testPkpEthersWithEoaSessionSigsToEthSign } from './tests/testPkpEthersWithEoaSessionSigsToEthSign'; -import { testPkpEthersWithEoaSessionSigsToPersonalSign } from './tests/testPkpEthersWithEoaSessionSigsToPersonalSign'; -import { testPkpEthersWithEoaSessionSigsToSendTx } from './tests/testPkpEthersWithEoaSessionSigsToSendTx'; -import { testPkpEthersWithPkpSessionSigsToSignMessage } from './tests/testPkpEthersWithPkpSessionSigsToSignMessage'; -import { testPkpEthersWithPkpSessionSigsToEthSign } from './tests/testPkpEthersWithPkpSessionSigsToEthSign'; -import { testPkpEthersWithPkpSessionSigsToPersonalSign } from './tests/testPkpEthersWithPkpSessionSigsToPersonalSign'; -import { testPkpEthersWithPkpSessionSigsToSendTx } from './tests/testPkpEthersWithPkpSessionSigsToSendTx'; -import { testPkpEthersWithEoaSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction'; - -import { testPkpEthersWithPkpSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction'; -import { testPkpEthersWithLitActionSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction'; -import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1'; -import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1'; -import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1'; -import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3'; -import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4'; -import { testPkpEthersWithEoaSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData'; -import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil'; -import { testPkpEthersWithLitActionSessionSigsToSignMessage } from './tests/testPkpEthersWithLitActionSessionSigsToSignMessage'; -import { testPkpEthersWithLitActionSessionSigsToEthSign } from './tests/testPkpEthersWithLitActionSessionSigsToEthSign'; -import { testPkpEthersWithLitActionSessionSigsToPersonalSign } from './tests/testPkpEthersWithLitActionSessionSigsToPersonalSign'; -import { testPkpEthersWithLitActionSessionSigsToSendTx } from './tests/testPkpEthersWithLitActionSessionSigsToSendTx'; -import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3'; -import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3'; -import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4'; -import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4'; -import { testPkpEthersWithPkpSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData'; -import { testPkpEthersWithLitActionSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData'; -import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil'; -import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil'; -import { testUseCustomAuthSessionSigsToPkpSignExecuteJs } from './tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs'; -import { testExecuteJsSignAndCombineEcdsa } from './tests/testExecuteJsSignAndCombineEcdsa'; -import { testExecutJsDecryptAndCombine } from './tests/testExecuteJsDecryptAndCombine'; -import { testExecuteJsBroadcastAndCollect } from './tests/testExecuteJsBroadcastAndCollect'; -import { testRelayer } from './tests/testRelayer'; - -import { testEthereumSignMessageGeneratedKey } from './tests/wrapped-keys/testEthereumSignMessageGeneratedKey'; -import { testEthereumBroadcastTransactionGeneratedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey'; -import { testEthereumSignMessageWrappedKey } from './tests/wrapped-keys/testEthereumSignMessageWrappedKey'; -import { testFailEthereumSignTransactionWrappedKeyInvalidDecryption } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption'; -import { testEthereumSignTransactionWrappedKey } from './tests/wrapped-keys/testEthereumSignTransactionWrappedKey'; -import { testFailEthereumSignTransactionWrappedKeyWithInvalidParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam'; -import { testFailEthereumSignTransactionWrappedKeyWithMissingParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam'; -import { testEthereumBroadcastTransactionWrappedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey'; -import { testEthereumBroadcastWrappedKeyWithFetchGasParams } from './tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams'; -import { testImportWrappedKey } from './tests/wrapped-keys/testImportWrappedKey'; -import { testGenerateEthereumWrappedKey } from './tests/wrapped-keys/testGenerateEthereumWrappedKey'; -import { testGenerateSolanaWrappedKey } from './tests/wrapped-keys/testGenerateSolanaWrappedKey'; -import { testFailImportWrappedKeysWithSamePrivateKey } from './tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey'; -import { testFailImportWrappedKeysWithEoaSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig'; -import { testFailImportWrappedKeysWithMaxExpirySessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig'; -import { testFailImportWrappedKeysWithInvalidSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig'; -import { testFailImportWrappedKeysWithExpiredSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig'; -import { testExportWrappedKey } from './tests/wrapped-keys/testExportWrappedKey'; -import { testSignMessageWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey'; -import { testSignTransactionWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey'; -import { testBatchGeneratePrivateKeys } from './tests/wrapped-keys/testBatchGeneratePrivateKeys'; -import { testFailBatchGeneratePrivateKeysAtomic } from './tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic'; - +import { tinnyTests } from './tests'; import { setLitActionsCodeToLocal } from './tests/wrapped-keys/util'; -import { testUseEoaSessionSigsToRequestSingleResponse } from './tests/testUseEoaSessionSigsToRequestSingleResponse'; // Use the current LIT action code to test against setLitActionsCodeToLocal(); @@ -117,198 +12,13 @@ setLitActionsCodeToLocal(); await devEnv.init(); - const relayerTests = { - testRelayer, - }; - - // --filter=WrappedKey - const wrappedKeysTests = { - // -- valid cases - testBatchGeneratePrivateKeys, - testEthereumSignMessageGeneratedKey, - testEthereumBroadcastTransactionGeneratedKey, - testEthereumSignMessageWrappedKey, - testEthereumSignTransactionWrappedKey, - testEthereumBroadcastTransactionWrappedKey, - testEthereumBroadcastWrappedKeyWithFetchGasParams, - - // -- generate wrapped keys - testGenerateEthereumWrappedKey, - testGenerateSolanaWrappedKey, - - // -- import wrapped keys - testImportWrappedKey, - - // -- export wrapped keys - testExportWrappedKey, - - // -- solana wrapped keys - testSignMessageWithSolanaEncryptedKey, - testSignTransactionWithSolanaEncryptedKey, - - // -- invalid cases - testFailEthereumSignTransactionWrappedKeyWithMissingParam, - testFailEthereumSignTransactionWrappedKeyWithInvalidParam, - testFailEthereumSignTransactionWrappedKeyInvalidDecryption, - testFailBatchGeneratePrivateKeysAtomic, - - // -- import wrapped keys - testFailImportWrappedKeysWithSamePrivateKey, - testFailImportWrappedKeysWithEoaSessionSig, - testFailImportWrappedKeysWithMaxExpirySessionSig, - testFailImportWrappedKeysWithInvalidSessionSig, - testFailImportWrappedKeysWithExpiredSessionSig, - }; - - const eoaSessionSigsTests = { - testUseEoaSessionSigsToExecuteJsSigning, - testUseEoaSessionSigsToPkpSign, - testUseEoaSessionSigsToExecuteJsSigningInParallel, - testUseEoaSessionSigsToExecuteJsClaimKeys, - testUseEoaSessionSigsToExecuteJsClaimMultipleKeys, - testUseEoaSessionSigsToExecuteJsJsonResponse, - testUseEoaSessionSigsToExecuteJsConsoleLog, - testUseEoaSessionSigsToEncryptDecryptString, - testUseEoaSessionSigsToEncryptDecryptUint8Array, - testUseEoaSessionSigsToEncryptDecryptFile, - }; - - const pkpSessionSigsTests = { - testUsePkpSessionSigsToExecuteJsSigning, - testUsePkpSessionSigsToPkpSign, - testUsePkpSessionSigsToExecuteJsSigningInParallel, - testUsePkpSessionSigsToExecuteJsClaimKeys, - testUsePkpSessionSigsToExecuteJsClaimMultipleKeys, - testUsePkpSessionSigsToExecuteJsJsonResponse, - testUsePkpSessionSigsToExecuteJsConsoleLog, - testUsePkpSessionSigsToEncryptDecryptString, - testUsePkpSessionSigsToEncryptDecryptFile, - }; - - const litActionSessionSigsTests = { - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning, - testUseValidLitActionCodeGeneratedSessionSigsToPkpSign, - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel, - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys, - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys, - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse, - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog, - testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString, - testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile, - - // -- invalid cases - testUseInvalidLitActionIpfsCodeToGenerateSessionSigs, - - // -- custom auth methods - testUseCustomAuthSessionSigsToPkpSignExecuteJs, - }; - - const litActionIpfsIdSessionSigsTests = { - testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign, - testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning, - - // -- invalid cases - testUseInvalidLitActionCodeToGenerateSessionSigs, - }; - - const capacityDelegationTests = { - testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs, - testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign, - testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs, - testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs, - testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign, - testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs, - testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign, - }; - - const bareAuthSigTests = { - // -- eth auth sig - testEthAuthSigToEncryptDecryptString, - - // -- solana auth sig - testSolAuthSigToEncryptDecryptString, - - // -- cosmos auth sig - testCosmosAuthSigToEncryptDecryptString, - }; - - const pkpEthersTest = { - eoaSessionSigs: { - testPkpEthersWithEoaSessionSigsToSignWithAuthContext, - testPkpEthersWithEoaSessionSigsToSignMessage, - testPkpEthersWithEoaSessionSigsToEthSign, - testPkpEthersWithEoaSessionSigsToPersonalSign, - testPkpEthersWithEoaSessionSigsToSendTx, - testPkpEthersWithEoaSessionSigsToEthSignTransaction, - testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1, - testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3, - testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4, - testPkpEthersWithEoaSessionSigsToEthSignTypedData, - testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil, - }, - pkpSessionSigs: { - testPkpEthersWithPkpSessionSigsToSignMessage, - testPkpEthersWithPkpSessionSigsToEthSign, - testPkpEthersWithPkpSessionSigsToPersonalSign, - testPkpEthersWithPkpSessionSigsToSendTx, - testPkpEthersWithPkpSessionSigsToEthSignTransaction, - testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1, - testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3, - testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4, - testPkpEthersWithPkpSessionSigsToEthSignTypedData, - testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil, - }, - litActionSessionSigs: { - testPkpEthersWithLitActionSessionSigsToSignMessage, - testPkpEthersWithLitActionSessionSigsToEthSign, - testPkpEthersWithLitActionSessionSigsToPersonalSign, - testPkpEthersWithLitActionSessionSigsToSendTx, - testPkpEthersWithLitActionSessionSigsToEthSignTransaction, - testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1, - testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3, - testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4, - testPkpEthersWithLitActionSessionSigsToEthSignTypedData, - testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil, - }, - }; - - const litActionCombiningTests = { - ecdsaSignAndCombine: { - testExecuteJsSignAndCombineEcdsa, - }, - decryptAndCombine: { - testExecutJsDecryptAndCombine, - }, - broadcastAndCombine: { - testExecuteJsBroadcastAndCollect, - }, - }; - const testConfig = { - tests: { - // testExample, - // testBundleSpeed, - ...eoaSessionSigsTests, - ...pkpSessionSigsTests, - ...litActionSessionSigsTests, - ...litActionIpfsIdSessionSigsTests, - ...capacityDelegationTests, - ...bareAuthSigTests, - - ...pkpEthersTest.eoaSessionSigs, - ...pkpEthersTest.pkpSessionSigs, - ...pkpEthersTest.litActionSessionSigs, - - ...litActionCombiningTests.broadcastAndCombine, - ...litActionCombiningTests.decryptAndCombine, - ...litActionCombiningTests.ecdsaSignAndCombine, - - ...relayerTests, - ...wrappedKeysTests, - }, + tests: tinnyTests, devEnv, }; + let res; + if (devEnv.processEnvs.RUN_IN_BAND) { res = await runInBand(testConfig); } else { @@ -316,4 +26,5 @@ setLitActionsCodeToLocal(); } await devEnv.stopTestnet(); process.exit(res); + })(); diff --git a/local-tests/tests.js b/local-tests/tests.js new file mode 100644 index 0000000000..bd78f0e664 --- /dev/null +++ b/local-tests/tests.js @@ -0,0 +1,366 @@ +import { testUseEoaSessionSigsToExecuteJsSigning } from './tests/testUseEoaSessionSigsToExecuteJsSigning'; +import { testUseEoaSessionSigsToPkpSign } from './tests/testUseEoaSessionSigsToPkpSign'; +import { testUsePkpSessionSigsToExecuteJsSigning } from './tests/testUsePkpSessionSigsToExecuteJsSigning'; +import { testUsePkpSessionSigsToPkpSign } from './tests/testUsePkpSessionSigsToPkpSign'; +import { testUseValidLitActionCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning'; +import { testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning'; +import { testUseEoaSessionSigsToExecuteJsSigningInParallel } from './tests/testUseEoaSessionSigsToExecuteJsSigningInParallel'; +import { testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'; +import { testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs'; +import { testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs'; +import { testUseEoaSessionSigsToExecuteJsClaimKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimKeys'; +import { testUseEoaSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUseEoaSessionSigsToExecuteJsJsonResponse } from './tests/testUseEoaSessionSigsToExecuteJsJsonResponse'; +import { testUseEoaSessionSigsToExecuteJsConsoleLog } from './tests/testUseEoaSessionSigsToExecuteJsConsoleLog'; +import { testUseEoaSessionSigsToEncryptDecryptString } from './tests/testUseEoaSessionSigsToEncryptDecryptString'; +import { testUseEoaSessionSigsToEncryptDecryptUint8Array } from './tests/testUseEoaSessionSigsToEncryptDecryptUint8Array'; +import { testUsePkpSessionSigsToEncryptDecryptString } from './tests/testUsePkpSessionSigsToEncryptDecryptString'; +import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString'; +import { testUseInvalidLitActionCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionCodeToGenerateSessionSigs'; +import { testUseEoaSessionSigsToEncryptDecryptFile } from './tests/testUseEoaSessionSigsToEncryptDecryptFile'; +import { testUsePkpSessionSigsToExecuteJsSigningInParallel } from './tests/testUsePkpSessionSigsToExecuteJsSigningInParallel'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel'; +import { testUsePkpSessionSigsToExecuteJsClaimKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimKeys'; +import { testUsePkpSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUsePkpSessionSigsToExecuteJsJsonResponse } from './tests/testUsePkpSessionSigsToExecuteJsJsonResponse'; +import { testUsePkpSessionSigsToExecuteJsConsoleLog } from './tests/testUsePkpSessionSigsToExecuteJsConsoleLog'; +import { testUsePkpSessionSigsToEncryptDecryptFile } from './tests/testUsePkpSessionSigsToEncryptDecryptFile'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog'; +import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile'; +import { testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign'; +import { testUseInvalidLitActionIpfsCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs'; +import { testSolAuthSigToEncryptDecryptString } from './tests/testSolAuthSigToEncryptDecryptString'; +import { testEthAuthSigToEncryptDecryptString } from './tests/testEthAuthSigToEncryptDecryptString'; +import { testCosmosAuthSigToEncryptDecryptString } from './tests/testCosmosAuthSigToEncryptDecryptString'; +import { testPkpEthersWithEoaSessionSigsToSignMessage } from './tests/testPkpEthersWithEoaSessionSigsToSignMessage'; +import { testPkpEthersWithEoaSessionSigsToSignWithAuthContext } from './tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext'; +import { testPkpEthersWithEoaSessionSigsToEthSign } from './tests/testPkpEthersWithEoaSessionSigsToEthSign'; +import { testPkpEthersWithEoaSessionSigsToPersonalSign } from './tests/testPkpEthersWithEoaSessionSigsToPersonalSign'; +import { testPkpEthersWithEoaSessionSigsToSendTx } from './tests/testPkpEthersWithEoaSessionSigsToSendTx'; +import { testPkpEthersWithPkpSessionSigsToSignMessage } from './tests/testPkpEthersWithPkpSessionSigsToSignMessage'; +import { testPkpEthersWithPkpSessionSigsToEthSign } from './tests/testPkpEthersWithPkpSessionSigsToEthSign'; +import { testPkpEthersWithPkpSessionSigsToPersonalSign } from './tests/testPkpEthersWithPkpSessionSigsToPersonalSign'; +import { testPkpEthersWithPkpSessionSigsToSendTx } from './tests/testPkpEthersWithPkpSessionSigsToSendTx'; +import { testPkpEthersWithEoaSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction'; +import { testPkpEthersWithPkpSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil'; +import { testPkpEthersWithLitActionSessionSigsToSignMessage } from './tests/testPkpEthersWithLitActionSessionSigsToSignMessage'; +import { testPkpEthersWithLitActionSessionSigsToEthSign } from './tests/testPkpEthersWithLitActionSessionSigsToEthSign'; +import { testPkpEthersWithLitActionSessionSigsToPersonalSign } from './tests/testPkpEthersWithLitActionSessionSigsToPersonalSign'; +import { testPkpEthersWithLitActionSessionSigsToSendTx } from './tests/testPkpEthersWithLitActionSessionSigsToSendTx'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil'; +import { testUseCustomAuthSessionSigsToPkpSignExecuteJs } from './tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs'; +import { testExecuteJsSignAndCombineEcdsa } from './tests/testExecuteJsSignAndCombineEcdsa'; +import { testExecutJsDecryptAndCombine } from './tests/testExecuteJsDecryptAndCombine'; +import { testExecuteJsBroadcastAndCollect } from './tests/testExecuteJsBroadcastAndCollect'; +import { testRelayer } from './tests/testRelayer'; +import { testEthereumSignMessageGeneratedKey } from './tests/wrapped-keys/testEthereumSignMessageGeneratedKey'; +import { testEthereumBroadcastTransactionGeneratedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey'; +import { testEthereumSignMessageWrappedKey } from './tests/wrapped-keys/testEthereumSignMessageWrappedKey'; +import { testFailEthereumSignTransactionWrappedKeyInvalidDecryption } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption'; +import { testEthereumSignTransactionWrappedKey } from './tests/wrapped-keys/testEthereumSignTransactionWrappedKey'; +import { testFailEthereumSignTransactionWrappedKeyWithInvalidParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam'; +import { testFailEthereumSignTransactionWrappedKeyWithMissingParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam'; +import { testEthereumBroadcastTransactionWrappedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey'; +import { testEthereumBroadcastWrappedKeyWithFetchGasParams } from './tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams'; +import { testImportWrappedKey } from './tests/wrapped-keys/testImportWrappedKey'; +import { testGenerateEthereumWrappedKey } from './tests/wrapped-keys/testGenerateEthereumWrappedKey'; +import { testGenerateSolanaWrappedKey } from './tests/wrapped-keys/testGenerateSolanaWrappedKey'; +import { testFailImportWrappedKeysWithSamePrivateKey } from './tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey'; +import { testFailImportWrappedKeysWithEoaSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig'; +import { testFailImportWrappedKeysWithMaxExpirySessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig'; +import { testFailImportWrappedKeysWithInvalidSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig'; +import { testFailImportWrappedKeysWithExpiredSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig'; +import { testExportWrappedKey } from './tests/wrapped-keys/testExportWrappedKey'; +import { testSignMessageWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey'; +import { testSignTransactionWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey'; +import { testBatchGeneratePrivateKeys } from './tests/wrapped-keys/testBatchGeneratePrivateKeys'; +import { testFailBatchGeneratePrivateKeysAtomic } from './tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic'; +export { testUseEoaSessionSigsToExecuteJsSigning } from './tests/testUseEoaSessionSigsToExecuteJsSigning'; +export { testUseEoaSessionSigsToPkpSign } from './tests/testUseEoaSessionSigsToPkpSign'; +export { testUsePkpSessionSigsToExecuteJsSigning } from './tests/testUsePkpSessionSigsToExecuteJsSigning'; +export { testUsePkpSessionSigsToPkpSign } from './tests/testUsePkpSessionSigsToPkpSign'; +export { testUseValidLitActionCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning'; +export { testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning'; +export { testUseEoaSessionSigsToExecuteJsSigningInParallel } from './tests/testUseEoaSessionSigsToExecuteJsSigningInParallel'; +export { testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'; +export { testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs'; +export { testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs'; +export { testUseEoaSessionSigsToExecuteJsClaimKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimKeys'; +export { testUseEoaSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys'; +export { testUseEoaSessionSigsToExecuteJsJsonResponse } from './tests/testUseEoaSessionSigsToExecuteJsJsonResponse'; +export { testUseEoaSessionSigsToExecuteJsConsoleLog } from './tests/testUseEoaSessionSigsToExecuteJsConsoleLog'; +export { testUseEoaSessionSigsToEncryptDecryptString } from './tests/testUseEoaSessionSigsToEncryptDecryptString'; +export { testUseEoaSessionSigsToEncryptDecryptUint8Array } from './tests/testUseEoaSessionSigsToEncryptDecryptUint8Array'; +export { testUsePkpSessionSigsToEncryptDecryptString } from './tests/testUsePkpSessionSigsToEncryptDecryptString'; +export { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString'; +export { testUseInvalidLitActionCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionCodeToGenerateSessionSigs'; +export { testUseEoaSessionSigsToEncryptDecryptFile } from './tests/testUseEoaSessionSigsToEncryptDecryptFile'; +export { testUsePkpSessionSigsToExecuteJsSigningInParallel } from './tests/testUsePkpSessionSigsToExecuteJsSigningInParallel'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel'; +export { testUsePkpSessionSigsToExecuteJsClaimKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimKeys'; +export { testUsePkpSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys'; +export { testUsePkpSessionSigsToExecuteJsJsonResponse } from './tests/testUsePkpSessionSigsToExecuteJsJsonResponse'; +export { testUsePkpSessionSigsToExecuteJsConsoleLog } from './tests/testUsePkpSessionSigsToExecuteJsConsoleLog'; +export { testUsePkpSessionSigsToEncryptDecryptFile } from './tests/testUsePkpSessionSigsToEncryptDecryptFile'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog'; +export { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile'; +export { testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign'; +export { testUseInvalidLitActionIpfsCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs'; +export { testSolAuthSigToEncryptDecryptString } from './tests/testSolAuthSigToEncryptDecryptString'; +export { testEthAuthSigToEncryptDecryptString } from './tests/testEthAuthSigToEncryptDecryptString'; +export { testCosmosAuthSigToEncryptDecryptString } from './tests/testCosmosAuthSigToEncryptDecryptString'; +export { testPkpEthersWithEoaSessionSigsToSignMessage } from './tests/testPkpEthersWithEoaSessionSigsToSignMessage'; +export { testPkpEthersWithEoaSessionSigsToSignWithAuthContext } from './tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext'; +export { testPkpEthersWithEoaSessionSigsToEthSign } from './tests/testPkpEthersWithEoaSessionSigsToEthSign'; +export { testPkpEthersWithEoaSessionSigsToPersonalSign } from './tests/testPkpEthersWithEoaSessionSigsToPersonalSign'; +export { testPkpEthersWithEoaSessionSigsToSendTx } from './tests/testPkpEthersWithEoaSessionSigsToSendTx'; +export { testPkpEthersWithPkpSessionSigsToSignMessage } from './tests/testPkpEthersWithPkpSessionSigsToSignMessage'; +export { testPkpEthersWithPkpSessionSigsToEthSign } from './tests/testPkpEthersWithPkpSessionSigsToEthSign'; +export { testPkpEthersWithPkpSessionSigsToPersonalSign } from './tests/testPkpEthersWithPkpSessionSigsToPersonalSign'; +export { testPkpEthersWithPkpSessionSigsToSendTx } from './tests/testPkpEthersWithPkpSessionSigsToSendTx'; +export { testPkpEthersWithEoaSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction'; +export { testPkpEthersWithPkpSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil'; +export { testPkpEthersWithLitActionSessionSigsToSignMessage } from './tests/testPkpEthersWithLitActionSessionSigsToSignMessage'; +export { testPkpEthersWithLitActionSessionSigsToEthSign } from './tests/testPkpEthersWithLitActionSessionSigsToEthSign'; +export { testPkpEthersWithLitActionSessionSigsToPersonalSign } from './tests/testPkpEthersWithLitActionSessionSigsToPersonalSign'; +export { testPkpEthersWithLitActionSessionSigsToSendTx } from './tests/testPkpEthersWithLitActionSessionSigsToSendTx'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil'; +export { testUseCustomAuthSessionSigsToPkpSignExecuteJs } from './tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs'; +export { testExecuteJsSignAndCombineEcdsa } from './tests/testExecuteJsSignAndCombineEcdsa'; +export { testExecutJsDecryptAndCombine } from './tests/testExecuteJsDecryptAndCombine'; +export { testExecuteJsBroadcastAndCollect } from './tests/testExecuteJsBroadcastAndCollect'; +export { testRelayer } from './tests/testRelayer'; +export { testEthereumSignMessageGeneratedKey } from './tests/wrapped-keys/testEthereumSignMessageGeneratedKey'; +export { testEthereumBroadcastTransactionGeneratedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey'; +export { testEthereumSignMessageWrappedKey } from './tests/wrapped-keys/testEthereumSignMessageWrappedKey'; +export { testFailEthereumSignTransactionWrappedKeyInvalidDecryption } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption'; +export { testEthereumSignTransactionWrappedKey } from './tests/wrapped-keys/testEthereumSignTransactionWrappedKey'; +export { testFailEthereumSignTransactionWrappedKeyWithInvalidParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam'; +export { testFailEthereumSignTransactionWrappedKeyWithMissingParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam'; +export { testEthereumBroadcastTransactionWrappedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey'; +export { testEthereumBroadcastWrappedKeyWithFetchGasParams } from './tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams'; +export { testImportWrappedKey } from './tests/wrapped-keys/testImportWrappedKey'; +export { testGenerateEthereumWrappedKey } from './tests/wrapped-keys/testGenerateEthereumWrappedKey'; +export { testGenerateSolanaWrappedKey } from './tests/wrapped-keys/testGenerateSolanaWrappedKey'; +export { testFailImportWrappedKeysWithSamePrivateKey } from './tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey'; +export { testFailImportWrappedKeysWithEoaSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig'; +export { testFailImportWrappedKeysWithMaxExpirySessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig'; +export { testFailImportWrappedKeysWithInvalidSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig'; +export { testFailImportWrappedKeysWithExpiredSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig'; +export { testExportWrappedKey } from './tests/wrapped-keys/testExportWrappedKey'; +export { testSignMessageWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey'; +export { testSignTransactionWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey'; +export { testBatchGeneratePrivateKeys } from './tests/wrapped-keys/testBatchGeneratePrivateKeys'; +export { testFailBatchGeneratePrivateKeysAtomic } from './tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic'; +export { testUseEoaSessionSigsToRequestSingleResponse } from './tests/testUseEoaSessionSigsToRequestSingleResponse'; +const relayerTests = { + testRelayer, +}; +// --filter=WrappedKey +const wrappedKeysTests = { + // -- valid cases + testBatchGeneratePrivateKeys, + testEthereumSignMessageGeneratedKey, + testEthereumBroadcastTransactionGeneratedKey, + testEthereumSignMessageWrappedKey, + testEthereumSignTransactionWrappedKey, + testEthereumBroadcastTransactionWrappedKey, + testEthereumBroadcastWrappedKeyWithFetchGasParams, + // -- generate wrapped keys + testGenerateEthereumWrappedKey, + testGenerateSolanaWrappedKey, + // -- import wrapped keys + testImportWrappedKey, + // -- export wrapped keys + testExportWrappedKey, + // -- solana wrapped keys + testSignMessageWithSolanaEncryptedKey, + testSignTransactionWithSolanaEncryptedKey, + // -- invalid cases + testFailEthereumSignTransactionWrappedKeyWithMissingParam, + testFailEthereumSignTransactionWrappedKeyWithInvalidParam, + testFailEthereumSignTransactionWrappedKeyInvalidDecryption, + testFailBatchGeneratePrivateKeysAtomic, + // -- import wrapped keys + testFailImportWrappedKeysWithSamePrivateKey, + testFailImportWrappedKeysWithEoaSessionSig, + testFailImportWrappedKeysWithMaxExpirySessionSig, + testFailImportWrappedKeysWithInvalidSessionSig, + testFailImportWrappedKeysWithExpiredSessionSig, +}; +const eoaSessionSigsTests = { + testUseEoaSessionSigsToExecuteJsSigning, + testUseEoaSessionSigsToPkpSign, + testUseEoaSessionSigsToExecuteJsSigningInParallel, + testUseEoaSessionSigsToExecuteJsClaimKeys, + testUseEoaSessionSigsToExecuteJsClaimMultipleKeys, + testUseEoaSessionSigsToExecuteJsJsonResponse, + testUseEoaSessionSigsToExecuteJsConsoleLog, + testUseEoaSessionSigsToEncryptDecryptString, + testUseEoaSessionSigsToEncryptDecryptUint8Array, + testUseEoaSessionSigsToEncryptDecryptFile, +}; +const pkpSessionSigsTests = { + testUsePkpSessionSigsToExecuteJsSigning, + testUsePkpSessionSigsToPkpSign, + testUsePkpSessionSigsToExecuteJsSigningInParallel, + testUsePkpSessionSigsToExecuteJsClaimKeys, + testUsePkpSessionSigsToExecuteJsClaimMultipleKeys, + testUsePkpSessionSigsToExecuteJsJsonResponse, + testUsePkpSessionSigsToExecuteJsConsoleLog, + testUsePkpSessionSigsToEncryptDecryptString, + testUsePkpSessionSigsToEncryptDecryptFile, +}; +const litActionSessionSigsTests = { + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning, + testUseValidLitActionCodeGeneratedSessionSigsToPkpSign, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile, + // -- invalid cases + testUseInvalidLitActionIpfsCodeToGenerateSessionSigs, + // -- custom auth methods + testUseCustomAuthSessionSigsToPkpSignExecuteJs, +}; +const litActionIpfsIdSessionSigsTests = { + testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign, + testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning, + // -- invalid cases + testUseInvalidLitActionCodeToGenerateSessionSigs, +}; +const capacityDelegationTests = { + testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs, + testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign, + testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign, +}; +const bareAuthSigTests = { + // -- eth auth sig + testEthAuthSigToEncryptDecryptString, + // -- solana auth sig + testSolAuthSigToEncryptDecryptString, + // -- cosmos auth sig + testCosmosAuthSigToEncryptDecryptString, +}; +const pkpEthersTest = { + eoaSessionSigs: { + testPkpEthersWithEoaSessionSigsToSignWithAuthContext, + testPkpEthersWithEoaSessionSigsToSignMessage, + testPkpEthersWithEoaSessionSigsToEthSign, + testPkpEthersWithEoaSessionSigsToPersonalSign, + testPkpEthersWithEoaSessionSigsToSendTx, + testPkpEthersWithEoaSessionSigsToEthSignTransaction, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4, + testPkpEthersWithEoaSessionSigsToEthSignTypedData, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil, + }, + pkpSessionSigs: { + testPkpEthersWithPkpSessionSigsToSignMessage, + testPkpEthersWithPkpSessionSigsToEthSign, + testPkpEthersWithPkpSessionSigsToPersonalSign, + testPkpEthersWithPkpSessionSigsToSendTx, + testPkpEthersWithPkpSessionSigsToEthSignTransaction, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4, + testPkpEthersWithPkpSessionSigsToEthSignTypedData, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil, + }, + litActionSessionSigs: { + testPkpEthersWithLitActionSessionSigsToSignMessage, + testPkpEthersWithLitActionSessionSigsToEthSign, + testPkpEthersWithLitActionSessionSigsToPersonalSign, + testPkpEthersWithLitActionSessionSigsToSendTx, + testPkpEthersWithLitActionSessionSigsToEthSignTransaction, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4, + testPkpEthersWithLitActionSessionSigsToEthSignTypedData, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil, + }, +}; +const litActionCombiningTests = { + ecdsaSignAndCombine: { + testExecuteJsSignAndCombineEcdsa, + }, + decryptAndCombine: { + testExecutJsDecryptAndCombine, + }, + broadcastAndCombine: { + testExecuteJsBroadcastAndCollect, + }, +}; +export const tinnyTests = { + // testExample, + // testBundleSpeed, + ...eoaSessionSigsTests, + ...pkpSessionSigsTests, + ...litActionSessionSigsTests, + ...litActionIpfsIdSessionSigsTests, + ...capacityDelegationTests, + ...bareAuthSigTests, + ...pkpEthersTest.eoaSessionSigs, + ...pkpEthersTest.pkpSessionSigs, + ...pkpEthersTest.litActionSessionSigs, + ...litActionCombiningTests.broadcastAndCombine, + ...litActionCombiningTests.decryptAndCombine, + ...litActionCombiningTests.ecdsaSignAndCombine, + ...relayerTests, + ...wrappedKeysTests, +}; +//# sourceMappingURL=tests.js.map \ No newline at end of file diff --git a/local-tests/tests.ts b/local-tests/tests.ts new file mode 100644 index 0000000000..e73921f860 --- /dev/null +++ b/local-tests/tests.ts @@ -0,0 +1,396 @@ +import { testUseEoaSessionSigsToExecuteJsSigning } from './tests/testUseEoaSessionSigsToExecuteJsSigning'; +import { testUseEoaSessionSigsToPkpSign } from './tests/testUseEoaSessionSigsToPkpSign'; +import { testUsePkpSessionSigsToExecuteJsSigning } from './tests/testUsePkpSessionSigsToExecuteJsSigning'; +import { testUsePkpSessionSigsToPkpSign } from './tests/testUsePkpSessionSigsToPkpSign'; +import { testUseValidLitActionCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning'; +import { testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning'; +import { testUseEoaSessionSigsToExecuteJsSigningInParallel } from './tests/testUseEoaSessionSigsToExecuteJsSigningInParallel'; +import { testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'; +import { testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs'; +import { testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs'; +import { testUseEoaSessionSigsToExecuteJsClaimKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimKeys'; +import { testUseEoaSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUseEoaSessionSigsToExecuteJsJsonResponse } from './tests/testUseEoaSessionSigsToExecuteJsJsonResponse'; +import { testUseEoaSessionSigsToExecuteJsConsoleLog } from './tests/testUseEoaSessionSigsToExecuteJsConsoleLog'; +import { testUseEoaSessionSigsToEncryptDecryptString } from './tests/testUseEoaSessionSigsToEncryptDecryptString'; +import { testUseEoaSessionSigsToEncryptDecryptUint8Array } from './tests/testUseEoaSessionSigsToEncryptDecryptUint8Array'; +import { testUsePkpSessionSigsToEncryptDecryptString } from './tests/testUsePkpSessionSigsToEncryptDecryptString'; +import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString'; +import { testUseInvalidLitActionCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionCodeToGenerateSessionSigs'; +import { testUseEoaSessionSigsToEncryptDecryptFile } from './tests/testUseEoaSessionSigsToEncryptDecryptFile'; +import { testUsePkpSessionSigsToExecuteJsSigningInParallel } from './tests/testUsePkpSessionSigsToExecuteJsSigningInParallel'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel'; +import { testUsePkpSessionSigsToExecuteJsClaimKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimKeys'; +import { testUsePkpSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUsePkpSessionSigsToExecuteJsJsonResponse } from './tests/testUsePkpSessionSigsToExecuteJsJsonResponse'; +import { testUsePkpSessionSigsToExecuteJsConsoleLog } from './tests/testUsePkpSessionSigsToExecuteJsConsoleLog'; +import { testUsePkpSessionSigsToEncryptDecryptFile } from './tests/testUsePkpSessionSigsToEncryptDecryptFile'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog'; +import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile'; +import { testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign'; +import { testUseInvalidLitActionIpfsCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs'; +import { testSolAuthSigToEncryptDecryptString } from './tests/testSolAuthSigToEncryptDecryptString'; +import { testEthAuthSigToEncryptDecryptString } from './tests/testEthAuthSigToEncryptDecryptString'; +import { testCosmosAuthSigToEncryptDecryptString } from './tests/testCosmosAuthSigToEncryptDecryptString'; +import { testPkpEthersWithEoaSessionSigsToSignMessage } from './tests/testPkpEthersWithEoaSessionSigsToSignMessage'; +import { testPkpEthersWithEoaSessionSigsToSignWithAuthContext } from './tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext'; +import { testPkpEthersWithEoaSessionSigsToEthSign } from './tests/testPkpEthersWithEoaSessionSigsToEthSign'; +import { testPkpEthersWithEoaSessionSigsToPersonalSign } from './tests/testPkpEthersWithEoaSessionSigsToPersonalSign'; +import { testPkpEthersWithEoaSessionSigsToSendTx } from './tests/testPkpEthersWithEoaSessionSigsToSendTx'; +import { testPkpEthersWithPkpSessionSigsToSignMessage } from './tests/testPkpEthersWithPkpSessionSigsToSignMessage'; +import { testPkpEthersWithPkpSessionSigsToEthSign } from './tests/testPkpEthersWithPkpSessionSigsToEthSign'; +import { testPkpEthersWithPkpSessionSigsToPersonalSign } from './tests/testPkpEthersWithPkpSessionSigsToPersonalSign'; +import { testPkpEthersWithPkpSessionSigsToSendTx } from './tests/testPkpEthersWithPkpSessionSigsToSendTx'; +import { testPkpEthersWithEoaSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction'; + +import { testPkpEthersWithPkpSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData'; +import { testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil'; +import { testPkpEthersWithLitActionSessionSigsToSignMessage } from './tests/testPkpEthersWithLitActionSessionSigsToSignMessage'; +import { testPkpEthersWithLitActionSessionSigsToEthSign } from './tests/testPkpEthersWithLitActionSessionSigsToEthSign'; +import { testPkpEthersWithLitActionSessionSigsToPersonalSign } from './tests/testPkpEthersWithLitActionSessionSigsToPersonalSign'; +import { testPkpEthersWithLitActionSessionSigsToSendTx } from './tests/testPkpEthersWithLitActionSessionSigsToSendTx'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData'; +import { testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil'; +import { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil'; +import { testUseCustomAuthSessionSigsToPkpSignExecuteJs } from './tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs'; +import { testExecuteJsSignAndCombineEcdsa } from './tests/testExecuteJsSignAndCombineEcdsa'; +import { testExecutJsDecryptAndCombine } from './tests/testExecuteJsDecryptAndCombine'; +import { testExecuteJsBroadcastAndCollect } from './tests/testExecuteJsBroadcastAndCollect'; +import { testRelayer } from './tests/testRelayer'; + +import { testEthereumSignMessageGeneratedKey } from './tests/wrapped-keys/testEthereumSignMessageGeneratedKey'; +import { testEthereumBroadcastTransactionGeneratedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey'; +import { testEthereumSignMessageWrappedKey } from './tests/wrapped-keys/testEthereumSignMessageWrappedKey'; +import { testFailEthereumSignTransactionWrappedKeyInvalidDecryption } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption'; +import { testEthereumSignTransactionWrappedKey } from './tests/wrapped-keys/testEthereumSignTransactionWrappedKey'; +import { testFailEthereumSignTransactionWrappedKeyWithInvalidParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam'; +import { testFailEthereumSignTransactionWrappedKeyWithMissingParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam'; +import { testEthereumBroadcastTransactionWrappedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey'; +import { testEthereumBroadcastWrappedKeyWithFetchGasParams } from './tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams'; +import { testImportWrappedKey } from './tests/wrapped-keys/testImportWrappedKey'; +import { testGenerateEthereumWrappedKey } from './tests/wrapped-keys/testGenerateEthereumWrappedKey'; +import { testGenerateSolanaWrappedKey } from './tests/wrapped-keys/testGenerateSolanaWrappedKey'; +import { testFailImportWrappedKeysWithSamePrivateKey } from './tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey'; +import { testFailImportWrappedKeysWithEoaSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig'; +import { testFailImportWrappedKeysWithMaxExpirySessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig'; +import { testFailImportWrappedKeysWithInvalidSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig'; +import { testFailImportWrappedKeysWithExpiredSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig'; +import { testExportWrappedKey } from './tests/wrapped-keys/testExportWrappedKey'; +import { testSignMessageWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey'; +import { testSignTransactionWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey'; +import { testBatchGeneratePrivateKeys } from './tests/wrapped-keys/testBatchGeneratePrivateKeys'; +import { testFailBatchGeneratePrivateKeysAtomic } from './tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic'; +import { testUseEoaSessionSigsToRequestSingleResponse } from './tests/testUseEoaSessionSigsToRequestSingleResponse'; + +export { testUseEoaSessionSigsToExecuteJsSigning } from './tests/testUseEoaSessionSigsToExecuteJsSigning'; +export { testUseEoaSessionSigsToPkpSign } from './tests/testUseEoaSessionSigsToPkpSign'; +export { testUsePkpSessionSigsToExecuteJsSigning } from './tests/testUsePkpSessionSigsToExecuteJsSigning'; +export { testUsePkpSessionSigsToPkpSign } from './tests/testUsePkpSessionSigsToPkpSign'; +export { testUseValidLitActionCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning'; +export { testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning'; +export { testUseEoaSessionSigsToExecuteJsSigningInParallel } from './tests/testUseEoaSessionSigsToExecuteJsSigningInParallel'; +export { testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'; +export { testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign'; +export { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs'; +export { testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs'; +export { testUseEoaSessionSigsToExecuteJsClaimKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimKeys'; +export { testUseEoaSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys'; +export { testUseEoaSessionSigsToExecuteJsJsonResponse } from './tests/testUseEoaSessionSigsToExecuteJsJsonResponse'; +export { testUseEoaSessionSigsToExecuteJsConsoleLog } from './tests/testUseEoaSessionSigsToExecuteJsConsoleLog'; +export { testUseEoaSessionSigsToEncryptDecryptString } from './tests/testUseEoaSessionSigsToEncryptDecryptString'; +export { testUseEoaSessionSigsToEncryptDecryptUint8Array } from './tests/testUseEoaSessionSigsToEncryptDecryptUint8Array'; +export { testUsePkpSessionSigsToEncryptDecryptString } from './tests/testUsePkpSessionSigsToEncryptDecryptString'; +export { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString'; +export { testUseInvalidLitActionCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionCodeToGenerateSessionSigs'; +export { testUseEoaSessionSigsToEncryptDecryptFile } from './tests/testUseEoaSessionSigsToEncryptDecryptFile'; +export { testUsePkpSessionSigsToExecuteJsSigningInParallel } from './tests/testUsePkpSessionSigsToExecuteJsSigningInParallel'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel'; +export { testUsePkpSessionSigsToExecuteJsClaimKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimKeys'; +export { testUsePkpSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys'; +export { testUsePkpSessionSigsToExecuteJsJsonResponse } from './tests/testUsePkpSessionSigsToExecuteJsJsonResponse'; +export { testUsePkpSessionSigsToExecuteJsConsoleLog } from './tests/testUsePkpSessionSigsToExecuteJsConsoleLog'; +export { testUsePkpSessionSigsToEncryptDecryptFile } from './tests/testUsePkpSessionSigsToEncryptDecryptFile'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse'; +export { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog'; +export { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile'; +export { testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign'; +export { testUseInvalidLitActionIpfsCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs'; +export { testSolAuthSigToEncryptDecryptString } from './tests/testSolAuthSigToEncryptDecryptString'; +export { testEthAuthSigToEncryptDecryptString } from './tests/testEthAuthSigToEncryptDecryptString'; +export { testCosmosAuthSigToEncryptDecryptString } from './tests/testCosmosAuthSigToEncryptDecryptString'; +export { testPkpEthersWithEoaSessionSigsToSignMessage } from './tests/testPkpEthersWithEoaSessionSigsToSignMessage'; +export { testPkpEthersWithEoaSessionSigsToSignWithAuthContext } from './tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext'; +export { testPkpEthersWithEoaSessionSigsToEthSign } from './tests/testPkpEthersWithEoaSessionSigsToEthSign'; +export { testPkpEthersWithEoaSessionSigsToPersonalSign } from './tests/testPkpEthersWithEoaSessionSigsToPersonalSign'; +export { testPkpEthersWithEoaSessionSigsToSendTx } from './tests/testPkpEthersWithEoaSessionSigsToSendTx'; +export { testPkpEthersWithPkpSessionSigsToSignMessage } from './tests/testPkpEthersWithPkpSessionSigsToSignMessage'; +export { testPkpEthersWithPkpSessionSigsToEthSign } from './tests/testPkpEthersWithPkpSessionSigsToEthSign'; +export { testPkpEthersWithPkpSessionSigsToPersonalSign } from './tests/testPkpEthersWithPkpSessionSigsToPersonalSign'; +export { testPkpEthersWithPkpSessionSigsToSendTx } from './tests/testPkpEthersWithPkpSessionSigsToSendTx'; +export { testPkpEthersWithEoaSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction'; + +export { testPkpEthersWithPkpSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTransaction } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData'; +export { testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil'; +export { testPkpEthersWithLitActionSessionSigsToSignMessage } from './tests/testPkpEthersWithLitActionSessionSigsToSignMessage'; +export { testPkpEthersWithLitActionSessionSigsToEthSign } from './tests/testPkpEthersWithLitActionSessionSigsToEthSign'; +export { testPkpEthersWithLitActionSessionSigsToPersonalSign } from './tests/testPkpEthersWithLitActionSessionSigsToPersonalSign'; +export { testPkpEthersWithLitActionSessionSigsToSendTx } from './tests/testPkpEthersWithLitActionSessionSigsToSendTx'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedData } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData'; +export { testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil'; +export { testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil } from './tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil'; +export { testUseCustomAuthSessionSigsToPkpSignExecuteJs } from './tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs'; +export { testExecuteJsSignAndCombineEcdsa } from './tests/testExecuteJsSignAndCombineEcdsa'; +export { testExecutJsDecryptAndCombine } from './tests/testExecuteJsDecryptAndCombine'; +export { testExecuteJsBroadcastAndCollect } from './tests/testExecuteJsBroadcastAndCollect'; +export { testRelayer } from './tests/testRelayer'; + +export { testEthereumSignMessageGeneratedKey } from './tests/wrapped-keys/testEthereumSignMessageGeneratedKey'; +export { testEthereumBroadcastTransactionGeneratedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey'; +export { testEthereumSignMessageWrappedKey } from './tests/wrapped-keys/testEthereumSignMessageWrappedKey'; +export { testFailEthereumSignTransactionWrappedKeyInvalidDecryption } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption'; +export { testEthereumSignTransactionWrappedKey } from './tests/wrapped-keys/testEthereumSignTransactionWrappedKey'; +export { testFailEthereumSignTransactionWrappedKeyWithInvalidParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam'; +export { testFailEthereumSignTransactionWrappedKeyWithMissingParam } from './tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam'; +export { testEthereumBroadcastTransactionWrappedKey } from './tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey'; +export { testEthereumBroadcastWrappedKeyWithFetchGasParams } from './tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams'; +export { testImportWrappedKey } from './tests/wrapped-keys/testImportWrappedKey'; +export { testGenerateEthereumWrappedKey } from './tests/wrapped-keys/testGenerateEthereumWrappedKey'; +export { testGenerateSolanaWrappedKey } from './tests/wrapped-keys/testGenerateSolanaWrappedKey'; +export { testFailImportWrappedKeysWithSamePrivateKey } from './tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey'; +export { testFailImportWrappedKeysWithEoaSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig'; +export { testFailImportWrappedKeysWithMaxExpirySessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig'; +export { testFailImportWrappedKeysWithInvalidSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig'; +export { testFailImportWrappedKeysWithExpiredSessionSig } from './tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig'; +export { testExportWrappedKey } from './tests/wrapped-keys/testExportWrappedKey'; +export { testSignMessageWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey'; +export { testSignTransactionWithSolanaEncryptedKey } from './tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey'; +export { testBatchGeneratePrivateKeys } from './tests/wrapped-keys/testBatchGeneratePrivateKeys'; +export { testFailBatchGeneratePrivateKeysAtomic } from './tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic'; +export { testUseEoaSessionSigsToRequestSingleResponse } from './tests/testUseEoaSessionSigsToRequestSingleResponse'; + +const relayerTests = { + testRelayer, +}; + +// --filter=WrappedKey +const wrappedKeysTests = { + // -- valid cases + testBatchGeneratePrivateKeys, + testEthereumSignMessageGeneratedKey, + testEthereumBroadcastTransactionGeneratedKey, + testEthereumSignMessageWrappedKey, + testEthereumSignTransactionWrappedKey, + testEthereumBroadcastTransactionWrappedKey, + testEthereumBroadcastWrappedKeyWithFetchGasParams, + + // -- generate wrapped keys + testGenerateEthereumWrappedKey, + testGenerateSolanaWrappedKey, + + // -- import wrapped keys + testImportWrappedKey, + + // -- export wrapped keys + testExportWrappedKey, + + // -- solana wrapped keys + testSignMessageWithSolanaEncryptedKey, + testSignTransactionWithSolanaEncryptedKey, + + // -- invalid cases + testFailEthereumSignTransactionWrappedKeyWithMissingParam, + testFailEthereumSignTransactionWrappedKeyWithInvalidParam, + testFailEthereumSignTransactionWrappedKeyInvalidDecryption, + testFailBatchGeneratePrivateKeysAtomic, + + // -- import wrapped keys + testFailImportWrappedKeysWithSamePrivateKey, + testFailImportWrappedKeysWithEoaSessionSig, + testFailImportWrappedKeysWithMaxExpirySessionSig, + testFailImportWrappedKeysWithInvalidSessionSig, + testFailImportWrappedKeysWithExpiredSessionSig, +}; + +const eoaSessionSigsTests = { + testUseEoaSessionSigsToExecuteJsSigning, + testUseEoaSessionSigsToPkpSign, + testUseEoaSessionSigsToExecuteJsSigningInParallel, + testUseEoaSessionSigsToExecuteJsClaimKeys, + testUseEoaSessionSigsToExecuteJsClaimMultipleKeys, + testUseEoaSessionSigsToExecuteJsJsonResponse, + testUseEoaSessionSigsToExecuteJsConsoleLog, + testUseEoaSessionSigsToEncryptDecryptString, + testUseEoaSessionSigsToEncryptDecryptUint8Array, + testUseEoaSessionSigsToEncryptDecryptFile, +}; + +const pkpSessionSigsTests = { + testUsePkpSessionSigsToExecuteJsSigning, + testUsePkpSessionSigsToPkpSign, + testUsePkpSessionSigsToExecuteJsSigningInParallel, + testUsePkpSessionSigsToExecuteJsClaimKeys, + testUsePkpSessionSigsToExecuteJsClaimMultipleKeys, + testUsePkpSessionSigsToExecuteJsJsonResponse, + testUsePkpSessionSigsToExecuteJsConsoleLog, + testUsePkpSessionSigsToEncryptDecryptString, + testUsePkpSessionSigsToEncryptDecryptFile, +}; + +const litActionSessionSigsTests = { + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning, + testUseValidLitActionCodeGeneratedSessionSigsToPkpSign, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile, + + // -- invalid cases + testUseInvalidLitActionIpfsCodeToGenerateSessionSigs, + + // -- custom auth methods + testUseCustomAuthSessionSigsToPkpSignExecuteJs, +}; + +const litActionIpfsIdSessionSigsTests = { + testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign, + testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning, + + // -- invalid cases + testUseInvalidLitActionCodeToGenerateSessionSigs, +}; + +const capacityDelegationTests = { + testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs, + testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign, + testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign, +}; + +const bareAuthSigTests = { + // -- eth auth sig + testEthAuthSigToEncryptDecryptString, + + // -- solana auth sig + testSolAuthSigToEncryptDecryptString, + + // -- cosmos auth sig + testCosmosAuthSigToEncryptDecryptString, +}; + +const pkpEthersTest = { + eoaSessionSigs: { + testPkpEthersWithEoaSessionSigsToSignWithAuthContext, + testPkpEthersWithEoaSessionSigsToSignMessage, + testPkpEthersWithEoaSessionSigsToEthSign, + testPkpEthersWithEoaSessionSigsToPersonalSign, + testPkpEthersWithEoaSessionSigsToSendTx, + testPkpEthersWithEoaSessionSigsToEthSignTransaction, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4, + testPkpEthersWithEoaSessionSigsToEthSignTypedData, + testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil, + }, + pkpSessionSigs: { + testPkpEthersWithPkpSessionSigsToSignMessage, + testPkpEthersWithPkpSessionSigsToEthSign, + testPkpEthersWithPkpSessionSigsToPersonalSign, + testPkpEthersWithPkpSessionSigsToSendTx, + testPkpEthersWithPkpSessionSigsToEthSignTransaction, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4, + testPkpEthersWithPkpSessionSigsToEthSignTypedData, + testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil, + }, + litActionSessionSigs: { + testPkpEthersWithLitActionSessionSigsToSignMessage, + testPkpEthersWithLitActionSessionSigsToEthSign, + testPkpEthersWithLitActionSessionSigsToPersonalSign, + testPkpEthersWithLitActionSessionSigsToSendTx, + testPkpEthersWithLitActionSessionSigsToEthSignTransaction, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4, + testPkpEthersWithLitActionSessionSigsToEthSignTypedData, + testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil, + }, +}; + +const litActionCombiningTests = { + ecdsaSignAndCombine: { + testExecuteJsSignAndCombineEcdsa, + }, + decryptAndCombine: { + testExecutJsDecryptAndCombine, + }, + broadcastAndCombine: { + testExecuteJsBroadcastAndCollect, + }, +}; + +export const tinnyTests = { + // testExample, + // testBundleSpeed, + ...eoaSessionSigsTests, + ...pkpSessionSigsTests, + ...litActionSessionSigsTests, + ...litActionIpfsIdSessionSigsTests, + ...capacityDelegationTests, + ...bareAuthSigTests, + + ...pkpEthersTest.eoaSessionSigs, + ...pkpEthersTest.pkpSessionSigs, + ...pkpEthersTest.litActionSessionSigs, + + ...litActionCombiningTests.broadcastAndCombine, + ...litActionCombiningTests.decryptAndCombine, + ...litActionCombiningTests.ecdsaSignAndCombine, + + ...relayerTests, + ...wrappedKeysTests, +}; \ No newline at end of file diff --git a/local-tests/tests/test-bundle-speed.js b/local-tests/tests/test-bundle-speed.js new file mode 100644 index 0000000000..8a7476a465 --- /dev/null +++ b/local-tests/tests/test-bundle-speed.js @@ -0,0 +1,13 @@ +/** + * Test bundle speed + * @param devEnv + */ +export const testBundleSpeed = async (devEnv) => { + const a = await import('@lit-protocol/lit-node-client'); + const b = await import('@lit-protocol/contracts-sdk'); + const c = await import('@lit-protocol/auth-helpers'); + const d = await import('@lit-protocol/constants'); + const e = await import('@lit-protocol/lit-auth-client'); + console.log(a, b, c, d, e); +}; +//# sourceMappingURL=test-bundle-speed.js.map \ No newline at end of file diff --git a/local-tests/tests/test-example.js b/local-tests/tests/test-example.js new file mode 100644 index 0000000000..9a72c81801 --- /dev/null +++ b/local-tests/tests/test-example.js @@ -0,0 +1,33 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { LIT_NETWORK } from '@lit-protocol/constants'; +export const testExample = async (devEnv) => { + // Note: This test will be skipped if we are testing on the DatilDev network + devEnv.setUnavailable(LIT_NETWORK.DatilDev); + const alice = await devEnv.createRandomPerson(); + const aliceEoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const aliceExecuteJsRes = await devEnv.litNodeClient.executeJs({ + sessionSigs: aliceEoaSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp.publicKey, + }, + }); + console.log('aliceExecuteJsRes:', aliceExecuteJsRes); + devEnv.releasePrivateKeyFromUser(alice); + // console.log('aliceEoaSessionSigs: ', aliceEoaSessionSigs); + // const alicePkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + // console.log('alicePkpSessionSigs: ', alicePkpSessionSigs); + // const aliceLitActionSessionSigs = await getLitActionSessionSigs( + // devEnv, + // alice + // ); + // console.log('aliceLitActionSessionSigs: ', aliceLitActionSessionSigs); +}; +//# sourceMappingURL=test-example.js.map \ No newline at end of file diff --git a/local-tests/tests/testCosmosAuthSigToEncryptDecryptString.js b/local-tests/tests/testCosmosAuthSigToEncryptDecryptString.js new file mode 100644 index 0000000000..0fc4269781 --- /dev/null +++ b/local-tests/tests/testCosmosAuthSigToEncryptDecryptString.js @@ -0,0 +1,54 @@ +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LIT_NETWORK } from '@lit-protocol/constants'; +import { encryptString, decryptToString } from '@lit-protocol/encryption'; +/** + * Test Commands: + * ❌ NETWORK=datil-dev yarn test:local --filter=testCosmosAuthSigToEncryptDecryptString + * ❌ NETWORK=datil-test yarn test:local --filter=testCosmosAuthSigToEncryptDecryptString + * ❌ NETWORK=custom yarn test:local --filter=testCosmosAuthSigToEncryptDecryptString + * ❌ NETWORK=datil-dev yarn test:local --filter=testCosmosAuthSigToEncryptDecryptString + */ +export const testCosmosAuthSigToEncryptDecryptString = async (devEnv) => { + console.log('❌❌ THIS IS A KNOWN FAILING TEST, PLEASE IGNORE FOR NOW. ❌❌'); + devEnv.setUnavailable(LIT_NETWORK.Custom); + devEnv.setUnavailable(LIT_NETWORK.DatilDev); + const accs = AccessControlConditions.getCosmosBasicAccessControlConditions({ + userAddress: devEnv.bareCosmosAuthSig.address, + }); + const encryptRes = await encryptString({ + unifiedAccessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, devEnv.litNodeClient); + console.log('encryptRes:', encryptRes); + // -- Expected output:´ + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + // -- Decrypt the encrypted string + try { + const decryptRes = await decryptToString({ + unifiedAccessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + authSig: devEnv.bareCosmosAuthSig, + chain: 'cosmos', + }, devEnv.litNodeClient); + console.log('decryptRes:', decryptRes); + if (decryptRes !== 'Hello world') { + throw new Error(`Expected decryptRes to be 'Hello world' but got ${decryptRes}`); + } + console.log('✅ decryptRes:', decryptRes); + } + catch (e) { + console.log('❌ ERROR:', e); + } +}; +//# sourceMappingURL=testCosmosAuthSigToEncryptDecryptString.js.map \ No newline at end of file diff --git a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.js b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.js new file mode 100644 index 0000000000..40622af4be --- /dev/null +++ b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.js @@ -0,0 +1,96 @@ +import { AUTH_METHOD_SCOPE, AUTH_METHOD_TYPE } from '@lit-protocol/constants'; +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LIT_ABILITY } from '@lit-protocol/constants'; +/** + * ## Scenario: + * Delegating capacity credits NFT to Bob (delegatee) for him to execute JS code to sign with his PKP + * - Given: The capacity credits NFT is minted by the dApp owner + * - When: The dApp owner creates a capacity delegation authSig + * - And: The dApp owner delegates the capacity credits NFT to Bob + * - Then: The delegated (Bob's) wallet can execute JS code to sign with his PKP using the capacity from the capacity credits NFT + * + * + * ## Test Commands: + * - ✅ NETWORK=datil-test yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs + * - ✅ NETWORK=custom yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs + */ +export const testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + // Checking the scopes of the PKP owned by Bob + const bobsAuthMethodAuthId = await bob.getAuthMethodId(); + const scopes = await bob.contractsClient.pkpPermissionsContract.read.getPermittedAuthMethodScopes(bob.authMethodOwnedPkp.tokenId, AUTH_METHOD_TYPE.EthWallet, bobsAuthMethodAuthId, 3); + if (!scopes[AUTH_METHOD_SCOPE.SignAnything]) { + throw new Error('Bob does not have the "SignAnything" scope on his PKP'); + } + // As a dApp owner, create a capacity delegation authSig for Bob's PKP wallet + const capacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig([bob.authMethodOwnedPkp.ethAddress]); + // As a dApp owner, delegate the capacity credits NFT to Bob + const bobPkpSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: bob.authMethodOwnedPkp.publicKey, + authMethods: [bob.authMethod], + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ], + capabilityAuthSigs: [capacityDelegationAuthSig], + }); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobPkpSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.authMethodOwnedPkp.publicKey, + }, + }); + console.log('✅ res:', res); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "00fdf6f2fc3f13410393939bb678c8ec26c0eb46bfc39dbecdcf58540b7f9237", + // s: "480b578c78137150db2420669c47b220001b42a0bb4e92194ce7b76f6fd78ddc", + // recid: 0, + // signature: "0x00fdf6f2fc3f13410393939bb678c8ec26c0eb46bfc39dbecdcf58540b7f9237480b578c78137150db2420669c47b220001b42a0bb4e92194ce7b76f6fd78ddc1b", + // publicKey: "0465BFEE5CCFF60C0AF1D9B9481B680C2E34894A88F68F44CC094BA27501FD062A3C4AC61FA850BFA22D81D41AF72CBF983909501440FE51187F5FB3D1BC55C44E", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + // -- signatures.sig.signature must start with 0x + if (!res.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } +}; +//# sourceMappingURL=testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.js.map \ No newline at end of file diff --git a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.js b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.js new file mode 100644 index 0000000000..82bbf6ed12 --- /dev/null +++ b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.js @@ -0,0 +1,88 @@ +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * ## Scenario: + * Delegating capacity credits NFT to Bob (delegatee) for him to execute JS code to sign with his PKP + * - Given: The capacity credits NFT is minted by the dApp owner + * - When: The dApp owner creates a capacity delegation authSig + * - And: The dApp owner delegates the capacity credits NFT to Bob + * - Then: The delegated (Bob's) wallet can execute JS code to sign with his PKP using the capacity from the capacity credits NFT + * + * + * ## Test Commands: + * - ✅ NETWORK=datil-test yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs + * - ✅ NETWORK=custom yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs + */ +export const testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig([bob.wallet.address]); + // 4. Bob receives the capacity delegation authSig use it to generate session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations(devEnv, bob.wallet, appOwnersCapacityDelegationAuthSig); + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey, + }, + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + // Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", + // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", + // recid: 1, + // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", + // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + // -- signatures.sig.signature must start with 0x + if (!res.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // -- signatures.sig.recid must be parseable as a number + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + console.log('✅ testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'); +}; +//# sourceMappingURL=testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.js.map \ No newline at end of file diff --git a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.js b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.js new file mode 100644 index 0000000000..f9fc205a75 --- /dev/null +++ b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.js @@ -0,0 +1,71 @@ +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * ## Scenario: + * Delegating capacity credits NFT to Bob (delegatee) for him to execute JS code to sign with his PKP + * - Given: The capacity credits NFT is minted by the dApp owner + * - When: The dApp owner creates a capacity delegation authSig + * - And: The dApp owner delegates the capacity credits NFT to Bob + * - Then: The delegated (Bob's) wallet can execute JS code to sign with his PKP using the capacity from the capacity credits NFT + * + * + * ## Test Commands: + * - ✅ NETWORK=datil-test yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign + * - ✅ NETWORK=custom yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign + */ +export const testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig([bob.wallet.address]); + // 4. Bob receives the capacity delegation authSig use it to generate session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations(devEnv, bob.wallet, appOwnersCapacityDelegationAuthSig); + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.pkpSign({ + sessionSigs: bobsSessionSigs, + toSign: alice.loveLetter, + pubKey: bob.pkp.publicKey, + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + // -- Expected output: + // { + // r: "25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb636", + // s: "1e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c", + // recid: 0, + // signature: "0x25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb6361e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c1b", + // publicKey: "041FF0DC7B69D2B3C3E452AF9E0D30C7FDA6729A1B394059BDC8C4530D7F584FFCAEEEC19B1F22EFB054A22E5EF13AA0B5804994469570929066F5474D490B8A1F", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + // -- assertions + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + // -- signature must start with 0x + if (!res.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // -- recid must be parseable as a number + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + console.log('✅ res:', res); +}; +//# sourceMappingURL=testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testEthAuthSigToEncryptDecryptString.js b/local-tests/tests/testEthAuthSigToEncryptDecryptString.js new file mode 100644 index 0000000000..6f4ddc78d1 --- /dev/null +++ b/local-tests/tests/testEthAuthSigToEncryptDecryptString.js @@ -0,0 +1,52 @@ +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { log } from '@lit-protocol/misc'; +import { encryptString, decryptToString } from '@lit-protocol/encryption'; +import { CENTRALISATION_BY_NETWORK } from '@lit-protocol/constants'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testEthAuthSigToEncryptDecryptString + * ✅ NETWORK=datil-test yarn test:local --filter=testEthAuthSigToEncryptDecryptString + * ✅ NETWORK=custom yarn test:local --filter=testEthAuthSigToEncryptDecryptString + */ +export const testEthAuthSigToEncryptDecryptString = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + if (CENTRALISATION_BY_NETWORK[devEnv.network] === 'decentralised') { + // The capacity credits NFT owner automatically uses the capacity credits + // to pay for the encryption + await alice.mintCapacityCreditsNFT(); + } + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authSig.address, + }); + const encryptRes = await encryptString({ + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, devEnv.litNodeClient); + log('encryptRes:', encryptRes); + // await 5 seconds for the encryption to be mined + // -- Expected output:´ + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + // -- Decrypt the encrypted string + const decryptRes = await decryptToString({ + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + authSig: alice.authSig, + chain: 'ethereum', + }, devEnv.litNodeClient); + if (decryptRes !== 'Hello world') { + throw new Error(`Expected decryptRes to be 'Hello world' but got ${decryptRes}`); + } + console.log('✅ decryptRes:', decryptRes); +}; +//# sourceMappingURL=testEthAuthSigToEncryptDecryptString.js.map \ No newline at end of file diff --git a/local-tests/tests/testExecuteJsBroadcastAndCollect.js b/local-tests/tests/testExecuteJsBroadcastAndCollect.js new file mode 100644 index 0000000000..eb55c00bfe --- /dev/null +++ b/local-tests/tests/testExecuteJsBroadcastAndCollect.js @@ -0,0 +1,36 @@ +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString + * + */ +export const testExecuteJsBroadcastAndCollect = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + let rand = Math.floor(Math.random() * 100); + const resp = await Lit.Actions.broadcastAndCollect({ + name: "temperature", + value: rand.toString(), + }); + Lit.Actions.setResponse({ + response: JSON.stringify(resp) + }); + })();`, + jsParams: {}, + }); + devEnv.releasePrivateKeyFromUser(alice); + const response = res.response; + if (!response) { + throw new Error('Should contained broadcast data'); + } +}; +//# sourceMappingURL=testExecuteJsBroadcastAndCollect.js.map \ No newline at end of file diff --git a/local-tests/tests/testExecuteJsDecryptAndCombine.js b/local-tests/tests/testExecuteJsDecryptAndCombine.js new file mode 100644 index 0000000000..71345f4a85 --- /dev/null +++ b/local-tests/tests/testExecuteJsDecryptAndCombine.js @@ -0,0 +1,60 @@ +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { log } from '@lit-protocol/misc'; +import { encryptString } from '@lit-protocol/encryption'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString + * + */ +export const testExecutJsDecryptAndCombine = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const encryptRes = await encryptString({ + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, devEnv.litNodeClient); + log('encryptRes:', encryptRes); + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const resp = await Lit.Actions.decryptAndCombine({ + accessControlConditions, + ciphertext, + dataToEncryptHash, + authSig: null, + chain: 'ethereum', + }); + Lit.Actions.setResponse({ + response: resp + }); + })();`, + jsParams: { + accessControlConditions: accs, + dataToEncryptHash: encryptRes.dataToEncryptHash, + ciphertext: encryptRes.ciphertext, + }, + }); + devEnv.releasePrivateKeyFromUser(alice); + if (res.response !== 'Hello world') { + throw new Error('content does not match what was expected'); + } +}; +//# sourceMappingURL=testExecuteJsDecryptAndCombine.js.map \ No newline at end of file diff --git a/local-tests/tests/testExecuteJsSignAndCombineEcdsa.js b/local-tests/tests/testExecuteJsSignAndCombineEcdsa.js new file mode 100644 index 0000000000..95092b5b60 --- /dev/null +++ b/local-tests/tests/testExecuteJsSignAndCombineEcdsa.js @@ -0,0 +1,81 @@ +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * ## Scenario: + * Testing unrestricted access to execute js code using a capacity delegation authSig without specific delegatee restrictions + * - Given: A capacity delegation authSig is created by the dApp owner + * - When: The authSig does not specifically restrict delegatees + * - And: Any user attempts to execute js code using the capacity from the capacity credits NFT + * - Then: The user should be able to sign with his/her PKP using the capacity without restrictions due to the absence of delegatee limits + * + * + * ## Test Commands: + * - ✅ NETWORK=datil-test yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs + * - ✅ NETWORK=custom yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs + */ +export const testExecuteJsSignAndCombineEcdsa = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = (await devEnv.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: alice.wallet, + })).capacityDelegationAuthSig; + // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations(devEnv, bob.wallet, appOwnersCapacityDelegationAuthSig); + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + // 4. Bob can now execute JS code using the capacity credits NFT + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signAndCombineEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + Lit.Actions.setResponse({ + response: sigShare + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey, + }, + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + /** + Response format + { + "success": true, + "signedData": {}, + "decryptedData": {}, + "claimData": {}, + "response": "{\"r\":\"026eede14267ca76064a7e22dbe6f9e44d786c7b5917b7d023f45ee4e84ce1ea47\",\"s\":\"22a6048bcb88d724d45bdb6161fefd151483f41d592d167e5c33f42e9fe6dac6\",\"v\":0}", + "logs": "" + } + */ + if (!res.response) { + throw new Error('Response not found, expecting signature in response'); + } + const sig = JSON.parse(res.response); + console.log('signature returned as a response', sig); + if (!sig.r) { + throw new Error('invalid signature returned from lit action'); + } + if (!sig.s) { + throw new Error('invalid signature returned from lit action'); + } + if (sig.v === undefined) { + throw new Error('invalid signature returned from lit action'); + } + console.log('✅ testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'); +}; +//# sourceMappingURL=testExecuteJsSignAndCombineEcdsa.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSign.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSign.js new file mode 100644 index 0000000000..70c3b3d750 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSign.js @@ -0,0 +1,51 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSign + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSign + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSign + */ +export const testPkpEthersWithEoaSessionSigsToEthSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + console.log('devEnv.network:', devEnv.network); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs, + }); + await pkpEthersWallet.init(); + // -- test eth_sign + try { + // Message to sign + const message = 'Hello world'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + // DATA, 20 Bytes - address + // DATA, N Bytes - message to sign + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_sign', + params: [alice.pkp.ethAddress, hexMsg], + }, + }); + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error(`❌ test eth_sign recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}`); + } + console.log('✅ recoveredAddr:', recoveredAddr); + } + catch (e) { + throw new Error('❌ Error: ' + e.message); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToEthSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction.js new file mode 100644 index 0000000000..39e941fe64 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction.js @@ -0,0 +1,87 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTransaction + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTransaction + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTransaction + */ +export const testPkpEthersWithEoaSessionSigsToEthSignTransaction = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_sendTransaction parameters + try { + // Transaction to sign and send + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers.BigNumber.from('21000'); + const value = ethers.BigNumber.from('0'); + const data = '0x'; + // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const tx = { + from: from, + to: to, + gasLimit, + value, + data, + }; + // eth_sendTransaction parameters + // Transaction - Object + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction + // A serialized form of the whole transaction + const rawSignedTx = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTransaction', + params: [tx], + }, + }); + const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); + const signature = ethers.utils.joinSignature({ + r: parsedTransaction.r, + s: parsedTransaction.s, + v: parsedTransaction.v, + }); + const rawTx = { + nonce: parsedTransaction.nonce, + gasPrice: parsedTransaction.gasPrice, + gasLimit: parsedTransaction.gasLimit, + to: parsedTransaction.to, + value: parsedTransaction.value, + data: parsedTransaction.data, + chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 + }; + const txHash = ethers.utils.keccak256(ethers.utils.serializeTransaction(rawTx)); + const { v, r, s } = parsedTransaction; + const recoveredAddress = ethers.utils.recoverAddress(txHash, { r, s, v }); + // ==================== Post-Validation ==================== + if (!parsedTransaction) { + throw new Error('❌ parsedTransaction should not be null'); + } + if (signature.length !== 132) { + throw new Error(`❌ signature should be 132 characters long, got ${signature.length}`); + } + if (recoveredAddress.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddres should be ${alice.pkp.ethAddress}, got ${recoveredAddress}`); + } + } + catch (e) { + if (e.message.includes('insufficient FPE funds')) { + console.log(`🧪 PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)`); + } + else { + throw new Error(`❌ Error: ${e.toString()}`); + } + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToEthSignTransaction.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData.js new file mode 100644 index 0000000000..eb0266e621 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData.js @@ -0,0 +1,82 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedData + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedData + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedData + */ +export const testPkpEthersWithEoaSessionSigsToEthSignTypedData = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData parameters + try { + // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData', + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], + }, + }); + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData(msgParams.domain, { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, msgParams.message, signature); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToEthSignTypedData.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil.js new file mode 100644 index 0000000000..7bfec89812 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil.js @@ -0,0 +1,76 @@ +import { PKPEthersWallet, signTypedData, } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil + */ +export const testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData parameters + try { + // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + const signature = await signTypedData(pkpEthersWallet, msgParams); + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData(msgParams.domain, { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, msgParams.message, signature); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1.js new file mode 100644 index 0000000000..8e1448e1cf --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1.js @@ -0,0 +1,64 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { SignTypedDataVersion, recoverTypedSignature, } from '@metamask/eth-sig-util'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 + */ +export const testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData_v1 parameters + try { + const msgParams = [ + { + type: 'string', + name: 'Message', + value: 'Hi, Alice!', + }, + { + type: 'uint32', + name: 'A number', + value: '1337', + }, + ]; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v1', + params: [msgParams, alice.pkp.ethAddress], + }, + }); + const signatureBytes = ethers.utils.arrayify(signature); + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signatureBytes, + version: SignTypedDataVersion.V1, + }); + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + console.log('signature: ', signature); + console.log('recoveredAddr: ', recoveredAddr); + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3.js new file mode 100644 index 0000000000..342a02a8d9 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3.js @@ -0,0 +1,93 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { SignTypedDataVersion, recoverTypedSignature, } from '@metamask/eth-sig-util'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 + */ +export const testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData_v3 parameters + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v3', + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], + }, + }); + const recoveredAddr = recoverTypedSignature({ + data: { + // @ts-ignore + types: msgParams.types, + // @ts-ignore + domain: msgParams.domain, + // @ts-ignore + primaryType: msgParams.primaryType, + // @ts-ignore + message: msgParams.message, + }, + signature: signature, + version: SignTypedDataVersion.V3, + }); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4.js new file mode 100644 index 0000000000..017abbff8e --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4.js @@ -0,0 +1,93 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { SignTypedDataVersion, recoverTypedSignature, } from '@metamask/eth-sig-util'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 + */ +export const testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData_v3 parameters + try { + const msgParams = { + domain: { + chainId: 80001, + name: 'Ether Mail', + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + version: '1', + }, + message: { + contents: 'Hello, Bob!', + from: { + name: 'Cow', + wallets: [ + '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', + ], + }, + to: [ + { + name: 'Bob', + wallets: [ + '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', + '0xB0B0b0b0b0b0B000000000000000000000000000', + ], + }, + ], + }, + primaryType: 'Mail', + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person[]' }, + { name: 'contents', type: 'string' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallets', type: 'address[]' }, + ], + }, + }; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v4', + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], + }, + }); + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signature, + version: SignTypedDataVersion.V4, + }); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToPersonalSign.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToPersonalSign.js new file mode 100644 index 0000000000..4fbbc326c8 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToPersonalSign.js @@ -0,0 +1,52 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToPersonalSign + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToPersonalSign + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToPersonalSign + */ +export const testPkpEthersWithEoaSessionSigsToPersonalSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs, + }); + await pkpEthersWallet.init(); + // -- personal_sign parameters + try { + // Message to sign + const message = 'Free the web'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + // personal_sign parameters + // DATA, N Bytes - message to sign. + // DATA, 20 Bytes - address + // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'personal_sign', + params: [hexMsg, alice.pkp.ethAddress], + }, + }); + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error(`❌ recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}`); + } + console.log('✅ personal_sign recoveredAddr:', recoveredAddr); + } + catch (e) { + throw new Error('❌ Error: ' + e.message); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToPersonalSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToSendTx.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToSendTx.js new file mode 100644 index 0000000000..6c79199ae5 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToSendTx.js @@ -0,0 +1,57 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSendTx + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSendTx + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSendTx + */ +export const testPkpEthersWithEoaSessionSigsToSendTx = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs, + }); + await devEnv.getFunds(alice.pkp.ethAddress); + await pkpEthersWallet.init(); + // -- eth_sendTransaction parameters + try { + // Transaction to sign and send + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers.BigNumber.from('21000'); + const value = ethers.BigNumber.from('0'); + const data = '0x'; + // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const tx = { + from: from, + to: to, + gasLimit, + value, + data, + }; + const txRes = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_sendTransaction', + params: [tx], + }, + }); + console.log('✅ txRes:', txRes); + } + catch (e) { + if (e.message.includes('insufficient FPE funds')) { + console.log(`🧪 PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)`); + } + else { + throw new Error(`❌ Error: ${e.toString()}`); + } + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToSendTx.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignMessage.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignMessage.js new file mode 100644 index 0000000000..1c78cf3e9c --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignMessage.js @@ -0,0 +1,30 @@ +import { PKPEthersWallet } from '@lit-protocol/pkp-ethers'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignMessage + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignMessage + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignMessage + */ +export const testPkpEthersWithEoaSessionSigsToSignMessage = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: eoaSessionSigs, + }); + await pkpEthersWallet.init(); + // -- test signMessage + try { + const signature = await pkpEthersWallet.signMessage(alice.loveLetter); + console.log('✅ signature:', signature); + } + catch (e) { + throw new Error('❌ Error: ' + e.message); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToSignMessage.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext.js b/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext.js new file mode 100644 index 0000000000..66c44cc426 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext.js @@ -0,0 +1,58 @@ +import { LitActionResource, LitPKPResource, createSiweMessageWithRecaps, generateAuthSig, } from '@lit-protocol/auth-helpers'; +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { PKPEthersWallet } from '@lit-protocol/pkp-ethers'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignWithAuthContext + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignWithAuthContext + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignWithAuthContext + */ +export const testPkpEthersWithEoaSessionSigsToSignWithAuthContext = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpEthersWallet = new PKPEthersWallet({ + pkpPubKey: alice.pkp.publicKey, + litNodeClient: devEnv.litNodeClient, + authContext: { + client: devEnv.litNodeClient, + getSessionSigsProps: { + authNeededCallback: async function (params) { + const toSign = await createSiweMessageWithRecaps({ + uri: params.uri, + expiration: params.expiration, + resources: params.resourceAbilityRequests, + walletAddress: alice.wallet.address, + nonce: await devEnv.litNodeClient.getLatestBlockhash(), + litNodeClient: devEnv.litNodeClient, + }); + const authSig = await generateAuthSig({ + signer: alice.wallet, + toSign, + }); + return authSig; + }, + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ], + }, + }, + }); + await pkpEthersWallet.init(); + try { + const signature = await pkpEthersWallet.signMessage(alice.loveLetter); + console.log('✅ signature:', signature); + } + catch (e) { + throw new Error('❌ Error: ' + e.message); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithEoaSessionSigsToSignWithAuthContext.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSign.js b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSign.js new file mode 100644 index 0000000000..5525ac7755 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSign.js @@ -0,0 +1,51 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSign + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSign + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSign + */ +export const testPkpEthersWithLitActionSessionSigsToEthSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + console.log('devEnv.network:', devEnv.network); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs, + }); + await pkpEthersWallet.init(); + // -- test eth_sign + try { + // Message to sign + const message = 'Hello world'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + // DATA, 20 Bytes - address + // DATA, N Bytes - message to sign + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_sign', + params: [alice.pkp.ethAddress, hexMsg], + }, + }); + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error(`❌ test eth_sign recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}`); + } + console.log('✅ recoveredAddr:', recoveredAddr); + } + catch (e) { + throw new Error('❌ Error: ' + e.message); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithLitActionSessionSigsToEthSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction.js b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction.js new file mode 100644 index 0000000000..429bbe6ec3 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction.js @@ -0,0 +1,87 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTransaction + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTransaction + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTransaction + */ +export const testPkpEthersWithLitActionSessionSigsToEthSignTransaction = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_sendTransaction parameters + try { + // Transaction to sign and send + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers.BigNumber.from('21000'); + const value = ethers.BigNumber.from('0'); + const data = '0x'; + // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const tx = { + from: from, + to: to, + gasLimit, + value, + data, + }; + // eth_sendTransaction parameters + // Transaction - Object + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction + // A serialized form of the whole transaction + const rawSignedTx = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTransaction', + params: [tx], + }, + }); + const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); + const signature = ethers.utils.joinSignature({ + r: parsedTransaction.r, + s: parsedTransaction.s, + v: parsedTransaction.v, + }); + const rawTx = { + nonce: parsedTransaction.nonce, + gasPrice: parsedTransaction.gasPrice, + gasLimit: parsedTransaction.gasLimit, + to: parsedTransaction.to, + value: parsedTransaction.value, + data: parsedTransaction.data, + chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 + }; + const txHash = ethers.utils.keccak256(ethers.utils.serializeTransaction(rawTx)); + const { v, r, s } = parsedTransaction; + const recoveredAddress = ethers.utils.recoverAddress(txHash, { r, s, v }); + // ==================== Post-Validation ==================== + if (!parsedTransaction) { + throw new Error('❌ parsedTransaction should not be null'); + } + if (signature.length !== 132) { + throw new Error(`❌ signature should be 132 characters long, got ${signature.length}`); + } + if (recoveredAddress.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddres should be ${alice.pkp.ethAddress}, got ${recoveredAddress}`); + } + } + catch (e) { + if (e.message.includes('insufficient FPE funds')) { + console.log(`🧪 PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)`); + } + else { + throw new Error(`❌ Error: ${e.toString()}`); + } + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithLitActionSessionSigsToEthSignTransaction.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData.js b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData.js new file mode 100644 index 0000000000..8190d6d9e7 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData.js @@ -0,0 +1,82 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedData + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedData + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedData + */ +export const testPkpEthersWithLitActionSessionSigsToEthSignTypedData = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData parameters + try { + // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData', + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], + }, + }); + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData(msgParams.domain, { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, msgParams.message, signature); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithLitActionSessionSigsToEthSignTypedData.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil.js b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil.js new file mode 100644 index 0000000000..13187b059b --- /dev/null +++ b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil.js @@ -0,0 +1,76 @@ +import { PKPEthersWallet, signTypedData } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil + */ +export const testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData parameters + try { + // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + const signature = await signTypedData(pkpEthersWallet, msgParams); + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData(msgParams.domain, { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, msgParams.message, signature); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1.js b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1.js new file mode 100644 index 0000000000..e220cc86d9 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1.js @@ -0,0 +1,64 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { SignTypedDataVersion, recoverTypedSignature, } from '@metamask/eth-sig-util'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 + */ +export const testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData_v1 parameters + try { + const msgParams = [ + { + type: 'string', + name: 'Message', + value: 'Hi, Alice!', + }, + { + type: 'uint32', + name: 'A number', + value: '1337', + }, + ]; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v1', + params: [msgParams, alice.pkp.ethAddress], + }, + }); + const signatureBytes = ethers.utils.arrayify(signature); + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signatureBytes, + version: SignTypedDataVersion.V1, + }); + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + console.log('signature: ', signature); + console.log('recoveredAddr: ', recoveredAddr); + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3.js b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3.js new file mode 100644 index 0000000000..a8dc4a4193 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3.js @@ -0,0 +1,93 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { SignTypedDataVersion, recoverTypedSignature, } from '@metamask/eth-sig-util'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 + */ +export const testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData_v3 parameters + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v3', + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], + }, + }); + const recoveredAddr = recoverTypedSignature({ + data: { + // @ts-ignore + types: msgParams.types, + // @ts-ignore + domain: msgParams.domain, + // @ts-ignore + primaryType: msgParams.primaryType, + // @ts-ignore + message: msgParams.message, + }, + signature: signature, + version: SignTypedDataVersion.V3, + }); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4.js b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4.js new file mode 100644 index 0000000000..23d7de0252 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4.js @@ -0,0 +1,93 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { SignTypedDataVersion, recoverTypedSignature, } from '@metamask/eth-sig-util'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 + */ +export const testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData_v3 parameters + try { + const msgParams = { + domain: { + chainId: 80001, + name: 'Ether Mail', + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + version: '1', + }, + message: { + contents: 'Hello, Bob!', + from: { + name: 'Cow', + wallets: [ + '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', + ], + }, + to: [ + { + name: 'Bob', + wallets: [ + '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', + '0xB0B0b0b0b0b0B000000000000000000000000000', + ], + }, + ], + }, + primaryType: 'Mail', + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person[]' }, + { name: 'contents', type: 'string' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallets', type: 'address[]' }, + ], + }, + }; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v4', + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], + }, + }); + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signature, + version: SignTypedDataVersion.V4, + }); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToPersonalSign.js b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToPersonalSign.js new file mode 100644 index 0000000000..265920c7a6 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToPersonalSign.js @@ -0,0 +1,52 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToPersonalSign + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToPersonalSign + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToPersonalSign + */ +export const testPkpEthersWithLitActionSessionSigsToPersonalSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs, + }); + await pkpEthersWallet.init(); + // -- personal_sign parameters + try { + // Message to sign + const message = 'Free the web'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + // personal_sign parameters + // DATA, N Bytes - message to sign. + // DATA, 20 Bytes - address + // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'personal_sign', + params: [hexMsg, alice.pkp.ethAddress], + }, + }); + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error(`❌ recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}`); + } + console.log('✅ personal_sign recoveredAddr:', recoveredAddr); + } + catch (e) { + throw new Error('❌ Error: ' + e.message); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithLitActionSessionSigsToPersonalSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSendTx.js b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSendTx.js new file mode 100644 index 0000000000..a06e9ad417 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSendTx.js @@ -0,0 +1,57 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSendTx + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSendTx + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSendTx + */ +export const testPkpEthersWithLitActionSessionSigsToSendTx = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs, + }); + await devEnv.getFunds(alice.pkp.ethAddress); + await pkpEthersWallet.init(); + // -- eth_sendTransaction parameters + try { + // Transaction to sign and send + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers.BigNumber.from('21000'); + const value = ethers.BigNumber.from('0'); + const data = '0x'; + // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const tx = { + from: from, + to: to, + gasLimit, + value, + data, + }; + const txRes = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_sendTransaction', + params: [tx], + }, + }); + console.log('✅ txRes:', txRes); + } + catch (e) { + if (e.message.includes('insufficient FPE funds')) { + console.log(`🧪 PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)`); + } + else { + throw new Error(`❌ Error: ${e.toString()}`); + } + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithLitActionSessionSigsToSendTx.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSignMessage.js b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSignMessage.js new file mode 100644 index 0000000000..534385b1da --- /dev/null +++ b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSignMessage.js @@ -0,0 +1,30 @@ +import { PKPEthersWallet } from '@lit-protocol/pkp-ethers'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSignMessage + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSignMessage + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSignMessage + */ +export const testPkpEthersWithLitActionSessionSigsToSignMessage = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: litActionSessionSigs, + }); + await pkpEthersWallet.init(); + // -- test signMessage + try { + const signature = await pkpEthersWallet.signMessage(alice.loveLetter); + console.log('✅ signature:', signature); + } + catch (e) { + throw new Error('❌ Error: ' + e.message); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithLitActionSessionSigsToSignMessage.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSign.js b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSign.js new file mode 100644 index 0000000000..0a6c31efd1 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSign.js @@ -0,0 +1,51 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSign + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSign + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSign + */ +export const testPkpEthersWithPkpSessionSigsToEthSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + console.log('devEnv.network:', devEnv.network); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs, + }); + await pkpEthersWallet.init(); + // -- test eth_sign + try { + // Message to sign + const message = 'Hello world'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + // DATA, 20 Bytes - address + // DATA, N Bytes - message to sign + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_sign', + params: [alice.pkp.ethAddress, hexMsg], + }, + }); + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error(`❌ test eth_sign recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}`); + } + console.log('✅ recoveredAddr:', recoveredAddr); + } + catch (e) { + throw new Error('❌ Error: ' + e.message); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithPkpSessionSigsToEthSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction.js b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction.js new file mode 100644 index 0000000000..c58fa7b789 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction.js @@ -0,0 +1,87 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTransaction + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTransaction + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTransaction + */ +export const testPkpEthersWithPkpSessionSigsToEthSignTransaction = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_sendTransaction parameters + try { + // Transaction to sign and send + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers.BigNumber.from('21000'); + const value = ethers.BigNumber.from('0'); + const data = '0x'; + // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const tx = { + from: from, + to: to, + gasLimit, + value, + data, + }; + // eth_sendTransaction parameters + // Transaction - Object + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction + // A serialized form of the whole transaction + const rawSignedTx = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTransaction', + params: [tx], + }, + }); + const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); + const signature = ethers.utils.joinSignature({ + r: parsedTransaction.r, + s: parsedTransaction.s, + v: parsedTransaction.v, + }); + const rawTx = { + nonce: parsedTransaction.nonce, + gasPrice: parsedTransaction.gasPrice, + gasLimit: parsedTransaction.gasLimit, + to: parsedTransaction.to, + value: parsedTransaction.value, + data: parsedTransaction.data, + chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 + }; + const txHash = ethers.utils.keccak256(ethers.utils.serializeTransaction(rawTx)); + const { v, r, s } = parsedTransaction; + const recoveredAddress = ethers.utils.recoverAddress(txHash, { r, s, v }); + // ==================== Post-Validation ==================== + if (!parsedTransaction) { + throw new Error('❌ parsedTransaction should not be null'); + } + if (signature.length !== 132) { + throw new Error(`❌ signature should be 132 characters long, got ${signature.length}`); + } + if (recoveredAddress.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddres should be ${alice.pkp.ethAddress}, got ${recoveredAddress}`); + } + } + catch (e) { + if (e.message.includes('insufficient FPE funds')) { + console.log(`🧪 PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)`); + } + else { + throw new Error(`❌ Error: ${e.toString()}`); + } + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithPkpSessionSigsToEthSignTransaction.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData.js b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData.js new file mode 100644 index 0000000000..8969c021ce --- /dev/null +++ b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData.js @@ -0,0 +1,82 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedData + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedData + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedData + */ +export const testPkpEthersWithPkpSessionSigsToEthSignTypedData = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData parameters + try { + // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData', + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], + }, + }); + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData(msgParams.domain, { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, msgParams.message, signature); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithPkpSessionSigsToEthSignTypedData.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil.js b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil.js new file mode 100644 index 0000000000..2d9e68edab --- /dev/null +++ b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil.js @@ -0,0 +1,76 @@ +import { PKPEthersWallet, signTypedData } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil + */ +export const testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData parameters + try { + // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + const signature = await signTypedData(pkpEthersWallet, msgParams); + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData(msgParams.domain, { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, msgParams.message, signature); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1.js b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1.js new file mode 100644 index 0000000000..fb7e56852f --- /dev/null +++ b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1.js @@ -0,0 +1,64 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { SignTypedDataVersion, recoverTypedSignature, } from '@metamask/eth-sig-util'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 + */ +export const testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData_v1 parameters + try { + const msgParams = [ + { + type: 'string', + name: 'Message', + value: 'Hi, Alice!', + }, + { + type: 'uint32', + name: 'A number', + value: '1337', + }, + ]; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v1', + params: [msgParams, alice.pkp.ethAddress], + }, + }); + const signatureBytes = ethers.utils.arrayify(signature); + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signatureBytes, + version: SignTypedDataVersion.V1, + }); + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + console.log('signature: ', signature); + console.log('recoveredAddr: ', recoveredAddr); + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3.js b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3.js new file mode 100644 index 0000000000..8043779915 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3.js @@ -0,0 +1,93 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { SignTypedDataVersion, recoverTypedSignature, } from '@metamask/eth-sig-util'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 + */ +export const testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData_v3 parameters + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v3', + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], + }, + }); + const recoveredAddr = recoverTypedSignature({ + data: { + // @ts-ignore + types: msgParams.types, + // @ts-ignore + domain: msgParams.domain, + // @ts-ignore + primaryType: msgParams.primaryType, + // @ts-ignore + message: msgParams.message, + }, + signature: signature, + version: SignTypedDataVersion.V3, + }); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4.js b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4.js new file mode 100644 index 0000000000..fd8b1f047a --- /dev/null +++ b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4.js @@ -0,0 +1,93 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { SignTypedDataVersion, recoverTypedSignature, } from '@metamask/eth-sig-util'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 + */ +export const testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs, + }); + await pkpEthersWallet.init(); + // -- eth_signTypedData_v3 parameters + try { + const msgParams = { + domain: { + chainId: 80001, + name: 'Ether Mail', + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + version: '1', + }, + message: { + contents: 'Hello, Bob!', + from: { + name: 'Cow', + wallets: [ + '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', + ], + }, + to: [ + { + name: 'Bob', + wallets: [ + '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', + '0xB0B0b0b0b0b0B000000000000000000000000000', + ], + }, + ], + }, + primaryType: 'Mail', + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person[]' }, + { name: 'contents', type: 'string' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallets', type: 'address[]' }, + ], + }, + }; + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v4', + params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], + }, + }); + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signature, + version: SignTypedDataVersion.V4, + }); + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { + throw new Error(`❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}`); + } + } + catch (e) { + throw new Error(`❌ ${e.toString()}`); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToPersonalSign.js b/local-tests/tests/testPkpEthersWithPkpSessionSigsToPersonalSign.js new file mode 100644 index 0000000000..734754935d --- /dev/null +++ b/local-tests/tests/testPkpEthersWithPkpSessionSigsToPersonalSign.js @@ -0,0 +1,52 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithPkpSessionSigsToPersonalSign + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithPkpSessionSigsToPersonalSign + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithPkpSessionSigsToPersonalSign + */ +export const testPkpEthersWithPkpSessionSigsToPersonalSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs, + }); + await pkpEthersWallet.init(); + // -- personal_sign parameters + try { + // Message to sign + const message = 'Free the web'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + // personal_sign parameters + // DATA, N Bytes - message to sign. + // DATA, 20 Bytes - address + // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'personal_sign', + params: [hexMsg, alice.pkp.ethAddress], + }, + }); + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + if (recoveredAddr !== alice.pkp.ethAddress) { + throw new Error(`❌ recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}`); + } + console.log('✅ personal_sign recoveredAddr:', recoveredAddr); + } + catch (e) { + throw new Error('❌ Error: ' + e.message); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithPkpSessionSigsToPersonalSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToSendTx.js b/local-tests/tests/testPkpEthersWithPkpSessionSigsToSendTx.js new file mode 100644 index 0000000000..6b93828d67 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithPkpSessionSigsToSendTx.js @@ -0,0 +1,57 @@ +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSendTx + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSendTx + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSendTx + */ +export const testPkpEthersWithPkpSessionSigsToSendTx = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs, + }); + await devEnv.getFunds(alice.pkp.ethAddress); + await pkpEthersWallet.init(); + // -- eth_sendTransaction parameters + try { + // Transaction to sign and send + const from = alice.pkp.ethAddress; + const to = alice.pkp.ethAddress; + const gasLimit = ethers.BigNumber.from('21000'); + const value = ethers.BigNumber.from('0'); + const data = '0x'; + // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const tx = { + from: from, + to: to, + gasLimit, + value, + data, + }; + const txRes = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_sendTransaction', + params: [tx], + }, + }); + console.log('✅ txRes:', txRes); + } + catch (e) { + if (e.message.includes('insufficient FPE funds')) { + console.log(`🧪 PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)`); + } + else { + throw new Error(`❌ Error: ${e.toString()}`); + } + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithPkpSessionSigsToSendTx.js.map \ No newline at end of file diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToSignMessage.js b/local-tests/tests/testPkpEthersWithPkpSessionSigsToSignMessage.js new file mode 100644 index 0000000000..57fcd9f830 --- /dev/null +++ b/local-tests/tests/testPkpEthersWithPkpSessionSigsToSignMessage.js @@ -0,0 +1,30 @@ +import { PKPEthersWallet } from '@lit-protocol/pkp-ethers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSignMessage + * ✅ NETWORK=datil-test yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSignMessage + * ✅ NETWORK=custom yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSignMessage + */ +export const testPkpEthersWithPkpSessionSigsToSignMessage = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient, + pkpPubKey: alice.pkp.publicKey, + controllerSessionSigs: pkpSessionSigs, + }); + await pkpEthersWallet.init(); + // -- test signMessage + try { + const signature = await pkpEthersWallet.signMessage(alice.loveLetter); + console.log('✅ signature:', signature); + } + catch (e) { + throw new Error('❌ Error: ' + e.message); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testPkpEthersWithPkpSessionSigsToSignMessage.js.map \ No newline at end of file diff --git a/local-tests/tests/testRelayer.js b/local-tests/tests/testRelayer.js new file mode 100644 index 0000000000..6b4d135f74 --- /dev/null +++ b/local-tests/tests/testRelayer.js @@ -0,0 +1,94 @@ +import { log } from '@lit-protocol/misc'; +import { EthWalletProvider, LitRelay } from '@lit-protocol/lit-auth-client'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testRelayer + * ✅ NETWORK=datil-test yarn test:local --filter=testRelayer + * ✅ NETWORK=custom yarn test:local --filter=testRelayer + * ✅ NETWORK=datil-dev yarn test:local --filter=testRelayer + */ +export const testRelayer = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + // -- test fetch pkps + const litRelay = new LitRelay({ + relayUrl: LitRelay.getRelayUrl(devEnv.network), + relayApiKey: 'test-api-key', + }); + const ethWalletProvider = new EthWalletProvider({ + relay: litRelay, + litNodeClient: devEnv.litNodeClient, + }); + const pkps = await ethWalletProvider.fetchPKPsThroughRelayer(alice.authMethod); + if (pkps.length <= 0) { + throw new Error('No PKPs found'); + } + else { + console.log('✅ 1. [testRelayer] /fetch-pkps-by-auth-method works'); + } + // -- test claims + const claimRequest = { + authMethod: alice.authMethod, + signer: alice.wallet, + }; + const claimRes = await devEnv.litNodeClient.claimKeyId(claimRequest); + // Expected output: + // { + // signatures: [ + // { + // r: "0xf73ec73f2dd7858d9b463598420169cf153f8cd409c82af606b3832ff82f8774", + // s: "0x0de6ab4437749fdf1e6239a8d13af516ac9a0744fc0725f9897a880151799fde", + // v: 28, + // }, { + // r: "0x65ec2ac206c4d18aaf12d6d1f17826543c1f329657214cea66c509fcdec8d633", + // s: "0x710e2efb2c61f9ae504721d7bea0b8d1d3c519167e48e4d67c77bf61dfeca735", + // v: 28, + // }, { + // r: "0xe51bd0670463cb5b5e9994870362b3eaa747cb5732e5c666ccf25495fe9aaa54", + // s: "0x1b49aed6d46833c9b9ee0fa13a4009c533309dafdfd51dd30165f2556b6cdcf1", + // v: 27, + // }, { + // r: "0x4278d3f7f2eb38801da5940858be54527e42ee11b25d7b239cb491139c00765d", + // s: "0x13dac60eaa90a548a4c99f1e09ac24e07cb1ef7447e55d3c82cf2ea6d69ec190", + // v: 27, + // }, { + // r: "0xb18158eccd4b099d0cfae4c2f987843cbaf039ce50164410fe4f529e6dc2bb6a", + // s: "0x284d9d5326deeb3d10e2c1d81ed1a7d6fca584c46ad9606a4dad9f12d81874ab", + // v: 27, + // }, { + // r: "0x28ad76574d39d646948642d05f599a982a1dd0776e2e36138315f5fb2c03666e", + // s: "0x2a125a028df39b9230f5d866383fcda0107cc7ee2f42fa1f323d41b34f67273a", + // v: 27, + // }, { + // r: "0xb7ab5120aeffeaee6e8d6ab1456d6823a15fae7e5a70b88d2556dc85450486cf", + // s: "0x6e1e9ac479066d95d62a6cd86f0cb3db92e07367acf43873fb5a7b8ad558a09d", + // v: 28, + // } + // ], + // claimedKeyId: "4825e3caf11a273792ad0405524820410cd15d6323ae4621537f0a89c1322a74", + // pubkey: "049528b98ac4829b5eaf8f8e6addaa9c12e94e83c4d17baf8f86554c111f2ac6d774f483fca03ad06b268059f7c8bcf64c7fb93689e153dc2fed79dada7b289195", + // mintTx: "0x0000000000000000000000000000000000000000000000000000000000000000", + // } + // assertions + if (!claimRes.claimedKeyId) { + throw new Error(`Expected "claimedKeyId" in claimRes`); + } + if (!claimRes.pubkey) { + throw new Error(`Expected "pubkey" in claimRes`); + } + if (!claimRes.mintTx) { + throw new Error(`Expected "mintTx" in claimRes`); + } + claimRes.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); + log('✅ 2. [testRelayer] Claim works'); +}; +//# sourceMappingURL=testRelayer.js.map \ No newline at end of file diff --git a/local-tests/tests/testSolAuthSigToEncryptDecryptString.js b/local-tests/tests/testSolAuthSigToEncryptDecryptString.js new file mode 100644 index 0000000000..79e5059dfb --- /dev/null +++ b/local-tests/tests/testSolAuthSigToEncryptDecryptString.js @@ -0,0 +1,43 @@ +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { encryptString, decryptToString } from '@lit-protocol/encryption'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testSolAuthSigToEncryptDecryptString + * ✅ NETWORK=datil-test yarn test:local --filter=testSolAuthSigToEncryptDecryptString + * ✅ NETWORK=custom yarn test:local --filter=testSolAuthSigToEncryptDecryptString + */ +export const testSolAuthSigToEncryptDecryptString = async (devEnv) => { + const accs = AccessControlConditions.getSolBasicAccessControlConditions({ + userAddress: devEnv.bareSolAuthSig.address, + }); + const encryptRes = await encryptString({ + solRpcConditions: accs, + dataToEncrypt: 'Hello world', + }, devEnv.litNodeClient); + console.log('encryptRes:', encryptRes); + // -- Expected output:´ + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + // -- Decrypt the encrypted string + const decryptRes = await decryptToString({ + solRpcConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + authSig: devEnv.bareSolAuthSig, + chain: 'solana', + }, devEnv.litNodeClient); + if (decryptRes !== 'Hello world') { + throw new Error(`Expected decryptRes to be 'Hello world' but got ${decryptRes}`); + } + console.log('✅ decryptRes:', decryptRes); +}; +//# sourceMappingURL=testSolAuthSigToEncryptDecryptString.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.js b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.js new file mode 100644 index 0000000000..b5da016172 --- /dev/null +++ b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.js @@ -0,0 +1,91 @@ +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * ## Scenario: + * Testing unrestricted access to execute js code using a capacity delegation authSig without specific delegatee restrictions + * - Given: A capacity delegation authSig is created by the dApp owner + * - When: The authSig does not specifically restrict delegatees + * - And: Any user attempts to execute js code using the capacity from the capacity credits NFT + * - Then: The user should be able to sign with his/her PKP using the capacity without restrictions due to the absence of delegatee limits + * + * + * ## Test Commands: + * - ✅ NETWORK=datil-test yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs + * - ✅ NETWORK=custom yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs + */ +export const testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = (await devEnv.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: alice.wallet, + })).capacityDelegationAuthSig; + // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations(devEnv, bob.wallet, appOwnersCapacityDelegationAuthSig); + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + // 4. Bob can now execute JS code using the capacity credits NFT + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey, + }, + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + // Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", + // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", + // recid: 1, + // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", + // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + // -- signatures.sig.signature must start with 0x + if (!res.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // -- signatures.sig.recid must be parseable as a number + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + console.log('✅ testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'); +}; +//# sourceMappingURL=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.js b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.js new file mode 100644 index 0000000000..40100bc566 --- /dev/null +++ b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.js @@ -0,0 +1,73 @@ +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * ## Scenario: + * Testing unrestricted access to pkp sign using a capacity delegation authSig without specific delegatee restrictions + * - Given: A capacity delegation authSig is created by the dApp owner + * - When: The authSig does not specifically restrict delegatees + * - And: Any user attempts to pkp sign using the capacity from the capacity credits NFT + * - Then: The user should be able to sign with his/her PKP using the capacity without restrictions due to the absence of delegatee limits + * + * + * ## Test Commands: + * - ✅ NETWORK=datil-test yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign + * - ✅ NETWORK=custom yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign + */ +export const testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = (await devEnv.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: alice.wallet, + })).capacityDelegationAuthSig; + // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations(devEnv, bob.wallet, appOwnersCapacityDelegationAuthSig); + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + // 4. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.pkpSign({ + sessionSigs: bobsSessionSigs, + toSign: alice.loveLetter, + pubKey: bob.pkp.publicKey, + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + // -- Expected output: + // { + // r: "25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb636", + // s: "1e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c", + // recid: 0, + // signature: "0x25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb6361e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c1b", + // publicKey: "041FF0DC7B69D2B3C3E452AF9E0D30C7FDA6729A1B394059BDC8C4530D7F584FFCAEEEC19B1F22EFB054A22E5EF13AA0B5804994469570929066F5474D490B8A1F", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + // -- assertions + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + // -- signature must start with 0x + if (!res.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // -- recid must be parseable as a number + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + console.log('✅ res:', res); +}; +//# sourceMappingURL=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.js b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.js new file mode 100644 index 0000000000..d564597814 --- /dev/null +++ b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.js @@ -0,0 +1,89 @@ +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * ## Scenario: + * Testing unrestricted access to execute JS code using a capacity delegation authSig without specific delegatee restrictions + * - Given: A capacity delegation authSig is created by the dApp owner + * - When: The authSig does not specifically restrict delegatees + * - And: Any user attempts to execute JS code using the capacity from the capacity credits NFT + * - Then: The user should be able to execute the JS code using the capacity without restrictions due to the absence of delegatee limits + * + * + * ## Test Commands: + * - ✅ NETWORK=datil-test yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs + * - ✅ NETWORK=custom yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs + */ +export const testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + // No delegatee addresses provided. It means that the capability will not restrict access based on delegatee list, but it may still enforce other restrictions such as usage limits and specific NFT IDs. + const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig(); + // 4. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations(devEnv, bob.wallet, appOwnersCapacityDelegationAuthSig); + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey, + }, + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + // Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", + // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", + // recid: 1, + // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", + // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + // -- signatures.sig.signature must start with 0x + if (!res.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // -- signatures.sig.recid must be parseable as a number + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + console.log('✅ testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'); +}; +//# sourceMappingURL=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.js b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.js new file mode 100644 index 0000000000..7ffc5b44ae --- /dev/null +++ b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.js @@ -0,0 +1,71 @@ +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * ## Scenario: + * Testing unrestricted access to pkp sign code using a capacity delegation authSig without specific delegatee restrictions + * - Given: A capacity delegation authSig is created by the dApp owner + * - When: The authSig does not specifically restrict delegatees + * - And: Any user attempts to pkp sign code using the capacity from the capacity credits NFT + * - Then: The user should be able to execute the JS code using the capacity without restrictions due to the absence of delegatee limits + * + * + * ## Test Commands: + * - ✅ NETWORK=datil-test yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign + * - ✅ NETWORK=custom yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign + */ +export const testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig(); + // 4. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations(devEnv, bob.wallet, appOwnersCapacityDelegationAuthSig); + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + const regex = /urn:recap:[\w+\/=]+/g; + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + // 5. Bob can now pkp sign using the capacity credits NFT + const runWithSessionSigs = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: bob.pkp.publicKey, + sessionSigs: bobsSessionSigs, + }); + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + // -- Expected output: + // { + // r: "36bd0039b4e4d1dae488a63437318790df86b8023ac4ffa842c8983245b7f629", + // s: "29135af930c40ee0901a9ea3ca5621d06a6b932aee2f2256cf2a99a65cb36d05", + // recid: 1, + // signature: "0x36bd0039b4e4d1dae488a63437318790df86b8023ac4ffa842c8983245b7f62929135af930c40ee0901a9ea3ca5621d06a6b932aee2f2256cf2a99a65cb36d051c", + // publicKey: "04837486BD4DCF221D463D976E6A392E12BC2DFEFB124E189AB0A8EA406DFB1C73F4DCD268CC2B8F854C202256BD08E22D688121061EA9CFB1317142DBD2EAB4C4", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + // -- assertions + // r, s, dataSigned, and public key should be present + if (!runWithSessionSigs.r) { + throw new Error(`Expected "r" in runWithSessionSigs`); + } + if (!runWithSessionSigs.s) { + throw new Error(`Expected "s" in runWithSessionSigs`); + } + if (!runWithSessionSigs.dataSigned) { + throw new Error(`Expected "dataSigned" in runWithSessionSigs`); + } + if (!runWithSessionSigs.publicKey) { + throw new Error(`Expected "publicKey" in runWithSessionSigs`); + } + // signature must start with 0x + if (!runWithSessionSigs.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // recid must be parseable as a number + if (isNaN(runWithSessionSigs.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } +}; +//# sourceMappingURL=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs.js b/local-tests/tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs.js new file mode 100644 index 0000000000..84a25dde4d --- /dev/null +++ b/local-tests/tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs.js @@ -0,0 +1,121 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { AUTH_METHOD_SCOPE, CENTRALISATION_BY_NETWORK, LIT_ABILITY, } from '@lit-protocol/constants'; +import { stringToIpfsHash } from 'local-tests/setup/tinny-utils'; +/** + * Test Commands: + * NETWORK=datil-dev yarn test:local --filter=testUseCustomAuthSessionSigsToPkpSignExecuteJs + * NETWORK=custom yarn test:local --filter=testUseCustomAuthSessionSigsToPkpSignExecuteJs + */ +export const testUseCustomAuthSessionSigsToPkpSignExecuteJs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + /** + * This is a custom auth method. It can be anything you want. Even the shape of the object can be anything, + * because you will be handling the logic in the Lit action code yourself. + */ + const customAuthMethod = { + authMethodType: 89989, + authMethodId: 'app-id-xxx:user-id-yyy', + accessToken: 'xxx', + }; + /** + * Alice assigns the custom auth method to her PKP. + */ + const addPermittedAuthMethodReceipt = await alice.contractsClient.addPermittedAuthMethod({ + pkpTokenId: alice.pkp.tokenId, + authMethodType: customAuthMethod.authMethodType, + authMethodId: customAuthMethod.authMethodId, + authMethodScopes: [AUTH_METHOD_SCOPE.SignAnything], + }); + console.log('✅ addPermittedAuthMethodReceipt:', addPermittedAuthMethodReceipt); + /** + * Please note that the code below is first converted to a CID and stored in the smart contract. + * Therefore, the Lit action code executed in the `getPkpSessionSigs` function must match the CID stored in the smart contract. + * + * You can use https://explorer.litprotocol.com/create-action to create a Lit action and get the CID. + */ + const litActionCodeString = `(async () => { + const a = 1; + const b = 2; + + if (a + b === 3 && customAuthMethod.authMethodType === 89989) { + LitActions.setResponse({response:"true"}); + } else { + LitActions.setResponse({response:"false"}); + } + + console.log("Lit.Auth:", Lit.Auth); + })()`; + const IPFSID = await stringToIpfsHash(litActionCodeString); + console.log('✅ IPFSID:', IPFSID.toString()); + // Grant an action permission to use a PKP + const addPermittedActionReceipt = await alice.contractsClient.addPermittedAction({ + ipfsId: IPFSID, + pkpTokenId: alice.pkp.tokenId, + authMethodScopes: [AUTH_METHOD_SCOPE.SignAnything], + }); + console.log('✅ addPermittedActionReceipt:', addPermittedActionReceipt); + const centralisation = CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; + const litActionSessionSigs = await devEnv.litNodeClient.getLitActionSessionSigs({ + pkpPublicKey: alice.pkp.publicKey, + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ], + // litActionIpfsId: IPFSID, + litActionCode: Buffer.from(litActionCodeString).toString('base64'), + jsParams: { + publicKey: `0x${alice.pkp.publicKey}`, + customAuthMethod: customAuthMethod, + sigName: 'custom-auth-sig', + }, + ...(centralisation === 'decentralised' && { + capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig], + }), + }); + // -- pkp sign test + try { + const res = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.pkp.publicKey, + sessionSigs: litActionSessionSigs, + }); + console.log('✅ pkpSign res:', res); + } + catch (e) { + throw new Error(e); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } + // -- execute js + try { + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp.publicKey, + }, + }); + console.log('✅ executeJs res:', res); + } + catch (e) { + throw new Error(e); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testUseCustomAuthSessionSigsToPkpSignExecuteJs.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.js b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.js new file mode 100644 index 0000000000..dc7d4cd828 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.js @@ -0,0 +1,66 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { log } from '@lit-protocol/misc'; +import { encryptString, decryptToFile } from '@lit-protocol/encryption'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptFile + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptFile + * ✅ NETWORK=custom yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptFile + */ +export const testUseEoaSessionSigsToEncryptDecryptFile = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const message = 'Hello world'; + const blob = new Blob([message], { type: 'text/plain' }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address, + }); + const encryptRes = await encryptString({ + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, devEnv.litNodeClient); + log('encryptRes:', encryptRes); + // await 5 seconds for the encryption to be mined + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString(accs, encryptRes.dataToEncryptHash); + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption, + }, + ]); + // -- Decrypt the encrypted string + const decriptedFile = await decryptToFile({ + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: 'ethereum', + }, devEnv.litNodeClient); + devEnv.releasePrivateKeyFromUser(alice); + if (blobArray.length !== decriptedFile.length) { + throw new Error(`decrypted file should match the original file but received ${decriptedFile}`); + } + for (let i = 0; i < blobArray.length; i++) { + if (blobArray[i] !== decriptedFile[i]) { + throw new Error(`decrypted file should match the original file`); + } + } + console.log('decriptedFile:', decriptedFile); +}; +//# sourceMappingURL=testUseEoaSessionSigsToEncryptDecryptFile.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.js b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.js new file mode 100644 index 0000000000..e7d7a76d04 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.js @@ -0,0 +1,57 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { log } from '@lit-protocol/misc'; +import { encryptString, decryptToString } from '@lit-protocol/encryption'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptString + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptString + * ✅ NETWORK=custom yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptString + */ +export const testUseEoaSessionSigsToEncryptDecryptString = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address, + }); + const encryptRes = await encryptString({ + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, devEnv.litNodeClient); + log('encryptRes:', encryptRes); + // await 5 seconds for the encryption to be mined + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString(accs, encryptRes.dataToEncryptHash); + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption, + }, + ]); + // -- Decrypt the encrypted string + const decryptRes = await decryptToString({ + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: 'ethereum', + }, devEnv.litNodeClient); + devEnv.releasePrivateKeyFromUser(alice); + if (decryptRes !== 'Hello world') { + throw new Error(`Expected decryptRes to be 'Hello world' but got ${decryptRes}`); + } +}; +//# sourceMappingURL=testUseEoaSessionSigsToEncryptDecryptString.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptUint8Array.js b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptUint8Array.js new file mode 100644 index 0000000000..11e1b14d63 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptUint8Array.js @@ -0,0 +1,61 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { encryptUint8Array, decryptToUint8Array, } from '@lit-protocol/encryption'; +import { uint8arrayFromString, uint8arrayToString, } from '@lit-protocol/uint8arrays'; +import { log } from '@lit-protocol/misc'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptUint8Array + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptUint8Array + * ✅ NETWORK=custom yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptUint8Array + */ +export const testUseEoaSessionSigsToEncryptDecryptUint8Array = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address, + }); + const message = 'Hello world'; + const messageToEncrypt = uint8arrayFromString(message, 'utf8'); + const encryptRes = await encryptUint8Array({ + accessControlConditions: accs, + dataToEncrypt: messageToEncrypt, + }, devEnv.litNodeClient); + log('encryptRes:', encryptRes); + // await 5 seconds for the encryption to be mined + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString(accs, encryptRes.dataToEncryptHash); + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption, + }, + ]); + // -- Decrypt the encrypted string + const decryptRes = await decryptToUint8Array({ + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: 'ethereum', + }, devEnv.litNodeClient); + const decryptResString = uint8arrayToString(decryptRes, 'utf8'); + devEnv.releasePrivateKeyFromUser(alice); + if (decryptResString !== message) { + throw new Error(`Expected decryptRes to be 'Hello world' but got ${decryptRes}`); + } +}; +//# sourceMappingURL=testUseEoaSessionSigsToEncryptDecryptUint8Array.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.js b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.js new file mode 100644 index 0000000000..b3829f4864 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.js @@ -0,0 +1,160 @@ +// import { LitContracts } from '@lit-protocol/contracts-sdk'; +// import { log } from '@lit-protocol/misc'; +// import { +// ClaimRequest, +// ClaimResult, +// ClientClaimProcessor, +// } from '@lit-protocol/types'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { log } from '@lit-protocol/misc'; +/** + * ## Scenario: + * Testing the capability to claim keys using EOA (Externally Owned Account) session sigs. This test ensures that keys can be claimed correctly. + * + * - Given: EOA sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * + * - Note: The key claiming process involves multiple nodes within the Lit network verifying the sessionSigs and collaboratively signing the claim, which results in the generation of a new key pair if successful. + * + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimKeys + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimKeys + * ✅ NETWORK=custom yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimKeys + */ +export const testUseEoaSessionSigsToExecuteJsClaimKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log('res:', res); + // Expected output: + // { + // claims: { + // foo: { + // signatures: [ + // { + // r: "0x31e5dcf6eed3619aa6ff68d0c8f7a4bcf082acc2f12c3d5bcae9b8bbaf883c07", + // s: "0x405f671d1c659022105775b18afe805e01eaa1d0799c6b92887baef77dc023f5", + // v: 27, + // }, { + // r: "0xf2e9fe653d9155bd93feb7fe122c07a81769076fe44567c3ea93bb828f87146e", + // s: "0x01adf2b2780511f70b0b037360ff4b0c2b8d04657a689af780180bed9e6ea3c5", + // v: 27, + // }, { + // r: "0xfe1dcacd79f53b42b24dae75521f01315f34bbc492233e26083995c82218a3ff", + // s: "0x0b708b11704d986b50bce9f648bb5d40e8b9ad87f3a337a213999c7751dc1c0c", + // v: 27, + // } + // ], + // derivedKeyId: "22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); + // const claimRequest: ClaimRequest = { + // authMethod: devEnv.bobsWalletAuthMethod, + // signer: devEnv.hotWallet, + // mintCallback: async (claimRes: ClaimResult) => { + // console.log('claimRes:', claimRes); + // const litContracts = await devEnv.getContractsClient(claimRes.signer); + // const pkpInfo = await litContracts.pkpNftContractUtils.write.claimAndMint( + // `0x${claimRes.derivedKeyId}`, + // claimRes.signatures + // ); + // return pkpInfo.tokenId; + // }, + // }; + // const claimRes = await devEnv.litNodeClient.claimKeyId(claimRequest); + // console.log('claimRes:', claimRes); + // Expected output: + // { + // signatures: [ + // { + // r: "0xf73ec73f2dd7858d9b463598420169cf153f8cd409c82af606b3832ff82f8774", + // s: "0x0de6ab4437749fdf1e6239a8d13af516ac9a0744fc0725f9897a880151799fde", + // v: 28, + // }, { + // r: "0x65ec2ac206c4d18aaf12d6d1f17826543c1f329657214cea66c509fcdec8d633", + // s: "0x710e2efb2c61f9ae504721d7bea0b8d1d3c519167e48e4d67c77bf61dfeca735", + // v: 28, + // }, { + // r: "0xe51bd0670463cb5b5e9994870362b3eaa747cb5732e5c666ccf25495fe9aaa54", + // s: "0x1b49aed6d46833c9b9ee0fa13a4009c533309dafdfd51dd30165f2556b6cdcf1", + // v: 27, + // }, { + // r: "0x4278d3f7f2eb38801da5940858be54527e42ee11b25d7b239cb491139c00765d", + // s: "0x13dac60eaa90a548a4c99f1e09ac24e07cb1ef7447e55d3c82cf2ea6d69ec190", + // v: 27, + // }, { + // r: "0xb18158eccd4b099d0cfae4c2f987843cbaf039ce50164410fe4f529e6dc2bb6a", + // s: "0x284d9d5326deeb3d10e2c1d81ed1a7d6fca584c46ad9606a4dad9f12d81874ab", + // v: 27, + // }, { + // r: "0x28ad76574d39d646948642d05f599a982a1dd0776e2e36138315f5fb2c03666e", + // s: "0x2a125a028df39b9230f5d866383fcda0107cc7ee2f42fa1f323d41b34f67273a", + // v: 27, + // }, { + // r: "0xb7ab5120aeffeaee6e8d6ab1456d6823a15fae7e5a70b88d2556dc85450486cf", + // s: "0x6e1e9ac479066d95d62a6cd86f0cb3db92e07367acf43873fb5a7b8ad558a09d", + // v: 28, + // } + // ], + // claimedKeyId: "4825e3caf11a273792ad0405524820410cd15d6323ae4621537f0a89c1322a74", + // pubkey: "049528b98ac4829b5eaf8f8e6addaa9c12e94e83c4d17baf8f86554c111f2ac6d774f483fca03ad06b268059f7c8bcf64c7fb93689e153dc2fed79dada7b289195", + // mintTx: "0x0000000000000000000000000000000000000000000000000000000000000000", + // } + // assertions + // if (!claimRes.claimedKeyId) { + // throw new Error(`Expected "claimedKeyId" in claimRes`); + // } + // if (!claimRes.pubkey) { + // throw new Error(`Expected "pubkey" in claimRes`); + // } + // if (!claimRes.mintTx) { + // throw new Error(`Expected "mintTx" in claimRes`); + // } + // claimRes.signatures.forEach((sig: any) => { + // if (!sig.r) { + // throw new Error(`Expected "r" in sig`); + // } + // if (!sig.s) { + // throw new Error(`Expected "s" in sig`); + // } + // if (!sig.v) { + // throw new Error(`Expected "v" in sig`); + // } + // }); + log('✅ testUseEoaSessionSigsToExecuteJsClaimKeys'); +}; +//# sourceMappingURL=testUseEoaSessionSigsToExecuteJsClaimKeys.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.js b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.js new file mode 100644 index 0000000000..9e07360a26 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.js @@ -0,0 +1,94 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * ## Scenario: + * Testing the capability to claim keys using EOA (Externally Owned Account) session sigs. This test ensures that multiple keys can be claimed correctly. + * + * - Given: EOA sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * * + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimMultipleKeys + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimMultipleKeys + * ✅ NETWORK=custom yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimMultipleKeys + */ +export const testUseEoaSessionSigsToExecuteJsClaimMultipleKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; +//# sourceMappingURL=testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.js b/local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.js new file mode 100644 index 0000000000..0a95f0658e --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.js @@ -0,0 +1,42 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToExecuteJsConsoleLog + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToExecuteJsConsoleLog + * ✅ NETWORK=custom yarn test:local --filter=testUseEoaSessionSigsToExecuteJsConsoleLog + */ +export const testUseEoaSessionSigsToExecuteJsConsoleLog = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + console.log('hello world') + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log('res:', res); + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "", + // logs: "hello world\n", + // } + // -- assertions + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } +}; +//# sourceMappingURL=testUseEoaSessionSigsToExecuteJsConsoleLog.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.js b/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.js new file mode 100644 index 0000000000..35afa30d3a --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.js @@ -0,0 +1,55 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToExecuteJsJsonResponse + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToExecuteJsJsonResponse + * ✅ NETWORK=custom yarn test:local --filter=testUseEoaSessionSigsToExecuteJsJsonResponse + */ +export const testUseEoaSessionSigsToExecuteJsJsonResponse = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "{\"hello\":\"world\"}", + // logs: "hello world\n", + // } + // -- assertions + if (!res.response) { + throw new Error(`Expected "response" in res`); + } + if (!res.response.startsWith('{')) { + throw new Error(`Expected "response" to start with {`); + } + if (!res.response.endsWith('}')) { + throw new Error(`Expected "response" to end with }`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + if (res.success !== true) { + throw new Error(`Expected "success" to be true`); + } +}; +//# sourceMappingURL=testUseEoaSessionSigsToExecuteJsJsonResponse.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.js b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.js new file mode 100644 index 0000000000..45ef351244 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.js @@ -0,0 +1,55 @@ +import { log } from '@lit-protocol/misc'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning + * ✅ NETWORK=custom yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning + */ +export const testUseEoaSessionSigsToExecuteJsSigning = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp.publicKey, + }, + }); + devEnv.releasePrivateKeyFromUser(alice); + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "63311a761842b41686875862a3fb09975c838afff6ae11c5c3940da458dffe79", + // s: "1c25f352b4a8bf15510cecbee4e798270cdf68c45a26cf93dc32d6e03dfc720a", + // recid: 0, + // signature: "0x63311a761842b41686875862a3fb09975c838afff6ae11c5c3940da458dffe791c25f352b4a8bf15510cecbee4e798270cdf68c45a26cf93dc32d6e03dfc720a1b", + // publicKey: "0423F38A7663289FC58841B5F8E068FA43106BC7DDEE38D1F2542C03ABEC45B6733BE2D85A703C7B238865E45DF2175DD2A1736C56F2BAD0A965837F64BB21FB03", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // } + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + log('✅ testUseEoaSessionSigsToExecuteJsSigning'); +}; +//# sourceMappingURL=testUseEoaSessionSigsToExecuteJsSigning.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.js b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.js new file mode 100644 index 0000000000..14321552a4 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.js @@ -0,0 +1,106 @@ +import { log } from '@lit-protocol/misc'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigningInParallel + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigningInParallel + * ✅ NETWORK=custom yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigningInParallel + */ +export const testUseEoaSessionSigsToExecuteJsSigningInParallel = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const fn = async (index) => { + log(`Index: ${index}`); + return await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp.publicKey, + }, + }); + }; + const res = await Promise.all([fn(1), fn(2), fn(3)]); + devEnv.releasePrivateKeyFromUser(alice); + log('res:', res); + // -- Expected output: + // [ + // { + // claims: {}, + // signatures: { + // sig: { + // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", + // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", + // recid: 0, + // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", + // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", + // recid: 1, + // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", + // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", + // recid: 0, + // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // ] + // -- assertions + res.forEach((r) => { + if (!r.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!r.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!r.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!r.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + // -- signatures.sig.signature must start with 0x + if (!r.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // -- signatures.sig.recid must be parseable as a number + if (isNaN(r.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); + log('✅ testUseEoaSessionSigsToExecuteJsSigningInParallel'); +}; +//# sourceMappingURL=testUseEoaSessionSigsToExecuteJsSigningInParallel.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToPkpSign.js b/local-tests/tests/testUseEoaSessionSigsToPkpSign.js new file mode 100644 index 0000000000..9628f4fa38 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToPkpSign.js @@ -0,0 +1,51 @@ +import { log } from '@lit-protocol/misc'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToPkpSign + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToPkpSign + * ✅ NETWORK=custom yarn test:local --filter=testUseEoaSessionSigsToPkpSign + */ +export const testUseEoaSessionSigsToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const runWithSessionSigs = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.pkp.publicKey, + sessionSigs: eoaSessionSigs, + }); + devEnv.releasePrivateKeyFromUser(alice); + // Expected output: + // { + // r: "25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9", + // s: "549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b101833214", + // recid: 1, + // signature: "0x25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b1018332141c", + // publicKey: "04A3CD53CCF63597D3FFCD1DF1E8236F642C7DF8196F532C8104625635DC55A1EE59ABD2959077432FF635DF2CED36CC153050902B71291C4D4867E7DAAF964049", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + // -- assertions + // r, s, dataSigned, and public key should be present + if (!runWithSessionSigs.r) { + throw new Error(`Expected "r" in runWithSessionSigs`); + } + if (!runWithSessionSigs.s) { + throw new Error(`Expected "s" in runWithSessionSigs`); + } + if (!runWithSessionSigs.dataSigned) { + throw new Error(`Expected "dataSigned" in runWithSessionSigs`); + } + if (!runWithSessionSigs.publicKey) { + throw new Error(`Expected "publicKey" in runWithSessionSigs`); + } + // signature must start with 0x + if (!runWithSessionSigs.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // recid must be parseable as a number + if (isNaN(runWithSessionSigs.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + log('✅ testUseEoaSessionSigsToPkpSign'); +}; +//# sourceMappingURL=testUseEoaSessionSigsToPkpSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseEoaSessionSigsToRequestSingleResponse.js b/local-tests/tests/testUseEoaSessionSigsToRequestSingleResponse.js new file mode 100644 index 0000000000..59d5d43b28 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToRequestSingleResponse.js @@ -0,0 +1,47 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToRequestSingleResponse + * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToRequestSingleResponse + * ✅ NETWORK=datil yarn test:local --filter=testUseEoaSessionSigsToRequestSingleResponse + */ +export const testUseEoaSessionSigsToRequestSingleResponse = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + console.log('hello world') + })();`, + useSingleNode: true, + }); + console.log('res:', res); + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "", + // logs: "hello world\n", + // } + // -- assertions + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testUseEoaSessionSigsToRequestSingleResponse.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.js b/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.js new file mode 100644 index 0000000000..d39fcab756 --- /dev/null +++ b/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.js @@ -0,0 +1,26 @@ +import { getInvalidLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseInvalidLitActionCodeToGenerateSessionSigs + * ✅ NETWORK=custom yarn test:local --filter=testUseInvalidLitActionCodeToGenerateSessionSigs + */ +export const testUseInvalidLitActionCodeToGenerateSessionSigs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + await getInvalidLitActionSessionSigs(devEnv, alice); + } + catch (e) { + console.log('❌ This error is expected', e); + if (e.message === + 'There was an error getting the signing shares from the nodes') { + console.log('✅ testUseInvalidLitActionCodeToGenerateSessionSigs passed'); + } + else { + throw e; + } + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testUseInvalidLitActionCodeToGenerateSessionSigs.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs.js b/local-tests/tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs.js new file mode 100644 index 0000000000..910f88ed63 --- /dev/null +++ b/local-tests/tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs.js @@ -0,0 +1,25 @@ +import { getInvalidLitActionIpfsSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseInvalidLitActionIpfsCodeToGenerateSessionSigs + * ✅ NETWORK=custom yarn test:local --filter=testUseInvalidLitActionIpfsCodeToGenerateSessionSigs + */ +export const testUseInvalidLitActionIpfsCodeToGenerateSessionSigs = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + await getInvalidLitActionIpfsSessionSigs(devEnv, alice); + } + catch (e) { + console.log('❌ THIS IS EXPECTED: ', e); + if (e.message === 'An error related to validation has occured.') { + console.log('✅ testUseInvalidLitActionIpfsCodeToGenerateSessionSigs is expected to have an error'); + } + else { + throw e; + } + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testUseInvalidLitActionIpfsCodeToGenerateSessionSigs.js.map \ No newline at end of file diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.js b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.js new file mode 100644 index 0000000000..f192befead --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.js @@ -0,0 +1,66 @@ +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { log } from '@lit-protocol/misc'; +import { encryptString, decryptToFile } from '@lit-protocol/encryption'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptFile + * ✅ NETWORK=datil-test yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptFile + * ✅ NETWORK=custom yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptFile + */ +export const testUsePkpSessionSigsToEncryptDecryptFile = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const message = 'Hello world'; + const blob = new Blob([message], { type: 'text/plain' }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + const encryptRes = await encryptString({ + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, devEnv.litNodeClient); + log('encryptRes:', encryptRes); + // await 5 seconds for the encryption to be mined + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString(accs, encryptRes.dataToEncryptHash); + const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption, + }, + ]); + // -- Decrypt the encrypted string + const decriptedFile = await decryptToFile({ + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: pkpSessionSigs2, + chain: 'ethereum', + }, devEnv.litNodeClient); + devEnv.releasePrivateKeyFromUser(alice); + if (blobArray.length !== decriptedFile.length) { + throw new Error(`decrypted file should match the original file but received ${decriptedFile}`); + } + for (let i = 0; i < blobArray.length; i++) { + if (blobArray[i] !== decriptedFile[i]) { + throw new Error(`decrypted file should match the original file`); + } + } + console.log('decriptedFile:', decriptedFile); +}; +//# sourceMappingURL=testUsePkpSessionSigsToEncryptDecryptFile.js.map \ No newline at end of file diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.js b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.js new file mode 100644 index 0000000000..673413ea46 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.js @@ -0,0 +1,56 @@ +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { log } from '@lit-protocol/misc'; +import { encryptString, decryptToString } from '@lit-protocol/encryption'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptString + * ✅ NETWORK=datil-test yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptString + * ✅ NETWORK=custom yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptString + */ +export const testUsePkpSessionSigsToEncryptDecryptString = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + const encryptRes = await encryptString({ + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, devEnv.litNodeClient); + log('encryptRes:', encryptRes); + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString(accs, encryptRes.dataToEncryptHash); + const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption, + }, + ]); + // -- Decrypt the encrypted string + const decryptRes = await decryptToString({ + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: pkpSessionSigs2, + chain: 'ethereum', + }, devEnv.litNodeClient); + devEnv.releasePrivateKeyFromUser(alice); + if (decryptRes !== 'Hello world') { + throw new Error(`Expected decryptRes to be 'Hello world' but got ${decryptRes}`); + } +}; +//# sourceMappingURL=testUsePkpSessionSigsToEncryptDecryptString.js.map \ No newline at end of file diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.js b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.js new file mode 100644 index 0000000000..be0f6a02ca --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.js @@ -0,0 +1,151 @@ +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * ## Scenario: + * Testing the capability to claim keys using PKP session sigs. This test ensures that keys can be claimed correctly. + * + * - Given: PKP sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * + * - Note: The key claiming process involves multiple nodes within the Lit network verifying the sessionSigs and collaboratively signing the claim, which results in the generation of a new key pair if successful. + * + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimKeys + * ✅ NETWORK=datil-test yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimKeys + * ✅ NETWORK=custom yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimKeys + */ +export const testUsePkpSessionSigsToExecuteJsClaimKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log('res:', res); + // Expected output: + // { + // claims: { + // foo: { + // signatures: [ + // { + // r: "0x31e5dcf6eed3619aa6ff68d0c8f7a4bcf082acc2f12c3d5bcae9b8bbaf883c07", + // s: "0x405f671d1c659022105775b18afe805e01eaa1d0799c6b92887baef77dc023f5", + // v: 27, + // }, { + // r: "0xf2e9fe653d9155bd93feb7fe122c07a81769076fe44567c3ea93bb828f87146e", + // s: "0x01adf2b2780511f70b0b037360ff4b0c2b8d04657a689af780180bed9e6ea3c5", + // v: 27, + // }, { + // r: "0xfe1dcacd79f53b42b24dae75521f01315f34bbc492233e26083995c82218a3ff", + // s: "0x0b708b11704d986b50bce9f648bb5d40e8b9ad87f3a337a213999c7751dc1c0c", + // v: 27, + // } + // ], + // derivedKeyId: "22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); + // const claimRequest: ClaimRequest = { + // authMethod: devEnv.bobsWalletAuthMethod, + // signer: devEnv.hotWallet, + // mintCallback: async (claimRes: ClaimResult) => { + // console.log('claimRes:', claimRes); + // const litContracts = await devEnv.getContractsClient(claimRes.signer); + // const pkpInfo = await litContracts.pkpNftContractUtils.write.claimAndMint( + // `0x${claimRes.derivedKeyId}`, + // claimRes.signatures + // ); + // return pkpInfo.tokenId; + // }, + // }; + // const claimRes = await devEnv.litNodeClient.claimKeyId(claimRequest); + // console.log('claimRes:', claimRes); + // Expected output: + // { + // signatures: [ + // { + // r: "0xf73ec73f2dd7858d9b463598420169cf153f8cd409c82af606b3832ff82f8774", + // s: "0x0de6ab4437749fdf1e6239a8d13af516ac9a0744fc0725f9897a880151799fde", + // v: 28, + // }, { + // r: "0x65ec2ac206c4d18aaf12d6d1f17826543c1f329657214cea66c509fcdec8d633", + // s: "0x710e2efb2c61f9ae504721d7bea0b8d1d3c519167e48e4d67c77bf61dfeca735", + // v: 28, + // }, { + // r: "0xe51bd0670463cb5b5e9994870362b3eaa747cb5732e5c666ccf25495fe9aaa54", + // s: "0x1b49aed6d46833c9b9ee0fa13a4009c533309dafdfd51dd30165f2556b6cdcf1", + // v: 27, + // }, { + // r: "0x4278d3f7f2eb38801da5940858be54527e42ee11b25d7b239cb491139c00765d", + // s: "0x13dac60eaa90a548a4c99f1e09ac24e07cb1ef7447e55d3c82cf2ea6d69ec190", + // v: 27, + // }, { + // r: "0xb18158eccd4b099d0cfae4c2f987843cbaf039ce50164410fe4f529e6dc2bb6a", + // s: "0x284d9d5326deeb3d10e2c1d81ed1a7d6fca584c46ad9606a4dad9f12d81874ab", + // v: 27, + // }, { + // r: "0x28ad76574d39d646948642d05f599a982a1dd0776e2e36138315f5fb2c03666e", + // s: "0x2a125a028df39b9230f5d866383fcda0107cc7ee2f42fa1f323d41b34f67273a", + // v: 27, + // }, { + // r: "0xb7ab5120aeffeaee6e8d6ab1456d6823a15fae7e5a70b88d2556dc85450486cf", + // s: "0x6e1e9ac479066d95d62a6cd86f0cb3db92e07367acf43873fb5a7b8ad558a09d", + // v: 28, + // } + // ], + // claimedKeyId: "4825e3caf11a273792ad0405524820410cd15d6323ae4621537f0a89c1322a74", + // pubkey: "049528b98ac4829b5eaf8f8e6addaa9c12e94e83c4d17baf8f86554c111f2ac6d774f483fca03ad06b268059f7c8bcf64c7fb93689e153dc2fed79dada7b289195", + // mintTx: "0x0000000000000000000000000000000000000000000000000000000000000000", + // } + // assertions + // if (!claimRes.claimedKeyId) { + // throw new Error(`Expected "claimedKeyId" in claimRes`); + // } + // if (!claimRes.pubkey) { + // throw new Error(`Expected "pubkey" in claimRes`); + // } + // if (!claimRes.mintTx) { + // throw new Error(`Expected "mintTx" in claimRes`); + // } + // claimRes.signatures.forEach((sig: any) => { + // if (!sig.r) { + // throw new Error(`Expected "r" in sig`); + // } + // if (!sig.s) { + // throw new Error(`Expected "s" in sig`); + // } + // if (!sig.v) { + // throw new Error(`Expected "v" in sig`); + // } + // }); +}; +//# sourceMappingURL=testUsePkpSessionSigsToExecuteJsClaimKeys.js.map \ No newline at end of file diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.js b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.js new file mode 100644 index 0000000000..2f5a3b040a --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.js @@ -0,0 +1,94 @@ +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * ## Scenario: + * Testing the capability to claim keys using PKP session sigs. This test ensures that multiple keys can be claimed correctly. + * + * - Given: PKP sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * * + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimMultipleKeys + * ✅ NETWORK=datil-test yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimMultipleKeys + * ✅ NETWORK=custom yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimMultipleKeys + */ +export const testUsePkpSessionSigsToExecuteJsClaimMultipleKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; +//# sourceMappingURL=testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.js.map \ No newline at end of file diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.js b/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.js new file mode 100644 index 0000000000..b06b561cdc --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.js @@ -0,0 +1,41 @@ +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUsePkpSessionSigsToExecuteJsConsoleLog + * ✅ NETWORK=datil-test yarn test:local --filter=testUsePkpSessionSigsToExecuteJsConsoleLog + * ✅ NETWORK=custom yarn test:local --filter=testUsePkpSessionSigsToExecuteJsConsoleLog + */ +export const testUsePkpSessionSigsToExecuteJsConsoleLog = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + console.log('hello world') + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "", + // logs: "hello world\n", + // } + // -- assertions + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } +}; +//# sourceMappingURL=testUsePkpSessionSigsToExecuteJsConsoleLog.js.map \ No newline at end of file diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.js b/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.js new file mode 100644 index 0000000000..e332cb0d39 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.js @@ -0,0 +1,55 @@ +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUsePkpSessionSigsToExecuteJsJsonResponse + * ✅ NETWORK=datil-test yarn test:local --filter=testUsePkpSessionSigsToExecuteJsJsonResponse + * ✅ NETWORK=custom yarn test:local --filter=testUsePkpSessionSigsToExecuteJsJsonResponse + */ +export const testUsePkpSessionSigsToExecuteJsJsonResponse = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "{\"hello\":\"world\"}", + // logs: "hello world\n", + // } + // -- assertions + if (!res.response) { + throw new Error(`Expected "response" in res`); + } + if (!res.response.startsWith('{')) { + throw new Error(`Expected "response" to start with {`); + } + if (!res.response.endsWith('}')) { + throw new Error(`Expected "response" to end with }`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + if (res.success !== true) { + throw new Error(`Expected "success" to be true`); + } +}; +//# sourceMappingURL=testUsePkpSessionSigsToExecuteJsJsonResponse.js.map \ No newline at end of file diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.js b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.js new file mode 100644 index 0000000000..064b2ee1d5 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.js @@ -0,0 +1,67 @@ +import { log } from '@lit-protocol/misc'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigning + * ✅ NETWORK=datil-test yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigning + * ✅ NETWORK=custom yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigning + */ +export const testUsePkpSessionSigsToExecuteJsSigning = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey, + }, + }); + devEnv.releasePrivateKeyFromUser(alice); + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "8d2a3b3fa49e67b6bf9de15adfc0b5fbe04b6d730cbef60f4c211c4803bd9c3f", + // s: "1f819cc7a74a72e6f1b16a9a665f19cdd7294132d8a1c70871a752a6d70615e4", + // recid: 1, + // signature: "0x8d2a3b3fa49e67b6bf9de15adfc0b5fbe04b6d730cbef60f4c211c4803bd9c3f1f819cc7a74a72e6f1b16a9a665f19cdd7294132d8a1c70871a752a6d70615e41c", + // publicKey: "044395E44BA89AC0D0E76DEECD937C7BC0AE96B47766AB01CEC5449A8F869754560ACAEAC82CD48FAD3553AD47D7FAA99131F6E7E1B19DEBA058BB6D6B97F2BDB1", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + // -- signatures.sig.signature must start with 0x + if (!res.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // -- signatures.sig.recid must be parseable as a number + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + log('✅ res:', res); +}; +//# sourceMappingURL=testUsePkpSessionSigsToExecuteJsSigning.js.map \ No newline at end of file diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.js b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.js new file mode 100644 index 0000000000..9a89853cff --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.js @@ -0,0 +1,106 @@ +import { log } from '@lit-protocol/misc'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigningInParallel + * ✅ NETWORK=datil-test yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigningInParallel + * ✅ NETWORK=custom yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigningInParallel + */ +export const testUsePkpSessionSigsToExecuteJsSigningInParallel = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const fn = async (index) => { + log(`Index: ${index}`); + return await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey, + }, + }); + }; + devEnv.releasePrivateKeyFromUser(alice); + const res = await Promise.all([fn(1), fn(2), fn(3)]); + log('res:', res); + // -- Expected output: + // [ + // { + // claims: {}, + // signatures: { + // sig: { + // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", + // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", + // recid: 0, + // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", + // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", + // recid: 1, + // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", + // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", + // recid: 0, + // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // ] + // -- assertions + res.forEach((r) => { + if (!r.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!r.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!r.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!r.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + // -- signatures.sig.signature must start with 0x + if (!r.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // -- signatures.sig.recid must be parseable as a number + if (isNaN(r.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); + log('✅ testUsePkpSessionSigsToExecuteJsSigningInParallel'); +}; +//# sourceMappingURL=testUsePkpSessionSigsToExecuteJsSigningInParallel.js.map \ No newline at end of file diff --git a/local-tests/tests/testUsePkpSessionSigsToPkpSign.js b/local-tests/tests/testUsePkpSessionSigsToPkpSign.js new file mode 100644 index 0000000000..cea6c412b3 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToPkpSign.js @@ -0,0 +1,51 @@ +import { log } from '@lit-protocol/misc'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUsePkpSessionSigsToPkpSign + * ✅ NETWORK=datil-test yarn test:local --filter=testUsePkpSessionSigsToPkpSign + * ✅ NETWORK=custom yarn test:local --filter=testUsePkpSessionSigsToPkpSign + */ +export const testUsePkpSessionSigsToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.authMethodOwnedPkp.publicKey, + sessionSigs: pkpSessionSigs, + }); + devEnv.releasePrivateKeyFromUser(alice); + // -- Expected output: + // { + // r: "f67785b9c516a1fdbd224e9591554171d594bb1fb9799c851bac56212956838a", + // s: "799edb2732f2ebeaf90ea84cbf4c2a2e2ba509487a19d5c6b88210afe362ce42", + // recid: 1, + // signature: "0xf67785b9c516a1fdbd224e9591554171d594bb1fb9799c851bac56212956838a799edb2732f2ebeaf90ea84cbf4c2a2e2ba509487a19d5c6b88210afe362ce421c", + // publicKey: "0486C6E6E854337411A3884E0DEFF15D6D69663594826313BB73E18C465A079B4C2850719F45E9BE2FAC18AA78FFF2C7AEC912FA9D646B2F088C6CAAA8F7A0144A", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + // -- assertions + // r, s, dataSigned, and public key should be present + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + // signature must start with 0x + if (!res.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // recid must be parseable as a number + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + log('✅ res:', res); +}; +//# sourceMappingURL=testUsePkpSessionSigsToPkpSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.js b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.js new file mode 100644 index 0000000000..671b832694 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.js @@ -0,0 +1,67 @@ +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { log } from '@lit-protocol/misc'; +import { encryptString, decryptToFile } from '@lit-protocol/encryption'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile + * ✅ NETWORK=datil-test yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const message = 'Hello world'; + const blob = new Blob([message], { type: 'text/plain' }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + const encryptRes = await encryptString({ + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, devEnv.litNodeClient); + log('encryptRes:', encryptRes); + // await 5 seconds for the encryption to be mined + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString(accs, encryptRes.dataToEncryptHash); + const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption, + }, + ]); + // -- Decrypt the encrypted string + const decriptedFile = await decryptToFile({ + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: pkpSessionSigs2, + chain: 'ethereum', + }, devEnv.litNodeClient); + devEnv.releasePrivateKeyFromUser(alice); + if (blobArray.length !== decriptedFile.length) { + throw new Error(`decrypted file should match the original file but received ${decriptedFile}`); + } + for (let i = 0; i < blobArray.length; i++) { + if (blobArray[i] !== decriptedFile[i]) { + throw new Error(`decrypted file should match the original file`); + } + } + console.log('decriptedFile:', decriptedFile); +}; +//# sourceMappingURL=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.js b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.js new file mode 100644 index 0000000000..bd5a5af478 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.js @@ -0,0 +1,57 @@ +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { log } from '@lit-protocol/misc'; +import { encryptString, decryptToString } from '@lit-protocol/encryption'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString + * + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const encryptRes = await encryptString({ + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, devEnv.litNodeClient); + log('encryptRes:', encryptRes); + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + const accsResourceString = await LitAccessControlConditionResource.generateResourceString(accs, encryptRes.dataToEncryptHash); + const litActionSessionSigs2 = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LIT_ABILITY.AccessControlConditionDecryption, + }, + ]); + // -- Decrypt the encrypted string + const decryptRes = await decryptToString({ + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: litActionSessionSigs2, + chain: 'ethereum', + }, devEnv.litNodeClient); + devEnv.releasePrivateKeyFromUser(alice); + if (decryptRes !== 'Hello world') { + throw new Error(`Expected decryptRes to be 'Hello world' but got ${decryptRes}`); + } +}; +//# sourceMappingURL=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.js b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.js new file mode 100644 index 0000000000..9f943263f0 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.js @@ -0,0 +1,104 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * ## Scenario: + * Testing the capability to claim keys using Lit ACtion PKP session sigs. This test ensures that multiple keys can be claimed correctly. + * + * - Given: Lit ACtion PKP sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * * + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ]); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; +//# sourceMappingURL=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.js b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.js new file mode 100644 index 0000000000..3d3f498bd6 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.js @@ -0,0 +1,93 @@ +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * ## Scenario: + * Testing the capability to claim keys using Lit Action PKP session sigs. This test ensures that multiple keys can be claimed correctly. + * + * - Given: Lit Action PKP sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * * + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + res.claims.foo.signatures.forEach((sig) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; +//# sourceMappingURL=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.js b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.js new file mode 100644 index 0000000000..44c0a2d269 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.js @@ -0,0 +1,52 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ]); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + console.log('hello world') + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log('res:', res); + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "", + // logs: "hello world\n", + // } + // -- assertions + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } +}; +//# sourceMappingURL=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.js b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.js new file mode 100644 index 0000000000..ab9f6f4451 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.js @@ -0,0 +1,54 @@ +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();`, + }); + devEnv.releasePrivateKeyFromUser(alice); + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "{\"hello\":\"world\"}", + // logs: "hello world\n", + // } + // -- assertions + if (!res.response) { + throw new Error(`Expected "response" in res`); + } + if (!res.response.startsWith('{')) { + throw new Error(`Expected "response" to start with {`); + } + if (!res.response.endsWith('}')) { + throw new Error(`Expected "response" to end with }`); + } + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + if (res.success !== true) { + throw new Error(`Expected "success" to be true`); + } +}; +//# sourceMappingURL=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.js b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.js new file mode 100644 index 0000000000..b23b2115ce --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.js @@ -0,0 +1,70 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { log } from '@lit-protocol/misc'; +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning = async (devEnv) => { + // + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ]); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey, + }, + }); + devEnv.releasePrivateKeyFromUser(alice); + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "6d5ce6f948ff763939c204fc0f1b750fa0267ed567ed59581082d0cbf283feef", + // s: "4957ece75c60388500c4b7aa38a5fbafb7c20427db181aff7806af54c16ee145", + // recid: 1, + // signature: "0x6d5ce6f948ff763939c204fc0f1b750fa0267ed567ed59581082d0cbf283feef4957ece75c60388500c4b7aa38a5fbafb7c20427db181aff7806af54c16ee1451c", + // publicKey: "04D10D941B04491FDC99B048E2252A69137333254C482511D6CCDD401C080AF4F51BF65D9AE2413FCE066E326D7F0CED9C139DD9BA2D1C6334FD8C14CA4DD7F3D0", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + log('✅ res:', res); +}; +//# sourceMappingURL=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.js b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.js new file mode 100644 index 0000000000..418e4458c5 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.js @@ -0,0 +1,105 @@ +import { log } from '@lit-protocol/misc'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const fn = async (index) => { + log(`Index: ${index}`); + return await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey, + }, + }); + }; + devEnv.releasePrivateKeyFromUser(alice); + const res = await Promise.all([fn(1), fn(2), fn(3)]); + log('res:', res); + // -- Expected output: + // [ + // { + // claims: {}, + // signatures: { + // sig: { + // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", + // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", + // recid: 0, + // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", + // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", + // recid: 1, + // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", + // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", + // recid: 0, + // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // ] + // -- assertions + res.forEach((r) => { + if (!r.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!r.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!r.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!r.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + // -- signatures.sig.signature must start with 0x + if (!r.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // -- signatures.sig.recid must be parseable as a number + if (isNaN(r.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); + log('✅ testUsePkpSessionSigsToExecuteJsSigningInParallel'); +}; +//# sourceMappingURL=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.js b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.js new file mode 100644 index 0000000000..9438b23840 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.js @@ -0,0 +1,51 @@ +import { log } from '@lit-protocol/misc'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToPkpSign + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToPkpSign + * + **/ +export const testUseValidLitActionCodeGeneratedSessionSigsToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + const res = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.authMethodOwnedPkp.publicKey, + sessionSigs: litActionSessionSigs, + }); + devEnv.releasePrivateKeyFromUser(alice); + // -- Expected output: + // { + // r: "ab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b", + // s: "4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e", + // recid: 1, + // signature: "0xab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e1c", + // publicKey: "04400AD53C2F8BA11EBC69F05D1076D5BEE4EAE668CD66BABADE2E0770F756FDEEFC2C1D20F9A698EA3FEC6E9C944FF9FAFC2DC339B8E9392AFB9CC8AE75C5E5EC", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + // -- assertions + // r, s, dataSigned, and public key should be present + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + // signature must start with 0x + if (!res.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // recid must be parseable as a number + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + log('✅ res:', res); +}; +//# sourceMappingURL=testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning.js b/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning.js new file mode 100644 index 0000000000..fa22a4e5b9 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning.js @@ -0,0 +1,70 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { log } from '@lit-protocol/misc'; +import { LIT_ABILITY } from '@lit-protocol/constants'; +import { getLitActionSessionSigsUsingIpfsId } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning + * ✅ NETWORK=custom yarn test:local --filter=testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning + */ +export const testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigsUsingIpfsId(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LIT_ABILITY.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LIT_ABILITY.LitActionExecution, + }, + ]); + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey, + }, + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log('✅ res:', res); + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "6d5ce6f948ff763939c204fc0f1b750fa0267ed567ed59581082d0cbf283feef", + // s: "4957ece75c60388500c4b7aa38a5fbafb7c20427db181aff7806af54c16ee145", + // recid: 1, + // signature: "0x6d5ce6f948ff763939c204fc0f1b750fa0267ed567ed59581082d0cbf283feef4957ece75c60388500c4b7aa38a5fbafb7c20427db181aff7806af54c16ee1451c", + // publicKey: "04D10D941B04491FDC99B048E2252A69137333254C482511D6CCDD401C080AF4F51BF65D9AE2413FCE066E326D7F0CED9C139DD9BA2D1C6334FD8C14CA4DD7F3D0", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + log('✅ res:', res); +}; +//# sourceMappingURL=testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning.js.map \ No newline at end of file diff --git a/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign.js b/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign.js new file mode 100644 index 0000000000..aaaa684150 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign.js @@ -0,0 +1,59 @@ +import { log } from '@lit-protocol/misc'; +import { getLitActionSessionSigsUsingIpfsId } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign + * ❌ NETWORK=custom yarn test:local --filter=testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign + * + **/ +export const testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + let litActionSessionSigs; + try { + litActionSessionSigs = await getLitActionSessionSigsUsingIpfsId(devEnv, alice); + } + catch (e) { + console.log('❌ This error is NOT expected:', e); + throw new Error(e); + } + const res = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.authMethodOwnedPkp.publicKey, + sessionSigs: litActionSessionSigs, + }); + devEnv.releasePrivateKeyFromUser(alice); + console.log('✅ res:', res); + // -- Expected output: + // { + // r: "ab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b", + // s: "4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e", + // recid: 1, + // signature: "0xab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e1c", + // publicKey: "04400AD53C2F8BA11EBC69F05D1076D5BEE4EAE668CD66BABADE2E0770F756FDEEFC2C1D20F9A698EA3FEC6E9C944FF9FAFC2DC339B8E9392AFB9CC8AE75C5E5EC", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + // -- assertions + // r, s, dataSigned, and public key should be present + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + // signature must start with 0x + if (!res.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + // recid must be parseable as a number + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + log('✅ res:', res); +}; +//# sourceMappingURL=testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testBatchGeneratePrivateKeys.js b/local-tests/tests/wrapped-keys/testBatchGeneratePrivateKeys.js new file mode 100644 index 0000000000..a02b751580 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testBatchGeneratePrivateKeys.js @@ -0,0 +1,90 @@ +import { log } from '@lit-protocol/misc'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import nacl from 'tweetnacl'; +import bs58 from 'bs58'; +import { ethers } from 'ethers'; +const { batchGeneratePrivateKeys } = api; +async function verifySolanaSignature(solanaResult, solanaMessageToSign) { + const { signMessage: { signature }, generateEncryptedPrivateKey: { generatedPublicKey }, } = solanaResult; + const signatureIsValidForPublicKey = nacl.sign.detached.verify(Buffer.from(solanaMessageToSign), bs58.decode(signature), bs58.decode(generatedPublicKey)); + console.log({ signatureIsValidForPublicKey, signature }); + if (!signatureIsValidForPublicKey) { + throw new Error(`signature: ${signature} doesn't validate for the Solana public key: ${generatedPublicKey}`); + } +} +async function verifyEvmSignature(evmResult, messageToSign) { + function verifyMessageSignature() { + try { + return ethers.utils.verifyMessage(messageToSign, evmResult.signMessage.signature); + } + catch (err) { + throw new Error(`When validating signed Ethereum message is valid: ${err.message}`); + } + } + const walletAddress = ethers.utils.computeAddress(evmResult.generateEncryptedPrivateKey.generatedPublicKey); + const recoveredAddress = verifyMessageSignature(); + console.log({ + recoveredAddress, + walletAddress, + signature: evmResult.signMessage.signature, + }); + if (recoveredAddress !== walletAddress) { + throw new Error("Recovered address from verifyMessage doesn't match the wallet address"); + } +} +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testSignMessageWithSolanaEncryptedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testSignMessageWithSolanaEncryptedKey + * ✅ NETWORK=localchain yarn test:local --filter=testSignMessageWithSolanaEncryptedKey + */ +export const testBatchGeneratePrivateKeys = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const solanaMessageToSign = 'This is a test solana message'; + const evmMessageToSign = 'This is a test evm message'; + const { results } = await batchGeneratePrivateKeys({ + pkpSessionSigs: pkpSessionSigsSigning, + actions: [ + { + network: 'evm', + signMessageParams: { messageToSign: evmMessageToSign }, + generateKeyParams: { memo: 'Test evm key' }, + }, + { + network: 'solana', + signMessageParams: { messageToSign: solanaMessageToSign }, + generateKeyParams: { memo: 'Test solana key' }, + }, + ], + litNodeClient: devEnv.litNodeClient, + }); + if (results.length !== 2) { + throw new Error(`Incorrect # of results; expected 2, got ${results.length}`); + } + if (results[0].generateEncryptedPrivateKey.memo !== 'Test evm key' || + results[1].generateEncryptedPrivateKey.memo !== 'Test solana key') { + throw new Error('Results not in order sent; expected evm as first result, solana as second'); + } + if (!results[0].signMessage.signature || + !results[1].signMessage.signature) { + throw new Error('Missing message signature in response'); + } + console.log('solana verify sig'); + await verifySolanaSignature(results[1], solanaMessageToSign); + console.log('evm verify sig'); + await verifyEvmSignature(results[0], evmMessageToSign); + console.log('results', results); + log('✅ testBatchGenerateEncryptedKeys'); + } + catch (err) { + console.log(err.message, err, err.stack); + throw err; + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testBatchGeneratePrivateKeys.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey.js b/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey.js new file mode 100644 index 0000000000..c7769ef5fc --- /dev/null +++ b/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey.js @@ -0,0 +1,55 @@ +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { getBaseTransactionForNetwork } from './util'; +const { signTransactionWithEncryptedKey, generatePrivateKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testEthereumBroadcastTransactionGeneratedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testEthereumBroadcastTransactionGeneratedKey + * ✅ NETWORK=custom yarn test:local --filter=testEthereumBroadcastTransactionGeneratedKey + */ +export const testEthereumBroadcastTransactionGeneratedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ + pkpSessionSigs, + network: 'evm', + litNodeClient: devEnv.litNodeClient, + memo: 'Test key', + }); + const generatedKeysWalletAddress = ethers.utils.computeAddress(generatedPublicKey); + console.log(`Sending funds to ${generatedKeysWalletAddress}`); + await devEnv.getFunds(generatedKeysWalletAddress, '0.005'); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsSigning); + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient.config.litNetwork, + toAddress: alice.wallet.address, + }); + const signedTx = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'evm', + unsignedTransaction, + broadcast: true, + litNodeClient: devEnv.litNodeClient, + id, + }); + // console.log('signedTx'); + // console.log(signedTx); + if (!ethers.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + log('✅ testEthereumBroadcastTransactionGeneratedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testEthereumBroadcastTransactionGeneratedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey.js b/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey.js new file mode 100644 index 0000000000..a8c579c562 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey.js @@ -0,0 +1,60 @@ +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { getBaseTransactionForNetwork } from './util'; +const { importPrivateKey, signTransactionWithEncryptedKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testEthereumBroadcastTransactionWrappedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testEthereumBroadcastTransactionWrappedKey + * ✅ NETWORK=custom yarn test:local --filter=testEthereumBroadcastTransactionWrappedKey + */ +export const testEthereumBroadcastTransactionWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const wrappedKeysWallet = ethers.Wallet.createRandom(); + const wrappedKeysWalletPrivateKey = wrappedKeysWallet.privateKey; + const wrappedKeysWalletAddress = wrappedKeysWallet.address; + console.log(`Sending funds to ${wrappedKeysWalletAddress}`); + await devEnv.getFunds(wrappedKeysWallet.address, '0.005'); + const { pkpAddress, id } = await importPrivateKey({ + pkpSessionSigs, + privateKey: wrappedKeysWalletPrivateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsSigning); + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient.config.litNetwork, + toAddress: alice.wallet.address, + }); + const signedTx = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'evm', + unsignedTransaction, + broadcast: true, + litNodeClient: devEnv.litNodeClient, + id, + }); + // console.log('signedTx'); + // console.log(signedTx); + // TODO: Get the raw input from the tx hash, convert it to UTF-8 and assert that it contains "Test transaction from Alice to bob" + if (!ethers.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + log('✅ testEthereumBroadcastTransactionWrappedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testEthereumBroadcastTransactionWrappedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams.js b/local-tests/tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams.js new file mode 100644 index 0000000000..dba901e118 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams.js @@ -0,0 +1,62 @@ +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { getChainForNetwork } from './util'; +const { importPrivateKey, signTransactionWithEncryptedKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testEthereumBroadcastWrappedKeyWithFetchGasParams + * ✅ NETWORK=datil-test yarn test:local --filter=testEthereumBroadcastWrappedKeyWithFetchGasParams + * ✅ NETWORK=custom yarn test:local --filter=testEthereumBroadcastWrappedKeyWithFetchGasParams + */ +export const testEthereumBroadcastWrappedKeyWithFetchGasParams = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const wrappedKeysWallet = ethers.Wallet.createRandom(); + const wrappedKeysWalletPrivateKey = wrappedKeysWallet.privateKey; + const wrappedKeysWalletAddress = wrappedKeysWallet.address; + console.log(`Sending funds to ${wrappedKeysWalletAddress}`); + await devEnv.getFunds(wrappedKeysWallet.address, '0.005'); + const { pkpAddress, id } = await importPrivateKey({ + pkpSessionSigs, + privateKey: wrappedKeysWalletPrivateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsSigning); + const unsignedTransaction = { + toAddress: alice.wallet.address, + value: '0.0001', // in ethers (Lit tokens) + dataHex: ethers.utils.hexlify(ethers.utils.toUtf8Bytes('Test transaction from Alice to bob')), + ...getChainForNetwork(devEnv.litNodeClient.config.litNetwork), + }; + const signedTx = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'evm', + unsignedTransaction, + broadcast: true, + litNodeClient: devEnv.litNodeClient, + id, + }); + // console.log('signedTx'); + // console.log(signedTx); + // TODO: Get the raw input from the tx hash, convert it to UTF-8 and assert that it contains "Test transaction from Alice to bob" + if (!ethers.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + log('✅ testEthereumBroadcastWrappedKeyWithDefaultGasParams'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testEthereumBroadcastWrappedKeyWithFetchGasParams.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testEthereumSignMessageGeneratedKey.js b/local-tests/tests/wrapped-keys/testEthereumSignMessageGeneratedKey.js new file mode 100644 index 0000000000..fcb678d68e --- /dev/null +++ b/local-tests/tests/wrapped-keys/testEthereumSignMessageGeneratedKey.js @@ -0,0 +1,63 @@ +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +const { generatePrivateKey, signMessageWithEncryptedKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testEthereumSignMessageGeneratedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testEthereumSignMessageGeneratedKey + * ✅ NETWORK=custom yarn test:local --filter=testEthereumSignMessageGeneratedKey + */ +export const testEthereumSignMessageGeneratedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const { pkpAddress, id, generatedPublicKey } = await generatePrivateKey({ + pkpSessionSigs, + network: 'evm', + litNodeClient: devEnv.litNodeClient, + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsSigning); + const unsignedStringMessage = 'This is a test message'; + const signature = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'evm', + messageToSign: unsignedStringMessage, + litNodeClient: devEnv.litNodeClient, + id, + }); + // console.log('signature'); + // console.log(signature); + if (!ethers.utils.isHexString(signature)) { + throw new Error(`signature isn't hex: ${signature}`); + } + const unsignedBinaryMessage = ethers.utils.arrayify(ethers.utils.toUtf8Bytes(unsignedStringMessage)); + const signatureBinary = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'evm', + messageToSign: unsignedBinaryMessage, + litNodeClient: devEnv.litNodeClient, + id, + }); + // console.log('signatureBinary'); + // console.log(signatureBinary); + if (!ethers.utils.isHexString(signatureBinary)) { + throw new Error(`signatureBinary isn't hex: ${signatureBinary}`); + } + if (signatureBinary !== signature) { + throw new Error(`signature: ${signature} doesn't match it's signatureBinary form: ${signatureBinary}`); + } + log('✅ testEthereumSignMessageGeneratedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testEthereumSignMessageGeneratedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testEthereumSignMessageWrappedKey.js b/local-tests/tests/wrapped-keys/testEthereumSignMessageWrappedKey.js new file mode 100644 index 0000000000..349efb9b19 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testEthereumSignMessageWrappedKey.js @@ -0,0 +1,66 @@ +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +const { importPrivateKey, signMessageWithEncryptedKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testEthereumSignMessageWrappedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testEthereumSignMessageWrappedKey + * ✅ NETWORK=custom yarn test:local --filter=testEthereumSignMessageWrappedKey + */ +export const testEthereumSignMessageWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const privateKey = ethers.Wallet.createRandom().privateKey; + const { pkpAddress, id } = await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsSigning); + const unsignedStringMessage = 'This is a test message'; + const signature = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'evm', + messageToSign: unsignedStringMessage, + litNodeClient: devEnv.litNodeClient, + id, + }); + // console.log('signature'); + // console.log(signature); + if (!ethers.utils.isHexString(signature)) { + throw new Error(`signature isn't hex: ${signature}`); + } + const unsignedBinaryMessage = ethers.utils.arrayify(ethers.utils.toUtf8Bytes(unsignedStringMessage)); + const signatureBinary = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'evm', + messageToSign: unsignedBinaryMessage, + litNodeClient: devEnv.litNodeClient, + id, + }); + // console.log('signatureBinary'); + // console.log(signatureBinary); + if (!ethers.utils.isHexString(signatureBinary)) { + throw new Error(`signatureBinary isn't hex: ${signatureBinary}`); + } + if (signatureBinary !== signature) { + throw new Error(`signature: ${signature} doesn't match it's signatureBinary form: ${signatureBinary}`); + } + log('✅ testEthereumSignMessageWrappedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testEthereumSignMessageWrappedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testEthereumSignTransactionWrappedKey.js b/local-tests/tests/wrapped-keys/testEthereumSignTransactionWrappedKey.js new file mode 100644 index 0000000000..9d3612a79f --- /dev/null +++ b/local-tests/tests/wrapped-keys/testEthereumSignTransactionWrappedKey.js @@ -0,0 +1,55 @@ +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { getBaseTransactionForNetwork } from './util'; +const { importPrivateKey, signTransactionWithEncryptedKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testEthereumSignTransactionWrappedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testEthereumSignTransactionWrappedKey + * ✅ NETWORK=custom yarn test:local --filter=testEthereumSignTransactionWrappedKey + */ +export const testEthereumSignTransactionWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const privateKey = ethers.Wallet.createRandom().privateKey; + const { pkpAddress, id } = await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsSigning); + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient.config.litNetwork, + toAddress: alice.wallet.address, + }); + const signedTx = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'evm', + unsignedTransaction, + broadcast: false, + litNodeClient: devEnv.litNodeClient, + id, + }); + // console.log('signedTx'); + // console.log(signedTx); + if (!ethers.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + log('✅ testEthereumSignTransactionWrappedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testEthereumSignTransactionWrappedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testExportWrappedKey.js b/local-tests/tests/wrapped-keys/testExportWrappedKey.js new file mode 100644 index 0000000000..99c929a0c7 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testExportWrappedKey.js @@ -0,0 +1,47 @@ +import { log } from '@lit-protocol/misc'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from '../../setup/session-sigs/get-pkp-session-sigs'; +import { randomSolanaPrivateKey } from '../../setup/tinny-utils'; +const { exportPrivateKey, importPrivateKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testExportWrappedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testExportWrappedKey + * ✅ NETWORK=custom yarn test:local --filter=testExportWrappedKey + */ +export const testExportWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigsImport = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsImport); + const privateKey = randomSolanaPrivateKey(); + const { pkpAddress, id } = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigsImport, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsExport = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsExport); + const { decryptedPrivateKey } = await exportPrivateKey({ + pkpSessionSigs: pkpSessionSigsExport, + litNodeClient: devEnv.litNodeClient, + network: 'solana', + id, + }); + if (decryptedPrivateKey !== privateKey) { + throw new Error(`Decrypted private key: ${decryptedPrivateKey} doesn't match with the original private key: ${privateKey}`); + } + log('✅ testExportWrappedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testExportWrappedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption.js b/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption.js new file mode 100644 index 0000000000..2cdba52ad9 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption.js @@ -0,0 +1,65 @@ +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { encryptString } from '@lit-protocol/encryption'; +import { LIT_PREFIX } from 'packages/wrapped-keys/src/lib/constants'; +import { LIT_ACTION_CID_REPOSITORY } from '../../../packages/wrapped-keys/src/lib/lit-actions-client/constants'; +import { getBaseTransactionForNetwork } from './util'; +import { GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK } from '@lit-protocol/constants'; +import { getPkpAccessControlCondition } from '../../../packages/wrapped-keys/src/lib/api/utils'; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyInvalidDecryption + * ✅ NETWORK=datil-test yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyInvalidDecryption + * ✅ NETWORK=custom yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyInvalidDecryption + */ +export const testFailEthereumSignTransactionWrappedKeyInvalidDecryption = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + try { + const privateKey = ethers.Wallet.createRandom().privateKey; + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + const decryptionAccessControlCondition = getPkpAccessControlCondition(alicePkpAddress); + const { ciphertext, dataToEncryptHash } = await encryptString({ + accessControlConditions: [decryptionAccessControlCondition], + dataToEncrypt: LIT_PREFIX + privateKey, + }, devEnv.litNodeClient); + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, bob, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsSigning); + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient.config.litNetwork, + toAddress: alice.wallet.address, + }); + try { + const _res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigsSigning, + ipfsId: LIT_ACTION_CID_REPOSITORY.signTransaction.evm, + jsParams: { + ciphertext, + dataToEncryptHash, + unsignedTransaction, + accessControlConditions: [decryptionAccessControlCondition], + }, + ipfsOptions: { + overwriteCode: GLOBAL_OVERWRITE_IPFS_CODE_BY_NETWORK[devEnv.litNodeClient.config.litNetwork], + }, + }); + } + catch (e) { + if (e.message.includes('There was an error getting the signing shares from the nodes')) { + console.log('✅ THIS IS EXPECTED: ', e); + console.log(e.message); + console.log('✅ testFailEthereumSignTransactionWrappedKeyInvalidDecryption is expected to have an error'); + } + else { + throw e; + } + } + log('✅ testFailEthereumSignTransactionWrappedKeyInvalidDecryption'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + } +}; +//# sourceMappingURL=testFailEthereumSignTransactionWrappedKeyInvalidDecryption.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam.js b/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam.js new file mode 100644 index 0000000000..5e5b04f8ed --- /dev/null +++ b/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam.js @@ -0,0 +1,66 @@ +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { getBaseTransactionForNetwork } from './util'; +const { importPrivateKey, signTransactionWithEncryptedKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithInvalidParam + * ✅ NETWORK=datil-test yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithInvalidParam + * ✅ NETWORK=custom yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithInvalidParam + */ +export const testFailEthereumSignTransactionWrappedKeyWithInvalidParam = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const privateKey = ethers.Wallet.createRandom().privateKey; + const { pkpAddress, id } = await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsSigning); + const unsignedTransaction = { + ...getBaseTransactionForNetwork({ + network: devEnv.litNodeClient.config.litNetwork, + toAddress: alice.wallet.address, + }), + dataHex: 'Test transaction from Alice to bob', + }; + try { + const _res = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'evm', + unsignedTransaction, + broadcast: false, + litNodeClient: devEnv.litNodeClient, + id, + }); + } + catch (e) { + if (e.message.includes('invalid hexlify value')) { + console.log('✅ THIS IS EXPECTED: ', e); + console.log(e.message); + console.log('✅ testFailEthereumSignTransactionWrappedKeyWithInvalidParam is expected to have an error'); + } + else { + console.log('ERROR', e.message); + throw e; + } + } + log('✅ testFailEthereumSignTransactionWrappedKeyWithInvalidParam'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testFailEthereumSignTransactionWrappedKeyWithInvalidParam.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam.js b/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam.js new file mode 100644 index 0000000000..688fd38bd7 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam.js @@ -0,0 +1,62 @@ +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { getChainForNetwork } from './util'; +const { importPrivateKey, signTransactionWithEncryptedKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithMissingParam + * ✅ NETWORK=datil-test yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithMissingParam + * ✅ NETWORK=custom yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithMissingParam + */ +export const testFailEthereumSignTransactionWrappedKeyWithMissingParam = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const privateKey = ethers.Wallet.createRandom().privateKey; + const { pkpAddress, id } = await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsSigning); + try { + const _res = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'evm', + unsignedTransaction: { + ...getChainForNetwork(devEnv.litNodeClient.config.litNetwork), + // @ts-expect-error This test is intentionally using the type incorrectly. + serializedTransaction: 'random-value', + }, + broadcast: false, + litNodeClient: devEnv.litNodeClient, + id, + }); + } + catch (e) { + if (e.message.includes('Missing required field: toAddress')) { + console.log('✅ THIS IS EXPECTED: ', e); + console.log(e.message); + console.log('✅ testFailEthereumSignTransactionWrappedKeyWithMissingParam is expected to have an error'); + } + else { + throw e; + } + } + log('✅ testFailEthereumSignTransactionWrappedKeyWithMissingParam'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testFailEthereumSignTransactionWrappedKeyWithMissingParam.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig.js b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig.js new file mode 100644 index 0000000000..46dca381a1 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig.js @@ -0,0 +1,43 @@ +import { api } from '@lit-protocol/wrapped-keys'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { randomSolanaPrivateKey } from 'local-tests/setup/tinny-utils'; +const { importPrivateKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testFailImportWrappedKeysWithEoaSessionSig + * ✅ NETWORK=datil-test yarn test:local --filter=testFailImportWrappedKeysWithEoaSessionSig + * ✅ NETWORK=custom yarn test:local --filter=testFailImportWrappedKeysWithEoaSessionSig + */ +export const testFailImportWrappedKeysWithEoaSessionSig = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + // console.log(eoaSessionSigs); + const privateKey = randomSolanaPrivateKey(); + try { + await importPrivateKey({ + pkpSessionSigs: eoaSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + } + catch (e) { + if (e.message.includes('SessionSig is not from a PKP')) { + console.log('✅ THIS IS EXPECTED: ', e); + console.log(e.message); + console.log('✅ testFailImportWrappedKeysWithEoaSessionSig is expected to have an error'); + } + else { + throw e; + } + } + console.log('✅ testFailImportWrappedKeysWithEoaSessionSig'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testFailImportWrappedKeysWithEoaSessionSig.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig.js b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig.js new file mode 100644 index 0000000000..074037219a --- /dev/null +++ b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig.js @@ -0,0 +1,58 @@ +import { api } from '@lit-protocol/wrapped-keys'; +import { randomSolanaPrivateKey } from 'local-tests/setup/tinny-utils'; +const { importPrivateKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testFailImportWrappedKeysWithExpiredSessionSig + * ✅ NETWORK=datil-test yarn test:local --filter=testFailImportWrappedKeysWithExpiredSessionSig + * ✅ NETWORK=custom yarn test:local --filter=testFailImportWrappedKeysWithExpiredSessionSig + */ +export const testFailImportWrappedKeysWithExpiredSessionSig = async (devEnv) => { + const pkpSessionSigs = { + 'https://207.244.70.36:8474': { + sig: '1827d1c7b79c979ce76d0b9e130f6804dbf7c7838b6dfa41d4cadf690b9a8bec23321dde6cc573e8a592c395193074ade303d94f3c198d8f0017ca0aca91bd0f', + derivedVia: 'litSessionSignViaNacl', + signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8474"}`, + address: '4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b', + algo: 'ed25519', + }, + 'https://207.244.70.36:8473': { + sig: '762b9849d2cc77d0c75aa354c3cce63abca008a9a07ec3efc69ee8a4954650c3362b8cb83cd3d63310ad98b446be5e68cb8193f9d486453b2df72188dc698d0e', + derivedVia: 'litSessionSignViaNacl', + signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8473"}`, + address: '4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b', + algo: 'ed25519', + }, + 'https://207.244.70.36:8475': { + sig: '5e506dc973cc1540dcb3bd1de251afa687caf277cb5f3efe107339ecf4c25607d4bdf5d8c8910874519252e026a49cc66cea0b07bc5d38342c7cb2613decbe0a', + derivedVia: 'litSessionSignViaNacl', + signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8475"}`, + address: '4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b', + algo: 'ed25519', + }, + }; + try { + const privateKey = randomSolanaPrivateKey(); + const res = await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + // console.log(res); + } + catch (e) { + if (e.message.includes('Invalid sessionSig: Expired')) { + console.log('✅ THIS IS EXPECTED: ', e); + console.log(e.message); + console.log('✅ testFailImportWrappedKeysWithExpiredSessionSig is expected to have an error'); + } + else { + throw e; + } + } + console.log('✅ testFailImportWrappedKeysWithExpiredSessionSig'); +}; +//# sourceMappingURL=testFailImportWrappedKeysWithExpiredSessionSig.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig.js b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig.js new file mode 100644 index 0000000000..fe0849fdae --- /dev/null +++ b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig.js @@ -0,0 +1,57 @@ +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { randomSolanaPrivateKey } from 'local-tests/setup/tinny-utils'; +const { importPrivateKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testFailImportWrappedKeysWithInvalidSessionSig + * ✅ NETWORK=datil-test yarn test:local --filter=testFailImportWrappedKeysWithInvalidSessionSig + * ✅ NETWORK=custom yarn test:local --filter=testFailImportWrappedKeysWithInvalidSessionSig + */ +export const testFailImportWrappedKeysWithInvalidSessionSig = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + try { + const privateKey = randomSolanaPrivateKey(); + await importPrivateKey({ + pkpSessionSigs: tamperPkpSessionSigs(pkpSessionSigs), + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + } + catch (e) { + if (e.message.includes('bad public key size')) { + console.log('✅ THIS IS EXPECTED: ', e); + console.log(e.message); + console.log('✅ testFailImportWrappedKeysWithInvalidSessionSig is expected to have an error'); + } + else { + throw e; + } + } + console.log('✅ testFailImportWrappedKeysWithInvalidSessionSig'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +const tamperPkpSessionSigs = (pkpSessionSig) => { + const tamperedPkpSessionSigs = {}; + for (const key in pkpSessionSig) { + if (pkpSessionSig.hasOwnProperty(key)) { + const authSig = pkpSessionSig[key]; + const updatedAuthSig = { + ...authSig, + address: authSig.address.slice(0, -1), + }; + tamperedPkpSessionSigs[key] = updatedAuthSig; + } + } + // console.log(tamperedPkpSessionSigs); + return tamperedPkpSessionSigs; +}; +//# sourceMappingURL=testFailImportWrappedKeysWithInvalidSessionSig.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig.js b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig.js new file mode 100644 index 0000000000..5d40f0ffb0 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig.js @@ -0,0 +1,42 @@ +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { randomSolanaPrivateKey } from 'local-tests/setup/tinny-utils'; +const { importPrivateKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testFailImportWrappedKeysWithMaxExpirySessionSig + * ✅ NETWORK=datil-test yarn test:local --filter=testFailImportWrappedKeysWithMaxExpirySessionSig + * ✅ NETWORK=custom yarn test:local --filter=testFailImportWrappedKeysWithMaxExpirySessionSig + */ +export const testFailImportWrappedKeysWithMaxExpirySessionSig = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + try { + const privateKey = randomSolanaPrivateKey(); + await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + } + catch (e) { + if (e.message.includes('Expires too far in the future')) { + console.log('✅ THIS IS EXPECTED: ', e); + console.log(e.message); + console.log('✅ testFailImportWrappedKeysWithMaxExpirySessionSig is expected to have an error'); + } + else { + throw e; + } + } + console.log('✅ testFailImportWrappedKeysWithMaxExpirySessionSig'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testFailImportWrappedKeysWithMaxExpirySessionSig.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey.js b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey.js new file mode 100644 index 0000000000..ab34bb1307 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey.js @@ -0,0 +1,50 @@ +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +const { importPrivateKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testFailImportWrappedKeysWithSamePrivateKey + * ✅ NETWORK=datil-test yarn test:local --filter=testFailImportWrappedKeysWithSamePrivateKey + * ✅ NETWORK=custom yarn test:local --filter=testFailImportWrappedKeysWithSamePrivateKey + */ +export const testFailImportWrappedKeysWithSamePrivateKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const privateKey = '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; // Already exists in the DB + try { + await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + throw new Error('Expected an AlreadyExists error but the importPrivateKey succeeded!'); + } + catch (e) { + if (e.message.includes('There is already a wrapped key stored with the same dataToEncryptHash')) { + console.log('✅ THIS IS EXPECTED: ', e); + console.log(e.message); + console.log('✅ testFailImportWrappedKeysWithSamePrivateKey is expected to have an error'); + } + else { + throw e; + } + } + console.log('✅ testFailImportWrappedKeysWithSamePrivateKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testFailImportWrappedKeysWithSamePrivateKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic.js b/local-tests/tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic.js new file mode 100644 index 0000000000..93d4b707c0 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testFailStoreEncryptedKeyBatchIsAtomic.js @@ -0,0 +1,93 @@ +import { log } from '@lit-protocol/misc'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { batchGenerateKeysWithLitAction } from '../../../packages/wrapped-keys/src/lib/lit-actions-client'; +import { getLitActionCodeOrCidCommon } from '../../../packages/wrapped-keys/src/lib/lit-actions-client/utils'; +import { getFirstSessionSig, getKeyTypeFromNetwork, getPkpAccessControlCondition, getPkpAddressFromSessionSig, } from '../../../packages/wrapped-keys/src/lib/api/utils'; +import { listEncryptedKeyMetadata } from '../../../packages/wrapped-keys/src/lib/api'; +const { storeEncryptedKeyBatch } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testSignMessageWithSolanaEncryptedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testSignMessageWithSolanaEncryptedKey + * ✅ NETWORK=localchain yarn test:local --filter=testSignMessageWithSolanaEncryptedKey + */ +export const testFailBatchGeneratePrivateKeysAtomic = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const solanaMessageToSign = 'This is a test solana message'; + const evmMessageToSign = 'This is a test evm message'; + const sessionSig = getFirstSessionSig(pkpSessionSigsSigning); + const pkpAddress = getPkpAddressFromSessionSig(sessionSig); + const allowPkpAddressToDecrypt = getPkpAccessControlCondition(pkpAddress); + const { litActionCode, litActionIpfsCid } = getLitActionCodeOrCidCommon('batchGenerateEncryptedKeys'); + const actionResults = await batchGenerateKeysWithLitAction({ + litNodeClient: devEnv.litNodeClient, + litActionIpfsCid: litActionCode ? undefined : litActionIpfsCid, + litActionCode: litActionCode ? litActionCode : undefined, + accessControlConditions: [allowPkpAddressToDecrypt], + actions: [ + { + network: 'evm', + signMessageParams: { messageToSign: evmMessageToSign }, + generateKeyParams: { memo: 'Test evm key' }, + }, + { + network: 'solana', + signMessageParams: { messageToSign: solanaMessageToSign }, + generateKeyParams: { memo: 'Test solana key' }, + }, + ], + pkpSessionSigs: pkpSessionSigsSigning, + }); + const keyParamsBatch = actionResults.map((keyData) => { + const { generateEncryptedPrivateKey, network } = keyData; + return { + ...generateEncryptedPrivateKey, + keyType: getKeyTypeFromNetwork(network), + }; + }); + // Intentional failure to persist due to missing publicKey + delete keyParamsBatch[0].publicKey; + try { + await storeEncryptedKeyBatch({ + pkpSessionSigs: pkpSessionSigsSigning, + litNodeClient: devEnv.litNodeClient, + keyBatch: keyParamsBatch, + }); + throw new Error('storeEncryptedKeyBatch() succeeded but we expected it to fail!'); + } + catch (err) { + // We expect `storeEncryptedKeyBatch` to fail w/ a specific error + if (err.message.includes('storeEncryptedKeyBatch() succeeded but we expected it to fail!') || + !err.message.includes('keyParamsBatch[0]: Missing "publicKey" parameter in request')) { + throw err; + } + try { + const keys = await listEncryptedKeyMetadata({ + litNodeClient: devEnv.litNodeClient, + pkpSessionSigs: pkpSessionSigsSigning, + }); + console.error('Got a value back we shouldnt have from listEncryptedKeyMetadata()', keys); + throw new Error('Expected `listEncryptedKeyMetadata() to fail, but it didnt!`'); + } + catch (err) { + if (err.message.includes('No keys exist for pkpAddress')) { + log('✅ testFailBatchGeneratePrivateKeysAtomic'); + } + else { + throw err; + } + } + } + } + catch (err) { + console.log(err.message, err, err.stack); + throw err; + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testFailStoreEncryptedKeyBatchIsAtomic.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testGenerateEthereumWrappedKey.js b/local-tests/tests/wrapped-keys/testGenerateEthereumWrappedKey.js new file mode 100644 index 0000000000..0ab285e952 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testGenerateEthereumWrappedKey.js @@ -0,0 +1,46 @@ +import { log } from '@lit-protocol/misc'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { ethers } from 'ethers'; +import { exportPrivateKey } from '../../../packages/wrapped-keys/src/lib/api'; +const { generatePrivateKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testGenerateEthereumWrappedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testGenerateEthereumWrappedKey + * ✅ NETWORK=custom yarn test:local --filter=testGenerateEthereumWrappedKey + */ +export const testGenerateEthereumWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); + const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ + pkpSessionSigs, + network: 'evm', + litNodeClient: devEnv.litNodeClient, + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsExport = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsExport); + const { decryptedPrivateKey } = await exportPrivateKey({ + pkpSessionSigs: pkpSessionSigsExport, + litNodeClient: devEnv.litNodeClient, + network: 'evm', + id, + }); + const wallet = new ethers.Wallet(decryptedPrivateKey); + const decryptedPublicKey = wallet.publicKey; + if (decryptedPublicKey !== generatedPublicKey) { + throw new Error(`Decrypted decryptedPublicKey: ${decryptedPublicKey} doesn't match with the original generatedPublicKey: ${generatedPublicKey}`); + } + log('✅ testGenerateEthereumWrappedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testGenerateEthereumWrappedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testGenerateSolanaWrappedKey.js b/local-tests/tests/wrapped-keys/testGenerateSolanaWrappedKey.js new file mode 100644 index 0000000000..fa29aecc3f --- /dev/null +++ b/local-tests/tests/wrapped-keys/testGenerateSolanaWrappedKey.js @@ -0,0 +1,62 @@ +import { log } from '@lit-protocol/misc'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { Keypair } from '@solana/web3.js'; +import { ethers } from 'ethers'; +import nacl from 'tweetnacl'; +const { generatePrivateKey, signMessageWithEncryptedKey, exportPrivateKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testGenerateSolanaWrappedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testGenerateSolanaWrappedKey + * ✅ NETWORK=custom yarn test:local --filter=testGenerateSolanaWrappedKey + */ +export const testGenerateSolanaWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ + pkpSessionSigs, + network: 'solana', + litNodeClient: devEnv.litNodeClient, + memo: 'Test key', + }); + console.log(`generatedPublicKey: ${generatedPublicKey}`); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + // console.log(pkpSessionSigsSigning); + const messageToSign = 'This is a test message'; + const signature = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'solana', + messageToSign, + litNodeClient: devEnv.litNodeClient, + id, + }); + // console.log('signature'); + // console.log(signature); + const signatureIsValidForPublicKey = nacl.sign.detached.verify(Buffer.from(messageToSign), ethers.utils.base58.decode(signature), ethers.utils.base58.decode(generatedPublicKey)); + if (!signatureIsValidForPublicKey) + throw new Error(`signature: ${signature} doesn't validate for the Solana public key: ${generatedPublicKey}`); + const pkpSessionSigsExport = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const { decryptedPrivateKey } = await exportPrivateKey({ + pkpSessionSigs: pkpSessionSigsExport, + litNodeClient: devEnv.litNodeClient, + network: 'solana', + id, + }); + const solanaKeyPair = Keypair.fromSecretKey(Buffer.from(decryptedPrivateKey, 'hex')); + const decryptedPublicKey = solanaKeyPair.publicKey; + if (decryptedPublicKey.toString() !== generatedPublicKey) { + throw new Error(`Decrypted decryptedPublicKey: ${decryptedPublicKey} doesn't match with the original generatedPublicKey: ${generatedPublicKey}`); + } + log('✅ testGenerateSolanaWrappedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testGenerateSolanaWrappedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testImportWrappedKey.js b/local-tests/tests/wrapped-keys/testImportWrappedKey.js new file mode 100644 index 0000000000..d3263fd48c --- /dev/null +++ b/local-tests/tests/wrapped-keys/testImportWrappedKey.js @@ -0,0 +1,43 @@ +import { log } from '@lit-protocol/misc'; +import { api } from '@lit-protocol/wrapped-keys'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { randomSolanaPrivateKey } from 'local-tests/setup/tinny-utils'; +const { importPrivateKey, listEncryptedKeyMetadata } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testImportWrappedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testImportWrappedKey + * ✅ NETWORK=custom yarn test:local --filter=testImportWrappedKey + */ +export const testImportWrappedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const privateKey = randomSolanaPrivateKey(); + // '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; + const { pkpAddress, id } = await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const keys = await listEncryptedKeyMetadata({ + pkpSessionSigs, + litNodeClient: devEnv.litNodeClient, + }); + if (keys.length !== 1 || keys[0].id !== id) { + throw new Error('Keys returned by `listPrivateKeyMetadata()` do not match expected result.'); + } + log('✅ testImportWrappedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testImportWrappedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey.js b/local-tests/tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey.js new file mode 100644 index 0000000000..efa9759659 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey.js @@ -0,0 +1,52 @@ +import { log } from '@lit-protocol/misc'; +import { api } from '@lit-protocol/wrapped-keys'; +import { Keypair } from '@solana/web3.js'; +import { ethers } from 'ethers'; +import nacl from 'tweetnacl'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +const { importPrivateKey, signMessageWithEncryptedKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testSignMessageWithSolanaEncryptedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testSignMessageWithSolanaEncryptedKey + * ✅ NETWORK=custom yarn test:local --filter=testSignMessageWithSolanaEncryptedKey + */ +export const testSignMessageWithSolanaEncryptedKey = async (devEnv) => { + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const solanaKeypair = Keypair.generate(); + const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); + const { pkpAddress, id } = await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + keyType: 'K256', + memo: 'Test key', + }); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const messageToSign = 'This is a test message'; + const signature = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'solana', + messageToSign, + litNodeClient: devEnv.litNodeClient, + id, + }); + console.log('signature'); + console.log(signature); + const signatureIsValidForPublicKey = nacl.sign.detached.verify(Buffer.from(messageToSign), ethers.utils.base58.decode(signature), solanaKeypair.publicKey.toBuffer()); + if (!signatureIsValidForPublicKey) + throw new Error(`signature: ${signature} doesn't validate for the Solana public key: ${solanaKeypair.publicKey.toString()}`); + log('✅ testSignMessageWithSolanaEncryptedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testSignMessageWithSolanaEncryptedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey.js b/local-tests/tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey.js new file mode 100644 index 0000000000..bff45eb2f1 --- /dev/null +++ b/local-tests/tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey.js @@ -0,0 +1,95 @@ +import { log } from '@lit-protocol/misc'; +import { api } from '@lit-protocol/wrapped-keys'; +import { Connection, Keypair, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction, clusterApiUrl, } from '@solana/web3.js'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { ethers } from 'ethers'; +const { importPrivateKey, signTransactionWithEncryptedKey } = api; +/** + * Test Commands: + * ✅ NETWORK=datil-dev yarn test:local --filter=testSignTransactionWithSolanaEncryptedKey + * ✅ NETWORK=datil-test yarn test:local --filter=testSignTransactionWithSolanaEncryptedKey + * ✅ NETWORK=custom yarn test:local --filter=testSignTransactionWithSolanaEncryptedKey + */ +export const testSignTransactionWithSolanaEncryptedKey = async (devEnv) => { + /** + * The commented code tests the following. We're commenting it as Solana heavily rate limits its Air Dropping + * 1. Importing with the actual Solana publicKey + * 2. Requesting a Solana Airdrop on devnet + * 3. Setting broadcast as true so that the Lit Action returns the transaction signature which can be used to confirm the tx + * 4. Checking the status of the tx as well as confirming it + */ + const alice = await devEnv.createRandomPerson(); + try { + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const solanaKeypair = Keypair.generate(); + const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); + // const publicKey = solanaKeypair.publicKey; + // console.log("publicKey"); + // console.log(publicKey); // https://explorer.solana.com/address/jnu7wE8XMWXDmghQuVUZUUtQ1HFRkn8mwoquVif3e8q?cluster=devnet + const { pkpAddress, id } = await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient, + publicKey: '0xdeadbeef', + // publicKey: publicKey.toBase58(), + keyType: 'K256', + memo: 'Test key', + }); + const solanaConnection = new Connection(clusterApiUrl('devnet'), 'confirmed'); + // Request Solana Airdrop + // const balance = await solanaConnection.getBalance(solanaKeypair.publicKey); + // console.log("balance- ", balance); // Should be 0, in fact if we get the balance right after the Air Drop it will also be 0 unless we wait. We're skipping the balance confirmation + // await solanaConnection.requestAirdrop(solanaKeypair.publicKey, 1000000000); + const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error(`Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}`); + } + const pkpSessionSigsSigning = await getPkpSessionSigs(devEnv, alice, null, new Date(Date.now() + 1000 * 60 * 10).toISOString()); // 10 mins expiry + const solanaTransaction = new Transaction(); + solanaTransaction.add(SystemProgram.transfer({ + fromPubkey: solanaKeypair.publicKey, + toPubkey: new PublicKey(solanaKeypair.publicKey), + lamports: LAMPORTS_PER_SOL / 100, // Transfer 0.01 SOL + })); + solanaTransaction.feePayer = solanaKeypair.publicKey; + const { blockhash } = await solanaConnection.getLatestBlockhash(); + solanaTransaction.recentBlockhash = blockhash; + const serializedTransaction = solanaTransaction + .serialize({ + requireAllSignatures: false, // should be false as we're not signing the message + verifySignatures: false, // should be false as we're not signing the message + }) + .toString('base64'); + const unsignedTransaction = { + serializedTransaction, + chain: 'devnet', + }; + const signedTx = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning, + network: 'solana', + unsignedTransaction, + broadcast: false, + // broadcast: true, + litNodeClient: devEnv.litNodeClient, + id, + }); + // The following Explorer link show that the imported Solana wallet was sent an Air Drop and then broadcasted a tx from within the Lit Action + // https://explorer.solana.com/address/jnu7wE8XMWXDmghQuVUZUUtQ1HFRkn8mwoquVif3e8q?cluster=devnet + // Transaction Signature upon broadcast from `sendRawTransaction()`. We use this below to check the status of the tx and check whether it's confirmed. + // console.log(signedTx); // 5YEthLprbhk5Zwn47YU7qZW6qZEFFhJTEK37B53vLLzGNXis436SLk5vYD7QQK7LuERtKunuSuxdwTYkS48Bb1Vf + // const status = await solanaConnection.getSignatureStatus(signedTx); + // console.log(status); // { context: { apiVersion: '2.0.5', slot: 321490377 }, value: { confirmationStatus: 'confirmed', confirmations: 0, err: null, slot: 321490377, status: { Ok: null } } } + // const confirmation = await solanaConnection.confirmTransaction(signedTx); + // console.log(confirmation); // { context: { slot: 321490379 }, value: { err: null } } + const signatureBuffer = Buffer.from(ethers.utils.base58.decode(signedTx)); + solanaTransaction.addSignature(solanaKeypair.publicKey, signatureBuffer); + if (!solanaTransaction.verifySignatures()) { + throw new Error(`Signature: ${signedTx} doesn't validate for the Solana transaction.`); + } + log('✅ testSignMessageWithSolanaEncryptedKey'); + } + finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; +//# sourceMappingURL=testSignTransactionWithSolanaEncryptedKey.js.map \ No newline at end of file diff --git a/local-tests/tests/wrapped-keys/util.js b/local-tests/tests/wrapped-keys/util.js new file mode 100644 index 0000000000..69fc938007 --- /dev/null +++ b/local-tests/tests/wrapped-keys/util.js @@ -0,0 +1,76 @@ +import { LIT_CHAINS } from '@lit-protocol/constants'; +import { ethers } from 'ethers'; +import { config } from '@lit-protocol/wrapped-keys'; +import { litActionRepositoryCommon, litActionRepository, } from '@lit-protocol/wrapped-keys-lit-actions'; +const emptyLitActionRepositoryCommon = { + batchGenerateEncryptedKeys: '', +}; +const emptyLitActionRepository = { + signTransaction: { + evm: '', + solana: '', + }, + signMessage: { + evm: '', + solana: '', + }, + generateEncryptedKey: { + evm: '', + solana: '', + }, + exportPrivateKey: { + evm: '', + solana: '', + }, +}; +export function resetLitActionsCode() { + config.setLitActionsCodeCommon(emptyLitActionRepositoryCommon); + config.setLitActionsCode(emptyLitActionRepository); +} +export function setLitActionsCodeToLocal() { + config.setLitActionsCodeCommon(litActionRepositoryCommon); + config.setLitActionsCode(litActionRepository); +} +export function getChainForNetwork(network) { + switch (network) { + case 'datil-dev': + return { + chain: 'yellowstone', + chainId: LIT_CHAINS['yellowstone'].chainId, + }; + case 'datil-test': + return { + chain: 'yellowstone', + chainId: LIT_CHAINS['yellowstone'].chainId, + }; + case 'datil': + return { + chain: 'yellowstone', + chainId: LIT_CHAINS['yellowstone'].chainId, + }; + default: + throw new Error(`Cannot identify chain params for ${network}`); + } +} +export function getGasParamsForNetwork(network) { + switch (network) { + case 'datil-dev': + return { gasLimit: 5000000 }; + case 'datil-test': + return { gasLimit: 5000000 }; + case 'datil': + return { gasLimit: 5000000 }; + default: + throw new Error(`Cannot identify chain params for ${network}`); + } +} +export function getBaseTransactionForNetwork({ toAddress, network, }) { + return { + toAddress, + value: '0.0001', // in ethers (Lit tokens) + ...getChainForNetwork(network), + ...getGasParamsForNetwork(network), + dataHex: ethers.utils.hexlify(ethers.utils.toUtf8Bytes('Test transaction from Alice to bob')), + }; +} +//# sourceMappingURL=util.js.map \ No newline at end of file