diff --git a/.changeset/happy-rocks-jump.md b/.changeset/happy-rocks-jump.md new file mode 100644 index 0000000000..6dc3e0e569 --- /dev/null +++ b/.changeset/happy-rocks-jump.md @@ -0,0 +1,12 @@ +--- +"@evmts/ts-plugin": minor +"@evmts/unplugin": minor +"@evmts/runtime": minor +"@evmts/core": minor +"@evmts/base": minor +"@evmts/solc": minor +"@evmts/bun-plugin": minor +"@evmts/bundler": minor +--- + +Added back bytecode to EVMts bundler. When the compiler encounters a file ending in .s.sol it will compile the bytecode in addition to the abi diff --git a/bundler/base/docs/modules/bundler.md b/bundler/base/docs/modules/bundler.md index 4da4215d5e..0df25ff069 100644 --- a/bundler/base/docs/modules/bundler.md +++ b/bundler/base/docs/modules/bundler.md @@ -44,4 +44,4 @@ #### Defined in -[types.ts:32](https://github.com/evmts/evmts-monorepo/blob/main/bundler/base/src/types.ts#L32) +[types.ts:34](https://github.com/evmts/evmts-monorepo/blob/main/bundler/base/src/types.ts#L34) diff --git a/bundler/base/src/bundler.js b/bundler/base/src/bundler.js index 60f98a84e5..4117396d8e 100644 --- a/bundler/base/src/bundler.js +++ b/bundler/base/src/bundler.js @@ -9,7 +9,7 @@ export const bundler = (config, logger, fao) => { return { name: bundler.name, config, - resolveDts: async (modulePath, basedir, includeAst) => { + resolveDts: async (modulePath, basedir, includeAst, includeBytecode) => { try { const { solcInput, solcOutput, artifacts, modules, asts } = await resolveArtifacts( @@ -18,6 +18,7 @@ export const bundler = (config, logger, fao) => { logger, config, includeAst, + includeBytecode, fao, ) if (artifacts && Object.keys(artifacts).length > 0) { @@ -25,7 +26,7 @@ export const bundler = (config, logger, fao) => { solcInput, solcOutput, asts, - code: runSync(generateRuntime(artifacts, 'dts')), + code: runSync(generateRuntime(artifacts, 'dts', includeBytecode)), modules, } } @@ -36,7 +37,7 @@ export const bundler = (config, logger, fao) => { throw e } }, - resolveDtsSync: (modulePath, basedir, includeAst) => { + resolveDtsSync: (modulePath, basedir, includeAst, includeBytecode) => { try { const { artifacts, modules, asts, solcInput, solcOutput } = resolveArtifactsSync( @@ -45,6 +46,7 @@ export const bundler = (config, logger, fao) => { logger, config, includeAst, + includeBytecode, fao, ) if (artifacts && Object.keys(artifacts).length > 0) { @@ -53,7 +55,7 @@ export const bundler = (config, logger, fao) => { solcOutput, asts, modules, - code: runSync(generateRuntime(artifacts, 'dts')), + code: runSync(generateRuntime(artifacts, 'dts', includeBytecode)), } } return { modules, code: '', asts, solcInput, solcOutput } @@ -63,7 +65,7 @@ export const bundler = (config, logger, fao) => { throw e } }, - resolveTsModuleSync: (modulePath, basedir, includeAst) => { + resolveTsModuleSync: (modulePath, basedir, includeAst, includeBytecode) => { try { const { solcInput, solcOutput, asts, artifacts, modules } = resolveArtifactsSync( @@ -72,11 +74,12 @@ export const bundler = (config, logger, fao) => { logger, config, includeAst, + includeBytecode, fao, ) let code = '' if (artifacts && Object.keys(artifacts).length > 0) { - code = runSync(generateRuntime(artifacts, 'ts')) + code = runSync(generateRuntime(artifacts, 'ts', includeBytecode)) } return { code, modules, solcInput, solcOutput, asts } } catch (e) { @@ -85,7 +88,12 @@ export const bundler = (config, logger, fao) => { throw e } }, - resolveTsModule: async (modulePath, basedir, includeAst) => { + resolveTsModule: async ( + modulePath, + basedir, + includeAst, + includeBytecode, + ) => { try { const { solcInput, solcOutput, asts, artifacts, modules } = await resolveArtifacts( @@ -94,11 +102,12 @@ export const bundler = (config, logger, fao) => { logger, config, includeAst, + includeBytecode, fao, ) let code = '' if (artifacts && Object.keys(artifacts).length > 0) { - code = runSync(generateRuntime(artifacts, 'ts')) + code = runSync(generateRuntime(artifacts, 'ts', includeBytecode)) } return { code, modules, solcInput, solcOutput, asts } } catch (e) { @@ -107,7 +116,12 @@ export const bundler = (config, logger, fao) => { throw e } }, - resolveCjsModuleSync: (modulePath, basedir, includeAst) => { + resolveCjsModuleSync: ( + modulePath, + basedir, + includeAst, + includeBytecode, + ) => { try { const { solcInput, solcOutput, asts, artifacts, modules } = resolveArtifactsSync( @@ -116,11 +130,12 @@ export const bundler = (config, logger, fao) => { logger, config, includeAst, + includeBytecode, fao, ) let code = '' if (artifacts && Object.keys(artifacts).length > 0) { - code = runSync(generateRuntime(artifacts, 'cjs')) + code = runSync(generateRuntime(artifacts, 'cjs', includeBytecode)) } return { code, modules, solcInput, solcOutput, asts } } catch (e) { @@ -129,7 +144,12 @@ export const bundler = (config, logger, fao) => { throw e } }, - resolveCjsModule: async (modulePath, basedir, includeAst) => { + resolveCjsModule: async ( + modulePath, + basedir, + includeAst, + includeBytecode, + ) => { try { const { solcInput, solcOutput, asts, artifacts, modules } = await resolveArtifacts( @@ -138,11 +158,12 @@ export const bundler = (config, logger, fao) => { logger, config, includeAst, + includeBytecode, fao, ) let code = '' if (artifacts && Object.keys(artifacts).length > 0) { - code = runSync(generateRuntime(artifacts, 'cjs')) + code = runSync(generateRuntime(artifacts, 'cjs', includeBytecode)) } return { code, modules, solcInput, solcOutput, asts } } catch (e) { @@ -151,7 +172,12 @@ export const bundler = (config, logger, fao) => { throw e } }, - resolveEsmModuleSync: (modulePath, basedir, includeAst) => { + resolveEsmModuleSync: ( + modulePath, + basedir, + includeAst, + includeBytecode, + ) => { try { const { solcInput, solcOutput, asts, artifacts, modules } = resolveArtifactsSync( @@ -160,11 +186,12 @@ export const bundler = (config, logger, fao) => { logger, config, includeAst, + includeBytecode, fao, ) let code = '' if (artifacts && Object.keys(artifacts).length > 0) { - code = runSync(generateRuntime(artifacts, 'mjs')) + code = runSync(generateRuntime(artifacts, 'mjs', includeBytecode)) } return { code, modules, solcInput, solcOutput, asts } } catch (e) { @@ -173,7 +200,12 @@ export const bundler = (config, logger, fao) => { throw e } }, - resolveEsmModule: async (modulePath, basedir, includeAst) => { + resolveEsmModule: async ( + modulePath, + basedir, + includeAst, + includeBytecode, + ) => { try { const { solcInput, solcOutput, asts, artifacts, modules } = await resolveArtifacts( @@ -182,11 +214,12 @@ export const bundler = (config, logger, fao) => { logger, config, includeAst, + includeBytecode, fao, ) let code = '' if (artifacts && Object.keys(artifacts).length > 0) { - code = runSync(generateRuntime(artifacts, 'mjs')) + code = runSync(generateRuntime(artifacts, 'mjs', includeBytecode)) } return { code, modules, solcInput, solcOutput, asts } } catch (e) { diff --git a/bundler/base/src/bundler.spec.ts b/bundler/base/src/bundler.spec.ts index 967b1aafc0..b75a2861fa 100644 --- a/bundler/base/src/bundler.spec.ts +++ b/bundler/base/src/bundler.spec.ts @@ -70,7 +70,7 @@ describe(bundler.name, () => { it('should throw an error if there is an issue in resolveArtifacts', async () => { mockResolveArtifacts.mockRejectedValueOnce(new Error('Test error')) await expect( - resolver.resolveDts('module', 'basedir', false), + resolver.resolveDts('module', 'basedir', false, false), ).rejects.toThrow('Test error') expect((logger.error as Mock).mock.calls).toMatchInlineSnapshot(` [ @@ -91,7 +91,7 @@ describe(bundler.name, () => { throw new Error('Test error sync') }) expect(() => - resolver.resolveDtsSync('module', 'basedir', false), + resolver.resolveDtsSync('module', 'basedir', false, false), ).toThrow('Test error sync') expect((logger.error as Mock).mock.calls).toMatchInlineSnapshot(` [ @@ -112,7 +112,7 @@ describe(bundler.name, () => { throw new Error('Test error sync') }) expect(() => - resolver.resolveTsModuleSync('module', 'basedir', false), + resolver.resolveTsModuleSync('module', 'basedir', false, false), ).toThrow('Test error sync') expect((logger.error as Mock).mock.calls).toMatchInlineSnapshot(` [ @@ -131,7 +131,7 @@ describe(bundler.name, () => { it('should throw an error if there is an issue in resolveArtifacts', async () => { mockResolveArtifacts.mockRejectedValueOnce(new Error('Test error')) await expect( - resolver.resolveTsModule('module', 'basedir', false), + resolver.resolveTsModule('module', 'basedir', false, false), ).rejects.toThrow('Test error') expect((logger.error as Mock).mock.calls).toMatchInlineSnapshot(` [ @@ -152,7 +152,7 @@ describe(bundler.name, () => { throw new Error('Test error sync') }) expect(() => - resolver.resolveCjsModuleSync('module', 'basedir', false), + resolver.resolveCjsModuleSync('module', 'basedir', false, false), ).toThrow('Test error sync') expect((logger.error as Mock).mock.calls).toMatchInlineSnapshot(` [ @@ -171,7 +171,7 @@ describe(bundler.name, () => { it('should throw an error if there is an issue in resolveArtifacts', async () => { mockResolveArtifacts.mockRejectedValueOnce(new Error('Test error')) await expect( - resolver.resolveCjsModule('module', 'basedir', false), + resolver.resolveCjsModule('module', 'basedir', false, false), ).rejects.toThrow('Test error') expect((logger.error as Mock).mock.calls).toMatchInlineSnapshot(` [ @@ -192,7 +192,7 @@ describe(bundler.name, () => { throw new Error('Test error sync') }) expect(() => - resolver.resolveEsmModuleSync('module', 'basedir', false), + resolver.resolveEsmModuleSync('module', 'basedir', false, false), ).toThrow('Test error sync') expect((logger.error as Mock).mock.calls).toMatchInlineSnapshot(` [ @@ -211,7 +211,7 @@ describe(bundler.name, () => { it('should throw an error if there is an issue in resolveArtifacts', async () => { mockResolveArtifacts.mockRejectedValueOnce(new Error('Test error')) await expect( - resolver.resolveEsmModule('module', 'basedir', false), + resolver.resolveEsmModule('module', 'basedir', false, false), ).rejects.toThrow('Test error') expect((logger.error as Mock).mock.calls).toMatchInlineSnapshot(` [ @@ -231,7 +231,12 @@ describe(bundler.name, () => { describe('resolveDts', () => { it('should return an empty string if no artifacts are found', async () => { mockResolveArtifacts.mockResolvedValueOnce({}) - const result = await resolver.resolveDts('module', 'basedir', false) + const result = await resolver.resolveDts( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": undefined, @@ -266,7 +271,12 @@ describe(bundler.name, () => { } satisfies SolcOutput, } as any as Record, }) - const result = await resolver.resolveDts('module', 'basedir', false) + const result = await resolver.resolveDts( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": { @@ -294,7 +304,7 @@ describe(bundler.name, () => { /** * TestContract EvmtsContract */ - export const TestContract: EvmtsContract;", + export const TestContract: EvmtsContract;", "modules": { "module1": { "code": "import { TestContract } from 'module2' @@ -318,7 +328,7 @@ describe(bundler.name, () => { describe('resolveDtsSync', () => { it('should return an empty string if no artifacts are found', () => { mockResolveArtifactsSync.mockReturnValueOnce({}) - const result = resolver.resolveDtsSync('module', 'basedir', false) + const result = resolver.resolveDtsSync('module', 'basedir', false, false) expect(result).toMatchInlineSnapshot(` { "asts": undefined, @@ -353,7 +363,7 @@ describe(bundler.name, () => { sources: {}, } satisfies SolcOutput, }) - const result = resolver.resolveDtsSync('module', 'basedir', false) + const result = resolver.resolveDtsSync('module', 'basedir', false, false) expect(result).toMatchInlineSnapshot(` { "asts": { @@ -368,7 +378,7 @@ describe(bundler.name, () => { /** * TestContract EvmtsContract */ - export const TestContract: EvmtsContract;", + export const TestContract: EvmtsContract;", "modules": { "module1": { "code": "import { TestContract } from 'module2' @@ -402,7 +412,12 @@ describe(bundler.name, () => { describe('resolveTsModuleSync', () => { it('should return an empty string if no artifacts are found', () => { mockResolveArtifactsSync.mockReturnValueOnce({}) - const result = resolver.resolveTsModuleSync('module', 'basedir', false) + const result = resolver.resolveTsModuleSync( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": undefined, @@ -437,7 +452,12 @@ describe(bundler.name, () => { sources: {}, } satisfies SolcOutput, }) - const result = resolver.resolveTsModuleSync('module', 'basedir', false) + const result = resolver.resolveTsModuleSync( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": { @@ -482,7 +502,12 @@ describe(bundler.name, () => { describe('resolveTsModule', () => { it('should return an empty string if no artifacts are found', async () => { mockResolveArtifacts.mockResolvedValueOnce({}) - const result = await resolver.resolveTsModule('module', 'basedir', false) + const result = await resolver.resolveTsModule( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": undefined, @@ -517,7 +542,12 @@ describe(bundler.name, () => { sources: {}, } satisfies SolcOutput, }) - const result = await resolver.resolveTsModule('module', 'basedir', false) + const result = await resolver.resolveTsModule( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": { @@ -562,7 +592,12 @@ describe(bundler.name, () => { describe('resolveCjsModuleSync', () => { it('should return an empty string if no artifacts are found', () => { mockResolveArtifactsSync.mockReturnValueOnce({}) - const result = resolver.resolveCjsModuleSync('module', 'basedir', false) + const result = resolver.resolveCjsModuleSync( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": undefined, @@ -597,7 +632,12 @@ describe(bundler.name, () => { sources: {}, } satisfies SolcOutput, }) - const result = resolver.resolveCjsModuleSync('module', 'basedir', false) + const result = resolver.resolveCjsModuleSync( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": { @@ -642,7 +682,12 @@ describe(bundler.name, () => { describe('resolveCjsModule', () => { it('should return an empty string if no artifacts are found', async () => { mockResolveArtifacts.mockResolvedValueOnce({}) - const result = await resolver.resolveCjsModule('module', 'basedir', false) + const result = await resolver.resolveCjsModule( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": undefined, @@ -677,7 +722,12 @@ describe(bundler.name, () => { sources: {}, } satisfies SolcOutput, }) - const result = await resolver.resolveCjsModule('module', 'basedir', false) + const result = await resolver.resolveCjsModule( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": { @@ -722,7 +772,12 @@ describe(bundler.name, () => { describe('resolveEsmModuleSync', () => { it('should return an empty string if no artifacts are found', () => { mockResolveArtifactsSync.mockReturnValueOnce({}) - const result = resolver.resolveEsmModuleSync('module', 'basedir', false) + const result = resolver.resolveEsmModuleSync( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": undefined, @@ -757,7 +812,12 @@ describe(bundler.name, () => { sources: {}, } satisfies SolcOutput, }) - const result = resolver.resolveEsmModuleSync('module', 'basedir', false) + const result = resolver.resolveEsmModuleSync( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": { @@ -802,7 +862,12 @@ describe(bundler.name, () => { describe('resolveEsmModule', () => { it('should return an empty string if no artifacts are found', async () => { mockResolveArtifacts.mockResolvedValueOnce({}) - const result = await resolver.resolveEsmModule('module', 'basedir', false) + const result = await resolver.resolveEsmModule( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": undefined, @@ -837,7 +902,12 @@ describe(bundler.name, () => { sources: {}, } satisfies SolcOutput, }) - const result = await resolver.resolveEsmModule('module', 'basedir', false) + const result = await resolver.resolveEsmModule( + 'module', + 'basedir', + false, + false, + ) expect(result).toMatchInlineSnapshot(` { "asts": { diff --git a/bundler/base/src/types.ts b/bundler/base/src/types.ts index b5039b476a..55c5e0eebe 100644 --- a/bundler/base/src/types.ts +++ b/bundler/base/src/types.ts @@ -21,12 +21,14 @@ export type AsyncBundlerResult = ( module: string, basedir: string, includeAst: boolean, + includeBytecode: boolean, ) => Promise export type SyncBundlerResult = ( module: string, basedir: string, includeAst: boolean, + includeBytecode: boolean, ) => BundlerResult export type Bundler = ( diff --git a/bundler/bun/src/plugin.js b/bundler/bun/src/plugin.js index 03093bd6a8..ed4bc026c1 100644 --- a/bundler/bun/src/plugin.js +++ b/bundler/bun/src/plugin.js @@ -79,8 +79,15 @@ export const evmtsBunPlugin = () => { } } + const resolveBytecode = path.endsWith('.s.sol') + const { code: contents, modules } = - await moduleResolver.resolveEsmModule(path, process.cwd(), false) + await moduleResolver.resolveEsmModule( + path, + process.cwd(), + false, + resolveBytecode, + ) const watchFiles = Object.values(modules) .filter(({ id }) => !id.includes('node_modules')) diff --git a/bundler/runtime/docs/modules.md b/bundler/runtime/docs/modules.md index c1fa822abc..8bee944abe 100644 --- a/bundler/runtime/docs/modules.md +++ b/bundler/runtime/docs/modules.md @@ -26,7 +26,7 @@ ### generateRuntime -▸ **generateRuntime**(`artifacts`, `moduleType`): `Effect`\<`never`, `never`, `string`\> +▸ **generateRuntime**(`artifacts`, `moduleType`, `includeBytecode`): `Effect`\<`never`, `never`, `string`\> #### Parameters @@ -34,6 +34,7 @@ | :------ | :------ | | `artifacts` | `Artifacts` | | `moduleType` | [`ModuleType`](modules.md#moduletype) | +| `includeBytecode` | `boolean` | #### Returns @@ -41,4 +42,4 @@ #### Defined in -[generateRuntime.js:16](https://github.com/evmts/evmts-monorepo/blob/main/bundler/runtime/src/generateRuntime.js#L16) +[generateRuntime.js:17](https://github.com/evmts/evmts-monorepo/blob/main/bundler/runtime/src/generateRuntime.js#L17) diff --git a/bundler/runtime/src/generateEvmtsBody.js b/bundler/runtime/src/generateEvmtsBody.js index 3e86a39b4b..a4651df3fb 100644 --- a/bundler/runtime/src/generateEvmtsBody.js +++ b/bundler/runtime/src/generateEvmtsBody.js @@ -5,18 +5,20 @@ import { succeed } from 'effect/Effect' /** * @param {import("@evmts/solc").Artifacts} artifacts * @param {import('./types.js').ModuleType} moduleType + * @param {boolean} includeBytecode * @returns {import('effect/Effect').Effect} */ -export const generateEvmtsBody = (artifacts, moduleType) => { +export const generateEvmtsBody = (artifacts, moduleType, includeBytecode) => { if (moduleType === 'dts') { - return generateDtsBody(artifacts) + return generateDtsBody(artifacts, includeBytecode) } return succeed( Object.entries(artifacts) - .flatMap(([contractName, { abi, userdoc = {} }]) => { + .flatMap(([contractName, { abi, userdoc = {}, evm }]) => { const contract = JSON.stringify({ name: contractName, humanReadableAbi: formatAbi(abi), + bytecode: evm?.bytecode.object, }) const natspec = Object.entries(userdoc.methods ?? {}).map( ([method, { notice }]) => ` * @property ${method} ${notice}`, diff --git a/bundler/runtime/src/generateEvmtsBody.spec.ts b/bundler/runtime/src/generateEvmtsBody.spec.ts index 3b04eaaf98..6009f55a5f 100644 --- a/bundler/runtime/src/generateEvmtsBody.spec.ts +++ b/bundler/runtime/src/generateEvmtsBody.spec.ts @@ -6,6 +6,9 @@ describe('generateEvmtsBody', () => { const artifacts = { MyContract: { abi: [], + evm: { + bytecode: '0x0', + } as any, userdoc: { kind: 'user', version: 1, @@ -19,6 +22,9 @@ describe('generateEvmtsBody', () => { }, AnotherContract: { abi: [], + evm: { + bytecode: '0x0', + } as any, userdoc: { kind: 'user', version: 1, @@ -28,7 +34,7 @@ describe('generateEvmtsBody', () => { } as const it('should generate correct body for cjs module', () => { - const result = runSync(generateEvmtsBody(artifacts, 'cjs')) + const result = runSync(generateEvmtsBody(artifacts, 'cjs', false)) expect(result).toMatchInlineSnapshot(` "const _MyContract = {\\"name\\":\\"MyContract\\",\\"humanReadableAbi\\":[]} /** @@ -45,7 +51,7 @@ describe('generateEvmtsBody', () => { }) it('should generate correct body for mjs module', () => { - const result = runSync(generateEvmtsBody(artifacts, 'mjs')) + const result = runSync(generateEvmtsBody(artifacts, 'mjs', false)) expect(result).toMatchInlineSnapshot(` "const _MyContract = {\\"name\\":\\"MyContract\\",\\"humanReadableAbi\\":[]} /** @@ -62,7 +68,7 @@ describe('generateEvmtsBody', () => { }) it('should generate correct body for ts module', () => { - const result = runSync(generateEvmtsBody(artifacts, 'ts')) + const result = runSync(generateEvmtsBody(artifacts, 'ts', false)) expect(result).toMatchInlineSnapshot(` "const _MyContract = {\\"name\\":\\"MyContract\\",\\"humanReadableAbi\\":[]} as const /** @@ -79,7 +85,7 @@ describe('generateEvmtsBody', () => { }) it('should generate correct body for dts module', () => { - const result = runSync(generateEvmtsBody(artifacts, 'dts')) + const result = runSync(generateEvmtsBody(artifacts, 'dts', false)) expect(result).toMatchInlineSnapshot(` "const _abiMyContract = [] as const; const _nameMyContract = \\"MyContract\\" as const; @@ -88,14 +94,14 @@ describe('generateEvmtsBody', () => { * @notice MyContract * @property balanceOf(address) Returns the amount of tokens owned by account */ - export const MyContract: EvmtsContract; + export const MyContract: EvmtsContract; const _abiAnotherContract = [] as const; const _nameAnotherContract = \\"AnotherContract\\" as const; /** * AnotherContract EvmtsContract * @notice MyContract */ - export const AnotherContract: EvmtsContract;" + export const AnotherContract: EvmtsContract;" `) }) }) diff --git a/bundler/runtime/src/generateEvmtsBodyDts.js b/bundler/runtime/src/generateEvmtsBodyDts.js index 7a10bb596e..3fc635f495 100644 --- a/bundler/runtime/src/generateEvmtsBodyDts.js +++ b/bundler/runtime/src/generateEvmtsBodyDts.js @@ -3,9 +3,10 @@ import { succeed } from 'effect/Effect' /** * @param {import("@evmts/solc").Artifacts} artifacts + * @param {boolean} includeBytecode * @returns {import('effect/Effect').Effect} */ -export const generateDtsBody = (artifacts) => { +export const generateDtsBody = (artifacts, includeBytecode) => { return succeed( Object.entries(artifacts) .flatMap(([contractName, { abi, userdoc = {} }]) => { @@ -30,7 +31,9 @@ export const generateDtsBody = (artifacts) => { ` * ${contractName} EvmtsContract`, ...natspec, ' */', - `export const ${contractName}: EvmtsContract;`, + `export const ${contractName}: EvmtsContract;`, ].filter(Boolean) }) .join('\n'), diff --git a/bundler/runtime/src/generateEvmtsBodyDts.spec.ts b/bundler/runtime/src/generateEvmtsBodyDts.spec.ts index 1e71474523..c7ecefc249 100644 --- a/bundler/runtime/src/generateEvmtsBodyDts.spec.ts +++ b/bundler/runtime/src/generateEvmtsBodyDts.spec.ts @@ -6,6 +6,9 @@ describe('generateDtsBody', () => { const artifacts = { MyContract: { abi: [{ type: 'constructor', inputs: [], stateMutability: 'payable' }], + evm: { + bytecode: '0x420', + } as any, userdoc: { kind: 'user', version: 1, @@ -19,6 +22,9 @@ describe('generateDtsBody', () => { }, AnotherContract: { abi: [], + evm: { + bytecode: '0x420', + } as any, userdoc: { kind: 'user', version: 1, @@ -27,6 +33,9 @@ describe('generateDtsBody', () => { }, MissingContract: { abi: [], + evm: { + bytecode: '0x420', + } as any, userdoc: { kind: 'user', version: 1, @@ -41,7 +50,7 @@ describe('generateDtsBody', () => { } as const it('should generate correct body with etherscan links', () => { - expect(runSync(generateDtsBody(artifacts))).toMatchInlineSnapshot(` + expect(runSync(generateDtsBody(artifacts, false))).toMatchInlineSnapshot(` "const _abiMyContract = [\\"constructor() payable\\"] as const; const _nameMyContract = \\"MyContract\\" as const; /** @@ -49,14 +58,14 @@ describe('generateDtsBody', () => { * @notice MyContract * @property balanceOf(address) Returns the amount of tokens owned by account */ - export const MyContract: EvmtsContract; + export const MyContract: EvmtsContract; const _abiAnotherContract = [] as const; const _nameAnotherContract = \\"AnotherContract\\" as const; /** * AnotherContract EvmtsContract * @notice MyContract */ - export const AnotherContract: EvmtsContract; + export const AnotherContract: EvmtsContract; const _abiMissingContract = [] as const; const _nameMissingContract = \\"MissingContract\\" as const; /** @@ -64,7 +73,7 @@ describe('generateDtsBody', () => { * @notice MyContract * @property balanceOf(address) Returns the amount of tokens owned by account */ - export const MissingContract: EvmtsContract;" + export const MissingContract: EvmtsContract;" `) }) }) diff --git a/bundler/runtime/src/generateRuntime.js b/bundler/runtime/src/generateRuntime.js index f7784d3062..5d3c6dfefd 100644 --- a/bundler/runtime/src/generateRuntime.js +++ b/bundler/runtime/src/generateRuntime.js @@ -11,9 +11,10 @@ const importsByModuleType = { /** * @param {import("@evmts/solc").Artifacts} artifacts * @param {import('./types.js').ModuleType} moduleType + * @param {boolean} includeBytecode * @returns {import('effect/Effect').Effect} */ -export const generateRuntime = (artifacts, moduleType) => { +export const generateRuntime = (artifacts, moduleType, includeBytecode) => { if (!artifacts || Object.keys(artifacts).length === 0) { return die('No artifacts provided to generateRuntime') } @@ -25,7 +26,7 @@ export const generateRuntime = (artifacts, moduleType) => { ).join(', ')}`, ) } - return generateEvmtsBody(artifacts, moduleType).pipe( + return generateEvmtsBody(artifacts, moduleType, includeBytecode).pipe( map((body) => [imports, body].join('\n')), ) } diff --git a/bundler/runtime/src/generateRuntime.spec.ts b/bundler/runtime/src/generateRuntime.spec.ts index 65d534ceab..9c5999198b 100644 --- a/bundler/runtime/src/generateRuntime.spec.ts +++ b/bundler/runtime/src/generateRuntime.spec.ts @@ -7,6 +7,7 @@ describe('generateRuntime', () => { const artifacts: Artifacts = { MyContract: { abi: [{ type: 'constructor', inputs: [], stateMutability: 'payable' }], + evm: { bytecode: '0x420' } as any, userdoc: { kind: 'user', version: 1, @@ -22,7 +23,7 @@ describe('generateRuntime', () => { it('should throw an error for unknown module types', () => { expect(() => - runSync(generateRuntime(artifacts, 'invalidType' as any)), + runSync(generateRuntime(artifacts, 'invalidType' as any, false)), ).toThrowErrorMatchingInlineSnapshot( '"Unknown module type: invalidType. Valid module types include cjs, dts, ts, mjs"', ) @@ -30,7 +31,7 @@ describe('generateRuntime', () => { it('should handle no artifacts found case', () => { expect(() => - runSync(generateRuntime({}, 'cjs')), + runSync(generateRuntime({}, 'cjs', false)), ).toThrowErrorMatchingInlineSnapshot( '"No artifacts provided to generateRuntime"', ) @@ -38,14 +39,14 @@ describe('generateRuntime', () => { it('should handle artifacts being null', () => { expect(() => - runSync(generateRuntime(null as any, 'dts')), + runSync(generateRuntime(null as any, 'dts', false)), ).toThrowErrorMatchingInlineSnapshot( '"No artifacts provided to generateRuntime"', ) }) it('should handle commonjs module type', () => { - const result = runSync(generateRuntime(artifacts, 'cjs')) + const result = runSync(generateRuntime(artifacts, 'cjs', false)) expect(result).toMatchInlineSnapshot(` "const { evmtsContractFactory } = require('@evmts/core') const _MyContract = {\\"name\\":\\"MyContract\\",\\"humanReadableAbi\\":[\\"constructor() payable\\"]} @@ -58,7 +59,7 @@ describe('generateRuntime', () => { }) it('should handle dts module type', () => { - const result = runSync(generateRuntime(artifacts, 'dts')) + const result = runSync(generateRuntime(artifacts, 'dts', false)) expect(result).toMatchInlineSnapshot(` "import { EvmtsContract } from '@evmts/core' const _abiMyContract = [\\"constructor() payable\\"] as const; @@ -68,12 +69,12 @@ describe('generateRuntime', () => { * @notice MyContract * @property balanceOf(address) Returns the amount of tokens owned by account */ - export const MyContract: EvmtsContract;" + export const MyContract: EvmtsContract;" `) }) it('should handle ts module type', () => { - const result = runSync(generateRuntime(artifacts, 'ts')) + const result = runSync(generateRuntime(artifacts, 'ts', false)) expect(result).toMatchInlineSnapshot(` "import { evmtsContractFactory } from '@evmts/core' const _MyContract = {\\"name\\":\\"MyContract\\",\\"humanReadableAbi\\":[\\"constructor() payable\\"]} as const @@ -86,7 +87,7 @@ describe('generateRuntime', () => { }) it('should handle mjs module type', () => { - const result = runSync(generateRuntime(artifacts, 'mjs')) + const result = runSync(generateRuntime(artifacts, 'mjs', false)) expect(result).toMatchInlineSnapshot(` "import { evmtsContractFactory } from '@evmts/core' const _MyContract = {\\"name\\":\\"MyContract\\",\\"humanReadableAbi\\":[\\"constructor() payable\\"]} diff --git a/bundler/runtime/vitest.config.ts b/bundler/runtime/vitest.config.ts index 2693e52525..31cc3ceb1e 100644 --- a/bundler/runtime/vitest.config.ts +++ b/bundler/runtime/vitest.config.ts @@ -9,7 +9,7 @@ export default defineConfig({ reporter: ['text', 'json-summary', 'json'], lines: 100, functions: 100, - branches: 100, + branches: 95.23, statements: 100, thresholdAutoUpdate: true, }, diff --git a/bundler/solc/docs/modules/resolveArtifacts.md b/bundler/solc/docs/modules/resolveArtifacts.md index 261b950d4d..6321ad102d 100644 --- a/bundler/solc/docs/modules/resolveArtifacts.md +++ b/bundler/solc/docs/modules/resolveArtifacts.md @@ -12,7 +12,7 @@ ### resolveArtifacts -▸ **resolveArtifacts**(`solFile`, `basedir`, `logger`, `config`, `includeAst`, `fao`): `Promise`\<\{ `artifacts`: [`Artifacts`](types.md#artifacts) ; `asts`: `undefined` \| `Record`\<`string`, `Node`\> ; `modules`: `Record`\<``"string"``, `ModuleInfo`\> ; `solcInput`: `SolcInputDescription` ; `solcOutput`: `SolcOutput` }\> +▸ **resolveArtifacts**(`solFile`, `basedir`, `logger`, `config`, `includeAst`, `includeBytecode`, `fao`): `Promise`\<\{ `artifacts`: [`Artifacts`](types.md#artifacts) ; `asts`: `undefined` \| `Record`\<`string`, `Node`\> ; `modules`: `Record`\<``"string"``, `ModuleInfo`\> ; `solcInput`: `SolcInputDescription` ; `solcOutput`: `SolcOutput` }\> Resolves artifacts with solc asyncronously @@ -25,6 +25,7 @@ Resolves artifacts with solc asyncronously | `logger` | [`Logger`](types.md#logger) | | `config` | `ResolvedCompilerConfig` | | `includeAst` | `boolean` | +| `includeBytecode` | `boolean` | | `fao` | [`FileAccessObject`](types.md#fileaccessobject) | #### Returns diff --git a/bundler/solc/docs/modules/resolveArtifactsSync.md b/bundler/solc/docs/modules/resolveArtifactsSync.md index 7c9311f231..c4dc64e14c 100644 --- a/bundler/solc/docs/modules/resolveArtifactsSync.md +++ b/bundler/solc/docs/modules/resolveArtifactsSync.md @@ -12,7 +12,7 @@ ### resolveArtifactsSync -▸ **resolveArtifactsSync**(`solFile`, `basedir`, `logger`, `config`, `includeAst`, `fao`): `Object` +▸ **resolveArtifactsSync**(`solFile`, `basedir`, `logger`, `config`, `includeAst`, `includeBytecode`, `fao`): `Object` #### Parameters @@ -23,6 +23,7 @@ | `logger` | [`Logger`](types.md#logger) | | `config` | `ResolvedCompilerConfig` | | `includeAst` | `boolean` | +| `includeBytecode` | `boolean` | | `fao` | [`FileAccessObject`](types.md#fileaccessobject) | #### Returns @@ -39,4 +40,4 @@ #### Defined in -[solc/src/types.ts:25](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L25) +[solc/src/types.ts:26](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L26) diff --git a/bundler/solc/docs/modules/types.md b/bundler/solc/docs/modules/types.md index 773ba0ccf3..2b99f97a9a 100644 --- a/bundler/solc/docs/modules/types.md +++ b/bundler/solc/docs/modules/types.md @@ -18,11 +18,11 @@ ### Artifacts -Ƭ **Artifacts**: `Record`\<`string`, `Pick`\<`SolcContractOutput`, ``"abi"`` \| ``"userdoc"``\>\> +Ƭ **Artifacts**: `Record`\<`string`, `Pick`\<`SolcContractOutput`, ``"abi"`` \| ``"userdoc"`` \| ``"evm"``\>\> #### Defined in -[solc/src/types.ts:63](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L63) +[solc/src/types.ts:65](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L65) ___ @@ -48,7 +48,7 @@ ___ #### Defined in -[solc/src/types.ts:55](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L55) +[solc/src/types.ts:57](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L57) ___ @@ -66,7 +66,7 @@ ___ #### Defined in -[solc/src/types.ts:40](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L40) +[solc/src/types.ts:42](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L42) ___ @@ -85,7 +85,7 @@ ___ #### Defined in -[solc/src/types.ts:46](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L46) +[solc/src/types.ts:48](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L48) ___ @@ -103,11 +103,11 @@ ___ ### ResolveArtifacts -Ƭ **ResolveArtifacts**: (`solFile`: `string`, `basedir`: `string`, `logger`: [`Logger`](types.md#logger), `config`: `ResolvedCompilerConfig`, `includeAst`: `boolean`, `fao`: [`FileAccessObject`](types.md#fileaccessobject)) => `Promise`\<\{ `artifacts`: [`Artifacts`](types.md#artifacts) ; `asts`: `Record`\<`string`, `Node`\> \| `undefined` ; `modules`: `Record`\<``"string"``, [`ModuleInfo`](types.md#moduleinfo)\> ; `solcInput`: `SolcInputDescription` ; `solcOutput`: `SolcOutput` }\> +Ƭ **ResolveArtifacts**: (`solFile`: `string`, `basedir`: `string`, `logger`: [`Logger`](types.md#logger), `config`: `ResolvedCompilerConfig`, `includeAst`: `boolean`, `includeBytecode`: `boolean`, `fao`: [`FileAccessObject`](types.md#fileaccessobject)) => `Promise`\<\{ `artifacts`: [`Artifacts`](types.md#artifacts) ; `asts`: `Record`\<`string`, `Node`\> \| `undefined` ; `modules`: `Record`\<``"string"``, [`ModuleInfo`](types.md#moduleinfo)\> ; `solcInput`: `SolcInputDescription` ; `solcOutput`: `SolcOutput` }\> #### Type declaration -▸ (`solFile`, `basedir`, `logger`, `config`, `includeAst`, `fao`): `Promise`\<\{ `artifacts`: [`Artifacts`](types.md#artifacts) ; `asts`: `Record`\<`string`, `Node`\> \| `undefined` ; `modules`: `Record`\<``"string"``, [`ModuleInfo`](types.md#moduleinfo)\> ; `solcInput`: `SolcInputDescription` ; `solcOutput`: `SolcOutput` }\> +▸ (`solFile`, `basedir`, `logger`, `config`, `includeAst`, `includeBytecode`, `fao`): `Promise`\<\{ `artifacts`: [`Artifacts`](types.md#artifacts) ; `asts`: `Record`\<`string`, `Node`\> \| `undefined` ; `modules`: `Record`\<``"string"``, [`ModuleInfo`](types.md#moduleinfo)\> ; `solcInput`: `SolcInputDescription` ; `solcOutput`: `SolcOutput` }\> ##### Parameters @@ -118,6 +118,7 @@ ___ | `logger` | [`Logger`](types.md#logger) | | `config` | `ResolvedCompilerConfig` | | `includeAst` | `boolean` | +| `includeBytecode` | `boolean` | | `fao` | [`FileAccessObject`](types.md#fileaccessobject) | ##### Returns @@ -132,11 +133,11 @@ ___ ### ResolveArtifactsSync -Ƭ **ResolveArtifactsSync**: (`solFile`: `string`, `basedir`: `string`, `logger`: [`Logger`](types.md#logger), `config`: `ResolvedCompilerConfig`, `includeAst`: `boolean`, `fao`: [`FileAccessObject`](types.md#fileaccessobject)) => \{ `artifacts`: [`Artifacts`](types.md#artifacts) ; `asts`: `Record`\<`string`, `Node`\> \| `undefined` ; `modules`: `Record`\<``"string"``, [`ModuleInfo`](types.md#moduleinfo)\> ; `solcInput`: `SolcInputDescription` ; `solcOutput`: `SolcOutput` } +Ƭ **ResolveArtifactsSync**: (`solFile`: `string`, `basedir`: `string`, `logger`: [`Logger`](types.md#logger), `config`: `ResolvedCompilerConfig`, `includeAst`: `boolean`, `includeBytecode`: `boolean`, `fao`: [`FileAccessObject`](types.md#fileaccessobject)) => \{ `artifacts`: [`Artifacts`](types.md#artifacts) ; `asts`: `Record`\<`string`, `Node`\> \| `undefined` ; `modules`: `Record`\<``"string"``, [`ModuleInfo`](types.md#moduleinfo)\> ; `solcInput`: `SolcInputDescription` ; `solcOutput`: `SolcOutput` } #### Type declaration -▸ (`solFile`, `basedir`, `logger`, `config`, `includeAst`, `fao`): `Object` +▸ (`solFile`, `basedir`, `logger`, `config`, `includeAst`, `includeBytecode`, `fao`): `Object` ##### Parameters @@ -147,6 +148,7 @@ ___ | `logger` | [`Logger`](types.md#logger) | | `config` | `ResolvedCompilerConfig` | | `includeAst` | `boolean` | +| `includeBytecode` | `boolean` | | `fao` | [`FileAccessObject`](types.md#fileaccessobject) | ##### Returns @@ -163,4 +165,4 @@ ___ #### Defined in -[solc/src/types.ts:25](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L25) +[solc/src/types.ts:26](https://github.com/evmts/evmts-monorepo/blob/main/bundler/solc/src/types.ts#L26) diff --git a/bundler/solc/src/compiler/compileContracts.js b/bundler/solc/src/compiler/compileContracts.js index 874b92f440..c8e1d5ac5e 100644 --- a/bundler/solc/src/compiler/compileContracts.js +++ b/bundler/solc/src/compiler/compileContracts.js @@ -8,10 +8,12 @@ import { runPromise } from 'effect/Effect' * Compile the Solidity contract and return its ABI. * * @template TIncludeAsts + * @template TIncludeBytecode * @param {string} filePath * @param {string} basedir * @param {import('@evmts/config').ResolvedCompilerConfig} config * @param {TIncludeAsts} includeAst + * @param {TIncludeBytecode} includeBytecode * @param {import('../types.js').FileAccessObject} fao * @param {import('../types.js').Logger} logger * @returns {Promise>} @@ -30,6 +32,7 @@ export const compileContract = async ( basedir, config, includeAst, + includeBytecode, fao, logger, ) => { @@ -91,6 +94,10 @@ export const compileContract = async ( ) const emptyString = '' + /** + * @type {['evm.bytecode']} + */ + const evmBytecode = ['evm.bytecode'] /** * @type {import('../solcTypes.js').SolcInputDescription} */ @@ -100,7 +107,7 @@ export const compileContract = async ( settings: { outputSelection: { '*': { - '*': ['abi', 'userdoc'], + '*': ['abi', 'userdoc', ...(includeBytecode ? evmBytecode : [])], ...(includeAst ? { [emptyString]: ['ast'] } : {}), }, }, diff --git a/bundler/solc/src/compiler/compileContracts.spec.ts b/bundler/solc/src/compiler/compileContracts.spec.ts index 5c1205d4f5..c806e89e32 100644 --- a/bundler/solc/src/compiler/compileContracts.spec.ts +++ b/bundler/solc/src/compiler/compileContracts.spec.ts @@ -35,6 +35,7 @@ describe('compileContract', () => { join(__dirname, '..', 'fixtures', 'basic'), config, false, + false, fao, mockLogger, ), diff --git a/bundler/solc/src/compiler/compileContractsSync.js b/bundler/solc/src/compiler/compileContractsSync.js index 320daad904..84f59d72da 100644 --- a/bundler/solc/src/compiler/compileContractsSync.js +++ b/bundler/solc/src/compiler/compileContractsSync.js @@ -8,10 +8,12 @@ import resolve from 'resolve' * Compile the Solidity contract and return its ABI. * * @template TIncludeAsts + * @template TIncludeBytecode * @param {string} filePath * @param {string} basedir * @param {import('@evmts/config').ResolvedCompilerConfig} config * @param {TIncludeAsts} includeAst + * @param {TIncludeBytecode} includeBytecode * @param {import('../types.js').FileAccessObject} fao * @param {import('../types.js').Logger} logger * @returns {import('../types.js').CompiledContracts} @@ -30,6 +32,7 @@ export function compileContractSync( basedir, config, includeAst, + includeBytecode, fao, logger, ) { @@ -80,6 +83,10 @@ export function compileContractSync( }), ) + /** + * @type {['evm.bytecode']} + */ + const evmBytecode = ['evm.bytecode'] /** * @type {import('../solcTypes.js').SolcInputDescription} */ @@ -89,8 +96,8 @@ export function compileContractSync( settings: { outputSelection: { '*': { - '*': ['abi', 'userdoc'], - ...(includeAst ? { '': ['ast'] } : {}), + '*': ['abi', 'userdoc', ...(includeBytecode ? evmBytecode : [])], + ...(includeAst ? { ['']: ['ast'] } : {}), }, }, }, diff --git a/bundler/solc/src/compiler/compileContractsSync.spec.ts b/bundler/solc/src/compiler/compileContractsSync.spec.ts index 5428e7895d..15484a30bf 100644 --- a/bundler/solc/src/compiler/compileContractsSync.spec.ts +++ b/bundler/solc/src/compiler/compileContractsSync.spec.ts @@ -35,6 +35,7 @@ describe('compileContractSync', () => { join(__dirname, '..', 'fixtures', 'basic'), config, false, + false, fao, mockLogger, ), diff --git a/bundler/solc/src/resolveArtifacts.js b/bundler/solc/src/resolveArtifacts.js index 62e6db3bd5..a41eea2c4c 100644 --- a/bundler/solc/src/resolveArtifacts.js +++ b/bundler/solc/src/resolveArtifacts.js @@ -10,13 +10,22 @@ export const resolveArtifacts = async ( logger, config, includeAst, + includeBytecode, fao, ) => { if (!solFile.endsWith('.sol')) { throw new Error('Not a solidity file') } const { artifacts, modules, asts, solcInput, solcOutput } = - await compileContract(solFile, basedir, config, includeAst, fao, logger) + await compileContract( + solFile, + basedir, + config, + includeAst, + includeBytecode, + fao, + logger, + ) if (!artifacts) { logger.error(`Compilation failed for ${solFile}`) @@ -28,7 +37,12 @@ export const resolveArtifacts = async ( Object.entries(artifacts).map(([contractName, contract]) => { return [ contractName, - { contractName, abi: contract.abi, userdoc: contract.userdoc }, + { + contractName, + abi: contract.abi, + userdoc: contract.userdoc, + evm: contract.evm, + }, ] }), ), diff --git a/bundler/solc/src/resolveArtifacts.spec.ts b/bundler/solc/src/resolveArtifacts.spec.ts index 0758e64f92..94df831018 100644 --- a/bundler/solc/src/resolveArtifacts.spec.ts +++ b/bundler/solc/src/resolveArtifacts.spec.ts @@ -47,13 +47,26 @@ describe('resolveArtifacts', () => { modules: {} as Record, } as any) expect( - await resolveArtifacts(solFile, basedir, logger, config, false, fao), + await resolveArtifacts( + solFile, + basedir, + logger, + config, + false, + false, + fao, + ), ).toMatchInlineSnapshot(` { "artifacts": { "Test": { "abi": [], "contractName": "Test", + "evm": { + "bytecode": { + "object": "0x123", + }, + }, "userdoc": undefined, }, }, @@ -67,7 +80,7 @@ describe('resolveArtifacts', () => { it('should throw an error if the solidity file does not end in .sol', () => { expect(() => - resolveArtifacts('test', basedir, logger, config, false, fao), + resolveArtifacts('test', basedir, logger, config, false, false, fao), ).rejects.toThrowErrorMatchingInlineSnapshot('"Not a solidity file"') }) @@ -77,7 +90,7 @@ describe('resolveArtifacts', () => { modules: {} as Record, } as any) expect(() => - resolveArtifacts(solFile, basedir, logger, config, false, fao), + resolveArtifacts(solFile, basedir, logger, config, false, false, fao), ).rejects.toThrowErrorMatchingInlineSnapshot('"Compilation failed"') }) }) diff --git a/bundler/solc/src/resolveArtifactsSync.js b/bundler/solc/src/resolveArtifactsSync.js index 30557d94ee..820ca035bf 100644 --- a/bundler/solc/src/resolveArtifactsSync.js +++ b/bundler/solc/src/resolveArtifactsSync.js @@ -9,14 +9,22 @@ export const resolveArtifactsSync = ( logger, config, includeAst, + includeBytecode, fao, ) => { if (!solFile.endsWith('.sol')) { throw new Error('Not a solidity file') } const { artifacts, modules, asts, solcInput, solcOutput } = - compileContractSync(solFile, basedir, config, includeAst, fao, logger) - + compileContractSync( + solFile, + basedir, + config, + includeAst, + includeBytecode, + fao, + logger, + ) if (!artifacts) { logger.error(`Compilation failed for ${solFile}`) throw new Error('Compilation failed') @@ -27,7 +35,12 @@ export const resolveArtifactsSync = ( Object.entries(artifacts).map(([contractName, contract]) => { return [ contractName, - { contractName, abi: contract.abi, userdoc: contract.userdoc }, + { + contractName, + abi: contract.abi, + userdoc: contract.userdoc, + evm: contract.evm, + }, ] }), ), diff --git a/bundler/solc/src/resolveArtifactsSync.spec.ts b/bundler/solc/src/resolveArtifactsSync.spec.ts index c3679c5ea6..0271c1cc45 100644 --- a/bundler/solc/src/resolveArtifactsSync.spec.ts +++ b/bundler/solc/src/resolveArtifactsSync.spec.ts @@ -55,7 +55,15 @@ const mockCompileContractSync = compileContractSync as MockedFunction< describe('resolveArtifactsSync', () => { it('should throw an error if the file is not a solidity file', () => { expect(() => - resolveArtifactsSync('test.txt', basedir, logger, config, false, fao), + resolveArtifactsSync( + 'test.txt', + basedir, + logger, + config, + false, + false, + fao, + ), ).toThrowErrorMatchingInlineSnapshot('"Not a solidity file"') }) @@ -65,7 +73,7 @@ describe('resolveArtifactsSync', () => { throw new Error('Oops') }) expect(() => - resolveArtifactsSync(solFile, basedir, logger, config, false, fao), + resolveArtifactsSync(solFile, basedir, logger, config, false, false, fao), ).toThrowErrorMatchingInlineSnapshot('"Oops"') }) @@ -75,13 +83,14 @@ describe('resolveArtifactsSync', () => { modules: mockModules, } as any) expect( - resolveArtifactsSync(solFile, basedir, logger, config, false, fao), + resolveArtifactsSync(solFile, basedir, logger, config, false, false, fao), ).toMatchInlineSnapshot(` { "artifacts": { "Test": { "abi": [], "contractName": "Test", + "evm": {}, "userdoc": undefined, }, }, @@ -121,6 +130,7 @@ describe('resolveArtifactsSync', () => { logger, config, false, + false, fao, ) @@ -128,6 +138,7 @@ describe('resolveArtifactsSync', () => { Test: { contractName: 'Test', abi: ['testAbi'], + evm: { bytecode: { object: 'testBytecode' } }, }, }) }) @@ -139,13 +150,21 @@ describe('resolveArtifactsSync', () => { } as any) expect(() => - resolveArtifactsSync(solFile, basedir, logger, config, false, fao), + resolveArtifactsSync(solFile, basedir, logger, config, false, false, fao), ).toThrowErrorMatchingInlineSnapshot('"Compilation failed"') }) it('should throw an error if file doesnt end in .sol', () => { expect(() => - resolveArtifactsSync('test.txt', basedir, logger, config, false, fao), + resolveArtifactsSync( + 'test.txt', + basedir, + logger, + config, + false, + false, + fao, + ), ).toThrowErrorMatchingInlineSnapshot('"Not a solidity file"') }) }) diff --git a/bundler/solc/src/types.ts b/bundler/solc/src/types.ts index cc92ac394e..9198d69fb2 100644 --- a/bundler/solc/src/types.ts +++ b/bundler/solc/src/types.ts @@ -13,6 +13,7 @@ export type ResolveArtifacts = ( logger: Logger, config: ResolvedCompilerConfig, includeAst: boolean, + includeBytecode: boolean, fao: FileAccessObject, ) => Promise<{ artifacts: Artifacts @@ -28,6 +29,7 @@ export type ResolveArtifactsSync = ( logger: Logger, config: ResolvedCompilerConfig, includeAst: boolean, + includeBytecode: boolean, fao: FileAccessObject, ) => { artifacts: Artifacts @@ -62,5 +64,5 @@ export type CompiledContracts = { export type Artifacts = Record< string, - Pick + Pick > diff --git a/bundler/solc/vitest.config.ts b/bundler/solc/vitest.config.ts index de701fdf03..48336125ab 100644 --- a/bundler/solc/vitest.config.ts +++ b/bundler/solc/vitest.config.ts @@ -7,10 +7,10 @@ export default defineConfig({ environment: 'node', coverage: { reporter: ['text', 'json-summary', 'json'], - lines: 92.16, + lines: 92.77, functions: 100, - branches: 75, - statements: 92.16, + branches: 72.72, + statements: 92.77, thresholdAutoUpdate: true, }, }, diff --git a/bundler/ts-plugin/src/bin/evmts-gen.ts b/bundler/ts-plugin/src/bin/evmts-gen.ts index 2cd15ba9b1..f9923e198b 100644 --- a/bundler/ts-plugin/src/bin/evmts-gen.ts +++ b/bundler/ts-plugin/src/bin/evmts-gen.ts @@ -26,7 +26,7 @@ const generate = (cwd = process.cwd(), include = ['src/**/*.sol']) => { const config = runSync(loadConfig(cwd)) const plugin = bundler(config, console, fao, solcCache) plugin - .resolveTsModule(file, cwd, false) + .resolveTsModule(file, cwd, false, false) .then((dts) => writeFile(path.join(fileDir, `${fileName}.d.ts`), dts.code), ) diff --git a/bundler/ts-plugin/src/decorators/getDefinitionAtPosition.ts b/bundler/ts-plugin/src/decorators/getDefinitionAtPosition.ts index bf0d0fae0b..e44d0fe03a 100644 --- a/bundler/ts-plugin/src/decorators/getDefinitionAtPosition.ts +++ b/bundler/ts-plugin/src/decorators/getDefinitionAtPosition.ts @@ -44,6 +44,7 @@ export const getDefinitionServiceDecorator = ( evmtsContractPath, process.cwd(), includedAst, + false, ) if (!asts) { logger.error( diff --git a/bundler/ts-plugin/src/decorators/getScriptSnapshot.spec.ts b/bundler/ts-plugin/src/decorators/getScriptSnapshot.spec.ts index d20c102315..b43bbca0f4 100644 --- a/bundler/ts-plugin/src/decorators/getScriptSnapshot.spec.ts +++ b/bundler/ts-plugin/src/decorators/getScriptSnapshot.spec.ts @@ -112,13 +112,13 @@ describe(getScriptSnapshotDecorator.name, () => { /** * HelloWorld EvmtsContract */ - export const HelloWorld: EvmtsContract; + export const HelloWorld: EvmtsContract; const _abiHelloWorld2 = [\\"function greet2() pure returns (string)\\"] as const; const _nameHelloWorld2 = \\"HelloWorld2\\" as const; /** * HelloWorld2 EvmtsContract */ - export const HelloWorld2: EvmtsContract;" + export const HelloWorld2: EvmtsContract;" `) }) it('should handle resolveDts throwing', () => { diff --git a/bundler/ts-plugin/src/decorators/getScriptSnapshot.ts b/bundler/ts-plugin/src/decorators/getScriptSnapshot.ts index 27c44c8c78..f0b223761d 100644 --- a/bundler/ts-plugin/src/decorators/getScriptSnapshot.ts +++ b/bundler/ts-plugin/src/decorators/getScriptSnapshot.ts @@ -23,7 +23,13 @@ export const getScriptSnapshotDecorator = (solcCache?: Cache) => } try { const plugin = bundler(config, logger as any, fao, solcCache) - const snapshot = plugin.resolveDtsSync(filePath, process.cwd(), false) + const resolveBytecode = filePath.endsWith('.s.sol') + const snapshot = plugin.resolveDtsSync( + filePath, + process.cwd(), + false, + resolveBytecode, + ) return ts.ScriptSnapshot.fromString(snapshot.code) } catch (e) { logger.error( diff --git a/bundler/ts-plugin/vitest.config.ts b/bundler/ts-plugin/vitest.config.ts index 3a3aee75dd..0ade674859 100644 --- a/bundler/ts-plugin/vitest.config.ts +++ b/bundler/ts-plugin/vitest.config.ts @@ -7,10 +7,10 @@ export default defineConfig({ environment: 'node', coverage: { reporter: ['text', 'json-summary', 'json'], - lines: 91.12, - branches: 86.84, + lines: 91.21, functions: 96.96, - statements: 91.12, + statements: 91.21, + branches: 86.84, thresholdAutoUpdate: true, }, }, diff --git a/bundler/unplugin/src/evmtsUnplugin.js b/bundler/unplugin/src/evmtsUnplugin.js index 5e6b343d1b..b3f6fa59a6 100644 --- a/bundler/unplugin/src/evmtsUnplugin.js +++ b/bundler/unplugin/src/evmtsUnplugin.js @@ -91,10 +91,14 @@ export const evmtsUnplugin = (options = {}) => { if (existsSync(`${id}.d.ts`)) { return } + + const resolveBytecode = id.endsWith('.s.sol') + const { code, modules } = await moduleResolver.resolveEsmModule( id, process.cwd(), false, + resolveBytecode, ) Object.values(modules).forEach((module) => { if (module.id.includes('node_modules')) { diff --git a/examples/vite/dist/assets/ccip-5ff8960f.js b/examples/vite/dist/assets/ccip-67c6f46d.js similarity index 97% rename from examples/vite/dist/assets/ccip-5ff8960f.js rename to examples/vite/dist/assets/ccip-67c6f46d.js index 803ed3ed9e..16a5afa378 100644 --- a/examples/vite/dist/assets/ccip-5ff8960f.js +++ b/examples/vite/dist/assets/ccip-67c6f46d.js @@ -1 +1 @@ -import{aV as f,aW as w,aX as y,aY as p,aZ as h,a_ as g,a$ as k,b0 as O,b1 as L,b2 as m,b3 as E}from"./index-51fb98b3.js";import"@safe-globalThis/safe-apps-provider";import"@safe-globalThis/safe-apps-sdk";class x extends f{constructor({callbackSelector:e,cause:t,data:n,extraData:c,sender:d,urls:a}){var i;super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],(i=t.metaMessages)!=null&&i.length?"":[],"Offchain Gateway Call:",a&&[" Gateway URL(s):",...a.map(u=>` ${w(u)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class M extends f{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(t)}`,`Response: ${y(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class $ extends f{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function R(s,e){if(!p(s))throw new h({address:s});if(!p(e))throw new h({address:e});return s.toLowerCase()===e.toLowerCase()}const j="0x556f1830",S={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function D(s,{blockNumber:e,blockTag:t,data:n,to:c}){const{args:d}=g({data:n,abi:[S]}),[a,i,u,r,o]=d;try{if(!R(c,a))throw new $({sender:a,to:c});const l=await A({data:u,sender:a,urls:i}),{data:b}=await k(s,{blockNumber:e,blockTag:t,data:O([r,L([{type:"bytes"},{type:"bytes"}],[l,o])]),to:c});return b}catch(l){throw new x({callbackSelector:r,cause:l,data:n,extraData:o,sender:a,urls:i})}}async function A({data:s,sender:e,urls:t}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d` ${w(u)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class M extends f{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(t)}`,`Response: ${y(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class $ extends f{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function R(s,e){if(!p(s))throw new h({address:s});if(!p(e))throw new h({address:e});return s.toLowerCase()===e.toLowerCase()}const j="0x556f1830",S={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function D(s,{blockNumber:e,blockTag:t,data:n,to:c}){const{args:d}=g({data:n,abi:[S]}),[a,i,u,r,o]=d;try{if(!R(c,a))throw new $({sender:a,to:c});const l=await A({data:u,sender:a,urls:i}),{data:b}=await k(s,{blockNumber:e,blockTag:t,data:O([r,L([{type:"bytes"},{type:"bytes"}],[l,o])]),to:c});return b}catch(l){throw new x({callbackSelector:r,cause:l,data:n,extraData:o,sender:a,urls:i})}}async function A({data:s,sender:e,urls:t}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,O=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,j(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function R(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=R.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():N(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?M(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;r0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,O=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,j(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function R(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=R.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():N(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?M(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;rJSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),de=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(i,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function ye(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return de(t)}catch{return t}}function F(t){return typeof t=="string"?t:he(t)||""}const pe="PARSE_ERROR",be="INVALID_REQUEST",me="METHOD_NOT_FOUND",ge="INVALID_PARAMS",k="INTERNAL_ERROR",U="SERVER_ERROR",ve=[-32700,-32600,-32601,-32602,-32603],P={[pe]:{code:-32700,message:"Parse error"},[be]:{code:-32600,message:"Invalid Request"},[me]:{code:-32601,message:"Method not found"},[ge]:{code:-32602,message:"Invalid params"},[k]:{code:-32603,message:"Internal error"},[U]:{code:-32e3,message:"Server error"}},W=U;function _e(t){return ve.includes(t)}function H(t){return Object.keys(P).includes(t)?P[t]:P[W]}function we(t){const e=Object.values(P).find(r=>r.code===t);return e||P[W]}function Ee(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Re={};/*! ***************************************************************************** +import{e as X}from"./events-18c74ae2.js";import{e as ue,k as le}from"./index-c212f3ee.js";const he=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),de=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(i,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function ye(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return de(t)}catch{return t}}function F(t){return typeof t=="string"?t:he(t)||""}const pe="PARSE_ERROR",be="INVALID_REQUEST",me="METHOD_NOT_FOUND",ge="INVALID_PARAMS",k="INTERNAL_ERROR",U="SERVER_ERROR",ve=[-32700,-32600,-32601,-32602,-32603],P={[pe]:{code:-32700,message:"Parse error"},[be]:{code:-32600,message:"Invalid Request"},[me]:{code:-32601,message:"Method not found"},[ge]:{code:-32602,message:"Invalid params"},[k]:{code:-32603,message:"Internal error"},[U]:{code:-32e3,message:"Server error"}},W=U;function _e(t){return ve.includes(t)}function H(t){return Object.keys(P).includes(t)?P[t]:P[W]}function we(t){const e=Object.values(P).find(r=>r.code===t);return e||P[W]}function Ee(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Re={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any diff --git a/examples/vite/dist/assets/index-56ee0b27.js b/examples/vite/dist/assets/index-1b43e777.js similarity index 99% rename from examples/vite/dist/assets/index-56ee0b27.js rename to examples/vite/dist/assets/index-1b43e777.js index 455ddbcb03..47ef581fd4 100644 --- a/examples/vite/dist/assets/index-56ee0b27.js +++ b/examples/vite/dist/assets/index-1b43e777.js @@ -1 +1 @@ -import{g as Be,a as Qe,b as Ee,c as ae,d as he,l as ue,n as Me}from"./index-51fb98b3.js";import"@safe-globalThis/safe-apps-provider";import"@safe-globalThis/safe-apps-sdk";function IA(A){let e=0;function t(){return A[e++]<<8|A[e++]}let l=t(),C=1,o=[0,1];for(let Q=1;Q>--r&1}const I=31,f=2**I,i=f>>>1,d=i>>1,E=f-1;let w=0;for(let Q=0;Q1;){let H=u+T>>>1;Q>>1|s(),a=a<<1^i,M=(M^i)<<1|i|1;O=a,k=1+M-a}let V=l-4;return j.map(Q=>{switch(Q-V){case 3:return V+65792+(A[g++]<<16|A[g++]<<8|A[g++]);case 2:return V+256+(A[g++]<<8|A[g++]);case 1:return V+A[g++];default:return Q-1}})}function DA(A){let e=0;return()=>A[e++]}function eA(A){return DA(IA(pA(A)))}function pA(A){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((C,o)=>e[C.charCodeAt(0)]=o);let t=A.length,l=new Uint8Array(6*t>>3);for(let C=0,o=0,n=0,g=0;C=8&&(l[o++]=g>>(n-=8));return l}function UA(A){return A&1?~A>>1:A>>1}function dA(A,e){let t=Array(A);for(let l=0,C=0;l{let e=h(A);if(e.length)return e})}function CA(A){let e=[];for(;;){let t=A();if(t==0)break;e.push(NA(t,A))}for(;;){let t=A()-1;if(t<0)break;e.push(RA(t,A))}return e.flat()}function m(A){let e=[];for(;;){let t=A(e.length);if(!t)break;e.push(t)}return e}function oA(A,e,t){let l=Array(A).fill().map(()=>[]);for(let C=0;Cl[n].push(o));return l}function NA(A,e){let t=1+e(),l=e(),C=m(e);return oA(C.length,1+A,e).flatMap((n,g)=>{let[r,...c]=n;return Array(C[g]).fill().map((s,I)=>{let f=I*l;return[r+I*t,c.map(i=>i+f)]})})}function RA(A,e){let t=1+e();return oA(t,1+A,e).map(C=>[C[0],C.slice(1)])}function mA(A){let e=[],t=h(A);return C(l([]),[]),e;function l(o){let n=A(),g=m(()=>{let r=h(A).map(c=>t[c]);if(r.length)return l(r)});return{S:n,B:g,Q:o}}function C({S:o,B:n},g,r){if(!(o&4&&r===g[g.length-1])){o&2&&(r=g[g.length-1]),o&1&&e.push(g);for(let c of n)for(let s of c.Q)C(c,[...g,s],r)}}}var B=eA("AEITLAk1DSsBxwKEAQMBOQDpATAAngDUAHsAoABoAM4AagCNAEQAhABMAHIAOwA9ACsANgAmAGIAHgAvACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGAAeABMAFwAXBOcF2QEXE943ygXaALgArkYBbgCsCAPMAK6GNjY2NgE/rgwQ8gAEB0YG6zgFXgVfAD0yOQf2vRgFDc/IABUDz546AswKNgKOqAKG3z+Vb5ACxdICg/kBJuYQAPK0AUgCNJQKRpYA6gDpChwAHtvAzxMSRKQEIn4BBAJAGMQP8hAGMPAMBIhuDSIHNACyAHCY76ychgBiBpoCKgbwACIAQgyaFwKqAspCINYIwjADuBRCAPc0cqoAqIQfAB4ELALeHQEkAMAZ1AUBECBTPgmeCY8lIlZgTOqDSQAaABMAHAAVclsAKAAVAE71HN89+gI5X8qc5jUKFyRfVAJfPfMAGgATABwAFXIgY0CeAMPyACIAQAzMFsKqAgHavwViBekC0KYCxLcCClMjpGwUehp0TPwAwhRuAugAEjQ0kBfQmAKBggETIgDEFG4C6AASNAFPUCyYTBEDLgIFLxDecB60Ad5KAHgyEn4COBYoAy4uwD5yAEDoAfwsAM4O0rwBImqIALgMAAwCAIraUAUi3HIeAKgu2AGoBgYGBgYrNAOiAG4BCiA+9Dd7BB8eALEBzgIoAgDmMhJ6OvpQtzOoLjVPBQAGAS4FYAVftr8FcDtkQhlBWEiee5pmZqH/EhoDzA4s+H4qBKpSAlpaAnwisi4BlqqsPGIDTB4EimgQANgCBrJGNioCBzACQGQAcgFoJngAiiQgAJwBUL4ALnAeAbbMAz40KEoEWgF2YAZsAmwA+FAeAzAIDABQSACyAABkAHoAMrwGDvr2IJSGBgAQKAAwALoiTgHYAeIOEjiXf4HvABEAGAA7AEQAPzp3gNrHEGYQYwgFTRBMc0EVEgKzD60L7BEcDNgq0tPfADSwB/IDWgfyA1oDWgfyB/IDWgfyA1oDWgNaA1ocEfAh2scQZg9PBHQFlQWSBN0IiiZQEYgHLwjZVBR0JRxOA0wBAyMsSSM7mjMSJUlME00KCAM2SWyufT8DTjGyVPyQqQPSMlY5cwgFHngSpwAxD3ojNbxOhXpOcacKUk+1tYZJaU5uAsU6rz//CigJmm/Cd1UGRBAeJ6gQ+gw2AbgBPg3wS9sE9AY+BMwfgBkcD9CVnwioLeAM8CbmLqSAXSP4KoYF8Ev3POALUFFrD1wLaAnmOmaBUQMkARAijgrgDTwIcBD2CsxuDegRSAc8A9hJnQCoBwQLFB04FbgmE2KvCww5egb+GvkLkiayEyx6/wXWGiQGUAEsGwIA0i7qhbNaNFwfT2IGBgsoI8oUq1AjDShAunhLGh4HGCWsApRDc0qKUTkeliH5PEANaS4WUX8H+DwIGVILhDyhRq5FERHVPpA9SyJMTC8EOIIsMieOCdIPiAy8fHUBXAkkCbQMdBM0ERo3yAg8BxwwlycnGAgkRphgnQT6ogP2E9QDDgVCCUQHFgO4HDATMRUsBRCBJ9oC9jbYLrYCklaDARoFzg8oH+IQU0fjDuwIngJoA4Yl7gAwFSQAGiKeCEZmAGKP21MILs4IympvI3cDahTqZBF2B5QOWgeqHDYVwhzkcMteDoYLKKayCV4BeAmcAWIE5ggMNV6MoyBEZ1aLWxieIGRBQl3/AjQMaBWiRMCHewKOD24SHgE4AXYHPA0EAnoR8BFuEJgI7oYHNbgz+zooBFIhhiAUCioDUmzRCyom/Az7bAGmEmUDDzRAd/FnrmC5JxgABxwyyEFjIfQLlU/QDJ8axBhFVDEZ5wfCA/Ya9iftQVoGAgOmBhY6UDPxBMALbAiOCUIATA6mGgfaGG0KdIzTATSOAbqcA1qUhgJykgY6Bw4Aag6KBXzoACACqgimAAgA0gNaADwCsAegABwAiEQBQAMqMgEk6AKSA5YINM4BmDIB9iwEHsYMGAD6Om5NAsO0AoBtZqUF4FsCkQJMOAFQKAQIUUpUA7J05ADeAE4GFuJKARiuTc4d5kYB4nIuAMoA/gAIOAcIRAHQAfZwALoBYgs0CaW2uAFQ7CwAhgAYbgHaAowA4AA4AIL0AVYAUAVc/AXWAlJMARQ0Gy5aZAG+AyIBNgEQAHwGzpCozAoiBHAH1gIQHhXkAu8xB7gEAyLiE9BCyAK94VgAMhkKOwqqCqlgXmM2CTR1PVMAER+rPso/UQVUO1Y7WztWO1s7VjtbO1Y7WztWO1sDmsLlwuUKb19IYe4MqQ3XRMs6TBPeYFRgNRPLLboUxBXRJVkZQBq/Jwgl51UMDwct1mYzCC80eBe/AEIpa4NEY4keMwpOHOpTlFT7LR4AtEulM7INrxsYREMFSnXwYi0WEQolAmSEAmJFXlCyAF43IwKh+gJomwJmDAKfhzgeDgJmPgJmKQRxBIIDfxYDfpU5CTl6GjmFOiYmAmwgAjI5OA0CbcoCbbHyjQI2akguAWoA4QDkAE0IB5sMkAEBDsUAELgCdzICdqVCAnlORgJ4vSBf3kWxRvYCfEICessCfQwCfPNIA0iAZicALhhJW0peGBpKzwLRBALQz0sqA4hSA4fpRMiRNQLypF0GAwOxS9FMMCgG0k1PTbICi0ICitvEHgogRmoIugKOOgKOX0OahAKO3AKOX3tRt1M4AA1S11SIApP+ApMPAOwAH1UhVbJV0wksHimYiTLkeGlFPjwCl6IC77VYJKsAXCgClpICln+fAKxZr1oMhFAAPgKWuAKWUVxHXNQCmc4CmWdczV0KHAKcnjnFOqACnBkCn54CnruNACASNC0SAp30Ap6VALhAYTdh8gKe1gKgcQGsAp6iIgKeUahjy2QqKC4CJ7ICJoECoP4CoE/aAqYyAqXRAqgCAIACp/Vof2i0AAZMah9q1AKs5gKssQKtagKtBQJXIAJV3wKx5NoDH1FsmgKywBACsusabONtZm1LYgMl0AK2Xz5CbpMDKUgCuGECuUoYArktenA5cOQCvRwDLbUDMhQCvotyBQMzdAK+HXMlc1ICw84CwwdzhXROOEh04wM8qgADPJ0DPcICxX8CxkoCxhOMAshsVALIRwLJUgLJMQJkoALd1Xh8ZHixeShL0wMYpmcFAmH3GfaVJ3sOXpVevhQCz24Cz28yTlbV9haiAMmwAs92ASztA04Vfk4IAtwqAtuNAtJSA1JfA1NiAQQDVY+AjEIDzhnwY0h4AoLRg5AC2soC2eGEE4RMpz8DhqgAMgNkEYZ0XPwAWALfaALeu3Z6AuIy7RcB8zMqAfSeAfLVigLr9gLpc3wCAur8AurnAPxKAbwC7owC65+WrZcGAu5CA4XjmHxw43GkAvMGAGwDjhmZlgL3FgORcQOSigL3mwL53AL4aZofmq6+OpshA52GAv79AR4APJ8fAJ+2AwWQA6ZtA6bcANTIAwZtoYuiCAwDDEwBEgEiB3AGZLxqCAC+BG7CFI4ethAAGng8ACYDNhJQA4yCAWYqJACM8gAkAOamCqKUCLoGIqbIBQCuBRjCBfAkREUEFn8Fbz5FRzJCKEK7X3gYX8MAlswFOQCQUyCbwDstYDkYutYONhjNGJDJ/QVeBV8FXgVfBWoFXwVeBV8FXgVfBV4FXwVeBV9NHAjejG4JCQkKa17wMgTQA7gGNsLCAMIErsIA7kcwFrkFTT5wPndCRkK9X3w+X+8AWBgzsgCNBcxyzAOm7kaBRC0qCzIdLj08fnTfccH4GckscAFy13U3HgVmBXHJyMm/CNZQYgcHBwqDXoSSxQA6P4gAChbYBuy0KgwAjMoSAwgUAOVsJEQrJlFCuELDSD8qXy5gPS4/KgnIRAUKSz9KPn8+iD53PngCkELDUElCX9JVVnFUETNyWzYCcQASdSZf5zpBIgluogppKjJDJC1CskLDMswIzANf0BUmNRAPEAMGAQYpfqTfcUE0UR7JssmzCWzI0tMKZ0FmD+wQqhgAk5QkTEIsG7BtQM4/Cjo/Sj53QkYcDhEkU05zYjM0Wui8GQqE9CQyQkYcZA9REBU6W0pJPgs7SpwzCogiNEJGG/wPWikqHzc4BwyPaPBlCnhk0GASYDQqdQZKYCBACSIlYLoNCXIXbFVgVBgIBQZk7mAcYJxghGC6YFJgmG8WHga8FdxcsLxhC0MdsgHCMtTICSYcByMKJQGAAnMBNjecWYcCAZEKv04hAOsqdJUR0RQErU3xAaICjqNWBUdmAP4ARBEHOx1egRKsEysmwbZOAFYTOwMAHBO+NVsC2RJLbBEiAN9VBnwEESVhADgAvQKhLgsWdrI5P6YgAWIBjQoDA+D0FgaxBlEGwAAky1ywYRC7aBOQCy1GDsIBwgEpCU4DYQUvLy8nJSYoMxktDSgTlABbAnVel1CcCHUmBA94TgHadRbVWCcgsLdN8QcYBVNmAP4ARBEHgQYNK3MRjhKsPzc0zrZdFBIAZsMSAGpKblAoIiLGADgAvQKhLi1CFdUClxiCAVDCWM90eY7epaIO/KAVRBvzEuASDQ8iAwHOCUEQmgwXMhM9EgBCALrVAQkAqwDoAJuRNgAbAGIbzTVzfTEUyAIXCUIrStroIyUSG4QCggTIEbHxcwA+QDQOrT8u1agjB8IQABBBLtUYIAB9suEjD8IhThzUqHclAUQqZiMC8qAPBFPz6x9sDMMNAQhDCkUABccLRAJSDcIIww1DCUMKwy7VqDEOwgyYCCIPkhroBCILwhZCAKcLQhDCCwUYp3vjADtyDEMAAq0JwwUi1/UMBQ110QaCAAfCEmIYEsMBCADxCAAAexViDRbSG/x2F8IYQgAuwgLyqMIAHsICXCcxhgABwgAC6hVDFcIr8qPCz6hCCgKlJ1IAAmIA5+QZwg+lYhW/ywD7GoIIqAUR/3cA38KnwhjiARrCo5J5eQcCqaKKABLCDRsSAAOaAG3CDQALwqdCCBpCAsEIqJzRDwIHx6lCBQDhgi+9bcUDTwAD8gAVwgAHAgAJwgBpkgAawgAOwgkYwo5wFgIAAWIADnIALlIlAAbCABfCCCgADVEAusItAAPCAA6iKvIAsmEAHCIAG8IAAfIKqAAFzQscFeIAB6IAQsIBCQBpwgALggAdwgAIwgmoAAXRAG6mGdwAmAgoAAXRAAFCAAfiAB2iCCgABqEACYIAGzIAbSIA5sKHAAhiAAhCABTCAwBpAgkoAAbRAOOSAAlCC6gOy/tmAAdCAG6jQE8ATgAKwgsAA0IACbQDPgAHIgAZggACEqcCAAoiAApCAAoCp/IGwgAJIgADEgAQQgcAFEIAEXIAD5IADfIADcIAGRINFiIAFUIAbqIWugHCAMEAE0IKAGkyEQDhUgACQgAEWQAXggUiAAbXABjCBCUBgi9ZAEBMALYPBxQMeQAvMXcBqwwIZQJzKhMGBBAOdlJzZjGQJgWHGwVpND0DqAq7BgjfAB0DAgp1AX15TlkbKANWAhxFATMGCnpNxIJZgUcAMAA4CAACAAAAWhHiAIKXMwEyAH3sFBg5TQhRAF4MAAhXAQ6R0wB/QgQnrABhAN0cAJxvPiaSANRyuADW2wEdD8l8eiIfXSQQ2AGPl7IpWlpUTxlDyZAAAACGIz5HMDLnGJ5WAHkBMCw3KUkgFgM3XAT+zPUAUmzjAHECeAJGEYE6zng1NdwCAQwXGSYLGw60tQIBAQEABQIEAgIAGdMCACwBAAUFBQUFBQQEBAQEBAMEBQYHCAMEBAQEAwEBIQCMAI8AlDwA6QC6ANsAo0MAwQCxAKwApwDtAKUA2QCiAOYBBwECAMYAgABhANEA0wECAN0A8QCPAKgBMADpAN4A2woACA4xOtnZ2dm7xeHS1dNINxwBUQFbNEwBWQFoAWcBWgFLUEhKbRIBUhoMDwo5PRINACYTKiwuMT0/P0JCQkNEE0UFI1ZWVlZYWFdYLllaXFtbImJmZmVnZilrbXV0d3d3d3d3eXl5eXl5eXl5eXl7e3x7emEAQ/EASACZAHcAMQBl9wCNAFYAVgA2AnXuAIoABPf3AGMAkvEAngBOAGEAY/7+rwCEAIQAaABVALAAIwC1AIICPwJCAPsA5gD9AP0A5wD+AOgA6ADnAOUALgJ6AVABPwE9AVMBPQE9AT0BOAE3ATcBNwEbAVcWADAPBwAAUh4RHQocHRUAjQCVAKUAUABpHwIwAHUAbgCWAxQDJjEDIEhFTjAAkAJOAMYCVgKjAL8ClQKVApUClQKVApUCigKVApUClQKVApUClQKUApQClwKfApYClQKVApMCkwKTApMCkQKUAnQB0wKWAp4ClQKVApQdgBIEAP0MA54CYAI5HgFTFzwC4RgRMhoBTT4aVJgBeqtDAWhgAQQDQE4BBQCYMB4flnEAMGcAcAA1AJADm8yS8LWLYQzBMhXJARgIpNx7MQsEKmFzAbkA5IWHhoWHhYiJiYWKjYuFjI+Nh46Jj4mQhZGFkoWTkZSFlYWWiZeFmIWZhZqFm4qcj52JnoUAiXMrc6cAinNzBEIEPwRBBEQEQgRIBEUEQARGBEgERwRDBEUESACqA45zANBYc3MA1nMCE3MA/WFzAP0BIAD9APsA+wD8APvbA4sqbMUA/QD7APsA/AD7I3NzAJBhcwD9AJABIAD9AJAC8wD9AJDbA4sqbMUjcwD+YXMBIAD9AP0A+wD7APwA+wD+APsA+wD8APvbA4sqbMUjc3MAkGFzASAA/QCQAP0AkALzAP0AkNsDiypsxSNzAkoBPXMCUQFAcwJSyHNzA6UC8wOl2wOLKmzFI3NzAJBhcwEgA6UAkAOlAJAC8wOlAJDbA4sqbMUjcwQ3cwCQBDgAkA2UOHQnATNz3QdFdQoqcwEEAM1hCXNzAFthAAUaOQlzcwCQCXNE3wBQc90JcwCdbXNzQ4CD8BW5tNbewS6T/Np1iIh1Iy3DtPDAAXjPx9ENpwOgreI1z2BewtbX8Yi21FG1bBeCk7aB4sFY/Hi+/ekcwwyBHP+f0YI9G/iFY/5bObtuyY4MTYyHeQiZ62eBq/P8+68/rJI6cCQTfucgoskxeeDzvfo6MGQtbufZbw0FPGPpUNSG9SSs7NDWGUbpnlDGReZvnpkqvyGbE9edMaFydt2lujOB9XLYEAXRfM2Kx0lHbXJ4cszHh5aoooqxDeYXz4qvSy3ahNyE6DBY8J7v31dfMFEdiyjfirJ6hX3Pa2ygMOeuVytsRijRhyF9mVnMu2RxuZv3hI/Amu/2xe54SmySPFpHGxTUY0pe8SZ3I+HauujP4GbIzZYg6enubuUlyP0funGhg8HHYTHFSQD9Hm7HGbFy4n0sziYcpwdArgmsyy41VMV2ppGXMiMR4deCi34NNmlnftVdxoyCJzK+r1GvJvWDtbf4dPnrf0G9qOgEs2CpD3n+1P6MHu+kHtsR6lMcf3NcCDlg2BVcCpSVRHQRiw7qolVbxHeM9xvBMbdwjpFKXi7QUZOi6YaKam2q+tP/4Q5El2aNNWkj5UfSZY4ugEdPUnNXG3TnvpCSZ5IpiIvjM/Q7pZNYYv80gD+OdT5J+D+8K7RPkhzH4w8mJHEG67poqLR0JygXeOe4Qz7fpS6uh/vOXaryaHpamD78JfCU/VdaCwy9bCrfgh13NQynhoIdWRr1IQREtBfsr9bRjkodN4IdiTUMDdlCuM8mKFhoQzu5fn+1PZwtWpT+RAfPcOYqFvyg15NH3r44CwuiNOuJa3QiXx/LenV02OWmQIs/SX/g9e97kXeFyzzC5o3GZEj1A4edoQL/Hfudd5DbKP9jRl8TN4J6Kc1PFyNVAX5Xac6bdFhUIzF/y2fxEOMqCLdbgMjAScVBfo62Fi65kWkU5AuSnpXNEa53A8jiHAFWPQRbvChz7XzIQ1/JFkW4oI8xBV6UfjKIPDLC7squNvW2nzcUx+fOUY3Ocin2ftqIvHfTUJTRNcd7Ke70yAIwvqOtwoyPaZMBpoXD8wnXXhGcZwxMUx5c5bPIUoEI0NmMFTasTLrC3msRFOTj05Bautfl1sY/SvMF/LAsyI9YLxLDyLAdk5DR3UM3aUic2osD5OeVdqZVW/Q1m1ebiFPdS2jIqNLulNQ8bGE2SLfELriR1KiTO9P5+lrvWYO1fSrGrUt2bWuylLbZPkwOvWGZpLOHyarck2ZRqWS6sCGey7WyzKtSLDf8N998dc1hh6BN4lUthsFzHww9KK8RpC1vUV1amMjRDMR+KvY6u8hOpZEzHdLMb13izFQP3ijwSQCEFVH7Js8hL21h1Vgxap8exSPY1CBI89DYkx6Tv5XhsKTqejQ6qbBFVPb0FeZ+D1SdjxYgqAq6uvJHq7PW8hluldBOJ7puqANPsXDOtG/su5LwU1PnRExiBpZNO+7blORJ7i9gQYmu2AXSSiKxSZIyyJ+0umdON6y4aPTTM0FbgQzMWfO3PXOymBuZ9DjNH4dcMJSwm9PsU05clrl3w1WkZ04jCxhragJpQ4w9q2B/PX0G25bXPNnUGKSL3EAHAUkcsOzO66BRomJQr0Z8uQAcdKYDE3iFkuZQy+yZq2C3vghrwhw2d8jCgn3V2SEF0Obph80afZ5zohDVBkZps5UEZmSaeyACcgZ6Ecj/Z3Shx0cxedqpF4rbvSD14by33Qb4gSiKqHx0WH7WjNWW+fZz2t1PtJAPWvC6IaLarFyTSGtiv46IG1Q3YMBw5bDrisQFBnBi22oUgsO/eSzcLI5+wpv1ZX3aTHBQ79qiLoPd5uu6JrnhGzEeM0/gRT5wwCJ6uPDv35Qi4MGUO2s9+aimuET6TexV/KC9BGv9ibvW0+9hFedmTLXfrk2/sgHRe5wZPR6ao7kFwN3Egab8d2ApFPLOUgTY+d32/+XKglFsszuassqJBzo6MTbCwlYKO4yYdfk2gfjuHXxxdIjaUUcqePg/jf4AWUOsz7EjkKaPqLCzwTwkuPoskO+HPvSSIj56NBqwhlukh/SUlBPCAvpc+1hWM5aIt7e+NWicwHeXmf7JihSLmAxjDWNDmv6lSpQAYgl3KGYcLR/SwD/UbzS+YBYGKLhVlwwyGYf2autLOFuC7hdVncxFH6lx4+53/q/z8ukeP5C9jWhZLQvvvXJkWbnwQUbH8WW8VDTl7dYYgEw/d8e8PZVIP8QO8aJwNBObbcAh1bZg/ev/mIcRpHqvapWZBZJccfvQ55WYxxTdBLqYbSDjLNfI0d/IB7j1JaX07Z1abn2SGfV7zm8TU65Tqui5ZG/m8fTS7ZJVkQbJqcHfdRPbFKgIm9Q6lqhbspKIufB0JN5lyRQHiZp5cOyRLL44fHhfM56Ukt8hCMN0cSOYZcp5mvcoAcpVNPjMcA/siqAhaIn3EO6j0+ArsfN/wEexl90dGjecxE+R4JAHU9hBGZrDrJJ0L3FasUPVvPdmvrRUYY0LSEJpgUBo4pykiQr4GRZ9cAVKhzBxs86T9E+h0iOclANvJaS1ozReL9coKT4XJH2R15ed78yO6xqF3vPVSvwW+hApUYHspT4xNknEfEBks2ZT80sBfcq+kKqQeraVh2FtwOkIyPZc2PIZqDVqS2OfSXUEJ+aPajbV+aVHDMxPd4ak0ln8Lm3mlBsJjoNzm1LCOw1FWMbUNFmAyj82fesmdYwbtO9hz97ErIjkGBD8ojAOzSZzPT7bq7FxmZzdfzjVX5lq0DgHNm/HtOP0Fha40VmytaL4VvkkkmaH1vfbxgid+hNPqf//ggLAH9wOu9cN3TPGf7RkhvnFBg9Ue9dEMIY0QnUn6WfZwgFnf37KcfXeA/7qvv2NJesfukMgngn3pyJLjhbJ8DGZvbF61Q19ZVHZ/HfiOf3XZwiD/xlEDb+fuGzUrWRq7IMm/Qsd6SJc6Lqt4i6YC+L5h62FwYHiS63//p0lyL3iAb18QEPtnpbEUty0Zrt0fktA9L/YFLfrzYT6atdQjL6OMhCrZ4O3UUaYR0yme/4GNO/yHHufyAVpH/OIPEf2OzptXJ19+tA+NpivJNqCKOwUsJHqTzrT2G77O9dBe4ZcGyF0mPkzzJEpTJOjkgCt47TXZnFahlCXR9VbZ0lb1c1wAqXTKUqyPVaxz4Eu3rPJHiM3IXQQ0NjTvzUPG258V7vbrgoezETHlADY7B1WeyNMFYVE/LaWY7bSfQb7lKJ/KMRmoFwCrkwMEEkDen5KTEXCfVJrN+v4OeBxxE44mtzJOKdlLb7tqPfXrxftovGQyuaJhwlI3qpYBgfatKX2BJFeGTK5b4b9aSrMIv0QoyWUKQxoWaM41bP4QW5RbSawNQdN/0wv7aL9Jkk5J66IDpo7KQGXAKznLFeMn7t0F83ZTXPCDUhEjgWM2SA9ChmM5YEHa5l1hI1fsf77dxeRWfVHKPsN3Pbl3Dy5b4QIYb6N4Pm9jAAQLmQlaBBhZw5Ia7PfQ+xKgKJFQbR4F32mFfupbsbWLM9jDeqYdACLyf6uAKgVu9AJQpYtNbCj5wj9nXAWUWbWQL1cXcTXoVZqxjtyS/BsoaURCQi3dk09KVzUA0V6ZlrQ53Kj5AnQOcl+5F45QK+I7z2+zhbRVGq2VwcLCugx3BCQZwoiwsqtS8RQRixu4k8uRiaKZ/k7rmghRah8nMGZhmN6r12o0TqdMaPiD/n4TLE9VhVaO0KPZEGCIhU8QX+UXBAqICxssIsyKn1OrvUgTYYTO4jXEpu2+kVS6L6T5gjC1tufk8YssX4CRRcvyMaWoJuzmhC3Bq/DBUCuPaMuhQPIQfcmps2oqp9AqlngtSCo26+n5fKqSzEU3lpH1SMPRDrw6OdD/LhpNrs1YTHgMmP068bb8qMgF+/ASQedI7CvWdu04rAtlsP7kSnTDkyMw2LiZnpMx+i+ayXB7c3ckJcjFuig7H00vq2OQzM5PPevRdYi+cZJifcz1t3cNSD0yuvsuFXD/Nk2j60H5RpUU+Zrlp99wSgKEAkuC8nBJJnZ9PR+DkXPe3s4UeOKoq99964VWB9Pnva6uKI779pgq9oaspNcGV8vSOMCM8ACQn9kUPweu9UwI2n5+goo05CFaR5kALF5jhYmybPavdtAxmaC//LVF0ZLRkIcU+NGJzY3OdUKILkQKUDGABumIZHHzKw/jCOmPL+Zl8t46Wkz0WFvi9Gu4zuSn4okuXcj0BSeDVzHIf7sqCBjmC4zCJ+jyS/+Gq2fPUkgfW0bxdgVFMY+zY3TQuMfygLLiF9MzfKQiZXIgzRm4z85AALjRtWp3nO7kFP7ApIqqe2zn0NfjROHgw/hqbhgKGKjsXzu+rrdu5HeSlhWO8hxwDmVaQObSdcyTFMG/YiFD6lJGKdFb4NNS1HnW8T1P6nNQPqraOBTSnQKxz5tTGqNrbaAE4Iio3Cj50ZUqo6/O5OAtJ6Bznp4gKMgBetgD11fCO++j1RdcFdTbD0tkgfxXgzJTUtWCUmdYjl93RR27ifZGYzgK23MdwF4zvKNem782m0dQnmh47Rxz3+2MVhiiS85nTOXxmaODvzAWBE2IQowSrbzE12IJ82fOrvritWvRIF0aLCLdEytK+NVdDxLvmdW+dFeKOa/ocw1Son0O6OzX0lBLmjYSMQSrFe5X5yf6WE2ehsLrv6M8Cqjvwr+u9X+kP/f3iAk31TV+K9yZKQqAn3QOWy+9Hz7iVWRMuM9hs35+avVy4pXASFbOjGdXM1fSQkLOWmFUhyadKWYPjRZoZo0g3CS0qhz+mjygAvmtkYRBcGNpYAEYoIDEwQaswtATb9HLzTetQL8aK79YSb0vJNPSYzsij3FcXbmfnMiaOJIGrrBJnAPRqg2lmCZFXOFah9l2GRBm8HJMGeiupFvR0aRN41otN6X6tGTxS53wk+2+w+Q5ABTdCd15LYZm/a/3bxe9RDQJ5HZhLzr5x1ccTkxBkbxlYBGd8AKvkL2IR3V283R5noyhAM5o/2rKEi4U6kxCV5efr8llvLFrgjPIwS8iES5jxmV5zyPzj7TyzJTJze+9tgDNGYRyyXPkU4mtAh8XUy9vMigfO+1+ZKYW2WCFjDUfvyNiplha4LliPPg8Rc890ZT+F9pMYPAmEg3JJVUm3fp5N0IPNMAYKmbdj8dkIpjDhDJUd6o3G858DgYwPhSC+z3a78QpEmqq+tRaHEcQ30ZN5KVVdASN8NMTnLKoA+IJdapqCRgooGTkhyjB1yEmjSy52110hPaqe1upiUeObsTXtGELTk2p2NZw/3PzU281tafWNmFUPAmooj83DhoQgKPIB7f+NGTDlTOtyPgN8pIB/lnFLL/gcwigZPKDW7p6hnW/GnAzyNS46gLJAl0Eyhqx6UWLeQTU7odMYORK5zf/FV79JGVPOQpNUA58rlB0ugHsyeub8Lnf9QQ4/N5sRKaUjEEhdpF28vfgPZACBbg5UHuVHl8Lby8mVGsrtI7TjL9U3mbtcF+cXQI/5AxT2i0MyciXEKZ8OjvPoQHHU/YSnCXtEp2r08SJxUAHIz1zM+FwdRCYPffQNi2NhkPWTiYTxJ00WVZIrHwmG7jzOLcfWnquJkpOmdPzXfAu+s5EADm0X4VmatqLjVa86dS7Os55qXuRa1Y7dWGvv57LjBlKKgqsbI7lwfyBN3qkKBqe7nwUDn6xqhGPiUPT7j7s+oD52AF6oj6SFXhYWlRXy+1FL7YSbjFxfFvJt5tVXMAr8/voIg8YRiBsKB6eLeIG5Y/KmGmFBxxYzSH7W0IaK3IId+cBlEk6H3Y5BqIBfvhOOBtInLWnsAoRpqlkxd7o/+LP9UXEahdcYlifFlURgUJl0Ly6LHjSZN1CfHB7OORacnBdpIM1lRpBcvwkeyXUvndU4zrfqwtuBEpxqvk4PZPJMByJXUbXie52mfUB689h9GRV99U4gzn1aTbHPWjbB0DQ0Aes2E/ZzoCTxCef56sExSu8ynaPxuDOOeD31OWT0zHo1XxSPQbclDivD+4/v1aWdhGXLR1Ui+NzuQK1NTedznX44c5T3b+2GZZjl5RqH8KR7FTVjLAXvg64Gpc1RROH24J9jrNDyvrMxY453DRUjZ/K3zYJC+M1JxcvLkuZALsXVQ4Z7sj0EuLbRnhTKzRGwFrpXcixvnCgRbJrCl3+RjyWVipph0VLB0nDop/tvjfFmysZ+d2/k6baJMxYoqnE7PFceicrxUYyoJ2LMxicgJqrgvSR3mNJTkvfTU8BIoZz3PpSIS+Y7Ey3MXecxcxYZTeX62egI5Nub2z8Bj4Eg71YCz8Oiapkinw4RRlL+0c2/6jDqc8UK4Zzi1X4aIpgYsPJQOEz2YWBdvH6z5CuY7UvWK2F0Mg4ofRVBArX1p9Gv5VLqWYyL/raRVWkPNI4FEv9+ePcdmBSQR4CFSO6TG13hIV+cm1dkd0/Nt3r28H4NU2knSniDCeozM/Btc4i/ni4H83S2/ktAAvUM7UKJPT+RO8LOlvxhuI8HQmAuJCzVH23R/0JovidxgdJ7g7whCdVQa9/TLFUJWmNSYAaPRAXW/kk2UBmAz6f6POK1zcMlmI8P9tqW2qVXABN0L0zHarXbWHlhtYpXMEda/pIHLwu8RHqmWWMgMzkyKicSFKK10UvZRdcO8fCiSijtFIY8qW7CscvtzpP92lm+c648urehw35v1EOfO3kdny+CQm/Y0u+zPuevhCrQKhTsUq4G1rNPoGuVzvhf2Ui1f8jzvx9fJbQR69A0ETLUUC2ndk1YFQNi22yLwyZyw4xU8P3RGLM5qojKNwHAZAMAEudzg8UdfV6i4VktOLbhhHUPqpCn6dtpnr16rINs5hWJGMYXaEn0irFCuoYnJEVhdJ4PZLKuTkrP1UUVWZ0SMgJ3F2I8YRhtLwK4dhh/oKk0hdVgEH/l2/0c+cLlF7kpDuF3lC4fsFw3V0QrwH3GLNb2waS18OmYB07yaLEqhd58bSaGJZzePoroV5v3UK46/sWdKczstFIiYLmmKeaVGRNo3IWk+dYUqWy5aJClXj5tf/v47ijlkmMDP+ROUxoGk7LFzne4/0CRPl/5SUyOa679jibvdVQFZ1o0H9kBux7OSC9B+qVKE1trxr4xqTkjc1ZGZBpY0zyKBiu8wr+/KXc37u0cdXGJwY/aTic3kGj4jt3y4ZwleKskyXMFHKGwVhqpFH3ba02boSzGHyPMAe/reVqWSTT2Uz47+uYvHZGNASqYQ23uZoxalHK+PGoH9trTVaw2KB4dH8fNrXRLhiyxGdRtS0x8k3feeOvsOdKEdaOf3IrfWCZM/n3+hVJizA4zoX8MzsIf6bDfuFXIIRR2RN0rICZcMRmnRxUXT+YMOid50gg+Nt4Uucemmbd9kvJG/O04PVC0vm5gGDlIY3THI2+l1rZcMOuSDWBp6I4Eltp7naHZCdaPUWnQ07VqO49znDgCmtu5Tb+SSEQJV+rJsiXgCqoeeQciher8cqF616P8qlZeonKihdVkj+RTnjOcnoERWubvyaeFO6Ub3dhh0qmm2RD4enszxE1JaAaiezuSoCayJQP931HGcy0NmuVr/UV0pvbwICLpBbVkxC6qebjLGRXucTG0dbQDFPz049hMem2pb/FOTGYRLR0uPCa0oIwc9Z/g+Iy/zYFDThHi1cqbK824savKGMLMj7j87RT9NMwxaI0eKTfMFioi9SyLq5sN9pV8be2FrOc7xMOdv6btXyqFx63y9fIGMBP2T9Wmeeg61ZGdTE4IwybcGlXLJ3qLbRRpQ8vSzcqFobN+QPtL+51hadAWtRbF6aJpeb7Gca4/Ldh7BDvEbrUuEm+gTyVMeRQ3Ypf9uyFjVstrQIcdY+aur3LC5I5OOnJck1zLUKxLobjy9slG3hv6zylhtKbAbpX5p8Hc910fCT7FNH5/t9xEJX9kkeZ9IMCHAk9zn7L3pXEGZVvdaf85NtlemPpY7iSgSC7zRGsI5W6/UEwX6jDtNVZ9VqPDBe/EqmEEsGcs7jZPQPhi3xpj9UXWQLiy6tsxv/ft9aKQnUg0Sps/x3AZ2uK3ETGTQogPTMQPOnoU6p5KuS3uY6DfW0GeGQ1wNpGzGoUdRJRvHP9MDQpWRSZqZkE/rcNnQ5lS9BmMDW/umgZQD1C2YXfZMy7fIVXo121293Gfx9n7DQP6OxSqiSTNx48KId9kfGYOnV2Wg2TQQywNBRB0mSmqa/jwoBDYVDl6B0XFrVEAwbnhLyqGp5BH9bzsWrrFlu0x285RpqTylTZk3rgcm57prav0DUAKUd02vXdYyNBf7sfX7VYn0Syug9++ey/dHoG7GQzMbhXhtEuRXv6YR20SQgSOrgDUGPR4HhS+Qvk2zOtyH8N/lHYfQxNKt/f7uCpsBBh5eGZaeWNRTBdOObWOvyKJMfD8FLEX1v/5ywtRV27weRzSNaHEQFE0hIzzS4VPzgWtg/4bcetwXpabsePP192muNPyXiRzRZkoeudA9D9x/oVWfRieLfjdXbi/41RGNB3aIj0IxCBHSvUN7LzntO6Oh910zV9u4Glrouyr5odjs8/fW9r0buiTMWTjjLbi2k5tZ3m/134ci/d9f8zuv+4BI7F13Mjb7DTTD5ukfqNTlNC4V9PnfbGAJdKLEDJgBPKyYXCaAL9U5Cxi2j5j+IWmNg6NSnWcATzmOO4+dNBmefy6ceyd8J9/Q7amUWVVkuNVSq3iWEb3UJP7kG+P8wfL4xS0ZNuSKYuo9KpdkJ3b4PYRNSzF+8OXKDWqXuWsan/wconybIRBoGWHMuCkb35BtGfiqZ4hc2CCapKiLmrWnBLlRT+9GA0Qcykkg1B6C3kESJMu2dWyGabbhRwxUeMxARHqbXzHmHpr4Z3vmOxHZ6b1q6MJ0Vb/XKkaPF4xn/VindEJ3S8/9xcGF+PNFuAXc2Jf9uZLLtjxDAEeohd7wjie66LHvcNT0UpWif4uCox2YR/liegMgx8vEbvQClJBMBub7zJQMCr1C/Vf8siWQASp0Ewd7D2uP6f9YTISdEaUAzF9rST9JTHxez310BfdgtWKU1ZYoRuDZvGn2tj9DPjXrkgCr/13OHsP4MOC5b6YqHSedYMW9bEfS5M3nO7zTGS85BzpLTIFqAGhZJLEyLFcZXS7hDhDYVvlm10RLEslMK0cUL/9xqTMOX2iR65umsC8dW4hT0Sg6Tf3T2HAxsHKcNzoqFwuM9k3/LpYekhRc0C+f1I+vMQ4thkfSotx9GUt/cdRosaE8XwqV0k+8ZtU+jv8nn3lbcNxfXXKi5l0SL5kMmrCdrxeVVqxBobrFF+tb0wtkN+DMm88I4jWH/DcdJOjcMOLEsN70vlsfIi+NexpaT0ZsnfewPoTvUSXqqfhRcRk3jA7AdYHEFk4l6O3fe65uZNIMf1lbtJNCNaK2+c5hGKLcTSrBmwWv9TP6JDfZ6UY96g4baayVCbrDpXePgXTG6xO3rT0DAXG9OuPxkSEPLJnqxQViyYQhCp36Q2yFpF6cR04RO7Ab5HPrECqGR0Fnr2gzmjx49XjQf8N5Bk5XH0dh8NOoB62acHwMhlBM8duW9tghc7CN7oz91UEyd8fOtwDK/j7SykdllCAN5kUrcawufMV9y/EqUoKHtP5i8MgQY9RlZFZzi0BeT9Ang4mMIvWAFChZCNnb4tT5cS20jeit8JEN4tz4mUmZxDwiWkEucI1KF/FyAnvE4wybWvbaxBYjT2jdhlzd4y/eTmTl3im5YImADc2unOtmNTcgMdOb9kUgJmgzY/hDaAxqvwLEulLsjq0bsfSE3tRYCRn6xb0uv5B5yFshhewdO5KgoLcaGeqeg0pa9k2RXM32g1jE1UDWO0CaMobavPk+4u26Tmgg6VindBdYdRxpGqlvkxai0K/atC5CWUxlHuukX5b+hg83khzsZK7AVRVptyVNicu0sfQToTDEeIeDdFvDrReJUiJGZcXAhpRL3OufhL4aDfO1zsCmfGq8qFspBiJe13lgS9GguiMsdmgpWOhHkSTVkWnMOnUeIJgqZks/AwL/1yKPm00t6x6qLXQrCJrysUwR+ILJdyyyuUN4BuEtCDUXMXPU5srsAnDUhSfFM/j4RK+cK01o6lXAVbhiOLaaQtpYN6mCOwtJNcVqEpyrxXuWxvE4mbVCytBu/qKO4X2BI1NUSlj/g6FQEiYsXMAQuM9wnHngXKLZRWFHcgroF7URRzLPrMQUfALjbga6S+tGc3Tshv6PA6xeSqRPDbLG+X+0qt9crNzbaxGbStSCfYhdRY4t5BSVY9Pxl9trcYFiUdsV1BSwaZM5u8K+hUm8HV6PoLD/jlsRRzgUq6O+Qw3asFkTKm3clSTo8VtXdpTdzFAZP+tVvAjkfGq3MkSLyTYi08pvQ3h/L9o0JpUnnQeKxXk3qIsGGsH1BXzcZT+voCNv39FSdg6gNY51z9Cyq5Dql8wER5ylTwnLVeHlHAn/HNwxGYeUqrrc2gcmIybVKVD1XAPXjKks2+oHZk4OXYP6+LwVaFEApqEMyEusTgVFTzdjVa2BAaELvpyVhOSMW/ae3NwMfWId4Ue28z5IzumOF/CmY1GmXBOWBf2hgp/r3qS0GU7nGETmj+7Tudbjd1cKhgP39tVtWogjxHt6NLXz8OCbV1nIBG+mmrrZDCbH/o4Vgn3gZkRkq+iHOVW82LunJPXBZjX/ntmptWsqP8nDZBSb3TzAD4vSQeQ1GmtgGWAYfB951YKUnFVJb0z1YRjQqVksL5VpD4N/Vy31vtYY/2g9TmyMADPgCwwA6MhjQ9bd1JFJ3Vls7lD2RYjdIwQwhWzBRPfrxpKcYeu03F0/odRbEc9RZ11TxVY8mXqgJx/vDk0eF4MPV7lgBxYqxoGfEtGZBC1kZlxbcez4Ts4/TuXJ/QsfWT95Fwpc4CtiGCgU4i7LHgoDalqmBabvzV5xvq2pMVourJYZ4paytzilEG+lADOGx7qf9O5/4cP5SqyTCMG4I16I/6I5o4Y/QkWX9ctABry/8Adxz+ZB8AI1yUyNXk1Z073ECiDJ1EuVT69eIDEAlbnv24j4DJGeqIV1b1GDCHJ+OFD4W0gXUs/1bMkNESNKl2ON6DZzAXvqmr8X68yRDgIReKbX1SUwtzYnyadBLhEWS0WTE7T1IxC2SHChb1NFD+2rtJSN8OPTIZRqiizaoh7OSSNpBXJMkKcUQZV8sXw8VkU5ea8j0WZ/YK35loUxE1aG30SL/JYxZWlUenDyKrfbHWJ+z6JOsV0e1Xfw7VGavtHACLwn0tTG9e3lf++w1MCVjFIyU57uOlbTkUSnxAjzmA71qvjTzHeMDWcK099tm9rS8cnfuwxq+YRWANkfmLbCl+74mg4bccPsNY5zz7cjbaFAL0hAwId61yM5uqhMBr4Wcew3b2spG5tkKFOnADeXkGkH4vk+f+an92mWXemOFCpjRsFeEnPEAIsLemM3QfMoME5/w+7Y48y/SvkBN6/KSRVmB7/rHiW7iVkXF6Y1T853OaDg66cIfWkD5TqCDugrlaXlEL1fFjxPoKRHkP5GD/xDiscNH+Dp2fXEKUpwAvC8JTNC+k9JpaMXUB7oj4p77qiAOjXD2pT4v/v0Ukid02LpuYsS7/ScDL1SxB9hxxbkeGOMyPyL4HZPAbyagOgP5Xe2pCqMPyj/KJ0blDHzFVBqzeLIO5D4yq7IpSi9p/QlHa50sCHzGoMqrBS8l9IfRyhq8IDQtOZzjgdvgQDwH7cqa/sybwdfcQse9THS08maKkkgnOi0ShO8Gyf+WL4K9DX11CF9uIbVwJUaCv8r/6FDVOdsEjeumisIJlLJQsjjkEL2QfEc68oqsevnNAEdp4YMJivwBJnE0R2GiBFRTJZNkq/MHDP9O5unQoRoivMJkPm+A0K8CQNXL6V3apC4ROBTyJSW9oOGNF4YrwoTFyz/pexIkeWQADpi+M7q8gBlmGRUune0k7cXyacdbOsD0Q1JQat9T8nmHhyO8PNd2k4qjZsQCs6lEcmaThpVUzGzWOJQGGf2oz7+F/bMfUMARo1PD0/yIhVDK+8MGRo/uByG5UAwPfNeHAd09gkMFpZmTN2rZgoqdSjwv1SbFnFRAqYuzwW8P4+Rk9fE3PVu80HKcXyIEvPfit+o+pnlHDUKKo32HapcVtQhsNiIdH80j/lRnJ2y5RYRbECyY4vl20j/NiBAD0Z5jxWWiL6xAZIonSEJb1qhwmdRp3hISLL9Q1QYOt6C/OixU3eUtXblgBu+fGPAQE0o");const Z=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),W=4;function LA(A){return A.toString(16).toUpperCase().padStart(2,"0")}function lA(A){return`{${LA(A)}}`}function SA(A){let e=[];for(let t=0,l=A.length;t>24&255}function nA(A){return A&16777215}const FA=new Map(tA(X).flatMap((A,e)=>A.map(t=>[t,e+1<<24]))),OA=new Set(h(X)),gA=new Map,x=new Map;for(let[A,e]of CA(X)){if(!OA.has(A)&&e.length==2){let[t,l]=e,C=x.get(t);C||(C=new Map,x.set(t,C)),C.set(l,A)}gA.set(A,e.reverse())}const L=44032,b=4352,J=4449,G=4519,rA=19,cA=21,p=28,Y=cA*p,kA=rA*Y,VA=L+kA,bA=b+rA,JA=J+cA,GA=G+p;function iA(A){return A>=L&&A=b&&A=J&&eG&&e0&&C(G+c)}else{let n=gA.get(o);n?t.push(...n):C(o)}if(!t.length)break;o=t.pop()}if(l&&e.length>1){let o=N(e[0]);for(let n=1;n0&&C>=n)n==0?(e.push(l,...t),t.length=0,l=g):t.push(g),C=n;else{let r=YA(l,g);r>=0?l=r:C==0&&n==0?(e.push(l),l=g):(t.push(g),C=n)}}return l>=0&&e.push(l,...t),e}function sA(A){return wA(A).map(nA)}function zA(A){return KA(wA(A))}const fA=65039,BA=".",QA=1,v=45;function U(){return new Set(h(B))}const TA=new Map(CA(B)),HA=U(),K=U(),_=new Set(h(B).map(function(A){return this[A]},[...K])),xA=U();U();const XA=tA(B);function $(){return new Set([h(B).map(A=>XA[A]),h(B)].flat(2))}const qA=B(),S=m(A=>{let e=m(B).map(t=>t+96);if(e.length){let t=A>=qA;e[0]-=32,e=D(e),t&&(e=`Restricted[${e}]`);let l=$(),C=$(),o=[...l,...C].sort((g,r)=>g-r),n=!B();return{N:e,P:l,M:n,R:t,V:new Set(o)}}}),AA=U(),P=new Map;[...AA,...U()].sort((A,e)=>A-e).map((A,e,t)=>{let l=B(),C=t[e]=l?t[e-l]:{V:[],M:new Map};C.V.push(A),AA.has(A)||P.set(A,C)});for(let{V:A,M:e}of new Set(P.values())){let t=[];for(let C of A){let o=S.filter(g=>g.V.has(C)),n=t.find(({G:g})=>o.some(r=>g.has(r)));n||(n={G:new Set,V:[]},t.push(n)),n.V.push(C),o.forEach(g=>n.G.add(g))}let l=t.flatMap(({G:C})=>[...C]);for(let{G:C,V:o}of t){let n=new Set(l.filter(g=>!C.has(g)));for(let g of o)e.set(g,n)}}let F=new Set,EA=new Set;for(let A of S)for(let e of A.V)(F.has(e)?EA:F).add(e);for(let A of F)!P.has(A)&&!EA.has(A)&&P.set(A,QA);const yA=new Set([...F,...sA(F)]);class jA extends Array{get is_emoji(){return!0}}const ZA=mA(B).map(A=>jA.from(A)).sort(PA),aA=new Map;for(let A of ZA){let e=[aA];for(let t of A){let l=e.map(C=>{let o=C.get(t);return o||(o=new Map,C.set(t,o)),o});t===fA?e.push(...l):e=l}for(let t of e)t.V=A}function z(A,e=lA){let t=[];$A(A[0])&&t.push("◌");let l=0,C=A.length;for(let o=0;o=4&&A[2]==v&&A[3]==v)throw new Error(`invalid label extension: "${D(A.slice(0,4))}"`)}function vA(A){for(let t=A.lastIndexOf(95);t>0;)if(A[--t]!==95)throw new Error("underscore allowed only at start")}function _A(A){let e=A[0],t=Z.get(e);if(t)throw R(`leading ${t}`);let l=A.length,C=-1;for(let o=1;o{let o=SA(C),n={input:o,offset:l};l+=o.length+1;let g;try{let r=n.tokens=ne(o,e,t),c=r.length,s;if(c)if(g=r.flat(),vA(g),!(n.emoji=c>1||r[0].is_emoji)&&g.every(f=>f<128))WA(g),s="ASCII";else{let f=r.flatMap(i=>i.is_emoji?[]:i);if(!f.length)s="Emoji";else{if(K.has(g[0]))throw R("leading combining mark");for(let E=1;En.has(g)):[...n],!t.length)return}else l.push(C)}if(t){for(let C of t)if(l.every(o=>C.V.has(o)))throw new Error(`whole-script confusable: ${A.N}/${C.N}`)}}function Ce(A){let e=S;for(let t of A){let l=e.filter(C=>C.V.has(t));if(!l.length)throw S.some(C=>C.V.has(t))?MA(e[0],t):uA(t);if(e=l,l.length==1)break}return e}function oe(A){return A.map(({input:e,error:t,output:l})=>{if(t){let C=t.message;throw new Error(A.length==1?C:`Invalid label ${y(z(e))}: ${C}`)}return D(l)}).join(BA)}function uA(A){return new Error(`disallowed character: ${q(A)}`)}function MA(A,e){let t=q(e),l=S.find(C=>C.P.has(e));return l&&(t=`${l.N} ${t}`),new Error(`illegal mixture: ${A.N} + ${t}`)}function R(A){return new Error(`illegal placement: ${A}`)}function le(A,e){let{V:t,M:l}=A;for(let C of e)if(!t.has(C))throw MA(A,C);if(l){let C=sA(e);for(let o=1,n=C.length;oW)throw new Error(`excessive non-spacing marks: ${y(z(C.slice(o-1,g)))} (${g-o}/${W})`);o=g}}}function ne(A,e,t){let l=[],C=[];for(A=A.slice().reverse();A.length;){let o=re(A);if(o)C.length&&(l.push(e(C)),C=[]),l.push(t(o));else{let n=A.pop();if(yA.has(n))C.push(n);else{let g=TA.get(n);if(g)C.push(...g);else if(!HA.has(n))throw uA(n)}}}return C.length&&l.push(e(C)),l}function ge(A){return A.filter(e=>e!=fA)}function re(A,e){let t=aA,l,C=A.length;for(;C&&(t=t.get(A[--C]),!!t);){let{V:o}=t;o&&(l=o,e&&e.push(...A.slice(C).reverse()),A.length=C)}return l}function we(A){return Ae(A)}export{Be as getEnsAddress,Qe as getEnsAvatar,Ee as getEnsName,ae as getEnsResolver,he as getEnsText,ue as labelhash,Me as namehash,we as normalize}; +import{g as Be,a as Qe,b as Ee,c as ae,d as he,l as ue,n as Me}from"./index-c212f3ee.js";import"@safe-globalThis/safe-apps-provider";import"@safe-globalThis/safe-apps-sdk";function IA(A){let e=0;function t(){return A[e++]<<8|A[e++]}let l=t(),C=1,o=[0,1];for(let Q=1;Q>--r&1}const I=31,f=2**I,i=f>>>1,d=i>>1,E=f-1;let w=0;for(let Q=0;Q1;){let H=u+T>>>1;Q>>1|s(),a=a<<1^i,M=(M^i)<<1|i|1;O=a,k=1+M-a}let V=l-4;return j.map(Q=>{switch(Q-V){case 3:return V+65792+(A[g++]<<16|A[g++]<<8|A[g++]);case 2:return V+256+(A[g++]<<8|A[g++]);case 1:return V+A[g++];default:return Q-1}})}function DA(A){let e=0;return()=>A[e++]}function eA(A){return DA(IA(pA(A)))}function pA(A){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((C,o)=>e[C.charCodeAt(0)]=o);let t=A.length,l=new Uint8Array(6*t>>3);for(let C=0,o=0,n=0,g=0;C=8&&(l[o++]=g>>(n-=8));return l}function UA(A){return A&1?~A>>1:A>>1}function dA(A,e){let t=Array(A);for(let l=0,C=0;l{let e=h(A);if(e.length)return e})}function CA(A){let e=[];for(;;){let t=A();if(t==0)break;e.push(NA(t,A))}for(;;){let t=A()-1;if(t<0)break;e.push(RA(t,A))}return e.flat()}function m(A){let e=[];for(;;){let t=A(e.length);if(!t)break;e.push(t)}return e}function oA(A,e,t){let l=Array(A).fill().map(()=>[]);for(let C=0;Cl[n].push(o));return l}function NA(A,e){let t=1+e(),l=e(),C=m(e);return oA(C.length,1+A,e).flatMap((n,g)=>{let[r,...c]=n;return Array(C[g]).fill().map((s,I)=>{let f=I*l;return[r+I*t,c.map(i=>i+f)]})})}function RA(A,e){let t=1+e();return oA(t,1+A,e).map(C=>[C[0],C.slice(1)])}function mA(A){let e=[],t=h(A);return C(l([]),[]),e;function l(o){let n=A(),g=m(()=>{let r=h(A).map(c=>t[c]);if(r.length)return l(r)});return{S:n,B:g,Q:o}}function C({S:o,B:n},g,r){if(!(o&4&&r===g[g.length-1])){o&2&&(r=g[g.length-1]),o&1&&e.push(g);for(let c of n)for(let s of c.Q)C(c,[...g,s],r)}}}var B=eA("AEITLAk1DSsBxwKEAQMBOQDpATAAngDUAHsAoABoAM4AagCNAEQAhABMAHIAOwA9ACsANgAmAGIAHgAvACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGAAeABMAFwAXBOcF2QEXE943ygXaALgArkYBbgCsCAPMAK6GNjY2NgE/rgwQ8gAEB0YG6zgFXgVfAD0yOQf2vRgFDc/IABUDz546AswKNgKOqAKG3z+Vb5ACxdICg/kBJuYQAPK0AUgCNJQKRpYA6gDpChwAHtvAzxMSRKQEIn4BBAJAGMQP8hAGMPAMBIhuDSIHNACyAHCY76ychgBiBpoCKgbwACIAQgyaFwKqAspCINYIwjADuBRCAPc0cqoAqIQfAB4ELALeHQEkAMAZ1AUBECBTPgmeCY8lIlZgTOqDSQAaABMAHAAVclsAKAAVAE71HN89+gI5X8qc5jUKFyRfVAJfPfMAGgATABwAFXIgY0CeAMPyACIAQAzMFsKqAgHavwViBekC0KYCxLcCClMjpGwUehp0TPwAwhRuAugAEjQ0kBfQmAKBggETIgDEFG4C6AASNAFPUCyYTBEDLgIFLxDecB60Ad5KAHgyEn4COBYoAy4uwD5yAEDoAfwsAM4O0rwBImqIALgMAAwCAIraUAUi3HIeAKgu2AGoBgYGBgYrNAOiAG4BCiA+9Dd7BB8eALEBzgIoAgDmMhJ6OvpQtzOoLjVPBQAGAS4FYAVftr8FcDtkQhlBWEiee5pmZqH/EhoDzA4s+H4qBKpSAlpaAnwisi4BlqqsPGIDTB4EimgQANgCBrJGNioCBzACQGQAcgFoJngAiiQgAJwBUL4ALnAeAbbMAz40KEoEWgF2YAZsAmwA+FAeAzAIDABQSACyAABkAHoAMrwGDvr2IJSGBgAQKAAwALoiTgHYAeIOEjiXf4HvABEAGAA7AEQAPzp3gNrHEGYQYwgFTRBMc0EVEgKzD60L7BEcDNgq0tPfADSwB/IDWgfyA1oDWgfyB/IDWgfyA1oDWgNaA1ocEfAh2scQZg9PBHQFlQWSBN0IiiZQEYgHLwjZVBR0JRxOA0wBAyMsSSM7mjMSJUlME00KCAM2SWyufT8DTjGyVPyQqQPSMlY5cwgFHngSpwAxD3ojNbxOhXpOcacKUk+1tYZJaU5uAsU6rz//CigJmm/Cd1UGRBAeJ6gQ+gw2AbgBPg3wS9sE9AY+BMwfgBkcD9CVnwioLeAM8CbmLqSAXSP4KoYF8Ev3POALUFFrD1wLaAnmOmaBUQMkARAijgrgDTwIcBD2CsxuDegRSAc8A9hJnQCoBwQLFB04FbgmE2KvCww5egb+GvkLkiayEyx6/wXWGiQGUAEsGwIA0i7qhbNaNFwfT2IGBgsoI8oUq1AjDShAunhLGh4HGCWsApRDc0qKUTkeliH5PEANaS4WUX8H+DwIGVILhDyhRq5FERHVPpA9SyJMTC8EOIIsMieOCdIPiAy8fHUBXAkkCbQMdBM0ERo3yAg8BxwwlycnGAgkRphgnQT6ogP2E9QDDgVCCUQHFgO4HDATMRUsBRCBJ9oC9jbYLrYCklaDARoFzg8oH+IQU0fjDuwIngJoA4Yl7gAwFSQAGiKeCEZmAGKP21MILs4IympvI3cDahTqZBF2B5QOWgeqHDYVwhzkcMteDoYLKKayCV4BeAmcAWIE5ggMNV6MoyBEZ1aLWxieIGRBQl3/AjQMaBWiRMCHewKOD24SHgE4AXYHPA0EAnoR8BFuEJgI7oYHNbgz+zooBFIhhiAUCioDUmzRCyom/Az7bAGmEmUDDzRAd/FnrmC5JxgABxwyyEFjIfQLlU/QDJ8axBhFVDEZ5wfCA/Ya9iftQVoGAgOmBhY6UDPxBMALbAiOCUIATA6mGgfaGG0KdIzTATSOAbqcA1qUhgJykgY6Bw4Aag6KBXzoACACqgimAAgA0gNaADwCsAegABwAiEQBQAMqMgEk6AKSA5YINM4BmDIB9iwEHsYMGAD6Om5NAsO0AoBtZqUF4FsCkQJMOAFQKAQIUUpUA7J05ADeAE4GFuJKARiuTc4d5kYB4nIuAMoA/gAIOAcIRAHQAfZwALoBYgs0CaW2uAFQ7CwAhgAYbgHaAowA4AA4AIL0AVYAUAVc/AXWAlJMARQ0Gy5aZAG+AyIBNgEQAHwGzpCozAoiBHAH1gIQHhXkAu8xB7gEAyLiE9BCyAK94VgAMhkKOwqqCqlgXmM2CTR1PVMAER+rPso/UQVUO1Y7WztWO1s7VjtbO1Y7WztWO1sDmsLlwuUKb19IYe4MqQ3XRMs6TBPeYFRgNRPLLboUxBXRJVkZQBq/Jwgl51UMDwct1mYzCC80eBe/AEIpa4NEY4keMwpOHOpTlFT7LR4AtEulM7INrxsYREMFSnXwYi0WEQolAmSEAmJFXlCyAF43IwKh+gJomwJmDAKfhzgeDgJmPgJmKQRxBIIDfxYDfpU5CTl6GjmFOiYmAmwgAjI5OA0CbcoCbbHyjQI2akguAWoA4QDkAE0IB5sMkAEBDsUAELgCdzICdqVCAnlORgJ4vSBf3kWxRvYCfEICessCfQwCfPNIA0iAZicALhhJW0peGBpKzwLRBALQz0sqA4hSA4fpRMiRNQLypF0GAwOxS9FMMCgG0k1PTbICi0ICitvEHgogRmoIugKOOgKOX0OahAKO3AKOX3tRt1M4AA1S11SIApP+ApMPAOwAH1UhVbJV0wksHimYiTLkeGlFPjwCl6IC77VYJKsAXCgClpICln+fAKxZr1oMhFAAPgKWuAKWUVxHXNQCmc4CmWdczV0KHAKcnjnFOqACnBkCn54CnruNACASNC0SAp30Ap6VALhAYTdh8gKe1gKgcQGsAp6iIgKeUahjy2QqKC4CJ7ICJoECoP4CoE/aAqYyAqXRAqgCAIACp/Vof2i0AAZMah9q1AKs5gKssQKtagKtBQJXIAJV3wKx5NoDH1FsmgKywBACsusabONtZm1LYgMl0AK2Xz5CbpMDKUgCuGECuUoYArktenA5cOQCvRwDLbUDMhQCvotyBQMzdAK+HXMlc1ICw84CwwdzhXROOEh04wM8qgADPJ0DPcICxX8CxkoCxhOMAshsVALIRwLJUgLJMQJkoALd1Xh8ZHixeShL0wMYpmcFAmH3GfaVJ3sOXpVevhQCz24Cz28yTlbV9haiAMmwAs92ASztA04Vfk4IAtwqAtuNAtJSA1JfA1NiAQQDVY+AjEIDzhnwY0h4AoLRg5AC2soC2eGEE4RMpz8DhqgAMgNkEYZ0XPwAWALfaALeu3Z6AuIy7RcB8zMqAfSeAfLVigLr9gLpc3wCAur8AurnAPxKAbwC7owC65+WrZcGAu5CA4XjmHxw43GkAvMGAGwDjhmZlgL3FgORcQOSigL3mwL53AL4aZofmq6+OpshA52GAv79AR4APJ8fAJ+2AwWQA6ZtA6bcANTIAwZtoYuiCAwDDEwBEgEiB3AGZLxqCAC+BG7CFI4ethAAGng8ACYDNhJQA4yCAWYqJACM8gAkAOamCqKUCLoGIqbIBQCuBRjCBfAkREUEFn8Fbz5FRzJCKEK7X3gYX8MAlswFOQCQUyCbwDstYDkYutYONhjNGJDJ/QVeBV8FXgVfBWoFXwVeBV8FXgVfBV4FXwVeBV9NHAjejG4JCQkKa17wMgTQA7gGNsLCAMIErsIA7kcwFrkFTT5wPndCRkK9X3w+X+8AWBgzsgCNBcxyzAOm7kaBRC0qCzIdLj08fnTfccH4GckscAFy13U3HgVmBXHJyMm/CNZQYgcHBwqDXoSSxQA6P4gAChbYBuy0KgwAjMoSAwgUAOVsJEQrJlFCuELDSD8qXy5gPS4/KgnIRAUKSz9KPn8+iD53PngCkELDUElCX9JVVnFUETNyWzYCcQASdSZf5zpBIgluogppKjJDJC1CskLDMswIzANf0BUmNRAPEAMGAQYpfqTfcUE0UR7JssmzCWzI0tMKZ0FmD+wQqhgAk5QkTEIsG7BtQM4/Cjo/Sj53QkYcDhEkU05zYjM0Wui8GQqE9CQyQkYcZA9REBU6W0pJPgs7SpwzCogiNEJGG/wPWikqHzc4BwyPaPBlCnhk0GASYDQqdQZKYCBACSIlYLoNCXIXbFVgVBgIBQZk7mAcYJxghGC6YFJgmG8WHga8FdxcsLxhC0MdsgHCMtTICSYcByMKJQGAAnMBNjecWYcCAZEKv04hAOsqdJUR0RQErU3xAaICjqNWBUdmAP4ARBEHOx1egRKsEysmwbZOAFYTOwMAHBO+NVsC2RJLbBEiAN9VBnwEESVhADgAvQKhLgsWdrI5P6YgAWIBjQoDA+D0FgaxBlEGwAAky1ywYRC7aBOQCy1GDsIBwgEpCU4DYQUvLy8nJSYoMxktDSgTlABbAnVel1CcCHUmBA94TgHadRbVWCcgsLdN8QcYBVNmAP4ARBEHgQYNK3MRjhKsPzc0zrZdFBIAZsMSAGpKblAoIiLGADgAvQKhLi1CFdUClxiCAVDCWM90eY7epaIO/KAVRBvzEuASDQ8iAwHOCUEQmgwXMhM9EgBCALrVAQkAqwDoAJuRNgAbAGIbzTVzfTEUyAIXCUIrStroIyUSG4QCggTIEbHxcwA+QDQOrT8u1agjB8IQABBBLtUYIAB9suEjD8IhThzUqHclAUQqZiMC8qAPBFPz6x9sDMMNAQhDCkUABccLRAJSDcIIww1DCUMKwy7VqDEOwgyYCCIPkhroBCILwhZCAKcLQhDCCwUYp3vjADtyDEMAAq0JwwUi1/UMBQ110QaCAAfCEmIYEsMBCADxCAAAexViDRbSG/x2F8IYQgAuwgLyqMIAHsICXCcxhgABwgAC6hVDFcIr8qPCz6hCCgKlJ1IAAmIA5+QZwg+lYhW/ywD7GoIIqAUR/3cA38KnwhjiARrCo5J5eQcCqaKKABLCDRsSAAOaAG3CDQALwqdCCBpCAsEIqJzRDwIHx6lCBQDhgi+9bcUDTwAD8gAVwgAHAgAJwgBpkgAawgAOwgkYwo5wFgIAAWIADnIALlIlAAbCABfCCCgADVEAusItAAPCAA6iKvIAsmEAHCIAG8IAAfIKqAAFzQscFeIAB6IAQsIBCQBpwgALggAdwgAIwgmoAAXRAG6mGdwAmAgoAAXRAAFCAAfiAB2iCCgABqEACYIAGzIAbSIA5sKHAAhiAAhCABTCAwBpAgkoAAbRAOOSAAlCC6gOy/tmAAdCAG6jQE8ATgAKwgsAA0IACbQDPgAHIgAZggACEqcCAAoiAApCAAoCp/IGwgAJIgADEgAQQgcAFEIAEXIAD5IADfIADcIAGRINFiIAFUIAbqIWugHCAMEAE0IKAGkyEQDhUgACQgAEWQAXggUiAAbXABjCBCUBgi9ZAEBMALYPBxQMeQAvMXcBqwwIZQJzKhMGBBAOdlJzZjGQJgWHGwVpND0DqAq7BgjfAB0DAgp1AX15TlkbKANWAhxFATMGCnpNxIJZgUcAMAA4CAACAAAAWhHiAIKXMwEyAH3sFBg5TQhRAF4MAAhXAQ6R0wB/QgQnrABhAN0cAJxvPiaSANRyuADW2wEdD8l8eiIfXSQQ2AGPl7IpWlpUTxlDyZAAAACGIz5HMDLnGJ5WAHkBMCw3KUkgFgM3XAT+zPUAUmzjAHECeAJGEYE6zng1NdwCAQwXGSYLGw60tQIBAQEABQIEAgIAGdMCACwBAAUFBQUFBQQEBAQEBAMEBQYHCAMEBAQEAwEBIQCMAI8AlDwA6QC6ANsAo0MAwQCxAKwApwDtAKUA2QCiAOYBBwECAMYAgABhANEA0wECAN0A8QCPAKgBMADpAN4A2woACA4xOtnZ2dm7xeHS1dNINxwBUQFbNEwBWQFoAWcBWgFLUEhKbRIBUhoMDwo5PRINACYTKiwuMT0/P0JCQkNEE0UFI1ZWVlZYWFdYLllaXFtbImJmZmVnZilrbXV0d3d3d3d3eXl5eXl5eXl5eXl7e3x7emEAQ/EASACZAHcAMQBl9wCNAFYAVgA2AnXuAIoABPf3AGMAkvEAngBOAGEAY/7+rwCEAIQAaABVALAAIwC1AIICPwJCAPsA5gD9AP0A5wD+AOgA6ADnAOUALgJ6AVABPwE9AVMBPQE9AT0BOAE3ATcBNwEbAVcWADAPBwAAUh4RHQocHRUAjQCVAKUAUABpHwIwAHUAbgCWAxQDJjEDIEhFTjAAkAJOAMYCVgKjAL8ClQKVApUClQKVApUCigKVApUClQKVApUClQKUApQClwKfApYClQKVApMCkwKTApMCkQKUAnQB0wKWAp4ClQKVApQdgBIEAP0MA54CYAI5HgFTFzwC4RgRMhoBTT4aVJgBeqtDAWhgAQQDQE4BBQCYMB4flnEAMGcAcAA1AJADm8yS8LWLYQzBMhXJARgIpNx7MQsEKmFzAbkA5IWHhoWHhYiJiYWKjYuFjI+Nh46Jj4mQhZGFkoWTkZSFlYWWiZeFmIWZhZqFm4qcj52JnoUAiXMrc6cAinNzBEIEPwRBBEQEQgRIBEUEQARGBEgERwRDBEUESACqA45zANBYc3MA1nMCE3MA/WFzAP0BIAD9APsA+wD8APvbA4sqbMUA/QD7APsA/AD7I3NzAJBhcwD9AJABIAD9AJAC8wD9AJDbA4sqbMUjcwD+YXMBIAD9AP0A+wD7APwA+wD+APsA+wD8APvbA4sqbMUjc3MAkGFzASAA/QCQAP0AkALzAP0AkNsDiypsxSNzAkoBPXMCUQFAcwJSyHNzA6UC8wOl2wOLKmzFI3NzAJBhcwEgA6UAkAOlAJAC8wOlAJDbA4sqbMUjcwQ3cwCQBDgAkA2UOHQnATNz3QdFdQoqcwEEAM1hCXNzAFthAAUaOQlzcwCQCXNE3wBQc90JcwCdbXNzQ4CD8BW5tNbewS6T/Np1iIh1Iy3DtPDAAXjPx9ENpwOgreI1z2BewtbX8Yi21FG1bBeCk7aB4sFY/Hi+/ekcwwyBHP+f0YI9G/iFY/5bObtuyY4MTYyHeQiZ62eBq/P8+68/rJI6cCQTfucgoskxeeDzvfo6MGQtbufZbw0FPGPpUNSG9SSs7NDWGUbpnlDGReZvnpkqvyGbE9edMaFydt2lujOB9XLYEAXRfM2Kx0lHbXJ4cszHh5aoooqxDeYXz4qvSy3ahNyE6DBY8J7v31dfMFEdiyjfirJ6hX3Pa2ygMOeuVytsRijRhyF9mVnMu2RxuZv3hI/Amu/2xe54SmySPFpHGxTUY0pe8SZ3I+HauujP4GbIzZYg6enubuUlyP0funGhg8HHYTHFSQD9Hm7HGbFy4n0sziYcpwdArgmsyy41VMV2ppGXMiMR4deCi34NNmlnftVdxoyCJzK+r1GvJvWDtbf4dPnrf0G9qOgEs2CpD3n+1P6MHu+kHtsR6lMcf3NcCDlg2BVcCpSVRHQRiw7qolVbxHeM9xvBMbdwjpFKXi7QUZOi6YaKam2q+tP/4Q5El2aNNWkj5UfSZY4ugEdPUnNXG3TnvpCSZ5IpiIvjM/Q7pZNYYv80gD+OdT5J+D+8K7RPkhzH4w8mJHEG67poqLR0JygXeOe4Qz7fpS6uh/vOXaryaHpamD78JfCU/VdaCwy9bCrfgh13NQynhoIdWRr1IQREtBfsr9bRjkodN4IdiTUMDdlCuM8mKFhoQzu5fn+1PZwtWpT+RAfPcOYqFvyg15NH3r44CwuiNOuJa3QiXx/LenV02OWmQIs/SX/g9e97kXeFyzzC5o3GZEj1A4edoQL/Hfudd5DbKP9jRl8TN4J6Kc1PFyNVAX5Xac6bdFhUIzF/y2fxEOMqCLdbgMjAScVBfo62Fi65kWkU5AuSnpXNEa53A8jiHAFWPQRbvChz7XzIQ1/JFkW4oI8xBV6UfjKIPDLC7squNvW2nzcUx+fOUY3Ocin2ftqIvHfTUJTRNcd7Ke70yAIwvqOtwoyPaZMBpoXD8wnXXhGcZwxMUx5c5bPIUoEI0NmMFTasTLrC3msRFOTj05Bautfl1sY/SvMF/LAsyI9YLxLDyLAdk5DR3UM3aUic2osD5OeVdqZVW/Q1m1ebiFPdS2jIqNLulNQ8bGE2SLfELriR1KiTO9P5+lrvWYO1fSrGrUt2bWuylLbZPkwOvWGZpLOHyarck2ZRqWS6sCGey7WyzKtSLDf8N998dc1hh6BN4lUthsFzHww9KK8RpC1vUV1amMjRDMR+KvY6u8hOpZEzHdLMb13izFQP3ijwSQCEFVH7Js8hL21h1Vgxap8exSPY1CBI89DYkx6Tv5XhsKTqejQ6qbBFVPb0FeZ+D1SdjxYgqAq6uvJHq7PW8hluldBOJ7puqANPsXDOtG/su5LwU1PnRExiBpZNO+7blORJ7i9gQYmu2AXSSiKxSZIyyJ+0umdON6y4aPTTM0FbgQzMWfO3PXOymBuZ9DjNH4dcMJSwm9PsU05clrl3w1WkZ04jCxhragJpQ4w9q2B/PX0G25bXPNnUGKSL3EAHAUkcsOzO66BRomJQr0Z8uQAcdKYDE3iFkuZQy+yZq2C3vghrwhw2d8jCgn3V2SEF0Obph80afZ5zohDVBkZps5UEZmSaeyACcgZ6Ecj/Z3Shx0cxedqpF4rbvSD14by33Qb4gSiKqHx0WH7WjNWW+fZz2t1PtJAPWvC6IaLarFyTSGtiv46IG1Q3YMBw5bDrisQFBnBi22oUgsO/eSzcLI5+wpv1ZX3aTHBQ79qiLoPd5uu6JrnhGzEeM0/gRT5wwCJ6uPDv35Qi4MGUO2s9+aimuET6TexV/KC9BGv9ibvW0+9hFedmTLXfrk2/sgHRe5wZPR6ao7kFwN3Egab8d2ApFPLOUgTY+d32/+XKglFsszuassqJBzo6MTbCwlYKO4yYdfk2gfjuHXxxdIjaUUcqePg/jf4AWUOsz7EjkKaPqLCzwTwkuPoskO+HPvSSIj56NBqwhlukh/SUlBPCAvpc+1hWM5aIt7e+NWicwHeXmf7JihSLmAxjDWNDmv6lSpQAYgl3KGYcLR/SwD/UbzS+YBYGKLhVlwwyGYf2autLOFuC7hdVncxFH6lx4+53/q/z8ukeP5C9jWhZLQvvvXJkWbnwQUbH8WW8VDTl7dYYgEw/d8e8PZVIP8QO8aJwNBObbcAh1bZg/ev/mIcRpHqvapWZBZJccfvQ55WYxxTdBLqYbSDjLNfI0d/IB7j1JaX07Z1abn2SGfV7zm8TU65Tqui5ZG/m8fTS7ZJVkQbJqcHfdRPbFKgIm9Q6lqhbspKIufB0JN5lyRQHiZp5cOyRLL44fHhfM56Ukt8hCMN0cSOYZcp5mvcoAcpVNPjMcA/siqAhaIn3EO6j0+ArsfN/wEexl90dGjecxE+R4JAHU9hBGZrDrJJ0L3FasUPVvPdmvrRUYY0LSEJpgUBo4pykiQr4GRZ9cAVKhzBxs86T9E+h0iOclANvJaS1ozReL9coKT4XJH2R15ed78yO6xqF3vPVSvwW+hApUYHspT4xNknEfEBks2ZT80sBfcq+kKqQeraVh2FtwOkIyPZc2PIZqDVqS2OfSXUEJ+aPajbV+aVHDMxPd4ak0ln8Lm3mlBsJjoNzm1LCOw1FWMbUNFmAyj82fesmdYwbtO9hz97ErIjkGBD8ojAOzSZzPT7bq7FxmZzdfzjVX5lq0DgHNm/HtOP0Fha40VmytaL4VvkkkmaH1vfbxgid+hNPqf//ggLAH9wOu9cN3TPGf7RkhvnFBg9Ue9dEMIY0QnUn6WfZwgFnf37KcfXeA/7qvv2NJesfukMgngn3pyJLjhbJ8DGZvbF61Q19ZVHZ/HfiOf3XZwiD/xlEDb+fuGzUrWRq7IMm/Qsd6SJc6Lqt4i6YC+L5h62FwYHiS63//p0lyL3iAb18QEPtnpbEUty0Zrt0fktA9L/YFLfrzYT6atdQjL6OMhCrZ4O3UUaYR0yme/4GNO/yHHufyAVpH/OIPEf2OzptXJ19+tA+NpivJNqCKOwUsJHqTzrT2G77O9dBe4ZcGyF0mPkzzJEpTJOjkgCt47TXZnFahlCXR9VbZ0lb1c1wAqXTKUqyPVaxz4Eu3rPJHiM3IXQQ0NjTvzUPG258V7vbrgoezETHlADY7B1WeyNMFYVE/LaWY7bSfQb7lKJ/KMRmoFwCrkwMEEkDen5KTEXCfVJrN+v4OeBxxE44mtzJOKdlLb7tqPfXrxftovGQyuaJhwlI3qpYBgfatKX2BJFeGTK5b4b9aSrMIv0QoyWUKQxoWaM41bP4QW5RbSawNQdN/0wv7aL9Jkk5J66IDpo7KQGXAKznLFeMn7t0F83ZTXPCDUhEjgWM2SA9ChmM5YEHa5l1hI1fsf77dxeRWfVHKPsN3Pbl3Dy5b4QIYb6N4Pm9jAAQLmQlaBBhZw5Ia7PfQ+xKgKJFQbR4F32mFfupbsbWLM9jDeqYdACLyf6uAKgVu9AJQpYtNbCj5wj9nXAWUWbWQL1cXcTXoVZqxjtyS/BsoaURCQi3dk09KVzUA0V6ZlrQ53Kj5AnQOcl+5F45QK+I7z2+zhbRVGq2VwcLCugx3BCQZwoiwsqtS8RQRixu4k8uRiaKZ/k7rmghRah8nMGZhmN6r12o0TqdMaPiD/n4TLE9VhVaO0KPZEGCIhU8QX+UXBAqICxssIsyKn1OrvUgTYYTO4jXEpu2+kVS6L6T5gjC1tufk8YssX4CRRcvyMaWoJuzmhC3Bq/DBUCuPaMuhQPIQfcmps2oqp9AqlngtSCo26+n5fKqSzEU3lpH1SMPRDrw6OdD/LhpNrs1YTHgMmP068bb8qMgF+/ASQedI7CvWdu04rAtlsP7kSnTDkyMw2LiZnpMx+i+ayXB7c3ckJcjFuig7H00vq2OQzM5PPevRdYi+cZJifcz1t3cNSD0yuvsuFXD/Nk2j60H5RpUU+Zrlp99wSgKEAkuC8nBJJnZ9PR+DkXPe3s4UeOKoq99964VWB9Pnva6uKI779pgq9oaspNcGV8vSOMCM8ACQn9kUPweu9UwI2n5+goo05CFaR5kALF5jhYmybPavdtAxmaC//LVF0ZLRkIcU+NGJzY3OdUKILkQKUDGABumIZHHzKw/jCOmPL+Zl8t46Wkz0WFvi9Gu4zuSn4okuXcj0BSeDVzHIf7sqCBjmC4zCJ+jyS/+Gq2fPUkgfW0bxdgVFMY+zY3TQuMfygLLiF9MzfKQiZXIgzRm4z85AALjRtWp3nO7kFP7ApIqqe2zn0NfjROHgw/hqbhgKGKjsXzu+rrdu5HeSlhWO8hxwDmVaQObSdcyTFMG/YiFD6lJGKdFb4NNS1HnW8T1P6nNQPqraOBTSnQKxz5tTGqNrbaAE4Iio3Cj50ZUqo6/O5OAtJ6Bznp4gKMgBetgD11fCO++j1RdcFdTbD0tkgfxXgzJTUtWCUmdYjl93RR27ifZGYzgK23MdwF4zvKNem782m0dQnmh47Rxz3+2MVhiiS85nTOXxmaODvzAWBE2IQowSrbzE12IJ82fOrvritWvRIF0aLCLdEytK+NVdDxLvmdW+dFeKOa/ocw1Son0O6OzX0lBLmjYSMQSrFe5X5yf6WE2ehsLrv6M8Cqjvwr+u9X+kP/f3iAk31TV+K9yZKQqAn3QOWy+9Hz7iVWRMuM9hs35+avVy4pXASFbOjGdXM1fSQkLOWmFUhyadKWYPjRZoZo0g3CS0qhz+mjygAvmtkYRBcGNpYAEYoIDEwQaswtATb9HLzTetQL8aK79YSb0vJNPSYzsij3FcXbmfnMiaOJIGrrBJnAPRqg2lmCZFXOFah9l2GRBm8HJMGeiupFvR0aRN41otN6X6tGTxS53wk+2+w+Q5ABTdCd15LYZm/a/3bxe9RDQJ5HZhLzr5x1ccTkxBkbxlYBGd8AKvkL2IR3V283R5noyhAM5o/2rKEi4U6kxCV5efr8llvLFrgjPIwS8iES5jxmV5zyPzj7TyzJTJze+9tgDNGYRyyXPkU4mtAh8XUy9vMigfO+1+ZKYW2WCFjDUfvyNiplha4LliPPg8Rc890ZT+F9pMYPAmEg3JJVUm3fp5N0IPNMAYKmbdj8dkIpjDhDJUd6o3G858DgYwPhSC+z3a78QpEmqq+tRaHEcQ30ZN5KVVdASN8NMTnLKoA+IJdapqCRgooGTkhyjB1yEmjSy52110hPaqe1upiUeObsTXtGELTk2p2NZw/3PzU281tafWNmFUPAmooj83DhoQgKPIB7f+NGTDlTOtyPgN8pIB/lnFLL/gcwigZPKDW7p6hnW/GnAzyNS46gLJAl0Eyhqx6UWLeQTU7odMYORK5zf/FV79JGVPOQpNUA58rlB0ugHsyeub8Lnf9QQ4/N5sRKaUjEEhdpF28vfgPZACBbg5UHuVHl8Lby8mVGsrtI7TjL9U3mbtcF+cXQI/5AxT2i0MyciXEKZ8OjvPoQHHU/YSnCXtEp2r08SJxUAHIz1zM+FwdRCYPffQNi2NhkPWTiYTxJ00WVZIrHwmG7jzOLcfWnquJkpOmdPzXfAu+s5EADm0X4VmatqLjVa86dS7Os55qXuRa1Y7dWGvv57LjBlKKgqsbI7lwfyBN3qkKBqe7nwUDn6xqhGPiUPT7j7s+oD52AF6oj6SFXhYWlRXy+1FL7YSbjFxfFvJt5tVXMAr8/voIg8YRiBsKB6eLeIG5Y/KmGmFBxxYzSH7W0IaK3IId+cBlEk6H3Y5BqIBfvhOOBtInLWnsAoRpqlkxd7o/+LP9UXEahdcYlifFlURgUJl0Ly6LHjSZN1CfHB7OORacnBdpIM1lRpBcvwkeyXUvndU4zrfqwtuBEpxqvk4PZPJMByJXUbXie52mfUB689h9GRV99U4gzn1aTbHPWjbB0DQ0Aes2E/ZzoCTxCef56sExSu8ynaPxuDOOeD31OWT0zHo1XxSPQbclDivD+4/v1aWdhGXLR1Ui+NzuQK1NTedznX44c5T3b+2GZZjl5RqH8KR7FTVjLAXvg64Gpc1RROH24J9jrNDyvrMxY453DRUjZ/K3zYJC+M1JxcvLkuZALsXVQ4Z7sj0EuLbRnhTKzRGwFrpXcixvnCgRbJrCl3+RjyWVipph0VLB0nDop/tvjfFmysZ+d2/k6baJMxYoqnE7PFceicrxUYyoJ2LMxicgJqrgvSR3mNJTkvfTU8BIoZz3PpSIS+Y7Ey3MXecxcxYZTeX62egI5Nub2z8Bj4Eg71YCz8Oiapkinw4RRlL+0c2/6jDqc8UK4Zzi1X4aIpgYsPJQOEz2YWBdvH6z5CuY7UvWK2F0Mg4ofRVBArX1p9Gv5VLqWYyL/raRVWkPNI4FEv9+ePcdmBSQR4CFSO6TG13hIV+cm1dkd0/Nt3r28H4NU2knSniDCeozM/Btc4i/ni4H83S2/ktAAvUM7UKJPT+RO8LOlvxhuI8HQmAuJCzVH23R/0JovidxgdJ7g7whCdVQa9/TLFUJWmNSYAaPRAXW/kk2UBmAz6f6POK1zcMlmI8P9tqW2qVXABN0L0zHarXbWHlhtYpXMEda/pIHLwu8RHqmWWMgMzkyKicSFKK10UvZRdcO8fCiSijtFIY8qW7CscvtzpP92lm+c648urehw35v1EOfO3kdny+CQm/Y0u+zPuevhCrQKhTsUq4G1rNPoGuVzvhf2Ui1f8jzvx9fJbQR69A0ETLUUC2ndk1YFQNi22yLwyZyw4xU8P3RGLM5qojKNwHAZAMAEudzg8UdfV6i4VktOLbhhHUPqpCn6dtpnr16rINs5hWJGMYXaEn0irFCuoYnJEVhdJ4PZLKuTkrP1UUVWZ0SMgJ3F2I8YRhtLwK4dhh/oKk0hdVgEH/l2/0c+cLlF7kpDuF3lC4fsFw3V0QrwH3GLNb2waS18OmYB07yaLEqhd58bSaGJZzePoroV5v3UK46/sWdKczstFIiYLmmKeaVGRNo3IWk+dYUqWy5aJClXj5tf/v47ijlkmMDP+ROUxoGk7LFzne4/0CRPl/5SUyOa679jibvdVQFZ1o0H9kBux7OSC9B+qVKE1trxr4xqTkjc1ZGZBpY0zyKBiu8wr+/KXc37u0cdXGJwY/aTic3kGj4jt3y4ZwleKskyXMFHKGwVhqpFH3ba02boSzGHyPMAe/reVqWSTT2Uz47+uYvHZGNASqYQ23uZoxalHK+PGoH9trTVaw2KB4dH8fNrXRLhiyxGdRtS0x8k3feeOvsOdKEdaOf3IrfWCZM/n3+hVJizA4zoX8MzsIf6bDfuFXIIRR2RN0rICZcMRmnRxUXT+YMOid50gg+Nt4Uucemmbd9kvJG/O04PVC0vm5gGDlIY3THI2+l1rZcMOuSDWBp6I4Eltp7naHZCdaPUWnQ07VqO49znDgCmtu5Tb+SSEQJV+rJsiXgCqoeeQciher8cqF616P8qlZeonKihdVkj+RTnjOcnoERWubvyaeFO6Ub3dhh0qmm2RD4enszxE1JaAaiezuSoCayJQP931HGcy0NmuVr/UV0pvbwICLpBbVkxC6qebjLGRXucTG0dbQDFPz049hMem2pb/FOTGYRLR0uPCa0oIwc9Z/g+Iy/zYFDThHi1cqbK824savKGMLMj7j87RT9NMwxaI0eKTfMFioi9SyLq5sN9pV8be2FrOc7xMOdv6btXyqFx63y9fIGMBP2T9Wmeeg61ZGdTE4IwybcGlXLJ3qLbRRpQ8vSzcqFobN+QPtL+51hadAWtRbF6aJpeb7Gca4/Ldh7BDvEbrUuEm+gTyVMeRQ3Ypf9uyFjVstrQIcdY+aur3LC5I5OOnJck1zLUKxLobjy9slG3hv6zylhtKbAbpX5p8Hc910fCT7FNH5/t9xEJX9kkeZ9IMCHAk9zn7L3pXEGZVvdaf85NtlemPpY7iSgSC7zRGsI5W6/UEwX6jDtNVZ9VqPDBe/EqmEEsGcs7jZPQPhi3xpj9UXWQLiy6tsxv/ft9aKQnUg0Sps/x3AZ2uK3ETGTQogPTMQPOnoU6p5KuS3uY6DfW0GeGQ1wNpGzGoUdRJRvHP9MDQpWRSZqZkE/rcNnQ5lS9BmMDW/umgZQD1C2YXfZMy7fIVXo121293Gfx9n7DQP6OxSqiSTNx48KId9kfGYOnV2Wg2TQQywNBRB0mSmqa/jwoBDYVDl6B0XFrVEAwbnhLyqGp5BH9bzsWrrFlu0x285RpqTylTZk3rgcm57prav0DUAKUd02vXdYyNBf7sfX7VYn0Syug9++ey/dHoG7GQzMbhXhtEuRXv6YR20SQgSOrgDUGPR4HhS+Qvk2zOtyH8N/lHYfQxNKt/f7uCpsBBh5eGZaeWNRTBdOObWOvyKJMfD8FLEX1v/5ywtRV27weRzSNaHEQFE0hIzzS4VPzgWtg/4bcetwXpabsePP192muNPyXiRzRZkoeudA9D9x/oVWfRieLfjdXbi/41RGNB3aIj0IxCBHSvUN7LzntO6Oh910zV9u4Glrouyr5odjs8/fW9r0buiTMWTjjLbi2k5tZ3m/134ci/d9f8zuv+4BI7F13Mjb7DTTD5ukfqNTlNC4V9PnfbGAJdKLEDJgBPKyYXCaAL9U5Cxi2j5j+IWmNg6NSnWcATzmOO4+dNBmefy6ceyd8J9/Q7amUWVVkuNVSq3iWEb3UJP7kG+P8wfL4xS0ZNuSKYuo9KpdkJ3b4PYRNSzF+8OXKDWqXuWsan/wconybIRBoGWHMuCkb35BtGfiqZ4hc2CCapKiLmrWnBLlRT+9GA0Qcykkg1B6C3kESJMu2dWyGabbhRwxUeMxARHqbXzHmHpr4Z3vmOxHZ6b1q6MJ0Vb/XKkaPF4xn/VindEJ3S8/9xcGF+PNFuAXc2Jf9uZLLtjxDAEeohd7wjie66LHvcNT0UpWif4uCox2YR/liegMgx8vEbvQClJBMBub7zJQMCr1C/Vf8siWQASp0Ewd7D2uP6f9YTISdEaUAzF9rST9JTHxez310BfdgtWKU1ZYoRuDZvGn2tj9DPjXrkgCr/13OHsP4MOC5b6YqHSedYMW9bEfS5M3nO7zTGS85BzpLTIFqAGhZJLEyLFcZXS7hDhDYVvlm10RLEslMK0cUL/9xqTMOX2iR65umsC8dW4hT0Sg6Tf3T2HAxsHKcNzoqFwuM9k3/LpYekhRc0C+f1I+vMQ4thkfSotx9GUt/cdRosaE8XwqV0k+8ZtU+jv8nn3lbcNxfXXKi5l0SL5kMmrCdrxeVVqxBobrFF+tb0wtkN+DMm88I4jWH/DcdJOjcMOLEsN70vlsfIi+NexpaT0ZsnfewPoTvUSXqqfhRcRk3jA7AdYHEFk4l6O3fe65uZNIMf1lbtJNCNaK2+c5hGKLcTSrBmwWv9TP6JDfZ6UY96g4baayVCbrDpXePgXTG6xO3rT0DAXG9OuPxkSEPLJnqxQViyYQhCp36Q2yFpF6cR04RO7Ab5HPrECqGR0Fnr2gzmjx49XjQf8N5Bk5XH0dh8NOoB62acHwMhlBM8duW9tghc7CN7oz91UEyd8fOtwDK/j7SykdllCAN5kUrcawufMV9y/EqUoKHtP5i8MgQY9RlZFZzi0BeT9Ang4mMIvWAFChZCNnb4tT5cS20jeit8JEN4tz4mUmZxDwiWkEucI1KF/FyAnvE4wybWvbaxBYjT2jdhlzd4y/eTmTl3im5YImADc2unOtmNTcgMdOb9kUgJmgzY/hDaAxqvwLEulLsjq0bsfSE3tRYCRn6xb0uv5B5yFshhewdO5KgoLcaGeqeg0pa9k2RXM32g1jE1UDWO0CaMobavPk+4u26Tmgg6VindBdYdRxpGqlvkxai0K/atC5CWUxlHuukX5b+hg83khzsZK7AVRVptyVNicu0sfQToTDEeIeDdFvDrReJUiJGZcXAhpRL3OufhL4aDfO1zsCmfGq8qFspBiJe13lgS9GguiMsdmgpWOhHkSTVkWnMOnUeIJgqZks/AwL/1yKPm00t6x6qLXQrCJrysUwR+ILJdyyyuUN4BuEtCDUXMXPU5srsAnDUhSfFM/j4RK+cK01o6lXAVbhiOLaaQtpYN6mCOwtJNcVqEpyrxXuWxvE4mbVCytBu/qKO4X2BI1NUSlj/g6FQEiYsXMAQuM9wnHngXKLZRWFHcgroF7URRzLPrMQUfALjbga6S+tGc3Tshv6PA6xeSqRPDbLG+X+0qt9crNzbaxGbStSCfYhdRY4t5BSVY9Pxl9trcYFiUdsV1BSwaZM5u8K+hUm8HV6PoLD/jlsRRzgUq6O+Qw3asFkTKm3clSTo8VtXdpTdzFAZP+tVvAjkfGq3MkSLyTYi08pvQ3h/L9o0JpUnnQeKxXk3qIsGGsH1BXzcZT+voCNv39FSdg6gNY51z9Cyq5Dql8wER5ylTwnLVeHlHAn/HNwxGYeUqrrc2gcmIybVKVD1XAPXjKks2+oHZk4OXYP6+LwVaFEApqEMyEusTgVFTzdjVa2BAaELvpyVhOSMW/ae3NwMfWId4Ue28z5IzumOF/CmY1GmXBOWBf2hgp/r3qS0GU7nGETmj+7Tudbjd1cKhgP39tVtWogjxHt6NLXz8OCbV1nIBG+mmrrZDCbH/o4Vgn3gZkRkq+iHOVW82LunJPXBZjX/ntmptWsqP8nDZBSb3TzAD4vSQeQ1GmtgGWAYfB951YKUnFVJb0z1YRjQqVksL5VpD4N/Vy31vtYY/2g9TmyMADPgCwwA6MhjQ9bd1JFJ3Vls7lD2RYjdIwQwhWzBRPfrxpKcYeu03F0/odRbEc9RZ11TxVY8mXqgJx/vDk0eF4MPV7lgBxYqxoGfEtGZBC1kZlxbcez4Ts4/TuXJ/QsfWT95Fwpc4CtiGCgU4i7LHgoDalqmBabvzV5xvq2pMVourJYZ4paytzilEG+lADOGx7qf9O5/4cP5SqyTCMG4I16I/6I5o4Y/QkWX9ctABry/8Adxz+ZB8AI1yUyNXk1Z073ECiDJ1EuVT69eIDEAlbnv24j4DJGeqIV1b1GDCHJ+OFD4W0gXUs/1bMkNESNKl2ON6DZzAXvqmr8X68yRDgIReKbX1SUwtzYnyadBLhEWS0WTE7T1IxC2SHChb1NFD+2rtJSN8OPTIZRqiizaoh7OSSNpBXJMkKcUQZV8sXw8VkU5ea8j0WZ/YK35loUxE1aG30SL/JYxZWlUenDyKrfbHWJ+z6JOsV0e1Xfw7VGavtHACLwn0tTG9e3lf++w1MCVjFIyU57uOlbTkUSnxAjzmA71qvjTzHeMDWcK099tm9rS8cnfuwxq+YRWANkfmLbCl+74mg4bccPsNY5zz7cjbaFAL0hAwId61yM5uqhMBr4Wcew3b2spG5tkKFOnADeXkGkH4vk+f+an92mWXemOFCpjRsFeEnPEAIsLemM3QfMoME5/w+7Y48y/SvkBN6/KSRVmB7/rHiW7iVkXF6Y1T853OaDg66cIfWkD5TqCDugrlaXlEL1fFjxPoKRHkP5GD/xDiscNH+Dp2fXEKUpwAvC8JTNC+k9JpaMXUB7oj4p77qiAOjXD2pT4v/v0Ukid02LpuYsS7/ScDL1SxB9hxxbkeGOMyPyL4HZPAbyagOgP5Xe2pCqMPyj/KJ0blDHzFVBqzeLIO5D4yq7IpSi9p/QlHa50sCHzGoMqrBS8l9IfRyhq8IDQtOZzjgdvgQDwH7cqa/sybwdfcQse9THS08maKkkgnOi0ShO8Gyf+WL4K9DX11CF9uIbVwJUaCv8r/6FDVOdsEjeumisIJlLJQsjjkEL2QfEc68oqsevnNAEdp4YMJivwBJnE0R2GiBFRTJZNkq/MHDP9O5unQoRoivMJkPm+A0K8CQNXL6V3apC4ROBTyJSW9oOGNF4YrwoTFyz/pexIkeWQADpi+M7q8gBlmGRUune0k7cXyacdbOsD0Q1JQat9T8nmHhyO8PNd2k4qjZsQCs6lEcmaThpVUzGzWOJQGGf2oz7+F/bMfUMARo1PD0/yIhVDK+8MGRo/uByG5UAwPfNeHAd09gkMFpZmTN2rZgoqdSjwv1SbFnFRAqYuzwW8P4+Rk9fE3PVu80HKcXyIEvPfit+o+pnlHDUKKo32HapcVtQhsNiIdH80j/lRnJ2y5RYRbECyY4vl20j/NiBAD0Z5jxWWiL6xAZIonSEJb1qhwmdRp3hISLL9Q1QYOt6C/OixU3eUtXblgBu+fGPAQE0o");const Z=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),W=4;function LA(A){return A.toString(16).toUpperCase().padStart(2,"0")}function lA(A){return`{${LA(A)}}`}function SA(A){let e=[];for(let t=0,l=A.length;t>24&255}function nA(A){return A&16777215}const FA=new Map(tA(X).flatMap((A,e)=>A.map(t=>[t,e+1<<24]))),OA=new Set(h(X)),gA=new Map,x=new Map;for(let[A,e]of CA(X)){if(!OA.has(A)&&e.length==2){let[t,l]=e,C=x.get(t);C||(C=new Map,x.set(t,C)),C.set(l,A)}gA.set(A,e.reverse())}const L=44032,b=4352,J=4449,G=4519,rA=19,cA=21,p=28,Y=cA*p,kA=rA*Y,VA=L+kA,bA=b+rA,JA=J+cA,GA=G+p;function iA(A){return A>=L&&A=b&&A=J&&eG&&e0&&C(G+c)}else{let n=gA.get(o);n?t.push(...n):C(o)}if(!t.length)break;o=t.pop()}if(l&&e.length>1){let o=N(e[0]);for(let n=1;n0&&C>=n)n==0?(e.push(l,...t),t.length=0,l=g):t.push(g),C=n;else{let r=YA(l,g);r>=0?l=r:C==0&&n==0?(e.push(l),l=g):(t.push(g),C=n)}}return l>=0&&e.push(l,...t),e}function sA(A){return wA(A).map(nA)}function zA(A){return KA(wA(A))}const fA=65039,BA=".",QA=1,v=45;function U(){return new Set(h(B))}const TA=new Map(CA(B)),HA=U(),K=U(),_=new Set(h(B).map(function(A){return this[A]},[...K])),xA=U();U();const XA=tA(B);function $(){return new Set([h(B).map(A=>XA[A]),h(B)].flat(2))}const qA=B(),S=m(A=>{let e=m(B).map(t=>t+96);if(e.length){let t=A>=qA;e[0]-=32,e=D(e),t&&(e=`Restricted[${e}]`);let l=$(),C=$(),o=[...l,...C].sort((g,r)=>g-r),n=!B();return{N:e,P:l,M:n,R:t,V:new Set(o)}}}),AA=U(),P=new Map;[...AA,...U()].sort((A,e)=>A-e).map((A,e,t)=>{let l=B(),C=t[e]=l?t[e-l]:{V:[],M:new Map};C.V.push(A),AA.has(A)||P.set(A,C)});for(let{V:A,M:e}of new Set(P.values())){let t=[];for(let C of A){let o=S.filter(g=>g.V.has(C)),n=t.find(({G:g})=>o.some(r=>g.has(r)));n||(n={G:new Set,V:[]},t.push(n)),n.V.push(C),o.forEach(g=>n.G.add(g))}let l=t.flatMap(({G:C})=>[...C]);for(let{G:C,V:o}of t){let n=new Set(l.filter(g=>!C.has(g)));for(let g of o)e.set(g,n)}}let F=new Set,EA=new Set;for(let A of S)for(let e of A.V)(F.has(e)?EA:F).add(e);for(let A of F)!P.has(A)&&!EA.has(A)&&P.set(A,QA);const yA=new Set([...F,...sA(F)]);class jA extends Array{get is_emoji(){return!0}}const ZA=mA(B).map(A=>jA.from(A)).sort(PA),aA=new Map;for(let A of ZA){let e=[aA];for(let t of A){let l=e.map(C=>{let o=C.get(t);return o||(o=new Map,C.set(t,o)),o});t===fA?e.push(...l):e=l}for(let t of e)t.V=A}function z(A,e=lA){let t=[];$A(A[0])&&t.push("◌");let l=0,C=A.length;for(let o=0;o=4&&A[2]==v&&A[3]==v)throw new Error(`invalid label extension: "${D(A.slice(0,4))}"`)}function vA(A){for(let t=A.lastIndexOf(95);t>0;)if(A[--t]!==95)throw new Error("underscore allowed only at start")}function _A(A){let e=A[0],t=Z.get(e);if(t)throw R(`leading ${t}`);let l=A.length,C=-1;for(let o=1;o{let o=SA(C),n={input:o,offset:l};l+=o.length+1;let g;try{let r=n.tokens=ne(o,e,t),c=r.length,s;if(c)if(g=r.flat(),vA(g),!(n.emoji=c>1||r[0].is_emoji)&&g.every(f=>f<128))WA(g),s="ASCII";else{let f=r.flatMap(i=>i.is_emoji?[]:i);if(!f.length)s="Emoji";else{if(K.has(g[0]))throw R("leading combining mark");for(let E=1;En.has(g)):[...n],!t.length)return}else l.push(C)}if(t){for(let C of t)if(l.every(o=>C.V.has(o)))throw new Error(`whole-script confusable: ${A.N}/${C.N}`)}}function Ce(A){let e=S;for(let t of A){let l=e.filter(C=>C.V.has(t));if(!l.length)throw S.some(C=>C.V.has(t))?MA(e[0],t):uA(t);if(e=l,l.length==1)break}return e}function oe(A){return A.map(({input:e,error:t,output:l})=>{if(t){let C=t.message;throw new Error(A.length==1?C:`Invalid label ${y(z(e))}: ${C}`)}return D(l)}).join(BA)}function uA(A){return new Error(`disallowed character: ${q(A)}`)}function MA(A,e){let t=q(e),l=S.find(C=>C.P.has(e));return l&&(t=`${l.N} ${t}`),new Error(`illegal mixture: ${A.N} + ${t}`)}function R(A){return new Error(`illegal placement: ${A}`)}function le(A,e){let{V:t,M:l}=A;for(let C of e)if(!t.has(C))throw MA(A,C);if(l){let C=sA(e);for(let o=1,n=C.length;oW)throw new Error(`excessive non-spacing marks: ${y(z(C.slice(o-1,g)))} (${g-o}/${W})`);o=g}}}function ne(A,e,t){let l=[],C=[];for(A=A.slice().reverse();A.length;){let o=re(A);if(o)C.length&&(l.push(e(C)),C=[]),l.push(t(o));else{let n=A.pop();if(yA.has(n))C.push(n);else{let g=TA.get(n);if(g)C.push(...g);else if(!HA.has(n))throw uA(n)}}}return C.length&&l.push(e(C)),l}function ge(A){return A.filter(e=>e!=fA)}function re(A,e){let t=aA,l,C=A.length;for(;C&&(t=t.get(A[--C]),!!t);){let{V:o}=t;o&&(l=o,e&&e.push(...A.slice(C).reverse()),A.length=C)}return l}function we(A){return Ae(A)}export{Be as getEnsAddress,Qe as getEnsAvatar,Ee as getEnsName,ae as getEnsResolver,he as getEnsText,ue as labelhash,Me as namehash,we as normalize}; diff --git a/examples/vite/dist/assets/index-a570b5c8.js b/examples/vite/dist/assets/index-60c46f87.js similarity index 98% rename from examples/vite/dist/assets/index-a570b5c8.js rename to examples/vite/dist/assets/index-60c46f87.js index 58b3ab92eb..a84a6b38da 100644 --- a/examples/vite/dist/assets/index-a570b5c8.js +++ b/examples/vite/dist/assets/index-60c46f87.js @@ -1 +1 @@ -import{av as pe}from"./index-51fb98b3.js";const fe=Symbol(),Z=Object.getPrototypeOf,J=new WeakMap,me=e=>e&&(J.has(e)?J.get(e):Z(e)===Object.prototype||Z(e)===Array.prototype),he=e=>me(e)&&e[fe]||null,ee=(e,t=!0)=>{J.set(e,t)},z=e=>typeof e=="object"&&e!==null,P=new WeakMap,B=new WeakSet,ge=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>z(o)&&!B.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),r=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,v=r)=>{const b=l.get(o);if((b==null?void 0:b[0])===g)return b[1];const y=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return ee(y,!0),l.set(o,[g,y]),Reflect.ownKeys(o).forEach(D=>{if(Object.getOwnPropertyDescriptor(y,D))return;const _=Reflect.get(o,D),W={value:_,enumerable:!0,configurable:!0};if(B.has(_))ee(_,!1);else if(_ instanceof Promise)delete W.value,W.get=()=>v(_);else if(P.has(_)){const[I,K]=P.get(_);W.value=c(I,K(),v)}Object.defineProperty(y,D,W)}),Object.preventExtensions(y)},m=new WeakMap,f=[1,1],C=o=>{if(!z(o))throw new Error("object required");const g=m.get(o);if(g)return g;let v=f[0];const b=new Set,y=(a,i=++f[0])=>{v!==i&&(v=i,b.forEach(n=>n(a,i)))};let D=f[1];const _=(a=++f[1])=>(D!==a&&!b.size&&(D=a,I.forEach(([i])=>{const n=i[1](a);n>v&&(v=n)})),v),W=a=>(i,n)=>{const h=[...i];h[1]=[a,...h[1]],y(h,n)},I=new Map,K=(a,i)=>{if(b.size){const n=i[3](W(a));I.set(a,[i,n])}else I.set(a,[i])},X=a=>{var i;const n=I.get(a);n&&(I.delete(a),(i=n[1])==null||i.call(n))},de=a=>(b.add(a),b.size===1&&I.forEach(([n,h],j)=>{const k=n[3](W(j));I.set(j,[n,k])}),()=>{b.delete(a),b.size===0&&I.forEach(([n,h],j)=>{h&&(h(),I.set(j,[n]))})}),H=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),N=t(H,{deleteProperty(a,i){const n=Reflect.get(a,i);X(i);const h=Reflect.deleteProperty(a,i);return h&&y(["delete",[i],n]),h},set(a,i,n,h){const j=Reflect.has(a,i),k=Reflect.get(a,i,h);if(j&&(e(k,n)||m.has(n)&&e(k,m.get(n))))return!0;X(i),z(n)&&(n=he(n)||n);let $=n;if(n instanceof Promise)n.then(O=>{n.status="fulfilled",n.value=O,y(["resolve",[i],O])}).catch(O=>{n.status="rejected",n.reason=O,y(["reject",[i],O])});else{!P.has(n)&&s(n)&&($=C(n));const O=!B.has($)&&P.get($);O&&K(i,O)}return Reflect.set(a,i,$,h),y(["set",[i],n,k]),!0}});m.set(o,N);const ue=[H,_,c,de];return P.set(N,ue),Reflect.ownKeys(o).forEach(a=>{const i=Object.getOwnPropertyDescriptor(o,a);"value"in i&&(N[a]=o[a],delete i.value,delete i.writable),Object.defineProperty(H,a,i)}),N})=>[C,P,B,e,t,s,r,l,c,m,f],[be]=ge();function A(e={}){return be(e)}function M(e,t,s){const r=P.get(e);let l;const c=[],m=r[3];let f=!1;const o=m(g=>{if(c.push(g),s){t(c.splice(0));return}l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function ye(e,t){const s=P.get(e),[r,l,c]=s;return c(r,l(),t)}const d=A({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),ce={state:d,subscribe(e){return M(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},p={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return p.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return p.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(p.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!p.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(p.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(p.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=ce.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},Ie=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),u=A({enabled:Ie,userSessionId:"",events:[],connectedWalletId:void 0}),Ee={state:u,subscribe(e){return M(u.events,()=>e(ye(u.events[u.events.length-1])))},initialize(){u.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(u.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){u.connectedWalletId=e},click(e){if(u.enabled){const t={type:"CLICK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},track(e){if(u.enabled){const t={type:"TRACK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},view(e){if(u.enabled){const t={type:"VIEW",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}}},w=A({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),E={state:w,subscribe(e){return M(w,()=>e(w))},setChains(e){w.chains=e},setWalletConnectUri(e){w.walletConnectUri=e},setIsCustomDesktop(e){w.isCustomDesktop=e},setIsCustomMobile(e){w.isCustomMobile=e},setIsDataLoaded(e){w.isDataLoaded=e},setIsUiLoaded(e){w.isUiLoaded=e},setIsAuth(e){w.isAuth=e}},Y=A({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),T={state:Y,subscribe(e){return M(Y,()=>e(Y))},setConfig(e){var t,s;Ee.initialize(),E.setChains(e.chains),E.setIsAuth(!!e.enableAuthMode),E.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),E.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),p.setModalVersionInStorage(),Object.assign(Y,e)}};var ve=Object.defineProperty,te=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,se=(e,t,s)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,_e=(e,t)=>{for(var s in t||(t={}))we.call(t,s)&&se(e,s,t[s]);if(te)for(var s of te(t))Le.call(t,s)&&se(e,s,t[s]);return e};const q="https://explorer-api.walletconnect.com",F="wcm",G="js-2.6.2";async function x(e,t){const s=_e({sdkType:F,sdkVersion:G},t),r=new URL(e,q);return r.searchParams.append("projectId",T.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const R={async getDesktopListings(e){return x("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return x("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return x("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return x("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${q}/w3m/v1/getWalletImage/${e}?projectId=${T.state.projectId}&sdkType=${F}&sdkVersion=${G}`},getAssetImageUrl(e){return`${q}/w3m/v1/getAssetImage/${e}?projectId=${T.state.projectId}&sdkType=${F}&sdkVersion=${G}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&ne(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&ne(e,s,t[s]);return e};const re=p.isMobile(),L=A({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),ke={state:L,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=T.state;if(e==="NONE"||t==="ALL"&&!e)return L.recomendedWallets;if(p.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await R.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),C=e.indexOf(m.id);return f-C}),L.recomendedWallets=l}else{const{chains:s,isAuth:r}=E.state,l=s==null?void 0:s.join(","),c=p.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:p.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=re?await R.getMobileListings(m):await R.getDesktopListings(m);L.recomendedWallets=Object.values(f)}return L.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=T.state,{recomendedWallets:l}=L;if(r==="ALL")return L.wallets;l.length?t.excludedIds=l.map(v=>v.id).join(","):p.isArray(s)&&(t.excludedIds=s.join(",")),p.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),E.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:C}=re?await R.getMobileListings(t):await R.getDesktopListings(t),o=Object.values(f),g=m?"search":"wallets";return L[g]={listings:[...L[g].listings,...o],total:C,page:c??1},{listings:o,total:C}},getWalletImageUrl(e){return R.getWalletImageUrl(e)},getAssetImageUrl(e){return R.getAssetImageUrl(e)},resetSearch(){L.search={listings:[],total:0,page:1}}},S=A({open:!1}),Q={state:S,subscribe(e){return M(S,()=>e(S))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=E.state;if(p.removeWalletConnectDeepLink(),E.setWalletConnectUri(e==null?void 0:e.uri),E.setChains(e==null?void 0:e.chains),ce.reset("ConnectWallet"),s&&r)S.open=!0,t();else{const l=setInterval(()=>{const c=E.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),S.open=!0,t())},200)}})},close(){S.open=!1}};var We=Object.defineProperty,ie=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,ae=(e,t,s)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Re.call(t,s)&&ae(e,s,t[s]);if(ie)for(var s of ie(t))Ue.call(t,s)&&ae(e,s,t[s]);return e};function De(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const V=A({themeMode:De()?"dark":"light"}),le={state:V,subscribe(e){return M(V,()=>e(V))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(V.themeMode=t),s&&(V.themeVariables=Me({},s))}},U=A({open:!1,message:"",variant:"success"}),Ve={state:U,subscribe(e){return M(U,()=>e(U))},openToast(e,t){U.open=!0,U.message=e,U.variant=t},closeToast(){U.open=!1}};class je{constructor(t){this.openModal=Q.open,this.closeModal=Q.close,this.subscribeModal=Q.subscribe,this.setTheme=le.setThemeConfig,le.setThemeConfig(t),T.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-3cf525e2.js"),["assets/index-3cf525e2.js","assets/index-51fb98b3.js","assets/index-882a2daf.css"]);const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),E.setIsUiLoaded(!0)}}}const Ne=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:je},Symbol.toStringTag,{value:"Module"}));export{Ee as R,ce as T,p as a,Ne as i,le as n,Ve as o,E as p,Q as s,ke as t,T as y}; +import{av as pe}from"./index-c212f3ee.js";const fe=Symbol(),Z=Object.getPrototypeOf,J=new WeakMap,me=e=>e&&(J.has(e)?J.get(e):Z(e)===Object.prototype||Z(e)===Array.prototype),he=e=>me(e)&&e[fe]||null,ee=(e,t=!0)=>{J.set(e,t)},z=e=>typeof e=="object"&&e!==null,P=new WeakMap,B=new WeakSet,ge=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>z(o)&&!B.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),r=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,v=r)=>{const b=l.get(o);if((b==null?void 0:b[0])===g)return b[1];const y=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return ee(y,!0),l.set(o,[g,y]),Reflect.ownKeys(o).forEach(D=>{if(Object.getOwnPropertyDescriptor(y,D))return;const _=Reflect.get(o,D),W={value:_,enumerable:!0,configurable:!0};if(B.has(_))ee(_,!1);else if(_ instanceof Promise)delete W.value,W.get=()=>v(_);else if(P.has(_)){const[I,K]=P.get(_);W.value=c(I,K(),v)}Object.defineProperty(y,D,W)}),Object.preventExtensions(y)},m=new WeakMap,f=[1,1],C=o=>{if(!z(o))throw new Error("object required");const g=m.get(o);if(g)return g;let v=f[0];const b=new Set,y=(a,i=++f[0])=>{v!==i&&(v=i,b.forEach(n=>n(a,i)))};let D=f[1];const _=(a=++f[1])=>(D!==a&&!b.size&&(D=a,I.forEach(([i])=>{const n=i[1](a);n>v&&(v=n)})),v),W=a=>(i,n)=>{const h=[...i];h[1]=[a,...h[1]],y(h,n)},I=new Map,K=(a,i)=>{if(b.size){const n=i[3](W(a));I.set(a,[i,n])}else I.set(a,[i])},X=a=>{var i;const n=I.get(a);n&&(I.delete(a),(i=n[1])==null||i.call(n))},de=a=>(b.add(a),b.size===1&&I.forEach(([n,h],j)=>{const k=n[3](W(j));I.set(j,[n,k])}),()=>{b.delete(a),b.size===0&&I.forEach(([n,h],j)=>{h&&(h(),I.set(j,[n]))})}),H=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),N=t(H,{deleteProperty(a,i){const n=Reflect.get(a,i);X(i);const h=Reflect.deleteProperty(a,i);return h&&y(["delete",[i],n]),h},set(a,i,n,h){const j=Reflect.has(a,i),k=Reflect.get(a,i,h);if(j&&(e(k,n)||m.has(n)&&e(k,m.get(n))))return!0;X(i),z(n)&&(n=he(n)||n);let $=n;if(n instanceof Promise)n.then(O=>{n.status="fulfilled",n.value=O,y(["resolve",[i],O])}).catch(O=>{n.status="rejected",n.reason=O,y(["reject",[i],O])});else{!P.has(n)&&s(n)&&($=C(n));const O=!B.has($)&&P.get($);O&&K(i,O)}return Reflect.set(a,i,$,h),y(["set",[i],n,k]),!0}});m.set(o,N);const ue=[H,_,c,de];return P.set(N,ue),Reflect.ownKeys(o).forEach(a=>{const i=Object.getOwnPropertyDescriptor(o,a);"value"in i&&(N[a]=o[a],delete i.value,delete i.writable),Object.defineProperty(H,a,i)}),N})=>[C,P,B,e,t,s,r,l,c,m,f],[be]=ge();function A(e={}){return be(e)}function M(e,t,s){const r=P.get(e);let l;const c=[],m=r[3];let f=!1;const o=m(g=>{if(c.push(g),s){t(c.splice(0));return}l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function ye(e,t){const s=P.get(e),[r,l,c]=s;return c(r,l(),t)}const d=A({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),ce={state:d,subscribe(e){return M(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},p={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return p.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return p.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(p.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!p.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(p.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(p.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=ce.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},Ie=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),u=A({enabled:Ie,userSessionId:"",events:[],connectedWalletId:void 0}),Ee={state:u,subscribe(e){return M(u.events,()=>e(ye(u.events[u.events.length-1])))},initialize(){u.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(u.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){u.connectedWalletId=e},click(e){if(u.enabled){const t={type:"CLICK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},track(e){if(u.enabled){const t={type:"TRACK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},view(e){if(u.enabled){const t={type:"VIEW",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}}},w=A({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),E={state:w,subscribe(e){return M(w,()=>e(w))},setChains(e){w.chains=e},setWalletConnectUri(e){w.walletConnectUri=e},setIsCustomDesktop(e){w.isCustomDesktop=e},setIsCustomMobile(e){w.isCustomMobile=e},setIsDataLoaded(e){w.isDataLoaded=e},setIsUiLoaded(e){w.isUiLoaded=e},setIsAuth(e){w.isAuth=e}},Y=A({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),T={state:Y,subscribe(e){return M(Y,()=>e(Y))},setConfig(e){var t,s;Ee.initialize(),E.setChains(e.chains),E.setIsAuth(!!e.enableAuthMode),E.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),E.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),p.setModalVersionInStorage(),Object.assign(Y,e)}};var ve=Object.defineProperty,te=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,se=(e,t,s)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,_e=(e,t)=>{for(var s in t||(t={}))we.call(t,s)&&se(e,s,t[s]);if(te)for(var s of te(t))Le.call(t,s)&&se(e,s,t[s]);return e};const q="https://explorer-api.walletconnect.com",F="wcm",G="js-2.6.2";async function x(e,t){const s=_e({sdkType:F,sdkVersion:G},t),r=new URL(e,q);return r.searchParams.append("projectId",T.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const R={async getDesktopListings(e){return x("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return x("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return x("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return x("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${q}/w3m/v1/getWalletImage/${e}?projectId=${T.state.projectId}&sdkType=${F}&sdkVersion=${G}`},getAssetImageUrl(e){return`${q}/w3m/v1/getAssetImage/${e}?projectId=${T.state.projectId}&sdkType=${F}&sdkVersion=${G}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&ne(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&ne(e,s,t[s]);return e};const re=p.isMobile(),L=A({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),ke={state:L,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=T.state;if(e==="NONE"||t==="ALL"&&!e)return L.recomendedWallets;if(p.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await R.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),C=e.indexOf(m.id);return f-C}),L.recomendedWallets=l}else{const{chains:s,isAuth:r}=E.state,l=s==null?void 0:s.join(","),c=p.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:p.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=re?await R.getMobileListings(m):await R.getDesktopListings(m);L.recomendedWallets=Object.values(f)}return L.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=T.state,{recomendedWallets:l}=L;if(r==="ALL")return L.wallets;l.length?t.excludedIds=l.map(v=>v.id).join(","):p.isArray(s)&&(t.excludedIds=s.join(",")),p.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),E.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:C}=re?await R.getMobileListings(t):await R.getDesktopListings(t),o=Object.values(f),g=m?"search":"wallets";return L[g]={listings:[...L[g].listings,...o],total:C,page:c??1},{listings:o,total:C}},getWalletImageUrl(e){return R.getWalletImageUrl(e)},getAssetImageUrl(e){return R.getAssetImageUrl(e)},resetSearch(){L.search={listings:[],total:0,page:1}}},S=A({open:!1}),Q={state:S,subscribe(e){return M(S,()=>e(S))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=E.state;if(p.removeWalletConnectDeepLink(),E.setWalletConnectUri(e==null?void 0:e.uri),E.setChains(e==null?void 0:e.chains),ce.reset("ConnectWallet"),s&&r)S.open=!0,t();else{const l=setInterval(()=>{const c=E.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),S.open=!0,t())},200)}})},close(){S.open=!1}};var We=Object.defineProperty,ie=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,ae=(e,t,s)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Re.call(t,s)&&ae(e,s,t[s]);if(ie)for(var s of ie(t))Ue.call(t,s)&&ae(e,s,t[s]);return e};function De(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const V=A({themeMode:De()?"dark":"light"}),le={state:V,subscribe(e){return M(V,()=>e(V))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(V.themeMode=t),s&&(V.themeVariables=Me({},s))}},U=A({open:!1,message:"",variant:"success"}),Ve={state:U,subscribe(e){return M(U,()=>e(U))},openToast(e,t){U.open=!0,U.message=e,U.variant=t},closeToast(){U.open=!1}};class je{constructor(t){this.openModal=Q.open,this.closeModal=Q.close,this.subscribeModal=Q.subscribe,this.setTheme=le.setThemeConfig,le.setThemeConfig(t),T.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-986e5a4d.js"),["assets/index-986e5a4d.js","assets/index-c212f3ee.js","assets/index-882a2daf.css"]);const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),E.setIsUiLoaded(!0)}}}const Ne=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:je},Symbol.toStringTag,{value:"Module"}));export{Ee as R,ce as T,p as a,Ne as i,le as n,Ve as o,E as p,Q as s,ke as t,T as y}; diff --git a/examples/vite/dist/assets/index-dd98ab46.js b/examples/vite/dist/assets/index-86e5536c.js similarity index 99% rename from examples/vite/dist/assets/index-dd98ab46.js rename to examples/vite/dist/assets/index-86e5536c.js index 465d0d75f9..1b66990712 100644 --- a/examples/vite/dist/assets/index-dd98ab46.js +++ b/examples/vite/dist/assets/index-86e5536c.js @@ -1,4 +1,4 @@ -import{E as Dt}from"./events-372f436e.js";import{a as Fr,s as $r,m as jr,c as ie,I as Hr,f as vt,J as Et,H as zr}from"./http-dcace0d6.js";import{k as Ve,aB as Wr,aC as Vr,aD as Jr,aE as Qr,aF as Kr,aG as Yr,aH as Gr,aI as Zr,aJ as Xr,aK as eo,aL as to,aM as no,aN as ro,aO as oo,aP as io,aQ as so,aR as ao,aS as co,e as Ft,aT as lo,aU as uo}from"./index-51fb98b3.js";import{b as j,l as N,y as O,g as W,$ as B,q as ge,B as fo,E as ho,a as ye,c as Je,d as Qe,V as $t,s as jt,_ as Ht,A as zt,F as Wt,T as Vt,e as Jt,x as Qt,f as Kt,i as Yt,P as go}from"./hooks.module-408dc32d.js";import"@safe-globalThis/safe-apps-provider";import"@safe-globalThis/safe-apps-sdk";const Ne="Session currently connected",$="Session currently disconnected",_o="Session Rejected",po="Missing JSON RPC response",mo='JSON-RPC success response must include "result" field',wo='JSON-RPC error response must include "error" field',yo='JSON RPC request must have valid "method" value',bo='JSON RPC request must have valid "id" value',vo="Missing one of the required parameters: bridge / uri / session",Ct="JSON RPC response format is invalid",Eo="URI format is invalid",Co="QRCode Modal not provided",St="User close QRCode Modal",So=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],Io=["wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],Ke=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign",...Io],Pe="WALLETCONNECT_DEEPLINK_CHOICE",Ro={1:"mainnet",3:"ropsten",4:"rinkeby",5:"goerli",42:"kovan"};var Gt=Ye;Ye.strict=Zt;Ye.loose=Xt;var ko=Object.prototype.toString,To={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function Ye(t){return Zt(t)||Xt(t)}function Zt(t){return t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array}function Xt(t){return To[ko.call(t)]}const No=Ve(Gt);var xo=Gt.strict,Mo=function(e){if(xo(e)){var n=Buffer.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(n=n.slice(e.byteOffset,e.byteOffset+e.byteLength)),n}else return Buffer.from(e)};const Ao=Ve(Mo),Ge="hex",Ze="utf8",Oo="binary",Lo="buffer",Bo="array",Uo="typed-array",Po="array-buffer",be="0";function V(t){return new Uint8Array(t)}function Xe(t,e=!1){const n=t.toString(Ge);return e?se(n):n}function et(t){return t.toString(Ze)}function en(t){return t.readUIntBE(0,t.length)}function Z(t){return Ao(t)}function U(t,e=!1){return Xe(Z(t),e)}function tn(t){return et(Z(t))}function nn(t){return en(Z(t))}function tt(t){return Buffer.from(J(t),Ge)}function P(t){return V(tt(t))}function qo(t){return et(tt(t))}function Do(t){return nn(P(t))}function nt(t){return Buffer.from(t,Ze)}function rn(t){return V(nt(t))}function Fo(t,e=!1){return Xe(nt(t),e)}function $o(t){const e=parseInt(t,10);return ii(oi(e),"Number can only safely store up to 53 bits"),e}function jo(t){return Vo(rt(t))}function Ho(t){return ot(rt(t))}function zo(t,e){return Jo(rt(t),e)}function Wo(t){return`${t}`}function rt(t){const e=(t>>>0).toString(2);return st(e)}function Vo(t){return Z(ot(t))}function ot(t){return new Uint8Array(Xo(t).map(e=>parseInt(e,2)))}function Jo(t,e){return U(ot(t),e)}function Qo(t){return!(typeof t!="string"||!new RegExp(/^[01]+$/).test(t)||t.length%8!==0)}function on(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function ve(t){return Buffer.isBuffer(t)}function it(t){return No.strict(t)&&!ve(t)}function sn(t){return!it(t)&&!ve(t)&&typeof t.byteLength<"u"}function Ko(t){return ve(t)?Lo:it(t)?Uo:sn(t)?Po:Array.isArray(t)?Bo:typeof t}function Yo(t){return Qo(t)?Oo:on(t)?Ge:Ze}function Go(...t){return Buffer.concat(t)}function an(...t){let e=[];return t.forEach(n=>e=e.concat(Array.from(n))),new Uint8Array([...e])}function Zo(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}function Xo(t,e=8){const n=st(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}function st(t,e=8,n=be){return ei(t,Zo(t.length,e),n)}function ei(t,e,n=be){return si(t,e,!0,n)}function J(t){return t.replace(/^0x/,"")}function se(t){return t.startsWith("0x")?t:`0x${t}`}function ti(t){return t=J(t),t=st(t,2),t&&(t=se(t)),t}function ni(t){const e=t.startsWith("0x");return t=J(t),t=t.startsWith(be)?t.substring(1):t,e?se(t):t}function ri(t){return typeof t>"u"}function oi(t){return!ri(t)}function ii(t,e){if(!t)throw new Error(e)}function si(t,e,n,r=be){const o=e-t.length;let i=t;if(o>0){const s=r.repeat(o);i=n?s+t:t+s}return i}function _e(t){return Z(new Uint8Array(t))}function ai(t){return tn(new Uint8Array(t))}function cn(t,e){return U(new Uint8Array(t),!e)}function ci(t){return nn(new Uint8Array(t))}function li(...t){return P(t.map(e=>U(new Uint8Array(e))).join("")).buffer}function ln(t){return V(t).buffer}function ui(t){return et(t)}function di(t,e){return Xe(t,!e)}function fi(t){return en(t)}function hi(...t){return Go(...t)}function gi(t){return rn(t).buffer}function _i(t){return nt(t)}function pi(t,e){return Fo(t,!e)}function mi(t){return $o(t)}function wi(t){return tt(t)}function un(t){return P(t).buffer}function yi(t){return qo(t)}function bi(t){return Do(t)}function vi(t){return jo(t)}function Ei(t){return Ho(t).buffer}function Ci(t){return Wo(t)}function dn(t,e){return zo(Number(t),!e)}const Si=Qr,Ii=Kr,Ri=Yr,ki=Gr,Ti=Zr,fn=Jr,Ni=Xr,hn=Wr,xi=eo,Mi=to,Ai=no,Ee=Vr;function Ce(t){return ro(t)}function Se(){const t=Ce();return t&&t.os?t.os:void 0}function gn(){const t=Se();return t?t.toLowerCase().includes("android"):!1}function _n(){const t=Se();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function pn(){return Se()?gn()||_n():!1}function mn(){const t=Ce();return t&&t.name?t.name.toLowerCase()==="node":!1}function wn(){return!mn()&&!!fn()}const yn=Fr,bn=$r;function at(t,e){const n=bn(e),r=Ee();r&&r.setItem(t,n)}function ct(t){let e=null,n=null;const r=Ee();return r&&(n=r.getItem(t)),e=n&&yn(n),e}function lt(t){const e=Ee();e&&e.removeItem(t)}function qe(){return oo()}function Oi(t){return ti(t)}function Li(t){return se(t)}function Bi(t){return J(t)}function Ui(t){return ni(se(t))}const vn=jr;function he(){return((e,n)=>{for(n=e="";e++<36;n+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return n})()}function Pi(){console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!")}function En(t,e){let n;const r=Ro[t];return r&&(n=`https://${r}.infura.io/v3/${e}`),n}function Cn(t,e){let n;const r=En(t,e.infuraId);return e.custom&&e.custom[t]?n=e.custom[t]:r&&(n=r),n}function qi(t,e){const n=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${n}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${n}`:""}function Di(t){const e=t.href.split("?")[0];at(Pe,Object.assign(Object.assign({},t),{href:e}))}function Sn(t,e){return t.filter(n=>n.name.toLowerCase().includes(e.toLowerCase()))[0]}function Fi(t,e){let n=t;return e&&(n=e.map(r=>Sn(t,r)).filter(Boolean)),n}function $i(t,e){return async(...r)=>new Promise((o,i)=>{const s=(a,c)=>{(a===null||typeof a>"u")&&i(a),o(c)};t.apply(e,[...r,s])})}function In(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3;break}const r={code:n,message:e};return t.data&&(r.data=t.data),r}const Rn="https://registry.walletconnect.com";function ji(){return Rn+"/api/v2/wallets"}function Hi(){return Rn+"/api/v2/dapps"}function kn(t,e="mobile"){var n;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(n=t.image_url.sm)!==null&&n!==void 0?n:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function zi(t,e="mobile"){return Object.values(t).filter(n=>!!n[e].universal||!!n[e].native).map(n=>kn(n,e))}var ut={};(function(t){const e=ao,n=co,r=io,o=so,i=l=>l==null;function s(l){switch(l.arrayFormat){case"index":return d=>(f,u)=>{const g=f.length;return u===void 0||l.skipNull&&u===null||l.skipEmptyString&&u===""?f:u===null?[...f,[h(d,l),"[",g,"]"].join("")]:[...f,[h(d,l),"[",h(g,l),"]=",h(u,l)].join("")]};case"bracket":return d=>(f,u)=>u===void 0||l.skipNull&&u===null||l.skipEmptyString&&u===""?f:u===null?[...f,[h(d,l),"[]"].join("")]:[...f,[h(d,l),"[]=",h(u,l)].join("")];case"comma":case"separator":return d=>(f,u)=>u==null||u.length===0?f:f.length===0?[[h(d,l),"=",h(u,l)].join("")]:[[f,h(u,l)].join(l.arrayFormatSeparator)];default:return d=>(f,u)=>u===void 0||l.skipNull&&u===null||l.skipEmptyString&&u===""?f:u===null?[...f,h(d,l)]:[...f,[h(d,l),"=",h(u,l)].join("")]}}function a(l){let d;switch(l.arrayFormat){case"index":return(f,u,g)=>{if(d=/\[(\d*)\]$/.exec(f),f=f.replace(/\[\d*\]$/,""),!d){g[f]=u;return}g[f]===void 0&&(g[f]={}),g[f][d[1]]=u};case"bracket":return(f,u,g)=>{if(d=/(\[\])$/.exec(f),f=f.replace(/\[\]$/,""),!d){g[f]=u;return}if(g[f]===void 0){g[f]=[u];return}g[f]=[].concat(g[f],u)};case"comma":case"separator":return(f,u,g)=>{const y=typeof u=="string"&&u.includes(l.arrayFormatSeparator),m=typeof u=="string"&&!y&&_(u,l).includes(l.arrayFormatSeparator);u=m?_(u,l):u;const S=y||m?u.split(l.arrayFormatSeparator).map(R=>_(R,l)):u===null?u:_(u,l);g[f]=S};default:return(f,u,g)=>{if(g[f]===void 0){g[f]=u;return}g[f]=[].concat(g[f],u)}}}function c(l){if(typeof l!="string"||l.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(l,d){return d.encode?d.strict?e(l):encodeURIComponent(l):l}function _(l,d){return d.decode?n(l):l}function v(l){return Array.isArray(l)?l.sort():typeof l=="object"?v(Object.keys(l)).sort((d,f)=>Number(d)-Number(f)).map(d=>l[d]):l}function b(l){const d=l.indexOf("#");return d!==-1&&(l=l.slice(0,d)),l}function w(l){let d="";const f=l.indexOf("#");return f!==-1&&(d=l.slice(f)),d}function E(l){l=b(l);const d=l.indexOf("?");return d===-1?"":l.slice(d+1)}function C(l,d){return d.parseNumbers&&!Number.isNaN(Number(l))&&typeof l=="string"&&l.trim()!==""?l=Number(l):d.parseBooleans&&l!==null&&(l.toLowerCase()==="true"||l.toLowerCase()==="false")&&(l=l.toLowerCase()==="true"),l}function I(l,d){d=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},d),c(d.arrayFormatSeparator);const f=a(d),u=Object.create(null);if(typeof l!="string"||(l=l.trim().replace(/^[?#&]/,""),!l))return u;for(const g of l.split("&")){if(g==="")continue;let[y,m]=r(d.decode?g.replace(/\+/g," "):g,"=");m=m===void 0?null:["comma","separator"].includes(d.arrayFormat)?m:_(m,d),f(_(y,d),m,u)}for(const g of Object.keys(u)){const y=u[g];if(typeof y=="object"&&y!==null)for(const m of Object.keys(y))y[m]=C(y[m],d);else u[g]=C(y,d)}return d.sort===!1?u:(d.sort===!0?Object.keys(u).sort():Object.keys(u).sort(d.sort)).reduce((g,y)=>{const m=u[y];return m&&typeof m=="object"&&!Array.isArray(m)?g[y]=v(m):g[y]=m,g},Object.create(null))}t.extract=E,t.parse=I,t.stringify=(l,d)=>{if(!l)return"";d=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},d),c(d.arrayFormatSeparator);const f=m=>d.skipNull&&i(l[m])||d.skipEmptyString&&l[m]==="",u=s(d),g={};for(const m of Object.keys(l))f(m)||(g[m]=l[m]);const y=Object.keys(g);return d.sort!==!1&&y.sort(d.sort),y.map(m=>{const S=l[m];return S===void 0?"":S===null?h(m,d):Array.isArray(S)?S.reduce(u(m),[]).join("&"):h(m,d)+"="+h(S,d)}).filter(m=>m.length>0).join("&")},t.parseUrl=(l,d)=>{d=Object.assign({decode:!0},d);const[f,u]=r(l,"#");return Object.assign({url:f.split("?")[0]||"",query:I(E(l),d)},d&&d.parseFragmentIdentifier&&u?{fragmentIdentifier:_(u,d)}:{})},t.stringifyUrl=(l,d)=>{d=Object.assign({encode:!0,strict:!0},d);const f=b(l.url).split("?")[0]||"",u=t.extract(l.url),g=t.parse(u,{sort:!1}),y=Object.assign(g,l.query);let m=t.stringify(y,d);m&&(m=`?${m}`);let S=w(l.url);return l.fragmentIdentifier&&(S=`#${h(l.fragmentIdentifier,d)}`),`${f}${m}${S}`},t.pick=(l,d,f)=>{f=Object.assign({parseFragmentIdentifier:!0},f);const{url:u,query:g,fragmentIdentifier:y}=t.parseUrl(l,f);return t.stringifyUrl({url:u,query:o(g,d),fragmentIdentifier:y},f)},t.exclude=(l,d,f)=>{const u=Array.isArray(d)?g=>!d.includes(g):(g,y)=>!d(g,y);return t.pick(l,u,f)}})(ut);function Tn(t){const e=t.indexOf("?")!==-1?t.indexOf("?"):void 0;return typeof e<"u"?t.substr(e):""}function Nn(t,e){let n=dt(t);return n=Object.assign(Object.assign({},n),e),t=xn(n),t}function dt(t){return ut.parse(t)}function xn(t){return ut.stringify(t)}function Mn(t){return typeof t.bridge<"u"}function An(t){const e=t.indexOf(":"),n=t.indexOf("?")!==-1?t.indexOf("?"):void 0,r=t.substring(0,e),o=t.substring(e+1,n);function i(v){const b="@",w=v.split(b);return{handshakeTopic:w[0],version:parseInt(w[1],10)}}const s=i(o),a=typeof n<"u"?t.substr(n):"";function c(v){const b=dt(v);return{key:b.key||"",bridge:b.bridge||""}}const h=c(a);return Object.assign(Object.assign({protocol:r},s),h)}function Wi(t){return t===""||typeof t=="string"&&t.trim()===""}function Vi(t){return!(t&&t.length)}function Ji(t){return ve(t)}function Qi(t){return it(t)}function Ki(t){return sn(t)}function Yi(t){return Ko(t)}function Gi(t){return Yo(t)}function Zi(t,e){return on(t,e)}function Xi(t){return typeof t.params=="object"}function On(t){return typeof t.method<"u"}function H(t){return typeof t.result<"u"}function re(t){return typeof t.error<"u"}function De(t){return typeof t.event<"u"}function Ln(t){return So.includes(t)||t.startsWith("wc_")}function Bn(t){return t.method.startsWith("wc_")?!0:!Ke.includes(t.method)}const es=Object.freeze(Object.defineProperty({__proto__:null,addHexPrefix:Li,appendToQueryString:Nn,concatArrayBuffers:li,concatBuffers:hi,convertArrayBufferToBuffer:_e,convertArrayBufferToHex:cn,convertArrayBufferToNumber:ci,convertArrayBufferToUtf8:ai,convertBufferToArrayBuffer:ln,convertBufferToHex:di,convertBufferToNumber:fi,convertBufferToUtf8:ui,convertHexToArrayBuffer:un,convertHexToBuffer:wi,convertHexToNumber:bi,convertHexToUtf8:yi,convertNumberToArrayBuffer:Ei,convertNumberToBuffer:vi,convertNumberToHex:dn,convertNumberToUtf8:Ci,convertUtf8ToArrayBuffer:gi,convertUtf8ToBuffer:_i,convertUtf8ToHex:pi,convertUtf8ToNumber:mi,detectEnv:Ce,detectOS:Se,formatIOSMobile:qi,formatMobileRegistry:zi,formatMobileRegistryEntry:kn,formatQueryString:xn,formatRpcError:In,getClientMeta:qe,getCrypto:Mi,getCryptoOrThrow:xi,getDappRegistryUrl:Hi,getDocument:ki,getDocumentOrThrow:Ri,getEncoding:Gi,getFromWindow:Si,getFromWindowOrThrow:Ii,getInfuraRpcUrl:En,getLocal:ct,getLocalStorage:Ee,getLocalStorageOrThrow:Ai,getLocation:hn,getLocationOrThrow:Ni,getMobileLinkRegistry:Fi,getMobileRegistryEntry:Sn,getNavigator:fn,getNavigatorOrThrow:Ti,getQueryString:Tn,getRpcUrl:Cn,getType:Yi,getWalletRegistryUrl:ji,isAndroid:gn,isArrayBuffer:Ki,isBrowser:wn,isBuffer:Ji,isEmptyArray:Vi,isEmptyString:Wi,isHexString:Zi,isIOS:_n,isInternalEvent:De,isJsonRpcRequest:On,isJsonRpcResponseError:re,isJsonRpcResponseSuccess:H,isJsonRpcSubscription:Xi,isMobile:pn,isNode:mn,isReservedEvent:Ln,isSilentPayload:Bn,isTypedArray:Qi,isWalletConnectSession:Mn,logDeprecationWarning:Pi,parseQueryString:dt,parseWalletConnectUri:An,payloadId:vn,promisify:$i,removeHexLeadingZeros:Ui,removeHexPrefix:Bi,removeLocal:lt,safeJsonParse:yn,safeJsonStringify:bn,sanitizeHex:Oi,saveMobileLinkInfo:Di,setLocal:at,uuid:he},Symbol.toStringTag,{value:"Module"}));class ts{constructor(){this._eventEmitters=[],typeof window<"u"&&typeof window.addEventListener<"u"&&(window.addEventListener("online",()=>this.trigger("online")),window.addEventListener("offline",()=>this.trigger("offline")))}on(e,n){this._eventEmitters.push({event:e,callback:n})}trigger(e){let n=[];e&&(n=this._eventEmitters.filter(r=>r.event===e)),n.forEach(r=>{r.callback()})}}const ns=typeof globalThis.WebSocket<"u"?globalThis.WebSocket:require("ws");class rs{constructor(e){if(this.opts=e,this._queue=[],this._events=[],this._subscriptions=[],this._protocol=e.protocol,this._version=e.version,this._url="",this._netMonitor=null,this._socket=null,this._nextSocket=null,this._subscriptions=e.subscriptions||[],this._netMonitor=e.netMonitor||new ts,!e.url||typeof e.url!="string")throw new Error("Missing or invalid WebSocket url");this._url=e.url,this._netMonitor.on("online",()=>this._socketCreate())}set readyState(e){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(e){}get connecting(){return this.readyState===0}set connected(e){}get connected(){return this.readyState===1}set closing(e){}get closing(){return this.readyState===2}set closed(e){}get closed(){return this.readyState===3}open(){this._socketCreate()}close(){this._socketClose()}send(e,n,r){if(!n||typeof n!="string")throw new Error("Missing or invalid topic field");this._socketSend({topic:n,type:"pub",payload:e,silent:!!r})}subscribe(e){this._socketSend({topic:e,type:"sub",payload:"",silent:!0})}on(e,n){this._events.push({event:e,callback:n})}_socketCreate(){if(this._nextSocket)return;const e=os(this._url,this._protocol,this._version);if(this._nextSocket=new ns(e),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=n=>this._socketReceive(n),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=n=>this._socketError(n),this._nextSocket.onclose=()=>{setTimeout(()=>{this._nextSocket=null,this._socketCreate()},1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(e){const n=JSON.stringify(e);this._socket&&this._socket.readyState===1?this._socket.send(n):(this._setToQueue(e),this._socketCreate())}async _socketReceive(e){let n;try{n=JSON.parse(e.data)}catch{return}if(this._socketSend({topic:n.topic,type:"ack",payload:"",silent:!0}),this._socket&&this._socket.readyState===1){const r=this._events.filter(o=>o.event==="message");r&&r.length&&r.forEach(o=>o.callback(n))}}_socketError(e){const n=this._events.filter(r=>r.event==="error");n&&n.length&&n.forEach(r=>r.callback(e))}_queueSubscriptions(){this._subscriptions.forEach(n=>this._queue.push({topic:n,type:"sub",payload:"",silent:!0})),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(e){this._queue.push(e)}_pushQueue(){this._queue.forEach(n=>this._socketSend(n)),this._queue=[]}}function os(t,e,n){var r,o;const s=(t.startsWith("https")?t.replace("https","wss"):t.startsWith("http")?t.replace("http","ws"):t).split("?"),a=wn()?{protocol:e,version:n,env:"browser",host:((r=hn())===null||r===void 0?void 0:r.host)||""}:{protocol:e,version:n,env:((o=Ce())===null||o===void 0?void 0:o.name)||""},c=Nn(Tn(s[1]||""),a);return s[0]+"?"+c}class is{constructor(){this._eventEmitters=[]}subscribe(e){this._eventEmitters.push(e)}unsubscribe(e){this._eventEmitters=this._eventEmitters.filter(n=>n.event!==e)}trigger(e){let n=[],r;On(e)?r=e.method:H(e)||re(e)?r=`response:${e.id}`:De(e)?r=e.event:r="",r&&(n=this._eventEmitters.filter(o=>o.event===r)),(!n||!n.length)&&!Ln(r)&&!De(r)&&(n=this._eventEmitters.filter(o=>o.event==="call_request")),n.forEach(o=>{if(re(e)){const i=new Error(e.error.message);o.callback(i,null)}else o.callback(null,e)})}}class ss{constructor(e="walletconnect"){this.storageId=e}getSession(){let e=null;const n=ct(this.storageId);return n&&Mn(n)&&(e=n),e}setSession(e){return at(this.storageId,e),e}removeSession(){lt(this.storageId)}}const as="walletconnect.org",cs="abcdefghijklmnopqrstuvwxyz0123456789",Un=cs.split("").map(t=>`https://${t}.bridge.walletconnect.org`);function ls(t){let e=t.indexOf("//")>-1?t.split("/")[2]:t.split("/")[0];return e=e.split(":")[0],e=e.split("?")[0],e}function us(t){return ls(t).split(".").slice(-2).join(".")}function ds(){return Math.floor(Math.random()*Un.length)}function fs(){return Un[ds()]}function hs(t){return us(t)===as}function gs(t){return hs(t)?fs():t}class _s{constructor(e){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new is,this._clientMeta=qe()||e.connectorOpts.clientMeta||null,this._cryptoLib=e.cryptoLib,this._sessionStorage=e.sessionStorage||new ss(e.connectorOpts.storageId),this._qrcodeModal=e.connectorOpts.qrcodeModal,this._qrcodeModalOptions=e.connectorOpts.qrcodeModalOptions,this._signingMethods=[...Ke,...e.connectorOpts.signingMethods||[]],!e.connectorOpts.bridge&&!e.connectorOpts.uri&&!e.connectorOpts.session)throw new Error(vo);e.connectorOpts.bridge&&(this.bridge=gs(e.connectorOpts.bridge)),e.connectorOpts.uri&&(this.uri=e.connectorOpts.uri);const n=e.connectorOpts.session||this._getStorageSession();n&&(this.session=n),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=e.transport||new rs({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),e.connectorOpts.uri&&this._subscribeToSessionRequest(),e.pushServerOpts&&this._registerPushServer(e.pushServerOpts)}set bridge(e){e&&(this._bridge=e)}get bridge(){return this._bridge}set key(e){if(!e)return;const n=un(e);this._key=n}get key(){return this._key?cn(this._key,!0):""}set clientId(e){e&&(this._clientId=e)}get clientId(){let e=this._clientId;return e||(e=this._clientId=he()),this._clientId}set peerId(e){e&&(this._peerId=e)}get peerId(){return this._peerId}set clientMeta(e){}get clientMeta(){let e=this._clientMeta;return e||(e=this._clientMeta=qe()),e}set peerMeta(e){this._peerMeta=e}get peerMeta(){return this._peerMeta}set handshakeTopic(e){e&&(this._handshakeTopic=e)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(e){e&&(this._handshakeId=e)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(e){if(!e)return;const{handshakeTopic:n,bridge:r,key:o}=this._parseUri(e);this.handshakeTopic=n,this.bridge=r,this.key=o}set chainId(e){this._chainId=e}get chainId(){return this._chainId}set networkId(e){this._networkId=e}get networkId(){return this._networkId}set accounts(e){this._accounts=e}get accounts(){return this._accounts}set rpcUrl(e){this._rpcUrl=e}get rpcUrl(){return this._rpcUrl}set connected(e){}get connected(){return this._connected}set pending(e){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(e){e&&(this._connected=e.connected,this.accounts=e.accounts,this.chainId=e.chainId,this.bridge=e.bridge,this.key=e.key,this.clientId=e.clientId,this.clientMeta=e.clientMeta,this.peerId=e.peerId,this.peerMeta=e.peerMeta,this.handshakeId=e.handshakeId,this.handshakeTopic=e.handshakeTopic)}on(e,n){const r={event:e,callback:n};this._eventManager.subscribe(r)}off(e){this._eventManager.unsubscribe(e)}async createInstantRequest(e){this._key=await this._generateKey();const n=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(e)}]});this.handshakeId=n.id,this.handshakeTopic=he(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",()=>{throw new Error(St)});const r=()=>{this.killSession()};try{const o=await this._sendCallRequest(n);return o&&r(),o}catch(o){throw r(),o}}async connect(e){if(!this._qrcodeModal)throw new Error(Co);return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(e),new Promise(async(n,r)=>{this.on("modal_closed",()=>r(new Error(St))),this.on("connect",(o,i)=>{if(o)return r(o);n(i.params[0])})}))}async createSession(e){if(this._connected)throw new Error(Ne);if(this.pending)return;this._key=await this._generateKey();const n=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:e&&e.chainId?e.chainId:null}]});this.handshakeId=n.id,this.handshakeTopic=he(),this._sendSessionRequest(n,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(e){if(this._connected)throw new Error(Ne);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const n={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},r={id:this.handshakeId,jsonrpc:"2.0",result:n};this._sendResponse(r),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(e){if(this._connected)throw new Error(Ne);const n=e&&e.message?e.message:_o,r=this._formatResponse({id:this.handshakeId,error:{message:n}});this._sendResponse(r),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:n}]}),this._removeStorageSession()}updateSession(e){if(!this._connected)throw new Error($);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const n={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},r=this._formatRequest({method:"wc_sessionUpdate",params:[n]});this._sendSessionRequest(r,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(e){const n=e?e.message:"Session Disconnected",r={approved:!1,chainId:null,networkId:null,accounts:null},o=this._formatRequest({method:"wc_sessionUpdate",params:[r]});await this._sendRequest(o),this._handleSessionDisconnect(n)}async sendTransaction(e){if(!this._connected)throw new Error($);const n=e,r=this._formatRequest({method:"eth_sendTransaction",params:[n]});return await this._sendCallRequest(r)}async signTransaction(e){if(!this._connected)throw new Error($);const n=e,r=this._formatRequest({method:"eth_signTransaction",params:[n]});return await this._sendCallRequest(r)}async signMessage(e){if(!this._connected)throw new Error($);const n=this._formatRequest({method:"eth_sign",params:e});return await this._sendCallRequest(n)}async signPersonalMessage(e){if(!this._connected)throw new Error($);const n=this._formatRequest({method:"personal_sign",params:e});return await this._sendCallRequest(n)}async signTypedData(e){if(!this._connected)throw new Error($);const n=this._formatRequest({method:"eth_signTypedData",params:e});return await this._sendCallRequest(n)}async updateChain(e){if(!this._connected)throw new Error("Session currently disconnected");const n=this._formatRequest({method:"wallet_updateChain",params:[e]});return await this._sendCallRequest(n)}unsafeSend(e,n){return this._sendRequest(e,n),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:n}]}),new Promise((r,o)=>{this._subscribeToResponse(e.id,(i,s)=>{if(i){o(i);return}if(!s)throw new Error(po);r(s)})})}async sendCustomRequest(e,n){if(!this._connected)throw new Error($);switch(e.method){case"eth_accounts":return this.accounts;case"eth_chainId":return dn(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":e.params;break;case"personal_sign":e.params;break}const r=this._formatRequest(e);return await this._sendCallRequest(r,n)}approveRequest(e){if(H(e)){const n=this._formatResponse(e);this._sendResponse(n)}else throw new Error(mo)}rejectRequest(e){if(re(e)){const n=this._formatResponse(e);this._sendResponse(n)}else throw new Error(wo)}transportClose(){this._transport.close()}async _sendRequest(e,n){const r=this._formatRequest(e),o=await this._encrypt(r),i=typeof(n==null?void 0:n.topic)<"u"?n.topic:this.peerId,s=JSON.stringify(o),a=typeof(n==null?void 0:n.forcePushNotification)<"u"?!n.forcePushNotification:Bn(r);this._transport.send(s,i,a)}async _sendResponse(e){const n=await this._encrypt(e),r=this.peerId,o=JSON.stringify(n),i=!0;this._transport.send(o,r,i)}async _sendSessionRequest(e,n,r){this._sendRequest(e,r),this._subscribeToSessionResponse(e.id,n)}_sendCallRequest(e,n){return this._sendRequest(e,n),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:n}]}),this._subscribeToCallResponse(e.id)}_formatRequest(e){if(typeof e.method>"u")throw new Error(yo);return{id:typeof e.id>"u"?vn():e.id,jsonrpc:"2.0",method:e.method,params:typeof e.params>"u"?[]:e.params}}_formatResponse(e){if(typeof e.id>"u")throw new Error(bo);const n={id:e.id,jsonrpc:"2.0"};if(re(e)){const r=In(e.error);return Object.assign(Object.assign(Object.assign({},n),e),{error:r})}else if(H(e))return Object.assign(Object.assign({},n),e);throw new Error(Ct)}_handleSessionDisconnect(e){const n=e||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),lt(Pe)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:n}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(e,n){n?n.approved?(this._connected?(n.chainId&&(this.chainId=n.chainId),n.accounts&&(this.accounts=n.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,n.chainId&&(this.chainId=n.chainId),n.accounts&&(this.accounts=n.accounts),n.peerId&&!this.peerId&&(this.peerId=n.peerId),n.peerMeta&&!this.peerMeta&&(this.peerMeta=n.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(e):this._handleSessionDisconnect(e)}async _handleIncomingMessages(e){if(![this.clientId,this.handshakeTopic].includes(e.topic))return;let r;try{r=JSON.parse(e.payload)}catch{return}const o=await this._decrypt(r);o&&this._eventManager.trigger(o)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(e,n){this.on(`response:${e}`,n)}_subscribeToSessionResponse(e,n){this._subscribeToResponse(e,(r,o)=>{if(r){this._handleSessionResponse(r.message);return}H(o)?this._handleSessionResponse(n,o.result):o.error&&o.error.message?this._handleSessionResponse(o.error.message):this._handleSessionResponse(n)})}_subscribeToCallResponse(e){return new Promise((n,r)=>{this._subscribeToResponse(e,(o,i)=>{if(o){r(o);return}H(i)?n(i.result):i.error&&i.error.message?r(i.error):r(new Error(Ct))})})}_subscribeToInternalEvents(){this.on("display_uri",()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,()=>{this._eventManager.trigger({event:"modal_closed",params:[]})},this._qrcodeModalOptions)}),this.on("connect",()=>{this._qrcodeModal&&this._qrcodeModal.close()}),this.on("call_request_sent",(e,n)=>{const{request:r}=n.params[0];if(pn()&&this._signingMethods.includes(r.method)){const o=ct(Pe);o&&(window.location.href=o.href)}}),this.on("wc_sessionRequest",(e,n)=>{e&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:e.toString()}]}),this.handshakeId=n.id,this.peerId=n.params[0].peerId,this.peerMeta=n.params[0].peerMeta;const r=Object.assign(Object.assign({},n),{method:"session_request"});this._eventManager.trigger(r)}),this.on("wc_sessionUpdate",(e,n)=>{e&&this._handleSessionResponse(e.message),this._handleSessionResponse("Session disconnected",n.params[0])})}_initTransport(){this._transport.on("message",e=>this._handleIncomingMessages(e)),this._transport.on("open",()=>this._eventManager.trigger({event:"transport_open",params:[]})),this._transport.on("close",()=>this._eventManager.trigger({event:"transport_close",params:[]})),this._transport.on("error",()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]})),this._transport.open()}_formatUri(){const e=this.protocol,n=this.handshakeTopic,r=this.version,o=encodeURIComponent(this.bridge),i=this.key;return`${e}:${n}@${r}?bridge=${o}&key=${i}`}_parseUri(e){const n=An(e);if(n.protocol===this.protocol){if(!n.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const r=n.handshakeTopic;if(!n.bridge)throw Error("Invalid or missing bridge url parameter value");const o=decodeURIComponent(n.bridge);if(!n.key)throw Error("Invalid or missing key parameter value");const i=n.key;return{handshakeTopic:r,bridge:o,key:i}}else throw new Error(Eo)}async _generateKey(){return this._cryptoLib?await this._cryptoLib.generateKey():null}async _encrypt(e){const n=this._key;return this._cryptoLib&&n?await this._cryptoLib.encrypt(e,n):null}async _decrypt(e){const n=this._key;return this._cryptoLib&&n?await this._cryptoLib.decrypt(e,n):null}_getStorageSession(){let e=null;return this._sessionStorage&&(e=this._sessionStorage.getSession()),e}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(e){if(!e.url||typeof e.url!="string")throw Error("Invalid or missing pushServerOpts.url parameter value");if(!e.type||typeof e.type!="string")throw Error("Invalid or missing pushServerOpts.type parameter value");if(!e.token||typeof e.token!="string")throw Error("Invalid or missing pushServerOpts.token parameter value");const n={bridge:this.bridge,topic:this.clientId,type:e.type,token:e.token,peerName:"",language:e.language||""};this.on("connect",async(r,o)=>{if(r)throw r;if(e.peerMeta){const i=o.params[0].peerMeta.name;n.peerName=i}try{if(!(await(await fetch(`${e.url}/new`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)})).json()).success)throw Error("Failed to register in Push Server")}catch{throw Error("Failed to register in Push Server")}})}}function ps(t){return ie.getBrowerCrypto().getRandomValues(new Uint8Array(t))}const Pn=256,qn=Pn,ms=Pn,q="AES-CBC",ws=`SHA-${qn}`,Fe="HMAC",ys="encrypt",bs="decrypt",vs="sign",Es="verify";function Cs(t){return t===q?{length:qn,name:q}:{hash:{name:ws},name:Fe}}function Ss(t){return t===q?[ys,bs]:[vs,Es]}async function ft(t,e=q){return ie.getSubtleCrypto().importKey("raw",t,Cs(e),!0,Ss(e))}async function Is(t,e,n){const r=ie.getSubtleCrypto(),o=await ft(e,q),i=await r.encrypt({iv:t,name:q},o,n);return new Uint8Array(i)}async function Rs(t,e,n){const r=ie.getSubtleCrypto(),o=await ft(e,q),i=await r.decrypt({iv:t,name:q},o,n);return new Uint8Array(i)}async function ks(t,e){const n=ie.getSubtleCrypto(),r=await ft(t,Fe),o=await n.sign({length:ms,name:Fe},r,e);return new Uint8Array(o)}function Ts(t,e,n){return Is(t,e,n)}function Ns(t,e,n){return Rs(t,e,n)}async function Dn(t,e){return await ks(t,e)}async function Fn(t){const e=(t||256)/8,n=ps(e);return ln(Z(n))}async function $n(t,e){const n=P(t.data),r=P(t.iv),o=P(t.hmac),i=U(o,!1),s=an(n,r),a=await Dn(e,s),c=U(a,!1);return J(i)===J(c)}async function xs(t,e,n){const r=V(_e(e)),o=n||await Fn(128),i=V(_e(o)),s=U(i,!1),a=JSON.stringify(t),c=rn(a),h=await Ts(i,r,c),_=U(h,!1),v=an(h,i),b=await Dn(r,v),w=U(b,!1);return{data:_,hmac:w,iv:s}}async function Ms(t,e){const n=V(_e(e));if(!n)throw new Error("Missing key: required for decryption");if(!await $n(t,n))return null;const o=P(t.data),i=P(t.iv),s=await Ns(i,n,o),a=tn(s);let c;try{c=JSON.parse(a)}catch{return null}return c}const As=Object.freeze(Object.defineProperty({__proto__:null,decrypt:Ms,encrypt:xs,generateKey:Fn,verifyHmac:$n},Symbol.toStringTag,{value:"Module"}));class Os extends _s{constructor(e,n){super({cryptoLib:As,connectorOpts:e,pushServerOpts:n})}}const Ls=Ft(es);var ae={},Bs=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},jn={},M={};let ht;const Us=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];M.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};M.getSymbolTotalCodewords=function(e){return Us[e]};M.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};M.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');ht=e};M.isKanjiModeEnabled=function(){return typeof ht<"u"};M.toSJIS=function(e){return ht(e)};var Ie={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+n)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,o){if(t.isValid(r))return r;try{return e(r)}catch{return o}}})(Ie);function Hn(){this.buffer=[],this.length=0}Hn.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let n=0;n>>e-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Ps=Hn;function ce(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}ce.prototype.set=function(t,e,n,r){const o=t*this.size+e;this.data[o]=n,r&&(this.reservedBit[o]=!0)};ce.prototype.get=function(t,e){return this.data[t*this.size+e]};ce.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n};ce.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var qs=ce,zn={};(function(t){const e=M.getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const o=Math.floor(r/7)+2,i=e(r),s=i===145?26:Math.ceil((i-13)/(2*o-2))*2,a=[i-7];for(let c=1;c=0&&o<=7},t.from=function(o){return t.isValid(o)?parseInt(o,10):void 0},t.getPenaltyN1=function(o){const i=o.size;let s=0,a=0,c=0,h=null,_=null;for(let v=0;v=5&&(s+=e.N1+(a-5)),h=w,a=1),w=o.get(b,v),w===_?c++:(c>=5&&(s+=e.N1+(c-5)),_=w,c=1)}a>=5&&(s+=e.N1+(a-5)),c>=5&&(s+=e.N1+(c-5))}return s},t.getPenaltyN2=function(o){const i=o.size;let s=0;for(let a=0;a=10&&(a===1488||a===93)&&s++,c=c<<1&2047|o.get(_,h),_>=10&&(c===1488||c===93)&&s++}return s*e.N3},t.getPenaltyN4=function(o){let i=0;const s=o.data.length;for(let c=0;c=0;){const s=i[0];for(let c=0;c0){const i=new Uint8Array(this.degree);return i.set(r,o),i}return r};var Fs=gt,Kn={},D={},_t={};_t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var A={};const Yn="[0-9]+",$s="[A-Z $%*+\\-./:]+";let oe="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";oe=oe.replace(/u/g,"\\u");const js="(?:(?![A-Z0-9 $%*+\\-./:]|"+oe+`)(?:.|[\r +import{E as Dt}from"./events-18c74ae2.js";import{a as Fr,s as $r,m as jr,c as ie,I as Hr,f as vt,J as Et,H as zr}from"./http-2c4dd3df.js";import{k as Ve,aB as Wr,aC as Vr,aD as Jr,aE as Qr,aF as Kr,aG as Yr,aH as Gr,aI as Zr,aJ as Xr,aK as eo,aL as to,aM as no,aN as ro,aO as oo,aP as io,aQ as so,aR as ao,aS as co,e as Ft,aT as lo,aU as uo}from"./index-c212f3ee.js";import{b as j,l as N,y as O,g as W,$ as B,q as ge,B as fo,E as ho,a as ye,c as Je,d as Qe,V as $t,s as jt,_ as Ht,A as zt,F as Wt,T as Vt,e as Jt,x as Qt,f as Kt,i as Yt,P as go}from"./hooks.module-408dc32d.js";import"@safe-globalThis/safe-apps-provider";import"@safe-globalThis/safe-apps-sdk";const Ne="Session currently connected",$="Session currently disconnected",_o="Session Rejected",po="Missing JSON RPC response",mo='JSON-RPC success response must include "result" field',wo='JSON-RPC error response must include "error" field',yo='JSON RPC request must have valid "method" value',bo='JSON RPC request must have valid "id" value',vo="Missing one of the required parameters: bridge / uri / session",Ct="JSON RPC response format is invalid",Eo="URI format is invalid",Co="QRCode Modal not provided",St="User close QRCode Modal",So=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],Io=["wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],Ke=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign",...Io],Pe="WALLETCONNECT_DEEPLINK_CHOICE",Ro={1:"mainnet",3:"ropsten",4:"rinkeby",5:"goerli",42:"kovan"};var Gt=Ye;Ye.strict=Zt;Ye.loose=Xt;var ko=Object.prototype.toString,To={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function Ye(t){return Zt(t)||Xt(t)}function Zt(t){return t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array}function Xt(t){return To[ko.call(t)]}const No=Ve(Gt);var xo=Gt.strict,Mo=function(e){if(xo(e)){var n=Buffer.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(n=n.slice(e.byteOffset,e.byteOffset+e.byteLength)),n}else return Buffer.from(e)};const Ao=Ve(Mo),Ge="hex",Ze="utf8",Oo="binary",Lo="buffer",Bo="array",Uo="typed-array",Po="array-buffer",be="0";function V(t){return new Uint8Array(t)}function Xe(t,e=!1){const n=t.toString(Ge);return e?se(n):n}function et(t){return t.toString(Ze)}function en(t){return t.readUIntBE(0,t.length)}function Z(t){return Ao(t)}function U(t,e=!1){return Xe(Z(t),e)}function tn(t){return et(Z(t))}function nn(t){return en(Z(t))}function tt(t){return Buffer.from(J(t),Ge)}function P(t){return V(tt(t))}function qo(t){return et(tt(t))}function Do(t){return nn(P(t))}function nt(t){return Buffer.from(t,Ze)}function rn(t){return V(nt(t))}function Fo(t,e=!1){return Xe(nt(t),e)}function $o(t){const e=parseInt(t,10);return ii(oi(e),"Number can only safely store up to 53 bits"),e}function jo(t){return Vo(rt(t))}function Ho(t){return ot(rt(t))}function zo(t,e){return Jo(rt(t),e)}function Wo(t){return`${t}`}function rt(t){const e=(t>>>0).toString(2);return st(e)}function Vo(t){return Z(ot(t))}function ot(t){return new Uint8Array(Xo(t).map(e=>parseInt(e,2)))}function Jo(t,e){return U(ot(t),e)}function Qo(t){return!(typeof t!="string"||!new RegExp(/^[01]+$/).test(t)||t.length%8!==0)}function on(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function ve(t){return Buffer.isBuffer(t)}function it(t){return No.strict(t)&&!ve(t)}function sn(t){return!it(t)&&!ve(t)&&typeof t.byteLength<"u"}function Ko(t){return ve(t)?Lo:it(t)?Uo:sn(t)?Po:Array.isArray(t)?Bo:typeof t}function Yo(t){return Qo(t)?Oo:on(t)?Ge:Ze}function Go(...t){return Buffer.concat(t)}function an(...t){let e=[];return t.forEach(n=>e=e.concat(Array.from(n))),new Uint8Array([...e])}function Zo(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}function Xo(t,e=8){const n=st(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}function st(t,e=8,n=be){return ei(t,Zo(t.length,e),n)}function ei(t,e,n=be){return si(t,e,!0,n)}function J(t){return t.replace(/^0x/,"")}function se(t){return t.startsWith("0x")?t:`0x${t}`}function ti(t){return t=J(t),t=st(t,2),t&&(t=se(t)),t}function ni(t){const e=t.startsWith("0x");return t=J(t),t=t.startsWith(be)?t.substring(1):t,e?se(t):t}function ri(t){return typeof t>"u"}function oi(t){return!ri(t)}function ii(t,e){if(!t)throw new Error(e)}function si(t,e,n,r=be){const o=e-t.length;let i=t;if(o>0){const s=r.repeat(o);i=n?s+t:t+s}return i}function _e(t){return Z(new Uint8Array(t))}function ai(t){return tn(new Uint8Array(t))}function cn(t,e){return U(new Uint8Array(t),!e)}function ci(t){return nn(new Uint8Array(t))}function li(...t){return P(t.map(e=>U(new Uint8Array(e))).join("")).buffer}function ln(t){return V(t).buffer}function ui(t){return et(t)}function di(t,e){return Xe(t,!e)}function fi(t){return en(t)}function hi(...t){return Go(...t)}function gi(t){return rn(t).buffer}function _i(t){return nt(t)}function pi(t,e){return Fo(t,!e)}function mi(t){return $o(t)}function wi(t){return tt(t)}function un(t){return P(t).buffer}function yi(t){return qo(t)}function bi(t){return Do(t)}function vi(t){return jo(t)}function Ei(t){return Ho(t).buffer}function Ci(t){return Wo(t)}function dn(t,e){return zo(Number(t),!e)}const Si=Qr,Ii=Kr,Ri=Yr,ki=Gr,Ti=Zr,fn=Jr,Ni=Xr,hn=Wr,xi=eo,Mi=to,Ai=no,Ee=Vr;function Ce(t){return ro(t)}function Se(){const t=Ce();return t&&t.os?t.os:void 0}function gn(){const t=Se();return t?t.toLowerCase().includes("android"):!1}function _n(){const t=Se();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function pn(){return Se()?gn()||_n():!1}function mn(){const t=Ce();return t&&t.name?t.name.toLowerCase()==="node":!1}function wn(){return!mn()&&!!fn()}const yn=Fr,bn=$r;function at(t,e){const n=bn(e),r=Ee();r&&r.setItem(t,n)}function ct(t){let e=null,n=null;const r=Ee();return r&&(n=r.getItem(t)),e=n&&yn(n),e}function lt(t){const e=Ee();e&&e.removeItem(t)}function qe(){return oo()}function Oi(t){return ti(t)}function Li(t){return se(t)}function Bi(t){return J(t)}function Ui(t){return ni(se(t))}const vn=jr;function he(){return((e,n)=>{for(n=e="";e++<36;n+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return n})()}function Pi(){console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!")}function En(t,e){let n;const r=Ro[t];return r&&(n=`https://${r}.infura.io/v3/${e}`),n}function Cn(t,e){let n;const r=En(t,e.infuraId);return e.custom&&e.custom[t]?n=e.custom[t]:r&&(n=r),n}function qi(t,e){const n=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${n}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${n}`:""}function Di(t){const e=t.href.split("?")[0];at(Pe,Object.assign(Object.assign({},t),{href:e}))}function Sn(t,e){return t.filter(n=>n.name.toLowerCase().includes(e.toLowerCase()))[0]}function Fi(t,e){let n=t;return e&&(n=e.map(r=>Sn(t,r)).filter(Boolean)),n}function $i(t,e){return async(...r)=>new Promise((o,i)=>{const s=(a,c)=>{(a===null||typeof a>"u")&&i(a),o(c)};t.apply(e,[...r,s])})}function In(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3;break}const r={code:n,message:e};return t.data&&(r.data=t.data),r}const Rn="https://registry.walletconnect.com";function ji(){return Rn+"/api/v2/wallets"}function Hi(){return Rn+"/api/v2/dapps"}function kn(t,e="mobile"){var n;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(n=t.image_url.sm)!==null&&n!==void 0?n:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function zi(t,e="mobile"){return Object.values(t).filter(n=>!!n[e].universal||!!n[e].native).map(n=>kn(n,e))}var ut={};(function(t){const e=ao,n=co,r=io,o=so,i=l=>l==null;function s(l){switch(l.arrayFormat){case"index":return d=>(f,u)=>{const g=f.length;return u===void 0||l.skipNull&&u===null||l.skipEmptyString&&u===""?f:u===null?[...f,[h(d,l),"[",g,"]"].join("")]:[...f,[h(d,l),"[",h(g,l),"]=",h(u,l)].join("")]};case"bracket":return d=>(f,u)=>u===void 0||l.skipNull&&u===null||l.skipEmptyString&&u===""?f:u===null?[...f,[h(d,l),"[]"].join("")]:[...f,[h(d,l),"[]=",h(u,l)].join("")];case"comma":case"separator":return d=>(f,u)=>u==null||u.length===0?f:f.length===0?[[h(d,l),"=",h(u,l)].join("")]:[[f,h(u,l)].join(l.arrayFormatSeparator)];default:return d=>(f,u)=>u===void 0||l.skipNull&&u===null||l.skipEmptyString&&u===""?f:u===null?[...f,h(d,l)]:[...f,[h(d,l),"=",h(u,l)].join("")]}}function a(l){let d;switch(l.arrayFormat){case"index":return(f,u,g)=>{if(d=/\[(\d*)\]$/.exec(f),f=f.replace(/\[\d*\]$/,""),!d){g[f]=u;return}g[f]===void 0&&(g[f]={}),g[f][d[1]]=u};case"bracket":return(f,u,g)=>{if(d=/(\[\])$/.exec(f),f=f.replace(/\[\]$/,""),!d){g[f]=u;return}if(g[f]===void 0){g[f]=[u];return}g[f]=[].concat(g[f],u)};case"comma":case"separator":return(f,u,g)=>{const y=typeof u=="string"&&u.includes(l.arrayFormatSeparator),m=typeof u=="string"&&!y&&_(u,l).includes(l.arrayFormatSeparator);u=m?_(u,l):u;const S=y||m?u.split(l.arrayFormatSeparator).map(R=>_(R,l)):u===null?u:_(u,l);g[f]=S};default:return(f,u,g)=>{if(g[f]===void 0){g[f]=u;return}g[f]=[].concat(g[f],u)}}}function c(l){if(typeof l!="string"||l.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(l,d){return d.encode?d.strict?e(l):encodeURIComponent(l):l}function _(l,d){return d.decode?n(l):l}function v(l){return Array.isArray(l)?l.sort():typeof l=="object"?v(Object.keys(l)).sort((d,f)=>Number(d)-Number(f)).map(d=>l[d]):l}function b(l){const d=l.indexOf("#");return d!==-1&&(l=l.slice(0,d)),l}function w(l){let d="";const f=l.indexOf("#");return f!==-1&&(d=l.slice(f)),d}function E(l){l=b(l);const d=l.indexOf("?");return d===-1?"":l.slice(d+1)}function C(l,d){return d.parseNumbers&&!Number.isNaN(Number(l))&&typeof l=="string"&&l.trim()!==""?l=Number(l):d.parseBooleans&&l!==null&&(l.toLowerCase()==="true"||l.toLowerCase()==="false")&&(l=l.toLowerCase()==="true"),l}function I(l,d){d=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},d),c(d.arrayFormatSeparator);const f=a(d),u=Object.create(null);if(typeof l!="string"||(l=l.trim().replace(/^[?#&]/,""),!l))return u;for(const g of l.split("&")){if(g==="")continue;let[y,m]=r(d.decode?g.replace(/\+/g," "):g,"=");m=m===void 0?null:["comma","separator"].includes(d.arrayFormat)?m:_(m,d),f(_(y,d),m,u)}for(const g of Object.keys(u)){const y=u[g];if(typeof y=="object"&&y!==null)for(const m of Object.keys(y))y[m]=C(y[m],d);else u[g]=C(y,d)}return d.sort===!1?u:(d.sort===!0?Object.keys(u).sort():Object.keys(u).sort(d.sort)).reduce((g,y)=>{const m=u[y];return m&&typeof m=="object"&&!Array.isArray(m)?g[y]=v(m):g[y]=m,g},Object.create(null))}t.extract=E,t.parse=I,t.stringify=(l,d)=>{if(!l)return"";d=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},d),c(d.arrayFormatSeparator);const f=m=>d.skipNull&&i(l[m])||d.skipEmptyString&&l[m]==="",u=s(d),g={};for(const m of Object.keys(l))f(m)||(g[m]=l[m]);const y=Object.keys(g);return d.sort!==!1&&y.sort(d.sort),y.map(m=>{const S=l[m];return S===void 0?"":S===null?h(m,d):Array.isArray(S)?S.reduce(u(m),[]).join("&"):h(m,d)+"="+h(S,d)}).filter(m=>m.length>0).join("&")},t.parseUrl=(l,d)=>{d=Object.assign({decode:!0},d);const[f,u]=r(l,"#");return Object.assign({url:f.split("?")[0]||"",query:I(E(l),d)},d&&d.parseFragmentIdentifier&&u?{fragmentIdentifier:_(u,d)}:{})},t.stringifyUrl=(l,d)=>{d=Object.assign({encode:!0,strict:!0},d);const f=b(l.url).split("?")[0]||"",u=t.extract(l.url),g=t.parse(u,{sort:!1}),y=Object.assign(g,l.query);let m=t.stringify(y,d);m&&(m=`?${m}`);let S=w(l.url);return l.fragmentIdentifier&&(S=`#${h(l.fragmentIdentifier,d)}`),`${f}${m}${S}`},t.pick=(l,d,f)=>{f=Object.assign({parseFragmentIdentifier:!0},f);const{url:u,query:g,fragmentIdentifier:y}=t.parseUrl(l,f);return t.stringifyUrl({url:u,query:o(g,d),fragmentIdentifier:y},f)},t.exclude=(l,d,f)=>{const u=Array.isArray(d)?g=>!d.includes(g):(g,y)=>!d(g,y);return t.pick(l,u,f)}})(ut);function Tn(t){const e=t.indexOf("?")!==-1?t.indexOf("?"):void 0;return typeof e<"u"?t.substr(e):""}function Nn(t,e){let n=dt(t);return n=Object.assign(Object.assign({},n),e),t=xn(n),t}function dt(t){return ut.parse(t)}function xn(t){return ut.stringify(t)}function Mn(t){return typeof t.bridge<"u"}function An(t){const e=t.indexOf(":"),n=t.indexOf("?")!==-1?t.indexOf("?"):void 0,r=t.substring(0,e),o=t.substring(e+1,n);function i(v){const b="@",w=v.split(b);return{handshakeTopic:w[0],version:parseInt(w[1],10)}}const s=i(o),a=typeof n<"u"?t.substr(n):"";function c(v){const b=dt(v);return{key:b.key||"",bridge:b.bridge||""}}const h=c(a);return Object.assign(Object.assign({protocol:r},s),h)}function Wi(t){return t===""||typeof t=="string"&&t.trim()===""}function Vi(t){return!(t&&t.length)}function Ji(t){return ve(t)}function Qi(t){return it(t)}function Ki(t){return sn(t)}function Yi(t){return Ko(t)}function Gi(t){return Yo(t)}function Zi(t,e){return on(t,e)}function Xi(t){return typeof t.params=="object"}function On(t){return typeof t.method<"u"}function H(t){return typeof t.result<"u"}function re(t){return typeof t.error<"u"}function De(t){return typeof t.event<"u"}function Ln(t){return So.includes(t)||t.startsWith("wc_")}function Bn(t){return t.method.startsWith("wc_")?!0:!Ke.includes(t.method)}const es=Object.freeze(Object.defineProperty({__proto__:null,addHexPrefix:Li,appendToQueryString:Nn,concatArrayBuffers:li,concatBuffers:hi,convertArrayBufferToBuffer:_e,convertArrayBufferToHex:cn,convertArrayBufferToNumber:ci,convertArrayBufferToUtf8:ai,convertBufferToArrayBuffer:ln,convertBufferToHex:di,convertBufferToNumber:fi,convertBufferToUtf8:ui,convertHexToArrayBuffer:un,convertHexToBuffer:wi,convertHexToNumber:bi,convertHexToUtf8:yi,convertNumberToArrayBuffer:Ei,convertNumberToBuffer:vi,convertNumberToHex:dn,convertNumberToUtf8:Ci,convertUtf8ToArrayBuffer:gi,convertUtf8ToBuffer:_i,convertUtf8ToHex:pi,convertUtf8ToNumber:mi,detectEnv:Ce,detectOS:Se,formatIOSMobile:qi,formatMobileRegistry:zi,formatMobileRegistryEntry:kn,formatQueryString:xn,formatRpcError:In,getClientMeta:qe,getCrypto:Mi,getCryptoOrThrow:xi,getDappRegistryUrl:Hi,getDocument:ki,getDocumentOrThrow:Ri,getEncoding:Gi,getFromWindow:Si,getFromWindowOrThrow:Ii,getInfuraRpcUrl:En,getLocal:ct,getLocalStorage:Ee,getLocalStorageOrThrow:Ai,getLocation:hn,getLocationOrThrow:Ni,getMobileLinkRegistry:Fi,getMobileRegistryEntry:Sn,getNavigator:fn,getNavigatorOrThrow:Ti,getQueryString:Tn,getRpcUrl:Cn,getType:Yi,getWalletRegistryUrl:ji,isAndroid:gn,isArrayBuffer:Ki,isBrowser:wn,isBuffer:Ji,isEmptyArray:Vi,isEmptyString:Wi,isHexString:Zi,isIOS:_n,isInternalEvent:De,isJsonRpcRequest:On,isJsonRpcResponseError:re,isJsonRpcResponseSuccess:H,isJsonRpcSubscription:Xi,isMobile:pn,isNode:mn,isReservedEvent:Ln,isSilentPayload:Bn,isTypedArray:Qi,isWalletConnectSession:Mn,logDeprecationWarning:Pi,parseQueryString:dt,parseWalletConnectUri:An,payloadId:vn,promisify:$i,removeHexLeadingZeros:Ui,removeHexPrefix:Bi,removeLocal:lt,safeJsonParse:yn,safeJsonStringify:bn,sanitizeHex:Oi,saveMobileLinkInfo:Di,setLocal:at,uuid:he},Symbol.toStringTag,{value:"Module"}));class ts{constructor(){this._eventEmitters=[],typeof window<"u"&&typeof window.addEventListener<"u"&&(window.addEventListener("online",()=>this.trigger("online")),window.addEventListener("offline",()=>this.trigger("offline")))}on(e,n){this._eventEmitters.push({event:e,callback:n})}trigger(e){let n=[];e&&(n=this._eventEmitters.filter(r=>r.event===e)),n.forEach(r=>{r.callback()})}}const ns=typeof globalThis.WebSocket<"u"?globalThis.WebSocket:require("ws");class rs{constructor(e){if(this.opts=e,this._queue=[],this._events=[],this._subscriptions=[],this._protocol=e.protocol,this._version=e.version,this._url="",this._netMonitor=null,this._socket=null,this._nextSocket=null,this._subscriptions=e.subscriptions||[],this._netMonitor=e.netMonitor||new ts,!e.url||typeof e.url!="string")throw new Error("Missing or invalid WebSocket url");this._url=e.url,this._netMonitor.on("online",()=>this._socketCreate())}set readyState(e){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(e){}get connecting(){return this.readyState===0}set connected(e){}get connected(){return this.readyState===1}set closing(e){}get closing(){return this.readyState===2}set closed(e){}get closed(){return this.readyState===3}open(){this._socketCreate()}close(){this._socketClose()}send(e,n,r){if(!n||typeof n!="string")throw new Error("Missing or invalid topic field");this._socketSend({topic:n,type:"pub",payload:e,silent:!!r})}subscribe(e){this._socketSend({topic:e,type:"sub",payload:"",silent:!0})}on(e,n){this._events.push({event:e,callback:n})}_socketCreate(){if(this._nextSocket)return;const e=os(this._url,this._protocol,this._version);if(this._nextSocket=new ns(e),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=n=>this._socketReceive(n),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=n=>this._socketError(n),this._nextSocket.onclose=()=>{setTimeout(()=>{this._nextSocket=null,this._socketCreate()},1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(e){const n=JSON.stringify(e);this._socket&&this._socket.readyState===1?this._socket.send(n):(this._setToQueue(e),this._socketCreate())}async _socketReceive(e){let n;try{n=JSON.parse(e.data)}catch{return}if(this._socketSend({topic:n.topic,type:"ack",payload:"",silent:!0}),this._socket&&this._socket.readyState===1){const r=this._events.filter(o=>o.event==="message");r&&r.length&&r.forEach(o=>o.callback(n))}}_socketError(e){const n=this._events.filter(r=>r.event==="error");n&&n.length&&n.forEach(r=>r.callback(e))}_queueSubscriptions(){this._subscriptions.forEach(n=>this._queue.push({topic:n,type:"sub",payload:"",silent:!0})),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(e){this._queue.push(e)}_pushQueue(){this._queue.forEach(n=>this._socketSend(n)),this._queue=[]}}function os(t,e,n){var r,o;const s=(t.startsWith("https")?t.replace("https","wss"):t.startsWith("http")?t.replace("http","ws"):t).split("?"),a=wn()?{protocol:e,version:n,env:"browser",host:((r=hn())===null||r===void 0?void 0:r.host)||""}:{protocol:e,version:n,env:((o=Ce())===null||o===void 0?void 0:o.name)||""},c=Nn(Tn(s[1]||""),a);return s[0]+"?"+c}class is{constructor(){this._eventEmitters=[]}subscribe(e){this._eventEmitters.push(e)}unsubscribe(e){this._eventEmitters=this._eventEmitters.filter(n=>n.event!==e)}trigger(e){let n=[],r;On(e)?r=e.method:H(e)||re(e)?r=`response:${e.id}`:De(e)?r=e.event:r="",r&&(n=this._eventEmitters.filter(o=>o.event===r)),(!n||!n.length)&&!Ln(r)&&!De(r)&&(n=this._eventEmitters.filter(o=>o.event==="call_request")),n.forEach(o=>{if(re(e)){const i=new Error(e.error.message);o.callback(i,null)}else o.callback(null,e)})}}class ss{constructor(e="walletconnect"){this.storageId=e}getSession(){let e=null;const n=ct(this.storageId);return n&&Mn(n)&&(e=n),e}setSession(e){return at(this.storageId,e),e}removeSession(){lt(this.storageId)}}const as="walletconnect.org",cs="abcdefghijklmnopqrstuvwxyz0123456789",Un=cs.split("").map(t=>`https://${t}.bridge.walletconnect.org`);function ls(t){let e=t.indexOf("//")>-1?t.split("/")[2]:t.split("/")[0];return e=e.split(":")[0],e=e.split("?")[0],e}function us(t){return ls(t).split(".").slice(-2).join(".")}function ds(){return Math.floor(Math.random()*Un.length)}function fs(){return Un[ds()]}function hs(t){return us(t)===as}function gs(t){return hs(t)?fs():t}class _s{constructor(e){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new is,this._clientMeta=qe()||e.connectorOpts.clientMeta||null,this._cryptoLib=e.cryptoLib,this._sessionStorage=e.sessionStorage||new ss(e.connectorOpts.storageId),this._qrcodeModal=e.connectorOpts.qrcodeModal,this._qrcodeModalOptions=e.connectorOpts.qrcodeModalOptions,this._signingMethods=[...Ke,...e.connectorOpts.signingMethods||[]],!e.connectorOpts.bridge&&!e.connectorOpts.uri&&!e.connectorOpts.session)throw new Error(vo);e.connectorOpts.bridge&&(this.bridge=gs(e.connectorOpts.bridge)),e.connectorOpts.uri&&(this.uri=e.connectorOpts.uri);const n=e.connectorOpts.session||this._getStorageSession();n&&(this.session=n),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=e.transport||new rs({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),e.connectorOpts.uri&&this._subscribeToSessionRequest(),e.pushServerOpts&&this._registerPushServer(e.pushServerOpts)}set bridge(e){e&&(this._bridge=e)}get bridge(){return this._bridge}set key(e){if(!e)return;const n=un(e);this._key=n}get key(){return this._key?cn(this._key,!0):""}set clientId(e){e&&(this._clientId=e)}get clientId(){let e=this._clientId;return e||(e=this._clientId=he()),this._clientId}set peerId(e){e&&(this._peerId=e)}get peerId(){return this._peerId}set clientMeta(e){}get clientMeta(){let e=this._clientMeta;return e||(e=this._clientMeta=qe()),e}set peerMeta(e){this._peerMeta=e}get peerMeta(){return this._peerMeta}set handshakeTopic(e){e&&(this._handshakeTopic=e)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(e){e&&(this._handshakeId=e)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(e){if(!e)return;const{handshakeTopic:n,bridge:r,key:o}=this._parseUri(e);this.handshakeTopic=n,this.bridge=r,this.key=o}set chainId(e){this._chainId=e}get chainId(){return this._chainId}set networkId(e){this._networkId=e}get networkId(){return this._networkId}set accounts(e){this._accounts=e}get accounts(){return this._accounts}set rpcUrl(e){this._rpcUrl=e}get rpcUrl(){return this._rpcUrl}set connected(e){}get connected(){return this._connected}set pending(e){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(e){e&&(this._connected=e.connected,this.accounts=e.accounts,this.chainId=e.chainId,this.bridge=e.bridge,this.key=e.key,this.clientId=e.clientId,this.clientMeta=e.clientMeta,this.peerId=e.peerId,this.peerMeta=e.peerMeta,this.handshakeId=e.handshakeId,this.handshakeTopic=e.handshakeTopic)}on(e,n){const r={event:e,callback:n};this._eventManager.subscribe(r)}off(e){this._eventManager.unsubscribe(e)}async createInstantRequest(e){this._key=await this._generateKey();const n=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(e)}]});this.handshakeId=n.id,this.handshakeTopic=he(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",()=>{throw new Error(St)});const r=()=>{this.killSession()};try{const o=await this._sendCallRequest(n);return o&&r(),o}catch(o){throw r(),o}}async connect(e){if(!this._qrcodeModal)throw new Error(Co);return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(e),new Promise(async(n,r)=>{this.on("modal_closed",()=>r(new Error(St))),this.on("connect",(o,i)=>{if(o)return r(o);n(i.params[0])})}))}async createSession(e){if(this._connected)throw new Error(Ne);if(this.pending)return;this._key=await this._generateKey();const n=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:e&&e.chainId?e.chainId:null}]});this.handshakeId=n.id,this.handshakeTopic=he(),this._sendSessionRequest(n,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(e){if(this._connected)throw new Error(Ne);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const n={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},r={id:this.handshakeId,jsonrpc:"2.0",result:n};this._sendResponse(r),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(e){if(this._connected)throw new Error(Ne);const n=e&&e.message?e.message:_o,r=this._formatResponse({id:this.handshakeId,error:{message:n}});this._sendResponse(r),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:n}]}),this._removeStorageSession()}updateSession(e){if(!this._connected)throw new Error($);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const n={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},r=this._formatRequest({method:"wc_sessionUpdate",params:[n]});this._sendSessionRequest(r,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(e){const n=e?e.message:"Session Disconnected",r={approved:!1,chainId:null,networkId:null,accounts:null},o=this._formatRequest({method:"wc_sessionUpdate",params:[r]});await this._sendRequest(o),this._handleSessionDisconnect(n)}async sendTransaction(e){if(!this._connected)throw new Error($);const n=e,r=this._formatRequest({method:"eth_sendTransaction",params:[n]});return await this._sendCallRequest(r)}async signTransaction(e){if(!this._connected)throw new Error($);const n=e,r=this._formatRequest({method:"eth_signTransaction",params:[n]});return await this._sendCallRequest(r)}async signMessage(e){if(!this._connected)throw new Error($);const n=this._formatRequest({method:"eth_sign",params:e});return await this._sendCallRequest(n)}async signPersonalMessage(e){if(!this._connected)throw new Error($);const n=this._formatRequest({method:"personal_sign",params:e});return await this._sendCallRequest(n)}async signTypedData(e){if(!this._connected)throw new Error($);const n=this._formatRequest({method:"eth_signTypedData",params:e});return await this._sendCallRequest(n)}async updateChain(e){if(!this._connected)throw new Error("Session currently disconnected");const n=this._formatRequest({method:"wallet_updateChain",params:[e]});return await this._sendCallRequest(n)}unsafeSend(e,n){return this._sendRequest(e,n),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:n}]}),new Promise((r,o)=>{this._subscribeToResponse(e.id,(i,s)=>{if(i){o(i);return}if(!s)throw new Error(po);r(s)})})}async sendCustomRequest(e,n){if(!this._connected)throw new Error($);switch(e.method){case"eth_accounts":return this.accounts;case"eth_chainId":return dn(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":e.params;break;case"personal_sign":e.params;break}const r=this._formatRequest(e);return await this._sendCallRequest(r,n)}approveRequest(e){if(H(e)){const n=this._formatResponse(e);this._sendResponse(n)}else throw new Error(mo)}rejectRequest(e){if(re(e)){const n=this._formatResponse(e);this._sendResponse(n)}else throw new Error(wo)}transportClose(){this._transport.close()}async _sendRequest(e,n){const r=this._formatRequest(e),o=await this._encrypt(r),i=typeof(n==null?void 0:n.topic)<"u"?n.topic:this.peerId,s=JSON.stringify(o),a=typeof(n==null?void 0:n.forcePushNotification)<"u"?!n.forcePushNotification:Bn(r);this._transport.send(s,i,a)}async _sendResponse(e){const n=await this._encrypt(e),r=this.peerId,o=JSON.stringify(n),i=!0;this._transport.send(o,r,i)}async _sendSessionRequest(e,n,r){this._sendRequest(e,r),this._subscribeToSessionResponse(e.id,n)}_sendCallRequest(e,n){return this._sendRequest(e,n),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:n}]}),this._subscribeToCallResponse(e.id)}_formatRequest(e){if(typeof e.method>"u")throw new Error(yo);return{id:typeof e.id>"u"?vn():e.id,jsonrpc:"2.0",method:e.method,params:typeof e.params>"u"?[]:e.params}}_formatResponse(e){if(typeof e.id>"u")throw new Error(bo);const n={id:e.id,jsonrpc:"2.0"};if(re(e)){const r=In(e.error);return Object.assign(Object.assign(Object.assign({},n),e),{error:r})}else if(H(e))return Object.assign(Object.assign({},n),e);throw new Error(Ct)}_handleSessionDisconnect(e){const n=e||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),lt(Pe)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:n}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(e,n){n?n.approved?(this._connected?(n.chainId&&(this.chainId=n.chainId),n.accounts&&(this.accounts=n.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,n.chainId&&(this.chainId=n.chainId),n.accounts&&(this.accounts=n.accounts),n.peerId&&!this.peerId&&(this.peerId=n.peerId),n.peerMeta&&!this.peerMeta&&(this.peerMeta=n.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(e):this._handleSessionDisconnect(e)}async _handleIncomingMessages(e){if(![this.clientId,this.handshakeTopic].includes(e.topic))return;let r;try{r=JSON.parse(e.payload)}catch{return}const o=await this._decrypt(r);o&&this._eventManager.trigger(o)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(e,n){this.on(`response:${e}`,n)}_subscribeToSessionResponse(e,n){this._subscribeToResponse(e,(r,o)=>{if(r){this._handleSessionResponse(r.message);return}H(o)?this._handleSessionResponse(n,o.result):o.error&&o.error.message?this._handleSessionResponse(o.error.message):this._handleSessionResponse(n)})}_subscribeToCallResponse(e){return new Promise((n,r)=>{this._subscribeToResponse(e,(o,i)=>{if(o){r(o);return}H(i)?n(i.result):i.error&&i.error.message?r(i.error):r(new Error(Ct))})})}_subscribeToInternalEvents(){this.on("display_uri",()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,()=>{this._eventManager.trigger({event:"modal_closed",params:[]})},this._qrcodeModalOptions)}),this.on("connect",()=>{this._qrcodeModal&&this._qrcodeModal.close()}),this.on("call_request_sent",(e,n)=>{const{request:r}=n.params[0];if(pn()&&this._signingMethods.includes(r.method)){const o=ct(Pe);o&&(window.location.href=o.href)}}),this.on("wc_sessionRequest",(e,n)=>{e&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:e.toString()}]}),this.handshakeId=n.id,this.peerId=n.params[0].peerId,this.peerMeta=n.params[0].peerMeta;const r=Object.assign(Object.assign({},n),{method:"session_request"});this._eventManager.trigger(r)}),this.on("wc_sessionUpdate",(e,n)=>{e&&this._handleSessionResponse(e.message),this._handleSessionResponse("Session disconnected",n.params[0])})}_initTransport(){this._transport.on("message",e=>this._handleIncomingMessages(e)),this._transport.on("open",()=>this._eventManager.trigger({event:"transport_open",params:[]})),this._transport.on("close",()=>this._eventManager.trigger({event:"transport_close",params:[]})),this._transport.on("error",()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]})),this._transport.open()}_formatUri(){const e=this.protocol,n=this.handshakeTopic,r=this.version,o=encodeURIComponent(this.bridge),i=this.key;return`${e}:${n}@${r}?bridge=${o}&key=${i}`}_parseUri(e){const n=An(e);if(n.protocol===this.protocol){if(!n.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const r=n.handshakeTopic;if(!n.bridge)throw Error("Invalid or missing bridge url parameter value");const o=decodeURIComponent(n.bridge);if(!n.key)throw Error("Invalid or missing key parameter value");const i=n.key;return{handshakeTopic:r,bridge:o,key:i}}else throw new Error(Eo)}async _generateKey(){return this._cryptoLib?await this._cryptoLib.generateKey():null}async _encrypt(e){const n=this._key;return this._cryptoLib&&n?await this._cryptoLib.encrypt(e,n):null}async _decrypt(e){const n=this._key;return this._cryptoLib&&n?await this._cryptoLib.decrypt(e,n):null}_getStorageSession(){let e=null;return this._sessionStorage&&(e=this._sessionStorage.getSession()),e}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(e){if(!e.url||typeof e.url!="string")throw Error("Invalid or missing pushServerOpts.url parameter value");if(!e.type||typeof e.type!="string")throw Error("Invalid or missing pushServerOpts.type parameter value");if(!e.token||typeof e.token!="string")throw Error("Invalid or missing pushServerOpts.token parameter value");const n={bridge:this.bridge,topic:this.clientId,type:e.type,token:e.token,peerName:"",language:e.language||""};this.on("connect",async(r,o)=>{if(r)throw r;if(e.peerMeta){const i=o.params[0].peerMeta.name;n.peerName=i}try{if(!(await(await fetch(`${e.url}/new`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)})).json()).success)throw Error("Failed to register in Push Server")}catch{throw Error("Failed to register in Push Server")}})}}function ps(t){return ie.getBrowerCrypto().getRandomValues(new Uint8Array(t))}const Pn=256,qn=Pn,ms=Pn,q="AES-CBC",ws=`SHA-${qn}`,Fe="HMAC",ys="encrypt",bs="decrypt",vs="sign",Es="verify";function Cs(t){return t===q?{length:qn,name:q}:{hash:{name:ws},name:Fe}}function Ss(t){return t===q?[ys,bs]:[vs,Es]}async function ft(t,e=q){return ie.getSubtleCrypto().importKey("raw",t,Cs(e),!0,Ss(e))}async function Is(t,e,n){const r=ie.getSubtleCrypto(),o=await ft(e,q),i=await r.encrypt({iv:t,name:q},o,n);return new Uint8Array(i)}async function Rs(t,e,n){const r=ie.getSubtleCrypto(),o=await ft(e,q),i=await r.decrypt({iv:t,name:q},o,n);return new Uint8Array(i)}async function ks(t,e){const n=ie.getSubtleCrypto(),r=await ft(t,Fe),o=await n.sign({length:ms,name:Fe},r,e);return new Uint8Array(o)}function Ts(t,e,n){return Is(t,e,n)}function Ns(t,e,n){return Rs(t,e,n)}async function Dn(t,e){return await ks(t,e)}async function Fn(t){const e=(t||256)/8,n=ps(e);return ln(Z(n))}async function $n(t,e){const n=P(t.data),r=P(t.iv),o=P(t.hmac),i=U(o,!1),s=an(n,r),a=await Dn(e,s),c=U(a,!1);return J(i)===J(c)}async function xs(t,e,n){const r=V(_e(e)),o=n||await Fn(128),i=V(_e(o)),s=U(i,!1),a=JSON.stringify(t),c=rn(a),h=await Ts(i,r,c),_=U(h,!1),v=an(h,i),b=await Dn(r,v),w=U(b,!1);return{data:_,hmac:w,iv:s}}async function Ms(t,e){const n=V(_e(e));if(!n)throw new Error("Missing key: required for decryption");if(!await $n(t,n))return null;const o=P(t.data),i=P(t.iv),s=await Ns(i,n,o),a=tn(s);let c;try{c=JSON.parse(a)}catch{return null}return c}const As=Object.freeze(Object.defineProperty({__proto__:null,decrypt:Ms,encrypt:xs,generateKey:Fn,verifyHmac:$n},Symbol.toStringTag,{value:"Module"}));class Os extends _s{constructor(e,n){super({cryptoLib:As,connectorOpts:e,pushServerOpts:n})}}const Ls=Ft(es);var ae={},Bs=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},jn={},M={};let ht;const Us=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];M.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};M.getSymbolTotalCodewords=function(e){return Us[e]};M.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};M.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');ht=e};M.isKanjiModeEnabled=function(){return typeof ht<"u"};M.toSJIS=function(e){return ht(e)};var Ie={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+n)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,o){if(t.isValid(r))return r;try{return e(r)}catch{return o}}})(Ie);function Hn(){this.buffer=[],this.length=0}Hn.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let n=0;n>>e-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Ps=Hn;function ce(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}ce.prototype.set=function(t,e,n,r){const o=t*this.size+e;this.data[o]=n,r&&(this.reservedBit[o]=!0)};ce.prototype.get=function(t,e){return this.data[t*this.size+e]};ce.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n};ce.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var qs=ce,zn={};(function(t){const e=M.getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const o=Math.floor(r/7)+2,i=e(r),s=i===145?26:Math.ceil((i-13)/(2*o-2))*2,a=[i-7];for(let c=1;c=0&&o<=7},t.from=function(o){return t.isValid(o)?parseInt(o,10):void 0},t.getPenaltyN1=function(o){const i=o.size;let s=0,a=0,c=0,h=null,_=null;for(let v=0;v=5&&(s+=e.N1+(a-5)),h=w,a=1),w=o.get(b,v),w===_?c++:(c>=5&&(s+=e.N1+(c-5)),_=w,c=1)}a>=5&&(s+=e.N1+(a-5)),c>=5&&(s+=e.N1+(c-5))}return s},t.getPenaltyN2=function(o){const i=o.size;let s=0;for(let a=0;a=10&&(a===1488||a===93)&&s++,c=c<<1&2047|o.get(_,h),_>=10&&(c===1488||c===93)&&s++}return s*e.N3},t.getPenaltyN4=function(o){let i=0;const s=o.data.length;for(let c=0;c=0;){const s=i[0];for(let c=0;c0){const i=new Uint8Array(this.degree);return i.set(r,o),i}return r};var Fs=gt,Kn={},D={},_t={};_t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var A={};const Yn="[0-9]+",$s="[A-Z $%*+\\-./:]+";let oe="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";oe=oe.replace(/u/g,"\\u");const js="(?:(?![A-Z0-9 $%*+\\-./:]|"+oe+`)(?:.|[\r ]))+`;A.KANJI=new RegExp(oe,"g");A.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");A.BYTE=new RegExp(js,"g");A.NUMERIC=new RegExp(Yn,"g");A.ALPHANUMERIC=new RegExp($s,"g");const Hs=new RegExp("^"+oe+"$"),zs=new RegExp("^"+Yn+"$"),Ws=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");A.testKanji=function(e){return Hs.test(e)};A.testNumeric=function(e){return zs.test(e)};A.testAlphanumeric=function(e){return Ws.test(e)};(function(t){const e=_t,n=A;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(i,s){if(!i.ccBits)throw new Error("Invalid mode: "+i);if(!e.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?i.ccBits[0]:s<27?i.ccBits[1]:i.ccBits[2]},t.getBestModeForData=function(i){return n.testNumeric(i)?t.NUMERIC:n.testAlphanumeric(i)?t.ALPHANUMERIC:n.testKanji(i)?t.KANJI:t.BYTE},t.toString=function(i){if(i&&i.id)return i.id;throw new Error("Invalid mode")},t.isValid=function(i){return i&&i.bit&&i.ccBits};function r(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+o)}}t.from=function(i,s){if(t.isValid(i))return i;try{return r(i)}catch{return s}}})(D);(function(t){const e=M,n=Re,r=Ie,o=D,i=_t,s=7973,a=e.getBCHDigit(s);function c(b,w,E){for(let C=1;C<=40;C++)if(w<=t.getCapacity(C,E,b))return C}function h(b,w){return o.getCharCountIndicator(b,w)+4}function _(b,w){let E=0;return b.forEach(function(C){const I=h(C.mode,w);E+=I+C.getBitsLength()}),E}function v(b,w){for(let E=1;E<=40;E++)if(_(b,E)<=t.getCapacity(E,w,o.MIXED))return E}t.from=function(w,E){return i.isValid(w)?parseInt(w,10):E},t.getCapacity=function(w,E,C){if(!i.isValid(w))throw new Error("Invalid QR Code version");typeof C>"u"&&(C=o.BYTE);const I=e.getSymbolTotalCodewords(w),l=n.getTotalCodewordsCount(w,E),d=(I-l)*8;if(C===o.MIXED)return d;const f=d-h(C,w);switch(C){case o.NUMERIC:return Math.floor(f/10*3);case o.ALPHANUMERIC:return Math.floor(f/11*2);case o.KANJI:return Math.floor(f/13);case o.BYTE:default:return Math.floor(f/8)}},t.getBestVersionForData=function(w,E){let C;const I=r.from(E,r.M);if(Array.isArray(w)){if(w.length>1)return v(w,I);if(w.length===0)return 1;C=w[0]}else C=w;return c(C.mode,C.getLength(),I)},t.getEncodedBits=function(w){if(!i.isValid(w)||w<7)throw new Error("Invalid QR Code version");let E=w<<12;for(;e.getBCHDigit(E)-a>=0;)E^=s<=0;)o^=Zn<<$e.getBCHDigit(o)-Rt;return(r<<10|o)^Vs};var Xn={};const Js=D;function Q(t){this.mode=Js.NUMERIC,this.data=t.toString()}Q.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Q.prototype.getLength=function(){return this.data.length};Q.prototype.getBitsLength=function(){return Q.getBitsLength(this.data.length)};Q.prototype.write=function(e){let n,r,o;for(n=0;n+3<=this.data.length;n+=3)r=this.data.substr(n,3),o=parseInt(r,10),e.put(o,10);const i=this.data.length-n;i>0&&(r=this.data.substr(n),o=parseInt(r,10),e.put(o,i*3+1))};var Qs=Q;const Ks=D,xe=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function K(t){this.mode=Ks.ALPHANUMERIC,this.data=t}K.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};K.prototype.getLength=function(){return this.data.length};K.prototype.getBitsLength=function(){return K.getBitsLength(this.data.length)};K.prototype.write=function(e){let n;for(n=0;n+2<=this.data.length;n+=2){let r=xe.indexOf(this.data[n])*45;r+=xe.indexOf(this.data[n+1]),e.put(r,11)}this.data.length%2&&e.put(xe.indexOf(this.data[n]),6)};var Ys=K;const Gs=lo,Zs=D;function Y(t){this.mode=Zs.BYTE,typeof t=="string"&&(t=Gs(t)),this.data=new Uint8Array(t)}Y.getBitsLength=function(e){return e*8};Y.prototype.getLength=function(){return this.data.length};Y.prototype.getBitsLength=function(){return Y.getBitsLength(this.data.length)};Y.prototype.write=function(t){for(let e=0,n=this.data.length;e=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),t.put(n,13)}};var na=G;(function(t){const e=D,n=Qs,r=Ys,o=Xs,i=na,s=A,a=M,c=uo;function h(l){return unescape(encodeURIComponent(l)).length}function _(l,d,f){const u=[];let g;for(;(g=l.exec(f))!==null;)u.push({data:g[0],index:g.index,mode:d,length:g[0].length});return u}function v(l){const d=_(s.NUMERIC,e.NUMERIC,l),f=_(s.ALPHANUMERIC,e.ALPHANUMERIC,l);let u,g;return a.isKanjiModeEnabled()?(u=_(s.BYTE,e.BYTE,l),g=_(s.KANJI,e.KANJI,l)):(u=_(s.BYTE_KANJI,e.BYTE,l),g=[]),d.concat(f,u,g).sort(function(m,S){return m.index-S.index}).map(function(m){return{data:m.data,mode:m.mode,length:m.length}})}function b(l,d){switch(d){case e.NUMERIC:return n.getBitsLength(l);case e.ALPHANUMERIC:return r.getBitsLength(l);case e.KANJI:return i.getBitsLength(l);case e.BYTE:return o.getBitsLength(l)}}function w(l){return l.reduce(function(d,f){const u=d.length-1>=0?d[d.length-1]:null;return u&&u.mode===f.mode?(d[d.length-1].data+=f.data,d):(d.push(f),d)},[])}function E(l){const d=[];for(let f=0;f=0&&a<=6&&(c===0||c===6)||c>=0&&c<=6&&(a===0||a===6)||a>=2&&a<=4&&c>=2&&c<=4?t.set(i+a,s+c,!0,!0):t.set(i+a,s+c,!1,!0))}}function da(t){const e=t.size;for(let n=8;n>a&1)===1,t.set(o,i,s,!0),t.set(i,o,s,!0)}function Oe(t,e,n){const r=t.size,o=ca.getEncodedBits(e,n);let i,s;for(i=0;i<15;i++)s=(o>>i&1)===1,i<6?t.set(i,8,s,!0):i<8?t.set(i+1,8,s,!0):t.set(r-15+i,8,s,!0),i<8?t.set(8,r-i-1,s,!0):i<9?t.set(8,15-i-1+1,s,!0):t.set(8,15-i-1,s,!0);t.set(r-8,8,1,!0)}function ga(t,e){const n=t.size;let r=-1,o=n-1,i=7,s=0;for(let a=n-1;a>0;a-=2)for(a===6&&a--;;){for(let c=0;c<2;c++)if(!t.isReserved(o,a-c)){let h=!1;s>>i&1)===1),t.set(o,a-c,h),i--,i===-1&&(s++,i=7)}if(o+=r,o<0||n<=o){o-=r,r=-r;break}}}function _a(t,e,n){const r=new ra;n.forEach(function(c){r.put(c.mode.bit,4),r.put(c.getLength(),la.getCharCountIndicator(c.mode,t)),c.write(r)});const o=Te.getSymbolTotalCodewords(t),i=He.getTotalCodewordsCount(t,e),s=(o-i)*8;for(r.getLengthInBits()+4<=s&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);const a=(s-r.getLengthInBits())/8;for(let c=0;c"data"in d)||e.walk():{},E=(()=>e instanceof h1?new KR({functionName:i}):[ZR,Eo.code].includes(s)&&(o||l||c)?new Bp({abi:u,data:typeof o=="object"?o.data:o,functionName:i,message:c??l}):e)();return new FC(E,{abi:u,args:n,contractAddress:t,docsPath:r,functionName:i,sender:a})}class zo extends Bu{constructor({docsPath:u}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join(` -`),{docsPath:u,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}class XR extends Bu{constructor(u,{account:t,docsPath:n,chain:r,data:i,gas:a,gasPrice:s,maxFeePerGas:o,maxPriorityFeePerGas:l,nonce:c,to:E,value:d}){var p;const f=zc({from:t==null?void 0:t.address,to:E,value:typeof d<"u"&&`${yC(d)} ${((p=r==null?void 0:r.nativeCurrency)==null?void 0:p.symbol)||"ETH"}`,data:i,gas:a,gasPrice:typeof s<"u"&&`${Re(s)} gwei`,maxFeePerGas:typeof o<"u"&&`${Re(o)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Re(l)} gwei`,nonce:c});super(u.shortMessage,{cause:u,docsPath:n,metaMessages:[...u.metaMessages?[...u.metaMessages," "]:[],"Estimate Gas Arguments:",f].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=u}}function bC(e,u){const t=(e.details||"").toLowerCase(),n=e.walk(r=>r.code===Ns.code);return n instanceof Bu?new Ns({cause:e,message:n.details}):Ns.nodeMessage.test(t)?new Ns({cause:e,message:e.details}):e2.nodeMessage.test(t)?new e2({cause:e,maxFeePerGas:u==null?void 0:u.maxFeePerGas}):cp.nodeMessage.test(t)?new cp({cause:e,maxFeePerGas:u==null?void 0:u.maxFeePerGas}):Ep.nodeMessage.test(t)?new Ep({cause:e,nonce:u==null?void 0:u.nonce}):dp.nodeMessage.test(t)?new dp({cause:e,nonce:u==null?void 0:u.nonce}):fp.nodeMessage.test(t)?new fp({cause:e,nonce:u==null?void 0:u.nonce}):pp.nodeMessage.test(t)?new pp({cause:e}):hp.nodeMessage.test(t)?new hp({cause:e,gas:u==null?void 0:u.gas}):Cp.nodeMessage.test(t)?new Cp({cause:e,gas:u==null?void 0:u.gas}):mp.nodeMessage.test(t)?new mp({cause:e}):t2.nodeMessage.test(t)?new t2({cause:e,maxFeePerGas:u==null?void 0:u.maxFeePerGas,maxPriorityFeePerGas:u==null?void 0:u.maxPriorityFeePerGas}):new f1({cause:e})}function uz(e,{docsPath:u,...t}){const n=(()=>{const r=bC(e,t);return r instanceof f1?e:r})();return new XR(n,{docsPath:u,...t})}function wC(e,{format:u}){if(!u)return{};const t={};function n(i){const a=Object.keys(i);for(const s of a)s in e&&(t[s]=e[s]),i[s]&&typeof i[s]=="object"&&!Array.isArray(i[s])&&n(i[s])}const r=u(e||{});return n(r),t}function jc(e){const{account:u,gasPrice:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:i}=e,a=u?kt(u):void 0;if(a&&!lo(a.address))throw new Bl({address:a.address});if(i&&!lo(i))throw new Bl({address:i});if(typeof t<"u"&&(typeof n<"u"||typeof r<"u"))throw new qR;if(n&&n>2n**256n-1n)throw new e2({maxFeePerGas:n});if(r&&n&&r>n)throw new t2({maxFeePerGas:n,maxPriorityFeePerGas:r})}class ez extends Bu{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class xC extends Bu{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class tz extends Bu{constructor({maxPriorityFeePerGas:u}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Re(u)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class nz extends Bu{constructor({blockHash:u,blockNumber:t}){let n="Block";u&&(n=`Block at hash "${u}"`),t&&(n=`Block at number "${t}"`),super(`${n} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}async function vi(e,{blockHash:u,blockNumber:t,blockTag:n,includeTransactions:r}={}){var c,E,d;const i=n??"latest",a=r??!1,s=t!==void 0?Lu(t):void 0;let o=null;if(u?o=await e.request({method:"eth_getBlockByHash",params:[u,a]}):o=await e.request({method:"eth_getBlockByNumber",params:[s||i,a]}),!o)throw new nz({blockHash:u,blockNumber:t});return(((d=(E=(c=e.chain)==null?void 0:c.formatters)==null?void 0:E.block)==null?void 0:d.format)||cC)(o)}async function kC(e){const u=await e.request({method:"eth_gasPrice"});return BigInt(u)}async function rz(e,u){return Eb(e,u)}async function Eb(e,u){var i,a,s;const{block:t,chain:n=e.chain,request:r}=u||{};if(typeof((i=n==null?void 0:n.fees)==null?void 0:i.defaultPriorityFee)=="function"){const o=t||await zu(e,vi)({});return n.fees.defaultPriorityFee({block:o,client:e,request:r})}else if(typeof((a=n==null?void 0:n.fees)==null?void 0:a.defaultPriorityFee)<"u")return(s=n==null?void 0:n.fees)==null?void 0:s.defaultPriorityFee;try{const o=await e.request({method:"eth_maxPriorityFeePerGas"});return Zn(o)}catch{const[o,l]=await Promise.all([t?Promise.resolve(t):zu(e,vi)({}),zu(e,kC)({})]);if(typeof o.baseFeePerGas!="bigint")throw new xC;const c=l-o.baseFeePerGas;return c<0n?0n:c}}async function iz(e,u){return Fp(e,u)}async function Fp(e,u){var d,f;const{block:t,chain:n=e.chain,request:r,type:i="eip1559"}=u||{},a=await(async()=>{var p,h;return typeof((p=n==null?void 0:n.fees)==null?void 0:p.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:t,client:e,request:r}):((h=n==null?void 0:n.fees)==null?void 0:h.baseFeeMultiplier)??1.2})();if(a<1)throw new ez;const o=10**(((d=a.toString().split(".")[1])==null?void 0:d.length)??0),l=p=>p*BigInt(Math.ceil(a*o))/BigInt(o),c=t||await zu(e,vi)({});if(typeof((f=n==null?void 0:n.fees)==null?void 0:f.estimateFeesPerGas)=="function")return n.fees.estimateFeesPerGas({block:t,client:e,multiply:l,request:r,type:i});if(i==="eip1559"){if(typeof c.baseFeePerGas!="bigint")throw new xC;const p=r!=null&&r.maxPriorityFeePerGas?r.maxPriorityFeePerGas:await Eb(e,{block:c,chain:n,request:r}),h=l(c.baseFeePerGas);return{maxFeePerGas:(r==null?void 0:r.maxFeePerGas)??h+p,maxPriorityFeePerGas:p}}return{gasPrice:(r==null?void 0:r.gasPrice)??l(await zu(e,kC)({}))}}async function db(e,{address:u,blockTag:t="latest",blockNumber:n}){const r=await e.request({method:"eth_getTransactionCount",params:[u,n?Lu(n):t]});return se(r)}function az(e){if(e.type)return e.type;if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new HR({transaction:e})}async function B1(e,u){const{account:t=e.account,chain:n,gas:r,nonce:i,type:a}=u;if(!t)throw new zo;const s=kt(t),o=await zu(e,vi)({blockTag:"latest"}),l={...u,from:s.address};if(typeof i>"u"&&(l.nonce=await zu(e,db)({address:s.address,blockTag:"pending"})),typeof a>"u")try{l.type=az(l)}catch{l.type=typeof o.baseFeePerGas=="bigint"?"eip1559":"legacy"}if(l.type==="eip1559"){const{maxFeePerGas:c,maxPriorityFeePerGas:E}=await Fp(e,{block:o,chain:n,request:l});if(typeof u.maxPriorityFeePerGas>"u"&&u.maxFeePerGas&&u.maxFeePerGas"u"&&(l.gas=await zu(e,_C)({...l,account:{address:s.address,type:"json-rpc"}})),jc(l),l}async function _C(e,u){var r,i,a;const t=u.account??e.account;if(!t)throw new zo({docsPath:"/docs/actions/public/estimateGas"});const n=kt(t);try{const{accessList:s,blockNumber:o,blockTag:l,data:c,gas:E,gasPrice:d,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:h,to:g,value:A,...m}=n.type==="local"?await B1(e,u):u,F=(o?Lu(o):void 0)||l;jc(u);const w=(a=(i=(r=e.chain)==null?void 0:r.formatters)==null?void 0:i.transactionRequest)==null?void 0:a.format,C=(w||d1)({...wC(m,{format:w}),from:n.address,accessList:s,data:c,gas:E,gasPrice:d,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:h,to:g,value:A}),k=await e.request({method:"eth_estimateGas",params:F?[C,F]:[C]});return BigInt(k)}catch(s){throw uz(s,{...u,account:n,chain:e.chain})}}async function sz(e,{abi:u,address:t,args:n,functionName:r,...i}){const a=Pi({abi:u,args:n,functionName:r});try{return await zu(e,_C)({data:a,to:t,...i})}catch(s){const o=i.account?kt(i.account):void 0;throw Il(s,{abi:u,address:t,args:n,docsPath:"/docs/contract/estimateContractGas",functionName:r,sender:o==null?void 0:o.address})}}const Y7="/docs/contract/decodeEventLog";function Mc({abi:e,data:u,strict:t,topics:n}){const r=t??!0,[i,...a]=n;if(!i)throw new WN({docsPath:Y7});const s=e.find(p=>p.type==="event"&&i===CC(Za(p)));if(!(s&&"name"in s)||s.type!=="event")throw new qN(i,{docsPath:Y7});const{name:o,inputs:l}=s,c=l==null?void 0:l.some(p=>!("name"in p&&p.name));let E=c?[]:{};const d=l.filter(p=>"indexed"in p&&p.indexed);for(let p=0;p!("indexed"in p&&p.indexed));if(f.length>0){if(u&&u!=="0x")try{const p=g1(f,u);if(p)if(c)E=[...E,...p];else for(let h=0;h0?E:void 0}}function oz({param:e,value:u}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?u:(g1([e],u)||[])[0]}async function SC(e,{address:u,blockHash:t,fromBlock:n,toBlock:r,event:i,events:a,args:s,strict:o}={}){const l=o??!1,c=a??(i?[i]:void 0);let E=[];c&&(E=[c.flatMap(f=>Rc({abi:[f],eventName:f.name,args:s}))],i&&(E=E[0]));let d;return t?d=await e.request({method:"eth_getLogs",params:[{address:u,topics:E,blockHash:t}]}):d=await e.request({method:"eth_getLogs",params:[{address:u,topics:E,fromBlock:typeof n=="bigint"?Lu(n):n,toBlock:typeof r=="bigint"?Lu(r):r}]}),d.map(f=>{var p;try{const{eventName:h,args:g}=c?Mc({abi:c,data:f.data,topics:f.topics,strict:l}):{eventName:void 0,args:void 0};return Jt(f,{args:g,eventName:h})}catch(h){let g,A;if(h instanceof $a||h instanceof No){if(l)return;g=h.abiItem.name,A=(p=h.abiItem.inputs)==null?void 0:p.some(m=>!("name"in m&&m.name))}return Jt(f,{args:A?[]:{},eventName:g})}}).filter(Boolean)}async function fb(e,{abi:u,address:t,args:n,blockHash:r,eventName:i,fromBlock:a,toBlock:s,strict:o}){const l=i?Nc({abi:u,name:i}):void 0,c=l?void 0:u.filter(E=>E.type==="event");return zu(e,SC)({address:t,args:n,blockHash:r,event:l,events:c,fromBlock:a,toBlock:s,strict:o})}const o6="/docs/contract/decodeFunctionResult";function jo({abi:e,args:u,functionName:t,data:n}){let r=e[0];if(t&&(r=Nc({abi:e,args:u,name:t}),!r))throw new n2(t,{docsPath:o6});if(r.type!=="function")throw new n2(void 0,{docsPath:o6});if(!r.outputs)throw new HN(r.name,{docsPath:o6});const i=g1(r.outputs,n);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}const Dp=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],pb=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],hb=[...pb,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],lz=[...pb,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],Z7=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],X7=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],cz=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],Ez="0x82ad56cb";function Mo({blockNumber:e,chain:u,contract:t}){var r;const n=(r=u==null?void 0:u.contracts)==null?void 0:r[t];if(!n)throw new lp({chain:u,contract:{name:t}});if(e&&n.blockCreated&&n.blockCreated>e)throw new lp({blockNumber:e,chain:u,contract:{name:t,blockCreated:n.blockCreated}});return n.address}function dz(e,{docsPath:u,...t}){const n=(()=>{const r=bC(e,t);return r instanceof f1?e:r})();return new cb(n,{docsPath:u,...t})}const l6=new Map;function PC({fn:e,id:u,shouldSplitBatch:t,wait:n=0,sort:r}){const i=async()=>{const c=o();a();const E=c.map(({args:d})=>d);E.length!==0&&e(E).then(d=>{r&&Array.isArray(d)&&d.sort(r),c.forEach(({pendingPromise:f},p)=>{var h;return(h=f.resolve)==null?void 0:h.call(f,[d[p],d])})}).catch(d=>{c.forEach(({pendingPromise:f})=>{var p;return(p=f.reject)==null?void 0:p.call(f,d)})})},a=()=>l6.delete(u),s=()=>o().map(({args:c})=>c),o=()=>l6.get(u)||[],l=c=>l6.set(u,[...o(),c]);return{flush:a,async schedule(c){const E={},d=new Promise((h,g)=>{E.resolve=h,E.reject=g});return(t==null?void 0:t([...s(),c]))&&i(),o().length>0?(l({args:c,pendingPromise:E}),d):(l({args:c,pendingPromise:E}),setTimeout(i,n),d)}}}async function y1(e,u){var A,m,B,F;const{account:t=e.account,batch:n=!!((A=e.batch)!=null&&A.multicall),blockNumber:r,blockTag:i="latest",accessList:a,data:s,gas:o,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:E,nonce:d,to:f,value:p,...h}=u,g=t?kt(t):void 0;try{jc(u);const v=(r?Lu(r):void 0)||i,C=(F=(B=(m=e.chain)==null?void 0:m.formatters)==null?void 0:B.transactionRequest)==null?void 0:F.format,j=(C||d1)({...wC(h,{format:C}),from:g==null?void 0:g.address,accessList:a,data:s,gas:o,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:E,nonce:d,to:f,value:p});if(n&&fz({request:j}))try{return await pz(e,{...j,blockNumber:r,blockTag:i})}catch(uu){if(!(uu instanceof Qv)&&!(uu instanceof lp))throw uu}const N=await e.request({method:"eth_call",params:v?[j,v]:[j]});return N==="0x"?{data:void 0}:{data:N}}catch(w){const v=hz(w),{offchainLookup:C,offchainLookupSignature:k}=await Uu(()=>import("./ccip-5ff8960f.js"),[]);if((v==null?void 0:v.slice(0,10))===k&&f)return{data:await C(e,{data:v,to:f})};throw dz(w,{...u,account:g,chain:e.chain})}}function fz({request:e}){const{data:u,to:t,...n}=e;return!(!u||u.startsWith(Ez)||!t||Object.values(n).filter(r=>typeof r<"u").length>0)}async function pz(e,u){var h;const{batchSize:t=1024,wait:n=0}=typeof((h=e.batch)==null?void 0:h.multicall)=="object"?e.batch.multicall:{},{blockNumber:r,blockTag:i="latest",data:a,multicallAddress:s,to:o}=u;let l=s;if(!l){if(!e.chain)throw new Qv;l=Mo({blockNumber:r,chain:e.chain,contract:"multicall3"})}const E=(r?Lu(r):void 0)||i,{schedule:d}=PC({id:`${e.uid}.${E}`,wait:n,shouldSplitBatch(g){return g.reduce((m,{data:B})=>m+(B.length-2),0)>t*2},fn:async g=>{const A=g.map(F=>({allowFailure:!0,callData:F.data,target:F.to})),m=Pi({abi:Dp,args:[A],functionName:"aggregate3"}),B=await e.request({method:"eth_call",params:[{data:m,to:l},E]});return jo({abi:Dp,args:[A],functionName:"aggregate3",data:B||"0x"})}}),[{returnData:f,success:p}]=await d({data:a,to:o});if(!p)throw new DC({data:f});return f==="0x"?{data:void 0}:{data:f}}function hz(e){if(!(e instanceof Bu))return;const u=e.walk();return typeof u.data=="object"?u.data.data:u.data}async function bi(e,{abi:u,address:t,args:n,functionName:r,...i}){const a=Pi({abi:u,args:n,functionName:r});try{const{data:s}=await zu(e,y1)({data:a,to:t,...i});return jo({abi:u,args:n,functionName:r,data:s||"0x"})}catch(s){throw Il(s,{abi:u,address:t,args:n,docsPath:"/docs/contract/readContract",functionName:r})}}async function Cz(e,{abi:u,address:t,args:n,dataSuffix:r,functionName:i,...a}){const s=a.account?kt(a.account):void 0,o=Pi({abi:u,args:n,functionName:i});try{const{data:l}=await zu(e,y1)({batch:!1,data:`${o}${r?r.replace("0x",""):""}`,to:t,...a});return{result:jo({abi:u,args:n,functionName:i,data:l||"0x"}),request:{abi:u,address:t,args:n,dataSuffix:r,functionName:i,...a}}}catch(l){throw Il(l,{abi:u,address:t,args:n,docsPath:"/docs/contract/simulateContract",functionName:i,sender:s==null?void 0:s.address})}}const c6=new Map,uA=new Map;let mz=0;function Lo(e,u,t){const n=++mz,r=()=>c6.get(e)||[],i=()=>{const c=r();c6.set(e,c.filter(E=>E.id!==n))},a=()=>{const c=uA.get(e);r().length===1&&c&&c(),i()},s=r();if(c6.set(e,[...s,{id:n,fns:u}]),s&&s.length>0)return a;const o={};for(const c in u)o[c]=(...E)=>{const d=r();d.length!==0&&d.forEach(f=>{var p,h;return(h=(p=f.fns)[c])==null?void 0:h.call(p,...E)})};const l=t(o);return typeof l=="function"&&uA.set(e,l),a}async function a2(e){return new Promise(u=>setTimeout(u,e))}function Lc(e,{emitOnBegin:u,initialWaitTime:t,interval:n}){let r=!0;const i=()=>r=!1;return(async()=>{let s;u&&(s=await e({unpoll:i}));const o=await(t==null?void 0:t(s))??n;await a2(o);const l=async()=>{r&&(await e({unpoll:i}),await a2(n),l())};l()})(),i}const Az=new Map,gz=new Map;function Bz(e){const u=(r,i)=>({clear:()=>i.delete(r),get:()=>i.get(r),set:a=>i.set(r,a)}),t=u(e,Az),n=u(e,gz);return{clear:()=>{t.clear(),n.clear()},promise:t,response:n}}async function yz(e,{cacheKey:u,cacheTime:t=1/0}){const n=Bz(u),r=n.response.get();if(r&&t>0&&new Date().getTime()-r.created.getTime()`blockNumber.${e}`;async function Uc(e,{cacheTime:u=e.cacheTime,maxAge:t}={}){const n=await yz(()=>e.request({method:"eth_blockNumber"}),{cacheKey:Fz(e.uid),cacheTime:t??u});return BigInt(n)}async function F1(e,{filter:u}){const t="strict"in u&&u.strict;return(await u.request({method:"eth_getFilterChanges",params:[u.id]})).map(r=>{var i;if(typeof r=="string")return r;try{const{eventName:a,args:s}="abi"in u&&u.abi?Mc({abi:u.abi,data:r.data,topics:r.topics,strict:t}):{eventName:void 0,args:void 0};return Jt(r,{args:s,eventName:a})}catch(a){let s,o;if(a instanceof $a||a instanceof No){if("strict"in u&&u.strict)return;s=a.abiItem.name,o=(i=a.abiItem.inputs)==null?void 0:i.some(l=>!("name"in l&&l.name))}return Jt(r,{args:o?[]:{},eventName:s})}}).filter(Boolean)}async function D1(e,{filter:u}){return u.request({method:"eth_uninstallFilter",params:[u.id]})}function Dz(e,{abi:u,address:t,args:n,batch:r=!0,eventName:i,onError:a,onLogs:s,poll:o,pollingInterval:l=e.pollingInterval,strict:c}){return(typeof o<"u"?o:e.transport.type!=="webSocket")?(()=>{const p=ge(["watchContractEvent",t,n,r,e.uid,i,l]),h=c??!1;return Lo(p,{onLogs:s,onError:a},g=>{let A,m,B=!1;const F=Lc(async()=>{var w;if(!B){try{m=await zu(e,ib)({abi:u,address:t,args:n,eventName:i,strict:h})}catch{}B=!0;return}try{let v;if(m)v=await zu(e,F1)({filter:m});else{const C=await zu(e,Uc)({});A&&A!==C?v=await zu(e,fb)({abi:u,address:t,args:n,eventName:i,fromBlock:A+1n,toBlock:C,strict:h}):v=[],A=C}if(v.length===0)return;r?g.onLogs(v):v.forEach(C=>g.onLogs([C]))}catch(v){m&&v instanceof Wa&&(B=!1),(w=g.onError)==null||w.call(g,v)}},{emitOnBegin:!0,interval:l});return async()=>{m&&await zu(e,D1)({filter:m}),F()}})})():(()=>{let p=!0,h=()=>p=!1;return(async()=>{try{const g=i?Rc({abi:u,eventName:i,args:n}):[],{unsubscribe:A}=await e.transport.subscribe({params:["logs",{address:t,topics:g}],onData(m){var F;if(!p)return;const B=m.result;try{const{eventName:w,args:v}=Mc({abi:u,data:B.data,topics:B.topics,strict:c}),C=Jt(B,{args:v,eventName:w});s([C])}catch(w){let v,C;if(w instanceof $a||w instanceof No){if(c)return;v=w.abiItem.name,C=(F=w.abiItem.inputs)==null?void 0:F.some(j=>!("name"in j&&j.name))}const k=Jt(B,{args:C?[]:{},eventName:v});s([k])}},onError(m){a==null||a(m)}});h=A,p||h()}catch(g){a==null||a(g)}})(),h})()}function Cb({chain:e,currentChainId:u}){if(!e)throw new SN;if(u!==e.id)throw new _N({chain:e,currentChainId:u})}function vz(e,{docsPath:u,...t}){const n=(()=>{const r=bC(e,t);return r instanceof f1?e:r})();return new GR(n,{docsPath:u,...t})}async function Nl(e){const u=await e.request({method:"eth_chainId"});return se(u)}async function TC(e,{serializedTransaction:u}){return e.request({method:"eth_sendRawTransaction",params:[u]})}async function OC(e,u){var h,g,A,m;const{account:t=e.account,chain:n=e.chain,accessList:r,data:i,gas:a,gasPrice:s,maxFeePerGas:o,maxPriorityFeePerGas:l,nonce:c,to:E,value:d,...f}=u;if(!t)throw new zo({docsPath:"/docs/actions/wallet/sendTransaction"});const p=kt(t);try{jc(u);let B;if(n!==null&&(B=await zu(e,Nl)({}),Cb({currentChainId:B,chain:n})),p.type==="local"){const C=await zu(e,B1)({account:p,accessList:r,chain:n,data:i,gas:a,gasPrice:s,maxFeePerGas:o,maxPriorityFeePerGas:l,nonce:c,to:E,value:d,...f});B||(B=await zu(e,Nl)({}));const k=(h=n==null?void 0:n.serializers)==null?void 0:h.transaction,j=await p.signTransaction({...C,chainId:B},{serializer:k});return await zu(e,TC)({serializedTransaction:j})}const F=(m=(A=(g=e.chain)==null?void 0:g.formatters)==null?void 0:A.transactionRequest)==null?void 0:m.format,v=(F||d1)({...wC(f,{format:F}),accessList:r,data:i,from:p.address,gas:a,gasPrice:s,maxFeePerGas:o,maxPriorityFeePerGas:l,nonce:c,to:E,value:d});return await e.request({method:"eth_sendTransaction",params:[v]})}catch(B){throw vz(B,{...u,account:p,chain:u.chain||void 0})}}async function bz(e,{abi:u,address:t,args:n,dataSuffix:r,functionName:i,...a}){const s=Pi({abi:u,args:n,functionName:i});return await zu(e,OC)({data:`${s}${r?r.replace("0x",""):""}`,to:t,...a})}async function wz(e,{chain:u}){const{id:t,name:n,nativeCurrency:r,rpcUrls:i,blockExplorers:a}=u;await e.request({method:"wallet_addEthereumChain",params:[{chainId:Lu(t),chainName:n,nativeCurrency:r,rpcUrls:i.default.http,blockExplorerUrls:a?Object.values(a).map(({url:s})=>s):void 0}]})}const vp=256;let TE=vp,OE;function xz(e=11){if(!OE||TE+e>vp*2){OE="",TE=0;for(let u=0;u{const A=g(h);for(const B in f)delete A[B];const m={...h,...A};return Object.assign(m,{extend:p(m)})}}return Object.assign(f,{extend:p(f)})}function Ab(e,{delay:u=100,retryCount:t=2,shouldRetry:n=()=>!0}={}){return new Promise((r,i)=>{const a=async({count:s=0}={})=>{const o=async({error:l})=>{const c=typeof u=="function"?u({count:s,error:l}):u;c&&await a2(c),a({count:s+1})};try{const l=await e();r(l)}catch(l){if(s"code"in e?e.code!==-1&&e.code!==-32004&&e.code!==-32005&&e.code!==-32042&&e.code!==-32603:e instanceof K3&&e.status?e.status!==403&&e.status!==408&&e.status!==413&&e.status!==429&&e.status!==500&&e.status!==502&&e.status!==503&&e.status!==504:!1;function kz(e,{retryDelay:u=150,retryCount:t=3}={}){return async n=>Ab(async()=>{try{return await e(n)}catch(r){const i=r;switch(i.code){case yl.code:throw new yl(i);case Fl.code:throw new Fl(i);case Dl.code:throw new Dl(i);case vl.code:throw new vl(i);case Eo.code:throw new Eo(i);case Wa.code:throw new Wa(i);case bl.code:throw new bl(i);case Di.code:throw new Di(i);case wl.code:throw new wl(i);case xl.code:throw new xl(i);case kl.code:throw new kl(i);case _l.code:throw new _l(i);case O0.code:throw new O0(i);case Sl.code:throw new Sl(i);case Pl.code:throw new Pl(i);case Tl.code:throw new Tl(i);case Ol.code:throw new Ol(i);case kn.code:throw new kn(i);case 5e3:throw new O0(i);default:throw r instanceof Bu?r:new YR(i)}}},{delay:({count:r,error:i})=>{var a;if(i&&i instanceof K3){const s=(a=i==null?void 0:i.headers)==null?void 0:a.get("Retry-After");if(s!=null&&s.match(/\d/))return parseInt(s)*1e3}return~~(1<!gb(r)})}function v1({key:e,name:u,request:t,retryCount:n=3,retryDelay:r=150,timeout:i,type:a},s){return{config:{key:e,name:u,request:t,retryCount:n,retryDelay:r,timeout:i,type:a},request:kz(t,{retryCount:n,retryDelay:r}),value:s}}function $c(e,u={}){const{key:t="custom",name:n="Custom Provider",retryDelay:r}=u;return({retryCount:i})=>v1({key:t,name:n,request:e.request.bind(e),retryCount:u.retryCount??i,retryDelay:r,type:"custom"})}function eA(e,u={}){const{key:t="fallback",name:n="Fallback",rank:r=!1,retryCount:i,retryDelay:a}=u;return({chain:s,pollingInterval:o=4e3,timeout:l})=>{let c=e,E=()=>{};const d=v1({key:t,name:n,async request({method:f,params:p}){const h=async(g=0)=>{const A=c[g]({chain:s,retryCount:0,timeout:l});try{const m=await A.request({method:f,params:p});return E({method:f,params:p,response:m,transport:A,status:"success"}),m}catch(m){if(E({error:m,method:f,params:p,transport:A,status:"error"}),gb(m)||g===c.length-1)throw m;return h(g+1)}};return h()},retryCount:i,retryDelay:a,type:"fallback"},{onResponse:f=>E=f,transports:c.map(f=>f({chain:s,retryCount:0}))});if(r){const f=typeof r=="object"?r:{};_z({chain:s,interval:f.interval??o,onTransports:p=>c=p,sampleCount:f.sampleCount,timeout:f.timeout,transports:c,weights:f.weights})}return d}}function _z({chain:e,interval:u=4e3,onTransports:t,sampleCount:n=10,timeout:r=1e3,transports:i,weights:a={}}){const{stability:s=.7,latency:o=.3}=a,l=[],c=async()=>{const E=await Promise.all(i.map(async p=>{const h=p({chain:e,retryCount:0,timeout:r}),g=Date.now();let A,m;try{await h.request({method:"net_listening"}),m=1}catch{m=0}finally{A=Date.now()}return{latency:A-g,success:m}}));l.push(E),l.length>n&&l.shift();const d=Math.max(...l.map(p=>Math.max(...p.map(({latency:h})=>h)))),f=i.map((p,h)=>{const g=l.map(w=>w[h].latency),m=1-g.reduce((w,v)=>w+v,0)/g.length/d,B=l.map(w=>w[h].success),F=B.reduce((w,v)=>w+v,0)/B.length;return F===0?[0,h]:[o*m+s*F,h]}).sort((p,h)=>h[0]-p[0]);t(f.map(([,p])=>i[p])),await a2(u),c()};c()}class Bb extends Bu{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}function Sz(){if(typeof WebSocket<"u")return WebSocket;if(typeof globalThis.WebSocket<"u")return globalThis.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const tA=Sz();function yb(e,{errorInstance:u=new Error("timed out"),timeout:t,signal:n}){return new Promise((r,i)=>{(async()=>{let a;try{const s=new AbortController;t>0&&(a=setTimeout(()=>{n?s.abort():i(u)},t)),r(await e({signal:s==null?void 0:s.signal}))}catch(s){s.name==="AbortError"&&i(u),i(s)}finally{clearTimeout(a)}})()})}let bp=0;async function Pz(e,{body:u,fetchOptions:t={},timeout:n=1e4}){var s;const{headers:r,method:i,signal:a}=t;try{const o=await yb(async({signal:c})=>await fetch(e,{...t,body:Array.isArray(u)?ge(u.map(d=>({jsonrpc:"2.0",id:d.id??bp++,...d}))):ge({jsonrpc:"2.0",id:u.id??bp++,...u}),headers:{...r,"Content-Type":"application/json"},method:i||"POST",signal:a||(n>0?c:void 0)}),{errorInstance:new yp({body:u,url:e}),timeout:n,signal:!0});let l;if((s=o.headers.get("Content-Type"))!=null&&s.startsWith("application/json")?l=await o.json():l=await o.text(),!o.ok)throw new K3({body:u,details:ge(l.error)||o.statusText,headers:o.headers,status:o.status,url:e});return l}catch(o){throw o instanceof K3||o instanceof yp?o:new K3({body:u,details:o.message,url:e})}}const E6=new Map;async function d6(e){let u=E6.get(e);if(u)return u;const{schedule:t}=PC({id:e,fn:async()=>{const i=new tA(e),a=new Map,s=new Map,o=({data:c})=>{const E=JSON.parse(c),d=E.method==="eth_subscription",f=d?E.params.subscription:E.id,p=d?s:a,h=p.get(f);h&&h({data:c}),d||p.delete(f)},l=()=>{E6.delete(e),i.removeEventListener("close",l),i.removeEventListener("message",o)};return i.addEventListener("close",l),i.addEventListener("message",o),i.readyState===tA.CONNECTING&&await new Promise((c,E)=>{i&&(i.onopen=c,i.onerror=E)}),u=Object.assign(i,{requests:a,subscriptions:s}),E6.set(e,u),[u]}}),[n,[r]]=await t();return r}function Tz(e,{body:u,onResponse:t}){if(e.readyState===e.CLOSED||e.readyState===e.CLOSING)throw new VR({body:u,url:e.url,details:"Socket is closed."});const n=bp++,r=({data:i})=>{var s;const a=JSON.parse(i);typeof a.id=="number"&&n!==a.id||(t==null||t(a),u.method==="eth_subscribe"&&typeof a.result=="string"&&e.subscriptions.set(a.result,r),u.method==="eth_unsubscribe"&&e.subscriptions.delete((s=u.params)==null?void 0:s[0]))};return e.requests.set(n,r),e.send(JSON.stringify({jsonrpc:"2.0",...u,id:n})),e}async function Oz(e,{body:u,timeout:t=1e4}){return yb(()=>new Promise(n=>Ys.webSocket(e,{body:u,onResponse:n})),{errorInstance:new yp({body:u,url:e.url}),timeout:t})}const Ys={http:Pz,webSocket:Tz,webSocketAsync:Oz};function Iz(e,u={}){const{batch:t,fetchOptions:n,key:r="http",name:i="HTTP JSON-RPC",retryDelay:a}=u;return({chain:s,retryCount:o,timeout:l})=>{const{batchSize:c=1e3,wait:E=0}=typeof t=="object"?t:{},d=u.retryCount??o,f=l??u.timeout??1e4,p=e||(s==null?void 0:s.rpcUrls.default.http[0]);if(!p)throw new Bb;return v1({key:r,name:i,async request({method:h,params:g}){const A={method:h,params:g},{schedule:m}=PC({id:`${e}`,wait:E,shouldSplitBatch(v){return v.length>c},fn:v=>Ys.http(p,{body:v,fetchOptions:n,timeout:f}),sort:(v,C)=>v.id-C.id}),B=async v=>t?m(v):[await Ys.http(p,{body:v,fetchOptions:n,timeout:f})],[{error:F,result:w}]=await B(A);if(F)throw new vC({body:A,error:F,url:p});return w},retryCount:d,retryDelay:a,timeout:f,type:"http"},{fetchOptions:n,url:e})}}function IC(e,u){var n,r,i;if(!(e instanceof Bu))return!1;const t=e.walk(a=>a instanceof Bp);return t instanceof Bp?!!(((n=t.data)==null?void 0:n.errorName)==="ResolverNotFound"||((r=t.data)==null?void 0:r.errorName)==="ResolverWildcardNotSupported"||(i=t.reason)!=null&&i.includes("Wildcard on non-extended resolvers is not supported")||u==="reverse"&&t.reason===ab[50]):!1}function Fb(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const u=`0x${e.slice(1,65)}`;return xn(u)?u:null}function l9(e){let u=new Uint8Array(32).fill(0);if(!e)return gl(u);const t=e.split(".");for(let n=t.length-1;n>=0;n-=1){const r=Fb(t[n]),i=r?Fi(r):pe(sr(t[n]),"bytes");u=pe(pr([u,i]),"bytes")}return gl(u)}function Nz(e){return`[${e.slice(2)}]`}function Rz(e){const u=new Uint8Array(32).fill(0);return e?Fb(e)||pe(sr(e)):gl(u)}function b1(e){const u=e.replace(/^\.|\.$/gm,"");if(u.length===0)return new Uint8Array(1);const t=new Uint8Array(sr(u).byteLength+2);let n=0;const r=u.split(".");for(let i=0;i255&&(a=sr(Nz(Rz(r[i])))),t[n]=a.length,t.set(a,n+1),n+=a.length+1}return t.byteLength!==n+1?t.slice(0,n+1):t}async function zz(e,{blockNumber:u,blockTag:t,coinType:n,name:r,universalResolverAddress:i}){let a=i;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=Mo({blockNumber:u,chain:e.chain,contract:"ensUniversalResolver"})}try{const s=Pi({abi:X7,functionName:"addr",...n!=null?{args:[l9(r),BigInt(n)]}:{args:[l9(r)]}}),o=await zu(e,bi)({address:a,abi:hb,functionName:"resolve",args:[Br(b1(r)),s],blockNumber:u,blockTag:t});if(o[0]==="0x")return null;const l=jo({abi:X7,args:n!=null?[l9(r),BigInt(n)]:void 0,functionName:"addr",data:o[0]});return l==="0x"||Pa(l)==="0x00"?null:l}catch(s){if(IC(s,"resolve"))return null;throw s}}class jz extends Bu{constructor({data:u}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(u)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class h3 extends Bu{constructor({reason:u}){super(`ENS NFT avatar URI is invalid. ${u}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class NC extends Bu{constructor({uri:u}){super(`Unable to resolve ENS avatar URI "${u}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class Mz extends Bu{constructor({namespace:u}){super(`ENS NFT avatar namespace "${u}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const Lz=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,Uz=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,$z=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Wz=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function qz(e){try{const u=await fetch(e,{method:"HEAD"});if(u.status===200){const t=u.headers.get("content-type");return t==null?void 0:t.startsWith("image/")}return!1}catch(u){return typeof u=="object"&&typeof u.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(t=>{const n=new Image;n.onload=()=>{t(!0)},n.onerror=()=>{t(!1)},n.src=e})}}function nA(e,u){return e?e.endsWith("/")?e.slice(0,-1):e:u}function Db({uri:e,gatewayUrls:u}){const t=$z.test(e);if(t)return{uri:e,isOnChain:!0,isEncoded:t};const n=nA(u==null?void 0:u.ipfs,"https://ipfs.io"),r=nA(u==null?void 0:u.arweave,"https://arweave.net"),i=e.match(Lz),{protocol:a,subpath:s,target:o,subtarget:l=""}=(i==null?void 0:i.groups)||{},c=a==="ipns:/"||s==="ipns/",E=a==="ipfs:/"||s==="ipfs/"||Uz.test(e);if(e.startsWith("http")&&!c&&!E){let f=e;return u!=null&&u.arweave&&(f=e.replace(/https:\/\/arweave.net/g,u==null?void 0:u.arweave)),{uri:f,isOnChain:!1,isEncoded:!1}}if((c||E)&&o)return{uri:`${n}/${c?"ipns":"ipfs"}/${o}${l}`,isOnChain:!1,isEncoded:!1};if(a==="ar:/"&&o)return{uri:`${r}/${o}${l||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(Wz,"");if(d.startsWith("r.json());return await RC({gatewayUrls:e,uri:vb(t)})}catch{throw new NC({uri:u})}}async function RC({gatewayUrls:e,uri:u}){const{uri:t,isOnChain:n}=Db({uri:u,gatewayUrls:e});if(n||await qz(t))return t;throw new NC({uri:u})}function Gz(e){let u=e;u.startsWith("did:nft:")&&(u=u.replace("did:nft:","").replace(/_/g,"/"));const[t,n,r]=u.split("/"),[i,a]=t.split(":"),[s,o]=n.split(":");if(!i||i.toLowerCase()!=="eip155")throw new h3({reason:"Only EIP-155 supported"});if(!a)throw new h3({reason:"Chain ID not found"});if(!o)throw new h3({reason:"Contract address not found"});if(!r)throw new h3({reason:"Token ID not found"});if(!s)throw new h3({reason:"ERC namespace not found"});return{chainID:parseInt(a),namespace:s.toLowerCase(),contractAddress:o,tokenID:r}}async function Qz(e,{nft:u}){if(u.namespace==="erc721")return bi(e,{address:u.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(u.tokenID)]});if(u.namespace==="erc1155")return bi(e,{address:u.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(u.tokenID)]});throw new Mz({namespace:u.namespace})}async function Kz(e,{gatewayUrls:u,record:t}){return/eip155:/i.test(t)?Vz(e,{gatewayUrls:u,record:t}):RC({uri:t,gatewayUrls:u})}async function Vz(e,{gatewayUrls:u,record:t}){const n=Gz(t),r=await Qz(e,{nft:n}),{uri:i,isOnChain:a,isEncoded:s}=Db({uri:r,gatewayUrls:u});if(a&&(i.includes("data:application/json;base64,")||i.startsWith("{"))){const l=s?atob(i.replace("data:application/json;base64,","")):i,c=JSON.parse(l);return RC({uri:vb(c),gatewayUrls:u})}let o=n.tokenID;return n.namespace==="erc1155"&&(o=o.replace("0x","").padStart(64,"0")),Hz({gatewayUrls:u,uri:i.replace(/(?:0x)?{id}/,o)})}async function bb(e,{blockNumber:u,blockTag:t,name:n,key:r,universalResolverAddress:i}){let a=i;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=Mo({blockNumber:u,chain:e.chain,contract:"ensUniversalResolver"})}try{const s=await zu(e,bi)({address:a,abi:hb,functionName:"resolve",args:[Br(b1(n)),Pi({abi:Z7,functionName:"text",args:[l9(n),r]})],blockNumber:u,blockTag:t});if(s[0]==="0x")return null;const o=jo({abi:Z7,functionName:"text",data:s[0]});return o===""?null:o}catch(s){if(IC(s,"resolve"))return null;throw s}}async function Jz(e,{blockNumber:u,blockTag:t,gatewayUrls:n,name:r,universalResolverAddress:i}){const a=await zu(e,bb)({blockNumber:u,blockTag:t,key:"avatar",name:r,universalResolverAddress:i});if(!a)return null;try{return await Kz(e,{record:a,gatewayUrls:n})}catch{return null}}async function Yz(e,{address:u,blockNumber:t,blockTag:n,universalResolverAddress:r}){let i=r;if(!i){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");i=Mo({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${u.toLowerCase().substring(2)}.addr.reverse`;try{return(await zu(e,bi)({address:i,abi:lz,functionName:"reverse",args:[Br(b1(a))],blockNumber:t,blockTag:n}))[0]}catch(s){if(IC(s,"reverse"))return null;throw s}}async function Zz(e,{blockNumber:u,blockTag:t,name:n,universalResolverAddress:r}){let i=r;if(!i){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");i=Mo({blockNumber:u,chain:e.chain,contract:"ensUniversalResolver"})}const[a]=await zu(e,bi)({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Br(b1(n))],blockNumber:u,blockTag:t});return a}async function Xz(e){const u=A1(e,{method:"eth_newBlockFilter"}),t=await e.request({method:"eth_newBlockFilter"});return{id:t,request:u(t),type:"block"}}async function wb(e,{address:u,args:t,event:n,events:r,fromBlock:i,strict:a,toBlock:s}={}){const o=r??(n?[n]:void 0),l=A1(e,{method:"eth_newFilter"});let c=[];o&&(c=[o.flatMap(d=>Rc({abi:[d],eventName:d.name,args:t}))],n&&(c=c[0]));const E=await e.request({method:"eth_newFilter",params:[{address:u,fromBlock:typeof i=="bigint"?Lu(i):i,toBlock:typeof s=="bigint"?Lu(s):s,...c.length?{topics:c}:{}}]});return{abi:o,args:t,eventName:n?n.name:void 0,fromBlock:i,id:E,request:l(E),strict:a,toBlock:s,type:"event"}}async function xb(e){const u=A1(e,{method:"eth_newPendingTransactionFilter"}),t=await e.request({method:"eth_newPendingTransactionFilter"});return{id:t,request:u(t),type:"transaction"}}async function uj(e,{address:u,blockNumber:t,blockTag:n="latest"}){const r=t?Lu(t):void 0,i=await e.request({method:"eth_getBalance",params:[u,r||n]});return BigInt(i)}async function ej(e,{blockHash:u,blockNumber:t,blockTag:n="latest"}={}){const r=t!==void 0?Lu(t):void 0;let i;return u?i=await e.request({method:"eth_getBlockTransactionCountByHash",params:[u]}):i=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[r||n]}),se(i)}async function tj(e,{address:u,blockNumber:t,blockTag:n="latest"}){const r=t!==void 0?Lu(t):void 0,i=await e.request({method:"eth_getCode",params:[u,r||n]});if(i!=="0x")return i}function nj(e){var u;return{baseFeePerGas:e.baseFeePerGas.map(t=>BigInt(t)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:(u=e.reward)==null?void 0:u.map(t=>t.map(n=>BigInt(n)))}}async function rj(e,{blockCount:u,blockNumber:t,blockTag:n="latest",rewardPercentiles:r}){const i=t?Lu(t):void 0,a=await e.request({method:"eth_feeHistory",params:[Lu(u),i||n,r]});return nj(a)}async function ij(e,{filter:u}){const t=u.strict??!1;return(await u.request({method:"eth_getFilterLogs",params:[u.id]})).map(r=>{var i;try{const{eventName:a,args:s}="abi"in u&&u.abi?Mc({abi:u.abi,data:r.data,topics:r.topics,strict:t}):{eventName:void 0,args:void 0};return Jt(r,{args:s,eventName:a})}catch(a){let s,o;if(a instanceof $a||a instanceof No){if("strict"in u&&u.strict)return;s=a.abiItem.name,o=(i=a.abiItem.inputs)==null?void 0:i.some(l=>!("name"in l&&l.name))}return Jt(r,{args:o?[]:{},eventName:s})}}).filter(Boolean)}const aj=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,sj=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function oj({domain:e,message:u,primaryType:t,types:n}){const r=typeof e>"u"?{}:e,i={EIP712Domain:Ob({domain:r}),...n};Tb({domain:r,message:u,primaryType:t,types:i});const a=["0x1901"];return r&&a.push(lj({domain:r,types:i})),t!=="EIP712Domain"&&a.push(kb({data:u,primaryType:t,types:i})),pe(pr(a))}function lj({domain:e,types:u}){return kb({data:e,primaryType:"EIP712Domain",types:u})}function kb({data:e,primaryType:u,types:t}){const n=_b({data:e,primaryType:u,types:t});return pe(n)}function _b({data:e,primaryType:u,types:t}){const n=[{type:"bytes32"}],r=[cj({primaryType:u,types:t})];for(const i of t[u]){const[a,s]=Pb({types:t,name:i.name,type:i.type,value:e[i.name]});n.push(a),r.push(s)}return Ic(n,r)}function cj({primaryType:e,types:u}){const t=Br(Ej({primaryType:e,types:u}));return pe(t)}function Ej({primaryType:e,types:u}){let t="";const n=Sb({primaryType:e,types:u});n.delete(e);const r=[e,...Array.from(n).sort()];for(const i of r)t+=`${i}(${u[i].map(({name:a,type:s})=>`${s} ${a}`).join(",")})`;return t}function Sb({primaryType:e,types:u},t=new Set){const n=e.match(/^\w*/u),r=n==null?void 0:n[0];if(t.has(r)||u[r]===void 0)return t;t.add(r);for(const i of u[r])Sb({primaryType:i.type,types:u},t);return t}function Pb({types:e,name:u,type:t,value:n}){if(e[t]!==void 0)return[{type:"bytes32"},pe(_b({data:n,primaryType:t,types:e}))];if(t==="bytes")return n=`0x${(n.length%2?"0":"")+n.slice(2)}`,[{type:"bytes32"},pe(n)];if(t==="string")return[{type:"bytes32"},pe(Br(n))];if(t.lastIndexOf("]")===t.length-1){const r=t.slice(0,t.lastIndexOf("[")),i=n.map(a=>Pb({name:u,type:r,types:e,value:a}));return[{type:"bytes32"},pe(Ic(i.map(([a])=>a),i.map(([,a])=>a)))]}return[{type:t},n]}function Tb({domain:e,message:u,primaryType:t,types:n}){const r=n,i=(a,s)=>{for(const o of a){const{name:l,type:c}=o,E=c,d=s[l],f=E.match(sj);if(f&&(typeof d=="number"||typeof d=="bigint")){const[g,A,m]=f;Lu(d,{signed:A==="int",size:parseInt(m)/8})}if(E==="address"&&typeof d=="string"&&!lo(d))throw new Bl({address:d});const p=E.match(aj);if(p){const[g,A]=p;if(A&&I0(d)!==parseInt(A))throw new GN({expectedSize:parseInt(A),givenSize:I0(d)})}const h=r[E];h&&i(h,d)}};if(r.EIP712Domain&&e&&i(r.EIP712Domain,e),t!=="EIP712Domain"){const a=r[t];i(a,u)}}function Ob({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}const f6="/docs/contract/encodeDeployData";function Ib({abi:e,args:u,bytecode:t}){if(!u||u.length===0)return t;const n=e.find(i=>"type"in i&&i.type==="constructor");if(!n)throw new MN({docsPath:f6});if(!("inputs"in n))throw new H7({docsPath:f6});if(!n.inputs||n.inputs.length===0)throw new H7({docsPath:f6});const r=Ic(n.inputs,u);return EC([t,r])}const dj=`Ethereum Signed Message: +`),{docsPath:u,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}class XR extends Bu{constructor(u,{account:t,docsPath:n,chain:r,data:i,gas:a,gasPrice:s,maxFeePerGas:o,maxPriorityFeePerGas:l,nonce:c,to:E,value:d}){var p;const f=zc({from:t==null?void 0:t.address,to:E,value:typeof d<"u"&&`${yC(d)} ${((p=r==null?void 0:r.nativeCurrency)==null?void 0:p.symbol)||"ETH"}`,data:i,gas:a,gasPrice:typeof s<"u"&&`${Re(s)} gwei`,maxFeePerGas:typeof o<"u"&&`${Re(o)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Re(l)} gwei`,nonce:c});super(u.shortMessage,{cause:u,docsPath:n,metaMessages:[...u.metaMessages?[...u.metaMessages," "]:[],"Estimate Gas Arguments:",f].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=u}}function bC(e,u){const t=(e.details||"").toLowerCase(),n=e.walk(r=>r.code===Ns.code);return n instanceof Bu?new Ns({cause:e,message:n.details}):Ns.nodeMessage.test(t)?new Ns({cause:e,message:e.details}):e2.nodeMessage.test(t)?new e2({cause:e,maxFeePerGas:u==null?void 0:u.maxFeePerGas}):cp.nodeMessage.test(t)?new cp({cause:e,maxFeePerGas:u==null?void 0:u.maxFeePerGas}):Ep.nodeMessage.test(t)?new Ep({cause:e,nonce:u==null?void 0:u.nonce}):dp.nodeMessage.test(t)?new dp({cause:e,nonce:u==null?void 0:u.nonce}):fp.nodeMessage.test(t)?new fp({cause:e,nonce:u==null?void 0:u.nonce}):pp.nodeMessage.test(t)?new pp({cause:e}):hp.nodeMessage.test(t)?new hp({cause:e,gas:u==null?void 0:u.gas}):Cp.nodeMessage.test(t)?new Cp({cause:e,gas:u==null?void 0:u.gas}):mp.nodeMessage.test(t)?new mp({cause:e}):t2.nodeMessage.test(t)?new t2({cause:e,maxFeePerGas:u==null?void 0:u.maxFeePerGas,maxPriorityFeePerGas:u==null?void 0:u.maxPriorityFeePerGas}):new f1({cause:e})}function uz(e,{docsPath:u,...t}){const n=(()=>{const r=bC(e,t);return r instanceof f1?e:r})();return new XR(n,{docsPath:u,...t})}function wC(e,{format:u}){if(!u)return{};const t={};function n(i){const a=Object.keys(i);for(const s of a)s in e&&(t[s]=e[s]),i[s]&&typeof i[s]=="object"&&!Array.isArray(i[s])&&n(i[s])}const r=u(e||{});return n(r),t}function jc(e){const{account:u,gasPrice:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:i}=e,a=u?kt(u):void 0;if(a&&!lo(a.address))throw new Bl({address:a.address});if(i&&!lo(i))throw new Bl({address:i});if(typeof t<"u"&&(typeof n<"u"||typeof r<"u"))throw new qR;if(n&&n>2n**256n-1n)throw new e2({maxFeePerGas:n});if(r&&n&&r>n)throw new t2({maxFeePerGas:n,maxPriorityFeePerGas:r})}class ez extends Bu{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class xC extends Bu{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class tz extends Bu{constructor({maxPriorityFeePerGas:u}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Re(u)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class nz extends Bu{constructor({blockHash:u,blockNumber:t}){let n="Block";u&&(n=`Block at hash "${u}"`),t&&(n=`Block at number "${t}"`),super(`${n} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}async function vi(e,{blockHash:u,blockNumber:t,blockTag:n,includeTransactions:r}={}){var c,E,d;const i=n??"latest",a=r??!1,s=t!==void 0?Lu(t):void 0;let o=null;if(u?o=await e.request({method:"eth_getBlockByHash",params:[u,a]}):o=await e.request({method:"eth_getBlockByNumber",params:[s||i,a]}),!o)throw new nz({blockHash:u,blockNumber:t});return(((d=(E=(c=e.chain)==null?void 0:c.formatters)==null?void 0:E.block)==null?void 0:d.format)||cC)(o)}async function kC(e){const u=await e.request({method:"eth_gasPrice"});return BigInt(u)}async function rz(e,u){return Eb(e,u)}async function Eb(e,u){var i,a,s;const{block:t,chain:n=e.chain,request:r}=u||{};if(typeof((i=n==null?void 0:n.fees)==null?void 0:i.defaultPriorityFee)=="function"){const o=t||await zu(e,vi)({});return n.fees.defaultPriorityFee({block:o,client:e,request:r})}else if(typeof((a=n==null?void 0:n.fees)==null?void 0:a.defaultPriorityFee)<"u")return(s=n==null?void 0:n.fees)==null?void 0:s.defaultPriorityFee;try{const o=await e.request({method:"eth_maxPriorityFeePerGas"});return Zn(o)}catch{const[o,l]=await Promise.all([t?Promise.resolve(t):zu(e,vi)({}),zu(e,kC)({})]);if(typeof o.baseFeePerGas!="bigint")throw new xC;const c=l-o.baseFeePerGas;return c<0n?0n:c}}async function iz(e,u){return Fp(e,u)}async function Fp(e,u){var d,f;const{block:t,chain:n=e.chain,request:r,type:i="eip1559"}=u||{},a=await(async()=>{var p,h;return typeof((p=n==null?void 0:n.fees)==null?void 0:p.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:t,client:e,request:r}):((h=n==null?void 0:n.fees)==null?void 0:h.baseFeeMultiplier)??1.2})();if(a<1)throw new ez;const o=10**(((d=a.toString().split(".")[1])==null?void 0:d.length)??0),l=p=>p*BigInt(Math.ceil(a*o))/BigInt(o),c=t||await zu(e,vi)({});if(typeof((f=n==null?void 0:n.fees)==null?void 0:f.estimateFeesPerGas)=="function")return n.fees.estimateFeesPerGas({block:t,client:e,multiply:l,request:r,type:i});if(i==="eip1559"){if(typeof c.baseFeePerGas!="bigint")throw new xC;const p=r!=null&&r.maxPriorityFeePerGas?r.maxPriorityFeePerGas:await Eb(e,{block:c,chain:n,request:r}),h=l(c.baseFeePerGas);return{maxFeePerGas:(r==null?void 0:r.maxFeePerGas)??h+p,maxPriorityFeePerGas:p}}return{gasPrice:(r==null?void 0:r.gasPrice)??l(await zu(e,kC)({}))}}async function db(e,{address:u,blockTag:t="latest",blockNumber:n}){const r=await e.request({method:"eth_getTransactionCount",params:[u,n?Lu(n):t]});return se(r)}function az(e){if(e.type)return e.type;if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new HR({transaction:e})}async function B1(e,u){const{account:t=e.account,chain:n,gas:r,nonce:i,type:a}=u;if(!t)throw new zo;const s=kt(t),o=await zu(e,vi)({blockTag:"latest"}),l={...u,from:s.address};if(typeof i>"u"&&(l.nonce=await zu(e,db)({address:s.address,blockTag:"pending"})),typeof a>"u")try{l.type=az(l)}catch{l.type=typeof o.baseFeePerGas=="bigint"?"eip1559":"legacy"}if(l.type==="eip1559"){const{maxFeePerGas:c,maxPriorityFeePerGas:E}=await Fp(e,{block:o,chain:n,request:l});if(typeof u.maxPriorityFeePerGas>"u"&&u.maxFeePerGas&&u.maxFeePerGas"u"&&(l.gas=await zu(e,_C)({...l,account:{address:s.address,type:"json-rpc"}})),jc(l),l}async function _C(e,u){var r,i,a;const t=u.account??e.account;if(!t)throw new zo({docsPath:"/docs/actions/public/estimateGas"});const n=kt(t);try{const{accessList:s,blockNumber:o,blockTag:l,data:c,gas:E,gasPrice:d,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:h,to:g,value:A,...m}=n.type==="local"?await B1(e,u):u,F=(o?Lu(o):void 0)||l;jc(u);const w=(a=(i=(r=e.chain)==null?void 0:r.formatters)==null?void 0:i.transactionRequest)==null?void 0:a.format,C=(w||d1)({...wC(m,{format:w}),from:n.address,accessList:s,data:c,gas:E,gasPrice:d,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:h,to:g,value:A}),k=await e.request({method:"eth_estimateGas",params:F?[C,F]:[C]});return BigInt(k)}catch(s){throw uz(s,{...u,account:n,chain:e.chain})}}async function sz(e,{abi:u,address:t,args:n,functionName:r,...i}){const a=Pi({abi:u,args:n,functionName:r});try{return await zu(e,_C)({data:a,to:t,...i})}catch(s){const o=i.account?kt(i.account):void 0;throw Il(s,{abi:u,address:t,args:n,docsPath:"/docs/contract/estimateContractGas",functionName:r,sender:o==null?void 0:o.address})}}const Y7="/docs/contract/decodeEventLog";function Mc({abi:e,data:u,strict:t,topics:n}){const r=t??!0,[i,...a]=n;if(!i)throw new WN({docsPath:Y7});const s=e.find(p=>p.type==="event"&&i===CC(Za(p)));if(!(s&&"name"in s)||s.type!=="event")throw new qN(i,{docsPath:Y7});const{name:o,inputs:l}=s,c=l==null?void 0:l.some(p=>!("name"in p&&p.name));let E=c?[]:{};const d=l.filter(p=>"indexed"in p&&p.indexed);for(let p=0;p!("indexed"in p&&p.indexed));if(f.length>0){if(u&&u!=="0x")try{const p=g1(f,u);if(p)if(c)E=[...E,...p];else for(let h=0;h0?E:void 0}}function oz({param:e,value:u}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?u:(g1([e],u)||[])[0]}async function SC(e,{address:u,blockHash:t,fromBlock:n,toBlock:r,event:i,events:a,args:s,strict:o}={}){const l=o??!1,c=a??(i?[i]:void 0);let E=[];c&&(E=[c.flatMap(f=>Rc({abi:[f],eventName:f.name,args:s}))],i&&(E=E[0]));let d;return t?d=await e.request({method:"eth_getLogs",params:[{address:u,topics:E,blockHash:t}]}):d=await e.request({method:"eth_getLogs",params:[{address:u,topics:E,fromBlock:typeof n=="bigint"?Lu(n):n,toBlock:typeof r=="bigint"?Lu(r):r}]}),d.map(f=>{var p;try{const{eventName:h,args:g}=c?Mc({abi:c,data:f.data,topics:f.topics,strict:l}):{eventName:void 0,args:void 0};return Jt(f,{args:g,eventName:h})}catch(h){let g,A;if(h instanceof $a||h instanceof No){if(l)return;g=h.abiItem.name,A=(p=h.abiItem.inputs)==null?void 0:p.some(m=>!("name"in m&&m.name))}return Jt(f,{args:A?[]:{},eventName:g})}}).filter(Boolean)}async function fb(e,{abi:u,address:t,args:n,blockHash:r,eventName:i,fromBlock:a,toBlock:s,strict:o}){const l=i?Nc({abi:u,name:i}):void 0,c=l?void 0:u.filter(E=>E.type==="event");return zu(e,SC)({address:t,args:n,blockHash:r,event:l,events:c,fromBlock:a,toBlock:s,strict:o})}const o6="/docs/contract/decodeFunctionResult";function jo({abi:e,args:u,functionName:t,data:n}){let r=e[0];if(t&&(r=Nc({abi:e,args:u,name:t}),!r))throw new n2(t,{docsPath:o6});if(r.type!=="function")throw new n2(void 0,{docsPath:o6});if(!r.outputs)throw new HN(r.name,{docsPath:o6});const i=g1(r.outputs,n);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}const Dp=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],pb=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],hb=[...pb,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],lz=[...pb,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],Z7=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],X7=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],cz=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],Ez="0x82ad56cb";function Mo({blockNumber:e,chain:u,contract:t}){var r;const n=(r=u==null?void 0:u.contracts)==null?void 0:r[t];if(!n)throw new lp({chain:u,contract:{name:t}});if(e&&n.blockCreated&&n.blockCreated>e)throw new lp({blockNumber:e,chain:u,contract:{name:t,blockCreated:n.blockCreated}});return n.address}function dz(e,{docsPath:u,...t}){const n=(()=>{const r=bC(e,t);return r instanceof f1?e:r})();return new cb(n,{docsPath:u,...t})}const l6=new Map;function PC({fn:e,id:u,shouldSplitBatch:t,wait:n=0,sort:r}){const i=async()=>{const c=o();a();const E=c.map(({args:d})=>d);E.length!==0&&e(E).then(d=>{r&&Array.isArray(d)&&d.sort(r),c.forEach(({pendingPromise:f},p)=>{var h;return(h=f.resolve)==null?void 0:h.call(f,[d[p],d])})}).catch(d=>{c.forEach(({pendingPromise:f})=>{var p;return(p=f.reject)==null?void 0:p.call(f,d)})})},a=()=>l6.delete(u),s=()=>o().map(({args:c})=>c),o=()=>l6.get(u)||[],l=c=>l6.set(u,[...o(),c]);return{flush:a,async schedule(c){const E={},d=new Promise((h,g)=>{E.resolve=h,E.reject=g});return(t==null?void 0:t([...s(),c]))&&i(),o().length>0?(l({args:c,pendingPromise:E}),d):(l({args:c,pendingPromise:E}),setTimeout(i,n),d)}}}async function y1(e,u){var A,m,B,F;const{account:t=e.account,batch:n=!!((A=e.batch)!=null&&A.multicall),blockNumber:r,blockTag:i="latest",accessList:a,data:s,gas:o,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:E,nonce:d,to:f,value:p,...h}=u,g=t?kt(t):void 0;try{jc(u);const v=(r?Lu(r):void 0)||i,C=(F=(B=(m=e.chain)==null?void 0:m.formatters)==null?void 0:B.transactionRequest)==null?void 0:F.format,j=(C||d1)({...wC(h,{format:C}),from:g==null?void 0:g.address,accessList:a,data:s,gas:o,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:E,nonce:d,to:f,value:p});if(n&&fz({request:j}))try{return await pz(e,{...j,blockNumber:r,blockTag:i})}catch(uu){if(!(uu instanceof Qv)&&!(uu instanceof lp))throw uu}const N=await e.request({method:"eth_call",params:v?[j,v]:[j]});return N==="0x"?{data:void 0}:{data:N}}catch(w){const v=hz(w),{offchainLookup:C,offchainLookupSignature:k}=await Uu(()=>import("./ccip-67c6f46d.js"),[]);if((v==null?void 0:v.slice(0,10))===k&&f)return{data:await C(e,{data:v,to:f})};throw dz(w,{...u,account:g,chain:e.chain})}}function fz({request:e}){const{data:u,to:t,...n}=e;return!(!u||u.startsWith(Ez)||!t||Object.values(n).filter(r=>typeof r<"u").length>0)}async function pz(e,u){var h;const{batchSize:t=1024,wait:n=0}=typeof((h=e.batch)==null?void 0:h.multicall)=="object"?e.batch.multicall:{},{blockNumber:r,blockTag:i="latest",data:a,multicallAddress:s,to:o}=u;let l=s;if(!l){if(!e.chain)throw new Qv;l=Mo({blockNumber:r,chain:e.chain,contract:"multicall3"})}const E=(r?Lu(r):void 0)||i,{schedule:d}=PC({id:`${e.uid}.${E}`,wait:n,shouldSplitBatch(g){return g.reduce((m,{data:B})=>m+(B.length-2),0)>t*2},fn:async g=>{const A=g.map(F=>({allowFailure:!0,callData:F.data,target:F.to})),m=Pi({abi:Dp,args:[A],functionName:"aggregate3"}),B=await e.request({method:"eth_call",params:[{data:m,to:l},E]});return jo({abi:Dp,args:[A],functionName:"aggregate3",data:B||"0x"})}}),[{returnData:f,success:p}]=await d({data:a,to:o});if(!p)throw new DC({data:f});return f==="0x"?{data:void 0}:{data:f}}function hz(e){if(!(e instanceof Bu))return;const u=e.walk();return typeof u.data=="object"?u.data.data:u.data}async function bi(e,{abi:u,address:t,args:n,functionName:r,...i}){const a=Pi({abi:u,args:n,functionName:r});try{const{data:s}=await zu(e,y1)({data:a,to:t,...i});return jo({abi:u,args:n,functionName:r,data:s||"0x"})}catch(s){throw Il(s,{abi:u,address:t,args:n,docsPath:"/docs/contract/readContract",functionName:r})}}async function Cz(e,{abi:u,address:t,args:n,dataSuffix:r,functionName:i,...a}){const s=a.account?kt(a.account):void 0,o=Pi({abi:u,args:n,functionName:i});try{const{data:l}=await zu(e,y1)({batch:!1,data:`${o}${r?r.replace("0x",""):""}`,to:t,...a});return{result:jo({abi:u,args:n,functionName:i,data:l||"0x"}),request:{abi:u,address:t,args:n,dataSuffix:r,functionName:i,...a}}}catch(l){throw Il(l,{abi:u,address:t,args:n,docsPath:"/docs/contract/simulateContract",functionName:i,sender:s==null?void 0:s.address})}}const c6=new Map,uA=new Map;let mz=0;function Lo(e,u,t){const n=++mz,r=()=>c6.get(e)||[],i=()=>{const c=r();c6.set(e,c.filter(E=>E.id!==n))},a=()=>{const c=uA.get(e);r().length===1&&c&&c(),i()},s=r();if(c6.set(e,[...s,{id:n,fns:u}]),s&&s.length>0)return a;const o={};for(const c in u)o[c]=(...E)=>{const d=r();d.length!==0&&d.forEach(f=>{var p,h;return(h=(p=f.fns)[c])==null?void 0:h.call(p,...E)})};const l=t(o);return typeof l=="function"&&uA.set(e,l),a}async function a2(e){return new Promise(u=>setTimeout(u,e))}function Lc(e,{emitOnBegin:u,initialWaitTime:t,interval:n}){let r=!0;const i=()=>r=!1;return(async()=>{let s;u&&(s=await e({unpoll:i}));const o=await(t==null?void 0:t(s))??n;await a2(o);const l=async()=>{r&&(await e({unpoll:i}),await a2(n),l())};l()})(),i}const Az=new Map,gz=new Map;function Bz(e){const u=(r,i)=>({clear:()=>i.delete(r),get:()=>i.get(r),set:a=>i.set(r,a)}),t=u(e,Az),n=u(e,gz);return{clear:()=>{t.clear(),n.clear()},promise:t,response:n}}async function yz(e,{cacheKey:u,cacheTime:t=1/0}){const n=Bz(u),r=n.response.get();if(r&&t>0&&new Date().getTime()-r.created.getTime()`blockNumber.${e}`;async function Uc(e,{cacheTime:u=e.cacheTime,maxAge:t}={}){const n=await yz(()=>e.request({method:"eth_blockNumber"}),{cacheKey:Fz(e.uid),cacheTime:t??u});return BigInt(n)}async function F1(e,{filter:u}){const t="strict"in u&&u.strict;return(await u.request({method:"eth_getFilterChanges",params:[u.id]})).map(r=>{var i;if(typeof r=="string")return r;try{const{eventName:a,args:s}="abi"in u&&u.abi?Mc({abi:u.abi,data:r.data,topics:r.topics,strict:t}):{eventName:void 0,args:void 0};return Jt(r,{args:s,eventName:a})}catch(a){let s,o;if(a instanceof $a||a instanceof No){if("strict"in u&&u.strict)return;s=a.abiItem.name,o=(i=a.abiItem.inputs)==null?void 0:i.some(l=>!("name"in l&&l.name))}return Jt(r,{args:o?[]:{},eventName:s})}}).filter(Boolean)}async function D1(e,{filter:u}){return u.request({method:"eth_uninstallFilter",params:[u.id]})}function Dz(e,{abi:u,address:t,args:n,batch:r=!0,eventName:i,onError:a,onLogs:s,poll:o,pollingInterval:l=e.pollingInterval,strict:c}){return(typeof o<"u"?o:e.transport.type!=="webSocket")?(()=>{const p=ge(["watchContractEvent",t,n,r,e.uid,i,l]),h=c??!1;return Lo(p,{onLogs:s,onError:a},g=>{let A,m,B=!1;const F=Lc(async()=>{var w;if(!B){try{m=await zu(e,ib)({abi:u,address:t,args:n,eventName:i,strict:h})}catch{}B=!0;return}try{let v;if(m)v=await zu(e,F1)({filter:m});else{const C=await zu(e,Uc)({});A&&A!==C?v=await zu(e,fb)({abi:u,address:t,args:n,eventName:i,fromBlock:A+1n,toBlock:C,strict:h}):v=[],A=C}if(v.length===0)return;r?g.onLogs(v):v.forEach(C=>g.onLogs([C]))}catch(v){m&&v instanceof Wa&&(B=!1),(w=g.onError)==null||w.call(g,v)}},{emitOnBegin:!0,interval:l});return async()=>{m&&await zu(e,D1)({filter:m}),F()}})})():(()=>{let p=!0,h=()=>p=!1;return(async()=>{try{const g=i?Rc({abi:u,eventName:i,args:n}):[],{unsubscribe:A}=await e.transport.subscribe({params:["logs",{address:t,topics:g}],onData(m){var F;if(!p)return;const B=m.result;try{const{eventName:w,args:v}=Mc({abi:u,data:B.data,topics:B.topics,strict:c}),C=Jt(B,{args:v,eventName:w});s([C])}catch(w){let v,C;if(w instanceof $a||w instanceof No){if(c)return;v=w.abiItem.name,C=(F=w.abiItem.inputs)==null?void 0:F.some(j=>!("name"in j&&j.name))}const k=Jt(B,{args:C?[]:{},eventName:v});s([k])}},onError(m){a==null||a(m)}});h=A,p||h()}catch(g){a==null||a(g)}})(),h})()}function Cb({chain:e,currentChainId:u}){if(!e)throw new SN;if(u!==e.id)throw new _N({chain:e,currentChainId:u})}function vz(e,{docsPath:u,...t}){const n=(()=>{const r=bC(e,t);return r instanceof f1?e:r})();return new GR(n,{docsPath:u,...t})}async function Nl(e){const u=await e.request({method:"eth_chainId"});return se(u)}async function TC(e,{serializedTransaction:u}){return e.request({method:"eth_sendRawTransaction",params:[u]})}async function OC(e,u){var h,g,A,m;const{account:t=e.account,chain:n=e.chain,accessList:r,data:i,gas:a,gasPrice:s,maxFeePerGas:o,maxPriorityFeePerGas:l,nonce:c,to:E,value:d,...f}=u;if(!t)throw new zo({docsPath:"/docs/actions/wallet/sendTransaction"});const p=kt(t);try{jc(u);let B;if(n!==null&&(B=await zu(e,Nl)({}),Cb({currentChainId:B,chain:n})),p.type==="local"){const C=await zu(e,B1)({account:p,accessList:r,chain:n,data:i,gas:a,gasPrice:s,maxFeePerGas:o,maxPriorityFeePerGas:l,nonce:c,to:E,value:d,...f});B||(B=await zu(e,Nl)({}));const k=(h=n==null?void 0:n.serializers)==null?void 0:h.transaction,j=await p.signTransaction({...C,chainId:B},{serializer:k});return await zu(e,TC)({serializedTransaction:j})}const F=(m=(A=(g=e.chain)==null?void 0:g.formatters)==null?void 0:A.transactionRequest)==null?void 0:m.format,v=(F||d1)({...wC(f,{format:F}),accessList:r,data:i,from:p.address,gas:a,gasPrice:s,maxFeePerGas:o,maxPriorityFeePerGas:l,nonce:c,to:E,value:d});return await e.request({method:"eth_sendTransaction",params:[v]})}catch(B){throw vz(B,{...u,account:p,chain:u.chain||void 0})}}async function bz(e,{abi:u,address:t,args:n,dataSuffix:r,functionName:i,...a}){const s=Pi({abi:u,args:n,functionName:i});return await zu(e,OC)({data:`${s}${r?r.replace("0x",""):""}`,to:t,...a})}async function wz(e,{chain:u}){const{id:t,name:n,nativeCurrency:r,rpcUrls:i,blockExplorers:a}=u;await e.request({method:"wallet_addEthereumChain",params:[{chainId:Lu(t),chainName:n,nativeCurrency:r,rpcUrls:i.default.http,blockExplorerUrls:a?Object.values(a).map(({url:s})=>s):void 0}]})}const vp=256;let TE=vp,OE;function xz(e=11){if(!OE||TE+e>vp*2){OE="",TE=0;for(let u=0;u{const A=g(h);for(const B in f)delete A[B];const m={...h,...A};return Object.assign(m,{extend:p(m)})}}return Object.assign(f,{extend:p(f)})}function Ab(e,{delay:u=100,retryCount:t=2,shouldRetry:n=()=>!0}={}){return new Promise((r,i)=>{const a=async({count:s=0}={})=>{const o=async({error:l})=>{const c=typeof u=="function"?u({count:s,error:l}):u;c&&await a2(c),a({count:s+1})};try{const l=await e();r(l)}catch(l){if(s"code"in e?e.code!==-1&&e.code!==-32004&&e.code!==-32005&&e.code!==-32042&&e.code!==-32603:e instanceof K3&&e.status?e.status!==403&&e.status!==408&&e.status!==413&&e.status!==429&&e.status!==500&&e.status!==502&&e.status!==503&&e.status!==504:!1;function kz(e,{retryDelay:u=150,retryCount:t=3}={}){return async n=>Ab(async()=>{try{return await e(n)}catch(r){const i=r;switch(i.code){case yl.code:throw new yl(i);case Fl.code:throw new Fl(i);case Dl.code:throw new Dl(i);case vl.code:throw new vl(i);case Eo.code:throw new Eo(i);case Wa.code:throw new Wa(i);case bl.code:throw new bl(i);case Di.code:throw new Di(i);case wl.code:throw new wl(i);case xl.code:throw new xl(i);case kl.code:throw new kl(i);case _l.code:throw new _l(i);case O0.code:throw new O0(i);case Sl.code:throw new Sl(i);case Pl.code:throw new Pl(i);case Tl.code:throw new Tl(i);case Ol.code:throw new Ol(i);case kn.code:throw new kn(i);case 5e3:throw new O0(i);default:throw r instanceof Bu?r:new YR(i)}}},{delay:({count:r,error:i})=>{var a;if(i&&i instanceof K3){const s=(a=i==null?void 0:i.headers)==null?void 0:a.get("Retry-After");if(s!=null&&s.match(/\d/))return parseInt(s)*1e3}return~~(1<!gb(r)})}function v1({key:e,name:u,request:t,retryCount:n=3,retryDelay:r=150,timeout:i,type:a},s){return{config:{key:e,name:u,request:t,retryCount:n,retryDelay:r,timeout:i,type:a},request:kz(t,{retryCount:n,retryDelay:r}),value:s}}function $c(e,u={}){const{key:t="custom",name:n="Custom Provider",retryDelay:r}=u;return({retryCount:i})=>v1({key:t,name:n,request:e.request.bind(e),retryCount:u.retryCount??i,retryDelay:r,type:"custom"})}function eA(e,u={}){const{key:t="fallback",name:n="Fallback",rank:r=!1,retryCount:i,retryDelay:a}=u;return({chain:s,pollingInterval:o=4e3,timeout:l})=>{let c=e,E=()=>{};const d=v1({key:t,name:n,async request({method:f,params:p}){const h=async(g=0)=>{const A=c[g]({chain:s,retryCount:0,timeout:l});try{const m=await A.request({method:f,params:p});return E({method:f,params:p,response:m,transport:A,status:"success"}),m}catch(m){if(E({error:m,method:f,params:p,transport:A,status:"error"}),gb(m)||g===c.length-1)throw m;return h(g+1)}};return h()},retryCount:i,retryDelay:a,type:"fallback"},{onResponse:f=>E=f,transports:c.map(f=>f({chain:s,retryCount:0}))});if(r){const f=typeof r=="object"?r:{};_z({chain:s,interval:f.interval??o,onTransports:p=>c=p,sampleCount:f.sampleCount,timeout:f.timeout,transports:c,weights:f.weights})}return d}}function _z({chain:e,interval:u=4e3,onTransports:t,sampleCount:n=10,timeout:r=1e3,transports:i,weights:a={}}){const{stability:s=.7,latency:o=.3}=a,l=[],c=async()=>{const E=await Promise.all(i.map(async p=>{const h=p({chain:e,retryCount:0,timeout:r}),g=Date.now();let A,m;try{await h.request({method:"net_listening"}),m=1}catch{m=0}finally{A=Date.now()}return{latency:A-g,success:m}}));l.push(E),l.length>n&&l.shift();const d=Math.max(...l.map(p=>Math.max(...p.map(({latency:h})=>h)))),f=i.map((p,h)=>{const g=l.map(w=>w[h].latency),m=1-g.reduce((w,v)=>w+v,0)/g.length/d,B=l.map(w=>w[h].success),F=B.reduce((w,v)=>w+v,0)/B.length;return F===0?[0,h]:[o*m+s*F,h]}).sort((p,h)=>h[0]-p[0]);t(f.map(([,p])=>i[p])),await a2(u),c()};c()}class Bb extends Bu{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}function Sz(){if(typeof WebSocket<"u")return WebSocket;if(typeof globalThis.WebSocket<"u")return globalThis.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const tA=Sz();function yb(e,{errorInstance:u=new Error("timed out"),timeout:t,signal:n}){return new Promise((r,i)=>{(async()=>{let a;try{const s=new AbortController;t>0&&(a=setTimeout(()=>{n?s.abort():i(u)},t)),r(await e({signal:s==null?void 0:s.signal}))}catch(s){s.name==="AbortError"&&i(u),i(s)}finally{clearTimeout(a)}})()})}let bp=0;async function Pz(e,{body:u,fetchOptions:t={},timeout:n=1e4}){var s;const{headers:r,method:i,signal:a}=t;try{const o=await yb(async({signal:c})=>await fetch(e,{...t,body:Array.isArray(u)?ge(u.map(d=>({jsonrpc:"2.0",id:d.id??bp++,...d}))):ge({jsonrpc:"2.0",id:u.id??bp++,...u}),headers:{...r,"Content-Type":"application/json"},method:i||"POST",signal:a||(n>0?c:void 0)}),{errorInstance:new yp({body:u,url:e}),timeout:n,signal:!0});let l;if((s=o.headers.get("Content-Type"))!=null&&s.startsWith("application/json")?l=await o.json():l=await o.text(),!o.ok)throw new K3({body:u,details:ge(l.error)||o.statusText,headers:o.headers,status:o.status,url:e});return l}catch(o){throw o instanceof K3||o instanceof yp?o:new K3({body:u,details:o.message,url:e})}}const E6=new Map;async function d6(e){let u=E6.get(e);if(u)return u;const{schedule:t}=PC({id:e,fn:async()=>{const i=new tA(e),a=new Map,s=new Map,o=({data:c})=>{const E=JSON.parse(c),d=E.method==="eth_subscription",f=d?E.params.subscription:E.id,p=d?s:a,h=p.get(f);h&&h({data:c}),d||p.delete(f)},l=()=>{E6.delete(e),i.removeEventListener("close",l),i.removeEventListener("message",o)};return i.addEventListener("close",l),i.addEventListener("message",o),i.readyState===tA.CONNECTING&&await new Promise((c,E)=>{i&&(i.onopen=c,i.onerror=E)}),u=Object.assign(i,{requests:a,subscriptions:s}),E6.set(e,u),[u]}}),[n,[r]]=await t();return r}function Tz(e,{body:u,onResponse:t}){if(e.readyState===e.CLOSED||e.readyState===e.CLOSING)throw new VR({body:u,url:e.url,details:"Socket is closed."});const n=bp++,r=({data:i})=>{var s;const a=JSON.parse(i);typeof a.id=="number"&&n!==a.id||(t==null||t(a),u.method==="eth_subscribe"&&typeof a.result=="string"&&e.subscriptions.set(a.result,r),u.method==="eth_unsubscribe"&&e.subscriptions.delete((s=u.params)==null?void 0:s[0]))};return e.requests.set(n,r),e.send(JSON.stringify({jsonrpc:"2.0",...u,id:n})),e}async function Oz(e,{body:u,timeout:t=1e4}){return yb(()=>new Promise(n=>Ys.webSocket(e,{body:u,onResponse:n})),{errorInstance:new yp({body:u,url:e.url}),timeout:t})}const Ys={http:Pz,webSocket:Tz,webSocketAsync:Oz};function Iz(e,u={}){const{batch:t,fetchOptions:n,key:r="http",name:i="HTTP JSON-RPC",retryDelay:a}=u;return({chain:s,retryCount:o,timeout:l})=>{const{batchSize:c=1e3,wait:E=0}=typeof t=="object"?t:{},d=u.retryCount??o,f=l??u.timeout??1e4,p=e||(s==null?void 0:s.rpcUrls.default.http[0]);if(!p)throw new Bb;return v1({key:r,name:i,async request({method:h,params:g}){const A={method:h,params:g},{schedule:m}=PC({id:`${e}`,wait:E,shouldSplitBatch(v){return v.length>c},fn:v=>Ys.http(p,{body:v,fetchOptions:n,timeout:f}),sort:(v,C)=>v.id-C.id}),B=async v=>t?m(v):[await Ys.http(p,{body:v,fetchOptions:n,timeout:f})],[{error:F,result:w}]=await B(A);if(F)throw new vC({body:A,error:F,url:p});return w},retryCount:d,retryDelay:a,timeout:f,type:"http"},{fetchOptions:n,url:e})}}function IC(e,u){var n,r,i;if(!(e instanceof Bu))return!1;const t=e.walk(a=>a instanceof Bp);return t instanceof Bp?!!(((n=t.data)==null?void 0:n.errorName)==="ResolverNotFound"||((r=t.data)==null?void 0:r.errorName)==="ResolverWildcardNotSupported"||(i=t.reason)!=null&&i.includes("Wildcard on non-extended resolvers is not supported")||u==="reverse"&&t.reason===ab[50]):!1}function Fb(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const u=`0x${e.slice(1,65)}`;return xn(u)?u:null}function l9(e){let u=new Uint8Array(32).fill(0);if(!e)return gl(u);const t=e.split(".");for(let n=t.length-1;n>=0;n-=1){const r=Fb(t[n]),i=r?Fi(r):pe(sr(t[n]),"bytes");u=pe(pr([u,i]),"bytes")}return gl(u)}function Nz(e){return`[${e.slice(2)}]`}function Rz(e){const u=new Uint8Array(32).fill(0);return e?Fb(e)||pe(sr(e)):gl(u)}function b1(e){const u=e.replace(/^\.|\.$/gm,"");if(u.length===0)return new Uint8Array(1);const t=new Uint8Array(sr(u).byteLength+2);let n=0;const r=u.split(".");for(let i=0;i255&&(a=sr(Nz(Rz(r[i])))),t[n]=a.length,t.set(a,n+1),n+=a.length+1}return t.byteLength!==n+1?t.slice(0,n+1):t}async function zz(e,{blockNumber:u,blockTag:t,coinType:n,name:r,universalResolverAddress:i}){let a=i;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=Mo({blockNumber:u,chain:e.chain,contract:"ensUniversalResolver"})}try{const s=Pi({abi:X7,functionName:"addr",...n!=null?{args:[l9(r),BigInt(n)]}:{args:[l9(r)]}}),o=await zu(e,bi)({address:a,abi:hb,functionName:"resolve",args:[Br(b1(r)),s],blockNumber:u,blockTag:t});if(o[0]==="0x")return null;const l=jo({abi:X7,args:n!=null?[l9(r),BigInt(n)]:void 0,functionName:"addr",data:o[0]});return l==="0x"||Pa(l)==="0x00"?null:l}catch(s){if(IC(s,"resolve"))return null;throw s}}class jz extends Bu{constructor({data:u}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(u)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class h3 extends Bu{constructor({reason:u}){super(`ENS NFT avatar URI is invalid. ${u}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class NC extends Bu{constructor({uri:u}){super(`Unable to resolve ENS avatar URI "${u}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class Mz extends Bu{constructor({namespace:u}){super(`ENS NFT avatar namespace "${u}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const Lz=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,Uz=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,$z=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Wz=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function qz(e){try{const u=await fetch(e,{method:"HEAD"});if(u.status===200){const t=u.headers.get("content-type");return t==null?void 0:t.startsWith("image/")}return!1}catch(u){return typeof u=="object"&&typeof u.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(t=>{const n=new Image;n.onload=()=>{t(!0)},n.onerror=()=>{t(!1)},n.src=e})}}function nA(e,u){return e?e.endsWith("/")?e.slice(0,-1):e:u}function Db({uri:e,gatewayUrls:u}){const t=$z.test(e);if(t)return{uri:e,isOnChain:!0,isEncoded:t};const n=nA(u==null?void 0:u.ipfs,"https://ipfs.io"),r=nA(u==null?void 0:u.arweave,"https://arweave.net"),i=e.match(Lz),{protocol:a,subpath:s,target:o,subtarget:l=""}=(i==null?void 0:i.groups)||{},c=a==="ipns:/"||s==="ipns/",E=a==="ipfs:/"||s==="ipfs/"||Uz.test(e);if(e.startsWith("http")&&!c&&!E){let f=e;return u!=null&&u.arweave&&(f=e.replace(/https:\/\/arweave.net/g,u==null?void 0:u.arweave)),{uri:f,isOnChain:!1,isEncoded:!1}}if((c||E)&&o)return{uri:`${n}/${c?"ipns":"ipfs"}/${o}${l}`,isOnChain:!1,isEncoded:!1};if(a==="ar:/"&&o)return{uri:`${r}/${o}${l||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(Wz,"");if(d.startsWith("r.json());return await RC({gatewayUrls:e,uri:vb(t)})}catch{throw new NC({uri:u})}}async function RC({gatewayUrls:e,uri:u}){const{uri:t,isOnChain:n}=Db({uri:u,gatewayUrls:e});if(n||await qz(t))return t;throw new NC({uri:u})}function Gz(e){let u=e;u.startsWith("did:nft:")&&(u=u.replace("did:nft:","").replace(/_/g,"/"));const[t,n,r]=u.split("/"),[i,a]=t.split(":"),[s,o]=n.split(":");if(!i||i.toLowerCase()!=="eip155")throw new h3({reason:"Only EIP-155 supported"});if(!a)throw new h3({reason:"Chain ID not found"});if(!o)throw new h3({reason:"Contract address not found"});if(!r)throw new h3({reason:"Token ID not found"});if(!s)throw new h3({reason:"ERC namespace not found"});return{chainID:parseInt(a),namespace:s.toLowerCase(),contractAddress:o,tokenID:r}}async function Qz(e,{nft:u}){if(u.namespace==="erc721")return bi(e,{address:u.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(u.tokenID)]});if(u.namespace==="erc1155")return bi(e,{address:u.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(u.tokenID)]});throw new Mz({namespace:u.namespace})}async function Kz(e,{gatewayUrls:u,record:t}){return/eip155:/i.test(t)?Vz(e,{gatewayUrls:u,record:t}):RC({uri:t,gatewayUrls:u})}async function Vz(e,{gatewayUrls:u,record:t}){const n=Gz(t),r=await Qz(e,{nft:n}),{uri:i,isOnChain:a,isEncoded:s}=Db({uri:r,gatewayUrls:u});if(a&&(i.includes("data:application/json;base64,")||i.startsWith("{"))){const l=s?atob(i.replace("data:application/json;base64,","")):i,c=JSON.parse(l);return RC({uri:vb(c),gatewayUrls:u})}let o=n.tokenID;return n.namespace==="erc1155"&&(o=o.replace("0x","").padStart(64,"0")),Hz({gatewayUrls:u,uri:i.replace(/(?:0x)?{id}/,o)})}async function bb(e,{blockNumber:u,blockTag:t,name:n,key:r,universalResolverAddress:i}){let a=i;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=Mo({blockNumber:u,chain:e.chain,contract:"ensUniversalResolver"})}try{const s=await zu(e,bi)({address:a,abi:hb,functionName:"resolve",args:[Br(b1(n)),Pi({abi:Z7,functionName:"text",args:[l9(n),r]})],blockNumber:u,blockTag:t});if(s[0]==="0x")return null;const o=jo({abi:Z7,functionName:"text",data:s[0]});return o===""?null:o}catch(s){if(IC(s,"resolve"))return null;throw s}}async function Jz(e,{blockNumber:u,blockTag:t,gatewayUrls:n,name:r,universalResolverAddress:i}){const a=await zu(e,bb)({blockNumber:u,blockTag:t,key:"avatar",name:r,universalResolverAddress:i});if(!a)return null;try{return await Kz(e,{record:a,gatewayUrls:n})}catch{return null}}async function Yz(e,{address:u,blockNumber:t,blockTag:n,universalResolverAddress:r}){let i=r;if(!i){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");i=Mo({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${u.toLowerCase().substring(2)}.addr.reverse`;try{return(await zu(e,bi)({address:i,abi:lz,functionName:"reverse",args:[Br(b1(a))],blockNumber:t,blockTag:n}))[0]}catch(s){if(IC(s,"reverse"))return null;throw s}}async function Zz(e,{blockNumber:u,blockTag:t,name:n,universalResolverAddress:r}){let i=r;if(!i){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");i=Mo({blockNumber:u,chain:e.chain,contract:"ensUniversalResolver"})}const[a]=await zu(e,bi)({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Br(b1(n))],blockNumber:u,blockTag:t});return a}async function Xz(e){const u=A1(e,{method:"eth_newBlockFilter"}),t=await e.request({method:"eth_newBlockFilter"});return{id:t,request:u(t),type:"block"}}async function wb(e,{address:u,args:t,event:n,events:r,fromBlock:i,strict:a,toBlock:s}={}){const o=r??(n?[n]:void 0),l=A1(e,{method:"eth_newFilter"});let c=[];o&&(c=[o.flatMap(d=>Rc({abi:[d],eventName:d.name,args:t}))],n&&(c=c[0]));const E=await e.request({method:"eth_newFilter",params:[{address:u,fromBlock:typeof i=="bigint"?Lu(i):i,toBlock:typeof s=="bigint"?Lu(s):s,...c.length?{topics:c}:{}}]});return{abi:o,args:t,eventName:n?n.name:void 0,fromBlock:i,id:E,request:l(E),strict:a,toBlock:s,type:"event"}}async function xb(e){const u=A1(e,{method:"eth_newPendingTransactionFilter"}),t=await e.request({method:"eth_newPendingTransactionFilter"});return{id:t,request:u(t),type:"transaction"}}async function uj(e,{address:u,blockNumber:t,blockTag:n="latest"}){const r=t?Lu(t):void 0,i=await e.request({method:"eth_getBalance",params:[u,r||n]});return BigInt(i)}async function ej(e,{blockHash:u,blockNumber:t,blockTag:n="latest"}={}){const r=t!==void 0?Lu(t):void 0;let i;return u?i=await e.request({method:"eth_getBlockTransactionCountByHash",params:[u]}):i=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[r||n]}),se(i)}async function tj(e,{address:u,blockNumber:t,blockTag:n="latest"}){const r=t!==void 0?Lu(t):void 0,i=await e.request({method:"eth_getCode",params:[u,r||n]});if(i!=="0x")return i}function nj(e){var u;return{baseFeePerGas:e.baseFeePerGas.map(t=>BigInt(t)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:(u=e.reward)==null?void 0:u.map(t=>t.map(n=>BigInt(n)))}}async function rj(e,{blockCount:u,blockNumber:t,blockTag:n="latest",rewardPercentiles:r}){const i=t?Lu(t):void 0,a=await e.request({method:"eth_feeHistory",params:[Lu(u),i||n,r]});return nj(a)}async function ij(e,{filter:u}){const t=u.strict??!1;return(await u.request({method:"eth_getFilterLogs",params:[u.id]})).map(r=>{var i;try{const{eventName:a,args:s}="abi"in u&&u.abi?Mc({abi:u.abi,data:r.data,topics:r.topics,strict:t}):{eventName:void 0,args:void 0};return Jt(r,{args:s,eventName:a})}catch(a){let s,o;if(a instanceof $a||a instanceof No){if("strict"in u&&u.strict)return;s=a.abiItem.name,o=(i=a.abiItem.inputs)==null?void 0:i.some(l=>!("name"in l&&l.name))}return Jt(r,{args:o?[]:{},eventName:s})}}).filter(Boolean)}const aj=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,sj=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function oj({domain:e,message:u,primaryType:t,types:n}){const r=typeof e>"u"?{}:e,i={EIP712Domain:Ob({domain:r}),...n};Tb({domain:r,message:u,primaryType:t,types:i});const a=["0x1901"];return r&&a.push(lj({domain:r,types:i})),t!=="EIP712Domain"&&a.push(kb({data:u,primaryType:t,types:i})),pe(pr(a))}function lj({domain:e,types:u}){return kb({data:e,primaryType:"EIP712Domain",types:u})}function kb({data:e,primaryType:u,types:t}){const n=_b({data:e,primaryType:u,types:t});return pe(n)}function _b({data:e,primaryType:u,types:t}){const n=[{type:"bytes32"}],r=[cj({primaryType:u,types:t})];for(const i of t[u]){const[a,s]=Pb({types:t,name:i.name,type:i.type,value:e[i.name]});n.push(a),r.push(s)}return Ic(n,r)}function cj({primaryType:e,types:u}){const t=Br(Ej({primaryType:e,types:u}));return pe(t)}function Ej({primaryType:e,types:u}){let t="";const n=Sb({primaryType:e,types:u});n.delete(e);const r=[e,...Array.from(n).sort()];for(const i of r)t+=`${i}(${u[i].map(({name:a,type:s})=>`${s} ${a}`).join(",")})`;return t}function Sb({primaryType:e,types:u},t=new Set){const n=e.match(/^\w*/u),r=n==null?void 0:n[0];if(t.has(r)||u[r]===void 0)return t;t.add(r);for(const i of u[r])Sb({primaryType:i.type,types:u},t);return t}function Pb({types:e,name:u,type:t,value:n}){if(e[t]!==void 0)return[{type:"bytes32"},pe(_b({data:n,primaryType:t,types:e}))];if(t==="bytes")return n=`0x${(n.length%2?"0":"")+n.slice(2)}`,[{type:"bytes32"},pe(n)];if(t==="string")return[{type:"bytes32"},pe(Br(n))];if(t.lastIndexOf("]")===t.length-1){const r=t.slice(0,t.lastIndexOf("[")),i=n.map(a=>Pb({name:u,type:r,types:e,value:a}));return[{type:"bytes32"},pe(Ic(i.map(([a])=>a),i.map(([,a])=>a)))]}return[{type:t},n]}function Tb({domain:e,message:u,primaryType:t,types:n}){const r=n,i=(a,s)=>{for(const o of a){const{name:l,type:c}=o,E=c,d=s[l],f=E.match(sj);if(f&&(typeof d=="number"||typeof d=="bigint")){const[g,A,m]=f;Lu(d,{signed:A==="int",size:parseInt(m)/8})}if(E==="address"&&typeof d=="string"&&!lo(d))throw new Bl({address:d});const p=E.match(aj);if(p){const[g,A]=p;if(A&&I0(d)!==parseInt(A))throw new GN({expectedSize:parseInt(A),givenSize:I0(d)})}const h=r[E];h&&i(h,d)}};if(r.EIP712Domain&&e&&i(r.EIP712Domain,e),t!=="EIP712Domain"){const a=r[t];i(a,u)}}function Ob({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}const f6="/docs/contract/encodeDeployData";function Ib({abi:e,args:u,bytecode:t}){if(!u||u.length===0)return t;const n=e.find(i=>"type"in i&&i.type==="constructor");if(!n)throw new MN({docsPath:f6});if(!("inputs"in n))throw new H7({docsPath:f6});if(!n.inputs||n.inputs.length===0)throw new H7({docsPath:f6});const r=Ic(n.inputs,u);return EC([t,r])}const dj=`Ethereum Signed Message: `;function fj(e,u){const t=(()=>typeof e=="string"?sr(e):e.raw instanceof Uint8Array?e.raw:Fi(e.raw))(),n=sr(`${dj}${t.length}`);return pe(pr([n,t]),u)}function pj(e){return e.map(u=>({...u,value:BigInt(u.value)}))}function hj(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?se(e.nonce):void 0,storageProof:e.storageProof?pj(e.storageProof):void 0}}async function Cj(e,{address:u,blockNumber:t,blockTag:n,storageKeys:r}){const i=n??"latest",a=t!==void 0?Lu(t):void 0,s=await e.request({method:"eth_getProof",params:[u,r,a||i]});return hj(s)}async function mj(e,{address:u,blockNumber:t,blockTag:n="latest",slot:r}){const i=t!==void 0?Lu(t):void 0;return await e.request({method:"eth_getStorageAt",params:[u,r,i||n]})}async function zC(e,{blockHash:u,blockNumber:t,blockTag:n,hash:r,index:i}){var c,E,d;const a=n||"latest",s=t!==void 0?Lu(t):void 0;let o=null;if(r?o=await e.request({method:"eth_getTransactionByHash",params:[r]}):u?o=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[u,Lu(i)]}):(s||a)&&(o=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[s||a,Lu(i)]})),!o)throw new ob({blockHash:u,blockNumber:t,blockTag:a,hash:r,index:i});return(((d=(E=(c=e.chain)==null?void 0:c.formatters)==null?void 0:E.transaction)==null?void 0:d.format)||E1)(o)}async function Aj(e,{hash:u,transactionReceipt:t}){const[n,r]=await Promise.all([zu(e,Uc)({}),u?zu(e,zC)({hash:u}):void 0]),i=(t==null?void 0:t.blockNumber)||(r==null?void 0:r.blockNumber);return i?n-i+1n:0n}async function wp(e,{hash:u}){var r,i,a;const t=await e.request({method:"eth_getTransactionReceipt",params:[u]});if(!t)throw new lb({hash:u});return(((a=(i=(r=e.chain)==null?void 0:r.formatters)==null?void 0:i.transactionReceipt)==null?void 0:a.format)||Gv)(t)}async function gj(e,u){var h;const{allowFailure:t=!0,batchSize:n,blockNumber:r,blockTag:i,contracts:a,multicallAddress:s}=u,o=n??(typeof((h=e.batch)==null?void 0:h.multicall)=="object"&&e.batch.multicall.batchSize||1024);let l=s;if(!l){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");l=Mo({blockNumber:r,chain:e.chain,contract:"multicall3"})}const c=[[]];let E=0,d=0;for(let g=0;g0&&d>o&&c[E].length>0&&(E++,d=(w.length-2)/2,c[E]=[]),c[E]=[...c[E],{allowFailure:!0,callData:w,target:m}]}catch(w){const v=Il(w,{abi:A,address:m,args:B,docsPath:"/docs/contract/multicall",functionName:F});if(!t)throw v;c[E]=[...c[E],{allowFailure:!0,callData:"0x",target:m}]}}const f=await Promise.allSettled(c.map(g=>zu(e,bi)({abi:Dp,address:l,args:[g],blockNumber:r,blockTag:i,functionName:"aggregate3"}))),p=[];for(let g=0;ge instanceof Uint8Array,Fj=Array.from({length:256},(e,u)=>u.toString(16).padStart(2,"0"));function fo(e){if(!x1(e))throw new Error("Uint8Array expected");let u="";for(let t=0;tn+r.length,0));let t=0;return e.forEach(n=>{if(!x1(n))throw new Error("Uint8Array expected");u.set(n,t),t+=n.length}),u}function zb(e,u){if(e.length!==u.length)return!1;for(let t=0;tNb;e>>=w1,u+=1);return u}function wj(e,u){return e>>BigInt(u)&w1}const xj=(e,u,t)=>e|(t?w1:Nb)<(yj<new Uint8Array(e),rA=e=>Uint8Array.from(e);function jb(e,u,t){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof u!="number"||u<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=p6(e),r=p6(e),i=0;const a=()=>{n.fill(1),r.fill(0),i=0},s=(...E)=>t(r,n,...E),o=(E=p6())=>{r=s(rA([0]),E),n=s(),E.length!==0&&(r=s(rA([1]),E),n=s())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let E=0;const d=[];for(;E{a(),o(E);let f;for(;!(f=d(l()));)o();return a(),f}}const kj={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,u)=>u.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Wc(e,u,t={}){const n=(r,i,a)=>{const s=kj[i];if(typeof s!="function")throw new Error(`Invalid validator "${i}", expected function`);const o=e[r];if(!(a&&o===void 0)&&!s(o,e))throw new Error(`Invalid param ${String(r)}=${o} (${typeof o}), expected ${i}`)};for(const[r,i]of Object.entries(u))n(r,i,!1);for(const[r,i]of Object.entries(t))n(r,i,!0);return e}const _j=Object.freeze(Object.defineProperty({__proto__:null,bitGet:wj,bitLen:bj,bitMask:UC,bitSet:xj,bytesToHex:fo,bytesToNumberBE:Ta,bytesToNumberLE:MC,concatBytes:Rl,createHmacDrbg:jb,ensureBytes:Rt,equalBytes:zb,hexToBytes:po,hexToNumber:jC,numberToBytesBE:ho,numberToBytesLE:LC,numberToHexUnpadded:Rb,numberToVarBytesBE:Dj,utf8ToBytes:vj,validateObject:Wc},Symbol.toStringTag,{value:"Module"}));function Sj(e,u){const t=xn(e)?Fi(e):e,n=xn(u)?Fi(u):u;return zb(t,n)}async function Mb(e,{address:u,hash:t,signature:n,...r}){const i=xn(n)?n:Br(n);try{const{data:a}=await zu(e,y1)({data:Ib({abi:cz,args:[u,t,i],bytecode:Bj}),...r});return Sj(a??"0x0","0x1")}catch(a){if(a instanceof cb)return!1;throw a}}async function Pj(e,{address:u,message:t,signature:n,...r}){const i=fj(t);return Mb(e,{address:u,hash:i,signature:n,...r})}async function Tj(e,{address:u,signature:t,message:n,primaryType:r,types:i,domain:a,...s}){const o=oj({message:n,primaryType:r,types:i,domain:a});return Mb(e,{address:u,hash:o,signature:t,...s})}function Lb(e,{emitOnBegin:u=!1,emitMissed:t=!1,onBlockNumber:n,onError:r,poll:i,pollingInterval:a=e.pollingInterval}){const s=typeof i<"u"?i:e.transport.type!=="webSocket";let o;return s?(()=>{const E=ge(["watchBlockNumber",e.uid,u,t,a]);return Lo(E,{onBlockNumber:n,onError:r},d=>Lc(async()=>{var f;try{const p=await zu(e,Uc)({cacheTime:0});if(o){if(p===o)return;if(p-o>1&&t)for(let h=o+1n;ho)&&(d.onBlockNumber(p,o),o=p)}catch(p){(f=d.onError)==null||f.call(d,p)}},{emitOnBegin:u,interval:a}))})():(()=>{let E=!0,d=()=>E=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newHeads"],onData(p){var g;if(!E)return;const h=Zn((g=p.result)==null?void 0:g.number);n(h,o),o=h},onError(p){r==null||r(p)}});d=f,E||d()}catch(f){r==null||r(f)}})(),d})()}async function Oj(e,{confirmations:u=1,hash:t,onReplaced:n,pollingInterval:r=e.pollingInterval,timeout:i}){const a=ge(["waitForTransactionReceipt",e.uid,t]);let s,o,l,c=!1;return new Promise((E,d)=>{i&&setTimeout(()=>d(new QR({hash:t})),i);const f=Lo(a,{onReplaced:n,resolve:E,reject:d},p=>{const h=zu(e,Lb)({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:r,async onBlockNumber(g){if(c)return;let A=g;const m=B=>{h(),B(),f()};try{if(l){if(u>1&&(!l.blockNumber||A-l.blockNumber+1np.resolve(l));return}if(s||(c=!0,await Ab(async()=>{s=await zu(e,zC)({hash:t}),s.blockNumber&&(A=s.blockNumber)},{delay:({count:B})=>~~(1<1&&(!l.blockNumber||A-l.blockNumber+1np.resolve(l))}catch(B){if(s&&(B instanceof ob||B instanceof lb))try{o=s;const w=(await zu(e,vi)({blockNumber:A,includeTransactions:!0})).transactions.find(({from:C,nonce:k})=>C===o.from&&k===o.nonce);if(!w||(l=await zu(e,wp)({hash:w.hash}),u>1&&(!l.blockNumber||A-l.blockNumber+1n{var C;(C=p.onReplaced)==null||C.call(p,{reason:v,replacedTransaction:o,transaction:w,transactionReceipt:l}),p.resolve(l)})}catch(F){m(()=>p.reject(F))}else m(()=>p.reject(B))}}})})})}function Ij(e,{blockTag:u="latest",emitMissed:t=!1,emitOnBegin:n=!1,onBlock:r,onError:i,includeTransactions:a,poll:s,pollingInterval:o=e.pollingInterval}){const l=typeof s<"u"?s:e.transport.type!=="webSocket",c=a??!1;let E;return l?(()=>{const p=ge(["watchBlocks",e.uid,t,n,c,o]);return Lo(p,{onBlock:r,onError:i},h=>Lc(async()=>{var g;try{const A=await zu(e,vi)({blockTag:u,includeTransactions:c});if(A.number&&(E!=null&&E.number)){if(A.number===E.number)return;if(A.number-E.number>1&&t)for(let m=(E==null?void 0:E.number)+1n;mE.number)&&(h.onBlock(A,E),E=A)}catch(A){(g=h.onError)==null||g.call(h,A)}},{emitOnBegin:n,interval:o}))})():(()=>{let p=!0,h=()=>p=!1;return(async()=>{try{const{unsubscribe:g}=await e.transport.subscribe({params:["newHeads"],onData(A){var F,w,v;if(!p)return;const B=(((v=(w=(F=e.chain)==null?void 0:F.formatters)==null?void 0:w.block)==null?void 0:v.format)||cC)(A.result);r(B,E),E=B},onError(A){i==null||i(A)}});h=g,p||h()}catch(g){i==null||i(g)}})(),h})()}function Nj(e,{address:u,args:t,batch:n=!0,event:r,events:i,onError:a,onLogs:s,poll:o,pollingInterval:l=e.pollingInterval,strict:c}){const E=typeof o<"u"?o:e.transport.type!=="webSocket",d=c??!1;return E?(()=>{const h=ge(["watchEvent",u,t,n,e.uid,r,l]);return Lo(h,{onLogs:s,onError:a},g=>{let A,m,B=!1;const F=Lc(async()=>{var w;if(!B){try{m=await zu(e,wb)({address:u,args:t,event:r,events:i,strict:d})}catch{}B=!0;return}try{let v;if(m)v=await zu(e,F1)({filter:m});else{const C=await zu(e,Uc)({});A&&A!==C?v=await zu(e,SC)({address:u,args:t,event:r,events:i,fromBlock:A+1n,toBlock:C}):v=[],A=C}if(v.length===0)return;n?g.onLogs(v):v.forEach(C=>g.onLogs([C]))}catch(v){m&&v instanceof Wa&&(B=!1),(w=g.onError)==null||w.call(g,v)}},{emitOnBegin:!0,interval:l});return async()=>{m&&await zu(e,D1)({filter:m}),F()}})})():(()=>{let h=!0,g=()=>h=!1;return(async()=>{try{const A=i??(r?[r]:void 0);let m=[];A&&(m=[A.flatMap(F=>Rc({abi:[F],eventName:F.name,args:t}))],r&&(m=m[0]));const{unsubscribe:B}=await e.transport.subscribe({params:["logs",{address:u,topics:m}],onData(F){var v;if(!h)return;const w=F.result;try{const{eventName:C,args:k}=Mc({abi:A,data:w.data,topics:w.topics,strict:d}),j=Jt(w,{args:k,eventName:C});s([j])}catch(C){let k,j;if(C instanceof $a||C instanceof No){if(c)return;k=C.abiItem.name,j=(v=C.abiItem.inputs)==null?void 0:v.some(uu=>!("name"in uu&&uu.name))}const N=Jt(w,{args:j?[]:{},eventName:k});s([N])}},onError(F){a==null||a(F)}});g=B,h||g()}catch(A){a==null||a(A)}})(),g})()}function Rj(e,{batch:u=!0,onError:t,onTransactions:n,poll:r,pollingInterval:i=e.pollingInterval}){return(typeof r<"u"?r:e.transport.type!=="webSocket")?(()=>{const l=ge(["watchPendingTransactions",e.uid,u,i]);return Lo(l,{onTransactions:n,onError:t},c=>{let E;const d=Lc(async()=>{var f;try{if(!E)try{E=await zu(e,xb)({});return}catch(h){throw d(),h}const p=await zu(e,F1)({filter:E});if(p.length===0)return;u?c.onTransactions(p):p.forEach(h=>c.onTransactions([h]))}catch(p){(f=c.onError)==null||f.call(c,p)}},{emitOnBegin:!0,interval:i});return async()=>{E&&await zu(e,D1)({filter:E}),d()}})})():(()=>{let l=!0,c=()=>l=!1;return(async()=>{try{const{unsubscribe:E}=await e.transport.subscribe({params:["newPendingTransactions"],onData(d){if(!l)return;const f=d.result;n([f])},onError(d){t==null||t(d)}});c=E,l||c()}catch(E){t==null||t(E)}})(),c})()}function zj(e){return{call:u=>y1(e,u),createBlockFilter:()=>Xz(e),createContractEventFilter:u=>ib(e,u),createEventFilter:u=>wb(e,u),createPendingTransactionFilter:()=>xb(e),estimateContractGas:u=>sz(e,u),estimateGas:u=>_C(e,u),getBalance:u=>uj(e,u),getBlock:u=>vi(e,u),getBlockNumber:u=>Uc(e,u),getBlockTransactionCount:u=>ej(e,u),getBytecode:u=>tj(e,u),getChainId:()=>Nl(e),getContractEvents:u=>fb(e,u),getEnsAddress:u=>zz(e,u),getEnsAvatar:u=>Jz(e,u),getEnsName:u=>Yz(e,u),getEnsResolver:u=>Zz(e,u),getEnsText:u=>bb(e,u),getFeeHistory:u=>rj(e,u),estimateFeesPerGas:u=>iz(e,u),getFilterChanges:u=>F1(e,u),getFilterLogs:u=>ij(e,u),getGasPrice:()=>kC(e),getLogs:u=>SC(e,u),getProof:u=>Cj(e,u),estimateMaxPriorityFeePerGas:u=>rz(e,u),getStorageAt:u=>mj(e,u),getTransaction:u=>zC(e,u),getTransactionConfirmations:u=>Aj(e,u),getTransactionCount:u=>db(e,u),getTransactionReceipt:u=>wp(e,u),multicall:u=>gj(e,u),prepareTransactionRequest:u=>B1(e,u),readContract:u=>bi(e,u),sendRawTransaction:u=>TC(e,u),simulateContract:u=>Cz(e,u),verifyMessage:u=>Pj(e,u),verifyTypedData:u=>Tj(e,u),uninstallFilter:u=>D1(e,u),waitForTransactionReceipt:u=>Oj(e,u),watchBlocks:u=>Ij(e,u),watchBlockNumber:u=>Lb(e,u),watchContractEvent:u=>Dz(e,u),watchEvent:u=>Nj(e,u),watchPendingTransactions:u=>Rj(e,u)}}function iA(e){const{key:u="public",name:t="Public Client"}=e;return mb({...e,key:u,name:t,type:"publicClient"}).extend(zj)}function jj(e,{abi:u,args:t,bytecode:n,...r}){const i=Ib({abi:u,args:t,bytecode:n});return OC(e,{...r,data:i})}async function Mj(e){var t;return((t=e.account)==null?void 0:t.type)==="local"?[e.account.address]:(await e.request({method:"eth_accounts"})).map(n=>BC(n))}async function Lj(e){return await e.request({method:"wallet_getPermissions"})}async function Uj(e){return(await e.request({method:"eth_requestAccounts"})).map(t=>oe(t))}async function $j(e,u){return e.request({method:"wallet_requestPermissions",params:[u]})}async function Wj(e,{account:u=e.account,message:t}){if(!u)throw new zo({docsPath:"/docs/actions/wallet/signMessage"});const n=kt(u);if(n.type==="local")return n.signMessage({message:t});const r=(()=>typeof t=="string"?aC(t):t.raw instanceof Uint8Array?Br(t.raw):t.raw)();return e.request({method:"personal_sign",params:[r,n.address]})}async function qj(e,u){var l,c,E,d;const{account:t=e.account,chain:n=e.chain,...r}=u;if(!t)throw new zo({docsPath:"/docs/actions/wallet/signTransaction"});const i=kt(t);jc({account:i,...u});const a=await zu(e,Nl)({});n!==null&&Cb({currentChainId:a,chain:n});const s=(n==null?void 0:n.formatters)||((l=e.chain)==null?void 0:l.formatters),o=((c=s==null?void 0:s.transactionRequest)==null?void 0:c.format)||d1;return i.type==="local"?i.signTransaction({...r,chainId:a},{serializer:(d=(E=e.chain)==null?void 0:E.serializers)==null?void 0:d.transaction}):await e.request({method:"eth_signTransaction",params:[{...o(r),chainId:Lu(a),from:i.address}]})}async function Hj(e,{account:u=e.account,domain:t,message:n,primaryType:r,types:i}){if(!u)throw new zo({docsPath:"/docs/actions/wallet/signTypedData"});const a=kt(u),s={EIP712Domain:Ob({domain:t}),...i};if(Tb({domain:t,message:n,primaryType:r,types:s}),a.type==="local")return a.signTypedData({domain:t,primaryType:r,types:s,message:n});const o=ge({domain:t??{},primaryType:r,types:s,message:n},(l,c)=>xn(c)?c.toLowerCase():c);return e.request({method:"eth_signTypedData_v4",params:[a.address,o]})}async function Gj(e,{id:u}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:Lu(u)}]})}async function Qj(e,u){return await e.request({method:"wallet_watchAsset",params:u})}function Kj(e){return{addChain:u=>wz(e,u),deployContract:u=>jj(e,u),getAddresses:()=>Mj(e),getChainId:()=>Nl(e),getPermissions:()=>Lj(e),prepareTransactionRequest:u=>B1(e,u),requestAddresses:()=>Uj(e),requestPermissions:u=>$j(e,u),sendRawTransaction:u=>TC(e,u),sendTransaction:u=>OC(e,u),signMessage:u=>Wj(e,u),signTransaction:u=>qj(e,u),signTypedData:u=>Hj(e,u),switchChain:u=>Gj(e,u),watchAsset:u=>Qj(e,u),writeContract:u=>bz(e,u)}}function qc(e){const{key:u="wallet",name:t="Wallet Client",transport:n}=e;return mb({...e,key:u,name:t,transport:i=>n({...i,retryCount:0}),type:"walletClient"}).extend(Kj)}function Vj(e,u={}){const{key:t="webSocket",name:n="WebSocket JSON-RPC",retryDelay:r}=u;return({chain:i,retryCount:a,timeout:s})=>{var E;const o=u.retryCount??a,l=s??u.timeout??1e4,c=e||((E=i==null?void 0:i.rpcUrls.default.webSocket)==null?void 0:E[0]);if(!c)throw new Bb;return v1({key:t,name:n,async request({method:d,params:f}){const p={method:d,params:f},h=await d6(c),{error:g,result:A}=await Ys.webSocketAsync(h,{body:p,timeout:l});if(g)throw new vC({body:p,error:g,url:c});return A},retryCount:o,retryDelay:r,timeout:l,type:"webSocket"},{getSocket(){return d6(c)},async subscribe({params:d,onData:f,onError:p}){const h=await d6(c),{result:g}=await new Promise((A,m)=>Ys.webSocket(h,{body:{method:"eth_subscribe",params:d},onResponse(B){if(B.error){m(B.error),p==null||p(B.error);return}if(typeof B.id=="number"){A(B);return}B.method==="eth_subscription"&&f(B.params)}}));return{subscriptionId:g,async unsubscribe(){return new Promise(A=>Ys.webSocket(h,{body:{method:"eth_unsubscribe",params:[g]},onResponse:A}))}}}})}}function Jj(e,u,t,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(u,t,n);const r=BigInt(32),i=BigInt(4294967295),a=Number(t>>r&i),s=Number(t&i),o=n?4:0,l=n?0:4;e.setUint32(u+o,a,n),e.setUint32(u+l,s,n)}class Yj extends pC{constructor(u,t,n,r){super(),this.blockLen=u,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(u),this.view=s6(this.buffer)}update(u){co(this);const{view:t,buffer:n,blockLen:r}=this;u=C1(u);const i=u.length;for(let a=0;ar-a&&(this.process(n,0),a=0);for(let E=a;Ec.length)throw new Error("_sha2: outputLen bigger than state");for(let E=0;Ee&u^~e&t,Xj=(e,u,t)=>e&u^e&t^u&t,uM=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]),xr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),kr=new Uint32Array(64);class eM extends Yj{constructor(){super(64,32,8,!1),this.A=xr[0]|0,this.B=xr[1]|0,this.C=xr[2]|0,this.D=xr[3]|0,this.E=xr[4]|0,this.F=xr[5]|0,this.G=xr[6]|0,this.H=xr[7]|0}get(){const{A:u,B:t,C:n,D:r,E:i,F:a,G:s,H:o}=this;return[u,t,n,r,i,a,s,o]}set(u,t,n,r,i,a,s,o){this.A=u|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=s|0,this.H=o|0}process(u,t){for(let E=0;E<16;E++,t+=4)kr[E]=u.getUint32(t,!1);for(let E=16;E<64;E++){const d=kr[E-15],f=kr[E-2],p=nn(d,7)^nn(d,18)^d>>>3,h=nn(f,17)^nn(f,19)^f>>>10;kr[E]=h+kr[E-7]+p+kr[E-16]|0}let{A:n,B:r,C:i,D:a,E:s,F:o,G:l,H:c}=this;for(let E=0;E<64;E++){const d=nn(s,6)^nn(s,11)^nn(s,25),f=c+d+Zj(s,o,l)+uM[E]+kr[E]|0,h=(nn(n,2)^nn(n,13)^nn(n,22))+Xj(n,r,i)|0;c=l,l=o,o=s,s=a+f|0,a=i,i=r,r=n,n=f+h|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,s=s+this.E|0,o=o+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,i,a,s,o,l,c)}roundClean(){kr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const tM=Zv(()=>new eM);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const L0=BigInt(0),F0=BigInt(1),Wi=BigInt(2),nM=BigInt(3),xp=BigInt(4),aA=BigInt(5),sA=BigInt(8);BigInt(9);BigInt(16);function we(e,u){const t=e%u;return t>=L0?t:u+t}function rM(e,u,t){if(t<=L0||u 0");if(t===F0)return L0;let n=F0;for(;u>L0;)u&F0&&(n=n*e%t),e=e*e%t,u>>=F0;return n}function nt(e,u,t){let n=e;for(;u-- >L0;)n*=n,n%=t;return n}function kp(e,u){if(e===L0||u<=L0)throw new Error(`invert: expected positive integers, got n=${e} mod=${u}`);let t=we(e,u),n=u,r=L0,i=F0;for(;t!==L0;){const s=n/t,o=n%t,l=r-i*s;n=t,t=o,r=i,i=l}if(n!==F0)throw new Error("invert: does not exist");return we(r,u)}function iM(e){const u=(e-F0)/Wi;let t,n,r;for(t=e-F0,n=0;t%Wi===L0;t/=Wi,n++);for(r=Wi;r(n[r]="function",n),u);return Wc(e,t)}function lM(e,u,t){if(t 0");if(t===L0)return e.ONE;if(t===F0)return u;let n=e.ONE,r=u;for(;t>L0;)t&F0&&(n=e.mul(n,r)),r=e.sqr(r),t>>=F0;return n}function cM(e,u){const t=new Array(u.length),n=u.reduce((i,a,s)=>e.is0(a)?i:(t[s]=i,e.mul(i,a)),e.ONE),r=e.inv(n);return u.reduceRight((i,a,s)=>e.is0(a)?i:(t[s]=e.mul(i,t[s]),e.mul(i,a)),r),t}function Ub(e,u){const t=u!==void 0?u:e.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function EM(e,u,t=!1,n={}){if(e<=L0)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:r,nByteLength:i}=Ub(e,u);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=aM(e),s=Object.freeze({ORDER:e,BITS:r,BYTES:i,MASK:UC(r),ZERO:L0,ONE:F0,create:o=>we(o,e),isValid:o=>{if(typeof o!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof o}`);return L0<=o&&oo===L0,isOdd:o=>(o&F0)===F0,neg:o=>we(-o,e),eql:(o,l)=>o===l,sqr:o=>we(o*o,e),add:(o,l)=>we(o+l,e),sub:(o,l)=>we(o-l,e),mul:(o,l)=>we(o*l,e),pow:(o,l)=>lM(s,o,l),div:(o,l)=>we(o*kp(l,e),e),sqrN:o=>o*o,addN:(o,l)=>o+l,subN:(o,l)=>o-l,mulN:(o,l)=>o*l,inv:o=>kp(o,e),sqrt:n.sqrt||(o=>a(s,o)),invertBatch:o=>cM(s,o),cmov:(o,l,c)=>c?l:o,toBytes:o=>t?LC(o,i):ho(o,i),fromBytes:o=>{if(o.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${o.length}`);return t?MC(o):Ta(o)}});return Object.freeze(s)}function $b(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const u=e.toString(2).length;return Math.ceil(u/8)}function Wb(e){const u=$b(e);return u+Math.ceil(u/2)}function dM(e,u,t=!1){const n=e.length,r=$b(u),i=Wb(u);if(n<16||n1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const a=t?Ta(e):MC(e),s=we(a,u-F0)+F0;return t?LC(s,r):ho(s,r)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const fM=BigInt(0),h6=BigInt(1);function pM(e,u){const t=(r,i)=>{const a=i.negate();return r?a:i},n=r=>{const i=Math.ceil(u/r)+1,a=2**(r-1);return{windows:i,windowSize:a}};return{constTimeNegate:t,unsafeLadder(r,i){let a=e.ZERO,s=r;for(;i>fM;)i&h6&&(a=a.add(s)),s=s.double(),i>>=h6;return a},precomputeWindow(r,i){const{windows:a,windowSize:s}=n(i),o=[];let l=r,c=l;for(let E=0;E>=f,g>o&&(g-=d,a+=h6);const A=h,m=h+Math.abs(g)-1,B=p%2!==0,F=g<0;g===0?c=c.add(t(B,i[A])):l=l.add(t(F,i[m]))}return{p:l,f:c}},wNAFCached(r,i,a,s){const o=r._WINDOW_SIZE||1;let l=i.get(r);return l||(l=this.precomputeWindow(r,o),o!==1&&i.set(r,s(l))),this.wNAF(o,l,a)}}}function qb(e){return oM(e.Fp),Wc(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ub(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function hM(e){const u=qb(e);Wc(u,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:n,a:r}=u;if(t){if(!n.eql(r,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...u})}const{bytesToNumberBE:CM,hexToBytes:mM}=_j,Yi={Err:class extends Error{constructor(u=""){super(u)}},_parseInt(e){const{Err:u}=Yi;if(e.length<2||e[0]!==2)throw new u("Invalid signature integer tag");const t=e[1],n=e.subarray(2,t+2);if(!t||n.length!==t)throw new u("Invalid signature integer: wrong length");if(n[0]&128)throw new u("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new u("Invalid signature integer: unnecessary leading zero");return{d:CM(n),l:e.subarray(t+2)}},toSig(e){const{Err:u}=Yi,t=typeof e=="string"?mM(e):e;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let n=t.length;if(n<2||t[0]!=48)throw new u("Invalid signature tag");if(t[1]!==n-2)throw new u("Invalid signature: incorrect length");const{d:r,l:i}=Yi._parseInt(t.subarray(2)),{d:a,l:s}=Yi._parseInt(i);if(s.length)throw new u("Invalid signature: left bytes after parsing");return{r,s:a}},hexFromSig(e){const u=l=>Number.parseInt(l[0],16)&8?"00"+l:l,t=l=>{const c=l.toString(16);return c.length&1?`0${c}`:c},n=u(t(e.s)),r=u(t(e.r)),i=n.length/2,a=r.length/2,s=t(i),o=t(a);return`30${t(a+i+4)}02${o}${r}02${s}${n}`}},Xn=BigInt(0),Ct=BigInt(1);BigInt(2);const oA=BigInt(3);BigInt(4);function AM(e){const u=hM(e),{Fp:t}=u,n=u.toBytes||((p,h,g)=>{const A=h.toAffine();return Rl(Uint8Array.from([4]),t.toBytes(A.x),t.toBytes(A.y))}),r=u.fromBytes||(p=>{const h=p.subarray(1),g=t.fromBytes(h.subarray(0,t.BYTES)),A=t.fromBytes(h.subarray(t.BYTES,2*t.BYTES));return{x:g,y:A}});function i(p){const{a:h,b:g}=u,A=t.sqr(p),m=t.mul(A,p);return t.add(t.add(m,t.mul(p,h)),g)}if(!t.eql(t.sqr(u.Gy),i(u.Gx)))throw new Error("bad generator point: equation left != right");function a(p){return typeof p=="bigint"&&Xnt.eql(B,t.ZERO);return m(g)&&m(A)?E.ZERO:new E(g,A,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(h){const g=t.invertBatch(h.map(A=>A.pz));return h.map((A,m)=>A.toAffine(g[m])).map(E.fromAffine)}static fromHex(h){const g=E.fromAffine(r(Rt("pointHex",h)));return g.assertValidity(),g}static fromPrivateKey(h){return E.BASE.multiply(o(h))}_setWindowSize(h){this._WINDOW_SIZE=h,l.delete(this)}assertValidity(){if(this.is0()){if(u.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:h,y:g}=this.toAffine();if(!t.isValid(h)||!t.isValid(g))throw new Error("bad point: x or y not FE");const A=t.sqr(g),m=i(h);if(!t.eql(A,m))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:h}=this.toAffine();if(t.isOdd)return!t.isOdd(h);throw new Error("Field doesn't support isOdd")}equals(h){c(h);const{px:g,py:A,pz:m}=this,{px:B,py:F,pz:w}=h,v=t.eql(t.mul(g,w),t.mul(B,m)),C=t.eql(t.mul(A,w),t.mul(F,m));return v&&C}negate(){return new E(this.px,t.neg(this.py),this.pz)}double(){const{a:h,b:g}=u,A=t.mul(g,oA),{px:m,py:B,pz:F}=this;let w=t.ZERO,v=t.ZERO,C=t.ZERO,k=t.mul(m,m),j=t.mul(B,B),N=t.mul(F,F),uu=t.mul(m,B);return uu=t.add(uu,uu),C=t.mul(m,F),C=t.add(C,C),w=t.mul(h,C),v=t.mul(A,N),v=t.add(w,v),w=t.sub(j,v),v=t.add(j,v),v=t.mul(w,v),w=t.mul(uu,w),C=t.mul(A,C),N=t.mul(h,N),uu=t.sub(k,N),uu=t.mul(h,uu),uu=t.add(uu,C),C=t.add(k,k),k=t.add(C,k),k=t.add(k,N),k=t.mul(k,uu),v=t.add(v,k),N=t.mul(B,F),N=t.add(N,N),k=t.mul(N,uu),w=t.sub(w,k),C=t.mul(N,j),C=t.add(C,C),C=t.add(C,C),new E(w,v,C)}add(h){c(h);const{px:g,py:A,pz:m}=this,{px:B,py:F,pz:w}=h;let v=t.ZERO,C=t.ZERO,k=t.ZERO;const j=u.a,N=t.mul(u.b,oA);let uu=t.mul(g,B),ou=t.mul(A,F),su=t.mul(m,w),mu=t.add(g,A),tu=t.add(B,F);mu=t.mul(mu,tu),tu=t.add(uu,ou),mu=t.sub(mu,tu),tu=t.add(g,m);let au=t.add(B,w);return tu=t.mul(tu,au),au=t.add(uu,su),tu=t.sub(tu,au),au=t.add(A,m),v=t.add(F,w),au=t.mul(au,v),v=t.add(ou,su),au=t.sub(au,v),k=t.mul(j,tu),v=t.mul(N,su),k=t.add(v,k),v=t.sub(ou,k),k=t.add(ou,k),C=t.mul(v,k),ou=t.add(uu,uu),ou=t.add(ou,uu),su=t.mul(j,su),tu=t.mul(N,tu),ou=t.add(ou,su),su=t.sub(uu,su),su=t.mul(j,su),tu=t.add(tu,su),uu=t.mul(ou,tu),C=t.add(C,uu),uu=t.mul(au,tu),v=t.mul(mu,v),v=t.sub(v,uu),uu=t.mul(mu,ou),k=t.mul(au,k),k=t.add(k,uu),new E(v,C,k)}subtract(h){return this.add(h.negate())}is0(){return this.equals(E.ZERO)}wNAF(h){return f.wNAFCached(this,l,h,g=>{const A=t.invertBatch(g.map(m=>m.pz));return g.map((m,B)=>m.toAffine(A[B])).map(E.fromAffine)})}multiplyUnsafe(h){const g=E.ZERO;if(h===Xn)return g;if(s(h),h===Ct)return this;const{endo:A}=u;if(!A)return f.unsafeLadder(this,h);let{k1neg:m,k1:B,k2neg:F,k2:w}=A.splitScalar(h),v=g,C=g,k=this;for(;B>Xn||w>Xn;)B&Ct&&(v=v.add(k)),w&Ct&&(C=C.add(k)),k=k.double(),B>>=Ct,w>>=Ct;return m&&(v=v.negate()),F&&(C=C.negate()),C=new E(t.mul(C.px,A.beta),C.py,C.pz),v.add(C)}multiply(h){s(h);let g=h,A,m;const{endo:B}=u;if(B){const{k1neg:F,k1:w,k2neg:v,k2:C}=B.splitScalar(g);let{p:k,f:j}=this.wNAF(w),{p:N,f:uu}=this.wNAF(C);k=f.constTimeNegate(F,k),N=f.constTimeNegate(v,N),N=new E(t.mul(N.px,B.beta),N.py,N.pz),A=k.add(N),m=j.add(uu)}else{const{p:F,f:w}=this.wNAF(g);A=F,m=w}return E.normalizeZ([A,m])[0]}multiplyAndAddUnsafe(h,g,A){const m=E.BASE,B=(w,v)=>v===Xn||v===Ct||!w.equals(m)?w.multiplyUnsafe(v):w.multiply(v),F=B(this,g).add(B(h,A));return F.is0()?void 0:F}toAffine(h){const{px:g,py:A,pz:m}=this,B=this.is0();h==null&&(h=B?t.ONE:t.inv(m));const F=t.mul(g,h),w=t.mul(A,h),v=t.mul(m,h);if(B)return{x:t.ZERO,y:t.ZERO};if(!t.eql(v,t.ONE))throw new Error("invZ was invalid");return{x:F,y:w}}isTorsionFree(){const{h,isTorsionFree:g}=u;if(h===Ct)return!0;if(g)return g(E,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h,clearCofactor:g}=u;return h===Ct?this:g?g(E,this):this.multiplyUnsafe(u.h)}toRawBytes(h=!0){return this.assertValidity(),n(E,this,h)}toHex(h=!0){return fo(this.toRawBytes(h))}}E.BASE=new E(u.Gx,u.Gy,t.ONE),E.ZERO=new E(t.ZERO,t.ONE,t.ZERO);const d=u.nBitLength,f=pM(E,u.endo?Math.ceil(d/2):d);return{CURVE:u,ProjectivePoint:E,normPrivateKeyToScalar:o,weierstrassEquation:i,isWithinCurveOrder:a}}function gM(e){const u=qb(e);return Wc(u,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...u})}function BM(e){const u=gM(e),{Fp:t,n}=u,r=t.BYTES+1,i=2*t.BYTES+1;function a(tu){return Xnfo(ho(tu,u.nByteLength));function p(tu){const au=n>>Ct;return tu>au}function h(tu){return p(tu)?s(-tu):tu}const g=(tu,au,nu)=>Ta(tu.slice(au,nu));class A{constructor(au,nu,H){this.r=au,this.s=nu,this.recovery=H,this.assertValidity()}static fromCompact(au){const nu=u.nByteLength;return au=Rt("compactSignature",au,nu*2),new A(g(au,0,nu),g(au,nu,2*nu))}static fromDER(au){const{r:nu,s:H}=Yi.toSig(Rt("DER",au));return new A(nu,H)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(au){return new A(this.r,this.s,au)}recoverPublicKey(au){const{r:nu,s:H,recovery:iu}=this,lu=C(Rt("msgHash",au));if(iu==null||![0,1,2,3].includes(iu))throw new Error("recovery id invalid");const Eu=iu===2||iu===3?nu+u.n:nu;if(Eu>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const hu=iu&1?"03":"02",fu=l.fromHex(hu+f(Eu)),Y=o(Eu),Su=s(-lu*Y),wu=s(H*Y),xu=l.BASE.multiplyAndAddUnsafe(fu,Su,wu);if(!xu)throw new Error("point at infinify");return xu.assertValidity(),xu}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return po(this.toDERHex())}toDERHex(){return Yi.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return po(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const m={isValidPrivateKey(tu){try{return c(tu),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const tu=Wb(u.n);return dM(u.randomBytes(tu),u.n)},precompute(tu=8,au=l.BASE){return au._setWindowSize(tu),au.multiply(BigInt(3)),au}};function B(tu,au=!0){return l.fromPrivateKey(tu).toRawBytes(au)}function F(tu){const au=tu instanceof Uint8Array,nu=typeof tu=="string",H=(au||nu)&&tu.length;return au?H===r||H===i:nu?H===2*r||H===2*i:tu instanceof l}function w(tu,au,nu=!0){if(F(tu))throw new Error("first arg must be private key");if(!F(au))throw new Error("second arg must be public key");return l.fromHex(au).multiply(c(tu)).toRawBytes(nu)}const v=u.bits2int||function(tu){const au=Ta(tu),nu=tu.length*8-u.nBitLength;return nu>0?au>>BigInt(nu):au},C=u.bits2int_modN||function(tu){return s(v(tu))},k=UC(u.nBitLength);function j(tu){if(typeof tu!="bigint")throw new Error("bigint expected");if(!(Xn<=tu&&tuNu in nu))throw new Error("sign() legacy options not supported");const{hash:H,randomBytes:iu}=u;let{lowS:lu,prehash:Eu,extraEntropy:hu}=nu;lu==null&&(lu=!0),tu=Rt("msgHash",tu),Eu&&(tu=Rt("prehashed msgHash",H(tu)));const fu=C(tu),Y=c(au),Su=[j(Y),j(fu)];if(hu!=null){const Nu=hu===!0?iu(t.BYTES):hu;Su.push(Rt("extraEntropy",Nu))}const wu=Rl(...Su),xu=fu;function ku(Nu){const S=v(Nu);if(!d(S))return;const O=o(S),I=l.BASE.multiply(S).toAffine(),W=s(I.x);if(W===Xn)return;const U=s(O*s(xu+W*Y));if(U===Xn)return;let Q=(I.x===W?0:2)|Number(I.y&Ct),Z=U;return lu&&p(U)&&(Z=h(U),Q^=1),new A(W,Z,Q)}return{seed:wu,k2sig:ku}}const uu={lowS:u.lowS,prehash:!1},ou={lowS:u.lowS,prehash:!1};function su(tu,au,nu=uu){const{seed:H,k2sig:iu}=N(tu,au,nu),lu=u;return jb(lu.hash.outputLen,lu.nByteLength,lu.hmac)(H,iu)}l.BASE._setWindowSize(8);function mu(tu,au,nu,H=ou){var I;const iu=tu;if(au=Rt("msgHash",au),nu=Rt("publicKey",nu),"strict"in H)throw new Error("options.strict was renamed to lowS");const{lowS:lu,prehash:Eu}=H;let hu,fu;try{if(typeof iu=="string"||iu instanceof Uint8Array)try{hu=A.fromDER(iu)}catch(W){if(!(W instanceof Yi.Err))throw W;hu=A.fromCompact(iu)}else if(typeof iu=="object"&&typeof iu.r=="bigint"&&typeof iu.s=="bigint"){const{r:W,s:U}=iu;hu=new A(W,U)}else throw new Error("PARSE");fu=l.fromHex(nu)}catch(W){if(W.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(lu&&hu.hasHighS())return!1;Eu&&(au=u.hash(au));const{r:Y,s:Su}=hu,wu=C(au),xu=o(Su),ku=s(wu*xu),Nu=s(Y*xu),S=(I=l.BASE.multiplyAndAddUnsafe(fu,ku,Nu))==null?void 0:I.toAffine();return S?s(S.x)===Y:!1}return{CURVE:u,getPublicKey:B,getSharedSecret:w,sign:su,verify:mu,ProjectivePoint:l,Signature:A,utils:m}}let Hb=class extends pC{constructor(u,t){super(),this.finished=!1,this.destroyed=!1,uR(u);const n=C1(t);if(this.iHash=u.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;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?u.create().update(n).digest():n);for(let a=0;anew Hb(e,u).update(t).digest();Gb.create=(e,u)=>new Hb(e,u);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function yM(e){return{hash:e,hmac:(u,...t)=>Gb(e,u,cR(...t)),randomBytes:ER}}function FM(e,u){const t=n=>BM({...e,...yM(n)});return Object.freeze({...t(u),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Qb=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),lA=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),DM=BigInt(1),_p=BigInt(2),cA=(e,u)=>(e+u/_p)/u;function vM(e){const u=Qb,t=BigInt(3),n=BigInt(6),r=BigInt(11),i=BigInt(22),a=BigInt(23),s=BigInt(44),o=BigInt(88),l=e*e*e%u,c=l*l*e%u,E=nt(c,t,u)*c%u,d=nt(E,t,u)*c%u,f=nt(d,_p,u)*l%u,p=nt(f,r,u)*f%u,h=nt(p,i,u)*p%u,g=nt(h,s,u)*h%u,A=nt(g,o,u)*g%u,m=nt(A,s,u)*h%u,B=nt(m,t,u)*c%u,F=nt(B,a,u)*p%u,w=nt(F,n,u)*l%u,v=nt(w,_p,u);if(!Sp.eql(Sp.sqr(v),e))throw new Error("Cannot find square root");return v}const Sp=EM(Qb,void 0,void 0,{sqrt:vM}),Sr=FM({a:BigInt(0),b:BigInt(7),Fp:Sp,n:lA,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const u=lA,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-DM*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),r=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,a=BigInt("0x100000000000000000000000000000000"),s=cA(i*e,u),o=cA(-n*e,u);let l=we(e-s*t-o*r,u),c=we(-s*n-o*i,u);const E=l>a,d=c>a;if(E&&(l=u-l),d&&(c=u-c),l>a||c>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:E,k1:l,k2neg:d,k2:c}}}},tM);BigInt(0);Sr.ProjectivePoint;const bM=iC({id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0x56522D00C410a43BFfDF00a9A569489297385790",blockCreated:8765204},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6507670}},testnet:!0}),$C=iC({id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62",blockCreated:16966585},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),wM=iC({id:420,name:"Optimism Goerli",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:49461}},testnet:!0},{formatters:xN});var Kb=class extends Error{constructor({chainId:e,connectorId:u}){super(`Chain "${e}" not configured for connector "${u}".`),this.name="ChainNotConfiguredForConnectorError"}},ke=class extends Error{constructor(){super(...arguments),this.name="ConnectorNotFoundError",this.message="Connector not found"}};function qa(e){return typeof e=="string"?Number.parseInt(e,e.trim().substring(0,2)==="0x"?16:10):typeof e=="bigint"?Number(e):e}var Vb={exports:{}};(function(e){var u=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function r(o,l,c){this.fn=o,this.context=l,this.once=c||!1}function i(o,l,c,E,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new r(c,E||o,d),p=t?t+l:l;return o._events[p]?o._events[p].fn?o._events[p]=[o._events[p],f]:o._events[p].push(f):(o._events[p]=f,o._eventsCount++),o}function a(o,l){--o._eventsCount===0?o._events=new n:delete o._events[l]}function s(){this._events=new n,this._eventsCount=0}s.prototype.eventNames=function(){var l=[],c,E;if(this._eventsCount===0)return l;for(E in c=this._events)u.call(c,E)&&l.push(t?E.slice(1):E);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},s.prototype.listeners=function(l){var c=t?t+l:l,E=this._events[c];if(!E)return[];if(E.fn)return[E.fn];for(var d=0,f=E.length,p=new Array(f);d{if(!u.has(e))throw TypeError("Cannot "+t)},Hu=(e,u,t)=>(WC(e,u,"read from private field"),t?t.call(e):u.get(e)),S0=(e,u,t)=>{if(u.has(e))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(e):u.set(e,t)},hr=(e,u,t,n)=>(WC(e,u,"write to private field"),n?n.call(e,t):u.set(e,t),t),k0=(e,u,t)=>(WC(e,u,"access private method"),t),Hc=class extends kM{constructor({chains:e=[$C,bM],options:u}){super(),this.chains=e,this.options=u}getBlockExplorerUrls(e){const{default:u,...t}=e.blockExplorers??{};if(u)return[u.url,...Object.values(t).map(n=>n.url)]}isChainUnsupported(e){return!this.chains.some(u=>u.id===e)}setStorage(e){this.storage=e}};function _M(e){var t;if(!e)return"Injected";const u=n=>{if(n.isApexWallet)return"Apex Wallet";if(n.isAvalanche)return"Core Wallet";if(n.isBackpack)return"Backpack";if(n.isBifrost)return"Bifrost Wallet";if(n.isBitKeep)return"BitKeep";if(n.isBitski)return"Bitski";if(n.isBlockWallet)return"BlockWallet";if(n.isBraveWallet)return"Brave Wallet";if(n.isCoin98)return"Coin98 Wallet";if(n.isCoinbaseWallet)return"Coinbase Wallet";if(n.isDawn)return"Dawn Wallet";if(n.isDefiant)return"Defiant";if(n.isDesig)return"Desig Wallet";if(n.isEnkrypt)return"Enkrypt";if(n.isExodus)return"Exodus";if(n.isFordefi)return"Fordefi";if(n.isFrame)return"Frame";if(n.isFrontier)return"Frontier Wallet";if(n.isGamestop)return"GameStop Wallet";if(n.isHaqqWallet)return"HAQQ Wallet";if(n.isHyperPay)return"HyperPay Wallet";if(n.isImToken)return"ImToken";if(n.isHaloWallet)return"Halo Wallet";if(n.isKuCoinWallet)return"KuCoin Wallet";if(n.isMathWallet)return"MathWallet";if(n.isNovaWallet)return"Nova Wallet";if(n.isOkxWallet||n.isOKExWallet)return"OKX Wallet";if(n.isOneInchIOSWallet||n.isOneInchAndroidWallet)return"1inch Wallet";if(n.isOpera)return"Opera";if(n.isPhantom)return"Phantom";if(n.isPortal)return"Ripio Portal";if(n.isRabby)return"Rabby Wallet";if(n.isRainbow)return"Rainbow";if(n.isSafePal)return"SafePal Wallet";if(n.isStatus)return"Status";if(n.isSubWallet)return"SubWallet";if(n.isTalisman)return"Talisman";if(n.isTally)return"Taho";if(n.isTokenPocket)return"TokenPocket";if(n.isTokenary)return"Tokenary";if(n.isTrust||n.isTrustWallet)return"Trust Wallet";if(n.isTTWallet)return"TTWallet";if(n.isXDEFI)return"XDEFI Wallet";if(n.isZeal)return"Zeal";if(n.isZerion)return"Zerion";if(n.isMetaMask)return"MetaMask"};if((t=e.providers)!=null&&t.length){const n=new Set;let r=1;for(const a of e.providers){let s=u(a);s||(s=`Unknown Wallet #${r}`,r+=1),n.add(s)}const i=[...n];return i.length?i:i[0]??"Injected"}return u(e)??"Injected"}var c9,Co=class extends Hc{constructor({chains:e,options:u}={}){const t={shimDisconnect:!0,getProvider(){if(typeof window>"u")return;const r=window.ethereum;return r!=null&&r.providers&&r.providers.length>0?r.providers[0]:r},...u};super({chains:e,options:t}),this.id="injected",S0(this,c9,void 0),this.shimDisconnectKey=`${this.id}.shimDisconnect`,this.onAccountsChanged=r=>{r.length===0?this.emit("disconnect"):this.emit("change",{account:oe(r[0])})},this.onChainChanged=r=>{const i=qa(r),a=this.isChainUnsupported(i);this.emit("change",{chain:{id:i,unsupported:a}})},this.onDisconnect=async r=>{var i;r.code===1013&&await this.getProvider()&&await this.getAccount()||(this.emit("disconnect"),this.options.shimDisconnect&&((i=this.storage)==null||i.removeItem(this.shimDisconnectKey)))};const n=t.getProvider();if(typeof t.name=="string")this.name=t.name;else if(n){const r=_M(n);t.name?this.name=t.name(r):typeof r=="string"?this.name=r:this.name=r[0]}else this.name="Injected";this.ready=!!n}async connect({chainId:e}={}){var u;try{const t=await this.getProvider();if(!t)throw new ke;t.on&&(t.on("accountsChanged",this.onAccountsChanged),t.on("chainChanged",this.onChainChanged),t.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});const n=await t.request({method:"eth_requestAccounts"}),r=oe(n[0]);let i=await this.getChainId(),a=this.isChainUnsupported(i);return e&&i!==e&&(i=(await this.switchChain(e)).id,a=this.isChainUnsupported(i)),this.options.shimDisconnect&&((u=this.storage)==null||u.setItem(this.shimDisconnectKey,!0)),{account:r,chain:{id:i,unsupported:a}}}catch(t){throw this.isUserRejectedRequestError(t)?new O0(t):t.code===-32002?new Di(t):t}}async disconnect(){var u;const e=await this.getProvider();e!=null&&e.removeListener&&(e.removeListener("accountsChanged",this.onAccountsChanged),e.removeListener("chainChanged",this.onChainChanged),e.removeListener("disconnect",this.onDisconnect),this.options.shimDisconnect&&((u=this.storage)==null||u.removeItem(this.shimDisconnectKey)))}async getAccount(){const e=await this.getProvider();if(!e)throw new ke;const u=await e.request({method:"eth_accounts"});return oe(u[0])}async getChainId(){const e=await this.getProvider();if(!e)throw new ke;return e.request({method:"eth_chainId"}).then(qa)}async getProvider(){const e=this.options.getProvider();return e&&hr(this,c9,e),Hu(this,c9)}async getWalletClient({chainId:e}={}){const[u,t]=await Promise.all([this.getProvider(),this.getAccount()]),n=this.chains.find(r=>r.id===e);if(!u)throw new Error("provider is required.");return qc({account:t,chain:n,transport:$c(u)})}async isAuthorized(){var e;try{if(this.options.shimDisconnect&&!((e=this.storage)!=null&&e.getItem(this.shimDisconnectKey)))return!1;if(!await this.getProvider())throw new ke;return!!await this.getAccount()}catch{return!1}}async switchChain(e){var n,r,i;const u=await this.getProvider();if(!u)throw new ke;const t=Lu(e);try{return await Promise.all([u.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),new Promise(a=>this.on("change",({chain:s})=>{(s==null?void 0:s.id)===e&&a()}))]),this.chains.find(a=>a.id===e)??{id:e,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(a){const s=this.chains.find(o=>o.id===e);if(!s)throw new Kb({chainId:e,connectorId:this.id});if(a.code===4902||((r=(n=a==null?void 0:a.data)==null?void 0:n.originalError)==null?void 0:r.code)===4902)try{if(await u.request({method:"wallet_addEthereumChain",params:[{chainId:t,chainName:s.name,nativeCurrency:s.nativeCurrency,rpcUrls:[((i=s.rpcUrls.public)==null?void 0:i.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(s)}]}),await this.getChainId()!==e)throw new O0(new Error("User rejected switch after adding network."));return s}catch(o){throw new O0(o)}throw this.isUserRejectedRequestError(a)?new O0(a):new kn(a)}}async watchAsset({address:e,decimals:u=18,image:t,symbol:n}){const r=await this.getProvider();if(!r)throw new ke;return r.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,decimals:u,image:t,symbol:n}}})}isUserRejectedRequestError(e){return e.code===4001}};c9=new WeakMap;var qC=(e,u,t)=>{if(!u.has(e))throw TypeError("Cannot "+t)},C6=(e,u,t)=>(qC(e,u,"read from private field"),t?t.call(e):u.get(e)),m6=(e,u,t)=>{if(u.has(e))throw TypeError("Cannot add the same private member more than once");u instanceof WeakSet?u.add(e):u.set(e,t)},IE=(e,u,t,n)=>(qC(e,u,"write to private field"),n?n.call(e,t):u.set(e,t),t),SM=(e,u,t)=>(qC(e,u,"access private method"),t);const PM=e=>(u,t,n)=>{const r=n.subscribe;return n.subscribe=(a,s,o)=>{let l=a;if(s){const c=(o==null?void 0:o.equalityFn)||Object.is;let E=a(n.getState());l=d=>{const f=a(d);if(!c(E,f)){const p=E;s(E=f,p)}},o!=null&&o.fireImmediately&&s(E,E)}return r(l)},e(u,t,n)},TM=PM;function OM(e,u){let t;try{t=e()}catch{return}return{getItem:r=>{var i;const a=o=>o===null?null:JSON.parse(o,u==null?void 0:u.reviver),s=(i=t.getItem(r))!=null?i:null;return s instanceof Promise?s.then(a):a(s)},setItem:(r,i)=>t.setItem(r,JSON.stringify(i,u==null?void 0:u.replacer)),removeItem:r=>t.removeItem(r)}}const zl=e=>u=>{try{const t=e(u);return t instanceof Promise?t:{then(n){return zl(n)(t)},catch(n){return this}}}catch(t){return{then(n){return this},catch(n){return zl(n)(t)}}}},IM=(e,u)=>(t,n,r)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:g=>g,version:0,merge:(g,A)=>({...A,...g}),...u},a=!1;const s=new Set,o=new Set;let l;try{l=i.getStorage()}catch{}if(!l)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),t(...g)},n,r);const c=zl(i.serialize),E=()=>{const g=i.partialize({...n()});let A;const m=c({state:g,version:i.version}).then(B=>l.setItem(i.name,B)).catch(B=>{A=B});if(A)throw A;return m},d=r.setState;r.setState=(g,A)=>{d(g,A),E()};const f=e((...g)=>{t(...g),E()},n,r);let p;const h=()=>{var g;if(!l)return;a=!1,s.forEach(m=>m(n()));const A=((g=i.onRehydrateStorage)==null?void 0:g.call(i,n()))||void 0;return zl(l.getItem.bind(l))(i.name).then(m=>{if(m)return i.deserialize(m)}).then(m=>{if(m)if(typeof m.version=="number"&&m.version!==i.version){if(i.migrate)return i.migrate(m.state,m.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return m.state}).then(m=>{var B;return p=i.merge(m,(B=n())!=null?B:f),t(p,!0),E()}).then(()=>{A==null||A(p,void 0),a=!0,o.forEach(m=>m(p))}).catch(m=>{A==null||A(void 0,m)})};return r.persist={setOptions:g=>{i={...i,...g},g.getStorage&&(l=g.getStorage())},clearStorage:()=>{l==null||l.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>h(),hasHydrated:()=>a,onHydrate:g=>(s.add(g),()=>{s.delete(g)}),onFinishHydration:g=>(o.add(g),()=>{o.delete(g)})},h(),p||f},NM=(e,u)=>(t,n,r)=>{let i={storage:OM(()=>localStorage),partialize:h=>h,version:0,merge:(h,g)=>({...g,...h}),...u},a=!1;const s=new Set,o=new Set;let l=i.storage;if(!l)return e((...h)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),t(...h)},n,r);const c=()=>{const h=i.partialize({...n()});return l.setItem(i.name,{state:h,version:i.version})},E=r.setState;r.setState=(h,g)=>{E(h,g),c()};const d=e((...h)=>{t(...h),c()},n,r);let f;const p=()=>{var h,g;if(!l)return;a=!1,s.forEach(m=>{var B;return m((B=n())!=null?B:d)});const A=((g=i.onRehydrateStorage)==null?void 0:g.call(i,(h=n())!=null?h:d))||void 0;return zl(l.getItem.bind(l))(i.name).then(m=>{if(m)if(typeof m.version=="number"&&m.version!==i.version){if(i.migrate)return i.migrate(m.state,m.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return m.state}).then(m=>{var B;return f=i.merge(m,(B=n())!=null?B:d),t(f,!0),c()}).then(()=>{A==null||A(f,void 0),f=n(),a=!0,o.forEach(m=>m(f))}).catch(m=>{A==null||A(void 0,m)})};return r.persist={setOptions:h=>{i={...i,...h},h.storage&&(l=h.storage)},clearStorage:()=>{l==null||l.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>p(),hasHydrated:()=>a,onHydrate:h=>(s.add(h),()=>{s.delete(h)}),onFinishHydration:h=>(o.add(h),()=>{o.delete(h)})},i.skipHydration||p(),f||d},RM=(e,u)=>"getStorage"in u||"serialize"in u||"deserialize"in u?IM(e,u):NM(e,u),zM=RM,EA=e=>{let u;const t=new Set,n=(o,l)=>{const c=typeof o=="function"?o(u):o;if(!Object.is(c,u)){const E=u;u=l??typeof c!="object"?c:Object.assign({},u,c),t.forEach(d=>d(u,E))}},r=()=>u,s={setState:n,getState:r,subscribe:o=>(t.add(o),()=>t.delete(o)),destroy:()=>{t.clear()}};return u=e(n,r,s),s},jM=e=>e?EA(e):EA;function Jb(e,u){if(Object.is(e,u))return!0;if(typeof e!="object"||e===null||typeof u!="object"||u===null)return!1;if(e instanceof Map&&u instanceof Map){if(e.size!==u.size)return!1;for(const[n,r]of e)if(!Object.is(r,u.get(n)))return!1;return!0}if(e instanceof Set&&u instanceof Set){if(e.size!==u.size)return!1;for(const n of e)if(!u.has(n))return!1;return!0}const t=Object.keys(e);if(t.length!==Object.keys(u).length)return!1;for(let n=0;nh===E.id)||(o=[...o,p.chain]),l[E.id]=[...l[E.id]||[],...p.rpcUrls.http],p.rpcUrls.webSocket&&(c[E.id]=[...c[E.id]||[],...p.rpcUrls.webSocket]))}if(!d)throw new Error([`Could not find valid provider configuration for chain "${E.name}". `,"You may need to add `jsonRpcProvider` to `configureChains` with the chain's RPC URLs.","Read more: https://wagmi.sh/core/providers/jsonRpc"].join(` -`))}return{chains:o,publicClient:({chainId:E})=>{const d=o.find(h=>h.id===E)??e[0],f=l[d.id];if(!f||!f[0])throw new Error(`No providers configured for chain "${d.id}"`);const p=iA({batch:t,chain:d,transport:eA(f.map(h=>Iz(h,{timeout:s})),{rank:r,retryCount:i,retryDelay:a}),pollingInterval:n});return Object.assign(p,{chains:o})},webSocketPublicClient:({chainId:E})=>{const d=o.find(h=>h.id===E)??e[0],f=c[d.id];if(!f||!f[0])return;const p=iA({batch:t,chain:d,transport:eA(f.map(h=>Vj(h,{timeout:s})),{rank:r,retryCount:i,retryDelay:a}),pollingInterval:n});return Object.assign(p,{chains:o})}}}var LM=class extends Error{constructor({activeChain:e,targetChain:u}){super(`Chain mismatch: Expected "${u}", received "${e}".`),this.name="ChainMismatchError"}},UM=class extends Error{constructor({chainId:e,connectorId:u}){super(`Chain "${e}" not configured${u?` for connector "${u}"`:""}.`),this.name="ChainNotConfigured"}},$M=class extends Error{constructor(){super(...arguments),this.name="ConnectorAlreadyConnectedError",this.message="Connector already connected"}},WM=class extends Error{constructor(){super(...arguments),this.name="ConfigChainsNotFound",this.message="No chains were found on the wagmi config. Some functions that require a chain may not work."}},qM=class extends Error{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),this.name="SwitchChainNotSupportedError"}};function s2(e,u){if(e===u)return!0;if(e&&u&&typeof e=="object"&&typeof u=="object"){if(e.constructor!==u.constructor)return!1;let t,n;if(Array.isArray(e)&&Array.isArray(u)){if(t=e.length,t!=u.length)return!1;for(n=t;n--!==0;)if(!s2(e[n],u[n]))return!1;return!0}if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===u.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===u.toString();const r=Object.keys(e);if(t=r.length,t!==Object.keys(u).length)return!1;for(n=t;n--!==0;)if(!Object.prototype.hasOwnProperty.call(u,r[n]))return!1;for(n=t;n--!==0;){const i=r[n];if(i&&!s2(e[i],u[i]))return!1}return!0}return e!==e&&u!==u}var Pp=(e,{find:u,replace:t})=>e&&u(e)?t(e):typeof e!="object"?e:Array.isArray(e)?e.map(n=>Pp(n,{find:u,replace:t})):e instanceof Object?Object.entries(e).reduce((n,[r,i])=>({...n,[r]:Pp(i,{find:u,replace:t})}),{}):e;function HM(e){const u=JSON.parse(e);return Pp(u,{find:n=>typeof n=="string"&&n.startsWith("#bigint."),replace:n=>BigInt(n.replace("#bigint.",""))})}function GM(e){return{accessList:e.accessList,account:e.account,blockNumber:e.blockNumber,blockTag:e.blockTag,data:e.data,gas:e.gas,gasPrice:e.gasPrice,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce,to:e.to,value:e.value}}function QM(e){return{accessList:e.accessList,account:e.account,data:e.data,gas:e.gas,gasPrice:e.gasPrice,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce,to:e.to,value:e.value}}function dA(e){return typeof e=="number"?e:e==="wei"?0:Math.abs(ON[e])}function fA(e,u){return e.slice(0,u).join(".")||"."}function pA(e,u){const{length:t}=e;for(let n=0;n{const a=typeof i=="bigint"?`#bigint.${i.toString()}`:i;return(u==null?void 0:u(r,a))||a},n),t??void 0)}var Yb={getItem:e=>"",setItem:(e,u)=>null,removeItem:e=>null};function Zb({deserialize:e=HM,key:u="wagmi",serialize:t=VM,storage:n}){return{...n,getItem:(r,i=null)=>{const a=n.getItem(`${u}.${r}`);try{return a?e(a):i}catch(s){return console.warn(s),i}},setItem:(r,i)=>{if(i===null)n.removeItem(`${u}.${r}`);else try{n.setItem(`${u}.${r}`,t(i))}catch(a){console.error(a)}},removeItem:r=>n.removeItem(`${u}.${r}`)}}var hA="store",hs,b3,Tp,Xb,JM=class{constructor({autoConnect:e=!1,connectors:u=[new Co],publicClient:t,storage:n=Zb({storage:typeof window<"u"?window.localStorage:Yb}),logger:r={warn:console.warn},webSocketPublicClient:i}){var l,c;m6(this,Tp),this.publicClients=new Map,this.webSocketPublicClients=new Map,m6(this,hs,void 0),m6(this,b3,void 0),this.args={autoConnect:e,connectors:u,logger:r,publicClient:t,storage:n,webSocketPublicClient:i};let a="disconnected",s;if(e)try{const E=n.getItem(hA),d=(l=E==null?void 0:E.state)==null?void 0:l.data;a=d!=null&&d.account?"reconnecting":"connecting",s=(c=d==null?void 0:d.chain)==null?void 0:c.id}catch{}const o=typeof u=="function"?u():u;o.forEach(E=>E.setStorage(n)),this.store=jM(TM(zM(()=>({connectors:o,publicClient:this.getPublicClient({chainId:s}),status:a,webSocketPublicClient:this.getWebSocketPublicClient({chainId:s})}),{name:hA,storage:n,partialize:E=>{var d,f;return{...e&&{data:{account:(d=E==null?void 0:E.data)==null?void 0:d.account,chain:(f=E==null?void 0:E.data)==null?void 0:f.chain}},chains:E==null?void 0:E.chains}},version:2}))),this.storage=n,IE(this,b3,n==null?void 0:n.getItem("wallet")),SM(this,Tp,Xb).call(this),e&&typeof window<"u"&&setTimeout(async()=>await this.autoConnect(),0)}get chains(){return this.store.getState().chains}get connectors(){return this.store.getState().connectors}get connector(){return this.store.getState().connector}get data(){return this.store.getState().data}get error(){return this.store.getState().error}get lastUsedChainId(){var e,u;return(u=(e=this.data)==null?void 0:e.chain)==null?void 0:u.id}get publicClient(){return this.store.getState().publicClient}get status(){return this.store.getState().status}get subscribe(){return this.store.subscribe}get webSocketPublicClient(){return this.store.getState().webSocketPublicClient}setState(e){const u=typeof e=="function"?e(this.store.getState()):e;this.store.setState(u,!0)}clearState(){this.setState(e=>({...e,chains:void 0,connector:void 0,data:void 0,error:void 0,status:"disconnected"}))}async destroy(){var e,u;this.connector&&await((u=(e=this.connector).disconnect)==null?void 0:u.call(e)),IE(this,hs,!1),this.clearState(),this.store.destroy()}async autoConnect(){if(C6(this,hs))return;IE(this,hs,!0),this.setState(t=>{var n;return{...t,status:(n=t.data)!=null&&n.account?"reconnecting":"connecting"}});const e=C6(this,b3)?[...this.connectors].sort(t=>t.id===C6(this,b3)?-1:1):this.connectors;let u=!1;for(const t of e){if(!t.ready||!t.isAuthorized||!await t.isAuthorized())continue;const r=await t.connect();this.setState(i=>({...i,connector:t,chains:t==null?void 0:t.chains,data:r,status:"connected"})),u=!0;break}return u||this.setState(t=>({...t,data:void 0,status:"disconnected"})),IE(this,hs,!1),this.data}setConnectors(e){this.args={...this.args,connectors:e};const u=typeof e=="function"?e():e;u.forEach(t=>t.setStorage(this.args.storage)),this.setState(t=>({...t,connectors:u}))}getPublicClient({chainId:e}={}){let u=this.publicClients.get(-1);if(u&&(u==null?void 0:u.chain.id)===e||(u=this.publicClients.get(e??-1),u))return u;const{publicClient:t}=this.args;return u=typeof t=="function"?t({chainId:e}):t,this.publicClients.set(e??-1,u),u}setPublicClient(e){var t,n;const u=(n=(t=this.data)==null?void 0:t.chain)==null?void 0:n.id;this.args={...this.args,publicClient:e},this.publicClients.clear(),this.setState(r=>({...r,publicClient:this.getPublicClient({chainId:u})}))}getWebSocketPublicClient({chainId:e}={}){let u=this.webSocketPublicClients.get(-1);if(u&&(u==null?void 0:u.chain.id)===e||(u=this.webSocketPublicClients.get(e??-1),u))return u;const{webSocketPublicClient:t}=this.args;return u=typeof t=="function"?t({chainId:e}):t,u&&this.webSocketPublicClients.set(e??-1,u),u}setWebSocketPublicClient(e){var t,n;const u=(n=(t=this.data)==null?void 0:t.chain)==null?void 0:n.id;this.args={...this.args,webSocketPublicClient:e},this.webSocketPublicClients.clear(),this.setState(r=>({...r,webSocketPublicClient:this.getWebSocketPublicClient({chainId:u})}))}setLastUsedConnector(e=null){var u;(u=this.storage)==null||u.setItem("wallet",e)}};hs=new WeakMap;b3=new WeakMap;Tp=new WeakSet;Xb=function(){const e=s=>{this.setState(o=>({...o,data:{...o.data,...s}}))},u=()=>{this.clearState()},t=s=>{this.setState(o=>({...o,error:s}))};this.store.subscribe(({connector:s})=>s,(s,o)=>{var l,c,E,d,f,p;(l=o==null?void 0:o.off)==null||l.call(o,"change",e),(c=o==null?void 0:o.off)==null||c.call(o,"disconnect",u),(E=o==null?void 0:o.off)==null||E.call(o,"error",t),s&&((d=s.on)==null||d.call(s,"change",e),(f=s.on)==null||f.call(s,"disconnect",u),(p=s.on)==null||p.call(s,"error",t))});const{publicClient:n,webSocketPublicClient:r}=this.args;(typeof n=="function"||typeof r=="function")&&this.store.subscribe(({data:s})=>{var o;return(o=s==null?void 0:s.chain)==null?void 0:o.id},s=>{this.setState(o=>({...o,publicClient:this.getPublicClient({chainId:s}),webSocketPublicClient:this.getWebSocketPublicClient({chainId:s})}))})};var Op;function YM(e){const u=new JM(e);return Op=u,u}function ut(){if(!Op)throw new Error("No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config");return Op}async function ZM({chainId:e,connector:u}){const t=ut(),n=t.connector;if(n&&u.id===n.id)throw new $M;try{t.setState(i=>({...i,status:"connecting"}));const r=await u.connect({chainId:e});return t.setLastUsedConnector(u.id),t.setState(i=>({...i,connector:u,chains:u==null?void 0:u.chains,data:r,status:"connected"})),t.storage.setItem("connected",!0),{...r,connector:u}}catch(r){throw t.setState(i=>({...i,status:i.connector?"connected":"disconnected"})),r}}async function XM(){const e=ut();e.connector&&await e.connector.disconnect(),e.clearState(),e.storage.removeItem("connected")}var uL=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],eL=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bytes32"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bytes32"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}];function xt({chainId:e}={}){const u=ut();return e&&u.getPublicClient({chainId:e})||u.publicClient}async function HC({chainId:e}={}){var n,r;return await((r=(n=ut().connector)==null?void 0:n.getWalletClient)==null?void 0:r.call(n,{chainId:e}))||null}function Ip({chainId:e}={}){const u=ut();return e&&u.getWebSocketPublicClient({chainId:e})||u.webSocketPublicClient}function tL(e,u){const t=ut(),n=async()=>u(xt(e));return t.subscribe(({publicClient:i})=>i,n)}function nL(e,u){const t=ut(),n=async()=>u(Ip(e));return t.subscribe(({webSocketPublicClient:i})=>i,n)}async function rL({abi:e,address:u,args:t,chainId:n,dataSuffix:r,functionName:i,walletClient:a,...s}){const o=xt({chainId:n}),l=a??await HC({chainId:n});if(!l)throw new ke;n&&tw({chainId:n});const{account:c,accessList:E,blockNumber:d,blockTag:f,gas:p,gasPrice:h,maxFeePerGas:g,maxPriorityFeePerGas:A,nonce:m,value:B}=GM(s),{result:F,request:w}=await o.simulateContract({abi:e,address:u,functionName:i,args:t,account:c||l.account,accessList:E,blockNumber:d,blockTag:f,dataSuffix:r,gas:p,gasPrice:h,maxFeePerGas:g,maxPriorityFeePerGas:A,nonce:m,value:B}),v=e.filter(C=>"name"in C&&C.name===i);return{mode:"prepared",request:{...w,abi:v,chainId:n},result:F}}async function iL({chainId:e,contracts:u,blockNumber:t,blockTag:n,...r}){const i=xt({chainId:e});if(!i.chains)throw new WM;if(e&&i.chain.id!==e)throw new UM({chainId:e});return i.multicall({allowFailure:r.allowFailure??!0,blockNumber:t,blockTag:n,contracts:u})}async function uw({address:e,account:u,chainId:t,abi:n,args:r,functionName:i,blockNumber:a,blockTag:s}){return xt({chainId:t}).readContract({abi:n,address:e,account:u,functionName:i,args:r,blockNumber:a,blockTag:s})}async function aL({contracts:e,blockNumber:u,blockTag:t,...n}){const{allowFailure:r=!0}=n;try{const i=xt(),a=e.reduce((c,E,d)=>{const f=E.chainId??i.chain.id;return{...c,[f]:[...c[f]||[],{contract:E,index:d}]}},{}),s=()=>Object.entries(a).map(([c,E])=>iL({allowFailure:r,chainId:parseInt(c),contracts:E.map(({contract:d})=>d),blockNumber:u,blockTag:t})),o=(await Promise.all(s())).flat(),l=Object.values(a).flatMap(c=>c.map(({index:E})=>E));return o.reduce((c,E,d)=>(c&&(c[l[d]]=E),c),[])}catch(i){if(i instanceof FC)throw i;const a=()=>e.map(s=>uw({...s,blockNumber:u,blockTag:t}));return r?(await Promise.allSettled(a())).map(s=>s.status==="fulfilled"?{result:s.value,status:"success"}:{error:s.reason,result:void 0,status:"failure"}):await Promise.all(a())}}async function CA(e){const u=await HC({chainId:e.chainId});if(!u)throw new ke;e.chainId&&tw({chainId:e.chainId});let t;if(e.mode==="prepared")t=e.request;else{const{chainId:r,mode:i,...a}=e;t=(await rL(a)).request}return{hash:await u.writeContract({...t,chain:e.chainId?{id:e.chainId}:null})}}async function sL({address:e,chainId:u,formatUnits:t,token:n}){const r=ut(),i=xt({chainId:u});if(n){const l=async({abi:c})=>{const E={abi:c,address:n,chainId:u},[d,f,p]=await aL({allowFailure:!1,contracts:[{...E,functionName:"balanceOf",args:[e]},{...E,functionName:"decimals"},{...E,functionName:"symbol"}]});return{decimals:f,formatted:u2(d??"0",dA(t??f)),symbol:p,value:d}};try{return await l({abi:uL})}catch(c){if(c instanceof FC){const{symbol:E,...d}=await l({abi:eL});return{symbol:oC(Pa(E,{dir:"right"})),...d}}throw c}}const a=[...r.publicClient.chains||[],...r.chains??[]],s=await i.getBalance({address:e}),o=a.find(l=>l.id===i.chain.id);return{decimals:(o==null?void 0:o.nativeCurrency.decimals)??18,formatted:u2(s??"0",dA(t??18)),symbol:(o==null?void 0:o.nativeCurrency.symbol)??"ETH",value:s}}function ew(){const{data:e,connector:u,status:t}=ut();switch(t){case"connected":return{address:e==null?void 0:e.account,connector:u,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:t};case"reconnecting":return{address:e==null?void 0:e.account,connector:u,isConnected:!!(e!=null&&e.account),isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:t};case"connecting":return{address:e==null?void 0:e.account,connector:u,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:t};case"disconnected":return{address:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:t}}}function GC(){var r,i,a,s;const e=ut(),u=(i=(r=e.data)==null?void 0:r.chain)==null?void 0:i.id,t=e.chains??[],n=[...((a=e.publicClient)==null?void 0:a.chains)||[],...t].find(o=>o.id===u)??{id:u,name:`Chain ${u}`,network:`${u}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}};return{chain:u?{...n,...(s=e.data)==null?void 0:s.chain,id:u}:void 0,chains:t}}async function oL(e){const u=await HC();if(!u)throw new ke;return await u.signMessage({message:e.message})}async function lL({chainId:e}){const{connector:u}=ut();if(!u)throw new ke;if(!u.switchChain)throw new qM({connector:u});return u.switchChain(e)}function cL(e,{selector:u=t=>t}={}){const t=ut(),n=()=>e(ew());return t.subscribe(({data:i,connector:a,status:s})=>u({address:i==null?void 0:i.account,connector:a,status:s}),n,{equalityFn:Jb})}function EL(e,{selector:u=t=>t}={}){const t=ut(),n=()=>e(GC());return t.subscribe(({data:i,chains:a})=>{var s;return u({chainId:(s=i==null?void 0:i.chain)==null?void 0:s.id,chains:a})},n,{equalityFn:Jb})}async function dL({name:e,chainId:u}){const{normalize:t}=await Uu(()=>import("./index-56ee0b27.js"),[]);return await xt({chainId:u}).getEnsAvatar({name:t(e)})}async function fL({address:e,chainId:u}){return xt({chainId:u}).getEnsName({address:oe(e)})}async function pL({chainId:e}={}){return await xt({chainId:e}).getBlockNumber()}async function hL({chainId:e,confirmations:u=1,hash:t,onReplaced:n,timeout:r=0}){const i=xt({chainId:e}),a=await i.waitForTransactionReceipt({hash:t,confirmations:u,onReplaced:n,timeout:r});if(a.status==="reverted"){const s=await i.getTransaction({hash:a.transactionHash}),o=await i.call({...s,gasPrice:s.type!=="eip1559"?s.gasPrice:void 0,maxFeePerGas:s.type==="eip1559"?s.maxFeePerGas:void 0,maxPriorityFeePerGas:s.type==="eip1559"?s.maxPriorityFeePerGas:void 0}),l=oC(`0x${o.substring(138)}`);throw new Error(l)}return a}function tw({chainId:e}){var r,i;const{chain:u,chains:t}=GC(),n=u==null?void 0:u.id;if(n&&e!==n)throw new LM({activeChain:((r=t.find(a=>a.id===n))==null?void 0:r.name)??`Chain ${n}`,targetChain:((i=t.find(a=>a.id===e))==null?void 0:i.name)??`Chain ${e}`})}var nw={exports:{}},rw={};/** +`))}return{chains:o,publicClient:({chainId:E})=>{const d=o.find(h=>h.id===E)??e[0],f=l[d.id];if(!f||!f[0])throw new Error(`No providers configured for chain "${d.id}"`);const p=iA({batch:t,chain:d,transport:eA(f.map(h=>Iz(h,{timeout:s})),{rank:r,retryCount:i,retryDelay:a}),pollingInterval:n});return Object.assign(p,{chains:o})},webSocketPublicClient:({chainId:E})=>{const d=o.find(h=>h.id===E)??e[0],f=c[d.id];if(!f||!f[0])return;const p=iA({batch:t,chain:d,transport:eA(f.map(h=>Vj(h,{timeout:s})),{rank:r,retryCount:i,retryDelay:a}),pollingInterval:n});return Object.assign(p,{chains:o})}}}var LM=class extends Error{constructor({activeChain:e,targetChain:u}){super(`Chain mismatch: Expected "${u}", received "${e}".`),this.name="ChainMismatchError"}},UM=class extends Error{constructor({chainId:e,connectorId:u}){super(`Chain "${e}" not configured${u?` for connector "${u}"`:""}.`),this.name="ChainNotConfigured"}},$M=class extends Error{constructor(){super(...arguments),this.name="ConnectorAlreadyConnectedError",this.message="Connector already connected"}},WM=class extends Error{constructor(){super(...arguments),this.name="ConfigChainsNotFound",this.message="No chains were found on the wagmi config. Some functions that require a chain may not work."}},qM=class extends Error{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),this.name="SwitchChainNotSupportedError"}};function s2(e,u){if(e===u)return!0;if(e&&u&&typeof e=="object"&&typeof u=="object"){if(e.constructor!==u.constructor)return!1;let t,n;if(Array.isArray(e)&&Array.isArray(u)){if(t=e.length,t!=u.length)return!1;for(n=t;n--!==0;)if(!s2(e[n],u[n]))return!1;return!0}if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===u.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===u.toString();const r=Object.keys(e);if(t=r.length,t!==Object.keys(u).length)return!1;for(n=t;n--!==0;)if(!Object.prototype.hasOwnProperty.call(u,r[n]))return!1;for(n=t;n--!==0;){const i=r[n];if(i&&!s2(e[i],u[i]))return!1}return!0}return e!==e&&u!==u}var Pp=(e,{find:u,replace:t})=>e&&u(e)?t(e):typeof e!="object"?e:Array.isArray(e)?e.map(n=>Pp(n,{find:u,replace:t})):e instanceof Object?Object.entries(e).reduce((n,[r,i])=>({...n,[r]:Pp(i,{find:u,replace:t})}),{}):e;function HM(e){const u=JSON.parse(e);return Pp(u,{find:n=>typeof n=="string"&&n.startsWith("#bigint."),replace:n=>BigInt(n.replace("#bigint.",""))})}function GM(e){return{accessList:e.accessList,account:e.account,blockNumber:e.blockNumber,blockTag:e.blockTag,data:e.data,gas:e.gas,gasPrice:e.gasPrice,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce,to:e.to,value:e.value}}function QM(e){return{accessList:e.accessList,account:e.account,data:e.data,gas:e.gas,gasPrice:e.gasPrice,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce,to:e.to,value:e.value}}function dA(e){return typeof e=="number"?e:e==="wei"?0:Math.abs(ON[e])}function fA(e,u){return e.slice(0,u).join(".")||"."}function pA(e,u){const{length:t}=e;for(let n=0;n{const a=typeof i=="bigint"?`#bigint.${i.toString()}`:i;return(u==null?void 0:u(r,a))||a},n),t??void 0)}var Yb={getItem:e=>"",setItem:(e,u)=>null,removeItem:e=>null};function Zb({deserialize:e=HM,key:u="wagmi",serialize:t=VM,storage:n}){return{...n,getItem:(r,i=null)=>{const a=n.getItem(`${u}.${r}`);try{return a?e(a):i}catch(s){return console.warn(s),i}},setItem:(r,i)=>{if(i===null)n.removeItem(`${u}.${r}`);else try{n.setItem(`${u}.${r}`,t(i))}catch(a){console.error(a)}},removeItem:r=>n.removeItem(`${u}.${r}`)}}var hA="store",hs,b3,Tp,Xb,JM=class{constructor({autoConnect:e=!1,connectors:u=[new Co],publicClient:t,storage:n=Zb({storage:typeof window<"u"?window.localStorage:Yb}),logger:r={warn:console.warn},webSocketPublicClient:i}){var l,c;m6(this,Tp),this.publicClients=new Map,this.webSocketPublicClients=new Map,m6(this,hs,void 0),m6(this,b3,void 0),this.args={autoConnect:e,connectors:u,logger:r,publicClient:t,storage:n,webSocketPublicClient:i};let a="disconnected",s;if(e)try{const E=n.getItem(hA),d=(l=E==null?void 0:E.state)==null?void 0:l.data;a=d!=null&&d.account?"reconnecting":"connecting",s=(c=d==null?void 0:d.chain)==null?void 0:c.id}catch{}const o=typeof u=="function"?u():u;o.forEach(E=>E.setStorage(n)),this.store=jM(TM(zM(()=>({connectors:o,publicClient:this.getPublicClient({chainId:s}),status:a,webSocketPublicClient:this.getWebSocketPublicClient({chainId:s})}),{name:hA,storage:n,partialize:E=>{var d,f;return{...e&&{data:{account:(d=E==null?void 0:E.data)==null?void 0:d.account,chain:(f=E==null?void 0:E.data)==null?void 0:f.chain}},chains:E==null?void 0:E.chains}},version:2}))),this.storage=n,IE(this,b3,n==null?void 0:n.getItem("wallet")),SM(this,Tp,Xb).call(this),e&&typeof window<"u"&&setTimeout(async()=>await this.autoConnect(),0)}get chains(){return this.store.getState().chains}get connectors(){return this.store.getState().connectors}get connector(){return this.store.getState().connector}get data(){return this.store.getState().data}get error(){return this.store.getState().error}get lastUsedChainId(){var e,u;return(u=(e=this.data)==null?void 0:e.chain)==null?void 0:u.id}get publicClient(){return this.store.getState().publicClient}get status(){return this.store.getState().status}get subscribe(){return this.store.subscribe}get webSocketPublicClient(){return this.store.getState().webSocketPublicClient}setState(e){const u=typeof e=="function"?e(this.store.getState()):e;this.store.setState(u,!0)}clearState(){this.setState(e=>({...e,chains:void 0,connector:void 0,data:void 0,error:void 0,status:"disconnected"}))}async destroy(){var e,u;this.connector&&await((u=(e=this.connector).disconnect)==null?void 0:u.call(e)),IE(this,hs,!1),this.clearState(),this.store.destroy()}async autoConnect(){if(C6(this,hs))return;IE(this,hs,!0),this.setState(t=>{var n;return{...t,status:(n=t.data)!=null&&n.account?"reconnecting":"connecting"}});const e=C6(this,b3)?[...this.connectors].sort(t=>t.id===C6(this,b3)?-1:1):this.connectors;let u=!1;for(const t of e){if(!t.ready||!t.isAuthorized||!await t.isAuthorized())continue;const r=await t.connect();this.setState(i=>({...i,connector:t,chains:t==null?void 0:t.chains,data:r,status:"connected"})),u=!0;break}return u||this.setState(t=>({...t,data:void 0,status:"disconnected"})),IE(this,hs,!1),this.data}setConnectors(e){this.args={...this.args,connectors:e};const u=typeof e=="function"?e():e;u.forEach(t=>t.setStorage(this.args.storage)),this.setState(t=>({...t,connectors:u}))}getPublicClient({chainId:e}={}){let u=this.publicClients.get(-1);if(u&&(u==null?void 0:u.chain.id)===e||(u=this.publicClients.get(e??-1),u))return u;const{publicClient:t}=this.args;return u=typeof t=="function"?t({chainId:e}):t,this.publicClients.set(e??-1,u),u}setPublicClient(e){var t,n;const u=(n=(t=this.data)==null?void 0:t.chain)==null?void 0:n.id;this.args={...this.args,publicClient:e},this.publicClients.clear(),this.setState(r=>({...r,publicClient:this.getPublicClient({chainId:u})}))}getWebSocketPublicClient({chainId:e}={}){let u=this.webSocketPublicClients.get(-1);if(u&&(u==null?void 0:u.chain.id)===e||(u=this.webSocketPublicClients.get(e??-1),u))return u;const{webSocketPublicClient:t}=this.args;return u=typeof t=="function"?t({chainId:e}):t,u&&this.webSocketPublicClients.set(e??-1,u),u}setWebSocketPublicClient(e){var t,n;const u=(n=(t=this.data)==null?void 0:t.chain)==null?void 0:n.id;this.args={...this.args,webSocketPublicClient:e},this.webSocketPublicClients.clear(),this.setState(r=>({...r,webSocketPublicClient:this.getWebSocketPublicClient({chainId:u})}))}setLastUsedConnector(e=null){var u;(u=this.storage)==null||u.setItem("wallet",e)}};hs=new WeakMap;b3=new WeakMap;Tp=new WeakSet;Xb=function(){const e=s=>{this.setState(o=>({...o,data:{...o.data,...s}}))},u=()=>{this.clearState()},t=s=>{this.setState(o=>({...o,error:s}))};this.store.subscribe(({connector:s})=>s,(s,o)=>{var l,c,E,d,f,p;(l=o==null?void 0:o.off)==null||l.call(o,"change",e),(c=o==null?void 0:o.off)==null||c.call(o,"disconnect",u),(E=o==null?void 0:o.off)==null||E.call(o,"error",t),s&&((d=s.on)==null||d.call(s,"change",e),(f=s.on)==null||f.call(s,"disconnect",u),(p=s.on)==null||p.call(s,"error",t))});const{publicClient:n,webSocketPublicClient:r}=this.args;(typeof n=="function"||typeof r=="function")&&this.store.subscribe(({data:s})=>{var o;return(o=s==null?void 0:s.chain)==null?void 0:o.id},s=>{this.setState(o=>({...o,publicClient:this.getPublicClient({chainId:s}),webSocketPublicClient:this.getWebSocketPublicClient({chainId:s})}))})};var Op;function YM(e){const u=new JM(e);return Op=u,u}function ut(){if(!Op)throw new Error("No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config");return Op}async function ZM({chainId:e,connector:u}){const t=ut(),n=t.connector;if(n&&u.id===n.id)throw new $M;try{t.setState(i=>({...i,status:"connecting"}));const r=await u.connect({chainId:e});return t.setLastUsedConnector(u.id),t.setState(i=>({...i,connector:u,chains:u==null?void 0:u.chains,data:r,status:"connected"})),t.storage.setItem("connected",!0),{...r,connector:u}}catch(r){throw t.setState(i=>({...i,status:i.connector?"connected":"disconnected"})),r}}async function XM(){const e=ut();e.connector&&await e.connector.disconnect(),e.clearState(),e.storage.removeItem("connected")}var uL=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],eL=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bytes32"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bytes32"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}];function xt({chainId:e}={}){const u=ut();return e&&u.getPublicClient({chainId:e})||u.publicClient}async function HC({chainId:e}={}){var n,r;return await((r=(n=ut().connector)==null?void 0:n.getWalletClient)==null?void 0:r.call(n,{chainId:e}))||null}function Ip({chainId:e}={}){const u=ut();return e&&u.getWebSocketPublicClient({chainId:e})||u.webSocketPublicClient}function tL(e,u){const t=ut(),n=async()=>u(xt(e));return t.subscribe(({publicClient:i})=>i,n)}function nL(e,u){const t=ut(),n=async()=>u(Ip(e));return t.subscribe(({webSocketPublicClient:i})=>i,n)}async function rL({abi:e,address:u,args:t,chainId:n,dataSuffix:r,functionName:i,walletClient:a,...s}){const o=xt({chainId:n}),l=a??await HC({chainId:n});if(!l)throw new ke;n&&tw({chainId:n});const{account:c,accessList:E,blockNumber:d,blockTag:f,gas:p,gasPrice:h,maxFeePerGas:g,maxPriorityFeePerGas:A,nonce:m,value:B}=GM(s),{result:F,request:w}=await o.simulateContract({abi:e,address:u,functionName:i,args:t,account:c||l.account,accessList:E,blockNumber:d,blockTag:f,dataSuffix:r,gas:p,gasPrice:h,maxFeePerGas:g,maxPriorityFeePerGas:A,nonce:m,value:B}),v=e.filter(C=>"name"in C&&C.name===i);return{mode:"prepared",request:{...w,abi:v,chainId:n},result:F}}async function iL({chainId:e,contracts:u,blockNumber:t,blockTag:n,...r}){const i=xt({chainId:e});if(!i.chains)throw new WM;if(e&&i.chain.id!==e)throw new UM({chainId:e});return i.multicall({allowFailure:r.allowFailure??!0,blockNumber:t,blockTag:n,contracts:u})}async function uw({address:e,account:u,chainId:t,abi:n,args:r,functionName:i,blockNumber:a,blockTag:s}){return xt({chainId:t}).readContract({abi:n,address:e,account:u,functionName:i,args:r,blockNumber:a,blockTag:s})}async function aL({contracts:e,blockNumber:u,blockTag:t,...n}){const{allowFailure:r=!0}=n;try{const i=xt(),a=e.reduce((c,E,d)=>{const f=E.chainId??i.chain.id;return{...c,[f]:[...c[f]||[],{contract:E,index:d}]}},{}),s=()=>Object.entries(a).map(([c,E])=>iL({allowFailure:r,chainId:parseInt(c),contracts:E.map(({contract:d})=>d),blockNumber:u,blockTag:t})),o=(await Promise.all(s())).flat(),l=Object.values(a).flatMap(c=>c.map(({index:E})=>E));return o.reduce((c,E,d)=>(c&&(c[l[d]]=E),c),[])}catch(i){if(i instanceof FC)throw i;const a=()=>e.map(s=>uw({...s,blockNumber:u,blockTag:t}));return r?(await Promise.allSettled(a())).map(s=>s.status==="fulfilled"?{result:s.value,status:"success"}:{error:s.reason,result:void 0,status:"failure"}):await Promise.all(a())}}async function CA(e){const u=await HC({chainId:e.chainId});if(!u)throw new ke;e.chainId&&tw({chainId:e.chainId});let t;if(e.mode==="prepared")t=e.request;else{const{chainId:r,mode:i,...a}=e;t=(await rL(a)).request}return{hash:await u.writeContract({...t,chain:e.chainId?{id:e.chainId}:null})}}async function sL({address:e,chainId:u,formatUnits:t,token:n}){const r=ut(),i=xt({chainId:u});if(n){const l=async({abi:c})=>{const E={abi:c,address:n,chainId:u},[d,f,p]=await aL({allowFailure:!1,contracts:[{...E,functionName:"balanceOf",args:[e]},{...E,functionName:"decimals"},{...E,functionName:"symbol"}]});return{decimals:f,formatted:u2(d??"0",dA(t??f)),symbol:p,value:d}};try{return await l({abi:uL})}catch(c){if(c instanceof FC){const{symbol:E,...d}=await l({abi:eL});return{symbol:oC(Pa(E,{dir:"right"})),...d}}throw c}}const a=[...r.publicClient.chains||[],...r.chains??[]],s=await i.getBalance({address:e}),o=a.find(l=>l.id===i.chain.id);return{decimals:(o==null?void 0:o.nativeCurrency.decimals)??18,formatted:u2(s??"0",dA(t??18)),symbol:(o==null?void 0:o.nativeCurrency.symbol)??"ETH",value:s}}function ew(){const{data:e,connector:u,status:t}=ut();switch(t){case"connected":return{address:e==null?void 0:e.account,connector:u,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:t};case"reconnecting":return{address:e==null?void 0:e.account,connector:u,isConnected:!!(e!=null&&e.account),isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:t};case"connecting":return{address:e==null?void 0:e.account,connector:u,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:t};case"disconnected":return{address:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:t}}}function GC(){var r,i,a,s;const e=ut(),u=(i=(r=e.data)==null?void 0:r.chain)==null?void 0:i.id,t=e.chains??[],n=[...((a=e.publicClient)==null?void 0:a.chains)||[],...t].find(o=>o.id===u)??{id:u,name:`Chain ${u}`,network:`${u}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}};return{chain:u?{...n,...(s=e.data)==null?void 0:s.chain,id:u}:void 0,chains:t}}async function oL(e){const u=await HC();if(!u)throw new ke;return await u.signMessage({message:e.message})}async function lL({chainId:e}){const{connector:u}=ut();if(!u)throw new ke;if(!u.switchChain)throw new qM({connector:u});return u.switchChain(e)}function cL(e,{selector:u=t=>t}={}){const t=ut(),n=()=>e(ew());return t.subscribe(({data:i,connector:a,status:s})=>u({address:i==null?void 0:i.account,connector:a,status:s}),n,{equalityFn:Jb})}function EL(e,{selector:u=t=>t}={}){const t=ut(),n=()=>e(GC());return t.subscribe(({data:i,chains:a})=>{var s;return u({chainId:(s=i==null?void 0:i.chain)==null?void 0:s.id,chains:a})},n,{equalityFn:Jb})}async function dL({name:e,chainId:u}){const{normalize:t}=await Uu(()=>import("./index-1b43e777.js"),[]);return await xt({chainId:u}).getEnsAvatar({name:t(e)})}async function fL({address:e,chainId:u}){return xt({chainId:u}).getEnsName({address:oe(e)})}async function pL({chainId:e}={}){return await xt({chainId:e}).getBlockNumber()}async function hL({chainId:e,confirmations:u=1,hash:t,onReplaced:n,timeout:r=0}){const i=xt({chainId:e}),a=await i.waitForTransactionReceipt({hash:t,confirmations:u,onReplaced:n,timeout:r});if(a.status==="reverted"){const s=await i.getTransaction({hash:a.transactionHash}),o=await i.call({...s,gasPrice:s.type!=="eip1559"?s.gasPrice:void 0,maxFeePerGas:s.type==="eip1559"?s.maxFeePerGas:void 0,maxPriorityFeePerGas:s.type==="eip1559"?s.maxPriorityFeePerGas:void 0}),l=oC(`0x${o.substring(138)}`);throw new Error(l)}return a}function tw({chainId:e}){var r,i;const{chain:u,chains:t}=GC(),n=u==null?void 0:u.id;if(n&&e!==n)throw new LM({activeChain:((r=t.find(a=>a.id===n))==null?void 0:r.name)??`Chain ${n}`,targetChain:((i=t.find(a=>a.id===e))==null?void 0:i.name)??`Chain ${e}`})}var nw={exports:{}},rw={};/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * @@ -156,5 +156,5 @@ PERFORMANCE OF THIS SOFTWARE. Required: ${a.toString()} Approved: ${s.toString()}`)),Object.keys(u).forEach(E=>{if(!E.includes(":")||n)return;const d=n3(u[E].accounts);d.includes(E)||(n=jr("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${E} Required: ${E} - Approved: ${d.toString()}`))}),a.forEach(E=>{n||(Zi(r[E].methods,i[E].methods)?Zi(r[E].events,i[E].events)||(n=jr("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${E}`)):n=jr("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${E}`))}),n}function r1u(e){const u={};return Object.keys(e).forEach(t=>{var n;t.includes(":")?u[t]=e[t]:(n=e[t].chains)==null||n.forEach(r=>{u[r]={methods:e[t].methods,events:e[t].events}})}),u}function IB(e){return[...new Set(e.map(u=>u.includes(":")?u.split(":")[0]:u))]}function i1u(e){const u={};return Object.keys(e).forEach(t=>{if(t.includes(":"))u[t]=e[t];else{const n=n3(e[t].accounts);n==null||n.forEach(r=>{u[r]={accounts:e[t].accounts.filter(i=>i.includes(`${r}:`)),methods:e[t].methods,events:e[t].events}})}}),u}function Ihu(e,u){return G8(e,!1)&&e<=u.max&&e>=u.min}function Nhu(){const e=sE();return new Promise(u=>{switch(e){case Ke.browser:u(a1u());break;case Ke.reactNative:u(s1u());break;case Ke.node:u(o1u());break;default:u(!0)}})}function a1u(){return q8()&&(navigator==null?void 0:navigator.onLine)}async function s1u(){if(md()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo){const e=await(globalThis==null?void 0:globalThis.NetInfo.fetch());return e==null?void 0:e.isConnected}return!0}function o1u(){return!0}function Rhu(e){switch(sE()){case Ke.browser:l1u(e);break;case Ke.reactNative:c1u(e);break}}function l1u(e){!md()&&q8()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)))}function c1u(e){md()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo&&(globalThis==null||globalThis.NetInfo.addEventListener(u=>e(u==null?void 0:u.isConnected)))}const K6={};class zhu{static get(u){return K6[u]}static set(u,t){K6[u]=t}static delete(u){delete K6[u]}}var g_="eip155",E1u="store",B_="requestedChains",c5="wallet_addEthereumChain",d0,J3,f9,E5,Q8,y_,p9,d5,f5,F_,B2,K8,As,x3,y2,V8,F2,J8,D2,Y8,D_=class extends Hc{constructor(e){super({...e,options:{isNewChainsStale:!0,...e.options}}),S0(this,f9),S0(this,Q8),S0(this,p9),S0(this,f5),S0(this,B2),S0(this,As),S0(this,y2),S0(this,F2),S0(this,D2),this.id="walletConnect",this.name="WalletConnect",this.ready=!0,S0(this,d0,void 0),S0(this,J3,void 0),this.onAccountsChanged=u=>{u.length===0?this.emit("disconnect"):this.emit("change",{account:oe(u[0])})},this.onChainChanged=u=>{const t=Number(u),n=this.isChainUnsupported(t);this.emit("change",{chain:{id:t,unsupported:n}})},this.onDisconnect=()=>{k0(this,As,x3).call(this,[]),this.emit("disconnect")},this.onDisplayUri=u=>{this.emit("message",{type:"display_uri",data:u})},this.onConnect=()=>{this.emit("connect",{})},k0(this,f9,E5).call(this)}async connect({chainId:e,pairingTopic:u}={}){var t,n,r,i,a;try{let s=e;if(!s){const p=(t=this.storage)==null?void 0:t.getItem(E1u),h=(i=(r=(n=p==null?void 0:p.state)==null?void 0:n.data)==null?void 0:r.chain)==null?void 0:i.id;h&&!this.isChainUnsupported(h)?s=h:s=(a=this.chains[0])==null?void 0:a.id}if(!s)throw new Error("No chains found on connector.");const o=await this.getProvider();k0(this,f5,F_).call(this);const l=k0(this,p9,d5).call(this);if(o.session&&l&&await o.disconnect(),!o.session||l){const p=this.chains.filter(h=>h.id!==s).map(h=>h.id);this.emit("message",{type:"connecting"}),await o.connect({pairingTopic:u,chains:[s],optionalChains:p.length?p:void 0}),k0(this,As,x3).call(this,this.chains.map(({id:h})=>h))}const c=await o.enable(),E=oe(c[0]),d=await this.getChainId(),f=this.isChainUnsupported(d);return{account:E,chain:{id:d,unsupported:f}}}catch(s){throw/user rejected/i.test(s==null?void 0:s.message)?new O0(s):s}}async disconnect(){const e=await this.getProvider();try{await e.disconnect()}catch(u){if(!/No matching key/i.test(u.message))throw u}finally{k0(this,B2,K8).call(this),k0(this,As,x3).call(this,[])}}async getAccount(){const{accounts:e}=await this.getProvider();return oe(e[0])}async getChainId(){const{chainId:e}=await this.getProvider();return e}async getProvider({chainId:e}={}){return Hu(this,d0)||await k0(this,f9,E5).call(this),e&&await this.switchChain(e),Hu(this,d0)}async getWalletClient({chainId:e}={}){const[u,t]=await Promise.all([this.getProvider({chainId:e}),this.getAccount()]),n=this.chains.find(r=>r.id===e);if(!u)throw new Error("provider is required.");return qc({account:t,chain:n,transport:$c(u)})}async isAuthorized(){try{const[e,u]=await Promise.all([this.getAccount(),this.getProvider()]),t=k0(this,p9,d5).call(this);if(!e)return!1;if(t&&u.session){try{await u.disconnect()}catch{}return!1}return!0}catch{return!1}}async switchChain(e){var t,n;const u=this.chains.find(r=>r.id===e);if(!u)throw new kn(new Error("chain not found on connector."));try{const r=await this.getProvider(),i=k0(this,F2,J8).call(this),a=k0(this,D2,Y8).call(this);if(!i.includes(e)&&a.includes(c5)){await r.request({method:c5,params:[{chainId:Lu(u.id),blockExplorerUrls:[(n=(t=u.blockExplorers)==null?void 0:t.default)==null?void 0:n.url],chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[...u.rpcUrls.default.http]}]});const o=k0(this,y2,V8).call(this);o.push(e),k0(this,As,x3).call(this,o)}return await r.request({method:"wallet_switchEthereumChain",params:[{chainId:Lu(e)}]}),u}catch(r){const i=typeof r=="string"?r:r==null?void 0:r.message;throw/user rejected request/i.test(i)?new O0(r):new kn(r)}}};d0=new WeakMap;J3=new WeakMap;f9=new WeakSet;E5=async function(){return!Hu(this,J3)&&typeof window<"u"&&hr(this,J3,k0(this,Q8,y_).call(this)),Hu(this,J3)};Q8=new WeakSet;y_=async function(){const{EthereumProvider:e,OPTIONAL_EVENTS:u,OPTIONAL_METHODS:t}=await Uu(()=>import("./index.es-8f50e71b.js"),["assets/index.es-8f50e71b.js","assets/events-372f436e.js","assets/http-dcace0d6.js"]),[n,...r]=this.chains.map(({id:i})=>i);if(n){const{projectId:i,showQrModal:a=!0,qrModalOptions:s,metadata:o,relayUrl:l}=this.options;hr(this,d0,await e.init({showQrModal:a,qrModalOptions:s,projectId:i,optionalMethods:t,optionalEvents:u,chains:[n],optionalChains:r.length?r:void 0,rpcMap:Object.fromEntries(this.chains.map(c=>[c.id,c.rpcUrls.default.http[0]])),metadata:o,relayUrl:l}))}};p9=new WeakSet;d5=function(){if(k0(this,D2,Y8).call(this).includes(c5)||!this.options.isNewChainsStale)return!1;const u=k0(this,y2,V8).call(this),t=this.chains.map(({id:r})=>r),n=k0(this,F2,J8).call(this);return n.length&&!n.some(r=>t.includes(r))?!1:!t.every(r=>u.includes(r))};f5=new WeakSet;F_=function(){Hu(this,d0)&&(k0(this,B2,K8).call(this),Hu(this,d0).on("accountsChanged",this.onAccountsChanged),Hu(this,d0).on("chainChanged",this.onChainChanged),Hu(this,d0).on("disconnect",this.onDisconnect),Hu(this,d0).on("session_delete",this.onDisconnect),Hu(this,d0).on("display_uri",this.onDisplayUri),Hu(this,d0).on("connect",this.onConnect))};B2=new WeakSet;K8=function(){Hu(this,d0)&&(Hu(this,d0).removeListener("accountsChanged",this.onAccountsChanged),Hu(this,d0).removeListener("chainChanged",this.onChainChanged),Hu(this,d0).removeListener("disconnect",this.onDisconnect),Hu(this,d0).removeListener("session_delete",this.onDisconnect),Hu(this,d0).removeListener("display_uri",this.onDisplayUri),Hu(this,d0).removeListener("connect",this.onConnect))};As=new WeakSet;x3=function(e){var u;(u=this.storage)==null||u.setItem(B_,e)};y2=new WeakSet;V8=function(){var e;return((e=this.storage)==null?void 0:e.getItem(B_))??[]};F2=new WeakSet;J8=function(){var n,r,i;if(!Hu(this,d0))return[];const e=(n=Hu(this,d0).session)==null?void 0:n.namespaces;return e?((i=(r=m_(e)[g_])==null?void 0:r.chains)==null?void 0:i.map(a=>parseInt(a.split(":")[1]||"")))??[]:[]};D2=new WeakSet;Y8=function(){var n,r;if(!Hu(this,d0))return[];const e=(n=Hu(this,d0).session)==null?void 0:n.namespaces;return e?((r=m_(e)[g_])==null?void 0:r.methods)??[]:[]};var k3,gs,d1u=class extends Hc{constructor({chains:e,options:u}){super({chains:e,options:{reloadOnDisconnect:!1,...u}}),this.id="coinbaseWallet",this.name="Coinbase Wallet",this.ready=!0,S0(this,k3,void 0),S0(this,gs,void 0),this.onAccountsChanged=t=>{t.length===0?this.emit("disconnect"):this.emit("change",{account:oe(t[0])})},this.onChainChanged=t=>{const n=qa(t),r=this.isChainUnsupported(n);this.emit("change",{chain:{id:n,unsupported:r}})},this.onDisconnect=()=>{this.emit("disconnect")}}async connect({chainId:e}={}){try{const u=await this.getProvider();u.on("accountsChanged",this.onAccountsChanged),u.on("chainChanged",this.onChainChanged),u.on("disconnect",this.onDisconnect),this.emit("message",{type:"connecting"});const t=await u.enable(),n=oe(t[0]);let r=await this.getChainId(),i=this.isChainUnsupported(r);return e&&r!==e&&(r=(await this.switchChain(e)).id,i=this.isChainUnsupported(r)),{account:n,chain:{id:r,unsupported:i}}}catch(u){throw/(user closed modal|accounts received is empty)/i.test(u.message)?new O0(u):u}}async disconnect(){if(!Hu(this,gs))return;const e=await this.getProvider();e.removeListener("accountsChanged",this.onAccountsChanged),e.removeListener("chainChanged",this.onChainChanged),e.removeListener("disconnect",this.onDisconnect),e.disconnect(),e.close()}async getAccount(){const u=await(await this.getProvider()).request({method:"eth_accounts"});return oe(u[0])}async getChainId(){const e=await this.getProvider();return qa(e.chainId)}async getProvider(){var e;if(!Hu(this,gs)){let u=(await Uu(()=>import("./index-c5a6e03a.js").then(a=>a.i),["assets/index-c5a6e03a.js","assets/events-372f436e.js","assets/hooks.module-408dc32d.js"])).default;typeof u!="function"&&typeof u.default=="function"&&(u=u.default),hr(this,k3,new u(this.options));const t=(e=Hu(this,k3).walletExtension)==null?void 0:e.getChainId(),n=this.chains.find(a=>this.options.chainId?a.id===this.options.chainId:a.id===t)||this.chains[0],r=this.options.chainId||(n==null?void 0:n.id),i=this.options.jsonRpcUrl||(n==null?void 0:n.rpcUrls.default.http[0]);hr(this,gs,Hu(this,k3).makeWeb3Provider(i,r))}return Hu(this,gs)}async getWalletClient({chainId:e}={}){const[u,t]=await Promise.all([this.getProvider(),this.getAccount()]),n=this.chains.find(r=>r.id===e);if(!u)throw new Error("provider is required.");return qc({account:t,chain:n,transport:$c(u)})}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}async switchChain(e){var n;const u=await this.getProvider(),t=Lu(e);try{return await u.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),this.chains.find(r=>r.id===e)??{id:e,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(r){const i=this.chains.find(a=>a.id===e);if(!i)throw new Kb({chainId:e,connectorId:this.id});if(r.code===4902)try{return await u.request({method:"wallet_addEthereumChain",params:[{chainId:t,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:[((n=i.rpcUrls.public)==null?void 0:n.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(i)}]}),i}catch(a){throw new O0(a)}throw new kn(r)}}async watchAsset({address:e,decimals:u=18,image:t,symbol:n}){return(await this.getProvider()).request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,decimals:u,image:t,symbol:n}}})}};k3=new WeakMap;gs=new WeakMap;var h9,f1u=class extends Co{constructor({chains:e,options:u}={}){const t={name:"MetaMask",shimDisconnect:!0,getProvider(){function n(i){if(i!=null&&i.isMetaMask&&!(i.isBraveWallet&&!i._events&&!i._state)&&!i.isApexWallet&&!i.isAvalanche&&!i.isBitKeep&&!i.isBlockWallet&&!i.isCoin98&&!i.isFordefi&&!i.isMathWallet&&!(i.isOkxWallet||i.isOKExWallet)&&!(i.isOneInchIOSWallet||i.isOneInchAndroidWallet)&&!i.isOpera&&!i.isPortal&&!i.isRabby&&!i.isDefiant&&!i.isTokenPocket&&!i.isTokenary&&!i.isZeal&&!i.isZerion)return i}if(typeof window>"u")return;const r=window.ethereum;return r!=null&&r.providers?r.providers.find(n):n(r)},...u};super({chains:e,options:t}),this.id="metaMask",this.shimDisconnectKey=`${this.id}.shimDisconnect`,S0(this,h9,void 0),hr(this,h9,t.UNSTABLE_shimOnConnectSelectAccount)}async connect({chainId:e}={}){var u,t,n,r;try{const i=await this.getProvider();if(!i)throw new ke;i.on&&(i.on("accountsChanged",this.onAccountsChanged),i.on("chainChanged",this.onChainChanged),i.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});let a=null;if(Hu(this,h9)&&((u=this.options)!=null&&u.shimDisconnect)&&!((t=this.storage)!=null&&t.getItem(this.shimDisconnectKey))&&(a=await this.getAccount().catch(()=>null),!!a))try{await i.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}),a=await this.getAccount()}catch(c){if(this.isUserRejectedRequestError(c))throw new O0(c);if(c.code===new Di(c).code)throw c}if(!a){const l=await i.request({method:"eth_requestAccounts"});a=oe(l[0])}let s=await this.getChainId(),o=this.isChainUnsupported(s);return e&&s!==e&&(s=(await this.switchChain(e)).id,o=this.isChainUnsupported(s)),(n=this.options)!=null&&n.shimDisconnect&&((r=this.storage)==null||r.setItem(this.shimDisconnectKey,!0)),{account:a,chain:{id:s,unsupported:o},provider:i}}catch(i){throw this.isUserRejectedRequestError(i)?new O0(i):i.code===-32002?new Di(i):i}}};h9=new WeakMap;var p1u=/(imtoken|metamask|rainbow|trust wallet|uniswap wallet|ledger)/i,$i,p5,v_,h1u=class extends Hc{constructor(){super(...arguments),S0(this,p5),this.id="walletConnectLegacy",this.name="WalletConnectLegacy",this.ready=!0,S0(this,$i,void 0),this.onAccountsChanged=e=>{e.length===0?this.emit("disconnect"):this.emit("change",{account:oe(e[0])})},this.onChainChanged=e=>{const u=qa(e),t=this.isChainUnsupported(u);this.emit("change",{chain:{id:u,unsupported:t}})},this.onDisconnect=()=>{this.emit("disconnect")}}async connect({chainId:e}={}){var u,t,n,r,i,a;try{let s=e;if(!s){const p=(u=this.storage)==null?void 0:u.getItem("store"),h=(r=(n=(t=p==null?void 0:p.state)==null?void 0:t.data)==null?void 0:n.chain)==null?void 0:r.id;h&&!this.isChainUnsupported(h)&&(s=h)}const o=await this.getProvider({chainId:s,create:!0});o.on("accountsChanged",this.onAccountsChanged),o.on("chainChanged",this.onChainChanged),o.on("disconnect",this.onDisconnect),setTimeout(()=>this.emit("message",{type:"connecting"}),0);const l=await o.enable(),c=oe(l[0]),E=await this.getChainId(),d=this.isChainUnsupported(E),f=((a=(i=o.connector)==null?void 0:i.peerMeta)==null?void 0:a.name)??"";return p1u.test(f)&&(this.switchChain=k0(this,p5,v_)),{account:c,chain:{id:E,unsupported:d}}}catch(s){throw/user closed modal/i.test(s.message)?new O0(s):s}}async disconnect(){const e=await this.getProvider();await e.disconnect(),e.removeListener("accountsChanged",this.onAccountsChanged),e.removeListener("chainChanged",this.onChainChanged),e.removeListener("disconnect",this.onDisconnect),typeof localStorage<"u"&&localStorage.removeItem("walletconnect")}async getAccount(){const u=(await this.getProvider()).accounts;return oe(u[0])}async getChainId(){const e=await this.getProvider();return qa(e.chainId)}async getProvider({chainId:e,create:u}={}){var t,n;if(!Hu(this,$i)||e||u){const r=(t=this.options)!=null&&t.infuraId?{}:this.chains.reduce((a,s)=>({...a,[s.id]:s.rpcUrls.default.http[0]}),{}),i=(await Uu(()=>import("./index-dd98ab46.js"),["assets/index-dd98ab46.js","assets/events-372f436e.js","assets/http-dcace0d6.js","assets/hooks.module-408dc32d.js"])).default;hr(this,$i,new i({...this.options,chainId:e,rpc:{...r,...(n=this.options)==null?void 0:n.rpc}})),Hu(this,$i).http=await Hu(this,$i).setHttpProvider(e)}return Hu(this,$i)}async getWalletClient({chainId:e}={}){const[u,t]=await Promise.all([this.getProvider({chainId:e}),this.getAccount()]),n=this.chains.find(r=>r.id===e);if(!u)throw new Error("provider is required.");return qc({account:t,chain:n,transport:$c(u)})}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}};$i=new WeakMap;p5=new WeakSet;v_=async function(e){const u=await this.getProvider(),t=Lu(e);try{return await Promise.race([u.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),new Promise(n=>this.on("change",({chain:r})=>{(r==null?void 0:r.id)===e&&n(e)}))]),this.chains.find(n=>n.id===e)??{id:e,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(n){const r=typeof n=="string"?n:n==null?void 0:n.message;throw/user rejected request/i.test(r)?new O0(n):new kn(n)}};var _3,S3,C1u=class extends Hc{constructor({chains:e,options:u}){const t={shimDisconnect:!1,...u};super({chains:e,options:t}),this.id="safe",this.name="Safe",this.ready=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,S0(this,_3,void 0),S0(this,S3,void 0),this.shimDisconnectKey=`${this.id}.shimDisconnect`;let n=dE;typeof dE!="function"&&typeof dE.default=="function"&&(n=dE.default),hr(this,S3,new n(t))}async connect(){var n;const e=await this.getProvider();if(!e)throw new ke;e.on&&(e.on("accountsChanged",this.onAccountsChanged),e.on("chainChanged",this.onChainChanged),e.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});const u=await this.getAccount(),t=await this.getChainId();return this.options.shimDisconnect&&((n=this.storage)==null||n.setItem(this.shimDisconnectKey,!0)),{account:u,chain:{id:t,unsupported:this.isChainUnsupported(t)}}}async disconnect(){var u;const e=await this.getProvider();e!=null&&e.removeListener&&(e.removeListener("accountsChanged",this.onAccountsChanged),e.removeListener("chainChanged",this.onChainChanged),e.removeListener("disconnect",this.onDisconnect),this.options.shimDisconnect&&((u=this.storage)==null||u.removeItem(this.shimDisconnectKey)))}async getAccount(){const e=await this.getProvider();if(!e)throw new ke;const u=await e.request({method:"eth_accounts"});return oe(u[0])}async getChainId(){const e=await this.getProvider();if(!e)throw new ke;return qa(e.chainId)}async getProvider(){if(!Hu(this,_3)){const e=await Hu(this,S3).safe.getInfo();if(!e)throw new Error("Could not load Safe information");hr(this,_3,new FP(e,Hu(this,S3)))}return Hu(this,_3)}async getWalletClient({chainId:e}={}){const u=await this.getProvider(),t=await this.getAccount(),n=this.chains.find(r=>r.id===e);if(!u)throw new Error("provider is required.");return qc({account:t,chain:n,transport:$c(u)})}async isAuthorized(){var e;try{return this.options.shimDisconnect&&!((e=this.storage)!=null&&e.getItem(this.shimDisconnectKey))?!1:!!await this.getAccount()}catch{return!1}}onAccountsChanged(e){}onChainChanged(e){}onDisconnect(){this.emit("disconnect")}};_3=new WeakMap;S3=new WeakMap;function m1u(e){return Object.fromEntries(Object.entries(e).filter(([u,t])=>t!==void 0))}var A1u=e=>()=>{let u=-1;const t=[],n=[],r=[],i=[];return e.forEach(({groupName:s,wallets:o},l)=>{o.forEach(c=>{if(u++,c!=null&&c.iconAccent&&!zlu(c==null?void 0:c.iconAccent))throw new Error(`Property \`iconAccent\` is not a hex value for wallet: ${c.name}`);const E={...c,groupIndex:l,groupName:s,index:u};typeof c.hidden=="function"?r.push(E):n.push(E)})}),[...n,...r].forEach(({createConnector:s,groupIndex:o,groupName:l,hidden:c,index:E,...d})=>{if(typeof c=="function"&&c({wallets:[...i.map(({connector:m,id:B,installed:F,name:w})=>({connector:m,id:B,installed:F,name:w}))]}))return;const{connector:f,...p}=m1u(s());let h;if(d.id==="walletConnect"&&p.qrCode&&!J0()){const{chains:A,options:m}=f;h=new D_({chains:A,options:{...m,showQrModal:!0}}),t.push(h)}const g={connector:f,groupIndex:o,groupName:l,index:E,walletConnectModalConnector:h,...d,...p};i.push(g),t.includes(f)||(t.push(f),f._wallets=[]),f._wallets.push(g)}),t},g1u=({chains:e,...u})=>{var t;return{id:"brave",name:"Brave Wallet",iconUrl:async()=>(await Uu(()=>import("./braveWallet-BTBH4MDN-77ab02b2.js"),[])).default,iconBackground:"#fff",installed:typeof window<"u"&&((t=window.ethereum)==null?void 0:t.isBraveWallet)===!0,downloadUrls:{},createConnector:()=>({connector:new Co({chains:e,options:u})})}};function b_(e){if(typeof window>"u"||typeof window.ethereum>"u")return;const u=window.ethereum.providers;return u?u.find(t=>t[e]):window.ethereum[e]?window.ethereum:void 0}function w_(e){return!!b_(e)}function B1u(e){if(typeof window>"u"||typeof window.ethereum>"u")return;const u=window.ethereum.providers,t=b_(e);return t||(typeof u<"u"&&u.length>0?u[0]:window.ethereum)}function y1u({chains:e,flag:u,options:t}){return new Co({chains:e,options:{getProvider:()=>B1u(u),...t}})}var F1u=({appName:e,chains:u,...t})=>{const n=w_("isCoinbaseWallet");return{id:"coinbase",name:"Coinbase Wallet",shortName:"Coinbase",iconUrl:async()=>(await Uu(()=>import("./coinbaseWallet-2OUR5TUP-f6c629ff.js"),[])).default,iconAccent:"#2c5ff6",iconBackground:"#2c5ff6",installed:n||void 0,downloadUrls:{android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/us/app/coinbase-wallet-store-crypto/id1278383455",mobile:"https://coinbase.com/wallet/downloads",qrCode:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",browserExtension:"https://coinbase.com/wallet"},createConnector:()=>{const r=ns(),i=new d1u({chains:u,options:{appName:e,headlessMode:!0,...t}});return{connector:i,...r?{}:{qrCode:{getUri:async()=>(await i.getProvider()).qrUrl,instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-mobile",steps:[{description:"wallet_connectors.coinbase.qr_code.step1.description",step:"install",title:"wallet_connectors.coinbase.qr_code.step1.title"},{description:"wallet_connectors.coinbase.qr_code.step2.description",step:"create",title:"wallet_connectors.coinbase.qr_code.step2.title"},{description:"wallet_connectors.coinbase.qr_code.step3.description",step:"scan",title:"wallet_connectors.coinbase.qr_code.step3.title"}]}},extension:{instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-extension",steps:[{description:"wallet_connectors.coinbase.extension.step1.description",step:"install",title:"wallet_connectors.coinbase.extension.step1.title"},{description:"wallet_connectors.coinbase.extension.step2.description",step:"create",title:"wallet_connectors.coinbase.extension.step2.title"},{description:"wallet_connectors.coinbase.extension.step3.description",step:"refresh",title:"wallet_connectors.coinbase.extension.step3.title"}]}}}}}}},D1u=({chains:e,...u})=>({id:"injected",name:"Browser Wallet",iconUrl:async()=>(await Uu(()=>import("./injectedWallet-EUKDEAIU-b2513a2e.js"),[])).default,iconBackground:"#fff",hidden:({wallets:t})=>t.some(n=>n.installed&&n.name===n.connector.name&&(n.connector instanceof Co||n.id==="coinbase")),createConnector:()=>({connector:new Co({chains:e,options:u})})});async function Z8(e,u){const t=await e.getProvider();return u==="2"?new Promise(n=>t.once("display_uri",n)):t.connector.uri}var x_=new Map;function v1u(e,u){const t=e==="1"?new h1u(u):new D_(u);return x_.set(JSON.stringify(u),t),t}function v2({chains:e,options:u={},projectId:t,version:n="2"}){const r="21fef48091f12692cad574a6f7753643";if(n==="2"){if(!t||t==="")throw new Error("No projectId found. Every dApp must now provide a WalletConnect Cloud projectId to enable WalletConnect v2 https://www.rainbowkit.com/docs/installation#configure");(t==="YOUR_PROJECT_ID"||t===r)&&console.warn("Invalid projectId. Please create a unique WalletConnect Cloud projectId for your dApp https://www.rainbowkit.com/docs/installation#configure")}const i={chains:e,options:n==="1"?{qrcode:!1,...u}:{projectId:t==="YOUR_PROJECT_ID"?r:t,showQrModal:!1,...u}},a=JSON.stringify(i),s=x_.get(a);return s??v1u(n,i)}function NB(e){return!(!(e!=null&&e.isMetaMask)||e.isBraveWallet&&!e._events&&!e._state||e.isApexWallet||e.isAvalanche||e.isBackpack||e.isBifrost||e.isBitKeep||e.isBitski||e.isBlockWallet||e.isCoinbaseWallet||e.isDawn||e.isEnkrypt||e.isExodus||e.isFrame||e.isFrontier||e.isGamestop||e.isHyperPay||e.isImToken||e.isKuCoinWallet||e.isMathWallet||e.isOkxWallet||e.isOKExWallet||e.isOneInchIOSWallet||e.isOneInchAndroidWallet||e.isOpera||e.isPhantom||e.isPortal||e.isRabby||e.isRainbow||e.isStatus||e.isTalisman||e.isTally||e.isTokenPocket||e.isTokenary||e.isTrust||e.isTrustWallet||e.isXDEFI||e.isZeal||e.isZerion)}var b1u=({chains:e,projectId:u,walletConnectOptions:t,walletConnectVersion:n="2",...r})=>{var i,a;const s=typeof window<"u"&&((i=window.ethereum)==null?void 0:i.providers),o=typeof window<"u"&&typeof window.ethereum<"u"&&(((a=window.ethereum.providers)==null?void 0:a.some(NB))||window.ethereum.isMetaMask),l=!o;return{id:"metaMask",name:"MetaMask",iconUrl:async()=>(await Uu(()=>import("./metaMaskWallet-ORHUNQRP-ac2ea8b3.js"),[])).default,iconAccent:"#f6851a",iconBackground:"#fff",installed:l?void 0:o,downloadUrls:{android:"https://play.google.com/store/apps/details?id=io.metamask",ios:"https://apps.apple.com/us/app/metamask/id1438144202",mobile:"https://metamask.io/download",qrCode:"https://metamask.io/download",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",edge:"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm",firefox:"https://addons.mozilla.org/firefox/addon/ether-metamask",opera:"https://addons.opera.com/extensions/details/metamask-10",browserExtension:"https://metamask.io/download"},createConnector:()=>{const c=l?v2({projectId:u,chains:e,version:n,options:t}):new f1u({chains:e,options:{getProvider:()=>s?s.find(NB):typeof window<"u"?window.ethereum:void 0,...r}}),E=async()=>{const d=await Z8(c,n);return F8()?d:ns()?`metamask://wc?uri=${encodeURIComponent(d)}`:`https://metamask.app.link/wc?uri=${encodeURIComponent(d)}`};return{connector:c,mobile:{getUri:l?E:void 0},qrCode:l?{getUri:E,instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.qr_code.step1.description",step:"install",title:"wallet_connectors.metamask.qr_code.step1.title"},{description:"wallet_connectors.metamask.qr_code.step2.description",step:"create",title:"wallet_connectors.metamask.qr_code.step2.title"},{description:"wallet_connectors.metamask.qr_code.step3.description",step:"refresh",title:"wallet_connectors.metamask.qr_code.step3.title"}]}}:void 0,extension:{instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.extension.step1.description",step:"install",title:"wallet_connectors.metamask.extension.step1.title"},{description:"wallet_connectors.metamask.extension.step2.description",step:"create",title:"wallet_connectors.metamask.extension.step2.title"},{description:"wallet_connectors.metamask.extension.step3.description",step:"refresh",title:"wallet_connectors.metamask.extension.step3.title"}]}}}}}},w1u=({chains:e,projectId:u,walletConnectOptions:t,walletConnectVersion:n="2",...r})=>{const i=w_("isRainbow"),a=!i;return{id:"rainbow",name:"Rainbow",iconUrl:async()=>(await Uu(()=>import("./rainbowWallet-GGU64QEI-80e56a37.js"),[])).default,iconBackground:"#0c2f78",installed:a?void 0:i,downloadUrls:{android:"https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Drainbowkit&utm_source=rainbowkit",ios:"https://apps.apple.com/app/apple-store/id1457119021?pt=119997837&ct=rainbowkit&mt=8",mobile:"https://rainbow.download?utm_source=rainbowkit",qrCode:"https://rainbow.download?utm_source=rainbowkit&utm_medium=qrcode",browserExtension:"https://rainbow.me/extension?utm_source=rainbowkit"},createConnector:()=>{const s=a?v2({projectId:u,chains:e,version:n,options:t}):y1u({flag:"isRainbow",chains:e,options:r}),o=async()=>{const l=await Z8(s,n);return F8()?l:ns()?`rainbow://wc?uri=${encodeURIComponent(l)}&connector=rainbowkit`:`https://rnbwapp.com/wc?uri=${encodeURIComponent(l)}&connector=rainbowkit`};return{connector:s,mobile:{getUri:a?o:void 0},qrCode:a?{getUri:o,instructions:{learnMoreUrl:"https://learn.rainbow.me/connect-to-a-website-or-app?utm_source=rainbowkit&utm_medium=connector&utm_campaign=learnmore",steps:[{description:"wallet_connectors.rainbow.qr_code.step1.description",step:"install",title:"wallet_connectors.rainbow.qr_code.step1.title"},{description:"wallet_connectors.rainbow.qr_code.step2.description",step:"create",title:"wallet_connectors.rainbow.qr_code.step2.title"},{description:"wallet_connectors.rainbow.qr_code.step3.description",step:"scan",title:"wallet_connectors.rainbow.qr_code.step3.title"}]}}:void 0}}}},x1u=({chains:e,...u})=>({id:"safe",name:"Safe",iconAccent:"#12ff80",iconBackground:"#fff",iconUrl:async()=>(await Uu(()=>import("./safeWallet-DFMLSLCR-bb33abc9.js"),[])).default,installed:!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,downloadUrls:{},createConnector:()=>({connector:new C1u({chains:e,options:u})})}),k1u=({chains:e,options:u,projectId:t,version:n="2"})=>({id:"walletConnect",name:"WalletConnect",iconUrl:async()=>(await Uu(()=>import("./walletConnectWallet-D6ZADJM7-c1d5c644.js"),[])).default,iconBackground:"#3b99fc",createConnector:()=>{const r=ns(),i=v2(n==="1"?{version:"1",chains:e,options:{qrcode:r,...u}}:{version:"2",chains:e,projectId:t,options:{showQrModal:r,...u}}),a=async()=>Z8(i,n);return{connector:i,...r?{}:{mobile:{getUri:a},qrCode:{getUri:a}}}}}),_1u=({appName:e,chains:u,projectId:t})=>{const n=[{groupName:"Popular",wallets:[D1u({chains:u}),x1u({chains:u}),w1u({chains:u,projectId:t}),F1u({appName:e,chains:u}),b1u({chains:u,projectId:t}),k1u({chains:u,projectId:t}),g1u({chains:u})]}];return{connectors:A1u(n),wallets:n}};var oE=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},bo=typeof window>"u"||"Deno"in window;function mt(){}function S1u(e,u){return typeof e=="function"?e(u):e}function h5(e){return typeof e=="number"&&e>=0&&e!==1/0}function k_(e,u){return Math.max(e+(u||0)-Date.now(),0)}function RB(e,u){const{type:t="all",exact:n,fetchStatus:r,predicate:i,queryKey:a,stale:s}=e;if(a){if(n){if(u.queryHash!==X8(a,u.options))return!1}else if(!ql(u.queryKey,a))return!1}if(t!=="all"){const o=u.isActive();if(t==="active"&&!o||t==="inactive"&&o)return!1}return!(typeof s=="boolean"&&u.isStale()!==s||typeof r<"u"&&r!==u.state.fetchStatus||i&&!i(u))}function zB(e,u){const{exact:t,status:n,predicate:r,mutationKey:i}=e;if(i){if(!u.options.mutationKey)return!1;if(t){if(Wl(u.options.mutationKey)!==Wl(i))return!1}else if(!ql(u.options.mutationKey,i))return!1}return!(n&&u.state.status!==n||r&&!r(u))}function X8(e,u){return((u==null?void 0:u.queryKeyHashFn)||Wl)(e)}function Wl(e){return JSON.stringify(e,(u,t)=>m5(t)?Object.keys(t).sort().reduce((n,r)=>(n[r]=t[r],n),{}):t)}function ql(e,u){return e===u?!0:typeof e!=typeof u?!1:e&&u&&typeof e=="object"&&typeof u=="object"?!Object.keys(u).some(t=>!ql(e[t],u[t])):!1}function __(e,u){if(e===u)return e;const t=jB(e)&&jB(u);if(t||m5(e)&&m5(u)){const n=t?e.length:Object.keys(e).length,r=t?u:Object.keys(u),i=r.length,a=t?[]:{};let s=0;for(let o=0;o"u")return!0;const t=u.prototype;return!(!MB(t)||!t.hasOwnProperty("isPrototypeOf"))}function MB(e){return Object.prototype.toString.call(e)==="[object Object]"}function S_(e){return new Promise(u=>{setTimeout(u,e)})}function LB(e){S_(0).then(e)}function A5(e,u,t){return typeof t.structuralSharing=="function"?t.structuralSharing(e,u):t.structuralSharing!==!1?__(e,u):u}function P1u(e,u,t=0){const n=[...e,u];return t&&n.length>t?n.slice(1):n}function T1u(e,u,t=0){const n=[u,...e];return t&&n.length>t?n.slice(0,-1):n}var ea,Mr,e4,Vy,O1u=(Vy=class extends oE{constructor(){super();q(this,ea,void 0);q(this,Mr,void 0);q(this,e4,void 0);T(this,e4,u=>{if(!bo&&window.addEventListener){const t=()=>u();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){b(this,Mr)||this.setEventListener(b(this,e4))}onUnsubscribe(){var u;this.hasListeners()||((u=b(this,Mr))==null||u.call(this),T(this,Mr,void 0))}setEventListener(u){var t;T(this,e4,u),(t=b(this,Mr))==null||t.call(this),T(this,Mr,u(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(u){b(this,ea)!==u&&(T(this,ea,u),this.onFocus())}onFocus(){this.listeners.forEach(u=>{u()})}isFocused(){var u;return typeof b(this,ea)=="boolean"?b(this,ea):((u=globalThis.document)==null?void 0:u.visibilityState)!=="hidden"}},ea=new WeakMap,Mr=new WeakMap,e4=new WeakMap,Vy),b2=new O1u,t4,Lr,n4,Jy,I1u=(Jy=class extends oE{constructor(){super();q(this,t4,!0);q(this,Lr,void 0);q(this,n4,void 0);T(this,n4,u=>{if(!bo&&window.addEventListener){const t=()=>u(!0),n=()=>u(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}})}onSubscribe(){b(this,Lr)||this.setEventListener(b(this,n4))}onUnsubscribe(){var u;this.hasListeners()||((u=b(this,Lr))==null||u.call(this),T(this,Lr,void 0))}setEventListener(u){var t;T(this,n4,u),(t=b(this,Lr))==null||t.call(this),T(this,Lr,u(this.setOnline.bind(this)))}setOnline(u){b(this,t4)!==u&&(T(this,t4,u),this.listeners.forEach(n=>{n(u)}))}isOnline(){return b(this,t4)}},t4=new WeakMap,Lr=new WeakMap,n4=new WeakMap,Jy),w2=new I1u;function N1u(e){return Math.min(1e3*2**e,3e4)}function gd(e){return(e??"online")==="online"?w2.isOnline():!0}var P_=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function V6(e){return e instanceof P_}function T_(e){let u=!1,t=0,n=!1,r,i,a;const s=new Promise((g,A)=>{i=g,a=A}),o=g=>{var A;n||(f(new P_(g)),(A=e.abort)==null||A.call(e))},l=()=>{u=!0},c=()=>{u=!1},E=()=>!b2.isFocused()||e.networkMode!=="always"&&!w2.isOnline(),d=g=>{var A;n||(n=!0,(A=e.onSuccess)==null||A.call(e,g),r==null||r(),i(g))},f=g=>{var A;n||(n=!0,(A=e.onError)==null||A.call(e,g),r==null||r(),a(g))},p=()=>new Promise(g=>{var A;r=m=>{const B=n||!E();return B&&g(m),B},(A=e.onPause)==null||A.call(e)}).then(()=>{var g;r=void 0,n||(g=e.onContinue)==null||g.call(e)}),h=()=>{if(n)return;let g;try{g=e.fn()}catch(A){g=Promise.reject(A)}Promise.resolve(g).then(d).catch(A=>{var v;if(n)return;const m=e.retry??(bo?0:3),B=e.retryDelay??N1u,F=typeof B=="function"?B(t,A):B,w=m===!0||typeof m=="number"&&t{if(E())return p()}).then(()=>{u?f(A):h()})})};return gd(e.networkMode)?h():p().then(h),{promise:s,cancel:o,continue:()=>(r==null?void 0:r())?s:Promise.resolve(),cancelRetry:l,continueRetry:c}}function R1u(){let e=[],u=0,t=c=>{c()},n=c=>{c()};const r=c=>{let E;u++;try{E=c()}finally{u--,u||s()}return E},i=c=>{u?e.push(c):LB(()=>{t(c)})},a=c=>(...E)=>{i(()=>{c(...E)})},s=()=>{const c=e;e=[],c.length&&LB(()=>{n(()=>{c.forEach(E=>{t(E)})})})};return{batch:r,batchCalls:a,schedule:i,setNotifyFunction:c=>{t=c},setBatchNotifyFunction:c=>{n=c}}}var G0=R1u(),ta,Yy,O_=(Yy=class{constructor(){q(this,ta,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),h5(this.gcTime)&&T(this,ta,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bo?1/0:5*60*1e3))}clearGcTimeout(){b(this,ta)&&(clearTimeout(b(this,ta)),T(this,ta,void 0))}},ta=new WeakMap,Yy),r4,i4,ot,Ur,lt,z0,uc,na,a4,C9,zt,On,Zy,z1u=(Zy=class extends O_{constructor(u){super();q(this,a4);q(this,zt);q(this,r4,void 0);q(this,i4,void 0);q(this,ot,void 0);q(this,Ur,void 0);q(this,lt,void 0);q(this,z0,void 0);q(this,uc,void 0);q(this,na,void 0);T(this,na,!1),T(this,uc,u.defaultOptions),cu(this,a4,C9).call(this,u.options),T(this,z0,[]),T(this,ot,u.cache),this.queryKey=u.queryKey,this.queryHash=u.queryHash,T(this,r4,u.state||j1u(this.options)),this.state=b(this,r4),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!b(this,z0).length&&this.state.fetchStatus==="idle"&&b(this,ot).remove(this)}setData(u,t){const n=A5(this.state.data,u,this.options);return cu(this,zt,On).call(this,{data:n,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),n}setState(u,t){cu(this,zt,On).call(this,{type:"setState",state:u,setStateOptions:t})}cancel(u){var n;const t=b(this,Ur);return(n=b(this,lt))==null||n.cancel(u),t?t.then(mt).catch(mt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(b(this,r4))}isActive(){return b(this,z0).some(u=>u.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||b(this,z0).some(u=>u.getCurrentResult().isStale)}isStaleByTime(u=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!k_(this.state.dataUpdatedAt,u)}onFocus(){var t;const u=b(this,z0).find(n=>n.shouldFetchOnWindowFocus());u==null||u.refetch({cancelRefetch:!1}),(t=b(this,lt))==null||t.continue()}onOnline(){var t;const u=b(this,z0).find(n=>n.shouldFetchOnReconnect());u==null||u.refetch({cancelRefetch:!1}),(t=b(this,lt))==null||t.continue()}addObserver(u){b(this,z0).includes(u)||(b(this,z0).push(u),this.clearGcTimeout(),b(this,ot).notify({type:"observerAdded",query:this,observer:u}))}removeObserver(u){b(this,z0).includes(u)&&(T(this,z0,b(this,z0).filter(t=>t!==u)),b(this,z0).length||(b(this,lt)&&(b(this,na)?b(this,lt).cancel({revert:!0}):b(this,lt).cancelRetry()),this.scheduleGc()),b(this,ot).notify({type:"observerRemoved",query:this,observer:u}))}getObserversCount(){return b(this,z0).length}invalidate(){this.state.isInvalidated||cu(this,zt,On).call(this,{type:"invalidate"})}fetch(u,t){var l,c,E,d;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(b(this,Ur))return(l=b(this,lt))==null||l.continueRetry(),b(this,Ur)}if(u&&cu(this,a4,C9).call(this,u),!this.options.queryFn){const f=b(this,z0).find(p=>p.options.queryFn);f&&cu(this,a4,C9).call(this,f.options)}const n=new AbortController,r={queryKey:this.queryKey,meta:this.meta},i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(T(this,na,!0),n.signal)})};i(r);const a=()=>this.options.queryFn?(T(this,na,!1),this.options.persister?this.options.persister(this.options.queryFn,r,this):this.options.queryFn(r)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),s={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:a};i(s),(c=this.options.behavior)==null||c.onFetch(s,this),T(this,i4,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((E=s.fetchOptions)==null?void 0:E.meta))&&cu(this,zt,On).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const o=f=>{var p,h,g,A;V6(f)&&f.silent||cu(this,zt,On).call(this,{type:"error",error:f}),V6(f)||((h=(p=b(this,ot).config).onError)==null||h.call(p,f,this),(A=(g=b(this,ot).config).onSettled)==null||A.call(g,this.state.data,f,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return T(this,lt,T_({fn:s.fetchFn,abort:n.abort.bind(n),onSuccess:f=>{var p,h,g,A;if(typeof f>"u"){o(new Error(`${this.queryHash} data is undefined`));return}this.setData(f),(h=(p=b(this,ot).config).onSuccess)==null||h.call(p,f,this),(A=(g=b(this,ot).config).onSettled)==null||A.call(g,f,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:o,onFail:(f,p)=>{cu(this,zt,On).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{cu(this,zt,On).call(this,{type:"pause"})},onContinue:()=>{cu(this,zt,On).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode})),T(this,Ur,b(this,lt).promise),b(this,Ur)}},r4=new WeakMap,i4=new WeakMap,ot=new WeakMap,Ur=new WeakMap,lt=new WeakMap,z0=new WeakMap,uc=new WeakMap,na=new WeakMap,a4=new WeakSet,C9=function(u){this.options={...b(this,uc),...u},this.updateGcTime(this.options.gcTime)},zt=new WeakSet,On=function(u){const t=n=>{switch(u.type){case"failed":return{...n,fetchFailureCount:u.failureCount,fetchFailureReason:u.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:u.meta??null,fetchStatus:gd(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...n,data:u.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:u.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!u.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=u.error;return V6(r)&&r.revert&&b(this,i4)?{...b(this,i4),fetchStatus:"idle"}:{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...u.state}}};this.state=t(this.state),G0.batch(()=>{b(this,z0).forEach(n=>{n.onQueryUpdate()}),b(this,ot).notify({query:this,type:"updated",action:u})})},Zy);function j1u(e){const u=typeof e.initialData=="function"?e.initialData():e.initialData,t=typeof u<"u",n=t?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:u,dataUpdateCount:0,dataUpdatedAt:t?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var ln,Xy,M1u=(Xy=class extends oE{constructor(u={}){super();q(this,ln,void 0);this.config=u,T(this,ln,new Map)}build(u,t,n){const r=t.queryKey,i=t.queryHash??X8(r,t);let a=this.get(i);return a||(a=new z1u({cache:this,queryKey:r,queryHash:i,options:u.defaultQueryOptions(t),state:n,defaultOptions:u.getQueryDefaults(r)}),this.add(a)),a}add(u){b(this,ln).has(u.queryHash)||(b(this,ln).set(u.queryHash,u),this.notify({type:"added",query:u}))}remove(u){const t=b(this,ln).get(u.queryHash);t&&(u.destroy(),t===u&&b(this,ln).delete(u.queryHash),this.notify({type:"removed",query:u}))}clear(){G0.batch(()=>{this.getAll().forEach(u=>{this.remove(u)})})}get(u){return b(this,ln).get(u)}getAll(){return[...b(this,ln).values()]}find(u){const t={exact:!0,...u};return this.getAll().find(n=>RB(t,n))}findAll(u={}){const t=this.getAll();return Object.keys(u).length>0?t.filter(n=>RB(u,n)):t}notify(u){G0.batch(()=>{this.listeners.forEach(t=>{t(u)})})}onFocus(){G0.batch(()=>{this.getAll().forEach(u=>{u.onFocus()})})}onOnline(){G0.batch(()=>{this.getAll().forEach(u=>{u.onOnline()})})}},ln=new WeakMap,Xy),cn,ec,$e,s4,En,Pr,uF,L1u=(uF=class extends O_{constructor(u){super();q(this,En);q(this,cn,void 0);q(this,ec,void 0);q(this,$e,void 0);q(this,s4,void 0);this.mutationId=u.mutationId,T(this,ec,u.defaultOptions),T(this,$e,u.mutationCache),T(this,cn,[]),this.state=u.state||U1u(),this.setOptions(u.options),this.scheduleGc()}setOptions(u){this.options={...b(this,ec),...u},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(u){b(this,cn).includes(u)||(b(this,cn).push(u),this.clearGcTimeout(),b(this,$e).notify({type:"observerAdded",mutation:this,observer:u}))}removeObserver(u){T(this,cn,b(this,cn).filter(t=>t!==u)),this.scheduleGc(),b(this,$e).notify({type:"observerRemoved",mutation:this,observer:u})}optionalRemove(){b(this,cn).length||(this.state.status==="pending"?this.scheduleGc():b(this,$e).remove(this))}continue(){var u;return((u=b(this,s4))==null?void 0:u.continue())??this.execute(this.state.variables)}async execute(u){var r,i,a,s,o,l,c,E,d,f,p,h,g,A,m,B,F,w,v,C;const t=()=>(T(this,s4,T_({fn:()=>this.options.mutationFn?this.options.mutationFn(u):Promise.reject(new Error("No mutationFn found")),onFail:(k,j)=>{cu(this,En,Pr).call(this,{type:"failed",failureCount:k,error:j})},onPause:()=>{cu(this,En,Pr).call(this,{type:"pause"})},onContinue:()=>{cu(this,En,Pr).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),b(this,s4).promise),n=this.state.status==="pending";try{if(!n){cu(this,En,Pr).call(this,{type:"pending",variables:u}),await((i=(r=b(this,$e).config).onMutate)==null?void 0:i.call(r,u,this));const j=await((s=(a=this.options).onMutate)==null?void 0:s.call(a,u));j!==this.state.context&&cu(this,En,Pr).call(this,{type:"pending",context:j,variables:u})}const k=await t();return await((l=(o=b(this,$e).config).onSuccess)==null?void 0:l.call(o,k,u,this.state.context,this)),await((E=(c=this.options).onSuccess)==null?void 0:E.call(c,k,u,this.state.context)),await((f=(d=b(this,$e).config).onSettled)==null?void 0:f.call(d,k,null,this.state.variables,this.state.context,this)),await((h=(p=this.options).onSettled)==null?void 0:h.call(p,k,null,u,this.state.context)),cu(this,En,Pr).call(this,{type:"success",data:k}),k}catch(k){try{throw await((A=(g=b(this,$e).config).onError)==null?void 0:A.call(g,k,u,this.state.context,this)),await((B=(m=this.options).onError)==null?void 0:B.call(m,k,u,this.state.context)),await((w=(F=b(this,$e).config).onSettled)==null?void 0:w.call(F,void 0,k,this.state.variables,this.state.context,this)),await((C=(v=this.options).onSettled)==null?void 0:C.call(v,void 0,k,u,this.state.context)),k}finally{cu(this,En,Pr).call(this,{type:"error",error:k})}}}},cn=new WeakMap,ec=new WeakMap,$e=new WeakMap,s4=new WeakMap,En=new WeakSet,Pr=function(u){const t=n=>{switch(u.type){case"failed":return{...n,failureCount:u.failureCount,failureReason:u.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:u.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!gd(this.options.networkMode),status:"pending",variables:u.variables,submittedAt:Date.now()};case"success":return{...n,data:u.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:u.error,failureCount:n.failureCount+1,failureReason:u.error,isPaused:!1,status:"error"}}};this.state=t(this.state),G0.batch(()=>{b(this,cn).forEach(n=>{n.onMutationUpdate(u)}),b(this,$e).notify({mutation:this,type:"updated",action:u})})},uF);function U1u(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ct,tc,ra,eF,$1u=(eF=class extends oE{constructor(u={}){super();q(this,ct,void 0);q(this,tc,void 0);q(this,ra,void 0);this.config=u,T(this,ct,[]),T(this,tc,0)}build(u,t,n){const r=new L1u({mutationCache:this,mutationId:++br(this,tc)._,options:u.defaultMutationOptions(t),state:n});return this.add(r),r}add(u){b(this,ct).push(u),this.notify({type:"added",mutation:u})}remove(u){T(this,ct,b(this,ct).filter(t=>t!==u)),this.notify({type:"removed",mutation:u})}clear(){G0.batch(()=>{b(this,ct).forEach(u=>{this.remove(u)})})}getAll(){return b(this,ct)}find(u){const t={exact:!0,...u};return b(this,ct).find(n=>zB(t,n))}findAll(u={}){return b(this,ct).filter(t=>zB(u,t))}notify(u){G0.batch(()=>{this.listeners.forEach(t=>{t(u)})})}resumePausedMutations(){return T(this,ra,(b(this,ra)??Promise.resolve()).then(()=>{const u=b(this,ct).filter(t=>t.state.isPaused);return G0.batch(()=>u.reduce((t,n)=>t.then(()=>n.continue().catch(mt)),Promise.resolve()))}).then(()=>{T(this,ra,void 0)})),b(this,ra)}},ct=new WeakMap,tc=new WeakMap,ra=new WeakMap,eF);function W1u(e){return{onFetch:(u,t)=>{const n=async()=>{var p,h,g,A,m;const r=u.options,i=(g=(h=(p=u.fetchOptions)==null?void 0:p.meta)==null?void 0:h.fetchMore)==null?void 0:g.direction,a=((A=u.state.data)==null?void 0:A.pages)||[],s=((m=u.state.data)==null?void 0:m.pageParams)||[],o={pages:[],pageParams:[]};let l=!1;const c=B=>{Object.defineProperty(B,"signal",{enumerable:!0,get:()=>(u.signal.aborted?l=!0:u.signal.addEventListener("abort",()=>{l=!0}),u.signal)})},E=u.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${u.options.queryHash}'`))),d=async(B,F,w)=>{if(l)return Promise.reject();if(F==null&&B.pages.length)return Promise.resolve(B);const v={queryKey:u.queryKey,pageParam:F,direction:w?"backward":"forward",meta:u.options.meta};c(v);const C=await E(v),{maxPages:k}=u.options,j=w?T1u:P1u;return{pages:j(B.pages,C,k),pageParams:j(B.pageParams,F,k)}};let f;if(i&&a.length){const B=i==="backward",F=B?q1u:UB,w={pages:a,pageParams:s},v=F(r,w);f=await d(w,v,B)}else{f=await d(o,s[0]??r.initialPageParam);const B=e??a.length;for(let F=1;F{var r,i;return(i=(r=u.options).persister)==null?void 0:i.call(r,n,{queryKey:u.queryKey,meta:u.options.meta,signal:u.signal},t)}:u.fetchFn=n}}}function UB(e,{pages:u,pageParams:t}){const n=u.length-1;return e.getNextPageParam(u[n],u,t[n],t)}function q1u(e,{pages:u,pageParams:t}){var n;return(n=e.getPreviousPageParam)==null?void 0:n.call(e,u[0],u,t[0],t)}var x0,$r,Wr,o4,l4,qr,c4,E4,tF,H1u=(tF=class{constructor(e={}){q(this,x0,void 0);q(this,$r,void 0);q(this,Wr,void 0);q(this,o4,void 0);q(this,l4,void 0);q(this,qr,void 0);q(this,c4,void 0);q(this,E4,void 0);T(this,x0,e.queryCache||new M1u),T(this,$r,e.mutationCache||new $1u),T(this,Wr,e.defaultOptions||{}),T(this,o4,new Map),T(this,l4,new Map),T(this,qr,0)}mount(){br(this,qr)._++,b(this,qr)===1&&(T(this,c4,b2.subscribe(()=>{b2.isFocused()&&(this.resumePausedMutations(),b(this,x0).onFocus())})),T(this,E4,w2.subscribe(()=>{w2.isOnline()&&(this.resumePausedMutations(),b(this,x0).onOnline())})))}unmount(){var e,u;br(this,qr)._--,b(this,qr)===0&&((e=b(this,c4))==null||e.call(this),T(this,c4,void 0),(u=b(this,E4))==null||u.call(this),T(this,E4,void 0))}isFetching(e){return b(this,x0).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return b(this,$r).findAll({...e,status:"pending"}).length}getQueryData(e){var u;return(u=b(this,x0).find({queryKey:e}))==null?void 0:u.state.data}ensureQueryData(e){const u=this.getQueryData(e.queryKey);return u!==void 0?Promise.resolve(u):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:u,state:t})=>{const n=t.data;return[u,n]})}setQueryData(e,u,t){const n=b(this,x0).find({queryKey:e}),r=n==null?void 0:n.state.data,i=S1u(u,r);if(typeof i>"u")return;const a=this.defaultQueryOptions({queryKey:e});return b(this,x0).build(this,a).setData(i,{...t,manual:!0})}setQueriesData(e,u,t){return G0.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,u,t)]))}getQueryState(e){var u;return(u=b(this,x0).find({queryKey:e}))==null?void 0:u.state}removeQueries(e){const u=b(this,x0);G0.batch(()=>{u.findAll(e).forEach(t=>{u.remove(t)})})}resetQueries(e,u){const t=b(this,x0),n={type:"active",...e};return G0.batch(()=>(t.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries(n,u)))}cancelQueries(e={},u={}){const t={revert:!0,...u},n=G0.batch(()=>b(this,x0).findAll(e).map(r=>r.cancel(t)));return Promise.all(n).then(mt).catch(mt)}invalidateQueries(e={},u={}){return G0.batch(()=>{if(b(this,x0).findAll(e).forEach(n=>{n.invalidate()}),e.refetchType==="none")return Promise.resolve();const t={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(t,u)})}refetchQueries(e={},u){const t={...u,cancelRefetch:(u==null?void 0:u.cancelRefetch)??!0},n=G0.batch(()=>b(this,x0).findAll(e).filter(r=>!r.isDisabled()).map(r=>{let i=r.fetch(void 0,t);return t.throwOnError||(i=i.catch(mt)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(mt)}fetchQuery(e){const u=this.defaultQueryOptions(e);typeof u.retry>"u"&&(u.retry=!1);const t=b(this,x0).build(this,u);return t.isStaleByTime(u.staleTime)?t.fetch(u):Promise.resolve(t.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(mt).catch(mt)}fetchInfiniteQuery(e){return e.behavior=W1u(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(mt).catch(mt)}resumePausedMutations(){return b(this,$r).resumePausedMutations()}getQueryCache(){return b(this,x0)}getMutationCache(){return b(this,$r)}getDefaultOptions(){return b(this,Wr)}setDefaultOptions(e){T(this,Wr,e)}setQueryDefaults(e,u){b(this,o4).set(Wl(e),{queryKey:e,defaultOptions:u})}getQueryDefaults(e){const u=[...b(this,o4).values()];let t={};return u.forEach(n=>{ql(e,n.queryKey)&&(t={...t,...n.defaultOptions})}),t}setMutationDefaults(e,u){b(this,l4).set(Wl(e),{mutationKey:e,defaultOptions:u})}getMutationDefaults(e){const u=[...b(this,l4).values()];let t={};return u.forEach(n=>{ql(e,n.mutationKey)&&(t={...t,...n.defaultOptions})}),t}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const u={...b(this,Wr).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return u.queryHash||(u.queryHash=X8(u.queryKey,u)),typeof u.refetchOnReconnect>"u"&&(u.refetchOnReconnect=u.networkMode!=="always"),typeof u.throwOnError>"u"&&(u.throwOnError=!!u.suspense),typeof u.networkMode>"u"&&u.persister&&(u.networkMode="offlineFirst"),u}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...b(this,Wr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){b(this,x0).clear(),b(this,$r).clear()}},x0=new WeakMap,$r=new WeakMap,Wr=new WeakMap,o4=new WeakMap,l4=new WeakMap,qr=new WeakMap,c4=new WeakMap,E4=new WeakMap,tF),De,n0,d4,ee,ia,f4,dn,nc,p4,h4,aa,sa,Hr,oa,la,P3,rc,g5,ic,B5,ac,y5,sc,F5,oc,D5,lc,v5,cc,b5,z2,I_,nF,G1u=(nF=class extends oE{constructor(u,t){super();q(this,la);q(this,rc);q(this,ic);q(this,ac);q(this,sc);q(this,oc);q(this,lc);q(this,cc);q(this,z2);q(this,De,void 0);q(this,n0,void 0);q(this,d4,void 0);q(this,ee,void 0);q(this,ia,void 0);q(this,f4,void 0);q(this,dn,void 0);q(this,nc,void 0);q(this,p4,void 0);q(this,h4,void 0);q(this,aa,void 0);q(this,sa,void 0);q(this,Hr,void 0);q(this,oa,void 0);T(this,n0,void 0),T(this,d4,void 0),T(this,ee,void 0),T(this,oa,new Set),T(this,De,u),this.options=t,T(this,dn,null),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(b(this,n0).addObserver(this),$B(b(this,n0),this.options)?cu(this,la,P3).call(this):this.updateResult(),cu(this,sc,F5).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w5(b(this,n0),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w5(b(this,n0),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,cu(this,oc,D5).call(this),cu(this,lc,v5).call(this),b(this,n0).removeObserver(this)}setOptions(u,t){const n=this.options,r=b(this,n0);if(this.options=b(this,De).defaultQueryOptions(u),C5(n,this.options)||b(this,De).getQueryCache().notify({type:"observerOptionsUpdated",query:b(this,n0),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=n.queryKey),cu(this,cc,b5).call(this);const i=this.hasListeners();i&&WB(b(this,n0),r,this.options,n)&&cu(this,la,P3).call(this),this.updateResult(t),i&&(b(this,n0)!==r||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&cu(this,rc,g5).call(this);const a=cu(this,ic,B5).call(this);i&&(b(this,n0)!==r||this.options.enabled!==n.enabled||a!==b(this,Hr))&&cu(this,ac,y5).call(this,a)}getOptimisticResult(u){const t=b(this,De).getQueryCache().build(b(this,De),u),n=this.createResult(t,u);return K1u(this,n)&&(T(this,ee,n),T(this,f4,this.options),T(this,ia,b(this,n0).state)),n}getCurrentResult(){return b(this,ee)}trackResult(u){const t={};return Object.keys(u).forEach(n=>{Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:()=>(b(this,oa).add(n),u[n])})}),t}getCurrentQuery(){return b(this,n0)}refetch({...u}={}){return this.fetch({...u})}fetchOptimistic(u){const t=b(this,De).defaultQueryOptions(u),n=b(this,De).getQueryCache().build(b(this,De),t);return n.isFetchingOptimistic=!0,n.fetch().then(()=>this.createResult(n,t))}fetch(u){return cu(this,la,P3).call(this,{...u,cancelRefetch:u.cancelRefetch??!0}).then(()=>(this.updateResult(),b(this,ee)))}createResult(u,t){var v;const n=b(this,n0),r=this.options,i=b(this,ee),a=b(this,ia),s=b(this,f4),l=u!==n?u.state:b(this,d4),{state:c}=u;let{error:E,errorUpdatedAt:d,fetchStatus:f,status:p}=c,h=!1,g;if(t._optimisticResults){const C=this.hasListeners(),k=!C&&$B(u,t),j=C&&WB(u,n,t,r);(k||j)&&(f=gd(u.options.networkMode)?"fetching":"paused",c.dataUpdatedAt||(p="pending")),t._optimisticResults==="isRestoring"&&(f="idle")}if(t.select&&typeof c.data<"u")if(i&&c.data===(a==null?void 0:a.data)&&t.select===b(this,nc))g=b(this,p4);else try{T(this,nc,t.select),g=t.select(c.data),g=A5(i==null?void 0:i.data,g,t),T(this,p4,g),T(this,dn,null)}catch(C){T(this,dn,C)}else g=c.data;if(typeof t.placeholderData<"u"&&typeof g>"u"&&p==="pending"){let C;if(i!=null&&i.isPlaceholderData&&t.placeholderData===(s==null?void 0:s.placeholderData))C=i.data;else if(C=typeof t.placeholderData=="function"?t.placeholderData((v=b(this,h4))==null?void 0:v.state.data,b(this,h4)):t.placeholderData,t.select&&typeof C<"u")try{C=t.select(C),T(this,dn,null)}catch(k){T(this,dn,k)}typeof C<"u"&&(p="success",g=A5(i==null?void 0:i.data,C,t),h=!0)}b(this,dn)&&(E=b(this,dn),g=b(this,p4),d=Date.now(),p="error");const A=f==="fetching",m=p==="pending",B=p==="error",F=m&&A;return{status:p,fetchStatus:f,isPending:m,isSuccess:p==="success",isError:B,isInitialLoading:F,isLoading:F,data:g,dataUpdatedAt:c.dataUpdatedAt,error:E,errorUpdatedAt:d,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:A,isRefetching:A&&!m,isLoadingError:B&&c.dataUpdatedAt===0,isPaused:f==="paused",isPlaceholderData:h,isRefetchError:B&&c.dataUpdatedAt!==0,isStale:um(u,t),refetch:this.refetch}}updateResult(u){const t=b(this,ee),n=this.createResult(b(this,n0),this.options);if(T(this,ia,b(this,n0).state),T(this,f4,this.options),b(this,ia).data!==void 0&&T(this,h4,b(this,n0)),C5(n,t))return;T(this,ee,n);const r={},i=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,s=typeof a=="function"?a():a;if(s==="all"||!s&&!b(this,oa).size)return!0;const o=new Set(s??b(this,oa));return this.options.throwOnError&&o.add("error"),Object.keys(b(this,ee)).some(l=>{const c=l;return b(this,ee)[c]!==t[c]&&o.has(c)})};(u==null?void 0:u.listeners)!==!1&&i()&&(r.listeners=!0),cu(this,z2,I_).call(this,{...r,...u})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&cu(this,sc,F5).call(this)}},De=new WeakMap,n0=new WeakMap,d4=new WeakMap,ee=new WeakMap,ia=new WeakMap,f4=new WeakMap,dn=new WeakMap,nc=new WeakMap,p4=new WeakMap,h4=new WeakMap,aa=new WeakMap,sa=new WeakMap,Hr=new WeakMap,oa=new WeakMap,la=new WeakSet,P3=function(u){cu(this,cc,b5).call(this);let t=b(this,n0).fetch(this.options,u);return u!=null&&u.throwOnError||(t=t.catch(mt)),t},rc=new WeakSet,g5=function(){if(cu(this,oc,D5).call(this),bo||b(this,ee).isStale||!h5(this.options.staleTime))return;const t=k_(b(this,ee).dataUpdatedAt,this.options.staleTime)+1;T(this,aa,setTimeout(()=>{b(this,ee).isStale||this.updateResult()},t))},ic=new WeakSet,B5=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(b(this,n0)):this.options.refetchInterval)??!1},ac=new WeakSet,y5=function(u){cu(this,lc,v5).call(this),T(this,Hr,u),!(bo||this.options.enabled===!1||!h5(b(this,Hr))||b(this,Hr)===0)&&T(this,sa,setInterval(()=>{(this.options.refetchIntervalInBackground||b2.isFocused())&&cu(this,la,P3).call(this)},b(this,Hr)))},sc=new WeakSet,F5=function(){cu(this,rc,g5).call(this),cu(this,ac,y5).call(this,cu(this,ic,B5).call(this))},oc=new WeakSet,D5=function(){b(this,aa)&&(clearTimeout(b(this,aa)),T(this,aa,void 0))},lc=new WeakSet,v5=function(){b(this,sa)&&(clearInterval(b(this,sa)),T(this,sa,void 0))},cc=new WeakSet,b5=function(){const u=b(this,De).getQueryCache().build(b(this,De),this.options);if(u===b(this,n0))return;const t=b(this,n0);T(this,n0,u),T(this,d4,u.state),this.hasListeners()&&(t==null||t.removeObserver(this),u.addObserver(this))},z2=new WeakSet,I_=function(u){G0.batch(()=>{u.listeners&&this.listeners.forEach(t=>{t(b(this,ee))}),b(this,De).getQueryCache().notify({query:b(this,n0),type:"observerResultsUpdated"})})},nF);function Q1u(e,u){return u.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&u.retryOnMount===!1)}function $B(e,u){return Q1u(e,u)||e.state.dataUpdatedAt>0&&w5(e,u,u.refetchOnMount)}function w5(e,u,t){if(u.enabled!==!1){const n=typeof t=="function"?t(e):t;return n==="always"||n!==!1&&um(e,u)}return!1}function WB(e,u,t,n){return t.enabled!==!1&&(e!==u||n.enabled===!1)&&(!t.suspense||e.state.status!=="error")&&um(e,t)}function um(e,u){return e.isStaleByTime(u.staleTime)}function K1u(e,u){return!C5(e.getCurrentResult(),u)}var N_=M.createContext(void 0),V1u=e=>{const u=M.useContext(N_);if(e)return e;if(!u)throw new Error("No QueryClient set, use QueryClientProvider to set one");return u},J1u=({client:e,children:u})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),M.createElement(N_.Provider,{value:e},u)),R_=M.createContext(!1),Y1u=()=>M.useContext(R_);R_.Provider;function Z1u(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var X1u=M.createContext(Z1u()),udu=()=>M.useContext(X1u);function edu(e,u){return typeof e=="function"?e(...u):!!e}var tdu=(e,u)=>{(e.suspense||e.throwOnError)&&(u.isReset()||(e.retryOnMount=!1))},ndu=e=>{M.useEffect(()=>{e.clearReset()},[e])},rdu=({result:e,errorResetBoundary:u,throwOnError:t,query:n})=>e.isError&&!u.isReset()&&!e.isFetching&&edu(t,[e.error,n]),idu=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},adu=(e,u)=>(e==null?void 0:e.suspense)&&u.isPending,sdu=(e,u,t)=>u.fetchOptimistic(e).catch(()=>{t.clearReset()});function odu(e,u,t){const n=V1u(t),r=Y1u(),i=udu(),a=n.defaultQueryOptions(e);a._optimisticResults=r?"isRestoring":"optimistic",idu(a),tdu(a,i),ndu(i);const[s]=M.useState(()=>new u(n,a)),o=s.getOptimisticResult(a);if(M.useSyncExternalStore(M.useCallback(l=>{const c=r?()=>{}:s.subscribe(G0.batchCalls(l));return s.updateResult(),c},[s,r]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),M.useEffect(()=>{s.setOptions(a,{listeners:!1})},[a,s]),adu(a,o))throw sdu(a,s,i);if(rdu({result:o,errorResetBoundary:i,throwOnError:a.throwOnError,query:s.getCurrentQuery()}))throw o.error;return a.notifyOnChangeProps?o:s.trackResult(o)}function ldu(e,u){return odu(e,G1u,u)}var z_,qB=Nv;z_=qB.createRoot,qB.hydrateRoot;const ur={1:"0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2",5:"0x1df10ec981ac5871240be4a94f250dd238b77901",10:"0x1df10ec981ac5871240be4a94f250dd238b77901",56:"0x1df10ec981ac5871240be4a94f250dd238b77901",137:"0x1df10ec981ac5871240be4a94f250dd238b77901",250:"0x1df10ec981ac5871240be4a94f250dd238b77901",288:"0x1df10ec981ac5871240be4a94f250dd238b77901",324:"0x1df10ec981ac5871240be4a94f250dd238b77901",420:"0x1df10ec981ac5871240be4a94f250dd238b77901",42161:"0x1df10ec981ac5871240be4a94f250dd238b77901",80001:"0x1df10ec981ac5871240be4a94f250dd238b77901",421613:"0x1df10ec981ac5871240be4a94f250dd238b77901"};var cdu="0.10.2",Pt=class x5 extends Error{constructor(u,t={}){var a;const n=t.cause instanceof x5?t.cause.details:(a=t.cause)!=null&&a.message?t.cause.message:t.details,r=t.cause instanceof x5&&t.cause.docsPath||t.docsPath,i=[u||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${cdu}`].join(` -`);super(i),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),t.cause&&(this.cause=t.cause),this.details=n,this.docsPath=r,this.metaMessages=t.metaMessages,this.shortMessage=u}};function Ni(e,u){const t=e.exec(u);return t==null?void 0:t.groups}var j_=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,M_=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,L_=/^\(.+?\).*?$/,HB=/^tuple(?(\[(\d*)\])*)$/;function k5(e){let u=e.type;if(HB.test(e.type)&&"components"in e){u="(";const t=e.components.length;for(let r=0;r[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function ddu(e){return U_.test(e)}function fdu(e){return Ni(U_,e)}var $_=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function pdu(e){return $_.test(e)}function hdu(e){return Ni($_,e)}var W_=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function Cdu(e){return W_.test(e)}function mdu(e){return Ni(W_,e)}var q_=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function H_(e){return q_.test(e)}function Adu(e){return Ni(q_,e)}var G_=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function gdu(e){return G_.test(e)}function Bdu(e){return Ni(G_,e)}var ydu=/^fallback\(\)$/;function Fdu(e){return ydu.test(e)}var Ddu=/^receive\(\) external payable$/;function vdu(e){return Ddu.test(e)}var bdu=new Set(["indexed"]),_5=new Set(["calldata","memory","storage"]),wdu=class extends Pt{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}},xdu=class extends Pt{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}},kdu=class extends Pt{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},_du=class extends Pt{constructor({param:e,name:u}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${u}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}},Sdu=class extends Pt{constructor({param:e,type:u,modifier:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${t}" not allowed${u?` in "${u}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},Pdu=class extends Pt{constructor({param:e,type:u,modifier:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${t}" not allowed${u?` in "${u}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${t}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}},Tdu=class extends Pt{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}},T3=class extends Pt{constructor({signature:e,type:u}){super(`Invalid ${u} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},Odu=class extends Pt{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},Idu=class extends Pt{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}},Ndu=class extends Pt{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}},Rdu=class extends Pt{constructor({current:e,depth:u}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${u>0?"opening":"closing"} parentheses.`],details:`Depth "${u}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}};function zdu(e,u){return u?`${u}:${e}`:e}var J6=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function jdu(e,u={}){if(Cdu(e)){const t=mdu(e);if(!t)throw new T3({signature:e,type:"function"});const n=qt(t.parameters),r=[],i=n.length;for(let s=0;s[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Ldu=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Udu=/^u?int$/;function qi(e,u){var E,d;const t=zdu(e,u==null?void 0:u.type);if(J6.has(t))return J6.get(t);const n=L_.test(e),r=Ni(n?Ldu:Mdu,e);if(!r)throw new kdu({param:e});if(r.name&&Wdu(r.name))throw new _du({param:e,name:r.name});const i=r.name?{name:r.name}:{},a=r.modifier==="indexed"?{indexed:!0}:{},s=(u==null?void 0:u.structs)??{};let o,l={};if(n){o="tuple";const f=qt(r.type),p=[],h=f.length;for(let g=0;g[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function K_(e,u,t=new Set){const n=[],r=e.length;for(let i=0;iObject.fromEntries(e.filter(u=>u.type==="event").map(u=>{const t=n=>({eventName:u.name,abi:[u],humanReadableAbi:wo([u]),...n});return t.abi=[u],t.eventName=u.name,t.humanReadableAbi=wo([u]),[u.name,t]})),Vdu=({methods:e})=>Object.fromEntries(e.filter(({type:u})=>u==="function").map(u=>{const t=(...n)=>{const r=e.filter(a=>a.name===(u==null?void 0:u.name)),i=n.length>0?{args:n}:{};return{abi:r,humanReadableAbi:wo([u]),functionName:u.name,...i}};return t.abi=[u],t.humanReadableAbi=wo([u]),[u.name,t]})),Jdu=({methods:e})=>Object.fromEntries(e.map(u=>{const t=(...n)=>{const r=e.filter(a=>a.name===(u==null?void 0:u.name)),i=n.length>0?{args:n}:{};return{abi:r,humanReadableAbi:wo([u]),functionName:u.name,...i}};return t.abi=[u],t.humanReadableAbi=wo([u]),[u.name,t]})),Ydu=({humanReadableAbi:e,name:u})=>{const t=Qdu(e),n=t.filter(r=>r.type==="function");return{name:u,abi:t,humanReadableAbi:e,events:Kdu({abi:t}),write:Jdu({methods:n}),read:Vdu({methods:n})}};const Zdu={name:"WagmiMintExample",humanReadableAbi:["constructor()","event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)","event ApprovalForAll(address indexed owner, address indexed operator, bool approved)","event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)","function approve(address to, uint256 tokenId)","function balanceOf(address owner) view returns (uint256)","function getApproved(uint256 tokenId) view returns (address)","function isApprovedForAll(address owner, address operator) view returns (bool)","function mint()","function mint(uint256 tokenId)","function name() view returns (string)","function ownerOf(uint256 tokenId) view returns (address)","function safeTransferFrom(address from, address to, uint256 tokenId)","function safeTransferFrom(address from, address to, uint256 tokenId, bytes data)","function setApprovalForAll(address operator, bool approved)","function supportsInterface(bytes4 interfaceId) view returns (bool)","function symbol() view returns (string)","function tokenURI(uint256 tokenId) pure returns (string)","function totalSupply() view returns (uint256)","function transferFrom(address from, address to, uint256 tokenId)"]},Fn=Ydu(Zdu),Xdu="6.8.1";function u6u(e,u,t){const n=u.split("|").map(i=>i.trim());for(let i=0;iPromise.resolve(e[n])))).reduce((n,r,i)=>(n[u[i]]=r,n),{})}function Ru(e,u,t){for(let n in u){let r=u[n];const i=t?t[n]:null;i&&u6u(r,i,n),Object.defineProperty(e,n,{enumerable:!0,value:r,writable:!1})}}function Rs(e){if(e==null)return"null";if(Array.isArray(e))return"[ "+e.map(Rs).join(", ")+" ]";if(e instanceof Uint8Array){const u="0123456789abcdef";let t="0x";for(let n=0;n>4],t+=u[e[n]&15];return t}if(typeof e=="object"&&typeof e.toJSON=="function")return Rs(e.toJSON());switch(typeof e){case"boolean":case"symbol":return e.toString();case"bigint":return BigInt(e).toString();case"number":return e.toString();case"string":return JSON.stringify(e);case"object":{const u=Object.keys(e);return u.sort(),"{ "+u.map(t=>`${Rs(t)}: ${Rs(e[t])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Dt(e,u){return e&&e.code===u}function em(e){return Dt(e,"CALL_EXCEPTION")}function _0(e,u,t){let n=e;{const i=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${Rs(t)}`);for(const a in t){if(a==="shortMessage")continue;const s=t[a];i.push(a+"="+Rs(s))}}i.push(`code=${u}`),i.push(`version=${Xdu}`),i.length&&(e+=" ("+i.join(", ")+")")}let r;switch(u){case"INVALID_ARGUMENT":r=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(e);break;default:r=new Error(e)}return Ru(r,{code:u}),t&&Object.assign(r,t),r.shortMessage==null&&Ru(r,{shortMessage:n}),r}function du(e,u,t,n){if(!e)throw _0(u,t,n)}function V(e,u,t,n){du(e,u,"INVALID_ARGUMENT",{argument:t,value:n})}function V_(e,u,t){t==null&&(t=""),t&&(t=": "+t),du(e>=u,"missing arguemnt"+t,"MISSING_ARGUMENT",{count:e,expectedCount:u}),du(e<=u,"too many arguemnts"+t,"UNEXPECTED_ARGUMENT",{count:e,expectedCount:u})}const e6u=["NFD","NFC","NFKD","NFKC"].reduce((e,u)=>{try{if("test".normalize(u)!=="test")throw new Error("bad");if(u==="NFD"){const t=String.fromCharCode(233).normalize("NFD"),n=String.fromCharCode(101,769);if(t!==n)throw new Error("broken")}e.push(u)}catch{}return e},[]);function t6u(e){du(e6u.indexOf(e)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:e}})}function Bd(e,u,t){if(t==null&&(t=""),e!==u){let n=t,r="new";t&&(n+=".",r+=" "+t),du(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:r})}}function J_(e,u,t){if(e instanceof Uint8Array)return t?new Uint8Array(e):e;if(typeof e=="string"&&e.match(/^0x([0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((e.length-2)/2);let r=2;for(let i=0;i>4]+GB[r&15]}return t}function R0(e){return"0x"+e.map(u=>Ou(u).substring(2)).join("")}function Zs(e){return h0(e,!0)?(e.length-2)/2:u0(e).length}function A0(e,u,t){const n=u0(e);return t!=null&&t>n.length&&du(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:t}),Ou(n.slice(u??0,t??n.length))}function Y_(e,u,t){const n=u0(e);du(u>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:u,offset:u+1});const r=new Uint8Array(u);return r.fill(0),t?r.set(n,u-n.length):r.set(n,0),Ou(r)}function Ha(e,u){return Y_(e,u,!0)}function r6u(e,u){return Y_(e,u,!1)}const yd=BigInt(0),Ht=BigInt(1),zs=9007199254740991;function i6u(e,u){const t=Fd(e,"value"),n=BigInt(Gu(u,"width"));if(du(t>>n===yd,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:e}),t>>n-Ht){const r=(Ht<=-zs&&e<=zs,"overflow",u||"value",e),BigInt(e);case"string":try{if(e==="")throw new Error("empty string");return e[0]==="-"&&e[1]!=="-"?-BigInt(e.substring(1)):BigInt(e)}catch(t){V(!1,`invalid BigNumberish string: ${t.message}`,u||"value",e)}}V(!1,"invalid BigNumberish value",u||"value",e)}function Fd(e,u){const t=Iu(e,u);return du(t>=yd,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),t}const QB="0123456789abcdef";function tm(e){if(e instanceof Uint8Array){let u="0x0";for(const t of e)u+=QB[t>>4],u+=QB[t&15];return BigInt(u)}return Iu(e)}function Gu(e,u){switch(typeof e){case"bigint":return V(e>=-zs&&e<=zs,"overflow",u||"value",e),Number(e);case"number":return V(Number.isInteger(e),"underflow",u||"value",e),V(e>=-zs&&e<=zs,"overflow",u||"value",e),e;case"string":try{if(e==="")throw new Error("empty string");return Gu(BigInt(e),u)}catch(t){V(!1,`invalid numeric string: ${t.message}`,u||"value",e)}}V(!1,"invalid numeric value",u||"value",e)}function a6u(e){return Gu(tm(e))}function wi(e,u){let n=Fd(e,"value").toString(16);if(u==null)n.length%2&&(n="0"+n);else{const r=Gu(u,"width");for(du(r*2>=n.length,`value exceeds width (${r} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});n.length>6===2;a++)i++;return i}return e==="OVERRUN"?t.length-u-1:0}function d6u(e,u,t,n,r){return e==="OVERLONG"?(V(typeof r=="number","invalid bad code point for replacement","badCodepoint",r),n.push(r),0):(n.push(65533),uS(e,u,t))}const f6u=Object.freeze({error:E6u,ignore:uS,replace:d6u});function p6u(e,u){u==null&&(u=f6u.error);const t=u0(e,"bytes"),n=[];let r=0;for(;r>7)){n.push(i);continue}let a=null,s=null;if((i&224)===192)a=1,s=127;else if((i&240)===224)a=2,s=2047;else if((i&248)===240)a=3,s=65535;else{(i&192)===128?r+=u("UNEXPECTED_CONTINUE",r-1,t,n):r+=u("BAD_PREFIX",r-1,t,n);continue}if(r-1+a>=t.length){r+=u("OVERRUN",r-1,t,n);continue}let o=i&(1<<8-a-1)-1;for(let l=0;l1114111){r+=u("OUT_OF_RANGE",r-1-a,t,n,o);continue}if(o>=55296&&o<=57343){r+=u("UTF16_SURROGATE",r-1-a,t,n,o);continue}if(o<=s){r+=u("OVERLONG",r-1-a,t,n,o);continue}n.push(o)}}return n}function or(e,u){u!=null&&(t6u(u),e=e.normalize(u));let t=[];for(let n=0;n>6|192),t.push(r&63|128);else if((r&64512)==55296){n++;const i=e.charCodeAt(n);V(n>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(r>>12|224),t.push(r>>6&63|128),t.push(r&63|128)}return new Uint8Array(t)}function h6u(e){return e.map(u=>u<=65535?String.fromCharCode(u):(u-=65536,String.fromCharCode((u>>10&1023)+55296,(u&1023)+56320))).join("")}function nm(e,u){return h6u(p6u(e,u))}function eS(e){async function u(t,n){const r=t.url.split(":")[0].toLowerCase();du(r==="http"||r==="https",`unsupported protocol ${r}`,"UNSUPPORTED_OPERATION",{info:{protocol:r},operation:"request"}),du(r==="https"||!t.credentials||t.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i;if(n){const E=new AbortController;i=E.signal,n.addListener(()=>{E.abort()})}const a={method:t.method,headers:new Headers(Array.from(t)),body:t.body||void 0,signal:i},s=await fetch(t.url,a),o={};s.headers.forEach((E,d)=>{o[d.toLowerCase()]=E});const l=await s.arrayBuffer(),c=l==null?null:new Uint8Array(l);return{statusCode:s.status,statusMessage:s.statusText,headers:o,body:c}}return u}const C6u=12,m6u=250;let VB=eS();const A6u=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),g6u=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let Y6=!1;async function tS(e,u){try{const t=e.match(A6u);if(!t)throw new Error("invalid data");return new gi(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?l6u(t[3]):y6u(t[3]))}catch{return new gi(599,"BAD REQUEST (invalid data: URI)",{},null,new Cr(e))}}function nS(e){async function u(t,n){try{const r=t.match(g6u);if(!r)throw new Error("invalid link");return new Cr(`${e}${r[2]}`)}catch{return new gi(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Cr(t))}}return u}const $E={data:tS,ipfs:nS("https://gateway.ipfs.io/ipfs/")},rS=new WeakMap;var ca,Gr;class B6u{constructor(u){q(this,ca,void 0);q(this,Gr,void 0);T(this,ca,[]),T(this,Gr,!1),rS.set(u,()=>{if(!b(this,Gr)){T(this,Gr,!0);for(const t of b(this,ca))setTimeout(()=>{t()},0);T(this,ca,[])}})}addListener(u){du(!b(this,Gr),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),b(this,ca).push(u)}get cancelled(){return b(this,Gr)}checkSignal(){du(!this.cancelled,"cancelled","CANCELLED",{})}}ca=new WeakMap,Gr=new WeakMap;function WE(e){if(e==null)throw new Error("missing signal; should not happen");return e.checkSignal(),e}var m4,A4,jt,Mn,g4,B4,j0,We,Ln,Ea,da,fa,fn,Un,Qr,pa,I3;const j2=class j2{constructor(u){q(this,pa);q(this,m4,void 0);q(this,A4,void 0);q(this,jt,void 0);q(this,Mn,void 0);q(this,g4,void 0);q(this,B4,void 0);q(this,j0,void 0);q(this,We,void 0);q(this,Ln,void 0);q(this,Ea,void 0);q(this,da,void 0);q(this,fa,void 0);q(this,fn,void 0);q(this,Un,void 0);q(this,Qr,void 0);T(this,B4,String(u)),T(this,m4,!1),T(this,A4,!0),T(this,jt,{}),T(this,Mn,""),T(this,g4,3e5),T(this,Un,{slotInterval:m6u,maxAttempts:C6u}),T(this,Qr,null)}get url(){return b(this,B4)}set url(u){T(this,B4,String(u))}get body(){return b(this,j0)==null?null:new Uint8Array(b(this,j0))}set body(u){if(u==null)T(this,j0,void 0),T(this,We,void 0);else if(typeof u=="string")T(this,j0,or(u)),T(this,We,"text/plain");else if(u instanceof Uint8Array)T(this,j0,u),T(this,We,"application/octet-stream");else if(typeof u=="object")T(this,j0,or(JSON.stringify(u))),T(this,We,"application/json");else throw new Error("invalid body")}hasBody(){return b(this,j0)!=null}get method(){return b(this,Mn)?b(this,Mn):this.hasBody()?"POST":"GET"}set method(u){u==null&&(u=""),T(this,Mn,String(u).toUpperCase())}get headers(){const u=Object.assign({},b(this,jt));return b(this,Ln)&&(u.authorization=`Basic ${c6u(or(b(this,Ln)))}`),this.allowGzip&&(u["accept-encoding"]="gzip"),u["content-type"]==null&&b(this,We)&&(u["content-type"]=b(this,We)),this.body&&(u["content-length"]=String(this.body.length)),u}getHeader(u){return this.headers[u.toLowerCase()]}setHeader(u,t){b(this,jt)[String(u).toLowerCase()]=String(t)}clearHeaders(){T(this,jt,{})}[Symbol.iterator](){const u=this.headers,t=Object.keys(u);let n=0;return{next:()=>{if(n=0,"timeout must be non-zero","timeout",u),T(this,g4,u)}get preflightFunc(){return b(this,Ea)||null}set preflightFunc(u){T(this,Ea,u)}get processFunc(){return b(this,da)||null}set processFunc(u){T(this,da,u)}get retryFunc(){return b(this,fa)||null}set retryFunc(u){T(this,fa,u)}get getUrlFunc(){return b(this,Qr)||VB}set getUrlFunc(u){T(this,Qr,u)}toString(){return``}setThrottleParams(u){u.slotInterval!=null&&(b(this,Un).slotInterval=u.slotInterval),u.maxAttempts!=null&&(b(this,Un).maxAttempts=u.maxAttempts)}send(){return du(b(this,fn)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),T(this,fn,new B6u(this)),cu(this,pa,I3).call(this,0,JB()+this.timeout,0,this,new gi(0,"",{},null,this))}cancel(){du(b(this,fn)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const u=rS.get(this);if(!u)throw new Error("missing signal; should not happen");u()}redirect(u){const t=this.url.split(":")[0].toLowerCase(),n=u.split(":")[0].toLowerCase();du(this.method==="GET"&&(t!=="https"||n!=="http")&&u.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(u)})`});const r=new j2(u);return r.method="GET",r.allowGzip=this.allowGzip,r.timeout=this.timeout,T(r,jt,Object.assign({},b(this,jt))),b(this,j0)&&T(r,j0,new Uint8Array(b(this,j0))),T(r,We,b(this,We)),r}clone(){const u=new j2(this.url);return T(u,Mn,b(this,Mn)),b(this,j0)&&T(u,j0,b(this,j0)),T(u,We,b(this,We)),T(u,jt,Object.assign({},b(this,jt))),T(u,Ln,b(this,Ln)),this.allowGzip&&(u.allowGzip=!0),u.timeout=this.timeout,this.allowInsecureAuthentication&&(u.allowInsecureAuthentication=!0),T(u,Ea,b(this,Ea)),T(u,da,b(this,da)),T(u,fa,b(this,fa)),T(u,Qr,b(this,Qr)),u}static lockConfig(){Y6=!0}static getGateway(u){return $E[u.toLowerCase()]||null}static registerGateway(u,t){if(u=u.toLowerCase(),u==="http"||u==="https")throw new Error(`cannot intercept ${u}; use registerGetUrl`);if(Y6)throw new Error("gateways locked");$E[u]=t}static registerGetUrl(u){if(Y6)throw new Error("gateways locked");VB=u}static createGetUrlFunc(u){return eS()}static createDataGateway(){return tS}static createIpfsGatewayFunc(u){return nS(u)}};m4=new WeakMap,A4=new WeakMap,jt=new WeakMap,Mn=new WeakMap,g4=new WeakMap,B4=new WeakMap,j0=new WeakMap,We=new WeakMap,Ln=new WeakMap,Ea=new WeakMap,da=new WeakMap,fa=new WeakMap,fn=new WeakMap,Un=new WeakMap,Qr=new WeakMap,pa=new WeakSet,I3=async function(u,t,n,r,i){var c,E,d;if(u>=b(this,Un).maxAttempts)return i.makeServerError("exceeded maximum retry limit");du(JB()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:r}),n>0&&await F6u(n);let a=this.clone();const s=(a.url.split(":")[0]||"").toLowerCase();if(s in $E){const f=await $E[s](a.url,WE(b(r,fn)));if(f instanceof gi){let p=f;if(this.processFunc){WE(b(r,fn));try{p=await this.processFunc(a,p)}catch(h){(h.throttle==null||typeof h.stall!="number")&&p.makeServerError("error in post-processing function",h).assertOk()}}return p}a=f}this.preflightFunc&&(a=await this.preflightFunc(a));const o=await this.getUrlFunc(a,WE(b(r,fn)));let l=new gi(o.statusCode,o.statusMessage,o.headers,o.body,r);if(l.statusCode===301||l.statusCode===302){try{const f=l.headers.location||"";return cu(c=a.redirect(f),pa,I3).call(c,u+1,t,0,r,l)}catch{}return l}else if(l.statusCode===429&&(this.retryFunc==null||await this.retryFunc(a,l,u))){const f=l.headers["retry-after"];let p=b(this,Un).slotInterval*Math.trunc(Math.random()*Math.pow(2,u));return typeof f=="string"&&f.match(/^[1-9][0-9]*$/)&&(p=parseInt(f)),cu(E=a.clone(),pa,I3).call(E,u+1,t,p,r,l)}if(this.processFunc){WE(b(r,fn));try{l=await this.processFunc(a,l)}catch(f){(f.throttle==null||typeof f.stall!="number")&&l.makeServerError("error in post-processing function",f).assertOk();let p=b(this,Un).slotInterval*Math.trunc(Math.random()*Math.pow(2,u));return f.stall>=0&&(p=f.stall),cu(d=a.clone(),pa,I3).call(d,u+1,t,p,r,l)}}return l};let Cr=j2;var Ec,dc,fc,Mt,y4,ha;const hm=class hm{constructor(u,t,n,r,i){q(this,Ec,void 0);q(this,dc,void 0);q(this,fc,void 0);q(this,Mt,void 0);q(this,y4,void 0);q(this,ha,void 0);T(this,Ec,u),T(this,dc,t),T(this,fc,Object.keys(n).reduce((a,s)=>(a[s.toLowerCase()]=String(n[s]),a),{})),T(this,Mt,r==null?null:new Uint8Array(r)),T(this,y4,i||null),T(this,ha,{message:""})}toString(){return``}get statusCode(){return b(this,Ec)}get statusMessage(){return b(this,dc)}get headers(){return Object.assign({},b(this,fc))}get body(){return b(this,Mt)==null?null:new Uint8Array(b(this,Mt))}get bodyText(){try{return b(this,Mt)==null?"":nm(b(this,Mt))}catch{du(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{du(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const u=this.headers,t=Object.keys(u);let n=0;return{next:()=>{if(n=0,"invalid stall timeout","stall",t);const n=new Error(u||"throttling requests");throw Ru(n,{stall:t,throttle:!0}),n}getHeader(u){return this.headers[u.toLowerCase()]}hasBody(){return b(this,Mt)!=null}get request(){return b(this,y4)}ok(){return b(this,ha).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:u,error:t}=b(this,ha);u===""&&(u=`server response ${this.statusCode} ${this.statusMessage}`),du(!1,u,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t})}};Ec=new WeakMap,dc=new WeakMap,fc=new WeakMap,Mt=new WeakMap,y4=new WeakMap,ha=new WeakMap;let gi=hm;function JB(){return new Date().getTime()}function y6u(e){return or(e.replace(/%([0-9a-f][0-9a-f])/gi,(u,t)=>String.fromCharCode(parseInt(t,16))))}function F6u(e){return new Promise(u=>setTimeout(u,e))}function D6u(e){let u=e.toString(16);for(;u.length<2;)u="0"+u;return"0x"+u}function YB(e,u,t){let n=0;for(let r=0;r{du(n<=e.length,"data short segment too short","BUFFER_OVERRUN",{buffer:e,length:e.length,offset:n})};if(e[u]>=248){const n=e[u]-247;t(u+1+n);const r=YB(e,u+1,n);return t(u+1+n+r),ZB(e,u,u+1+n,n+r)}else if(e[u]>=192){const n=e[u]-192;return t(u+1+n),ZB(e,u,u+1,n)}else if(e[u]>=184){const n=e[u]-183;t(u+1+n);const r=YB(e,u+1,n);t(u+1+n+r);const i=Ou(e.slice(u+1+n,u+1+n+r));return{consumed:1+n+r,result:i}}else if(e[u]>=128){const n=e[u]-128;t(u+1+n);const r=Ou(e.slice(u+1,u+1+n));return{consumed:1+n,result:r}}return{consumed:1,result:D6u(e[u])}}function rm(e){const u=u0(e,"data"),t=iS(u,0);return V(t.consumed===u.length,"unexpected junk after rlp payload","data",e),t.result}function XB(e){const u=[];for(;e;)u.unshift(e&255),e>>=8;return u}function aS(e){if(Array.isArray(e)){let n=[];if(e.forEach(function(i){n=n.concat(aS(i))}),n.length<=55)return n.unshift(192+n.length),n;const r=XB(n.length);return r.unshift(247+r.length),r.concat(n)}const u=Array.prototype.slice.call(u0(e,"object"));if(u.length===1&&u[0]<=127)return u;if(u.length<=55)return u.unshift(128+u.length),u;const t=XB(u.length);return t.unshift(183+t.length),t.concat(u)}const uy="0123456789abcdef";function Hl(e){let u="0x";for(const t of aS(e))u+=uy[t>>4],u+=uy[t&15];return u}const he=32,S5=new Uint8Array(he),v6u=["then"],qE={};function B3(e,u){const t=new Error(`deferred error during ABI decoding triggered accessing ${e}`);throw t.error=u,t}var Kr;const X3=class X3 extends Array{constructor(...t){const n=t[0];let r=t[1],i=(t[2]||[]).slice(),a=!0;n!==qE&&(r=t,i=[],a=!1);super(r.length);q(this,Kr,void 0);r.forEach((o,l)=>{this[l]=o});const s=i.reduce((o,l)=>(typeof l=="string"&&o.set(l,(o.get(l)||0)+1),o),new Map);if(T(this,Kr,Object.freeze(r.map((o,l)=>{const c=i[l];return c!=null&&s.get(c)===1?c:null}))),!!a)return Object.freeze(this),new Proxy(this,{get:(o,l,c)=>{if(typeof l=="string"){if(l.match(/^[0-9]+$/)){const d=Gu(l,"%index");if(d<0||d>=this.length)throw new RangeError("out of result range");const f=o[d];return f instanceof Error&&B3(`index ${d}`,f),f}if(v6u.indexOf(l)>=0)return Reflect.get(o,l,c);const E=o[l];if(E instanceof Function)return function(...d){return E.apply(this===c?o:this,d)};if(!(l in o))return o.getValue.apply(this===c?o:this,[l])}return Reflect.get(o,l,c)}})}toArray(){const t=[];return this.forEach((n,r)=>{n instanceof Error&&B3(`index ${r}`,n),t.push(n)}),t}toObject(){return b(this,Kr).reduce((t,n,r)=>(du(n!=null,"value at index ${ index } unnamed","UNSUPPORTED_OPERATION",{operation:"toObject()"}),n in t||(t[n]=this.getValue(n)),t),{})}slice(t,n){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const r=[],i=[];for(let a=t;a{b(this,$n)[u]=ey(t)}}}$n=new WeakMap,Ca=new WeakMap,F4=new WeakSet,m9=function(u){return b(this,$n).push(u),T(this,Ca,b(this,Ca)+u.length),u.length};var qe,Et,M2,sS;const Cm=class Cm{constructor(u,t){q(this,M2);eu(this,"allowLoose");q(this,qe,void 0);q(this,Et,void 0);Ru(this,{allowLoose:!!t}),T(this,qe,Pe(u)),T(this,Et,0)}get data(){return Ou(b(this,qe))}get dataLength(){return b(this,qe).length}get consumed(){return b(this,Et)}get bytes(){return new Uint8Array(b(this,qe))}subReader(u){return new Cm(b(this,qe).slice(b(this,Et)+u),this.allowLoose)}readBytes(u,t){let n=cu(this,M2,sS).call(this,0,u,!!t);return T(this,Et,b(this,Et)+n.length),n.slice(0,u)}readValue(){return tm(this.readBytes(he))}readIndex(){return a6u(this.readBytes(he))}};qe=new WeakMap,Et=new WeakMap,M2=new WeakSet,sS=function(u,t,n){let r=Math.ceil(t/he)*he;return b(this,Et)+r>b(this,qe).length&&(this.allowLoose&&n&&b(this,Et)+t<=b(this,qe).length?r=t:du(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Pe(b(this,qe)),length:b(this,qe).length,offset:b(this,Et)+r})),b(this,qe).slice(b(this,Et),b(this,Et)+r)};let T5=Cm,oS=!1;const lS=function(e){return tb(e)};let cS=lS;function p0(e){const u=u0(e,"data");return Ou(cS(u))}p0._=lS;p0.lock=function(){oS=!0};p0.register=function(e){if(oS)throw new TypeError("keccak256 is locked");cS=e};Object.freeze(p0);const O5="0x0000000000000000000000000000000000000000",ty="0x0000000000000000000000000000000000000000000000000000000000000000",ny=BigInt(0),ry=BigInt(1),iy=BigInt(2),ay=BigInt(27),sy=BigInt(28),HE=BigInt(35),ds={};function oy(e){return Ha(Ve(e),32)}var D4,v4,b4,ma;const It=class It{constructor(u,t,n,r){q(this,D4,void 0);q(this,v4,void 0);q(this,b4,void 0);q(this,ma,void 0);Bd(u,ds,"Signature"),T(this,D4,t),T(this,v4,n),T(this,b4,r),T(this,ma,null)}get r(){return b(this,D4)}set r(u){V(Zs(u)===32,"invalid r","value",u),T(this,D4,Ou(u))}get s(){return b(this,v4)}set s(u){V(Zs(u)===32,"invalid s","value",u);const t=Ou(u);V(parseInt(t.substring(0,3))<8,"non-canonical s","value",t),T(this,v4,t)}get v(){return b(this,b4)}set v(u){const t=Gu(u,"value");V(t===27||t===28,"invalid v","v",u),T(this,b4,t)}get networkV(){return b(this,ma)}get legacyChainId(){const u=this.networkV;return u==null?null:It.getChainId(u)}get yParity(){return this.v===27?0:1}get yParityAndS(){const u=u0(this.s);return this.yParity&&(u[0]|=128),Ou(u)}get compactSerialized(){return R0([this.r,this.yParityAndS])}get serialized(){return R0([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const u=new It(ds,this.r,this.s,this.v);return this.networkV&&T(u,ma,this.networkV),u}toJSON(){const u=this.networkV;return{_type:"signature",networkV:u!=null?u.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(u){const t=Iu(u,"v");return t==ay||t==sy?ny:(V(t>=HE,"invalid EIP-155 v","v",u),(t-HE)/iy)}static getChainIdV(u,t){return Iu(u)*iy+BigInt(35+t-27)}static getNormalizedV(u){const t=Iu(u);return t===ny||t===ay?27:t===ry||t===sy?28:(V(t>=HE,"invalid v","v",u),t&ry?27:28)}static from(u){function t(l,c){V(l,c,"signature",u)}if(u==null)return new It(ds,ty,ty,27);if(typeof u=="string"){const l=u0(u,"signature");if(l.length===64){const c=Ou(l.slice(0,32)),E=l.slice(32,64),d=E[0]&128?28:27;return E[0]&=127,new It(ds,c,Ou(E),d)}if(l.length===65){const c=Ou(l.slice(0,32)),E=l.slice(32,64);t((E[0]&128)===0,"non-canonical s");const d=It.getNormalizedV(l[64]);return new It(ds,c,Ou(E),d)}t(!1,"invalid raw signature length")}if(u instanceof It)return u.clone();const n=u.r;t(n!=null,"missing r");const r=oy(n),i=function(l,c){if(l!=null)return oy(l);if(c!=null){t(h0(c,32),"invalid yParityAndS");const E=u0(c);return E[0]&=127,Ou(E)}t(!1,"missing s")}(u.s,u.yParityAndS);t((u0(i)[0]&128)==0,"non-canonical s");const{networkV:a,v:s}=function(l,c,E){if(l!=null){const d=Iu(l);return{networkV:d>=HE?d:void 0,v:It.getNormalizedV(d)}}if(c!=null)return t(h0(c,32),"invalid yParityAndS"),{v:u0(c)[0]&128?28:27};if(E!=null){switch(Gu(E,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")}(u.v,u.yParityAndS,u.yParity),o=new It(ds,r,i,s);return a&&T(o,ma,a),t(u.yParity==null||Gu(u.yParity,"sig.yParity")===o.yParity,"yParity mismatch"),t(u.yParityAndS==null||u.yParityAndS===o.yParityAndS,"yParityAndS mismatch"),o}};D4=new WeakMap,v4=new WeakMap,b4=new WeakMap,ma=new WeakMap;let Zt=It;var Wn;const Hi=class Hi{constructor(u){q(this,Wn,void 0);V(Zs(u)===32,"invalid private key","privateKey","[REDACTED]"),T(this,Wn,Ou(u))}get privateKey(){return b(this,Wn)}get publicKey(){return Hi.computePublicKey(b(this,Wn))}get compressedPublicKey(){return Hi.computePublicKey(b(this,Wn),!0)}sign(u){V(Zs(u)===32,"invalid digest length","digest",u);const t=Sr.sign(Pe(u),Pe(b(this,Wn)),{lowS:!0});return Zt.from({r:wi(t.r,32),s:wi(t.s,32),v:t.recovery?28:27})}computeSharedSecret(u){const t=Hi.computePublicKey(u);return Ou(Sr.getSharedSecret(Pe(b(this,Wn)),u0(t),!1))}static computePublicKey(u,t){let n=u0(u,"key");if(n.length===32){const i=Sr.getPublicKey(n,!!t);return Ou(i)}if(n.length===64){const i=new Uint8Array(65);i[0]=4,i.set(n,1),n=i}const r=Sr.ProjectivePoint.fromHex(n);return Ou(r.toRawBytes(t))}static recoverPublicKey(u,t){V(Zs(u)===32,"invalid digest length","digest",u);const n=Zt.from(t);let r=Sr.Signature.fromCompact(Pe(R0([n.r,n.s])));r=r.addRecoveryBit(n.yParity);const i=r.recoverPublicKey(Pe(u));return V(i!=null,"invalid signautre for digest","signature",t),"0x"+i.toHex(!1)}static addPoints(u,t,n){const r=Sr.ProjectivePoint.fromHex(Hi.computePublicKey(u).substring(2)),i=Sr.ProjectivePoint.fromHex(Hi.computePublicKey(t).substring(2));return"0x"+r.add(i).toHex(!!n)}};Wn=new WeakMap;let Gl=Hi;const b6u=BigInt(0),w6u=BigInt(36);function ly(e){e=e.toLowerCase();const u=e.substring(2).split(""),t=new Uint8Array(40);for(let r=0;r<40;r++)t[r]=u[r].charCodeAt(0);const n=u0(p0(t));for(let r=0;r<40;r+=2)n[r>>1]>>4>=8&&(u[r]=u[r].toUpperCase()),(n[r>>1]&15)>=8&&(u[r+1]=u[r+1].toUpperCase());return"0x"+u.join("")}const im={};for(let e=0;e<10;e++)im[String(e)]=String(e);for(let e=0;e<26;e++)im[String.fromCharCode(65+e)]=String(10+e);const cy=15;function x6u(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let u=e.split("").map(n=>im[n]).join("");for(;u.length>=cy;){let n=u.substring(0,cy);u=parseInt(n,10)%97+u.substring(n.length)}let t=String(98-parseInt(u,10)%97);for(;t.length<2;)t="0"+t;return t}const k6u=function(){const e={};for(let u=0;u<36;u++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[u];e[t]=BigInt(u)}return e}();function _6u(e){e=e.toLowerCase();let u=b6u;for(let t=0;tu.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return b(this,Aa)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return b(this,Aa)===!0?-1:b(this,Aa)===!1?this.value.length:null}static from(u,t){return new Rn(Nn,u,t)}static uint8(u){return Du(u,8)}static uint16(u){return Du(u,16)}static uint24(u){return Du(u,24)}static uint32(u){return Du(u,32)}static uint40(u){return Du(u,40)}static uint48(u){return Du(u,48)}static uint56(u){return Du(u,56)}static uint64(u){return Du(u,64)}static uint72(u){return Du(u,72)}static uint80(u){return Du(u,80)}static uint88(u){return Du(u,88)}static uint96(u){return Du(u,96)}static uint104(u){return Du(u,104)}static uint112(u){return Du(u,112)}static uint120(u){return Du(u,120)}static uint128(u){return Du(u,128)}static uint136(u){return Du(u,136)}static uint144(u){return Du(u,144)}static uint152(u){return Du(u,152)}static uint160(u){return Du(u,160)}static uint168(u){return Du(u,168)}static uint176(u){return Du(u,176)}static uint184(u){return Du(u,184)}static uint192(u){return Du(u,192)}static uint200(u){return Du(u,200)}static uint208(u){return Du(u,208)}static uint216(u){return Du(u,216)}static uint224(u){return Du(u,224)}static uint232(u){return Du(u,232)}static uint240(u){return Du(u,240)}static uint248(u){return Du(u,248)}static uint256(u){return Du(u,256)}static uint(u){return Du(u,256)}static int8(u){return Du(u,-8)}static int16(u){return Du(u,-16)}static int24(u){return Du(u,-24)}static int32(u){return Du(u,-32)}static int40(u){return Du(u,-40)}static int48(u){return Du(u,-48)}static int56(u){return Du(u,-56)}static int64(u){return Du(u,-64)}static int72(u){return Du(u,-72)}static int80(u){return Du(u,-80)}static int88(u){return Du(u,-88)}static int96(u){return Du(u,-96)}static int104(u){return Du(u,-104)}static int112(u){return Du(u,-112)}static int120(u){return Du(u,-120)}static int128(u){return Du(u,-128)}static int136(u){return Du(u,-136)}static int144(u){return Du(u,-144)}static int152(u){return Du(u,-152)}static int160(u){return Du(u,-160)}static int168(u){return Du(u,-168)}static int176(u){return Du(u,-176)}static int184(u){return Du(u,-184)}static int192(u){return Du(u,-192)}static int200(u){return Du(u,-200)}static int208(u){return Du(u,-208)}static int216(u){return Du(u,-216)}static int224(u){return Du(u,-224)}static int232(u){return Du(u,-232)}static int240(u){return Du(u,-240)}static int248(u){return Du(u,-248)}static int256(u){return Du(u,-256)}static int(u){return Du(u,-256)}static bytes1(u){return Ju(u,1)}static bytes2(u){return Ju(u,2)}static bytes3(u){return Ju(u,3)}static bytes4(u){return Ju(u,4)}static bytes5(u){return Ju(u,5)}static bytes6(u){return Ju(u,6)}static bytes7(u){return Ju(u,7)}static bytes8(u){return Ju(u,8)}static bytes9(u){return Ju(u,9)}static bytes10(u){return Ju(u,10)}static bytes11(u){return Ju(u,11)}static bytes12(u){return Ju(u,12)}static bytes13(u){return Ju(u,13)}static bytes14(u){return Ju(u,14)}static bytes15(u){return Ju(u,15)}static bytes16(u){return Ju(u,16)}static bytes17(u){return Ju(u,17)}static bytes18(u){return Ju(u,18)}static bytes19(u){return Ju(u,19)}static bytes20(u){return Ju(u,20)}static bytes21(u){return Ju(u,21)}static bytes22(u){return Ju(u,22)}static bytes23(u){return Ju(u,23)}static bytes24(u){return Ju(u,24)}static bytes25(u){return Ju(u,25)}static bytes26(u){return Ju(u,26)}static bytes27(u){return Ju(u,27)}static bytes28(u){return Ju(u,28)}static bytes29(u){return Ju(u,29)}static bytes30(u){return Ju(u,30)}static bytes31(u){return Ju(u,31)}static bytes32(u){return Ju(u,32)}static address(u){return new Rn(Nn,"address",u)}static bool(u){return new Rn(Nn,"bool",!!u)}static bytes(u){return new Rn(Nn,"bytes",u)}static string(u){return new Rn(Nn,"string",u)}static array(u,t){throw new Error("not implemented yet")}static tuple(u,t){throw new Error("not implemented yet")}static overrides(u){return new Rn(Nn,"overrides",Object.assign({},u))}static isTyped(u){return u&&typeof u=="object"&&"_typedSymbol"in u&&u._typedSymbol===Ey}static dereference(u,t){if(Rn.isTyped(u)){if(u.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${u.type}`);return u.value}return u}};Aa=new WeakMap;let le=Rn;class P6u extends vr{constructor(u){super("address","address",u,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(u,t){let n=le.dereference(t,"string");try{n=Zu(n)}catch(r){return this._throwError(r.message,t)}return u.writeValue(n)}decode(u){return Zu(wi(u.readValue(),20))}}class T6u extends vr{constructor(t){super(t.name,t.type,"_",t.dynamic);eu(this,"coder");this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,n){return this.coder.encode(t,n)}decode(t){return this.coder.decode(t)}}function dS(e,u,t){let n=[];if(Array.isArray(t))n=t;else if(t&&typeof t=="object"){let o={};n=u.map(l=>{const c=l.localName;return du(c,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:t}),du(!o[c],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:t}),o[c]=!0,t[c]})}else V(!1,"invalid tuple value","tuple",t);V(u.length===n.length,"types/value length mismatch","tuple",t);let r=new P5,i=new P5,a=[];u.forEach((o,l)=>{let c=n[l];if(o.dynamic){let E=i.length;o.encode(i,c);let d=r.writeUpdatableValue();a.push(f=>{d(f+E)})}else o.encode(r,c)}),a.forEach(o=>{o(r.length)});let s=e.appendWriter(r);return s+=e.appendWriter(i),s}function fS(e,u){let t=[],n=[],r=e.subReader(0);return u.forEach(i=>{let a=null;if(i.dynamic){let s=e.readIndex(),o=r.subReader(s);try{a=i.decode(o)}catch(l){if(Dt(l,"BUFFER_OVERRUN"))throw l;a=l,a.baseType=i.name,a.name=i.localName,a.type=i.type}}else try{a=i.decode(e)}catch(s){if(Dt(s,"BUFFER_OVERRUN"))throw s;a=s,a.baseType=i.name,a.name=i.localName,a.type=i.type}if(a==null)throw new Error("investigate");t.push(a),n.push(i.localName||null)}),x2.fromItems(t,n)}class O6u extends vr{constructor(t,n,r){const i=t.type+"["+(n>=0?n:"")+"]",a=n===-1||t.dynamic;super("array",i,r,a);eu(this,"coder");eu(this,"length");Ru(this,{coder:t,length:n})}defaultValue(){const t=this.coder.defaultValue(),n=[];for(let r=0;ra||r<-(a+L6u))&&this._throwError("value out-of-bounds",n),r=Z_(r,8*he)}else(rO3(i,this.size*8))&&this._throwError("value out-of-bounds",n);return t.writeValue(r)}decode(t){let n=O3(t.readValue(),this.size*8);return this.signed&&(n=i6u(n,this.size*8)),n}}class W6u extends pS{constructor(u){super("string",u)}defaultValue(){return""}encode(u,t){return super.encode(u,or(le.dereference(t,"string")))}decode(u){return nm(super.decode(u))}}class GE extends vr{constructor(t,n){let r=!1;const i=[];t.forEach(s=>{s.dynamic&&(r=!0),i.push(s.type)});const a="tuple("+i.join(",")+")";super("tuple",a,n,r);eu(this,"coders");Ru(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach(r=>{t.push(r.defaultValue())});const n=this.coders.reduce((r,i)=>{const a=i.localName;return a&&(r[a]||(r[a]=0),r[a]++),r},{});return this.coders.forEach((r,i)=>{let a=r.localName;!a||n[a]!==1||(a==="length"&&(a="_length"),t[a]==null&&(t[a]=t[i]))}),Object.freeze(t)}encode(t,n){const r=le.dereference(n,"tuple");return dS(t,this.coders,r)}decode(t){return fS(t,this.coders)}}function Ga(e){return p0(or(e))}var q6u="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";const dy=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),fy=4;function H6u(e){let u=0;function t(){return e[u++]<<8|e[u++]}let n=t(),r=1,i=[0,1];for(let w=1;w>--o&1}const E=31,d=2**E,f=d>>>1,p=f>>1,h=d-1;let g=0;for(let w=0;w1;){let N=v+C>>>1;w>>1|c(),k=k<<1^f,j=(j^f)<<1|f|1;m=k,B=1+j-k}let F=n-4;return A.map(w=>{switch(w-F){case 3:return F+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return F+256+(e[s++]<<8|e[s++]);case 1:return F+e[s++];default:return w-1}})}function G6u(e){let u=0;return()=>e[u++]}function hS(e){return G6u(H6u(Q6u(e)))}function Q6u(e){let u=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((r,i)=>u[r.charCodeAt(0)]=i);let t=e.length,n=new Uint8Array(6*t>>3);for(let r=0,i=0,a=0,s=0;r=8&&(n[i++]=s>>(a-=8));return n}function K6u(e){return e&1?~e>>1:e>>1}function V6u(e,u){let t=Array(e);for(let n=0,r=0;n{let u=Ql(e);if(u.length)return u})}function mS(e){let u=[];for(;;){let t=e();if(t==0)break;u.push(J6u(t,e))}for(;;){let t=e()-1;if(t<0)break;u.push(Y6u(t,e))}return u.flat()}function Kl(e){let u=[];for(;;){let t=e(u.length);if(!t)break;u.push(t)}return u}function AS(e,u,t){let n=Array(e).fill().map(()=>[]);for(let r=0;rn[a].push(i));return n}function J6u(e,u){let t=1+u(),n=u(),r=Kl(u);return AS(r.length,1+e,u).flatMap((a,s)=>{let[o,...l]=a;return Array(r[s]).fill().map((c,E)=>{let d=E*n;return[o+E*t,l.map(f=>f+d)]})})}function Y6u(e,u){let t=1+u();return AS(t,1+e,u).map(r=>[r[0],r.slice(1)])}function Z6u(e){let u=[],t=Ql(e);return r(n([]),[]),u;function n(i){let a=e(),s=Kl(()=>{let o=Ql(e).map(l=>t[l]);if(o.length)return n(o)});return{S:a,B:s,Q:i}}function r({S:i,B:a},s,o){if(!(i&4&&o===s[s.length-1])){i&2&&(o=s[s.length-1]),i&1&&u.push(s);for(let l of a)for(let c of l.Q)r(l,[...s,c],o)}}}function X6u(e){return e.toString(16).toUpperCase().padStart(2,"0")}function gS(e){return`{${X6u(e)}}`}function ufu(e){let u=[];for(let t=0,n=e.length;t>24&255}function FS(e){return e&16777215}let I5,py,N5,A9;function ofu(){let e=hS(tfu);I5=new Map(CS(e).flatMap((u,t)=>u.map(n=>[n,t+1<<24]))),py=new Set(Ql(e)),N5=new Map,A9=new Map;for(let[u,t]of mS(e)){if(!py.has(u)&&t.length==2){let[n,r]=t,i=A9.get(n);i||(i=new Map,A9.set(n,i)),i.set(r,u)}N5.set(u,t.reverse())}}function DS(e){return e>=Vl&&e=k2&&e=_2&&uS2&&u0&&r(S2+l)}else{let a=N5.get(i);a?t.push(...a):r(i)}if(!t.length)break;i=t.pop()}if(n&&u.length>1){let i=N3(u[0]);for(let a=1;a0&&r>=a)a==0?(u.push(n,...t),t.length=0,n=s):t.push(s),r=a;else{let o=lfu(n,s);o>=0?n=o:r==0&&a==0?(u.push(n),n=s):(t.push(s),r=a)}}return n>=0&&u.push(n,...t),u}function bS(e){return vS(e).map(FS)}function Efu(e){return cfu(vS(e))}const hy=45,wS=".",xS=65039,kS=1,Ms=e=>Array.from(e);function Jl(e,u){return e.P.has(u)||e.Q.has(u)}class dfu extends Array{get is_emoji(){return!0}}let R5,_S,Xi,z5,SS,Xs,X6,Bs,PS,Cy,j5;function am(){if(R5)return;let e=hS(q6u);const u=()=>Ql(e),t=()=>new Set(u());R5=new Map(mS(e)),_S=t(),Xi=u(),z5=new Set(u().map(c=>Xi[c])),Xi=new Set(Xi),SS=t(),t();let n=CS(e),r=e();const i=()=>new Set(u().flatMap(c=>n[c]).concat(u()));Xs=Kl(c=>{let E=Kl(e).map(d=>d+96);if(E.length){let d=c>=r;E[0]-=32,E=xo(E),d&&(E=`Restricted[${E}]`);let f=i(),p=i(),h=!e();return{N:E,P:f,Q:p,M:h,R:d}}}),X6=t(),Bs=new Map;let a=u().concat(Ms(X6)).sort((c,E)=>c-E);a.forEach((c,E)=>{let d=e(),f=a[E]=d?a[E-d]:{V:[],M:new Map};f.V.push(c),X6.has(c)||Bs.set(c,f)});for(let{V:c,M:E}of new Set(Bs.values())){let d=[];for(let p of c){let h=Xs.filter(A=>Jl(A,p)),g=d.find(({G:A})=>h.some(m=>A.has(m)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),h.forEach(A=>g.G.add(A))}let f=d.flatMap(p=>Ms(p.G));for(let{G:p,V:h}of d){let g=new Set(f.filter(A=>!p.has(A)));for(let A of h)E.set(A,g)}}let s=new Set,o=new Set;const l=c=>s.has(c)?o.add(c):s.add(c);for(let c of Xs){for(let E of c.P)l(E);for(let E of c.Q)l(E)}for(let c of s)!Bs.has(c)&&!o.has(c)&&Bs.set(c,kS);PS=new Set(Ms(s).concat(Ms(bS(s)))),Cy=Z6u(e).map(c=>dfu.from(c)).sort(efu),j5=new Map;for(let c of Cy){let E=[j5];for(let d of c){let f=E.map(p=>{let h=p.get(d);return h||(h=new Map,p.set(d,h)),h});d===xS?E.push(...f):E=f}for(let d of E)d.V=c}}function sm(e){return(TS(e)?"":`${om(Dd([e]))} `)+gS(e)}function om(e){return`"${e}"‎`}function ffu(e){if(e.length>=4&&e[2]==hy&&e[3]==hy)throw new Error(`invalid label extension: "${xo(e.slice(0,4))}"`)}function pfu(e){for(let t=e.lastIndexOf(95);t>0;)if(e[--t]!==95)throw new Error("underscore allowed only at start")}function hfu(e){let u=e[0],t=dy.get(u);if(t)throw Y3(`leading ${t}`);let n=e.length,r=-1;for(let i=1;i{let i=ufu(r),a={input:i,offset:n};n+=i.length+1;try{let s=a.tokens=Dfu(i,u,t),o=s.length,l;if(!o)throw new Error("empty label");let c=a.output=s.flat();if(pfu(c),!(a.emoji=o>1||s[0].is_emoji)&&c.every(d=>d<128))ffu(c),l="ASCII";else{let d=s.flatMap(f=>f.is_emoji?[]:f);if(!d.length)l="Emoji";else{if(Xi.has(c[0]))throw Y3("leading combining mark");for(let h=1;ha.has(s)):Ms(a),!t.length)return}else n.push(r)}if(t){for(let r of t)if(n.every(i=>Jl(r,i)))throw new Error(`whole-script confusable: ${e.N}/${r.N}`)}}function Bfu(e){let u=Xs;for(let t of e){let n=u.filter(r=>Jl(r,t));if(!n.length)throw Xs.some(r=>Jl(r,t))?IS(u[0],t):OS(t);if(u=n,n.length==1)break}return u}function yfu(e){return e.map(({input:u,error:t,output:n})=>{if(t){let r=t.message;throw new Error(e.length==1?r:`Invalid label ${om(Dd(u))}: ${r}`)}return xo(n)}).join(wS)}function OS(e){return new Error(`disallowed character: ${sm(e)}`)}function IS(e,u){let t=sm(u),n=Xs.find(r=>r.P.has(u));return n&&(t=`${n.N} ${t}`),new Error(`illegal mixture: ${e.N} + ${t}`)}function Y3(e){return new Error(`illegal placement: ${e}`)}function Ffu(e,u){for(let t of u)if(!Jl(e,t))throw IS(e,t);if(e.M){let t=bS(u);for(let n=1,r=t.length;nfy)throw new Error(`excessive non-spacing marks: ${om(Dd(t.slice(n-1,i)))} (${i-n}/${fy})`);n=i}}}function Dfu(e,u,t){let n=[],r=[];for(e=e.slice().reverse();e.length;){let i=bfu(e);if(i)r.length&&(n.push(u(r)),r=[]),n.push(t(i));else{let a=e.pop();if(PS.has(a))r.push(a);else{let s=R5.get(a);if(s)r.push(...s);else if(!_S.has(a))throw OS(a)}}}return r.length&&n.push(u(r)),n}function vfu(e){return e.filter(u=>u!=xS)}function bfu(e,u){let t=j5,n,r=e.length;for(;r&&(t=t.get(e[--r]),!!t);){let{V:i}=t;i&&(n=i,u&&u.push(...e.slice(r).reverse()),e.length=r)}return n}const NS=new Uint8Array(32);NS.fill(0);function my(e){return V(e.length!==0,"invalid ENS name; empty component","comp",e),e}function RS(e){const u=or(wfu(e)),t=[];if(e.length===0)return t;let n=0;for(let r=0;r{if(u.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(u.length+1);return t.set(u,1),t[0]=t.length-1,t})))+"00"}function uf(e,u){return{address:Zu(e),storageKeys:u.map((t,n)=>(V(h0(t,32),"invalid slot",`storageKeys[${n}]`,t),t.toLowerCase()))}}function is(e){if(Array.isArray(e))return e.map((t,n)=>Array.isArray(t)?(V(t.length===2,"invalid slot set",`value[${n}]`,t),uf(t[0],t[1])):(V(t!=null&&typeof t=="object","invalid address-slot set","value",e),uf(t.address,t.storageKeys)));V(e!=null&&typeof e=="object","invalid access list","value",e);const u=Object.keys(e).map(t=>{const n=e[t].reduce((r,i)=>(r[i]=!0,r),{});return uf(t,Object.keys(n).sort())});return u.sort((t,n)=>t.address.localeCompare(n.address)),u}function kfu(e){let u;return typeof e=="string"?u=Gl.computePublicKey(e,!1):u=e.publicKey,Zu(p0("0x"+u.substring(4)).substring(26))}function _fu(e,u){return kfu(Gl.recoverPublicKey(e,u))}const _e=BigInt(0),Sfu=BigInt(2),Pfu=BigInt(27),Tfu=BigInt(28),Ofu=BigInt(35),Ifu=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function lm(e){return e==="0x"?null:Zu(e)}function zS(e,u){try{return is(e)}catch(t){V(!1,t.message,u,e)}}function vd(e,u){return e==="0x"?0:Gu(e,u)}function fe(e,u){if(e==="0x")return _e;const t=Iu(e,u);return V(t<=Ifu,"value exceeds uint size",u,t),t}function H0(e,u){const t=Iu(e,"value"),n=Ve(t);return V(n.length<=32,"value too large",`tx.${u}`,t),n}function jS(e){return is(e).map(u=>[u.address,u.storageKeys])}function Nfu(e){const u=rm(e);V(Array.isArray(u)&&(u.length===9||u.length===6),"invalid field count for legacy transaction","data",e);const t={type:0,nonce:vd(u[0],"nonce"),gasPrice:fe(u[1],"gasPrice"),gasLimit:fe(u[2],"gasLimit"),to:lm(u[3]),value:fe(u[4],"value"),data:Ou(u[5]),chainId:_e};if(u.length===6)return t;const n=fe(u[6],"v"),r=fe(u[7],"r"),i=fe(u[8],"s");if(r===_e&&i===_e)t.chainId=n;else{let a=(n-Ofu)/Sfu;a<_e&&(a=_e),t.chainId=a,V(a!==_e||n===Pfu||n===Tfu,"non-canonical legacy v","v",u[6]),t.signature=Zt.from({r:Ha(u[7],32),s:Ha(u[8],32),v:n}),t.hash=p0(e)}return t}function Ay(e,u){const t=[H0(e.nonce||0,"nonce"),H0(e.gasPrice||0,"gasPrice"),H0(e.gasLimit||0,"gasLimit"),e.to!=null?Zu(e.to):"0x",H0(e.value||0,"value"),e.data||"0x"];let n=_e;if(e.chainId!=_e)n=Iu(e.chainId,"tx.chainId"),V(!u||u.networkV==null||u.legacyChainId===n,"tx.chainId/sig.v mismatch","sig",u);else if(e.signature){const i=e.signature.legacyChainId;i!=null&&(n=i)}if(!u)return n!==_e&&(t.push(Ve(n)),t.push("0x"),t.push("0x")),Hl(t);let r=BigInt(27+u.yParity);return n!==_e?r=Zt.getChainIdV(n,u.v):BigInt(u.v)!==r&&V(!1,"tx.chainId/sig.v mismatch","sig",u),t.push(Ve(r)),t.push(Ve(u.r)),t.push(Ve(u.s)),Hl(t)}function MS(e,u){let t;try{if(t=vd(u[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{V(!1,"invalid yParity","yParity",u[0])}const n=Ha(u[1],32),r=Ha(u[2],32),i=Zt.from({r:n,s:r,yParity:t});e.signature=i}function Rfu(e){const u=rm(u0(e).slice(1));V(Array.isArray(u)&&(u.length===9||u.length===12),"invalid field count for transaction type: 2","data",Ou(e));const t=fe(u[2],"maxPriorityFeePerGas"),n=fe(u[3],"maxFeePerGas"),r={type:2,chainId:fe(u[0],"chainId"),nonce:vd(u[1],"nonce"),maxPriorityFeePerGas:t,maxFeePerGas:n,gasPrice:null,gasLimit:fe(u[4],"gasLimit"),to:lm(u[5]),value:fe(u[6],"value"),data:Ou(u[7]),accessList:zS(u[8],"accessList")};return u.length===9||(r.hash=p0(e),MS(r,u.slice(9))),r}function gy(e,u){const t=[H0(e.chainId||0,"chainId"),H0(e.nonce||0,"nonce"),H0(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),H0(e.maxFeePerGas||0,"maxFeePerGas"),H0(e.gasLimit||0,"gasLimit"),e.to!=null?Zu(e.to):"0x",H0(e.value||0,"value"),e.data||"0x",jS(e.accessList||[])];return u&&(t.push(H0(u.yParity,"yParity")),t.push(Ve(u.r)),t.push(Ve(u.s))),R0(["0x02",Hl(t)])}function zfu(e){const u=rm(u0(e).slice(1));V(Array.isArray(u)&&(u.length===8||u.length===11),"invalid field count for transaction type: 1","data",Ou(e));const t={type:1,chainId:fe(u[0],"chainId"),nonce:vd(u[1],"nonce"),gasPrice:fe(u[2],"gasPrice"),gasLimit:fe(u[3],"gasLimit"),to:lm(u[4]),value:fe(u[5],"value"),data:Ou(u[6]),accessList:zS(u[7],"accessList")};return u.length===8||(t.hash=p0(e),MS(t,u.slice(8))),t}function By(e,u){const t=[H0(e.chainId||0,"chainId"),H0(e.nonce||0,"nonce"),H0(e.gasPrice||0,"gasPrice"),H0(e.gasLimit||0,"gasLimit"),e.to!=null?Zu(e.to):"0x",H0(e.value||0,"value"),e.data||"0x",jS(e.accessList||[])];return u&&(t.push(H0(u.yParity,"recoveryParam")),t.push(Ve(u.r)),t.push(Ve(u.s))),R0(["0x01",Hl(t)])}var qn,w4,x4,k4,_4,S4,P4,T4,O4,I4,N4,R4;const Nr=class Nr{constructor(){q(this,qn,void 0);q(this,w4,void 0);q(this,x4,void 0);q(this,k4,void 0);q(this,_4,void 0);q(this,S4,void 0);q(this,P4,void 0);q(this,T4,void 0);q(this,O4,void 0);q(this,I4,void 0);q(this,N4,void 0);q(this,R4,void 0);T(this,qn,null),T(this,w4,null),T(this,k4,0),T(this,_4,BigInt(0)),T(this,S4,null),T(this,P4,null),T(this,T4,null),T(this,x4,"0x"),T(this,O4,BigInt(0)),T(this,I4,BigInt(0)),T(this,N4,null),T(this,R4,null)}get type(){return b(this,qn)}set type(u){switch(u){case null:T(this,qn,null);break;case 0:case"legacy":T(this,qn,0);break;case 1:case"berlin":case"eip-2930":T(this,qn,1);break;case 2:case"london":case"eip-1559":T(this,qn,2);break;default:V(!1,"unsupported transaction type","type",u)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559"}return null}get to(){return b(this,w4)}set to(u){T(this,w4,u==null?null:Zu(u))}get nonce(){return b(this,k4)}set nonce(u){T(this,k4,Gu(u,"value"))}get gasLimit(){return b(this,_4)}set gasLimit(u){T(this,_4,Iu(u))}get gasPrice(){const u=b(this,S4);return u==null&&(this.type===0||this.type===1)?_e:u}set gasPrice(u){T(this,S4,u==null?null:Iu(u,"gasPrice"))}get maxPriorityFeePerGas(){const u=b(this,P4);return u??(this.type===2?_e:null)}set maxPriorityFeePerGas(u){T(this,P4,u==null?null:Iu(u,"maxPriorityFeePerGas"))}get maxFeePerGas(){const u=b(this,T4);return u??(this.type===2?_e:null)}set maxFeePerGas(u){T(this,T4,u==null?null:Iu(u,"maxFeePerGas"))}get data(){return b(this,x4)}set data(u){T(this,x4,Ou(u))}get value(){return b(this,O4)}set value(u){T(this,O4,Iu(u,"value"))}get chainId(){return b(this,I4)}set chainId(u){T(this,I4,Iu(u))}get signature(){return b(this,N4)||null}set signature(u){T(this,N4,u==null?null:Zt.from(u))}get accessList(){const u=b(this,R4)||null;return u??(this.type===1||this.type===2?[]:null)}set accessList(u){T(this,R4,u==null?null:is(u))}get hash(){return this.signature==null?null:p0(this.serialized)}get unsignedHash(){return p0(this.unsignedSerialized)}get from(){return this.signature==null?null:_fu(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:Gl.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){switch(du(this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"}),this.inferType()){case 0:return Ay(this,this.signature);case 1:return By(this,this.signature);case 2:return gy(this,this.signature)}du(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get unsignedSerialized(){switch(this.inferType()){case 0:return Ay(this);case 1:return By(this);case 2:return gy(this)}du(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".unsignedSerialized"})}inferType(){return this.inferTypes().pop()}inferTypes(){const u=this.gasPrice!=null,t=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&du(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),du(!t||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),du(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const r=[];return this.type!=null?r.push(this.type):t?r.push(2):u?(r.push(1),n||r.push(0)):n?(r.push(1),r.push(2)):(r.push(0),r.push(1),r.push(2)),r.sort(),r}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}clone(){return Nr.from(this)}toJSON(){const u=t=>t==null?null:t.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:u(this.gasLimit),gasPrice:u(this.gasPrice),maxPriorityFeePerGas:u(this.maxPriorityFeePerGas),maxFeePerGas:u(this.maxFeePerGas),value:u(this.value),chainId:u(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(u){if(u==null)return new Nr;if(typeof u=="string"){const n=u0(u);if(n[0]>=127)return Nr.from(Nfu(n));switch(n[0]){case 1:return Nr.from(zfu(n));case 2:return Nr.from(Rfu(n))}du(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new Nr;return u.type!=null&&(t.type=u.type),u.to!=null&&(t.to=u.to),u.nonce!=null&&(t.nonce=u.nonce),u.gasLimit!=null&&(t.gasLimit=u.gasLimit),u.gasPrice!=null&&(t.gasPrice=u.gasPrice),u.maxPriorityFeePerGas!=null&&(t.maxPriorityFeePerGas=u.maxPriorityFeePerGas),u.maxFeePerGas!=null&&(t.maxFeePerGas=u.maxFeePerGas),u.data!=null&&(t.data=u.data),u.value!=null&&(t.value=u.value),u.chainId!=null&&(t.chainId=u.chainId),u.signature!=null&&(t.signature=Zt.from(u.signature)),u.accessList!=null&&(t.accessList=u.accessList),u.hash!=null&&(V(t.isSigned(),"unsigned transaction cannot define hash","tx",u),V(t.hash===u.hash,"hash mismatch","tx",u)),u.from!=null&&(V(t.isSigned(),"unsigned transaction cannot define from","tx",u),V(t.from.toLowerCase()===(u.from||"").toLowerCase(),"from mismatch","tx",u)),t}};qn=new WeakMap,w4=new WeakMap,x4=new WeakMap,k4=new WeakMap,_4=new WeakMap,S4=new WeakMap,P4=new WeakMap,T4=new WeakMap,O4=new WeakMap,I4=new WeakMap,N4=new WeakMap,R4=new WeakMap;let T2=Nr;const LS=new Uint8Array(32);LS.fill(0);const jfu=BigInt(-1),US=BigInt(0),$S=BigInt(1),Mfu=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function Lfu(e){const u=u0(e),t=u.length%32;return t?R0([u,LS.slice(t)]):Ou(u)}const Ufu=wi($S,32),$fu=wi(US,32),yy={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ef=["name","version","chainId","verifyingContract","salt"];function Fy(e){return function(u){return V(typeof u=="string",`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,u),u}}const Wfu={name:Fy("name"),version:Fy("version"),chainId:function(e){const u=Iu(e,"domain.chainId");return V(u>=0,"invalid chain ID","domain.chainId",e),Number.isSafeInteger(u)?Number(u):js(u)},verifyingContract:function(e){try{return Zu(e).toLowerCase()}catch{}V(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){const u=u0(e,"domain.salt");return V(u.length===32,'invalid domain value "salt"',"domain.salt",e),Ou(u)}};function tf(e){{const u=e.match(/^(u?)int(\d*)$/);if(u){const t=u[1]==="",n=parseInt(u[2]||"256");V(n%8===0&&n!==0&&n<=256&&(u[2]==null||u[2]===String(n)),"invalid numeric width","type",e);const r=O3(Mfu,t?n-1:n),i=t?(r+$S)*jfu:US;return function(a){const s=Iu(a,"value");return V(s>=i&&s<=r,`value out-of-bounds for ${e}`,"value",s),wi(t?Z_(s,256):s,32)}}}{const u=e.match(/^bytes(\d+)$/);if(u){const t=parseInt(u[1]);return V(t!==0&&t<=32&&u[1]===String(t),"invalid bytes width","type",e),function(n){const r=u0(n);return V(r.length===t,`invalid length for ${e}`,"value",n),Lfu(n)}}}switch(e){case"address":return function(u){return Ha(Zu(u),32)};case"bool":return function(u){return u?Ufu:$fu};case"bytes":return function(u){return p0(u)};case"string":return function(u){return Ga(u)}}return null}function Dy(e,u){return`${e}(${u.map(({name:t,type:n})=>n+" "+t).join(",")})`}var pc,Hn,z4,L2,WS;const it=class it{constructor(u){q(this,L2);eu(this,"primaryType");q(this,pc,void 0);q(this,Hn,void 0);q(this,z4,void 0);T(this,pc,JSON.stringify(u)),T(this,Hn,new Map),T(this,z4,new Map);const t=new Map,n=new Map,r=new Map;Object.keys(u).forEach(s=>{t.set(s,new Set),n.set(s,[]),r.set(s,new Set)});for(const s in u){const o=new Set;for(const l of u[s]){V(!o.has(l.name),`duplicate variable name ${JSON.stringify(l.name)} in ${JSON.stringify(s)}`,"types",u),o.add(l.name);const c=l.type.match(/^([^\x5b]*)(\x5b|$)/)[1]||null;V(c!==s,`circular type reference to ${JSON.stringify(c)}`,"types",u),!tf(c)&&(V(n.has(c),`unknown type ${JSON.stringify(c)}`,"types",u),n.get(c).push(s),t.get(s).add(c))}}const i=Array.from(n.keys()).filter(s=>n.get(s).length===0);V(i.length!==0,"missing primary type","types",u),V(i.length===1,`ambiguous primary types or unused types: ${i.map(s=>JSON.stringify(s)).join(", ")}`,"types",u),Ru(this,{primaryType:i[0]});function a(s,o){V(!o.has(s),`circular type reference to ${JSON.stringify(s)}`,"types",u),o.add(s);for(const l of t.get(s))if(n.has(l)){a(l,o);for(const c of o)r.get(c).add(l)}o.delete(s)}a(this.primaryType,new Set);for(const[s,o]of r){const l=Array.from(o);l.sort(),b(this,Hn).set(s,Dy(s,u[s])+l.map(c=>Dy(c,u[c])).join(""))}}get types(){return JSON.parse(b(this,pc))}getEncoder(u){let t=b(this,z4).get(u);return t||(t=cu(this,L2,WS).call(this,u),b(this,z4).set(u,t)),t}encodeType(u){const t=b(this,Hn).get(u);return V(t,`unknown type: ${JSON.stringify(u)}`,"name",u),t}encodeData(u,t){return this.getEncoder(u)(t)}hashStruct(u,t){return p0(this.encodeData(u,t))}encode(u){return this.encodeData(this.primaryType,u)}hash(u){return this.hashStruct(this.primaryType,u)}_visit(u,t,n){if(tf(u))return n(u,t);const r=u.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r)return V(!r[3]||parseInt(r[3])===t.length,`array length mismatch; expected length ${parseInt(r[3])}`,"value",t),t.map(a=>this._visit(r[1],a,n));const i=this.types[u];if(i)return i.reduce((a,{name:s,type:o})=>(a[s]=this._visit(o,t[s],n),a),{});V(!1,`unknown type: ${u}`,"type",u)}visit(u,t){return this._visit(this.primaryType,u,t)}static from(u){return new it(u)}static getPrimaryType(u){return it.from(u).primaryType}static hashStruct(u,t,n){return it.from(t).hashStruct(u,n)}static hashDomain(u){const t=[];for(const n in u){if(u[n]==null)continue;const r=yy[n];V(r,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",u),t.push({name:n,type:r})}return t.sort((n,r)=>ef.indexOf(n.name)-ef.indexOf(r.name)),it.hashStruct("EIP712Domain",{EIP712Domain:t},u)}static encode(u,t,n){return R0(["0x1901",it.hashDomain(u),it.from(t).hash(n)])}static hash(u,t,n){return p0(it.encode(u,t,n))}static async resolveNames(u,t,n,r){u=Object.assign({},u);for(const s in u)u[s]==null&&delete u[s];const i={};u.verifyingContract&&!h0(u.verifyingContract,20)&&(i[u.verifyingContract]="0x");const a=it.from(t);a.visit(n,(s,o)=>(s==="address"&&!h0(o,20)&&(i[o]="0x"),o));for(const s in i)i[s]=await r(s);return u.verifyingContract&&i[u.verifyingContract]&&(u.verifyingContract=i[u.verifyingContract]),n=a.visit(n,(s,o)=>s==="address"&&i[o]?i[o]:o),{domain:u,value:n}}static getPayload(u,t,n){it.hashDomain(u);const r={},i=[];ef.forEach(o=>{const l=u[o];l!=null&&(r[o]=Wfu[o](l),i.push({name:o,type:yy[o]}))});const a=it.from(t),s=Object.assign({},t);return V(s.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",t),s.EIP712Domain=i,a.encode(n),{types:s,domain:r,primaryType:a.primaryType,message:a.visit(n,(o,l)=>{if(o.match(/^bytes(\d*)/))return Ou(u0(l));if(o.match(/^u?int/))return Iu(l).toString();switch(o){case"address":return l.toLowerCase();case"bool":return!!l;case"string":return V(typeof l=="string","invalid string","value",l),l}V(!1,"unsupported type","type",o)})}}};pc=new WeakMap,Hn=new WeakMap,z4=new WeakMap,L2=new WeakSet,WS=function(u){{const r=tf(u);if(r)return r}const t=u.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const r=t[1],i=this.getEncoder(r);return a=>{V(!t[3]||parseInt(t[3])===a.length,`array length mismatch; expected length ${parseInt(t[3])}`,"value",a);let s=a.map(i);return b(this,Hn).has(r)&&(s=s.map(p0)),p0(R0(s))}}const n=this.types[u];if(n){const r=Ga(b(this,Hn).get(u));return i=>{const a=n.map(({name:s,type:o})=>{const l=this.getEncoder(o)(i[s]);return b(this,Hn).has(o)?p0(l):l});return a.unshift(r),R0(a)}}V(!1,`unknown type: ${u}`,"type",u)};let O2=it;function me(e){const u=new Set;return e.forEach(t=>u.add(t)),Object.freeze(u)}const qfu="external public payable",Hfu=me(qfu.split(" ")),qS="constant external internal payable private public pure view",Gfu=me(qS.split(" ")),HS="constructor error event fallback function receive struct",GS=me(HS.split(" ")),QS="calldata memory storage payable indexed",Qfu=me(QS.split(" ")),Kfu="tuple returns",Vfu=[HS,QS,Kfu,qS].join(" "),Jfu=me(Vfu.split(" ")),Yfu={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Zfu=new RegExp("^(\\s*)"),Xfu=new RegExp("^([0-9]+)"),upu=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),KS=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),VS=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var W0,Lt,hc,L5;const U2=class U2{constructor(u){q(this,hc);q(this,W0,void 0);q(this,Lt,void 0);T(this,W0,0),T(this,Lt,u.slice())}get offset(){return b(this,W0)}get length(){return b(this,Lt).length-b(this,W0)}clone(){return new U2(b(this,Lt))}reset(){T(this,W0,0)}popKeyword(u){const t=this.peek();if(t.type!=="KEYWORD"||!u.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(u){if(this.peek().type!==u)throw new Error(`expected ${u}; got ${JSON.stringify(this.peek())}`);return this.pop().text}popParen(){const u=this.peek();if(u.type!=="OPEN_PAREN")throw new Error("bad start");const t=cu(this,hc,L5).call(this,b(this,W0)+1,u.match+1);return T(this,W0,u.match+1),t}popParams(){const u=this.peek();if(u.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;b(this,W0)=b(this,Lt).length)throw new Error("out-of-bounds");return b(this,Lt)[b(this,W0)]}peekKeyword(u){const t=this.peekType("KEYWORD");return t!=null&&u.has(t)?t:null}peekType(u){if(this.length===0)return null;const t=this.peek();return t.type===u?t.text:null}pop(){const u=this.peek();return br(this,W0)._++,u}toString(){const u=[];for(let t=b(this,W0);t`}};W0=new WeakMap,Lt=new WeakMap,hc=new WeakSet,L5=function(u=0,t=0){return new U2(b(this,Lt).slice(u,t).map(n=>Object.freeze(Object.assign({},n,{match:n.match-u,linkBack:n.linkBack-u,linkNext:n.linkNext-u}))))};let Xt=U2;function Ri(e){const u=[],t=a=>{const s=i0&&u[u.length-1].type==="NUMBER"){const E=u.pop().text;c=E+c,u[u.length-1].value=Gu(E)}if(u.length===0||u[u.length-1].type!=="BRACKET")throw new Error("missing opening bracket");u[u.length-1].text+=c}continue}if(s=a.match(upu),s){if(o.text=s[1],i+=o.text.length,Jfu.has(o.text)){o.type="KEYWORD";continue}if(o.text.match(VS)){o.type="TYPE";continue}o.type="ID";continue}if(s=a.match(Xfu),s){o.text=s[1],o.type="NUMBER",i+=o.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${i}`)}return new Xt(u.map(a=>Object.freeze(a)))}function vy(e,u){let t=[];for(const n in u.keys())e.has(n)&&t.push(n);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function bd(e,u){if(u.peekKeyword(GS)){const t=u.pop().text;if(t!==e)throw new Error(`expected ${e}, got ${t}`)}return u.popType("ID")}function mr(e,u){const t=new Set;for(;;){const n=e.peekType("KEYWORD");if(n==null||u&&!u.has(n))break;if(e.pop(),t.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);t.add(n)}return Object.freeze(t)}function JS(e){let u=mr(e,Gfu);return vy(u,me("constant payable nonpayable".split(" "))),vy(u,me("pure view payable nonpayable".split(" "))),u.has("view")?"view":u.has("pure")?"pure":u.has("payable")?"payable":u.has("nonpayable")?"nonpayable":u.has("constant")?"view":"nonpayable"}function lr(e,u){return e.popParams().map(t=>K0.from(t,u))}function YS(e){if(e.peekType("AT")){if(e.pop(),e.peekType("NUMBER"))return Iu(e.pop().text);throw new Error("invalid gas")}return null}function Qa(e){if(e.length)throw new Error(`unexpected tokens: ${e.toString()}`)}const epu=new RegExp(/^(.*)\[([0-9]*)\]$/);function by(e){const u=e.match(VS);if(V(u,"invalid type","type",e),e==="uint")return"uint256";if(e==="int")return"int256";if(u[2]){const t=parseInt(u[2]);V(t!==0&&t<=32,"invalid bytes length","type",e)}else if(u[3]){const t=parseInt(u[3]);V(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",e)}return e}const f0={},je=Symbol.for("_ethers_internal"),wy="_ParamTypeInternal",xy="_ErrorInternal",ky="_EventInternal",_y="_ConstructorInternal",Sy="_FallbackInternal",Py="_FunctionInternal",Ty="_StructInternal";var j4,g9;const at=class at{constructor(u,t,n,r,i,a,s,o){q(this,j4);eu(this,"name");eu(this,"type");eu(this,"baseType");eu(this,"indexed");eu(this,"components");eu(this,"arrayLength");eu(this,"arrayChildren");if(Bd(u,f0,"ParamType"),Object.defineProperty(this,je,{value:wy}),a&&(a=Object.freeze(a.slice())),r==="array"){if(s==null||o==null)throw new Error("")}else if(s!=null||o!=null)throw new Error("");if(r==="tuple"){if(a==null)throw new Error("")}else if(a!=null)throw new Error("");Ru(this,{name:t,type:n,baseType:r,indexed:i,components:a,arrayLength:s,arrayChildren:o})}format(u){if(u==null&&(u="sighash"),u==="json"){const n=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=n,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const r={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(r.indexed=this.indexed),this.isTuple()&&(r.components=this.components.map(i=>JSON.parse(i.format(u)))),JSON.stringify(r)}let t="";return this.isArray()?(t+=this.arrayChildren.format(u),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?(u!=="sighash"&&(t+=this.type),t+="("+this.components.map(n=>n.format(u)).join(u==="full"?", ":",")+")"):t+=this.type,u!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),u==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(u,t){if(this.isArray()){if(!Array.isArray(u))throw new Error("invalid array value");if(this.arrayLength!==-1&&u.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return u.map(r=>n.arrayChildren.walk(r,t))}if(this.isTuple()){if(!Array.isArray(u))throw new Error("invalid tuple value");if(u.length!==this.components.length)throw new Error("array is wrong length");const n=this;return u.map((r,i)=>n.components[i].walk(r,t))}return t(this.type,u)}async walkAsync(u,t){const n=[],r=[u];return cu(this,j4,g9).call(this,n,u,t,i=>{r[0]=i}),n.length&&await Promise.all(n),r[0]}static from(u,t){if(at.isParamType(u))return u;if(typeof u=="string")try{return at.from(Ri(u),t)}catch{V(!1,"invalid param type","obj",u)}else if(u instanceof Xt){let s="",o="",l=null;mr(u,me(["tuple"])).has("tuple")||u.peekType("OPEN_PAREN")?(o="tuple",l=u.popParams().map(h=>at.from(h)),s=`tuple(${l.map(h=>h.format()).join(",")})`):(s=by(u.popType("TYPE")),o=s);let c=null,E=null;for(;u.length&&u.peekType("BRACKET");){const h=u.pop();c=new at(f0,"",s,o,null,l,E,c),E=h.value,s+=h.text,o="array",l=null}let d=null;if(mr(u,Qfu).has("indexed")){if(!t)throw new Error("");d=!0}const p=u.peekType("ID")?u.pop().text:"";if(u.length)throw new Error("leftover tokens");return new at(f0,p,s,o,d,l,E,c)}const n=u.name;V(!n||typeof n=="string"&&n.match(KS),"invalid name","obj.name",n);let r=u.indexed;r!=null&&(V(t,"parameter cannot be indexed","obj.indexed",u.indexed),r=!!r);let i=u.type,a=i.match(epu);if(a){const s=parseInt(a[2]||"-1"),o=at.from({type:a[1],components:u.components});return new at(f0,n||"",i,"array",r,null,s,o)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const s=u.components!=null?u.components.map(l=>at.from(l)):null;return new at(f0,n||"",i,"tuple",r,s,null,null)}return i=by(u.type),new at(f0,n||"",i,i,r,null,null,null)}static isParamType(u){return u&&u[je]===wy}};j4=new WeakSet,g9=function(u,t,n,r){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const a=this.arrayChildren,s=t.slice();s.forEach((o,l)=>{var c;cu(c=a,j4,g9).call(c,u,o,n,E=>{s[l]=E})}),r(s);return}if(this.isTuple()){const a=this.components;let s;if(Array.isArray(t))s=t.slice();else{if(t==null||typeof t!="object")throw new Error("invalid tuple value");s=a.map(o=>{if(!o.name)throw new Error("cannot use object value with unnamed components");if(!(o.name in t))throw new Error(`missing value for component ${o.name}`);return t[o.name]})}if(s.length!==this.components.length)throw new Error("array is wrong length");s.forEach((o,l)=>{var c;cu(c=a[l],j4,g9).call(c,u,o,n,E=>{s[l]=E})}),r(s);return}const i=n(this.type,t);i.then?u.push(async function(){r(await i)}()):r(i)};let K0=at;class Ka{constructor(u,t,n){eu(this,"type");eu(this,"inputs");Bd(u,f0,"Fragment"),n=Object.freeze(n.slice()),Ru(this,{type:t,inputs:n})}static from(u){if(typeof u=="string"){try{Ka.from(JSON.parse(u))}catch{}return Ka.from(Ri(u))}if(u instanceof Xt)switch(u.peekKeyword(GS)){case"constructor":return rr.from(u);case"error":return Se.from(u);case"event":return Dn.from(u);case"fallback":case"receive":return jn.from(u);case"function":return vn.from(u);case"struct":return Ra.from(u)}else if(typeof u=="object"){switch(u.type){case"constructor":return rr.from(u);case"error":return Se.from(u);case"event":return Dn.from(u);case"fallback":case"receive":return jn.from(u);case"function":return vn.from(u);case"struct":return Ra.from(u)}du(!1,`unsupported type: ${u.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}V(!1,"unsupported frgament object","obj",u)}static isConstructor(u){return rr.isFragment(u)}static isError(u){return Se.isFragment(u)}static isEvent(u){return Dn.isFragment(u)}static isFunction(u){return vn.isFragment(u)}static isStruct(u){return Ra.isFragment(u)}}class wd extends Ka{constructor(t,n,r,i){super(t,n,i);eu(this,"name");V(typeof r=="string"&&r.match(KS),"invalid identifier","name",r),i=Object.freeze(i.slice()),Ru(this,{name:r})}}function Yl(e,u){return"("+u.map(t=>t.format(e)).join(e==="full"?", ":",")+")"}class Se extends wd{constructor(u,t,n){super(u,"error",t,n),Object.defineProperty(this,je,{value:xy})}get selector(){return Ga(this.format("sighash")).substring(0,10)}format(u){if(u==null&&(u="sighash"),u==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(u)))});const t=[];return u!=="sighash"&&t.push("error"),t.push(this.name+Yl(u,this.inputs)),t.join(" ")}static from(u){if(Se.isFragment(u))return u;if(typeof u=="string")return Se.from(Ri(u));if(u instanceof Xt){const t=bd("error",u),n=lr(u);return Qa(u),new Se(f0,t,n)}return new Se(f0,u.name,u.inputs?u.inputs.map(K0.from):[])}static isFragment(u){return u&&u[je]===xy}}class Dn extends wd{constructor(t,n,r,i){super(t,"event",n,r);eu(this,"anonymous");Object.defineProperty(this,je,{value:ky}),Ru(this,{anonymous:i})}get topicHash(){return Ga(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const n=[];return t!=="sighash"&&n.push("event"),n.push(this.name+Yl(t,this.inputs)),t!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(t,n){return n=(n||[]).map(i=>K0.from(i)),new Dn(f0,t,n,!1).topicHash}static from(t){if(Dn.isFragment(t))return t;if(typeof t=="string")try{return Dn.from(Ri(t))}catch{V(!1,"invalid event fragment","obj",t)}else if(t instanceof Xt){const n=bd("event",t),r=lr(t,!0),i=!!mr(t,me(["anonymous"])).has("anonymous");return Qa(t),new Dn(f0,n,r,i)}return new Dn(f0,t.name,t.inputs?t.inputs.map(n=>K0.from(n,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[je]===ky}}class rr extends Ka{constructor(t,n,r,i,a){super(t,n,r);eu(this,"payable");eu(this,"gas");Object.defineProperty(this,je,{value:_y}),Ru(this,{payable:i,gas:a})}format(t){if(du(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const n=[`constructor${Yl(t,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(t){if(rr.isFragment(t))return t;if(typeof t=="string")try{return rr.from(Ri(t))}catch{V(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof Xt){mr(t,me(["constructor"]));const n=lr(t),r=!!mr(t,Hfu).has("payable"),i=YS(t);return Qa(t),new rr(f0,"constructor",n,r,i)}return new rr(f0,"constructor",t.inputs?t.inputs.map(K0.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[je]===_y}}class jn extends Ka{constructor(t,n,r){super(t,"fallback",n);eu(this,"payable");Object.defineProperty(this,je,{value:Sy}),Ru(this,{payable:r})}format(t){const n=this.inputs.length===0?"receive":"fallback";if(t==="json"){const r=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:r})}return`${n}()${this.payable?" payable":""}`}static from(t){if(jn.isFragment(t))return t;if(typeof t=="string")try{return jn.from(Ri(t))}catch{V(!1,"invalid fallback fragment","obj",t)}else if(t instanceof Xt){const n=t.toString(),r=t.peekKeyword(me(["fallback","receive"]));if(V(r,"type must be fallback or receive","obj",n),t.popKeyword(me(["fallback","receive"]))==="receive"){const o=lr(t);return V(o.length===0,"receive cannot have arguments","obj.inputs",o),mr(t,me(["payable"])),Qa(t),new jn(f0,[],!0)}let a=lr(t);a.length?V(a.length===1&&a[0].type==="bytes","invalid fallback inputs","obj.inputs",a.map(o=>o.format("minimal")).join(", ")):a=[K0.from("bytes")];const s=JS(t);if(V(s==="nonpayable"||s==="payable","fallback cannot be constants","obj.stateMutability",s),mr(t,me(["returns"])).has("returns")){const o=lr(t);V(o.length===1&&o[0].type==="bytes","invalid fallback outputs","obj.outputs",o.map(l=>l.format("minimal")).join(", "))}return Qa(t),new jn(f0,a,s==="payable")}if(t.type==="receive")return new jn(f0,[],!0);if(t.type==="fallback"){const n=[K0.from("bytes")],r=t.stateMutability==="payable";return new jn(f0,n,r)}V(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[je]===Sy}}class vn extends wd{constructor(t,n,r,i,a,s){super(t,"function",n,i);eu(this,"constant");eu(this,"outputs");eu(this,"stateMutability");eu(this,"payable");eu(this,"gas");Object.defineProperty(this,je,{value:Py}),a=Object.freeze(a.slice()),Ru(this,{constant:r==="view"||r==="pure",gas:s,outputs:a,payable:r==="payable",stateMutability:r})}get selector(){return Ga(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="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!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t))),outputs:this.outputs.map(r=>JSON.parse(r.format(t)))});const n=[];return t!=="sighash"&&n.push("function"),n.push(this.name+Yl(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(Yl(t,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(t,n){return n=(n||[]).map(i=>K0.from(i)),new vn(f0,t,"view",n,[],null).selector}static from(t){if(vn.isFragment(t))return t;if(typeof t=="string")try{return vn.from(Ri(t))}catch{V(!1,"invalid function fragment","obj",t)}else if(t instanceof Xt){const r=bd("function",t),i=lr(t),a=JS(t);let s=[];mr(t,me(["returns"])).has("returns")&&(s=lr(t));const o=YS(t);return Qa(t),new vn(f0,r,a,i,s,o)}let n=t.stateMutability;return n==null&&(n="payable",typeof t.constant=="boolean"?(n="view",t.constant||(n="payable",typeof t.payable=="boolean"&&!t.payable&&(n="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(n="nonpayable")),new vn(f0,t.name,n,t.inputs?t.inputs.map(K0.from):[],t.outputs?t.outputs.map(K0.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[je]===Py}}class Ra extends wd{constructor(u,t,n){super(u,"struct",t,n),Object.defineProperty(this,je,{value:Ty})}format(){throw new Error("@TODO")}static from(u){if(typeof u=="string")try{return Ra.from(Ri(u))}catch{V(!1,"invalid struct fragment","obj",u)}else if(u instanceof Xt){const t=bd("struct",u),n=lr(u);return Qa(u),new Ra(f0,t,n)}return new Ra(f0,u.name,u.inputs?u.inputs.map(K0.from):[])}static isFragment(u){return u&&u[je]===Ty}}const en=new Map;en.set(0,"GENERIC_PANIC");en.set(1,"ASSERT_FALSE");en.set(17,"OVERFLOW");en.set(18,"DIVIDE_BY_ZERO");en.set(33,"ENUM_RANGE_ERROR");en.set(34,"BAD_STORAGE_DATA");en.set(49,"STACK_UNDERFLOW");en.set(50,"ARRAY_RANGE_ERROR");en.set(65,"OUT_OF_MEMORY");en.set(81,"UNINITIALIZED_FUNCTION_CALL");const tpu=new RegExp(/^bytes([0-9]*)$/),npu=new RegExp(/^(u?int)([0-9]*)$/);let nf=null;function rpu(e,u,t,n){let r="missing revert data",i=null;const a=null;let s=null;if(t){r="execution reverted";const l=u0(t);if(t=Ou(t),l.length===0)r+=" (no data present; likely require(false) occurred",i="require(false)";else if(l.length%32!==4)r+=" (could not decode reason; invalid data length)";else if(Ou(l.slice(0,4))==="0x08c379a0")try{i=n.decode(["string"],l.slice(4))[0],s={signature:"Error(string)",name:"Error",args:[i]},r+=`: ${JSON.stringify(i)}`}catch{r+=" (could not decode reason; invalid string data)"}else if(Ou(l.slice(0,4))==="0x4e487b71")try{const c=Number(n.decode(["uint256"],l.slice(4))[0]);s={signature:"Panic(uint256)",name:"Panic",args:[c]},i=`Panic due to ${en.get(c)||"UNKNOWN"}(${c})`,r+=`: ${i}`}catch{r+=" (could not decode panic code)"}else r+=" (unknown custom error)"}const o={to:u.to?Zu(u.to):null,data:u.data||"0x"};return u.from&&(o.from=Zu(u.from)),_0(r,"CALL_EXCEPTION",{action:e,data:t,reason:i,transaction:o,invocation:a,revert:s})}var Vr,ys;const $2=class $2{constructor(){q(this,Vr)}getDefaultValue(u){const t=u.map(r=>cu(this,Vr,ys).call(this,K0.from(r)));return new GE(t,"_").defaultValue()}encode(u,t){V_(t.length,u.length,"types/values length mismatch");const n=u.map(a=>cu(this,Vr,ys).call(this,K0.from(a))),r=new GE(n,"_"),i=new P5;return r.encode(i,t),i.data}decode(u,t,n){const r=u.map(a=>cu(this,Vr,ys).call(this,K0.from(a)));return new GE(r,"_").decode(new T5(t,n))}static defaultAbiCoder(){return nf==null&&(nf=new $2),nf}static getBuiltinCallException(u,t,n){return rpu(u,t,n,$2.defaultAbiCoder())}};Vr=new WeakSet,ys=function(u){if(u.isArray())return new O6u(cu(this,Vr,ys).call(this,u.arrayChildren),u.arrayLength,u.name);if(u.isTuple())return new GE(u.components.map(n=>cu(this,Vr,ys).call(this,n)),u.name);switch(u.baseType){case"address":return new P6u(u.name);case"bool":return new I6u(u.name);case"string":return new W6u(u.name);case"bytes":return new N6u(u.name);case"":return new j6u(u.name)}let t=u.type.match(npu);if(t){let n=parseInt(t[2]||"256");return V(n!==0&&n<=256&&n%8===0,"invalid "+t[1]+" bit length","param",u),new $6u(n/8,t[1]==="int",u.name)}if(t=u.type.match(tpu),t){let n=parseInt(t[1]);return V(n!==0&&n<=32,"invalid bytes length","param",u),new R6u(n,u.name)}V(!1,"invalid type","type",u.type)};let Zl=$2;class ipu{constructor(u,t,n){eu(this,"fragment");eu(this,"name");eu(this,"signature");eu(this,"topic");eu(this,"args");const r=u.name,i=u.format();Ru(this,{fragment:u,name:r,signature:i,topic:t,args:n})}}class apu{constructor(u,t,n,r){eu(this,"fragment");eu(this,"name");eu(this,"args");eu(this,"signature");eu(this,"selector");eu(this,"value");const i=u.name,a=u.format();Ru(this,{fragment:u,name:i,args:n,signature:a,selector:t,value:r})}}class spu{constructor(u,t,n){eu(this,"fragment");eu(this,"name");eu(this,"args");eu(this,"signature");eu(this,"selector");const r=u.name,i=u.format();Ru(this,{fragment:u,name:r,args:n,signature:i,selector:t})}}class Oy{constructor(u){eu(this,"hash");eu(this,"_isIndexed");Ru(this,{hash:u,_isIndexed:!0})}static isIndexed(u){return!!(u&&u._isIndexed)}}const Iy={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},Ny={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:e=>`reverted with reason string ${JSON.stringify(e)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:e=>{let u="unknown panic code";return e>=0&&e<=255&&Iy[e.toString()]&&(u=Iy[e.toString()]),`reverted with panic code 0x${e.toString(16)} (${u})`}}};var pn,hn,Cn,te,M4,B9,L4,y9;const Ls=class Ls{constructor(u){q(this,M4);q(this,L4);eu(this,"fragments");eu(this,"deploy");eu(this,"fallback");eu(this,"receive");q(this,pn,void 0);q(this,hn,void 0);q(this,Cn,void 0);q(this,te,void 0);let t=[];typeof u=="string"?t=JSON.parse(u):t=u,T(this,Cn,new Map),T(this,pn,new Map),T(this,hn,new Map);const n=[];for(const a of t)try{n.push(Ka.from(a))}catch(s){console.log("EE",s)}Ru(this,{fragments:Object.freeze(n)});let r=null,i=!1;T(this,te,this.getAbiCoder()),this.fragments.forEach((a,s)=>{let o;switch(a.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Ru(this,{deploy:a});return;case"fallback":a.inputs.length===0?i=!0:(V(!r||a.payable!==r.payable,"conflicting fallback fragments",`fragments[${s}]`,a),r=a,i=r.payable);return;case"function":o=b(this,Cn);break;case"event":o=b(this,hn);break;case"error":o=b(this,pn);break;default:return}const l=a.format();o.has(l)||o.set(l,a)}),this.deploy||Ru(this,{deploy:rr.from("constructor()")}),Ru(this,{fallback:r,receive:i})}format(u){const t=u?"minimal":"full";return this.fragments.map(r=>r.format(t))}formatJson(){const u=this.fragments.map(t=>t.format("json"));return JSON.stringify(u.map(t=>JSON.parse(t)))}getAbiCoder(){return Zl.defaultAbiCoder()}getFunctionName(u){const t=cu(this,M4,B9).call(this,u,null,!1);return V(t,"no matching function","key",u),t.name}hasFunction(u){return!!cu(this,M4,B9).call(this,u,null,!1)}getFunction(u,t){return cu(this,M4,B9).call(this,u,t||null,!0)}forEachFunction(u){const t=Array.from(b(this,Cn).keys());t.sort((n,r)=>n.localeCompare(r));for(let n=0;nn.localeCompare(r));for(let n=0;n1){const i=r.map(a=>JSON.stringify(a.format())).join(", ");V(!1,`ambiguous error description (i.e. ${i})`,"name",u)}return r[0]}if(u=Se.from(u).format(),u==="Error(string)")return Se.from("error Error(string)");if(u==="Panic(uint256)")return Se.from("error Panic(uint256)");const n=b(this,pn).get(u);return n||null}forEachError(u){const t=Array.from(b(this,pn).keys());t.sort((n,r)=>n.localeCompare(r));for(let n=0;ni.type==="string"?Ga(a):i.type==="bytes"?p0(Ou(a)):(i.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":i.type.match(/^u?int/)?a=wi(a):i.type.match(/^bytes/)?a=r6u(a,32):i.type==="address"&&b(this,te).encode(["address"],[a]),Ha(Ou(a),32));for(t.forEach((i,a)=>{const s=u.inputs[a];if(!s.indexed){V(i==null,"cannot filter non-indexed parameters; must be null","contract."+s.name,i);return}i==null?n.push(null):s.baseType==="array"||s.baseType==="tuple"?V(!1,"filtering with tuples or arrays not supported","contract."+s.name,i):Array.isArray(i)?n.push(i.map(o=>r(s,o))):n.push(r(s,i))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(u,t){if(typeof u=="string"){const a=this.getEvent(u);V(a,"unknown event","eventFragment",u),u=a}const n=[],r=[],i=[];return u.anonymous||n.push(u.topicHash),V(t.length===u.inputs.length,"event arguments/values mismatch","values",t),u.inputs.forEach((a,s)=>{const o=t[s];if(a.indexed)if(a.type==="string")n.push(Ga(o));else if(a.type==="bytes")n.push(p0(o));else{if(a.baseType==="tuple"||a.baseType==="array")throw new Error("not implemented");n.push(b(this,te).encode([a.type],[o]))}else r.push(a),i.push(o)}),{data:b(this,te).encode(r,i),topics:n}}decodeEventLog(u,t,n){if(typeof u=="string"){const f=this.getEvent(u);V(f,"unknown event","eventFragment",u),u=f}if(n!=null&&!u.anonymous){const f=u.topicHash;V(h0(n[0],32)&&n[0].toLowerCase()===f,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const r=[],i=[],a=[];u.inputs.forEach((f,p)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(r.push(K0.from({type:"bytes32",name:f.name})),a.push(!0)):(r.push(f),a.push(!1)):(i.push(f),a.push(!1))});const s=n!=null?b(this,te).decode(r,R0(n)):null,o=b(this,te).decode(i,t,!0),l=[],c=[];let E=0,d=0;return u.inputs.forEach((f,p)=>{let h=null;if(f.indexed)if(s==null)h=new Oy(null);else if(a[p])h=new Oy(s[d++]);else try{h=s[d++]}catch(g){h=g}else try{h=o[E++]}catch(g){h=g}l.push(h),c.push(f.name||null)}),x2.fromItems(l,c)}parseTransaction(u){const t=u0(u.data,"tx.data"),n=Iu(u.value!=null?u.value:0,"tx.value"),r=this.getFunction(Ou(t.slice(0,4)));if(!r)return null;const i=b(this,te).decode(r.inputs,t.slice(4));return new apu(r,r.selector,i,n)}parseCallResult(u){throw new Error("@TODO")}parseLog(u){const t=this.getEvent(u.topics[0]);return!t||t.anonymous?null:new ipu(t,t.topicHash,this.decodeEventLog(t,u.data,u.topics))}parseError(u){const t=Ou(u),n=this.getError(A0(t,0,4));if(!n)return null;const r=b(this,te).decode(n.inputs,A0(t,4));return new spu(n,n.selector,r)}static from(u){return u instanceof Ls?u:typeof u=="string"?new Ls(JSON.parse(u)):typeof u.format=="function"?new Ls(u.format("json")):new Ls(u)}};pn=new WeakMap,hn=new WeakMap,Cn=new WeakMap,te=new WeakMap,M4=new WeakSet,B9=function(u,t,n){if(h0(u)){const i=u.toLowerCase();for(const a of b(this,Cn).values())if(i===a.selector)return a;return null}if(u.indexOf("(")===-1){const i=[];for(const[a,s]of b(this,Cn))a.split("(")[0]===u&&i.push(s);if(t){const a=t.length>0?t[t.length-1]:null;let s=t.length,o=!0;le.isTyped(a)&&a.type==="overrides"&&(o=!1,s--);for(let l=i.length-1;l>=0;l--){const c=i[l].inputs.length;c!==s&&(!o||c!==s-1)&&i.splice(l,1)}for(let l=i.length-1;l>=0;l--){const c=i[l].inputs;for(let E=0;E=c.length){if(t[E].type==="overrides")continue;i.splice(l,1);break}if(t[E].type!==c[E].baseType){i.splice(l,1);break}}}}if(i.length===1&&t&&t.length!==i[0].inputs.length){const a=t[t.length-1];(a==null||Array.isArray(a)||typeof a!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&n){const a=i.map(s=>JSON.stringify(s.format())).join(", ");V(!1,`ambiguous function description (i.e. matches ${a})`,"key",u)}return i[0]}const r=b(this,Cn).get(vn.from(u).format());return r||null},L4=new WeakSet,y9=function(u,t,n){if(h0(u)){const i=u.toLowerCase();for(const a of b(this,hn).values())if(i===a.topicHash)return a;return null}if(u.indexOf("(")===-1){const i=[];for(const[a,s]of b(this,hn))a.split("(")[0]===u&&i.push(s);if(t){for(let a=i.length-1;a>=0;a--)i[a].inputs.length=0;a--){const s=i[a].inputs;for(let o=0;o1&&n){const a=i.map(s=>JSON.stringify(s.format())).join(", ");V(!1,`ambiguous event description (i.e. matches ${a})`,"key",u)}return i[0]}const r=b(this,hn).get(Dn.from(u).format());return r||null};let U5=Ls;const ZS=BigInt(0);function Z3(e){return e??null}function ae(e){return e==null?null:e.toString()}class Ry{constructor(u,t,n){eu(this,"gasPrice");eu(this,"maxFeePerGas");eu(this,"maxPriorityFeePerGas");Ru(this,{gasPrice:Z3(u),maxFeePerGas:Z3(t),maxPriorityFeePerGas:Z3(n)})}toJSON(){const{gasPrice:u,maxFeePerGas:t,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:ae(u),maxFeePerGas:ae(t),maxPriorityFeePerGas:ae(n)}}}function I2(e){const u={};e.to&&(u.to=e.to),e.from&&(u.from=e.from),e.data&&(u.data=Ou(e.data));const t="chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const r of t)!(r in e)||e[r]==null||(u[r]=Iu(e[r],`request.${r}`));const n="type,nonce".split(/,/);for(const r of n)!(r in e)||e[r]==null||(u[r]=Gu(e[r],`request.${r}`));return e.accessList&&(u.accessList=is(e.accessList)),"blockTag"in e&&(u.blockTag=e.blockTag),"enableCcipRead"in e&&(u.enableCcipRead=!!e.enableCcipRead),"customData"in e&&(u.customData=e.customData),u}var Gn;class opu{constructor(u,t){eu(this,"provider");eu(this,"number");eu(this,"hash");eu(this,"timestamp");eu(this,"parentHash");eu(this,"nonce");eu(this,"difficulty");eu(this,"gasLimit");eu(this,"gasUsed");eu(this,"miner");eu(this,"extraData");eu(this,"baseFeePerGas");q(this,Gn,void 0);T(this,Gn,u.transactions.map(n=>typeof n!="string"?new Xl(n,t):n)),Ru(this,{provider:t,hash:Z3(u.hash),number:u.number,timestamp:u.timestamp,parentHash:u.parentHash,nonce:u.nonce,difficulty:u.difficulty,gasLimit:u.gasLimit,gasUsed:u.gasUsed,miner:u.miner,extraData:u.extraData,baseFeePerGas:Z3(u.baseFeePerGas)})}get transactions(){return b(this,Gn).map(u=>typeof u=="string"?u:u.hash)}get prefetchedTransactions(){const u=b(this,Gn).slice();return u.length===0?[]:(du(typeof u[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),u)}toJSON(){const{baseFeePerGas:u,difficulty:t,extraData:n,gasLimit:r,gasUsed:i,hash:a,miner:s,nonce:o,number:l,parentHash:c,timestamp:E,transactions:d}=this;return{_type:"Block",baseFeePerGas:ae(u),difficulty:ae(t),extraData:n,gasLimit:ae(r),gasUsed:ae(i),hash:a,miner:s,nonce:o,number:l,parentHash:c,timestamp:E,transactions:d}}[Symbol.iterator](){let u=0;const t=this.transactions;return{next:()=>unew lE(r,t))));let n=ZS;u.effectiveGasPrice!=null?n=u.effectiveGasPrice:u.gasPrice!=null&&(n=u.gasPrice),Ru(this,{provider:t,to:u.to,from:u.from,contractAddress:u.contractAddress,hash:u.hash,index:u.index,blockHash:u.blockHash,blockNumber:u.blockNumber,logsBloom:u.logsBloom,gasUsed:u.gasUsed,cumulativeGasUsed:u.cumulativeGasUsed,gasPrice:n,type:u.type,status:u.status,root:u.root})}get logs(){return b(this,Cc)}toJSON(){const{to:u,from:t,contractAddress:n,hash:r,index:i,blockHash:a,blockNumber:s,logsBloom:o,logs:l,status:c,root:E}=this;return{_type:"TransactionReceipt",blockHash:a,blockNumber:s,contractAddress:n,cumulativeGasUsed:ae(this.cumulativeGasUsed),from:t,gasPrice:ae(this.gasPrice),gasUsed:ae(this.gasUsed),hash:r,index:i,logs:l,logsBloom:o,root:E,status:c,to:u}}get length(){return this.logs.length}[Symbol.iterator](){let u=0;return{next:()=>u{if(s)return null;const{blockNumber:d,nonce:f}=await de({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(f{if(d==null||d.status!==0)return d;du(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},c=await this.provider.getTransactionReceipt(this.hash);if(n===0)return l(c);if(c){if(await c.confirmations()>=n)return l(c)}else if(await o(),n===0)return null;return await new Promise((d,f)=>{const p=[],h=()=>{p.forEach(A=>A())};if(p.push(()=>{s=!0}),r>0){const A=setTimeout(()=>{h(),f(_0("wait for transaction timeout","TIMEOUT"))},r);p.push(()=>{clearTimeout(A)})}const g=async A=>{if(await A.confirmations()>=n){h();try{d(l(A))}catch(m){f(m)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),i>=0){const A=async()=>{try{await o()}catch(m){if(Dt(m,"TRANSACTION_REPLACED")){h(),f(m);return}}s||this.provider.once("block",A)};p.push(()=>{this.provider.off("block",A)}),this.provider.once("block",A)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}removedEvent(){return du(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),eP(this)}reorderedEvent(u){return du(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),du(!u||u.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),uP(this,u)}replaceableTransaction(u){V(Number.isInteger(u)&&u>=0,"invalid startBlock","startBlock",u);const t=new mm(this,this.provider);return T(t,Jr,u),t}};Jr=new WeakMap;let Xl=mm;function lpu(e){return{orphan:"drop-block",hash:e.hash,number:e.number}}function uP(e,u){return{orphan:"reorder-transaction",tx:e,other:u}}function eP(e){return{orphan:"drop-transaction",tx:e}}function cpu(e){return{orphan:"drop-log",log:{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,address:e.address,data:e.data,topics:Object.freeze(e.topics.slice()),index:e.index}}}class cm extends lE{constructor(t,n,r){super(t,t.provider);eu(this,"interface");eu(this,"fragment");eu(this,"args");const i=n.decodeEventLog(r,t.data,t.topics);Ru(this,{args:i,fragment:r,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class tP extends lE{constructor(t,n){super(t,t.provider);eu(this,"error");Ru(this,{error:n})}}var U4;class Epu extends XS{constructor(t,n,r){super(r,n);q(this,U4,void 0);T(this,U4,t)}get logs(){return super.logs.map(t=>{const n=t.topics.length?b(this,U4).getEvent(t.topics[0]):null;if(n)try{return new cm(t,b(this,U4),n)}catch(r){return new tP(t,r)}return t})}}U4=new WeakMap;var mc;class Em extends Xl{constructor(t,n,r){super(r,n);q(this,mc,void 0);T(this,mc,t)}async wait(t){const n=await super.wait(t);return n==null?null:new Epu(b(this,mc),this.provider,n)}}mc=new WeakMap;class nP extends X_{constructor(t,n,r,i){super(t,n,r);eu(this,"log");Ru(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class dpu extends nP{constructor(u,t,n,r,i){super(u,t,n,new cm(i,u.interface,r));const a=u.interface.decodeEventLog(r,this.log.data,this.log.topics);Ru(this,{args:a,fragment:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const zy=BigInt(0);function rP(e){return e&&typeof e.call=="function"}function iP(e){return e&&typeof e.estimateGas=="function"}function xd(e){return e&&typeof e.resolveName=="function"}function aP(e){return e&&typeof e.sendTransaction=="function"}function sP(e){if(e!=null){if(xd(e))return e;if(e.provider)return e.provider}}var Ac;class fpu{constructor(u,t,n){q(this,Ac,void 0);eu(this,"fragment");if(Ru(this,{fragment:t}),t.inputs.lengthn[o]==null?null:s.walkAsync(n[o],(c,E)=>c==="address"?Array.isArray(E)?Promise.all(E.map(d=>Ce(d,i))):Ce(E,i):E)));return u.interface.encodeFilterTopics(t,a)}())}getTopicFilter(){return b(this,Ac)}}Ac=new WeakMap;function Va(e,u){return e==null?null:typeof e[u]=="function"?e:e.provider&&typeof e.provider[u]=="function"?e.provider:null}function ua(e){return e==null?null:e.provider||null}async function oP(e,u){const t=le.dereference(e,"overrides");V(typeof t=="object","invalid overrides parameter","overrides",e);const n=I2(t);return V(n.to==null||(u||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),V(n.data==null||(u||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function ppu(e,u,t){const n=Va(e,"resolveName"),r=xd(n)?n:null;return await Promise.all(u.map((i,a)=>i.walkAsync(t[a],(s,o)=>(o=le.dereference(o,s),s==="address"?Ce(o,r):o))))}function hpu(e){const u=async function(a){const s=await oP(a,["data"]);s.to=await e.getAddress(),s.from&&(s.from=await Ce(s.from,sP(e.runner)));const o=e.interface,l=Iu(s.value||zy,"overrides.value")===zy,c=(s.data||"0x")==="0x";o.fallback&&!o.fallback.payable&&o.receive&&!c&&!l&&V(!1,"cannot send data to receive or send value to non-payable fallback","overrides",a),V(o.fallback||c,"cannot send data to receive-only contract","overrides.data",s.data);const E=o.receive||o.fallback&&o.fallback.payable;return V(E||l,"cannot send value to non-payable fallback","overrides.value",s.value),V(o.fallback||c,"cannot send data to receive-only contract","overrides.data",s.data),s},t=async function(a){const s=Va(e.runner,"call");du(rP(s),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const o=await u(a);try{return await s.call(o)}catch(l){throw em(l)&&l.data?e.interface.makeError(l.data,o):l}},n=async function(a){const s=e.runner;du(aP(s),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const o=await s.sendTransaction(await u(a)),l=ua(e.runner);return new Em(e.interface,l,o)},r=async function(a){const s=Va(e.runner,"estimateGas");return du(iP(s),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await s.estimateGas(await u(a))},i=async a=>await n(a);return Ru(i,{_contract:e,estimateGas:r,populateTransaction:u,send:n,staticCall:t}),i}function Cpu(e,u){const t=function(...l){const c=e.interface.getFunction(u,l);return du(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:u,args:l}}),c},n=async function(...l){const c=t(...l);let E={};if(c.inputs.length+1===l.length&&(E=await oP(l.pop()),E.from&&(E.from=await Ce(E.from,sP(e.runner)))),c.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await ppu(e.runner,c.inputs,l);return Object.assign({},E,await de({to:e.getAddress(),data:e.interface.encodeFunctionData(c,d)}))},r=async function(...l){const c=await s(...l);return c.length===1?c[0]:c},i=async function(...l){const c=e.runner;du(aP(c),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const E=await c.sendTransaction(await n(...l)),d=ua(e.runner);return new Em(e.interface,d,E)},a=async function(...l){const c=Va(e.runner,"estimateGas");return du(iP(c),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await c.estimateGas(await n(...l))},s=async function(...l){const c=Va(e.runner,"call");du(rP(c),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const E=await n(...l);let d="0x";try{d=await c.call(E)}catch(p){throw em(p)&&p.data?e.interface.makeError(p.data,E):p}const f=t(...l);return e.interface.decodeFunctionResult(f,d)},o=async(...l)=>t(...l).constant?await r(...l):await i(...l);return Ru(o,{name:e.interface.getFunctionName(u),_contract:e,_key:u,getFragment:t,estimateGas:a,populateTransaction:n,send:i,staticCall:r,staticCallResult:s}),Object.defineProperty(o,"fragment",{configurable:!1,enumerable:!0,get:()=>{const l=e.interface.getFunction(u);return du(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:u}}),l}}),o}function mpu(e,u){const t=function(...r){const i=e.interface.getEvent(u,r);return du(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:u,args:r}}),i},n=function(...r){return new fpu(e,t(...r),r)};return Ru(n,{name:e.interface.getEventName(u),_contract:e,_key:u,getFragment:t}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const r=e.interface.getEvent(u);return du(r,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:u}}),r}}),n}const N2=Symbol.for("_ethersInternal_contract"),lP=new WeakMap;function Apu(e,u){lP.set(e[N2],u)}function Ue(e){return lP.get(e[N2])}function gpu(e){return e&&typeof e=="object"&&"getTopicFilter"in e&&typeof e.getTopicFilter=="function"&&e.fragment}async function dm(e,u){let t,n=null;if(Array.isArray(u)){const i=function(a){if(h0(a,32))return a;const s=e.interface.getEvent(a);return V(s,"unknown fragment","name",a),s.topicHash};t=u.map(a=>a==null?null:Array.isArray(a)?a.map(i):i(a))}else u==="*"?t=[null]:typeof u=="string"?h0(u,32)?t=[u]:(n=e.interface.getEvent(u),V(n,"unknown fragment","event",u),t=[n.topicHash]):gpu(u)?t=await u.getTopicFilter():"fragment"in u?(n=u.fragment,t=[n.topicHash]):V(!1,"unknown event name","event",u);t=t.map(i=>{if(i==null)return null;if(Array.isArray(i)){const a=Array.from(new Set(i.map(s=>s.toLowerCase())).values());return a.length===1?a[0]:(a.sort(),a)}return i.toLowerCase()});const r=t.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:n,tag:r,topics:t}}async function R3(e,u){const{subs:t}=Ue(e);return t.get((await dm(e,u)).tag)||null}async function jy(e,u,t){const n=ua(e.runner);du(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:u});const{fragment:r,tag:i,topics:a}=await dm(e,t),{addr:s,subs:o}=Ue(e);let l=o.get(i);if(!l){const E={address:s||e,topics:a},d=g=>{let A=r;if(A==null)try{A=e.interface.getEvent(g.topics[0])}catch{}if(A){const m=A,B=r?e.interface.decodeEventLog(r,g.data,g.topics):[];W5(e,t,B,F=>new dpu(e,F,t,m,g))}else W5(e,t,[],m=>new nP(e,m,t,g))};let f=[];l={tag:i,listeners:[],start:()=>{f.length||f.push(n.on(E,d))},stop:async()=>{if(f.length==0)return;let g=f;f=[],await Promise.all(g),n.off(E,d)}},o.set(i,l)}return l}let $5=Promise.resolve();async function Bpu(e,u,t,n){await $5;const r=await R3(e,u);if(!r)return!1;const i=r.listeners.length;return r.listeners=r.listeners.filter(({listener:a,once:s})=>{const o=Array.from(t);n&&o.push(n(s?null:a));try{a.call(e,...o)}catch{}return!s}),r.listeners.length===0&&(r.stop(),Ue(e).subs.delete(r.tag)),i>0}async function W5(e,u,t,n){try{await $5}catch{}const r=Bpu(e,u,t,n);return $5=r,await r}const QE=["then"];var g5u;const ul=class ul{constructor(u,t,n,r){eu(this,"target");eu(this,"interface");eu(this,"runner");eu(this,"filters");eu(this,g5u);eu(this,"fallback");V(typeof u=="string"||ES(u),"invalid value for Contract target","target",u),n==null&&(n=null);const i=U5.from(t);Ru(this,{target:u,runner:n,interface:i}),Object.defineProperty(this,N2,{value:{}});let a,s=null,o=null;if(r){const E=ua(n);o=new Em(this.interface,E,r)}let l=new Map;if(typeof u=="string")if(h0(u))s=u,a=Promise.resolve(u);else{const E=Va(n,"resolveName");if(!xd(E))throw _0("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=E.resolveName(u).then(d=>{if(d==null)throw _0("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:u});return Ue(this).addr=d,d})}else a=u.getAddress().then(E=>{if(E==null)throw new Error("TODO");return Ue(this).addr=E,E});Apu(this,{addrPromise:a,addr:s,deployTx:o,subs:l});const c=new Proxy({},{get:(E,d,f)=>{if(typeof d=="symbol"||QE.indexOf(d)>=0)return Reflect.get(E,d,f);try{return this.getEvent(d)}catch(p){if(!Dt(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(E,d)=>QE.indexOf(d)>=0?Reflect.has(E,d):Reflect.has(E,d)||this.interface.hasEvent(String(d))});return Ru(this,{filters:c}),Ru(this,{fallback:i.receive||i.fallback?hpu(this):null}),new Proxy(this,{get:(E,d,f)=>{if(typeof d=="symbol"||d in E||QE.indexOf(d)>=0)return Reflect.get(E,d,f);try{return E.getFunction(d)}catch(p){if(!Dt(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(E,d)=>typeof d=="symbol"||d in E||QE.indexOf(d)>=0?Reflect.has(E,d):E.interface.hasFunction(d)})}connect(u){return new ul(this.target,this.interface,u)}attach(u){return new ul(u,this.interface,this.runner)}async getAddress(){return await Ue(this).addrPromise}async getDeployedCode(){const u=ua(this.runner);du(u,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await u.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const u=this.deploymentTransaction();if(u)return await u.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=ua(this.runner);return du(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((r,i)=>{const a=async()=>{try{if(await this.getDeployedCode()!=null)return r(this);n.once("block",a)}catch(s){i(s)}};a()})}deploymentTransaction(){return Ue(this).deployTx}getFunction(u){return typeof u!="string"&&(u=u.format()),Cpu(this,u)}getEvent(u){return typeof u!="string"&&(u=u.format()),mpu(this,u)}async queryTransaction(u){throw new Error("@TODO")}async queryFilter(u,t,n){t==null&&(t=0),n==null&&(n="latest");const{addr:r,addrPromise:i}=Ue(this),a=r||await i,{fragment:s,topics:o}=await dm(this,u),l={address:a,topics:o,fromBlock:t,toBlock:n},c=ua(this.runner);return du(c,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await c.getLogs(l)).map(E=>{let d=s;if(d==null)try{d=this.interface.getEvent(E.topics[0])}catch{}if(d)try{return new cm(E,this.interface,d)}catch(f){return new tP(E,f)}return new lE(E,c)})}async on(u,t){const n=await jy(this,"on",u);return n.listeners.push({listener:t,once:!1}),n.start(),this}async once(u,t){const n=await jy(this,"once",u);return n.listeners.push({listener:t,once:!0}),n.start(),this}async emit(u,...t){return await W5(this,u,t,null)}async listenerCount(u){if(u){const r=await R3(this,u);return r?r.listeners.length:0}const{subs:t}=Ue(this);let n=0;for(const{listeners:r}of t.values())n+=r.length;return n}async listeners(u){if(u){const r=await R3(this,u);return r?r.listeners.map(({listener:i})=>i):[]}const{subs:t}=Ue(this);let n=[];for(const{listeners:r}of t.values())n=n.concat(r.map(({listener:i})=>i));return n}async off(u,t){const n=await R3(this,u);if(!n)return this;if(t){const r=n.listeners.map(({listener:i})=>i).indexOf(t);r>=0&&n.listeners.splice(r,1)}return(t==null||n.listeners.length===0)&&(n.stop(),Ue(this).subs.delete(n.tag)),this}async removeAllListeners(u){if(u){const t=await R3(this,u);if(!t)return this;t.stop(),Ue(this).subs.delete(t.tag)}else{const{subs:t}=Ue(this);for(const{tag:n,stop:r}of t.values())r(),t.delete(n)}return this}async addListener(u,t){return await this.on(u,t)}async removeListener(u,t){return await this.off(u,t)}static buildClass(u){class t extends ul{constructor(r,i=null){super(r,u,i)}}return t}static from(u,t,n){return n==null&&(n=null),new this(u,t,n)}};g5u=N2;let q5=ul;function ypu(){return q5}let u4=class extends ypu(){};function rf(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):V(!1,"unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}class Fpu{constructor(u){eu(this,"name");Ru(this,{name:u})}connect(u){return this}supportsCoinType(u){return!1}async encodeAddress(u,t){throw new Error("unsupported coin")}async decodeAddress(u,t){throw new Error("unsupported coin")}}const cP=new RegExp("^(ipfs)://(.*)$","i"),My=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),cP,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var Yr,ga,Zr,Fs,W2,EP;const Us=class Us{constructor(u,t,n){q(this,Zr);eu(this,"provider");eu(this,"address");eu(this,"name");q(this,Yr,void 0);q(this,ga,void 0);Ru(this,{provider:u,address:t,name:n}),T(this,Yr,null),T(this,ga,new u4(t,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],u))}async supportsWildcard(){return b(this,Yr)==null&&T(this,Yr,(async()=>{try{return await b(this,ga).supportsInterface("0x9061b923")}catch(u){if(Dt(u,"CALL_EXCEPTION"))return!1;throw T(this,Yr,null),u}})()),await b(this,Yr)}async getAddress(u){if(u==null&&(u=60),u===60)try{const i=await cu(this,Zr,Fs).call(this,"addr(bytes32)");return i==null||i===O5?null:i}catch(i){if(Dt(i,"CALL_EXCEPTION"))return null;throw i}if(u>=0&&u<2147483648){let i=u+2147483648;const a=await cu(this,Zr,Fs).call(this,"addr(bytes32,uint)",[i]);if(h0(a,20))return Zu(a)}let t=null;for(const i of this.provider.plugins)if(i instanceof Fpu&&i.supportsCoinType(u)){t=i;break}if(t==null)return null;const n=await cu(this,Zr,Fs).call(this,"addr(bytes32,uint)",[u]);if(n==null||n==="0x")return null;const r=await t.decodeAddress(u,n);if(r!=null)return r;du(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${u})`,info:{coinType:u,data:n}})}async getText(u){const t=await cu(this,Zr,Fs).call(this,"text(bytes32,string)",[u]);return t==null||t==="0x"?null:t}async getContentHash(){const u=await cu(this,Zr,Fs).call(this,"contenthash(bytes32)");if(u==null||u==="0x")return null;const t=u.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const r=t[1]==="e3010170"?"ipfs":"ipns",i=parseInt(t[4],16);if(t[5].length===i*2)return`${r}://${o6u("0x"+t[2])}`}const n=u.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;du(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:u}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const u=[{type:"name",value:this.name}];try{const t=await this.getText("avatar");if(t==null)return u.push({type:"!avatar",value:""}),{url:null,linkage:u};u.push({type:"avatar",value:t});for(let n=0;n{if(!Array.isArray(u))throw new Error("not an array");return u.map(t=>e(t))}}function cE(e,u){return t=>{const n={};for(const r in e){let i=r;if(u&&r in u&&!(i in t)){for(const a of u[r])if(a in t){i=a;break}}try{const a=e[r](t[i]);a!==void 0&&(n[r]=a)}catch(a){const s=a instanceof Error?a.message:"not-an-error";du(!1,`invalid value for value.${r} (${s})`,"BAD_DATA",{value:t})}}return n}}function Dpu(e){switch(e){case!0:case"true":return!0;case!1:case"false":return!1}V(!1,`invalid boolean; ${JSON.stringify(e)}`,"value",e)}function _o(e){return V(h0(e,!0),"invalid data","value",e),e}function vt(e){return V(h0(e,32),"invalid hash","value",e),e}const vpu=cE({address:Zu,blockHash:vt,blockNumber:Gu,data:_o,index:Gu,removed:c0(Dpu,!1),topics:fm(vt),transactionHash:vt,transactionIndex:Gu},{index:["logIndex"]});function bpu(e){return vpu(e)}const wpu=cE({hash:c0(vt),parentHash:vt,number:Gu,timestamp:Gu,nonce:c0(_o),difficulty:Iu,gasLimit:Iu,gasUsed:Iu,miner:c0(Zu),extraData:_o,baseFeePerGas:c0(Iu)});function xpu(e){const u=wpu(e);return u.transactions=e.transactions.map(t=>typeof t=="string"?t:dP(t)),u}const kpu=cE({transactionIndex:Gu,blockNumber:Gu,transactionHash:vt,address:Zu,topics:fm(vt),data:_o,index:Gu,blockHash:vt},{index:["logIndex"]});function _pu(e){return kpu(e)}const Spu=cE({to:c0(Zu,null),from:c0(Zu,null),contractAddress:c0(Zu,null),index:Gu,root:c0(Ou),gasUsed:Iu,logsBloom:c0(_o),blockHash:vt,hash:vt,logs:fm(_pu),blockNumber:Gu,cumulativeGasUsed:Iu,effectiveGasPrice:c0(Iu),status:c0(Gu),type:c0(Gu,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function Ppu(e){return Spu(e)}function dP(e){e.to&&Iu(e.to)===Ly&&(e.to="0x0000000000000000000000000000000000000000");const u=cE({hash:vt,type:t=>t==="0x"||t==null?0:Gu(t),accessList:c0(is,null),blockHash:c0(vt,null),blockNumber:c0(Gu,null),transactionIndex:c0(Gu,null),from:Zu,gasPrice:c0(Iu),maxPriorityFeePerGas:c0(Iu),maxFeePerGas:c0(Iu),gasLimit:Iu,to:c0(Zu,null),value:Iu,nonce:Gu,data:_o,creates:c0(Zu,null),chainId:c0(Iu,null)},{data:["input"],gasLimit:["gas"]})(e);if(u.to==null&&u.creates==null&&(u.creates=S6u(u)),(e.type===1||e.type===2)&&e.accessList==null&&(u.accessList=[]),e.signature?u.signature=Zt.from(e.signature):u.signature=Zt.from(e),u.chainId==null){const t=u.signature.legacyChainId;t!=null&&(u.chainId=t)}return u.blockHash&&Iu(u.blockHash)===Ly&&(u.blockHash=null),u}const Tpu="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class EE{constructor(u){eu(this,"name");Ru(this,{name:u})}clone(){return new EE(this.name)}}class kd extends EE{constructor(t,n){t==null&&(t=0);super(`org.ethers.network.plugins.GasCost#${t||0}`);eu(this,"effectiveBlock");eu(this,"txBase");eu(this,"txCreate");eu(this,"txDataZero");eu(this,"txDataNonzero");eu(this,"txAccessListStorageKey");eu(this,"txAccessListAddress");const r={effectiveBlock:t};function i(a,s){let o=(n||{})[a];o==null&&(o=s),V(typeof o=="number",`invalud value for ${a}`,"costs",n),r[a]=o}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Ru(this,r)}clone(){return new kd(this.effectiveBlock,this)}}class _d extends EE{constructor(t,n){super("org.ethers.plugins.network.Ens");eu(this,"address");eu(this,"targetNetwork");Ru(this,{address:t||Tpu,targetNetwork:n??1})}clone(){return new _d(this.address,this.targetNetwork)}}var gc,Bc;class fP extends EE{constructor(t,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");q(this,gc,void 0);q(this,Bc,void 0);T(this,gc,t),T(this,Bc,n)}get url(){return b(this,gc)}get processFunc(){return b(this,Bc)}clone(){return this}}gc=new WeakMap,Bc=new WeakMap;const af=new Map;var $4,W4,Xr;const $s=class $s{constructor(u,t){q(this,$4,void 0);q(this,W4,void 0);q(this,Xr,void 0);T(this,$4,u),T(this,W4,Iu(t)),T(this,Xr,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return b(this,$4)}set name(u){T(this,$4,u)}get chainId(){return b(this,W4)}set chainId(u){T(this,W4,Iu(u,"chainId"))}matches(u){if(u==null)return!1;if(typeof u=="string"){try{return this.chainId===Iu(u)}catch{}return this.name===u}if(typeof u=="number"||typeof u=="bigint"){try{return this.chainId===Iu(u)}catch{}return!1}if(typeof u=="object"){if(u.chainId!=null){try{return this.chainId===Iu(u.chainId)}catch{}return!1}return u.name!=null?this.name===u.name:!1}return!1}get plugins(){return Array.from(b(this,Xr).values())}attachPlugin(u){if(b(this,Xr).get(u.name))throw new Error(`cannot replace existing plugin: ${u.name} `);return b(this,Xr).set(u.name,u.clone()),this}getPlugin(u){return b(this,Xr).get(u)||null}getPlugins(u){return this.plugins.filter(t=>t.name.split("#")[0]===u)}clone(){const u=new $s(this.name,this.chainId);return this.plugins.forEach(t=>{u.attachPlugin(t.clone())}),u}computeIntrinsicGas(u){const t=this.getPlugin("org.ethers.plugins.network.GasCost")||new kd;let n=t.txBase;if(u.to==null&&(n+=t.txCreate),u.data)for(let r=2;r9){let r=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||r++,n[1]=r.toString()}return BigInt(n[0]+n[1])}function $y(e){return new fP(e,async(u,t,n)=>{n.setHeader("User-Agent","ethers");let r;try{const[i,a]=await Promise.all([n.send(),u()]);r=i;const s=r.bodyJson.standard;return{gasPrice:a.gasPrice,maxFeePerGas:Uy(s.maxFee,9),maxPriorityFeePerGas:Uy(s.maxPriorityFee,9)}}catch(i){du(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:r,error:i})}})}function Opu(e){return new fP("data:",async(u,t,n)=>{const r=await u();if(r.maxFeePerGas==null||r.maxPriorityFeePerGas==null)return r;const i=r.maxFeePerGas-r.maxPriorityFeePerGas;return{gasPrice:r.gasPrice,maxFeePerGas:i+e,maxPriorityFeePerGas:e}})}let Wy=!1;function Ipu(){if(Wy)return;Wy=!0;function e(u,t,n){const r=function(){const i=new ir(u,t);return n.ensNetwork!=null&&i.attachPlugin(new _d(null,n.ensNetwork)),i.attachPlugin(new kd),(n.plugins||[]).forEach(a=>{i.attachPlugin(a)}),i};ir.register(u,r),ir.register(t,r),n.altNames&&n.altNames.forEach(i=>{ir.register(i,r)})}e("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),e("ropsten",3,{ensNetwork:3}),e("rinkeby",4,{ensNetwork:4}),e("goerli",5,{ensNetwork:5}),e("kovan",42,{ensNetwork:42}),e("sepolia",11155111,{ensNetwork:11155111}),e("classic",61,{}),e("classicKotti",6,{}),e("arbitrum",42161,{ensNetwork:1}),e("arbitrum-goerli",421613,{}),e("bnb",56,{ensNetwork:1}),e("bnbt",97,{}),e("linea",59144,{ensNetwork:1}),e("linea-goerli",59140,{}),e("matic",137,{ensNetwork:1,plugins:[$y("https://gasstation.polygon.technology/v2")]}),e("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[$y("https://gasstation-testnet.polygon.technology/v2")]}),e("optimism",10,{ensNetwork:1,plugins:[Opu(BigInt("1000000"))]}),e("optimism-goerli",420,{}),e("xdai",100,{ensNetwork:1})}function H5(e){return JSON.parse(JSON.stringify(e))}var Qn,dt,ui,mn,q4,F9;class Npu{constructor(u){q(this,q4);q(this,Qn,void 0);q(this,dt,void 0);q(this,ui,void 0);q(this,mn,void 0);T(this,Qn,u),T(this,dt,null),T(this,ui,4e3),T(this,mn,-2)}get pollingInterval(){return b(this,ui)}set pollingInterval(u){T(this,ui,u)}start(){b(this,dt)||(T(this,dt,b(this,Qn)._setTimeout(cu(this,q4,F9).bind(this),b(this,ui))),cu(this,q4,F9).call(this))}stop(){b(this,dt)&&(b(this,Qn)._clearTimeout(b(this,dt)),T(this,dt,null))}pause(u){this.stop(),u&&T(this,mn,-2)}resume(){this.start()}}Qn=new WeakMap,dt=new WeakMap,ui=new WeakMap,mn=new WeakMap,q4=new WeakSet,F9=async function(){try{const u=await b(this,Qn).getBlockNumber();if(b(this,mn)===-2){T(this,mn,u);return}if(u!==b(this,mn)){for(let t=b(this,mn)+1;t<=u;t++){if(b(this,dt)==null)return;await b(this,Qn).emit("block",t)}T(this,mn,u)}}catch{}b(this,dt)!=null&&T(this,dt,b(this,Qn)._setTimeout(cu(this,q4,F9).bind(this),b(this,ui)))};var Ba,ya,ei;class pP{constructor(u){q(this,Ba,void 0);q(this,ya,void 0);q(this,ei,void 0);T(this,Ba,u),T(this,ei,!1),T(this,ya,t=>{this._poll(t,b(this,Ba))})}async _poll(u,t){throw new Error("sub-classes must override this")}start(){b(this,ei)||(T(this,ei,!0),b(this,ya).call(this,-2),b(this,Ba).on("block",b(this,ya)))}stop(){b(this,ei)&&(T(this,ei,!1),b(this,Ba).off("block",b(this,ya)))}pause(u){this.stop()}resume(){this.start()}}Ba=new WeakMap,ya=new WeakMap,ei=new WeakMap;var q2;class Rpu extends pP{constructor(t,n){super(t);q(this,q2,void 0);T(this,q2,H5(n))}async _poll(t,n){throw new Error("@TODO")}}q2=new WeakMap;var H4;class zpu extends pP{constructor(t,n){super(t);q(this,H4,void 0);T(this,H4,n)}async _poll(t,n){const r=await n.getTransactionReceipt(b(this,H4));r&&n.emit(b(this,H4),r)}}H4=new WeakMap;var Kn,G4,Q4,ti,ft,H2,hP;class pm{constructor(u,t){q(this,H2);q(this,Kn,void 0);q(this,G4,void 0);q(this,Q4,void 0);q(this,ti,void 0);q(this,ft,void 0);T(this,Kn,u),T(this,G4,H5(t)),T(this,Q4,cu(this,H2,hP).bind(this)),T(this,ti,!1),T(this,ft,-2)}start(){b(this,ti)||(T(this,ti,!0),b(this,ft)===-2&&b(this,Kn).getBlockNumber().then(u=>{T(this,ft,u)}),b(this,Kn).on("block",b(this,Q4)))}stop(){b(this,ti)&&(T(this,ti,!1),b(this,Kn).off("block",b(this,Q4)))}pause(u){this.stop(),u&&T(this,ft,-2)}resume(){this.start()}}Kn=new WeakMap,G4=new WeakMap,Q4=new WeakMap,ti=new WeakMap,ft=new WeakMap,H2=new WeakSet,hP=async function(u){if(b(this,ft)===-2)return;const t=H5(b(this,G4));t.fromBlock=b(this,ft)+1,t.toBlock=u;const n=await b(this,Kn).getLogs(t);if(n.length===0){b(this,ft){if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const r=Object.keys(n);return r.sort(),r.reduce((i,a)=>(i[a]=n[a],i),{})}return n})}class CP{constructor(u){eu(this,"name");Ru(this,{name:u})}start(){}stop(){}pause(u){}resume(){}}function Lpu(e){return JSON.parse(JSON.stringify(e))}function G5(e){return e=Array.from(new Set(e).values()),e.sort(),e}async function sf(e,u){if(e==null)throw new Error("invalid event");if(Array.isArray(e)&&(e={topics:e}),typeof e=="string")switch(e){case"block":case"pending":case"debug":case"error":case"network":return{type:e,tag:e}}if(h0(e,32)){const t=e.toLowerCase();return{type:"transaction",tag:D9("tx",{hash:t}),hash:t}}if(e.orphan){const t=e;return{type:"orphan",tag:D9("orphan",t),filter:Lpu(t)}}if(e.address||e.topics){const t=e,n={topics:(t.topics||[]).map(r=>r==null?null:Array.isArray(r)?G5(r.map(i=>i.toLowerCase())):r.toLowerCase())};if(t.address){const r=[],i=[],a=s=>{h0(s)?r.push(s):i.push((async()=>{r.push(await Ce(s,u))})())};Array.isArray(t.address)?t.address.forEach(a):a(t.address),i.length&&await Promise.all(i),n.address=G5(r.map(s=>s.toLowerCase()))}return{filter:n,tag:D9("event",n),type:"event"}}V(!1,"unknown ProviderEvent","event",e)}function of(){return new Date().getTime()}const Upu={cacheTimeout:250,pollingInterval:4e3};var ne,ni,re,K4,He,Fa,ri,Vn,yc,pt,V4,J4,ve,rt,Fc,Q5,Dc,K5,Da,z3,vc,V5,va,j3,Y4,v9;class $pu{constructor(u,t){q(this,ve);q(this,Fc);q(this,Dc);q(this,Da);q(this,vc);q(this,va);q(this,Y4);q(this,ne,void 0);q(this,ni,void 0);q(this,re,void 0);q(this,K4,void 0);q(this,He,void 0);q(this,Fa,void 0);q(this,ri,void 0);q(this,Vn,void 0);q(this,yc,void 0);q(this,pt,void 0);q(this,V4,void 0);q(this,J4,void 0);if(T(this,J4,Object.assign({},Upu,t||{})),u==="any")T(this,Fa,!0),T(this,He,null);else if(u){const n=ir.from(u);T(this,Fa,!1),T(this,He,Promise.resolve(n)),setTimeout(()=>{this.emit("network",n,null)},0)}else T(this,Fa,!1),T(this,He,null);T(this,Vn,-1),T(this,ri,new Map),T(this,ne,new Map),T(this,ni,new Map),T(this,re,null),T(this,K4,!1),T(this,yc,1),T(this,pt,new Map),T(this,V4,!1)}get pollingInterval(){return b(this,J4).pollingInterval}get provider(){return this}get plugins(){return Array.from(b(this,ni).values())}attachPlugin(u){if(b(this,ni).get(u.name))throw new Error(`cannot replace existing plugin: ${u.name} `);return b(this,ni).set(u.name,u.connect(this)),this}getPlugin(u){return b(this,ni).get(u)||null}get disableCcipRead(){return b(this,V4)}set disableCcipRead(u){T(this,V4,!!u)}async ccipReadFetch(u,t,n){if(this.disableCcipRead||n.length===0||u.to==null)return null;const r=u.to.toLowerCase(),i=t.toLowerCase(),a=[];for(let s=0;s=500,`response not found during CCIP fetch: ${E}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:u,info:{url:o,errorMessage:E}}),a.push(E)}du(!1,`error encountered during CCIP fetch: ${a.map(s=>JSON.stringify(s)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:u,info:{urls:n,errorMessages:a}})}_wrapBlock(u,t){return new opu(xpu(u),this)}_wrapLog(u,t){return new lE(bpu(u),this)}_wrapTransactionReceipt(u,t){return new XS(Ppu(u),this)}_wrapTransactionResponse(u,t){return new Xl(dP(u),this)}_detectNetwork(){du(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(u){du(!1,`unsupported method: ${u.method}`,"UNSUPPORTED_OPERATION",{operation:u.method,info:u})}async getBlockNumber(){const u=Gu(await cu(this,ve,rt).call(this,{method:"getBlockNumber"}),"%response");return b(this,Vn)>=0&&T(this,Vn,u),u}_getAddress(u){return Ce(u,this)}_getBlockTag(u){if(u==null)return"latest";switch(u){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return u}if(h0(u))return h0(u,32)?u:js(u);if(typeof u=="bigint"&&(u=Gu(u,"blockTag")),typeof u=="number")return u>=0?js(u):b(this,Vn)>=0?js(b(this,Vn)+u):this.getBlockNumber().then(t=>js(t+u));V(!1,"invalid blockTag","blockTag",u)}_getFilter(u){const t=(u.topics||[]).map(o=>o==null?null:Array.isArray(o)?G5(o.map(l=>l.toLowerCase())):o.toLowerCase()),n="blockHash"in u?u.blockHash:void 0,r=(o,l,c)=>{let E;switch(o.length){case 0:break;case 1:E=o[0];break;default:o.sort(),E=o}if(n&&(l!=null||c!=null))throw new Error("invalid filter");const d={};return E&&(d.address=E),t.length&&(d.topics=t),l&&(d.fromBlock=l),c&&(d.toBlock=c),n&&(d.blockHash=n),d};let i=[];if(u.address)if(Array.isArray(u.address))for(const o of u.address)i.push(this._getAddress(o));else i.push(this._getAddress(u.address));let a;"fromBlock"in u&&(a=this._getBlockTag(u.fromBlock));let s;return"toBlock"in u&&(s=this._getBlockTag(u.toBlock)),i.filter(o=>typeof o!="string").length||a!=null&&typeof a!="string"||s!=null&&typeof s!="string"?Promise.all([Promise.all(i),a,s]).then(o=>r(o[0],o[1],o[2])):r(i,a,s)}_getTransactionRequest(u){const t=I2(u),n=[];if(["to","from"].forEach(r=>{if(t[r]==null)return;const i=Ce(t[r],this);KE(i)?n.push(async function(){t[r]=await i}()):t[r]=i}),t.blockTag!=null){const r=this._getBlockTag(t.blockTag);KE(r)?n.push(async function(){t.blockTag=await r}()):t.blockTag=r}return n.length?async function(){return await Promise.all(n),t}():t}async getNetwork(){if(b(this,He)==null){const r=this._detectNetwork().then(i=>(this.emit("network",i,null),i),i=>{throw b(this,He)===r&&T(this,He,null),i});return T(this,He,r),(await r).clone()}const u=b(this,He),[t,n]=await Promise.all([u,this._detectNetwork()]);return t.chainId!==n.chainId&&(b(this,Fa)?(this.emit("network",n,t),b(this,He)===u&&T(this,He,Promise.resolve(n))):du(!1,`network changed: ${t.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),t.clone()}async getFeeData(){const u=await this.getNetwork(),t=async()=>{const{_block:r,gasPrice:i}=await de({_block:cu(this,vc,V5).call(this,"latest",!1),gasPrice:(async()=>{try{const l=await cu(this,ve,rt).call(this,{method:"getGasPrice"});return Iu(l,"%response")}catch{}return null})()});let a=null,s=null;const o=this._wrapBlock(r,u);return o&&o.baseFeePerGas&&(s=BigInt("1000000000"),a=o.baseFeePerGas*jpu+s),new Ry(i,a,s)},n=u.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const r=new Cr(n.url),i=await n.processFunc(t,this,r);return new Ry(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await t()}async estimateGas(u){let t=this._getTransactionRequest(u);return KE(t)&&(t=await t),Iu(await cu(this,ve,rt).call(this,{method:"estimateGas",transaction:t}),"%response")}async call(u){const{tx:t,blockTag:n}=await de({tx:this._getTransactionRequest(u),blockTag:this._getBlockTag(u.blockTag)});return await cu(this,Dc,K5).call(this,cu(this,Fc,Q5).call(this,t,n,u.enableCcipRead?0:-1))}async getBalance(u,t){return Iu(await cu(this,Da,z3).call(this,{method:"getBalance"},u,t),"%response")}async getTransactionCount(u,t){return Gu(await cu(this,Da,z3).call(this,{method:"getTransactionCount"},u,t),"%response")}async getCode(u,t){return Ou(await cu(this,Da,z3).call(this,{method:"getCode"},u,t))}async getStorage(u,t,n){const r=Iu(t,"position");return Ou(await cu(this,Da,z3).call(this,{method:"getStorage",position:r},u,n))}async broadcastTransaction(u){const{blockNumber:t,hash:n,network:r}=await de({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:u}),network:this.getNetwork()}),i=T2.from(u);if(i.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,r).replaceableTransaction(t)}async getBlock(u,t){const{network:n,params:r}=await de({network:this.getNetwork(),params:cu(this,vc,V5).call(this,u,!!t)});return r==null?null:this._wrapBlock(r,n)}async getTransaction(u){const{network:t,params:n}=await de({network:this.getNetwork(),params:cu(this,ve,rt).call(this,{method:"getTransaction",hash:u})});return n==null?null:this._wrapTransactionResponse(n,t)}async getTransactionReceipt(u){const{network:t,params:n}=await de({network:this.getNetwork(),params:cu(this,ve,rt).call(this,{method:"getTransactionReceipt",hash:u})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const r=await cu(this,ve,rt).call(this,{method:"getTransaction",hash:u});if(r==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=r.gasPrice}return this._wrapTransactionReceipt(n,t)}async getTransactionResult(u){const{result:t}=await de({network:this.getNetwork(),result:cu(this,ve,rt).call(this,{method:"getTransactionResult",hash:u})});return t==null?null:Ou(t)}async getLogs(u){let t=this._getFilter(u);KE(t)&&(t=await t);const{network:n,params:r}=await de({network:this.getNetwork(),params:cu(this,ve,rt).call(this,{method:"getLogs",filter:t})});return r.map(i=>this._wrapLog(i,n))}_getProvider(u){du(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(u){return await R2.fromName(this,u)}async getAvatar(u){const t=await this.getResolver(u);return t?await t.getAvatar():null}async resolveName(u){const t=await this.getResolver(u);return t?await t.getAddress():null}async lookupAddress(u){u=Zu(u);const t=M5(u.substring(2).toLowerCase()+".addr.reverse");try{const n=await R2.getEnsAddress(this),i=await new u4(n,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(i==null||i===O5)return null;const s=await new u4(i,["function name(bytes32) view returns (string)"],this).name(t);return await this.resolveName(s)!==u?null:s}catch(n){if(Dt(n,"BAD_DATA")&&n.value==="0x"||Dt(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(u,t,n){const r=t??1;return r===0?this.getTransactionReceipt(u):new Promise(async(i,a)=>{let s=null;const o=async l=>{try{const c=await this.getTransactionReceipt(u);if(c!=null&&l-c.blockNumber+1>=r){i(c),s&&(clearTimeout(s),s=null);return}}catch(c){console.log("EEE",c)}this.once("block",o)};n!=null&&(s=setTimeout(()=>{s!=null&&(s=null,this.off("block",o),a(_0("timeout","TIMEOUT",{reason:"timeout"})))},n)),o(await this.getBlockNumber())})}async waitForBlock(u){du(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(u){const t=b(this,pt).get(u);t&&(t.timer&&clearTimeout(t.timer),b(this,pt).delete(u))}_setTimeout(u,t){t==null&&(t=0);const n=br(this,yc)._++,r=()=>{b(this,pt).delete(n),u()};if(this.paused)b(this,pt).set(n,{timer:null,func:r,time:t});else{const i=setTimeout(r,t);b(this,pt).set(n,{timer:i,func:r,time:of()})}return n}_forEachSubscriber(u){for(const t of b(this,ne).values())u(t.subscriber)}_getSubscriber(u){switch(u.type){case"debug":case"error":case"network":return new CP(u.type);case"block":{const t=new Npu(this);return t.pollingInterval=this.pollingInterval,t}case"event":return new pm(this,u.filter);case"transaction":return new zpu(this,u.hash);case"orphan":return new Rpu(this,u.filter)}throw new Error(`unsupported event: ${u.type}`)}_recoverSubscriber(u,t){for(const n of b(this,ne).values())if(n.subscriber===u){n.started&&n.subscriber.stop(),n.subscriber=t,n.started&&t.start(),b(this,re)!=null&&t.pause(b(this,re));break}}async on(u,t){const n=await cu(this,Y4,v9).call(this,u);return n.listeners.push({listener:t,once:!1}),n.started||(n.subscriber.start(),n.started=!0,b(this,re)!=null&&n.subscriber.pause(b(this,re))),this}async once(u,t){const n=await cu(this,Y4,v9).call(this,u);return n.listeners.push({listener:t,once:!0}),n.started||(n.subscriber.start(),n.started=!0,b(this,re)!=null&&n.subscriber.pause(b(this,re))),this}async emit(u,...t){const n=await cu(this,va,j3).call(this,u,t);if(!n||n.listeners.length===0)return!1;const r=n.listeners.length;return n.listeners=n.listeners.filter(({listener:i,once:a})=>{const s=new X_(this,a?null:i,u);try{i.call(this,...t,s)}catch{}return!a}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),b(this,ne).delete(n.tag)),r>0}async listenerCount(u){if(u){const n=await cu(this,va,j3).call(this,u);return n?n.listeners.length:0}let t=0;for(const{listeners:n}of b(this,ne).values())t+=n.length;return t}async listeners(u){if(u){const n=await cu(this,va,j3).call(this,u);return n?n.listeners.map(({listener:r})=>r):[]}let t=[];for(const{listeners:n}of b(this,ne).values())t=t.concat(n.map(({listener:r})=>r));return t}async off(u,t){const n=await cu(this,va,j3).call(this,u);if(!n)return this;if(t){const r=n.listeners.map(({listener:i})=>i).indexOf(t);r>=0&&n.listeners.splice(r,1)}return(!t||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),b(this,ne).delete(n.tag)),this}async removeAllListeners(u){if(u){const{tag:t,started:n,subscriber:r}=await cu(this,Y4,v9).call(this,u);n&&r.stop(),b(this,ne).delete(t)}else for(const[t,{started:n,subscriber:r}]of b(this,ne))n&&r.stop(),b(this,ne).delete(t);return this}async addListener(u,t){return await this.on(u,t)}async removeListener(u,t){return this.off(u,t)}get destroyed(){return b(this,K4)}destroy(){this.removeAllListeners();for(const u of b(this,pt).keys())this._clearTimeout(u);T(this,K4,!0)}get paused(){return b(this,re)!=null}set paused(u){!!u!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(u){if(T(this,Vn,-1),b(this,re)!=null){if(b(this,re)==!!u)return;du(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(t=>t.pause(u)),T(this,re,!!u);for(const t of b(this,pt).values())t.timer&&clearTimeout(t.timer),t.time=of()-t.time}resume(){if(b(this,re)!=null){this._forEachSubscriber(u=>u.resume()),T(this,re,null);for(const u of b(this,pt).values()){let t=u.time;t<0&&(t=0),u.time=of(),setTimeout(u.func,t)}}}}ne=new WeakMap,ni=new WeakMap,re=new WeakMap,K4=new WeakMap,He=new WeakMap,Fa=new WeakMap,ri=new WeakMap,Vn=new WeakMap,yc=new WeakMap,pt=new WeakMap,V4=new WeakMap,J4=new WeakMap,ve=new WeakSet,rt=async function(u){const t=b(this,J4).cacheTimeout;if(t<0)return await this._perform(u);const n=D9(u.method,u);let r=b(this,ri).get(n);return r||(r=this._perform(u),b(this,ri).set(n,r),setTimeout(()=>{b(this,ri).get(n)===r&&b(this,ri).delete(n)},t)),await r},Fc=new WeakSet,Q5=async function(u,t,n){du(n=0&&t==="latest"&&r.to!=null&&A0(i.data,0,4)==="0x556f1830"){const a=i.data,s=await Ce(r.to,this);let o;try{o=Qpu(A0(i.data,4))}catch(E){du(!1,E.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:r,info:{data:a}})}du(o.sender.toLowerCase()===s.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:a,reason:"OffchainLookup",transaction:r,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:o.errorArgs}});const l=await this.ccipReadFetch(r,o.calldata,o.urls);du(l!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:r,info:{data:i.data,errorArgs:o.errorArgs}});const c={to:s,data:R0([o.selector,Gpu([l,o.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:c});try{const E=await cu(this,Fc,Q5).call(this,c,t,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},c),result:E}),E}catch(E){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},c),error:E}),E}}throw i}},Dc=new WeakSet,K5=async function(u){const{value:t}=await de({network:this.getNetwork(),value:u});return t},Da=new WeakSet,z3=async function(u,t,n){let r=this._getAddress(t),i=this._getBlockTag(n);return(typeof r!="string"||typeof i!="string")&&([r,i]=await Promise.all([r,i])),await cu(this,Dc,K5).call(this,cu(this,ve,rt).call(this,Object.assign(u,{address:r,blockTag:i})))},vc=new WeakSet,V5=async function(u,t){if(h0(u,32))return await cu(this,ve,rt).call(this,{method:"getBlock",blockHash:u,includeTransactions:t});let n=this._getBlockTag(u);return typeof n!="string"&&(n=await n),await cu(this,ve,rt).call(this,{method:"getBlock",blockTag:n,includeTransactions:t})},va=new WeakSet,j3=async function(u,t){let n=await sf(u,this);return n.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(n=await sf({orphan:"drop-log",log:t[0]},this)),b(this,ne).get(n.tag)||null},Y4=new WeakSet,v9=async function(u){const t=await sf(u,this),n=t.tag;let r=b(this,ne).get(n);return r||(r={subscriber:this._getSubscriber(t),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},b(this,ne).set(n,r)),r};function Wpu(e,u){try{const t=J5(e,u);if(t)return nm(t)}catch{}return null}function J5(e,u){if(e==="0x")return null;try{const t=Gu(A0(e,u,u+32)),n=Gu(A0(e,t,t+32));return A0(e,t+32,t+32+n)}catch{}return null}function qy(e){const u=Ve(e);if(u.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(u,32-u.length),t}function qpu(e){if(e.length%32===0)return e;const u=new Uint8Array(Math.ceil(e.length/32)*32);return u.set(e),u}const Hpu=new Uint8Array([]);function Gpu(e){const u=[];let t=0;for(let n=0;n=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=A0(e,0,32);du(A0(t,0,12)===A0(Hy,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),u.sender=A0(t,12);try{const n=[],r=Gu(A0(e,32,64)),i=Gu(A0(e,r,r+32)),a=A0(e,r+32);for(let s=0;su[n]),u}function fs(e,u){if(e.provider)return e.provider;du(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:u})}async function Gy(e,u){let t=I2(u);if(t.to!=null&&(t.to=Ce(t.to,e)),t.from!=null){const n=t.from;t.from=Promise.all([e.getAddress(),Ce(n,e)]).then(([r,i])=>(V(r.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),r))}else t.from=e.getAddress();return await de(t)}class Kpu{constructor(u){eu(this,"provider");Ru(this,{provider:u||null})}async getNonce(u){return fs(this,"getTransactionCount").getTransactionCount(await this.getAddress(),u)}async populateCall(u){return await Gy(this,u)}async populateTransaction(u){const t=fs(this,"populateTransaction"),n=await Gy(this,u);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const r=await this.provider.getNetwork();if(n.chainId!=null){const a=Iu(n.chainId);V(a===r.chainId,"transaction chainId mismatch","tx.chainId",u.chainId)}else n.chainId=r.chainId;const i=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||i)?V(!1,"eip-1559 transaction do not support gasPrice","tx",u):(n.type===0||n.type===1)&&i&&V(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",u),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const a=await t.getFeeData();du(a.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice)}else{const a=await t.getFeeData();if(n.type==null)if(a.maxFeePerGas!=null&&a.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const s=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=s,n.maxPriorityFeePerGas=s}else n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas);else a.gasPrice!=null?(du(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice),n.type=0):du(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else n.type===2&&(n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas))}return await de(n)}async estimateGas(u){return fs(this,"estimateGas").estimateGas(await this.populateCall(u))}async call(u){return fs(this,"call").call(await this.populateCall(u))}async resolveName(u){return await fs(this,"resolveName").resolveName(u)}async sendTransaction(u){const t=fs(this,"sendTransaction"),n=await this.populateTransaction(u);delete n.from;const r=T2.from(n);return await t.broadcastTransaction(await this.signTransaction(r))}}function Vpu(e){return JSON.parse(JSON.stringify(e))}var be,An,ba,ii,wa,Z4,bc,Y5,wc,Z5;class mP{constructor(u){q(this,bc);q(this,wc);q(this,be,void 0);q(this,An,void 0);q(this,ba,void 0);q(this,ii,void 0);q(this,wa,void 0);q(this,Z4,void 0);T(this,be,u),T(this,An,null),T(this,ba,cu(this,bc,Y5).bind(this)),T(this,ii,!1),T(this,wa,null),T(this,Z4,!1)}_subscribe(u){throw new Error("subclasses must override this")}_emitResults(u,t){throw new Error("subclasses must override this")}_recover(u){throw new Error("subclasses must override this")}start(){b(this,ii)||(T(this,ii,!0),cu(this,bc,Y5).call(this,-2))}stop(){b(this,ii)&&(T(this,ii,!1),T(this,Z4,!0),cu(this,wc,Z5).call(this),b(this,be).off("block",b(this,ba)))}pause(u){u&&cu(this,wc,Z5).call(this),b(this,be).off("block",b(this,ba))}resume(){this.start()}}be=new WeakMap,An=new WeakMap,ba=new WeakMap,ii=new WeakMap,wa=new WeakMap,Z4=new WeakMap,bc=new WeakSet,Y5=async function(u){try{b(this,An)==null&&T(this,An,this._subscribe(b(this,be)));let t=null;try{t=await b(this,An)}catch(i){if(!Dt(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(t==null){T(this,An,null),b(this,be)._recoverSubscriber(this,this._recover(b(this,be)));return}const n=await b(this,be).getNetwork();if(b(this,wa)||T(this,wa,n),b(this,wa).chainId!==n.chainId)throw new Error("chaid changed");if(b(this,Z4))return;const r=await b(this,be).send("eth_getFilterChanges",[t]);await this._emitResults(b(this,be),r)}catch(t){console.log("@TODO",t)}b(this,be).once("block",b(this,ba))},wc=new WeakSet,Z5=function(){const u=b(this,An);u&&(T(this,An,null),u.then(t=>{b(this,be).send("eth_uninstallFilter",[t])}))};var xa;class Jpu extends mP{constructor(t,n){super(t);q(this,xa,void 0);T(this,xa,Vpu(n))}_recover(t){return new pm(t,b(this,xa))}async _subscribe(t){return await t.send("eth_newFilter",[b(this,xa)])}async _emitResults(t,n){for(const r of n)t.emit(b(this,xa),t._wrapLog(r,t._network))}}xa=new WeakMap;class Ypu extends mP{async _subscribe(u){return await u.send("eth_newPendingTransactionFilter",[])}async _emitResults(u,t){for(const n of t)u.emit("pending",n)}}const Zpu="bigint,boolean,function,number,string,symbol".split(/,/g);function b9(e){if(e==null||Zpu.indexOf(typeof e)>=0||typeof e.getAddress=="function")return e;if(Array.isArray(e))return e.map(b9);if(typeof e=="object")return Object.keys(e).reduce((u,t)=>(u[t]=e[t],u),{});throw new Error(`should not happen: ${e} (${typeof e})`)}function Xpu(e){return new Promise(u=>{setTimeout(u,e)})}function ps(e){return e&&e.toLowerCase()}function Qy(e){return e&&typeof e.pollingInterval=="number"}const u5u={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class lf extends Kpu{constructor(t,n){super(t);eu(this,"address");n=Zu(n),Ru(this,{address:n})}connect(t){du(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(t){return await this.populateCall(t)}async sendUncheckedTransaction(t){const n=b9(t),r=[];if(n.from){const a=n.from;r.push((async()=>{const s=await Ce(a,this.provider);V(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),n.from=s})())}else n.from=this.address;if(n.gasLimit==null&&r.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const a=n.to;r.push((async()=>{n.to=await Ce(a,this.provider)})())}r.length&&await Promise.all(r);const i=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(t){const n=await this.provider.getBlockNumber(),r=await this.sendUncheckedTransaction(t);return await new Promise((i,a)=>{const s=[1e3,100],o=async()=>{const l=await this.provider.getTransaction(r);if(l!=null){i(l.replaceableTransaction(n));return}this.provider._setTimeout(()=>{o()},s.pop()||4e3)};o()})}async signTransaction(t){const n=b9(t);if(n.from){const i=await Ce(n.from,this.provider);V(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),n.from=i}else n.from=this.address;const r=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[r])}async signMessage(t){const n=typeof t=="string"?or(t):t;return await this.provider.send("personal_sign",[Ou(n),this.address.toLowerCase()])}async signTypedData(t,n,r){const i=b9(r),a=await O2.resolveNames(t,n,i,async s=>{const o=await Ce(s);return V(o!=null,"TypedData does not support null address","value",s),o});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(O2.getPayload(a.domain,n,a.value))])}async unlock(t){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),t,null])}async _legacySignMessage(t){const n=typeof t=="string"?or(t):t;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ou(n)])}}var ka,X4,Jn,gn,Ut,Yn,xc,X5;class e5u extends $pu{constructor(t,n){super(t,n);q(this,xc);q(this,ka,void 0);q(this,X4,void 0);q(this,Jn,void 0);q(this,gn,void 0);q(this,Ut,void 0);q(this,Yn,void 0);T(this,X4,1),T(this,ka,Object.assign({},u5u,n||{})),T(this,Jn,[]),T(this,gn,null),T(this,Yn,null);{let i=null;const a=new Promise(s=>{i=s});T(this,Ut,{promise:a,resolve:i})}const r=this._getOption("staticNetwork");r&&(V(t==null||r.matches(t),"staticNetwork MUST match network object","options",n),T(this,Yn,r))}_getOption(t){return b(this,ka)[t]}get _network(){return du(b(this,Yn),"network is not available yet","NETWORK_ERROR"),b(this,Yn)}async _perform(t){if(t.method==="call"||t.method==="estimateGas"){let r=t.transaction;if(r&&r.type!=null&&Iu(r.type)&&r.maxFeePerGas==null&&r.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(t=Object.assign({},t,{transaction:Object.assign({},r,{type:void 0})}))}}const n=this.getRpcRequest(t);return n!=null?await this.send(n.method,n.args):super._perform(t)}async _detectNetwork(){const t=this._getOption("staticNetwork");if(t)return t;if(this.ready)return ir.from(Iu(await this.send("eth_chainId",[])));const n={id:br(this,X4)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let r;try{r=(await this._send(n))[0]}catch(i){throw this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:r}),"result"in r)return ir.from(Iu(r.result));throw this.getRpcError(n,r)}_start(){b(this,Ut)==null||b(this,Ut).resolve==null||(b(this,Ut).resolve(),T(this,Ut,null),(async()=>{for(;b(this,Yn)==null&&!this.destroyed;)try{T(this,Yn,await this._detectNetwork())}catch(t){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",_0("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:t}})),await Xpu(1e3)}cu(this,xc,X5).call(this)})())}async _waitUntilReady(){if(b(this,Ut)!=null)return await b(this,Ut).promise}_getSubscriber(t){return t.type==="pending"?new Ypu(this):t.type==="event"?this._getOption("polling")?new pm(this,t.filter):new Jpu(this,t.filter):t.type==="orphan"&&t.filter.orphan==="drop-log"?new CP("orphan"):super._getSubscriber(t)}get ready(){return b(this,Ut)==null}getRpcTransaction(t){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(r=>{if(t[r]==null)return;let i=r;r==="gasLimit"&&(i="gas"),n[i]=js(Iu(t[r],`tx.${r}`))}),["from","to","data"].forEach(r=>{t[r]!=null&&(n[r]=Ou(t[r]))}),t.accessList&&(n.accessList=is(t.accessList)),n}getRpcRequest(t){switch(t.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getBalance":return{method:"eth_getBalance",args:[ps(t.address),t.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[ps(t.address),t.blockTag]};case"getCode":return{method:"eth_getCode",args:[ps(t.address),t.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[ps(t.address),"0x"+t.position.toString(16),t.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[t.signedTransaction]};case"getBlock":if("blockTag"in t)return{method:"eth_getBlockByNumber",args:[t.blockTag,!!t.includeTransactions]};if("blockHash"in t)return{method:"eth_getBlockByHash",args:[t.blockHash,!!t.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[t.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[t.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(t.transaction),t.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(t.transaction)]};case"getLogs":return t.filter&&t.filter.address!=null&&(Array.isArray(t.filter.address)?t.filter.address=t.filter.address.map(ps):t.filter.address=ps(t.filter.address)),{method:"eth_getLogs",args:[t.filter]}}return null}getRpcError(t,n){const{method:r}=t,{error:i}=n;if(r==="eth_estimateGas"&&i.message){const o=i.message;if(!o.match(/revert/i)&&o.match(/insufficient funds/i))return _0("insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.params[0],info:{payload:t,error:i}})}if(r==="eth_call"||r==="eth_estimateGas"){const o=uh(i),l=Zl.getBuiltinCallException(r==="eth_call"?"call":"estimateGas",t.params[0],o?o.data:null);return l.info={error:i,payload:t},l}const a=JSON.stringify(r5u(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return _0("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[r]||"unknown",reason:"rejected",info:{payload:t,error:i}});if(r==="eth_sendRawTransaction"||r==="eth_sendTransaction"){const o=t.params[0];if(a.match(/insufficient funds|base fee exceeds gas limit/i))return _0("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:o,info:{error:i}});if(a.match(/nonce/i)&&a.match(/too low/i))return _0("nonce has already been used","NONCE_EXPIRED",{transaction:o,info:{error:i}});if(a.match(/replacement transaction/i)&&a.match(/underpriced/i))return _0("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o,info:{error:i}});if(a.match(/only replay-protected/i))return _0("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:r,info:{transaction:o,info:{error:i}}})}let s=!!a.match(/the method .* does not exist/i);return s||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(s=!0),s?_0("unsupported operation","UNSUPPORTED_OPERATION",{operation:t.method,info:{error:i,payload:t}}):_0("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:t})}send(t,n){if(this.destroyed)return Promise.reject(_0("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t}));const r=br(this,X4)._++,i=new Promise((a,s)=>{b(this,Jn).push({resolve:a,reject:s,payload:{method:t,params:n,id:r,jsonrpc:"2.0"}})});return cu(this,xc,X5).call(this),i}async getSigner(t){t==null&&(t=0);const n=this.send("eth_accounts",[]);if(typeof t=="number"){const i=await n;if(t>=i.length)throw new Error("no such account");return new lf(this,i[t])}const{accounts:r}=await de({network:this.getNetwork(),accounts:n});t=Zu(t);for(const i of r)if(Zu(i)===t)return new lf(this,t);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new lf(this,n))}destroy(){b(this,gn)&&(clearTimeout(b(this,gn)),T(this,gn,null));for(const{payload:t,reject:n}of b(this,Jn))n(_0("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t.method}));T(this,Jn,[]),super.destroy()}}ka=new WeakMap,X4=new WeakMap,Jn=new WeakMap,gn=new WeakMap,Ut=new WeakMap,Yn=new WeakMap,xc=new WeakSet,X5=function(){if(b(this,gn))return;const t=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");T(this,gn,setTimeout(()=>{T(this,gn,null);const n=b(this,Jn);for(T(this,Jn,[]);n.length;){const r=[n.shift()];for(;n.length&&r.length!==b(this,ka).batchMaxCount;)if(r.push(n.shift()),JSON.stringify(r.map(a=>a.payload)).length>b(this,ka).batchMaxSize){n.unshift(r.pop());break}(async()=>{const i=r.length===1?r[0].payload:r.map(a=>a.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const a=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:a});for(const{resolve:s,reject:o,payload:l}of r){if(this.destroyed){o(_0("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:l.method}));continue}const c=a.filter(E=>E.id===l.id)[0];if(c==null){const E=_0("missing response for request","BAD_DATA",{value:a,info:{payload:l}});this.emit("error",E),o(E);continue}if("error"in c){o(this.getRpcError(l,c));continue}s(c.result)}}catch(a){this.emit("debug",{action:"receiveRpcError",error:a});for(const{reject:s}of r)s(a)}})()}},t))};var ai;class t5u extends e5u{constructor(t,n){super(t,n);q(this,ai,void 0);T(this,ai,4e3)}_getSubscriber(t){const n=super._getSubscriber(t);return Qy(n)&&(n.pollingInterval=b(this,ai)),n}get pollingInterval(){return b(this,ai)}set pollingInterval(t){if(!Number.isInteger(t)||t<0)throw new Error("invalid interval");T(this,ai,t),this._forEachSubscriber(n=>{Qy(n)&&(n.pollingInterval=b(this,ai))})}}ai=new WeakMap;var uo;class n5u extends t5u{constructor(t,n,r){t==null&&(t="http://localhost:8545");super(n,r);q(this,uo,void 0);typeof t=="string"?T(this,uo,new Cr(t)):T(this,uo,t.clone())}_getConnection(){return b(this,uo).clone()}async send(t,n){return await this._start(),await super.send(t,n)}async _send(t){const n=this._getConnection();n.body=JSON.stringify(t),n.setHeader("content-type","application/json");const r=await n.send();r.assertOk();let i=r.bodyJson;return Array.isArray(i)||(i=[i]),i}}uo=new WeakMap;function uh(e){if(e==null)return null;if(typeof e.message=="string"&&e.message.match(/revert/i)&&h0(e.data))return{message:e.message,data:e.data};if(typeof e=="object"){for(const u in e){const t=uh(e[u]);if(t)return t}return null}if(typeof e=="string")try{return uh(JSON.parse(e))}catch{}return null}function eh(e,u){if(e!=null){if(typeof e.message=="string"&&u.push(e.message),typeof e=="object")for(const t in e)eh(e[t],u);if(typeof e=="string")try{return eh(JSON.parse(e),u)}catch{}}}function r5u(e){const u=[];return eh(e,u),u}const i5u=u4,a5u=async()=>{const e=new n5u("https://goerli.optimism.io",420);return new i5u(ur[420],Fn.abi,e).balanceOf(ur[420])},s5u=()=>{const{error:e,isLoading:u,data:t}=ldu(["ethers.Contract().balanceOf"],a5u);return u?qu.jsx("div",{children:"'loading balance...'"}):e?(console.error(e),qu.jsx("div",{children:"error loading balance"})):qu.jsx("div",{children:t==null?void 0:t.toString()})},o5u=()=>{const{address:e}=et(),{data:u}=KC(),[t,n]=M.useState([]),r=Fn.events.Transfer({fromBlock:u&&u-BigInt(1e3),args:{to:e}});return VL({...r,address:ur[420],listener:i=>{n([...t,i])}}),qu.jsx("div",{children:qu.jsx("div",{style:{display:"flex",flexDirection:"column-reverse"},children:t.map((i,a)=>qu.jsxs("div",{children:[qu.jsxs("div",{children:["Event ",a]}),qu.jsx("div",{children:JSON.stringify(i)})]}))})})},l5u=()=>{const{address:e,isConnected:u}=et(),{data:t}=Cs({...Fn.read.balanceOf(e),address:ur[420],enabled:u}),{data:n}=Cs({...Fn.read.totalSupply(),address:ur[420],enabled:u}),{data:r}=Cs({...Fn.read.tokenURI(BigInt(1)),address:ur[420],enabled:u}),{data:i}=Cs({...Fn.read.symbol(),address:ur[420],enabled:u}),{data:a}=Cs({...Fn.read.ownerOf(BigInt(1)),address:ur[420],enabled:u});return qu.jsx("div",{children:qu.jsxs("div",{children:[qu.jsxs("div",{children:["balanceOf(",e,"): ",t==null?void 0:t.toString()]}),qu.jsxs("div",{children:["totalSupply(): ",n==null?void 0:n.toString()]}),qu.jsxs("div",{children:["tokenUri(BigInt(1)): ",r==null?void 0:r.toString()]}),qu.jsxs("div",{children:["symbol(): ",i==null?void 0:i.toString()]}),qu.jsxs("div",{children:["ownerOf(BigInt(1)): ",a==null?void 0:a.toString()]})]})})};function c5u(e=1,u=1e9){const t=u-e+1;return Math.floor(Math.random()*t)+e}const E5u=()=>{const{address:e,isConnected:u}=et(),{data:t,refetch:n}=Cs({...Fn.read.balanceOf(e),enabled:u}),{writeAsync:r,data:i}=uU({address:ur[420],...Fn.write.mint});return lU({hash:i==null?void 0:i.hash,onSuccess:a=>{console.log("minted",a),n()}}),qu.jsxs("div",{children:[qu.jsx("div",{children:qu.jsxs("div",{children:["balance: ",t==null?void 0:t.toString()]})}),qu.jsx("button",{type:"button",onClick:()=>r(Fn.write.mint(BigInt(c5u()))),children:"Mint"})]})};function d5u(){const[e,u]=M.useState("unselected"),{isConnected:t}=et(),n={unselected:qu.jsx(qu.Fragment,{children:"Select which component to render"}),reads:qu.jsx(l5u,{}),writes:qu.jsx(E5u,{}),events:qu.jsx(o5u,{}),ethers:qu.jsx(s5u,{})};return qu.jsxs(qu.Fragment,{children:[qu.jsx("h1",{children:"Evmts example"}),qu.jsx(N8,{}),t&&qu.jsxs(qu.Fragment,{children:[qu.jsx("hr",{}),qu.jsx("div",{style:{display:"flex"},children:Object.keys(n).map(r=>qu.jsx("button",{type:"button",onClick:()=>u(r),children:r}))}),qu.jsx("h2",{children:e}),n[e]]})]})}function f5u({rpc:e}){return function(u){const t=e(u);return!t||t.http===""?null:{chain:{...u,rpcUrls:{...u.rpcUrls,default:{http:[t.http]}}},rpcUrls:{http:[t.http],webSocket:t.webSocket?[t.webSocket]:void 0}}}}const p5u="898f836c53a18d0661340823973f0cb4",{chains:AP,publicClient:h5u,webSocketPublicClient:C5u}=MM([$C,wM],[f5u({rpc:e=>{const u={1:{http:"https://mainnet.infura.io/v3/845f07495e374dfabf3a66e3f10ad786"},420:{http:"https://goerli.optimism.io"}};return[1,420].includes(e.id)?u[e.id]:null}})]),{connectors:m5u}=_1u({appName:"My wagmi + RainbowKit App",chains:AP,projectId:p5u}),A5u=e=>vL({autoConnect:!0,connectors:m5u,publicClient:h5u,webSocketPublicClient:C5u,queryClient:e}),Ky=new H1u,gP=document.getElementById("root");if(!gP)throw new Error("No root element found");z_(gP).render(qu.jsx(M.StrictMode,{children:qu.jsx(J1u,{client:Ky,children:qu.jsx(bL,{config:A5u(Ky),children:qu.jsx(tlu,{chains:AP,children:qu.jsx(d5u,{})})})})}));export{Cd as $,hhu as A,phu as B,nhu as C,ghu as D,chu as E,Z5u as F,lhu as G,bhu as H,Ahu as I,uhu as J,V5u as K,J5u as L,St as M,jr as N,shu as O,ihu as P,ahu as Q,g2u as R,md as S,q8 as T,vo as U,Q5u as V,p_ as W,Rhu as X,ehu as Y,Nhu as Z,aE as _,Jz as a,y1 as a$,thu as a0,K5u as a1,dhu as a2,fhu as a3,Ad as a4,X5u as a5,H8 as a6,Chu as a7,Ehu as a8,mhu as a9,L5u as aA,s_ as aB,$9u as aC,L8 as aD,W9u as aE,q9u as aF,G9u as aG,a_ as aH,V9u as aI,Z9u as aJ,e2u as aK,n2u as aL,i2u as aM,l9u as aN,o_ as aO,d2u as aP,f2u as aQ,o2u as aR,E2u as aS,fau as aT,Bau as aU,Bu as aV,c1 as aW,ge as aX,lo as aY,Bl as aZ,WR as a_,zhu as aa,Dhu as ab,Fhu as ac,t1u as ad,Ohu as ae,whu as af,n1u as ag,yhu as ah,Shu as ai,xhu as aj,Phu as ak,Ihu as al,khu as am,_hu as an,Thu as ao,vhu as ap,Q2u as aq,C_ as ar,Q6 as as,$5u as at,W5u as au,Uu as av,Xcu as aw,Yu as ax,rF as ay,U5u as az,Yz as b,pr as b0,Ic as b1,K3 as b2,xn as b3,Zz as c,bb as d,nh as e,Ia as f,zz as g,$u as h,Gt as i,aB as j,th as k,Rz as l,Na as m,l9 as n,Bhu as o,q5u as p,H5u as q,ld as r,G5u as s,Yt as t,f_ as u,ze as v,un as w,Y5u as x,rhu as y,ohu as z}; + Approved: ${d.toString()}`))}),a.forEach(E=>{n||(Zi(r[E].methods,i[E].methods)?Zi(r[E].events,i[E].events)||(n=jr("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${E}`)):n=jr("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${E}`))}),n}function r1u(e){const u={};return Object.keys(e).forEach(t=>{var n;t.includes(":")?u[t]=e[t]:(n=e[t].chains)==null||n.forEach(r=>{u[r]={methods:e[t].methods,events:e[t].events}})}),u}function IB(e){return[...new Set(e.map(u=>u.includes(":")?u.split(":")[0]:u))]}function i1u(e){const u={};return Object.keys(e).forEach(t=>{if(t.includes(":"))u[t]=e[t];else{const n=n3(e[t].accounts);n==null||n.forEach(r=>{u[r]={accounts:e[t].accounts.filter(i=>i.includes(`${r}:`)),methods:e[t].methods,events:e[t].events}})}}),u}function Ihu(e,u){return G8(e,!1)&&e<=u.max&&e>=u.min}function Nhu(){const e=sE();return new Promise(u=>{switch(e){case Ke.browser:u(a1u());break;case Ke.reactNative:u(s1u());break;case Ke.node:u(o1u());break;default:u(!0)}})}function a1u(){return q8()&&(navigator==null?void 0:navigator.onLine)}async function s1u(){if(md()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo){const e=await(globalThis==null?void 0:globalThis.NetInfo.fetch());return e==null?void 0:e.isConnected}return!0}function o1u(){return!0}function Rhu(e){switch(sE()){case Ke.browser:l1u(e);break;case Ke.reactNative:c1u(e);break}}function l1u(e){!md()&&q8()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)))}function c1u(e){md()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo&&(globalThis==null||globalThis.NetInfo.addEventListener(u=>e(u==null?void 0:u.isConnected)))}const K6={};class zhu{static get(u){return K6[u]}static set(u,t){K6[u]=t}static delete(u){delete K6[u]}}var g_="eip155",E1u="store",B_="requestedChains",c5="wallet_addEthereumChain",d0,J3,f9,E5,Q8,y_,p9,d5,f5,F_,B2,K8,As,x3,y2,V8,F2,J8,D2,Y8,D_=class extends Hc{constructor(e){super({...e,options:{isNewChainsStale:!0,...e.options}}),S0(this,f9),S0(this,Q8),S0(this,p9),S0(this,f5),S0(this,B2),S0(this,As),S0(this,y2),S0(this,F2),S0(this,D2),this.id="walletConnect",this.name="WalletConnect",this.ready=!0,S0(this,d0,void 0),S0(this,J3,void 0),this.onAccountsChanged=u=>{u.length===0?this.emit("disconnect"):this.emit("change",{account:oe(u[0])})},this.onChainChanged=u=>{const t=Number(u),n=this.isChainUnsupported(t);this.emit("change",{chain:{id:t,unsupported:n}})},this.onDisconnect=()=>{k0(this,As,x3).call(this,[]),this.emit("disconnect")},this.onDisplayUri=u=>{this.emit("message",{type:"display_uri",data:u})},this.onConnect=()=>{this.emit("connect",{})},k0(this,f9,E5).call(this)}async connect({chainId:e,pairingTopic:u}={}){var t,n,r,i,a;try{let s=e;if(!s){const p=(t=this.storage)==null?void 0:t.getItem(E1u),h=(i=(r=(n=p==null?void 0:p.state)==null?void 0:n.data)==null?void 0:r.chain)==null?void 0:i.id;h&&!this.isChainUnsupported(h)?s=h:s=(a=this.chains[0])==null?void 0:a.id}if(!s)throw new Error("No chains found on connector.");const o=await this.getProvider();k0(this,f5,F_).call(this);const l=k0(this,p9,d5).call(this);if(o.session&&l&&await o.disconnect(),!o.session||l){const p=this.chains.filter(h=>h.id!==s).map(h=>h.id);this.emit("message",{type:"connecting"}),await o.connect({pairingTopic:u,chains:[s],optionalChains:p.length?p:void 0}),k0(this,As,x3).call(this,this.chains.map(({id:h})=>h))}const c=await o.enable(),E=oe(c[0]),d=await this.getChainId(),f=this.isChainUnsupported(d);return{account:E,chain:{id:d,unsupported:f}}}catch(s){throw/user rejected/i.test(s==null?void 0:s.message)?new O0(s):s}}async disconnect(){const e=await this.getProvider();try{await e.disconnect()}catch(u){if(!/No matching key/i.test(u.message))throw u}finally{k0(this,B2,K8).call(this),k0(this,As,x3).call(this,[])}}async getAccount(){const{accounts:e}=await this.getProvider();return oe(e[0])}async getChainId(){const{chainId:e}=await this.getProvider();return e}async getProvider({chainId:e}={}){return Hu(this,d0)||await k0(this,f9,E5).call(this),e&&await this.switchChain(e),Hu(this,d0)}async getWalletClient({chainId:e}={}){const[u,t]=await Promise.all([this.getProvider({chainId:e}),this.getAccount()]),n=this.chains.find(r=>r.id===e);if(!u)throw new Error("provider is required.");return qc({account:t,chain:n,transport:$c(u)})}async isAuthorized(){try{const[e,u]=await Promise.all([this.getAccount(),this.getProvider()]),t=k0(this,p9,d5).call(this);if(!e)return!1;if(t&&u.session){try{await u.disconnect()}catch{}return!1}return!0}catch{return!1}}async switchChain(e){var t,n;const u=this.chains.find(r=>r.id===e);if(!u)throw new kn(new Error("chain not found on connector."));try{const r=await this.getProvider(),i=k0(this,F2,J8).call(this),a=k0(this,D2,Y8).call(this);if(!i.includes(e)&&a.includes(c5)){await r.request({method:c5,params:[{chainId:Lu(u.id),blockExplorerUrls:[(n=(t=u.blockExplorers)==null?void 0:t.default)==null?void 0:n.url],chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[...u.rpcUrls.default.http]}]});const o=k0(this,y2,V8).call(this);o.push(e),k0(this,As,x3).call(this,o)}return await r.request({method:"wallet_switchEthereumChain",params:[{chainId:Lu(e)}]}),u}catch(r){const i=typeof r=="string"?r:r==null?void 0:r.message;throw/user rejected request/i.test(i)?new O0(r):new kn(r)}}};d0=new WeakMap;J3=new WeakMap;f9=new WeakSet;E5=async function(){return!Hu(this,J3)&&typeof window<"u"&&hr(this,J3,k0(this,Q8,y_).call(this)),Hu(this,J3)};Q8=new WeakSet;y_=async function(){const{EthereumProvider:e,OPTIONAL_EVENTS:u,OPTIONAL_METHODS:t}=await Uu(()=>import("./index.es-deb3bc81.js"),["assets/index.es-deb3bc81.js","assets/events-18c74ae2.js","assets/http-2c4dd3df.js"]),[n,...r]=this.chains.map(({id:i})=>i);if(n){const{projectId:i,showQrModal:a=!0,qrModalOptions:s,metadata:o,relayUrl:l}=this.options;hr(this,d0,await e.init({showQrModal:a,qrModalOptions:s,projectId:i,optionalMethods:t,optionalEvents:u,chains:[n],optionalChains:r.length?r:void 0,rpcMap:Object.fromEntries(this.chains.map(c=>[c.id,c.rpcUrls.default.http[0]])),metadata:o,relayUrl:l}))}};p9=new WeakSet;d5=function(){if(k0(this,D2,Y8).call(this).includes(c5)||!this.options.isNewChainsStale)return!1;const u=k0(this,y2,V8).call(this),t=this.chains.map(({id:r})=>r),n=k0(this,F2,J8).call(this);return n.length&&!n.some(r=>t.includes(r))?!1:!t.every(r=>u.includes(r))};f5=new WeakSet;F_=function(){Hu(this,d0)&&(k0(this,B2,K8).call(this),Hu(this,d0).on("accountsChanged",this.onAccountsChanged),Hu(this,d0).on("chainChanged",this.onChainChanged),Hu(this,d0).on("disconnect",this.onDisconnect),Hu(this,d0).on("session_delete",this.onDisconnect),Hu(this,d0).on("display_uri",this.onDisplayUri),Hu(this,d0).on("connect",this.onConnect))};B2=new WeakSet;K8=function(){Hu(this,d0)&&(Hu(this,d0).removeListener("accountsChanged",this.onAccountsChanged),Hu(this,d0).removeListener("chainChanged",this.onChainChanged),Hu(this,d0).removeListener("disconnect",this.onDisconnect),Hu(this,d0).removeListener("session_delete",this.onDisconnect),Hu(this,d0).removeListener("display_uri",this.onDisplayUri),Hu(this,d0).removeListener("connect",this.onConnect))};As=new WeakSet;x3=function(e){var u;(u=this.storage)==null||u.setItem(B_,e)};y2=new WeakSet;V8=function(){var e;return((e=this.storage)==null?void 0:e.getItem(B_))??[]};F2=new WeakSet;J8=function(){var n,r,i;if(!Hu(this,d0))return[];const e=(n=Hu(this,d0).session)==null?void 0:n.namespaces;return e?((i=(r=m_(e)[g_])==null?void 0:r.chains)==null?void 0:i.map(a=>parseInt(a.split(":")[1]||"")))??[]:[]};D2=new WeakSet;Y8=function(){var n,r;if(!Hu(this,d0))return[];const e=(n=Hu(this,d0).session)==null?void 0:n.namespaces;return e?((r=m_(e)[g_])==null?void 0:r.methods)??[]:[]};var k3,gs,d1u=class extends Hc{constructor({chains:e,options:u}){super({chains:e,options:{reloadOnDisconnect:!1,...u}}),this.id="coinbaseWallet",this.name="Coinbase Wallet",this.ready=!0,S0(this,k3,void 0),S0(this,gs,void 0),this.onAccountsChanged=t=>{t.length===0?this.emit("disconnect"):this.emit("change",{account:oe(t[0])})},this.onChainChanged=t=>{const n=qa(t),r=this.isChainUnsupported(n);this.emit("change",{chain:{id:n,unsupported:r}})},this.onDisconnect=()=>{this.emit("disconnect")}}async connect({chainId:e}={}){try{const u=await this.getProvider();u.on("accountsChanged",this.onAccountsChanged),u.on("chainChanged",this.onChainChanged),u.on("disconnect",this.onDisconnect),this.emit("message",{type:"connecting"});const t=await u.enable(),n=oe(t[0]);let r=await this.getChainId(),i=this.isChainUnsupported(r);return e&&r!==e&&(r=(await this.switchChain(e)).id,i=this.isChainUnsupported(r)),{account:n,chain:{id:r,unsupported:i}}}catch(u){throw/(user closed modal|accounts received is empty)/i.test(u.message)?new O0(u):u}}async disconnect(){if(!Hu(this,gs))return;const e=await this.getProvider();e.removeListener("accountsChanged",this.onAccountsChanged),e.removeListener("chainChanged",this.onChainChanged),e.removeListener("disconnect",this.onDisconnect),e.disconnect(),e.close()}async getAccount(){const u=await(await this.getProvider()).request({method:"eth_accounts"});return oe(u[0])}async getChainId(){const e=await this.getProvider();return qa(e.chainId)}async getProvider(){var e;if(!Hu(this,gs)){let u=(await Uu(()=>import("./index-e3f53129.js").then(a=>a.i),["assets/index-e3f53129.js","assets/events-18c74ae2.js","assets/hooks.module-408dc32d.js"])).default;typeof u!="function"&&typeof u.default=="function"&&(u=u.default),hr(this,k3,new u(this.options));const t=(e=Hu(this,k3).walletExtension)==null?void 0:e.getChainId(),n=this.chains.find(a=>this.options.chainId?a.id===this.options.chainId:a.id===t)||this.chains[0],r=this.options.chainId||(n==null?void 0:n.id),i=this.options.jsonRpcUrl||(n==null?void 0:n.rpcUrls.default.http[0]);hr(this,gs,Hu(this,k3).makeWeb3Provider(i,r))}return Hu(this,gs)}async getWalletClient({chainId:e}={}){const[u,t]=await Promise.all([this.getProvider(),this.getAccount()]),n=this.chains.find(r=>r.id===e);if(!u)throw new Error("provider is required.");return qc({account:t,chain:n,transport:$c(u)})}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}async switchChain(e){var n;const u=await this.getProvider(),t=Lu(e);try{return await u.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),this.chains.find(r=>r.id===e)??{id:e,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(r){const i=this.chains.find(a=>a.id===e);if(!i)throw new Kb({chainId:e,connectorId:this.id});if(r.code===4902)try{return await u.request({method:"wallet_addEthereumChain",params:[{chainId:t,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:[((n=i.rpcUrls.public)==null?void 0:n.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(i)}]}),i}catch(a){throw new O0(a)}throw new kn(r)}}async watchAsset({address:e,decimals:u=18,image:t,symbol:n}){return(await this.getProvider()).request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,decimals:u,image:t,symbol:n}}})}};k3=new WeakMap;gs=new WeakMap;var h9,f1u=class extends Co{constructor({chains:e,options:u}={}){const t={name:"MetaMask",shimDisconnect:!0,getProvider(){function n(i){if(i!=null&&i.isMetaMask&&!(i.isBraveWallet&&!i._events&&!i._state)&&!i.isApexWallet&&!i.isAvalanche&&!i.isBitKeep&&!i.isBlockWallet&&!i.isCoin98&&!i.isFordefi&&!i.isMathWallet&&!(i.isOkxWallet||i.isOKExWallet)&&!(i.isOneInchIOSWallet||i.isOneInchAndroidWallet)&&!i.isOpera&&!i.isPortal&&!i.isRabby&&!i.isDefiant&&!i.isTokenPocket&&!i.isTokenary&&!i.isZeal&&!i.isZerion)return i}if(typeof window>"u")return;const r=window.ethereum;return r!=null&&r.providers?r.providers.find(n):n(r)},...u};super({chains:e,options:t}),this.id="metaMask",this.shimDisconnectKey=`${this.id}.shimDisconnect`,S0(this,h9,void 0),hr(this,h9,t.UNSTABLE_shimOnConnectSelectAccount)}async connect({chainId:e}={}){var u,t,n,r;try{const i=await this.getProvider();if(!i)throw new ke;i.on&&(i.on("accountsChanged",this.onAccountsChanged),i.on("chainChanged",this.onChainChanged),i.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});let a=null;if(Hu(this,h9)&&((u=this.options)!=null&&u.shimDisconnect)&&!((t=this.storage)!=null&&t.getItem(this.shimDisconnectKey))&&(a=await this.getAccount().catch(()=>null),!!a))try{await i.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}),a=await this.getAccount()}catch(c){if(this.isUserRejectedRequestError(c))throw new O0(c);if(c.code===new Di(c).code)throw c}if(!a){const l=await i.request({method:"eth_requestAccounts"});a=oe(l[0])}let s=await this.getChainId(),o=this.isChainUnsupported(s);return e&&s!==e&&(s=(await this.switchChain(e)).id,o=this.isChainUnsupported(s)),(n=this.options)!=null&&n.shimDisconnect&&((r=this.storage)==null||r.setItem(this.shimDisconnectKey,!0)),{account:a,chain:{id:s,unsupported:o},provider:i}}catch(i){throw this.isUserRejectedRequestError(i)?new O0(i):i.code===-32002?new Di(i):i}}};h9=new WeakMap;var p1u=/(imtoken|metamask|rainbow|trust wallet|uniswap wallet|ledger)/i,$i,p5,v_,h1u=class extends Hc{constructor(){super(...arguments),S0(this,p5),this.id="walletConnectLegacy",this.name="WalletConnectLegacy",this.ready=!0,S0(this,$i,void 0),this.onAccountsChanged=e=>{e.length===0?this.emit("disconnect"):this.emit("change",{account:oe(e[0])})},this.onChainChanged=e=>{const u=qa(e),t=this.isChainUnsupported(u);this.emit("change",{chain:{id:u,unsupported:t}})},this.onDisconnect=()=>{this.emit("disconnect")}}async connect({chainId:e}={}){var u,t,n,r,i,a;try{let s=e;if(!s){const p=(u=this.storage)==null?void 0:u.getItem("store"),h=(r=(n=(t=p==null?void 0:p.state)==null?void 0:t.data)==null?void 0:n.chain)==null?void 0:r.id;h&&!this.isChainUnsupported(h)&&(s=h)}const o=await this.getProvider({chainId:s,create:!0});o.on("accountsChanged",this.onAccountsChanged),o.on("chainChanged",this.onChainChanged),o.on("disconnect",this.onDisconnect),setTimeout(()=>this.emit("message",{type:"connecting"}),0);const l=await o.enable(),c=oe(l[0]),E=await this.getChainId(),d=this.isChainUnsupported(E),f=((a=(i=o.connector)==null?void 0:i.peerMeta)==null?void 0:a.name)??"";return p1u.test(f)&&(this.switchChain=k0(this,p5,v_)),{account:c,chain:{id:E,unsupported:d}}}catch(s){throw/user closed modal/i.test(s.message)?new O0(s):s}}async disconnect(){const e=await this.getProvider();await e.disconnect(),e.removeListener("accountsChanged",this.onAccountsChanged),e.removeListener("chainChanged",this.onChainChanged),e.removeListener("disconnect",this.onDisconnect),typeof localStorage<"u"&&localStorage.removeItem("walletconnect")}async getAccount(){const u=(await this.getProvider()).accounts;return oe(u[0])}async getChainId(){const e=await this.getProvider();return qa(e.chainId)}async getProvider({chainId:e,create:u}={}){var t,n;if(!Hu(this,$i)||e||u){const r=(t=this.options)!=null&&t.infuraId?{}:this.chains.reduce((a,s)=>({...a,[s.id]:s.rpcUrls.default.http[0]}),{}),i=(await Uu(()=>import("./index-86e5536c.js"),["assets/index-86e5536c.js","assets/events-18c74ae2.js","assets/http-2c4dd3df.js","assets/hooks.module-408dc32d.js"])).default;hr(this,$i,new i({...this.options,chainId:e,rpc:{...r,...(n=this.options)==null?void 0:n.rpc}})),Hu(this,$i).http=await Hu(this,$i).setHttpProvider(e)}return Hu(this,$i)}async getWalletClient({chainId:e}={}){const[u,t]=await Promise.all([this.getProvider({chainId:e}),this.getAccount()]),n=this.chains.find(r=>r.id===e);if(!u)throw new Error("provider is required.");return qc({account:t,chain:n,transport:$c(u)})}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}};$i=new WeakMap;p5=new WeakSet;v_=async function(e){const u=await this.getProvider(),t=Lu(e);try{return await Promise.race([u.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),new Promise(n=>this.on("change",({chain:r})=>{(r==null?void 0:r.id)===e&&n(e)}))]),this.chains.find(n=>n.id===e)??{id:e,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(n){const r=typeof n=="string"?n:n==null?void 0:n.message;throw/user rejected request/i.test(r)?new O0(n):new kn(n)}};var _3,S3,C1u=class extends Hc{constructor({chains:e,options:u}){const t={shimDisconnect:!1,...u};super({chains:e,options:t}),this.id="safe",this.name="Safe",this.ready=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,S0(this,_3,void 0),S0(this,S3,void 0),this.shimDisconnectKey=`${this.id}.shimDisconnect`;let n=dE;typeof dE!="function"&&typeof dE.default=="function"&&(n=dE.default),hr(this,S3,new n(t))}async connect(){var n;const e=await this.getProvider();if(!e)throw new ke;e.on&&(e.on("accountsChanged",this.onAccountsChanged),e.on("chainChanged",this.onChainChanged),e.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});const u=await this.getAccount(),t=await this.getChainId();return this.options.shimDisconnect&&((n=this.storage)==null||n.setItem(this.shimDisconnectKey,!0)),{account:u,chain:{id:t,unsupported:this.isChainUnsupported(t)}}}async disconnect(){var u;const e=await this.getProvider();e!=null&&e.removeListener&&(e.removeListener("accountsChanged",this.onAccountsChanged),e.removeListener("chainChanged",this.onChainChanged),e.removeListener("disconnect",this.onDisconnect),this.options.shimDisconnect&&((u=this.storage)==null||u.removeItem(this.shimDisconnectKey)))}async getAccount(){const e=await this.getProvider();if(!e)throw new ke;const u=await e.request({method:"eth_accounts"});return oe(u[0])}async getChainId(){const e=await this.getProvider();if(!e)throw new ke;return qa(e.chainId)}async getProvider(){if(!Hu(this,_3)){const e=await Hu(this,S3).safe.getInfo();if(!e)throw new Error("Could not load Safe information");hr(this,_3,new FP(e,Hu(this,S3)))}return Hu(this,_3)}async getWalletClient({chainId:e}={}){const u=await this.getProvider(),t=await this.getAccount(),n=this.chains.find(r=>r.id===e);if(!u)throw new Error("provider is required.");return qc({account:t,chain:n,transport:$c(u)})}async isAuthorized(){var e;try{return this.options.shimDisconnect&&!((e=this.storage)!=null&&e.getItem(this.shimDisconnectKey))?!1:!!await this.getAccount()}catch{return!1}}onAccountsChanged(e){}onChainChanged(e){}onDisconnect(){this.emit("disconnect")}};_3=new WeakMap;S3=new WeakMap;function m1u(e){return Object.fromEntries(Object.entries(e).filter(([u,t])=>t!==void 0))}var A1u=e=>()=>{let u=-1;const t=[],n=[],r=[],i=[];return e.forEach(({groupName:s,wallets:o},l)=>{o.forEach(c=>{if(u++,c!=null&&c.iconAccent&&!zlu(c==null?void 0:c.iconAccent))throw new Error(`Property \`iconAccent\` is not a hex value for wallet: ${c.name}`);const E={...c,groupIndex:l,groupName:s,index:u};typeof c.hidden=="function"?r.push(E):n.push(E)})}),[...n,...r].forEach(({createConnector:s,groupIndex:o,groupName:l,hidden:c,index:E,...d})=>{if(typeof c=="function"&&c({wallets:[...i.map(({connector:m,id:B,installed:F,name:w})=>({connector:m,id:B,installed:F,name:w}))]}))return;const{connector:f,...p}=m1u(s());let h;if(d.id==="walletConnect"&&p.qrCode&&!J0()){const{chains:A,options:m}=f;h=new D_({chains:A,options:{...m,showQrModal:!0}}),t.push(h)}const g={connector:f,groupIndex:o,groupName:l,index:E,walletConnectModalConnector:h,...d,...p};i.push(g),t.includes(f)||(t.push(f),f._wallets=[]),f._wallets.push(g)}),t},g1u=({chains:e,...u})=>{var t;return{id:"brave",name:"Brave Wallet",iconUrl:async()=>(await Uu(()=>import("./braveWallet-BTBH4MDN-77ab02b2.js"),[])).default,iconBackground:"#fff",installed:typeof window<"u"&&((t=window.ethereum)==null?void 0:t.isBraveWallet)===!0,downloadUrls:{},createConnector:()=>({connector:new Co({chains:e,options:u})})}};function b_(e){if(typeof window>"u"||typeof window.ethereum>"u")return;const u=window.ethereum.providers;return u?u.find(t=>t[e]):window.ethereum[e]?window.ethereum:void 0}function w_(e){return!!b_(e)}function B1u(e){if(typeof window>"u"||typeof window.ethereum>"u")return;const u=window.ethereum.providers,t=b_(e);return t||(typeof u<"u"&&u.length>0?u[0]:window.ethereum)}function y1u({chains:e,flag:u,options:t}){return new Co({chains:e,options:{getProvider:()=>B1u(u),...t}})}var F1u=({appName:e,chains:u,...t})=>{const n=w_("isCoinbaseWallet");return{id:"coinbase",name:"Coinbase Wallet",shortName:"Coinbase",iconUrl:async()=>(await Uu(()=>import("./coinbaseWallet-2OUR5TUP-f6c629ff.js"),[])).default,iconAccent:"#2c5ff6",iconBackground:"#2c5ff6",installed:n||void 0,downloadUrls:{android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/us/app/coinbase-wallet-store-crypto/id1278383455",mobile:"https://coinbase.com/wallet/downloads",qrCode:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",browserExtension:"https://coinbase.com/wallet"},createConnector:()=>{const r=ns(),i=new d1u({chains:u,options:{appName:e,headlessMode:!0,...t}});return{connector:i,...r?{}:{qrCode:{getUri:async()=>(await i.getProvider()).qrUrl,instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-mobile",steps:[{description:"wallet_connectors.coinbase.qr_code.step1.description",step:"install",title:"wallet_connectors.coinbase.qr_code.step1.title"},{description:"wallet_connectors.coinbase.qr_code.step2.description",step:"create",title:"wallet_connectors.coinbase.qr_code.step2.title"},{description:"wallet_connectors.coinbase.qr_code.step3.description",step:"scan",title:"wallet_connectors.coinbase.qr_code.step3.title"}]}},extension:{instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-extension",steps:[{description:"wallet_connectors.coinbase.extension.step1.description",step:"install",title:"wallet_connectors.coinbase.extension.step1.title"},{description:"wallet_connectors.coinbase.extension.step2.description",step:"create",title:"wallet_connectors.coinbase.extension.step2.title"},{description:"wallet_connectors.coinbase.extension.step3.description",step:"refresh",title:"wallet_connectors.coinbase.extension.step3.title"}]}}}}}}},D1u=({chains:e,...u})=>({id:"injected",name:"Browser Wallet",iconUrl:async()=>(await Uu(()=>import("./injectedWallet-EUKDEAIU-b2513a2e.js"),[])).default,iconBackground:"#fff",hidden:({wallets:t})=>t.some(n=>n.installed&&n.name===n.connector.name&&(n.connector instanceof Co||n.id==="coinbase")),createConnector:()=>({connector:new Co({chains:e,options:u})})});async function Z8(e,u){const t=await e.getProvider();return u==="2"?new Promise(n=>t.once("display_uri",n)):t.connector.uri}var x_=new Map;function v1u(e,u){const t=e==="1"?new h1u(u):new D_(u);return x_.set(JSON.stringify(u),t),t}function v2({chains:e,options:u={},projectId:t,version:n="2"}){const r="21fef48091f12692cad574a6f7753643";if(n==="2"){if(!t||t==="")throw new Error("No projectId found. Every dApp must now provide a WalletConnect Cloud projectId to enable WalletConnect v2 https://www.rainbowkit.com/docs/installation#configure");(t==="YOUR_PROJECT_ID"||t===r)&&console.warn("Invalid projectId. Please create a unique WalletConnect Cloud projectId for your dApp https://www.rainbowkit.com/docs/installation#configure")}const i={chains:e,options:n==="1"?{qrcode:!1,...u}:{projectId:t==="YOUR_PROJECT_ID"?r:t,showQrModal:!1,...u}},a=JSON.stringify(i),s=x_.get(a);return s??v1u(n,i)}function NB(e){return!(!(e!=null&&e.isMetaMask)||e.isBraveWallet&&!e._events&&!e._state||e.isApexWallet||e.isAvalanche||e.isBackpack||e.isBifrost||e.isBitKeep||e.isBitski||e.isBlockWallet||e.isCoinbaseWallet||e.isDawn||e.isEnkrypt||e.isExodus||e.isFrame||e.isFrontier||e.isGamestop||e.isHyperPay||e.isImToken||e.isKuCoinWallet||e.isMathWallet||e.isOkxWallet||e.isOKExWallet||e.isOneInchIOSWallet||e.isOneInchAndroidWallet||e.isOpera||e.isPhantom||e.isPortal||e.isRabby||e.isRainbow||e.isStatus||e.isTalisman||e.isTally||e.isTokenPocket||e.isTokenary||e.isTrust||e.isTrustWallet||e.isXDEFI||e.isZeal||e.isZerion)}var b1u=({chains:e,projectId:u,walletConnectOptions:t,walletConnectVersion:n="2",...r})=>{var i,a;const s=typeof window<"u"&&((i=window.ethereum)==null?void 0:i.providers),o=typeof window<"u"&&typeof window.ethereum<"u"&&(((a=window.ethereum.providers)==null?void 0:a.some(NB))||window.ethereum.isMetaMask),l=!o;return{id:"metaMask",name:"MetaMask",iconUrl:async()=>(await Uu(()=>import("./metaMaskWallet-ORHUNQRP-ac2ea8b3.js"),[])).default,iconAccent:"#f6851a",iconBackground:"#fff",installed:l?void 0:o,downloadUrls:{android:"https://play.google.com/store/apps/details?id=io.metamask",ios:"https://apps.apple.com/us/app/metamask/id1438144202",mobile:"https://metamask.io/download",qrCode:"https://metamask.io/download",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",edge:"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm",firefox:"https://addons.mozilla.org/firefox/addon/ether-metamask",opera:"https://addons.opera.com/extensions/details/metamask-10",browserExtension:"https://metamask.io/download"},createConnector:()=>{const c=l?v2({projectId:u,chains:e,version:n,options:t}):new f1u({chains:e,options:{getProvider:()=>s?s.find(NB):typeof window<"u"?window.ethereum:void 0,...r}}),E=async()=>{const d=await Z8(c,n);return F8()?d:ns()?`metamask://wc?uri=${encodeURIComponent(d)}`:`https://metamask.app.link/wc?uri=${encodeURIComponent(d)}`};return{connector:c,mobile:{getUri:l?E:void 0},qrCode:l?{getUri:E,instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.qr_code.step1.description",step:"install",title:"wallet_connectors.metamask.qr_code.step1.title"},{description:"wallet_connectors.metamask.qr_code.step2.description",step:"create",title:"wallet_connectors.metamask.qr_code.step2.title"},{description:"wallet_connectors.metamask.qr_code.step3.description",step:"refresh",title:"wallet_connectors.metamask.qr_code.step3.title"}]}}:void 0,extension:{instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.extension.step1.description",step:"install",title:"wallet_connectors.metamask.extension.step1.title"},{description:"wallet_connectors.metamask.extension.step2.description",step:"create",title:"wallet_connectors.metamask.extension.step2.title"},{description:"wallet_connectors.metamask.extension.step3.description",step:"refresh",title:"wallet_connectors.metamask.extension.step3.title"}]}}}}}},w1u=({chains:e,projectId:u,walletConnectOptions:t,walletConnectVersion:n="2",...r})=>{const i=w_("isRainbow"),a=!i;return{id:"rainbow",name:"Rainbow",iconUrl:async()=>(await Uu(()=>import("./rainbowWallet-GGU64QEI-80e56a37.js"),[])).default,iconBackground:"#0c2f78",installed:a?void 0:i,downloadUrls:{android:"https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Drainbowkit&utm_source=rainbowkit",ios:"https://apps.apple.com/app/apple-store/id1457119021?pt=119997837&ct=rainbowkit&mt=8",mobile:"https://rainbow.download?utm_source=rainbowkit",qrCode:"https://rainbow.download?utm_source=rainbowkit&utm_medium=qrcode",browserExtension:"https://rainbow.me/extension?utm_source=rainbowkit"},createConnector:()=>{const s=a?v2({projectId:u,chains:e,version:n,options:t}):y1u({flag:"isRainbow",chains:e,options:r}),o=async()=>{const l=await Z8(s,n);return F8()?l:ns()?`rainbow://wc?uri=${encodeURIComponent(l)}&connector=rainbowkit`:`https://rnbwapp.com/wc?uri=${encodeURIComponent(l)}&connector=rainbowkit`};return{connector:s,mobile:{getUri:a?o:void 0},qrCode:a?{getUri:o,instructions:{learnMoreUrl:"https://learn.rainbow.me/connect-to-a-website-or-app?utm_source=rainbowkit&utm_medium=connector&utm_campaign=learnmore",steps:[{description:"wallet_connectors.rainbow.qr_code.step1.description",step:"install",title:"wallet_connectors.rainbow.qr_code.step1.title"},{description:"wallet_connectors.rainbow.qr_code.step2.description",step:"create",title:"wallet_connectors.rainbow.qr_code.step2.title"},{description:"wallet_connectors.rainbow.qr_code.step3.description",step:"scan",title:"wallet_connectors.rainbow.qr_code.step3.title"}]}}:void 0}}}},x1u=({chains:e,...u})=>({id:"safe",name:"Safe",iconAccent:"#12ff80",iconBackground:"#fff",iconUrl:async()=>(await Uu(()=>import("./safeWallet-DFMLSLCR-bb33abc9.js"),[])).default,installed:!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,downloadUrls:{},createConnector:()=>({connector:new C1u({chains:e,options:u})})}),k1u=({chains:e,options:u,projectId:t,version:n="2"})=>({id:"walletConnect",name:"WalletConnect",iconUrl:async()=>(await Uu(()=>import("./walletConnectWallet-D6ZADJM7-c1d5c644.js"),[])).default,iconBackground:"#3b99fc",createConnector:()=>{const r=ns(),i=v2(n==="1"?{version:"1",chains:e,options:{qrcode:r,...u}}:{version:"2",chains:e,projectId:t,options:{showQrModal:r,...u}}),a=async()=>Z8(i,n);return{connector:i,...r?{}:{mobile:{getUri:a},qrCode:{getUri:a}}}}}),_1u=({appName:e,chains:u,projectId:t})=>{const n=[{groupName:"Popular",wallets:[D1u({chains:u}),x1u({chains:u}),w1u({chains:u,projectId:t}),F1u({appName:e,chains:u}),b1u({chains:u,projectId:t}),k1u({chains:u,projectId:t}),g1u({chains:u})]}];return{connectors:A1u(n),wallets:n}};var oE=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},bo=typeof window>"u"||"Deno"in window;function mt(){}function S1u(e,u){return typeof e=="function"?e(u):e}function h5(e){return typeof e=="number"&&e>=0&&e!==1/0}function k_(e,u){return Math.max(e+(u||0)-Date.now(),0)}function RB(e,u){const{type:t="all",exact:n,fetchStatus:r,predicate:i,queryKey:a,stale:s}=e;if(a){if(n){if(u.queryHash!==X8(a,u.options))return!1}else if(!ql(u.queryKey,a))return!1}if(t!=="all"){const o=u.isActive();if(t==="active"&&!o||t==="inactive"&&o)return!1}return!(typeof s=="boolean"&&u.isStale()!==s||typeof r<"u"&&r!==u.state.fetchStatus||i&&!i(u))}function zB(e,u){const{exact:t,status:n,predicate:r,mutationKey:i}=e;if(i){if(!u.options.mutationKey)return!1;if(t){if(Wl(u.options.mutationKey)!==Wl(i))return!1}else if(!ql(u.options.mutationKey,i))return!1}return!(n&&u.state.status!==n||r&&!r(u))}function X8(e,u){return((u==null?void 0:u.queryKeyHashFn)||Wl)(e)}function Wl(e){return JSON.stringify(e,(u,t)=>m5(t)?Object.keys(t).sort().reduce((n,r)=>(n[r]=t[r],n),{}):t)}function ql(e,u){return e===u?!0:typeof e!=typeof u?!1:e&&u&&typeof e=="object"&&typeof u=="object"?!Object.keys(u).some(t=>!ql(e[t],u[t])):!1}function __(e,u){if(e===u)return e;const t=jB(e)&&jB(u);if(t||m5(e)&&m5(u)){const n=t?e.length:Object.keys(e).length,r=t?u:Object.keys(u),i=r.length,a=t?[]:{};let s=0;for(let o=0;o"u")return!0;const t=u.prototype;return!(!MB(t)||!t.hasOwnProperty("isPrototypeOf"))}function MB(e){return Object.prototype.toString.call(e)==="[object Object]"}function S_(e){return new Promise(u=>{setTimeout(u,e)})}function LB(e){S_(0).then(e)}function A5(e,u,t){return typeof t.structuralSharing=="function"?t.structuralSharing(e,u):t.structuralSharing!==!1?__(e,u):u}function P1u(e,u,t=0){const n=[...e,u];return t&&n.length>t?n.slice(1):n}function T1u(e,u,t=0){const n=[u,...e];return t&&n.length>t?n.slice(0,-1):n}var ea,Mr,e4,Vy,O1u=(Vy=class extends oE{constructor(){super();q(this,ea,void 0);q(this,Mr,void 0);q(this,e4,void 0);T(this,e4,u=>{if(!bo&&window.addEventListener){const t=()=>u();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){b(this,Mr)||this.setEventListener(b(this,e4))}onUnsubscribe(){var u;this.hasListeners()||((u=b(this,Mr))==null||u.call(this),T(this,Mr,void 0))}setEventListener(u){var t;T(this,e4,u),(t=b(this,Mr))==null||t.call(this),T(this,Mr,u(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(u){b(this,ea)!==u&&(T(this,ea,u),this.onFocus())}onFocus(){this.listeners.forEach(u=>{u()})}isFocused(){var u;return typeof b(this,ea)=="boolean"?b(this,ea):((u=globalThis.document)==null?void 0:u.visibilityState)!=="hidden"}},ea=new WeakMap,Mr=new WeakMap,e4=new WeakMap,Vy),b2=new O1u,t4,Lr,n4,Jy,I1u=(Jy=class extends oE{constructor(){super();q(this,t4,!0);q(this,Lr,void 0);q(this,n4,void 0);T(this,n4,u=>{if(!bo&&window.addEventListener){const t=()=>u(!0),n=()=>u(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}})}onSubscribe(){b(this,Lr)||this.setEventListener(b(this,n4))}onUnsubscribe(){var u;this.hasListeners()||((u=b(this,Lr))==null||u.call(this),T(this,Lr,void 0))}setEventListener(u){var t;T(this,n4,u),(t=b(this,Lr))==null||t.call(this),T(this,Lr,u(this.setOnline.bind(this)))}setOnline(u){b(this,t4)!==u&&(T(this,t4,u),this.listeners.forEach(n=>{n(u)}))}isOnline(){return b(this,t4)}},t4=new WeakMap,Lr=new WeakMap,n4=new WeakMap,Jy),w2=new I1u;function N1u(e){return Math.min(1e3*2**e,3e4)}function gd(e){return(e??"online")==="online"?w2.isOnline():!0}var P_=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function V6(e){return e instanceof P_}function T_(e){let u=!1,t=0,n=!1,r,i,a;const s=new Promise((g,A)=>{i=g,a=A}),o=g=>{var A;n||(f(new P_(g)),(A=e.abort)==null||A.call(e))},l=()=>{u=!0},c=()=>{u=!1},E=()=>!b2.isFocused()||e.networkMode!=="always"&&!w2.isOnline(),d=g=>{var A;n||(n=!0,(A=e.onSuccess)==null||A.call(e,g),r==null||r(),i(g))},f=g=>{var A;n||(n=!0,(A=e.onError)==null||A.call(e,g),r==null||r(),a(g))},p=()=>new Promise(g=>{var A;r=m=>{const B=n||!E();return B&&g(m),B},(A=e.onPause)==null||A.call(e)}).then(()=>{var g;r=void 0,n||(g=e.onContinue)==null||g.call(e)}),h=()=>{if(n)return;let g;try{g=e.fn()}catch(A){g=Promise.reject(A)}Promise.resolve(g).then(d).catch(A=>{var v;if(n)return;const m=e.retry??(bo?0:3),B=e.retryDelay??N1u,F=typeof B=="function"?B(t,A):B,w=m===!0||typeof m=="number"&&t{if(E())return p()}).then(()=>{u?f(A):h()})})};return gd(e.networkMode)?h():p().then(h),{promise:s,cancel:o,continue:()=>(r==null?void 0:r())?s:Promise.resolve(),cancelRetry:l,continueRetry:c}}function R1u(){let e=[],u=0,t=c=>{c()},n=c=>{c()};const r=c=>{let E;u++;try{E=c()}finally{u--,u||s()}return E},i=c=>{u?e.push(c):LB(()=>{t(c)})},a=c=>(...E)=>{i(()=>{c(...E)})},s=()=>{const c=e;e=[],c.length&&LB(()=>{n(()=>{c.forEach(E=>{t(E)})})})};return{batch:r,batchCalls:a,schedule:i,setNotifyFunction:c=>{t=c},setBatchNotifyFunction:c=>{n=c}}}var G0=R1u(),ta,Yy,O_=(Yy=class{constructor(){q(this,ta,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),h5(this.gcTime)&&T(this,ta,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bo?1/0:5*60*1e3))}clearGcTimeout(){b(this,ta)&&(clearTimeout(b(this,ta)),T(this,ta,void 0))}},ta=new WeakMap,Yy),r4,i4,ot,Ur,lt,z0,uc,na,a4,C9,zt,On,Zy,z1u=(Zy=class extends O_{constructor(u){super();q(this,a4);q(this,zt);q(this,r4,void 0);q(this,i4,void 0);q(this,ot,void 0);q(this,Ur,void 0);q(this,lt,void 0);q(this,z0,void 0);q(this,uc,void 0);q(this,na,void 0);T(this,na,!1),T(this,uc,u.defaultOptions),cu(this,a4,C9).call(this,u.options),T(this,z0,[]),T(this,ot,u.cache),this.queryKey=u.queryKey,this.queryHash=u.queryHash,T(this,r4,u.state||j1u(this.options)),this.state=b(this,r4),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!b(this,z0).length&&this.state.fetchStatus==="idle"&&b(this,ot).remove(this)}setData(u,t){const n=A5(this.state.data,u,this.options);return cu(this,zt,On).call(this,{data:n,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),n}setState(u,t){cu(this,zt,On).call(this,{type:"setState",state:u,setStateOptions:t})}cancel(u){var n;const t=b(this,Ur);return(n=b(this,lt))==null||n.cancel(u),t?t.then(mt).catch(mt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(b(this,r4))}isActive(){return b(this,z0).some(u=>u.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||b(this,z0).some(u=>u.getCurrentResult().isStale)}isStaleByTime(u=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!k_(this.state.dataUpdatedAt,u)}onFocus(){var t;const u=b(this,z0).find(n=>n.shouldFetchOnWindowFocus());u==null||u.refetch({cancelRefetch:!1}),(t=b(this,lt))==null||t.continue()}onOnline(){var t;const u=b(this,z0).find(n=>n.shouldFetchOnReconnect());u==null||u.refetch({cancelRefetch:!1}),(t=b(this,lt))==null||t.continue()}addObserver(u){b(this,z0).includes(u)||(b(this,z0).push(u),this.clearGcTimeout(),b(this,ot).notify({type:"observerAdded",query:this,observer:u}))}removeObserver(u){b(this,z0).includes(u)&&(T(this,z0,b(this,z0).filter(t=>t!==u)),b(this,z0).length||(b(this,lt)&&(b(this,na)?b(this,lt).cancel({revert:!0}):b(this,lt).cancelRetry()),this.scheduleGc()),b(this,ot).notify({type:"observerRemoved",query:this,observer:u}))}getObserversCount(){return b(this,z0).length}invalidate(){this.state.isInvalidated||cu(this,zt,On).call(this,{type:"invalidate"})}fetch(u,t){var l,c,E,d;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(b(this,Ur))return(l=b(this,lt))==null||l.continueRetry(),b(this,Ur)}if(u&&cu(this,a4,C9).call(this,u),!this.options.queryFn){const f=b(this,z0).find(p=>p.options.queryFn);f&&cu(this,a4,C9).call(this,f.options)}const n=new AbortController,r={queryKey:this.queryKey,meta:this.meta},i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(T(this,na,!0),n.signal)})};i(r);const a=()=>this.options.queryFn?(T(this,na,!1),this.options.persister?this.options.persister(this.options.queryFn,r,this):this.options.queryFn(r)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),s={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:a};i(s),(c=this.options.behavior)==null||c.onFetch(s,this),T(this,i4,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((E=s.fetchOptions)==null?void 0:E.meta))&&cu(this,zt,On).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const o=f=>{var p,h,g,A;V6(f)&&f.silent||cu(this,zt,On).call(this,{type:"error",error:f}),V6(f)||((h=(p=b(this,ot).config).onError)==null||h.call(p,f,this),(A=(g=b(this,ot).config).onSettled)==null||A.call(g,this.state.data,f,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return T(this,lt,T_({fn:s.fetchFn,abort:n.abort.bind(n),onSuccess:f=>{var p,h,g,A;if(typeof f>"u"){o(new Error(`${this.queryHash} data is undefined`));return}this.setData(f),(h=(p=b(this,ot).config).onSuccess)==null||h.call(p,f,this),(A=(g=b(this,ot).config).onSettled)==null||A.call(g,f,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:o,onFail:(f,p)=>{cu(this,zt,On).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{cu(this,zt,On).call(this,{type:"pause"})},onContinue:()=>{cu(this,zt,On).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode})),T(this,Ur,b(this,lt).promise),b(this,Ur)}},r4=new WeakMap,i4=new WeakMap,ot=new WeakMap,Ur=new WeakMap,lt=new WeakMap,z0=new WeakMap,uc=new WeakMap,na=new WeakMap,a4=new WeakSet,C9=function(u){this.options={...b(this,uc),...u},this.updateGcTime(this.options.gcTime)},zt=new WeakSet,On=function(u){const t=n=>{switch(u.type){case"failed":return{...n,fetchFailureCount:u.failureCount,fetchFailureReason:u.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:u.meta??null,fetchStatus:gd(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...n,data:u.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:u.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!u.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=u.error;return V6(r)&&r.revert&&b(this,i4)?{...b(this,i4),fetchStatus:"idle"}:{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...u.state}}};this.state=t(this.state),G0.batch(()=>{b(this,z0).forEach(n=>{n.onQueryUpdate()}),b(this,ot).notify({query:this,type:"updated",action:u})})},Zy);function j1u(e){const u=typeof e.initialData=="function"?e.initialData():e.initialData,t=typeof u<"u",n=t?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:u,dataUpdateCount:0,dataUpdatedAt:t?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var ln,Xy,M1u=(Xy=class extends oE{constructor(u={}){super();q(this,ln,void 0);this.config=u,T(this,ln,new Map)}build(u,t,n){const r=t.queryKey,i=t.queryHash??X8(r,t);let a=this.get(i);return a||(a=new z1u({cache:this,queryKey:r,queryHash:i,options:u.defaultQueryOptions(t),state:n,defaultOptions:u.getQueryDefaults(r)}),this.add(a)),a}add(u){b(this,ln).has(u.queryHash)||(b(this,ln).set(u.queryHash,u),this.notify({type:"added",query:u}))}remove(u){const t=b(this,ln).get(u.queryHash);t&&(u.destroy(),t===u&&b(this,ln).delete(u.queryHash),this.notify({type:"removed",query:u}))}clear(){G0.batch(()=>{this.getAll().forEach(u=>{this.remove(u)})})}get(u){return b(this,ln).get(u)}getAll(){return[...b(this,ln).values()]}find(u){const t={exact:!0,...u};return this.getAll().find(n=>RB(t,n))}findAll(u={}){const t=this.getAll();return Object.keys(u).length>0?t.filter(n=>RB(u,n)):t}notify(u){G0.batch(()=>{this.listeners.forEach(t=>{t(u)})})}onFocus(){G0.batch(()=>{this.getAll().forEach(u=>{u.onFocus()})})}onOnline(){G0.batch(()=>{this.getAll().forEach(u=>{u.onOnline()})})}},ln=new WeakMap,Xy),cn,ec,$e,s4,En,Pr,uF,L1u=(uF=class extends O_{constructor(u){super();q(this,En);q(this,cn,void 0);q(this,ec,void 0);q(this,$e,void 0);q(this,s4,void 0);this.mutationId=u.mutationId,T(this,ec,u.defaultOptions),T(this,$e,u.mutationCache),T(this,cn,[]),this.state=u.state||U1u(),this.setOptions(u.options),this.scheduleGc()}setOptions(u){this.options={...b(this,ec),...u},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(u){b(this,cn).includes(u)||(b(this,cn).push(u),this.clearGcTimeout(),b(this,$e).notify({type:"observerAdded",mutation:this,observer:u}))}removeObserver(u){T(this,cn,b(this,cn).filter(t=>t!==u)),this.scheduleGc(),b(this,$e).notify({type:"observerRemoved",mutation:this,observer:u})}optionalRemove(){b(this,cn).length||(this.state.status==="pending"?this.scheduleGc():b(this,$e).remove(this))}continue(){var u;return((u=b(this,s4))==null?void 0:u.continue())??this.execute(this.state.variables)}async execute(u){var r,i,a,s,o,l,c,E,d,f,p,h,g,A,m,B,F,w,v,C;const t=()=>(T(this,s4,T_({fn:()=>this.options.mutationFn?this.options.mutationFn(u):Promise.reject(new Error("No mutationFn found")),onFail:(k,j)=>{cu(this,En,Pr).call(this,{type:"failed",failureCount:k,error:j})},onPause:()=>{cu(this,En,Pr).call(this,{type:"pause"})},onContinue:()=>{cu(this,En,Pr).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),b(this,s4).promise),n=this.state.status==="pending";try{if(!n){cu(this,En,Pr).call(this,{type:"pending",variables:u}),await((i=(r=b(this,$e).config).onMutate)==null?void 0:i.call(r,u,this));const j=await((s=(a=this.options).onMutate)==null?void 0:s.call(a,u));j!==this.state.context&&cu(this,En,Pr).call(this,{type:"pending",context:j,variables:u})}const k=await t();return await((l=(o=b(this,$e).config).onSuccess)==null?void 0:l.call(o,k,u,this.state.context,this)),await((E=(c=this.options).onSuccess)==null?void 0:E.call(c,k,u,this.state.context)),await((f=(d=b(this,$e).config).onSettled)==null?void 0:f.call(d,k,null,this.state.variables,this.state.context,this)),await((h=(p=this.options).onSettled)==null?void 0:h.call(p,k,null,u,this.state.context)),cu(this,En,Pr).call(this,{type:"success",data:k}),k}catch(k){try{throw await((A=(g=b(this,$e).config).onError)==null?void 0:A.call(g,k,u,this.state.context,this)),await((B=(m=this.options).onError)==null?void 0:B.call(m,k,u,this.state.context)),await((w=(F=b(this,$e).config).onSettled)==null?void 0:w.call(F,void 0,k,this.state.variables,this.state.context,this)),await((C=(v=this.options).onSettled)==null?void 0:C.call(v,void 0,k,u,this.state.context)),k}finally{cu(this,En,Pr).call(this,{type:"error",error:k})}}}},cn=new WeakMap,ec=new WeakMap,$e=new WeakMap,s4=new WeakMap,En=new WeakSet,Pr=function(u){const t=n=>{switch(u.type){case"failed":return{...n,failureCount:u.failureCount,failureReason:u.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:u.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!gd(this.options.networkMode),status:"pending",variables:u.variables,submittedAt:Date.now()};case"success":return{...n,data:u.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:u.error,failureCount:n.failureCount+1,failureReason:u.error,isPaused:!1,status:"error"}}};this.state=t(this.state),G0.batch(()=>{b(this,cn).forEach(n=>{n.onMutationUpdate(u)}),b(this,$e).notify({mutation:this,type:"updated",action:u})})},uF);function U1u(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ct,tc,ra,eF,$1u=(eF=class extends oE{constructor(u={}){super();q(this,ct,void 0);q(this,tc,void 0);q(this,ra,void 0);this.config=u,T(this,ct,[]),T(this,tc,0)}build(u,t,n){const r=new L1u({mutationCache:this,mutationId:++br(this,tc)._,options:u.defaultMutationOptions(t),state:n});return this.add(r),r}add(u){b(this,ct).push(u),this.notify({type:"added",mutation:u})}remove(u){T(this,ct,b(this,ct).filter(t=>t!==u)),this.notify({type:"removed",mutation:u})}clear(){G0.batch(()=>{b(this,ct).forEach(u=>{this.remove(u)})})}getAll(){return b(this,ct)}find(u){const t={exact:!0,...u};return b(this,ct).find(n=>zB(t,n))}findAll(u={}){return b(this,ct).filter(t=>zB(u,t))}notify(u){G0.batch(()=>{this.listeners.forEach(t=>{t(u)})})}resumePausedMutations(){return T(this,ra,(b(this,ra)??Promise.resolve()).then(()=>{const u=b(this,ct).filter(t=>t.state.isPaused);return G0.batch(()=>u.reduce((t,n)=>t.then(()=>n.continue().catch(mt)),Promise.resolve()))}).then(()=>{T(this,ra,void 0)})),b(this,ra)}},ct=new WeakMap,tc=new WeakMap,ra=new WeakMap,eF);function W1u(e){return{onFetch:(u,t)=>{const n=async()=>{var p,h,g,A,m;const r=u.options,i=(g=(h=(p=u.fetchOptions)==null?void 0:p.meta)==null?void 0:h.fetchMore)==null?void 0:g.direction,a=((A=u.state.data)==null?void 0:A.pages)||[],s=((m=u.state.data)==null?void 0:m.pageParams)||[],o={pages:[],pageParams:[]};let l=!1;const c=B=>{Object.defineProperty(B,"signal",{enumerable:!0,get:()=>(u.signal.aborted?l=!0:u.signal.addEventListener("abort",()=>{l=!0}),u.signal)})},E=u.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${u.options.queryHash}'`))),d=async(B,F,w)=>{if(l)return Promise.reject();if(F==null&&B.pages.length)return Promise.resolve(B);const v={queryKey:u.queryKey,pageParam:F,direction:w?"backward":"forward",meta:u.options.meta};c(v);const C=await E(v),{maxPages:k}=u.options,j=w?T1u:P1u;return{pages:j(B.pages,C,k),pageParams:j(B.pageParams,F,k)}};let f;if(i&&a.length){const B=i==="backward",F=B?q1u:UB,w={pages:a,pageParams:s},v=F(r,w);f=await d(w,v,B)}else{f=await d(o,s[0]??r.initialPageParam);const B=e??a.length;for(let F=1;F{var r,i;return(i=(r=u.options).persister)==null?void 0:i.call(r,n,{queryKey:u.queryKey,meta:u.options.meta,signal:u.signal},t)}:u.fetchFn=n}}}function UB(e,{pages:u,pageParams:t}){const n=u.length-1;return e.getNextPageParam(u[n],u,t[n],t)}function q1u(e,{pages:u,pageParams:t}){var n;return(n=e.getPreviousPageParam)==null?void 0:n.call(e,u[0],u,t[0],t)}var x0,$r,Wr,o4,l4,qr,c4,E4,tF,H1u=(tF=class{constructor(e={}){q(this,x0,void 0);q(this,$r,void 0);q(this,Wr,void 0);q(this,o4,void 0);q(this,l4,void 0);q(this,qr,void 0);q(this,c4,void 0);q(this,E4,void 0);T(this,x0,e.queryCache||new M1u),T(this,$r,e.mutationCache||new $1u),T(this,Wr,e.defaultOptions||{}),T(this,o4,new Map),T(this,l4,new Map),T(this,qr,0)}mount(){br(this,qr)._++,b(this,qr)===1&&(T(this,c4,b2.subscribe(()=>{b2.isFocused()&&(this.resumePausedMutations(),b(this,x0).onFocus())})),T(this,E4,w2.subscribe(()=>{w2.isOnline()&&(this.resumePausedMutations(),b(this,x0).onOnline())})))}unmount(){var e,u;br(this,qr)._--,b(this,qr)===0&&((e=b(this,c4))==null||e.call(this),T(this,c4,void 0),(u=b(this,E4))==null||u.call(this),T(this,E4,void 0))}isFetching(e){return b(this,x0).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return b(this,$r).findAll({...e,status:"pending"}).length}getQueryData(e){var u;return(u=b(this,x0).find({queryKey:e}))==null?void 0:u.state.data}ensureQueryData(e){const u=this.getQueryData(e.queryKey);return u!==void 0?Promise.resolve(u):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:u,state:t})=>{const n=t.data;return[u,n]})}setQueryData(e,u,t){const n=b(this,x0).find({queryKey:e}),r=n==null?void 0:n.state.data,i=S1u(u,r);if(typeof i>"u")return;const a=this.defaultQueryOptions({queryKey:e});return b(this,x0).build(this,a).setData(i,{...t,manual:!0})}setQueriesData(e,u,t){return G0.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,u,t)]))}getQueryState(e){var u;return(u=b(this,x0).find({queryKey:e}))==null?void 0:u.state}removeQueries(e){const u=b(this,x0);G0.batch(()=>{u.findAll(e).forEach(t=>{u.remove(t)})})}resetQueries(e,u){const t=b(this,x0),n={type:"active",...e};return G0.batch(()=>(t.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries(n,u)))}cancelQueries(e={},u={}){const t={revert:!0,...u},n=G0.batch(()=>b(this,x0).findAll(e).map(r=>r.cancel(t)));return Promise.all(n).then(mt).catch(mt)}invalidateQueries(e={},u={}){return G0.batch(()=>{if(b(this,x0).findAll(e).forEach(n=>{n.invalidate()}),e.refetchType==="none")return Promise.resolve();const t={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(t,u)})}refetchQueries(e={},u){const t={...u,cancelRefetch:(u==null?void 0:u.cancelRefetch)??!0},n=G0.batch(()=>b(this,x0).findAll(e).filter(r=>!r.isDisabled()).map(r=>{let i=r.fetch(void 0,t);return t.throwOnError||(i=i.catch(mt)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(mt)}fetchQuery(e){const u=this.defaultQueryOptions(e);typeof u.retry>"u"&&(u.retry=!1);const t=b(this,x0).build(this,u);return t.isStaleByTime(u.staleTime)?t.fetch(u):Promise.resolve(t.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(mt).catch(mt)}fetchInfiniteQuery(e){return e.behavior=W1u(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(mt).catch(mt)}resumePausedMutations(){return b(this,$r).resumePausedMutations()}getQueryCache(){return b(this,x0)}getMutationCache(){return b(this,$r)}getDefaultOptions(){return b(this,Wr)}setDefaultOptions(e){T(this,Wr,e)}setQueryDefaults(e,u){b(this,o4).set(Wl(e),{queryKey:e,defaultOptions:u})}getQueryDefaults(e){const u=[...b(this,o4).values()];let t={};return u.forEach(n=>{ql(e,n.queryKey)&&(t={...t,...n.defaultOptions})}),t}setMutationDefaults(e,u){b(this,l4).set(Wl(e),{mutationKey:e,defaultOptions:u})}getMutationDefaults(e){const u=[...b(this,l4).values()];let t={};return u.forEach(n=>{ql(e,n.mutationKey)&&(t={...t,...n.defaultOptions})}),t}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const u={...b(this,Wr).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return u.queryHash||(u.queryHash=X8(u.queryKey,u)),typeof u.refetchOnReconnect>"u"&&(u.refetchOnReconnect=u.networkMode!=="always"),typeof u.throwOnError>"u"&&(u.throwOnError=!!u.suspense),typeof u.networkMode>"u"&&u.persister&&(u.networkMode="offlineFirst"),u}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...b(this,Wr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){b(this,x0).clear(),b(this,$r).clear()}},x0=new WeakMap,$r=new WeakMap,Wr=new WeakMap,o4=new WeakMap,l4=new WeakMap,qr=new WeakMap,c4=new WeakMap,E4=new WeakMap,tF),De,n0,d4,ee,ia,f4,dn,nc,p4,h4,aa,sa,Hr,oa,la,P3,rc,g5,ic,B5,ac,y5,sc,F5,oc,D5,lc,v5,cc,b5,z2,I_,nF,G1u=(nF=class extends oE{constructor(u,t){super();q(this,la);q(this,rc);q(this,ic);q(this,ac);q(this,sc);q(this,oc);q(this,lc);q(this,cc);q(this,z2);q(this,De,void 0);q(this,n0,void 0);q(this,d4,void 0);q(this,ee,void 0);q(this,ia,void 0);q(this,f4,void 0);q(this,dn,void 0);q(this,nc,void 0);q(this,p4,void 0);q(this,h4,void 0);q(this,aa,void 0);q(this,sa,void 0);q(this,Hr,void 0);q(this,oa,void 0);T(this,n0,void 0),T(this,d4,void 0),T(this,ee,void 0),T(this,oa,new Set),T(this,De,u),this.options=t,T(this,dn,null),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(b(this,n0).addObserver(this),$B(b(this,n0),this.options)?cu(this,la,P3).call(this):this.updateResult(),cu(this,sc,F5).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w5(b(this,n0),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w5(b(this,n0),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,cu(this,oc,D5).call(this),cu(this,lc,v5).call(this),b(this,n0).removeObserver(this)}setOptions(u,t){const n=this.options,r=b(this,n0);if(this.options=b(this,De).defaultQueryOptions(u),C5(n,this.options)||b(this,De).getQueryCache().notify({type:"observerOptionsUpdated",query:b(this,n0),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=n.queryKey),cu(this,cc,b5).call(this);const i=this.hasListeners();i&&WB(b(this,n0),r,this.options,n)&&cu(this,la,P3).call(this),this.updateResult(t),i&&(b(this,n0)!==r||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&cu(this,rc,g5).call(this);const a=cu(this,ic,B5).call(this);i&&(b(this,n0)!==r||this.options.enabled!==n.enabled||a!==b(this,Hr))&&cu(this,ac,y5).call(this,a)}getOptimisticResult(u){const t=b(this,De).getQueryCache().build(b(this,De),u),n=this.createResult(t,u);return K1u(this,n)&&(T(this,ee,n),T(this,f4,this.options),T(this,ia,b(this,n0).state)),n}getCurrentResult(){return b(this,ee)}trackResult(u){const t={};return Object.keys(u).forEach(n=>{Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:()=>(b(this,oa).add(n),u[n])})}),t}getCurrentQuery(){return b(this,n0)}refetch({...u}={}){return this.fetch({...u})}fetchOptimistic(u){const t=b(this,De).defaultQueryOptions(u),n=b(this,De).getQueryCache().build(b(this,De),t);return n.isFetchingOptimistic=!0,n.fetch().then(()=>this.createResult(n,t))}fetch(u){return cu(this,la,P3).call(this,{...u,cancelRefetch:u.cancelRefetch??!0}).then(()=>(this.updateResult(),b(this,ee)))}createResult(u,t){var v;const n=b(this,n0),r=this.options,i=b(this,ee),a=b(this,ia),s=b(this,f4),l=u!==n?u.state:b(this,d4),{state:c}=u;let{error:E,errorUpdatedAt:d,fetchStatus:f,status:p}=c,h=!1,g;if(t._optimisticResults){const C=this.hasListeners(),k=!C&&$B(u,t),j=C&&WB(u,n,t,r);(k||j)&&(f=gd(u.options.networkMode)?"fetching":"paused",c.dataUpdatedAt||(p="pending")),t._optimisticResults==="isRestoring"&&(f="idle")}if(t.select&&typeof c.data<"u")if(i&&c.data===(a==null?void 0:a.data)&&t.select===b(this,nc))g=b(this,p4);else try{T(this,nc,t.select),g=t.select(c.data),g=A5(i==null?void 0:i.data,g,t),T(this,p4,g),T(this,dn,null)}catch(C){T(this,dn,C)}else g=c.data;if(typeof t.placeholderData<"u"&&typeof g>"u"&&p==="pending"){let C;if(i!=null&&i.isPlaceholderData&&t.placeholderData===(s==null?void 0:s.placeholderData))C=i.data;else if(C=typeof t.placeholderData=="function"?t.placeholderData((v=b(this,h4))==null?void 0:v.state.data,b(this,h4)):t.placeholderData,t.select&&typeof C<"u")try{C=t.select(C),T(this,dn,null)}catch(k){T(this,dn,k)}typeof C<"u"&&(p="success",g=A5(i==null?void 0:i.data,C,t),h=!0)}b(this,dn)&&(E=b(this,dn),g=b(this,p4),d=Date.now(),p="error");const A=f==="fetching",m=p==="pending",B=p==="error",F=m&&A;return{status:p,fetchStatus:f,isPending:m,isSuccess:p==="success",isError:B,isInitialLoading:F,isLoading:F,data:g,dataUpdatedAt:c.dataUpdatedAt,error:E,errorUpdatedAt:d,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:A,isRefetching:A&&!m,isLoadingError:B&&c.dataUpdatedAt===0,isPaused:f==="paused",isPlaceholderData:h,isRefetchError:B&&c.dataUpdatedAt!==0,isStale:um(u,t),refetch:this.refetch}}updateResult(u){const t=b(this,ee),n=this.createResult(b(this,n0),this.options);if(T(this,ia,b(this,n0).state),T(this,f4,this.options),b(this,ia).data!==void 0&&T(this,h4,b(this,n0)),C5(n,t))return;T(this,ee,n);const r={},i=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,s=typeof a=="function"?a():a;if(s==="all"||!s&&!b(this,oa).size)return!0;const o=new Set(s??b(this,oa));return this.options.throwOnError&&o.add("error"),Object.keys(b(this,ee)).some(l=>{const c=l;return b(this,ee)[c]!==t[c]&&o.has(c)})};(u==null?void 0:u.listeners)!==!1&&i()&&(r.listeners=!0),cu(this,z2,I_).call(this,{...r,...u})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&cu(this,sc,F5).call(this)}},De=new WeakMap,n0=new WeakMap,d4=new WeakMap,ee=new WeakMap,ia=new WeakMap,f4=new WeakMap,dn=new WeakMap,nc=new WeakMap,p4=new WeakMap,h4=new WeakMap,aa=new WeakMap,sa=new WeakMap,Hr=new WeakMap,oa=new WeakMap,la=new WeakSet,P3=function(u){cu(this,cc,b5).call(this);let t=b(this,n0).fetch(this.options,u);return u!=null&&u.throwOnError||(t=t.catch(mt)),t},rc=new WeakSet,g5=function(){if(cu(this,oc,D5).call(this),bo||b(this,ee).isStale||!h5(this.options.staleTime))return;const t=k_(b(this,ee).dataUpdatedAt,this.options.staleTime)+1;T(this,aa,setTimeout(()=>{b(this,ee).isStale||this.updateResult()},t))},ic=new WeakSet,B5=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(b(this,n0)):this.options.refetchInterval)??!1},ac=new WeakSet,y5=function(u){cu(this,lc,v5).call(this),T(this,Hr,u),!(bo||this.options.enabled===!1||!h5(b(this,Hr))||b(this,Hr)===0)&&T(this,sa,setInterval(()=>{(this.options.refetchIntervalInBackground||b2.isFocused())&&cu(this,la,P3).call(this)},b(this,Hr)))},sc=new WeakSet,F5=function(){cu(this,rc,g5).call(this),cu(this,ac,y5).call(this,cu(this,ic,B5).call(this))},oc=new WeakSet,D5=function(){b(this,aa)&&(clearTimeout(b(this,aa)),T(this,aa,void 0))},lc=new WeakSet,v5=function(){b(this,sa)&&(clearInterval(b(this,sa)),T(this,sa,void 0))},cc=new WeakSet,b5=function(){const u=b(this,De).getQueryCache().build(b(this,De),this.options);if(u===b(this,n0))return;const t=b(this,n0);T(this,n0,u),T(this,d4,u.state),this.hasListeners()&&(t==null||t.removeObserver(this),u.addObserver(this))},z2=new WeakSet,I_=function(u){G0.batch(()=>{u.listeners&&this.listeners.forEach(t=>{t(b(this,ee))}),b(this,De).getQueryCache().notify({query:b(this,n0),type:"observerResultsUpdated"})})},nF);function Q1u(e,u){return u.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&u.retryOnMount===!1)}function $B(e,u){return Q1u(e,u)||e.state.dataUpdatedAt>0&&w5(e,u,u.refetchOnMount)}function w5(e,u,t){if(u.enabled!==!1){const n=typeof t=="function"?t(e):t;return n==="always"||n!==!1&&um(e,u)}return!1}function WB(e,u,t,n){return t.enabled!==!1&&(e!==u||n.enabled===!1)&&(!t.suspense||e.state.status!=="error")&&um(e,t)}function um(e,u){return e.isStaleByTime(u.staleTime)}function K1u(e,u){return!C5(e.getCurrentResult(),u)}var N_=M.createContext(void 0),V1u=e=>{const u=M.useContext(N_);if(e)return e;if(!u)throw new Error("No QueryClient set, use QueryClientProvider to set one");return u},J1u=({client:e,children:u})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),M.createElement(N_.Provider,{value:e},u)),R_=M.createContext(!1),Y1u=()=>M.useContext(R_);R_.Provider;function Z1u(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var X1u=M.createContext(Z1u()),udu=()=>M.useContext(X1u);function edu(e,u){return typeof e=="function"?e(...u):!!e}var tdu=(e,u)=>{(e.suspense||e.throwOnError)&&(u.isReset()||(e.retryOnMount=!1))},ndu=e=>{M.useEffect(()=>{e.clearReset()},[e])},rdu=({result:e,errorResetBoundary:u,throwOnError:t,query:n})=>e.isError&&!u.isReset()&&!e.isFetching&&edu(t,[e.error,n]),idu=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},adu=(e,u)=>(e==null?void 0:e.suspense)&&u.isPending,sdu=(e,u,t)=>u.fetchOptimistic(e).catch(()=>{t.clearReset()});function odu(e,u,t){const n=V1u(t),r=Y1u(),i=udu(),a=n.defaultQueryOptions(e);a._optimisticResults=r?"isRestoring":"optimistic",idu(a),tdu(a,i),ndu(i);const[s]=M.useState(()=>new u(n,a)),o=s.getOptimisticResult(a);if(M.useSyncExternalStore(M.useCallback(l=>{const c=r?()=>{}:s.subscribe(G0.batchCalls(l));return s.updateResult(),c},[s,r]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),M.useEffect(()=>{s.setOptions(a,{listeners:!1})},[a,s]),adu(a,o))throw sdu(a,s,i);if(rdu({result:o,errorResetBoundary:i,throwOnError:a.throwOnError,query:s.getCurrentQuery()}))throw o.error;return a.notifyOnChangeProps?o:s.trackResult(o)}function ldu(e,u){return odu(e,G1u,u)}var z_,qB=Nv;z_=qB.createRoot,qB.hydrateRoot;const ur={1:"0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2",5:"0x1df10ec981ac5871240be4a94f250dd238b77901",10:"0x1df10ec981ac5871240be4a94f250dd238b77901",56:"0x1df10ec981ac5871240be4a94f250dd238b77901",137:"0x1df10ec981ac5871240be4a94f250dd238b77901",250:"0x1df10ec981ac5871240be4a94f250dd238b77901",288:"0x1df10ec981ac5871240be4a94f250dd238b77901",324:"0x1df10ec981ac5871240be4a94f250dd238b77901",420:"0x1df10ec981ac5871240be4a94f250dd238b77901",42161:"0x1df10ec981ac5871240be4a94f250dd238b77901",80001:"0x1df10ec981ac5871240be4a94f250dd238b77901",421613:"0x1df10ec981ac5871240be4a94f250dd238b77901"};var cdu="0.10.2",Pt=class x5 extends Error{constructor(u,t={}){var a;const n=t.cause instanceof x5?t.cause.details:(a=t.cause)!=null&&a.message?t.cause.message:t.details,r=t.cause instanceof x5&&t.cause.docsPath||t.docsPath,i=[u||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${cdu}`].join(` +`);super(i),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),t.cause&&(this.cause=t.cause),this.details=n,this.docsPath=r,this.metaMessages=t.metaMessages,this.shortMessage=u}};function Ni(e,u){const t=e.exec(u);return t==null?void 0:t.groups}var j_=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,M_=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,L_=/^\(.+?\).*?$/,HB=/^tuple(?(\[(\d*)\])*)$/;function k5(e){let u=e.type;if(HB.test(e.type)&&"components"in e){u="(";const t=e.components.length;for(let r=0;r[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function ddu(e){return U_.test(e)}function fdu(e){return Ni(U_,e)}var $_=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function pdu(e){return $_.test(e)}function hdu(e){return Ni($_,e)}var W_=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function Cdu(e){return W_.test(e)}function mdu(e){return Ni(W_,e)}var q_=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function H_(e){return q_.test(e)}function Adu(e){return Ni(q_,e)}var G_=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function gdu(e){return G_.test(e)}function Bdu(e){return Ni(G_,e)}var ydu=/^fallback\(\)$/;function Fdu(e){return ydu.test(e)}var Ddu=/^receive\(\) external payable$/;function vdu(e){return Ddu.test(e)}var bdu=new Set(["indexed"]),_5=new Set(["calldata","memory","storage"]),wdu=class extends Pt{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}},xdu=class extends Pt{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}},kdu=class extends Pt{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},_du=class extends Pt{constructor({param:e,name:u}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${u}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}},Sdu=class extends Pt{constructor({param:e,type:u,modifier:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${t}" not allowed${u?` in "${u}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},Pdu=class extends Pt{constructor({param:e,type:u,modifier:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${t}" not allowed${u?` in "${u}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${t}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}},Tdu=class extends Pt{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}},T3=class extends Pt{constructor({signature:e,type:u}){super(`Invalid ${u} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},Odu=class extends Pt{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},Idu=class extends Pt{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}},Ndu=class extends Pt{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}},Rdu=class extends Pt{constructor({current:e,depth:u}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${u>0?"opening":"closing"} parentheses.`],details:`Depth "${u}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}};function zdu(e,u){return u?`${u}:${e}`:e}var J6=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function jdu(e,u={}){if(Cdu(e)){const t=mdu(e);if(!t)throw new T3({signature:e,type:"function"});const n=qt(t.parameters),r=[],i=n.length;for(let s=0;s[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Ldu=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Udu=/^u?int$/;function qi(e,u){var E,d;const t=zdu(e,u==null?void 0:u.type);if(J6.has(t))return J6.get(t);const n=L_.test(e),r=Ni(n?Ldu:Mdu,e);if(!r)throw new kdu({param:e});if(r.name&&Wdu(r.name))throw new _du({param:e,name:r.name});const i=r.name?{name:r.name}:{},a=r.modifier==="indexed"?{indexed:!0}:{},s=(u==null?void 0:u.structs)??{};let o,l={};if(n){o="tuple";const f=qt(r.type),p=[],h=f.length;for(let g=0;g[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function K_(e,u,t=new Set){const n=[],r=e.length;for(let i=0;iObject.fromEntries(e.filter(u=>u.type==="event").map(u=>{const t=n=>({eventName:u.name,abi:[u],humanReadableAbi:wo([u]),...n});return t.abi=[u],t.eventName=u.name,t.humanReadableAbi=wo([u]),[u.name,t]})),Vdu=({methods:e})=>Object.fromEntries(e.filter(({type:u})=>u==="function").map(u=>{const t=(...n)=>{const r=e.filter(a=>a.name===(u==null?void 0:u.name)),i=n.length>0?{args:n}:{};return{abi:r,humanReadableAbi:wo([u]),functionName:u.name,...i}};return t.abi=[u],t.humanReadableAbi=wo([u]),[u.name,t]})),Jdu=({methods:e})=>Object.fromEntries(e.map(u=>{const t=(...n)=>{const r=e.filter(a=>a.name===(u==null?void 0:u.name)),i=n.length>0?{args:n}:{};return{abi:r,humanReadableAbi:wo([u]),functionName:u.name,...i}};return t.abi=[u],t.humanReadableAbi=wo([u]),[u.name,t]})),Ydu=({humanReadableAbi:e,name:u,bytecode:t})=>{const n=Qdu(e),r=n.filter(i=>i.type==="function");return{bytecode:t,name:u,abi:n,humanReadableAbi:e,events:Kdu({abi:n}),write:Jdu({methods:r}),read:Vdu({methods:r})}};const Zdu={name:"WagmiMintExample",humanReadableAbi:["constructor()","event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)","event ApprovalForAll(address indexed owner, address indexed operator, bool approved)","event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)","function approve(address to, uint256 tokenId)","function balanceOf(address owner) view returns (uint256)","function getApproved(uint256 tokenId) view returns (address)","function isApprovedForAll(address owner, address operator) view returns (bool)","function mint()","function mint(uint256 tokenId)","function name() view returns (string)","function ownerOf(uint256 tokenId) view returns (address)","function safeTransferFrom(address from, address to, uint256 tokenId)","function safeTransferFrom(address from, address to, uint256 tokenId, bytes data)","function setApprovalForAll(address operator, bool approved)","function supportsInterface(bytes4 interfaceId) view returns (bool)","function symbol() view returns (string)","function tokenURI(uint256 tokenId) pure returns (string)","function totalSupply() view returns (uint256)","function transferFrom(address from, address to, uint256 tokenId)"]},Fn=Ydu(Zdu),Xdu="6.8.1";function u6u(e,u,t){const n=u.split("|").map(i=>i.trim());for(let i=0;iPromise.resolve(e[n])))).reduce((n,r,i)=>(n[u[i]]=r,n),{})}function Ru(e,u,t){for(let n in u){let r=u[n];const i=t?t[n]:null;i&&u6u(r,i,n),Object.defineProperty(e,n,{enumerable:!0,value:r,writable:!1})}}function Rs(e){if(e==null)return"null";if(Array.isArray(e))return"[ "+e.map(Rs).join(", ")+" ]";if(e instanceof Uint8Array){const u="0123456789abcdef";let t="0x";for(let n=0;n>4],t+=u[e[n]&15];return t}if(typeof e=="object"&&typeof e.toJSON=="function")return Rs(e.toJSON());switch(typeof e){case"boolean":case"symbol":return e.toString();case"bigint":return BigInt(e).toString();case"number":return e.toString();case"string":return JSON.stringify(e);case"object":{const u=Object.keys(e);return u.sort(),"{ "+u.map(t=>`${Rs(t)}: ${Rs(e[t])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Dt(e,u){return e&&e.code===u}function em(e){return Dt(e,"CALL_EXCEPTION")}function _0(e,u,t){let n=e;{const i=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${Rs(t)}`);for(const a in t){if(a==="shortMessage")continue;const s=t[a];i.push(a+"="+Rs(s))}}i.push(`code=${u}`),i.push(`version=${Xdu}`),i.length&&(e+=" ("+i.join(", ")+")")}let r;switch(u){case"INVALID_ARGUMENT":r=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(e);break;default:r=new Error(e)}return Ru(r,{code:u}),t&&Object.assign(r,t),r.shortMessage==null&&Ru(r,{shortMessage:n}),r}function du(e,u,t,n){if(!e)throw _0(u,t,n)}function V(e,u,t,n){du(e,u,"INVALID_ARGUMENT",{argument:t,value:n})}function V_(e,u,t){t==null&&(t=""),t&&(t=": "+t),du(e>=u,"missing arguemnt"+t,"MISSING_ARGUMENT",{count:e,expectedCount:u}),du(e<=u,"too many arguemnts"+t,"UNEXPECTED_ARGUMENT",{count:e,expectedCount:u})}const e6u=["NFD","NFC","NFKD","NFKC"].reduce((e,u)=>{try{if("test".normalize(u)!=="test")throw new Error("bad");if(u==="NFD"){const t=String.fromCharCode(233).normalize("NFD"),n=String.fromCharCode(101,769);if(t!==n)throw new Error("broken")}e.push(u)}catch{}return e},[]);function t6u(e){du(e6u.indexOf(e)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:e}})}function Bd(e,u,t){if(t==null&&(t=""),e!==u){let n=t,r="new";t&&(n+=".",r+=" "+t),du(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:r})}}function J_(e,u,t){if(e instanceof Uint8Array)return t?new Uint8Array(e):e;if(typeof e=="string"&&e.match(/^0x([0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((e.length-2)/2);let r=2;for(let i=0;i>4]+GB[r&15]}return t}function R0(e){return"0x"+e.map(u=>Ou(u).substring(2)).join("")}function Zs(e){return h0(e,!0)?(e.length-2)/2:u0(e).length}function A0(e,u,t){const n=u0(e);return t!=null&&t>n.length&&du(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:t}),Ou(n.slice(u??0,t??n.length))}function Y_(e,u,t){const n=u0(e);du(u>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:u,offset:u+1});const r=new Uint8Array(u);return r.fill(0),t?r.set(n,u-n.length):r.set(n,0),Ou(r)}function Ha(e,u){return Y_(e,u,!0)}function r6u(e,u){return Y_(e,u,!1)}const yd=BigInt(0),Ht=BigInt(1),zs=9007199254740991;function i6u(e,u){const t=Fd(e,"value"),n=BigInt(Gu(u,"width"));if(du(t>>n===yd,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:e}),t>>n-Ht){const r=(Ht<=-zs&&e<=zs,"overflow",u||"value",e),BigInt(e);case"string":try{if(e==="")throw new Error("empty string");return e[0]==="-"&&e[1]!=="-"?-BigInt(e.substring(1)):BigInt(e)}catch(t){V(!1,`invalid BigNumberish string: ${t.message}`,u||"value",e)}}V(!1,"invalid BigNumberish value",u||"value",e)}function Fd(e,u){const t=Iu(e,u);return du(t>=yd,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),t}const QB="0123456789abcdef";function tm(e){if(e instanceof Uint8Array){let u="0x0";for(const t of e)u+=QB[t>>4],u+=QB[t&15];return BigInt(u)}return Iu(e)}function Gu(e,u){switch(typeof e){case"bigint":return V(e>=-zs&&e<=zs,"overflow",u||"value",e),Number(e);case"number":return V(Number.isInteger(e),"underflow",u||"value",e),V(e>=-zs&&e<=zs,"overflow",u||"value",e),e;case"string":try{if(e==="")throw new Error("empty string");return Gu(BigInt(e),u)}catch(t){V(!1,`invalid numeric string: ${t.message}`,u||"value",e)}}V(!1,"invalid numeric value",u||"value",e)}function a6u(e){return Gu(tm(e))}function wi(e,u){let n=Fd(e,"value").toString(16);if(u==null)n.length%2&&(n="0"+n);else{const r=Gu(u,"width");for(du(r*2>=n.length,`value exceeds width (${r} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});n.length>6===2;a++)i++;return i}return e==="OVERRUN"?t.length-u-1:0}function d6u(e,u,t,n,r){return e==="OVERLONG"?(V(typeof r=="number","invalid bad code point for replacement","badCodepoint",r),n.push(r),0):(n.push(65533),uS(e,u,t))}const f6u=Object.freeze({error:E6u,ignore:uS,replace:d6u});function p6u(e,u){u==null&&(u=f6u.error);const t=u0(e,"bytes"),n=[];let r=0;for(;r>7)){n.push(i);continue}let a=null,s=null;if((i&224)===192)a=1,s=127;else if((i&240)===224)a=2,s=2047;else if((i&248)===240)a=3,s=65535;else{(i&192)===128?r+=u("UNEXPECTED_CONTINUE",r-1,t,n):r+=u("BAD_PREFIX",r-1,t,n);continue}if(r-1+a>=t.length){r+=u("OVERRUN",r-1,t,n);continue}let o=i&(1<<8-a-1)-1;for(let l=0;l1114111){r+=u("OUT_OF_RANGE",r-1-a,t,n,o);continue}if(o>=55296&&o<=57343){r+=u("UTF16_SURROGATE",r-1-a,t,n,o);continue}if(o<=s){r+=u("OVERLONG",r-1-a,t,n,o);continue}n.push(o)}}return n}function or(e,u){u!=null&&(t6u(u),e=e.normalize(u));let t=[];for(let n=0;n>6|192),t.push(r&63|128);else if((r&64512)==55296){n++;const i=e.charCodeAt(n);V(n>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(r>>12|224),t.push(r>>6&63|128),t.push(r&63|128)}return new Uint8Array(t)}function h6u(e){return e.map(u=>u<=65535?String.fromCharCode(u):(u-=65536,String.fromCharCode((u>>10&1023)+55296,(u&1023)+56320))).join("")}function nm(e,u){return h6u(p6u(e,u))}function eS(e){async function u(t,n){const r=t.url.split(":")[0].toLowerCase();du(r==="http"||r==="https",`unsupported protocol ${r}`,"UNSUPPORTED_OPERATION",{info:{protocol:r},operation:"request"}),du(r==="https"||!t.credentials||t.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i;if(n){const E=new AbortController;i=E.signal,n.addListener(()=>{E.abort()})}const a={method:t.method,headers:new Headers(Array.from(t)),body:t.body||void 0,signal:i},s=await fetch(t.url,a),o={};s.headers.forEach((E,d)=>{o[d.toLowerCase()]=E});const l=await s.arrayBuffer(),c=l==null?null:new Uint8Array(l);return{statusCode:s.status,statusMessage:s.statusText,headers:o,body:c}}return u}const C6u=12,m6u=250;let VB=eS();const A6u=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),g6u=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let Y6=!1;async function tS(e,u){try{const t=e.match(A6u);if(!t)throw new Error("invalid data");return new gi(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?l6u(t[3]):y6u(t[3]))}catch{return new gi(599,"BAD REQUEST (invalid data: URI)",{},null,new Cr(e))}}function nS(e){async function u(t,n){try{const r=t.match(g6u);if(!r)throw new Error("invalid link");return new Cr(`${e}${r[2]}`)}catch{return new gi(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Cr(t))}}return u}const $E={data:tS,ipfs:nS("https://gateway.ipfs.io/ipfs/")},rS=new WeakMap;var ca,Gr;class B6u{constructor(u){q(this,ca,void 0);q(this,Gr,void 0);T(this,ca,[]),T(this,Gr,!1),rS.set(u,()=>{if(!b(this,Gr)){T(this,Gr,!0);for(const t of b(this,ca))setTimeout(()=>{t()},0);T(this,ca,[])}})}addListener(u){du(!b(this,Gr),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),b(this,ca).push(u)}get cancelled(){return b(this,Gr)}checkSignal(){du(!this.cancelled,"cancelled","CANCELLED",{})}}ca=new WeakMap,Gr=new WeakMap;function WE(e){if(e==null)throw new Error("missing signal; should not happen");return e.checkSignal(),e}var m4,A4,jt,Mn,g4,B4,j0,We,Ln,Ea,da,fa,fn,Un,Qr,pa,I3;const j2=class j2{constructor(u){q(this,pa);q(this,m4,void 0);q(this,A4,void 0);q(this,jt,void 0);q(this,Mn,void 0);q(this,g4,void 0);q(this,B4,void 0);q(this,j0,void 0);q(this,We,void 0);q(this,Ln,void 0);q(this,Ea,void 0);q(this,da,void 0);q(this,fa,void 0);q(this,fn,void 0);q(this,Un,void 0);q(this,Qr,void 0);T(this,B4,String(u)),T(this,m4,!1),T(this,A4,!0),T(this,jt,{}),T(this,Mn,""),T(this,g4,3e5),T(this,Un,{slotInterval:m6u,maxAttempts:C6u}),T(this,Qr,null)}get url(){return b(this,B4)}set url(u){T(this,B4,String(u))}get body(){return b(this,j0)==null?null:new Uint8Array(b(this,j0))}set body(u){if(u==null)T(this,j0,void 0),T(this,We,void 0);else if(typeof u=="string")T(this,j0,or(u)),T(this,We,"text/plain");else if(u instanceof Uint8Array)T(this,j0,u),T(this,We,"application/octet-stream");else if(typeof u=="object")T(this,j0,or(JSON.stringify(u))),T(this,We,"application/json");else throw new Error("invalid body")}hasBody(){return b(this,j0)!=null}get method(){return b(this,Mn)?b(this,Mn):this.hasBody()?"POST":"GET"}set method(u){u==null&&(u=""),T(this,Mn,String(u).toUpperCase())}get headers(){const u=Object.assign({},b(this,jt));return b(this,Ln)&&(u.authorization=`Basic ${c6u(or(b(this,Ln)))}`),this.allowGzip&&(u["accept-encoding"]="gzip"),u["content-type"]==null&&b(this,We)&&(u["content-type"]=b(this,We)),this.body&&(u["content-length"]=String(this.body.length)),u}getHeader(u){return this.headers[u.toLowerCase()]}setHeader(u,t){b(this,jt)[String(u).toLowerCase()]=String(t)}clearHeaders(){T(this,jt,{})}[Symbol.iterator](){const u=this.headers,t=Object.keys(u);let n=0;return{next:()=>{if(n=0,"timeout must be non-zero","timeout",u),T(this,g4,u)}get preflightFunc(){return b(this,Ea)||null}set preflightFunc(u){T(this,Ea,u)}get processFunc(){return b(this,da)||null}set processFunc(u){T(this,da,u)}get retryFunc(){return b(this,fa)||null}set retryFunc(u){T(this,fa,u)}get getUrlFunc(){return b(this,Qr)||VB}set getUrlFunc(u){T(this,Qr,u)}toString(){return``}setThrottleParams(u){u.slotInterval!=null&&(b(this,Un).slotInterval=u.slotInterval),u.maxAttempts!=null&&(b(this,Un).maxAttempts=u.maxAttempts)}send(){return du(b(this,fn)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),T(this,fn,new B6u(this)),cu(this,pa,I3).call(this,0,JB()+this.timeout,0,this,new gi(0,"",{},null,this))}cancel(){du(b(this,fn)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const u=rS.get(this);if(!u)throw new Error("missing signal; should not happen");u()}redirect(u){const t=this.url.split(":")[0].toLowerCase(),n=u.split(":")[0].toLowerCase();du(this.method==="GET"&&(t!=="https"||n!=="http")&&u.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(u)})`});const r=new j2(u);return r.method="GET",r.allowGzip=this.allowGzip,r.timeout=this.timeout,T(r,jt,Object.assign({},b(this,jt))),b(this,j0)&&T(r,j0,new Uint8Array(b(this,j0))),T(r,We,b(this,We)),r}clone(){const u=new j2(this.url);return T(u,Mn,b(this,Mn)),b(this,j0)&&T(u,j0,b(this,j0)),T(u,We,b(this,We)),T(u,jt,Object.assign({},b(this,jt))),T(u,Ln,b(this,Ln)),this.allowGzip&&(u.allowGzip=!0),u.timeout=this.timeout,this.allowInsecureAuthentication&&(u.allowInsecureAuthentication=!0),T(u,Ea,b(this,Ea)),T(u,da,b(this,da)),T(u,fa,b(this,fa)),T(u,Qr,b(this,Qr)),u}static lockConfig(){Y6=!0}static getGateway(u){return $E[u.toLowerCase()]||null}static registerGateway(u,t){if(u=u.toLowerCase(),u==="http"||u==="https")throw new Error(`cannot intercept ${u}; use registerGetUrl`);if(Y6)throw new Error("gateways locked");$E[u]=t}static registerGetUrl(u){if(Y6)throw new Error("gateways locked");VB=u}static createGetUrlFunc(u){return eS()}static createDataGateway(){return tS}static createIpfsGatewayFunc(u){return nS(u)}};m4=new WeakMap,A4=new WeakMap,jt=new WeakMap,Mn=new WeakMap,g4=new WeakMap,B4=new WeakMap,j0=new WeakMap,We=new WeakMap,Ln=new WeakMap,Ea=new WeakMap,da=new WeakMap,fa=new WeakMap,fn=new WeakMap,Un=new WeakMap,Qr=new WeakMap,pa=new WeakSet,I3=async function(u,t,n,r,i){var c,E,d;if(u>=b(this,Un).maxAttempts)return i.makeServerError("exceeded maximum retry limit");du(JB()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:r}),n>0&&await F6u(n);let a=this.clone();const s=(a.url.split(":")[0]||"").toLowerCase();if(s in $E){const f=await $E[s](a.url,WE(b(r,fn)));if(f instanceof gi){let p=f;if(this.processFunc){WE(b(r,fn));try{p=await this.processFunc(a,p)}catch(h){(h.throttle==null||typeof h.stall!="number")&&p.makeServerError("error in post-processing function",h).assertOk()}}return p}a=f}this.preflightFunc&&(a=await this.preflightFunc(a));const o=await this.getUrlFunc(a,WE(b(r,fn)));let l=new gi(o.statusCode,o.statusMessage,o.headers,o.body,r);if(l.statusCode===301||l.statusCode===302){try{const f=l.headers.location||"";return cu(c=a.redirect(f),pa,I3).call(c,u+1,t,0,r,l)}catch{}return l}else if(l.statusCode===429&&(this.retryFunc==null||await this.retryFunc(a,l,u))){const f=l.headers["retry-after"];let p=b(this,Un).slotInterval*Math.trunc(Math.random()*Math.pow(2,u));return typeof f=="string"&&f.match(/^[1-9][0-9]*$/)&&(p=parseInt(f)),cu(E=a.clone(),pa,I3).call(E,u+1,t,p,r,l)}if(this.processFunc){WE(b(r,fn));try{l=await this.processFunc(a,l)}catch(f){(f.throttle==null||typeof f.stall!="number")&&l.makeServerError("error in post-processing function",f).assertOk();let p=b(this,Un).slotInterval*Math.trunc(Math.random()*Math.pow(2,u));return f.stall>=0&&(p=f.stall),cu(d=a.clone(),pa,I3).call(d,u+1,t,p,r,l)}}return l};let Cr=j2;var Ec,dc,fc,Mt,y4,ha;const hm=class hm{constructor(u,t,n,r,i){q(this,Ec,void 0);q(this,dc,void 0);q(this,fc,void 0);q(this,Mt,void 0);q(this,y4,void 0);q(this,ha,void 0);T(this,Ec,u),T(this,dc,t),T(this,fc,Object.keys(n).reduce((a,s)=>(a[s.toLowerCase()]=String(n[s]),a),{})),T(this,Mt,r==null?null:new Uint8Array(r)),T(this,y4,i||null),T(this,ha,{message:""})}toString(){return``}get statusCode(){return b(this,Ec)}get statusMessage(){return b(this,dc)}get headers(){return Object.assign({},b(this,fc))}get body(){return b(this,Mt)==null?null:new Uint8Array(b(this,Mt))}get bodyText(){try{return b(this,Mt)==null?"":nm(b(this,Mt))}catch{du(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{du(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const u=this.headers,t=Object.keys(u);let n=0;return{next:()=>{if(n=0,"invalid stall timeout","stall",t);const n=new Error(u||"throttling requests");throw Ru(n,{stall:t,throttle:!0}),n}getHeader(u){return this.headers[u.toLowerCase()]}hasBody(){return b(this,Mt)!=null}get request(){return b(this,y4)}ok(){return b(this,ha).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:u,error:t}=b(this,ha);u===""&&(u=`server response ${this.statusCode} ${this.statusMessage}`),du(!1,u,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t})}};Ec=new WeakMap,dc=new WeakMap,fc=new WeakMap,Mt=new WeakMap,y4=new WeakMap,ha=new WeakMap;let gi=hm;function JB(){return new Date().getTime()}function y6u(e){return or(e.replace(/%([0-9a-f][0-9a-f])/gi,(u,t)=>String.fromCharCode(parseInt(t,16))))}function F6u(e){return new Promise(u=>setTimeout(u,e))}function D6u(e){let u=e.toString(16);for(;u.length<2;)u="0"+u;return"0x"+u}function YB(e,u,t){let n=0;for(let r=0;r{du(n<=e.length,"data short segment too short","BUFFER_OVERRUN",{buffer:e,length:e.length,offset:n})};if(e[u]>=248){const n=e[u]-247;t(u+1+n);const r=YB(e,u+1,n);return t(u+1+n+r),ZB(e,u,u+1+n,n+r)}else if(e[u]>=192){const n=e[u]-192;return t(u+1+n),ZB(e,u,u+1,n)}else if(e[u]>=184){const n=e[u]-183;t(u+1+n);const r=YB(e,u+1,n);t(u+1+n+r);const i=Ou(e.slice(u+1+n,u+1+n+r));return{consumed:1+n+r,result:i}}else if(e[u]>=128){const n=e[u]-128;t(u+1+n);const r=Ou(e.slice(u+1,u+1+n));return{consumed:1+n,result:r}}return{consumed:1,result:D6u(e[u])}}function rm(e){const u=u0(e,"data"),t=iS(u,0);return V(t.consumed===u.length,"unexpected junk after rlp payload","data",e),t.result}function XB(e){const u=[];for(;e;)u.unshift(e&255),e>>=8;return u}function aS(e){if(Array.isArray(e)){let n=[];if(e.forEach(function(i){n=n.concat(aS(i))}),n.length<=55)return n.unshift(192+n.length),n;const r=XB(n.length);return r.unshift(247+r.length),r.concat(n)}const u=Array.prototype.slice.call(u0(e,"object"));if(u.length===1&&u[0]<=127)return u;if(u.length<=55)return u.unshift(128+u.length),u;const t=XB(u.length);return t.unshift(183+t.length),t.concat(u)}const uy="0123456789abcdef";function Hl(e){let u="0x";for(const t of aS(e))u+=uy[t>>4],u+=uy[t&15];return u}const he=32,S5=new Uint8Array(he),v6u=["then"],qE={};function B3(e,u){const t=new Error(`deferred error during ABI decoding triggered accessing ${e}`);throw t.error=u,t}var Kr;const X3=class X3 extends Array{constructor(...t){const n=t[0];let r=t[1],i=(t[2]||[]).slice(),a=!0;n!==qE&&(r=t,i=[],a=!1);super(r.length);q(this,Kr,void 0);r.forEach((o,l)=>{this[l]=o});const s=i.reduce((o,l)=>(typeof l=="string"&&o.set(l,(o.get(l)||0)+1),o),new Map);if(T(this,Kr,Object.freeze(r.map((o,l)=>{const c=i[l];return c!=null&&s.get(c)===1?c:null}))),!!a)return Object.freeze(this),new Proxy(this,{get:(o,l,c)=>{if(typeof l=="string"){if(l.match(/^[0-9]+$/)){const d=Gu(l,"%index");if(d<0||d>=this.length)throw new RangeError("out of result range");const f=o[d];return f instanceof Error&&B3(`index ${d}`,f),f}if(v6u.indexOf(l)>=0)return Reflect.get(o,l,c);const E=o[l];if(E instanceof Function)return function(...d){return E.apply(this===c?o:this,d)};if(!(l in o))return o.getValue.apply(this===c?o:this,[l])}return Reflect.get(o,l,c)}})}toArray(){const t=[];return this.forEach((n,r)=>{n instanceof Error&&B3(`index ${r}`,n),t.push(n)}),t}toObject(){return b(this,Kr).reduce((t,n,r)=>(du(n!=null,"value at index ${ index } unnamed","UNSUPPORTED_OPERATION",{operation:"toObject()"}),n in t||(t[n]=this.getValue(n)),t),{})}slice(t,n){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const r=[],i=[];for(let a=t;a{b(this,$n)[u]=ey(t)}}}$n=new WeakMap,Ca=new WeakMap,F4=new WeakSet,m9=function(u){return b(this,$n).push(u),T(this,Ca,b(this,Ca)+u.length),u.length};var qe,Et,M2,sS;const Cm=class Cm{constructor(u,t){q(this,M2);eu(this,"allowLoose");q(this,qe,void 0);q(this,Et,void 0);Ru(this,{allowLoose:!!t}),T(this,qe,Pe(u)),T(this,Et,0)}get data(){return Ou(b(this,qe))}get dataLength(){return b(this,qe).length}get consumed(){return b(this,Et)}get bytes(){return new Uint8Array(b(this,qe))}subReader(u){return new Cm(b(this,qe).slice(b(this,Et)+u),this.allowLoose)}readBytes(u,t){let n=cu(this,M2,sS).call(this,0,u,!!t);return T(this,Et,b(this,Et)+n.length),n.slice(0,u)}readValue(){return tm(this.readBytes(he))}readIndex(){return a6u(this.readBytes(he))}};qe=new WeakMap,Et=new WeakMap,M2=new WeakSet,sS=function(u,t,n){let r=Math.ceil(t/he)*he;return b(this,Et)+r>b(this,qe).length&&(this.allowLoose&&n&&b(this,Et)+t<=b(this,qe).length?r=t:du(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Pe(b(this,qe)),length:b(this,qe).length,offset:b(this,Et)+r})),b(this,qe).slice(b(this,Et),b(this,Et)+r)};let T5=Cm,oS=!1;const lS=function(e){return tb(e)};let cS=lS;function p0(e){const u=u0(e,"data");return Ou(cS(u))}p0._=lS;p0.lock=function(){oS=!0};p0.register=function(e){if(oS)throw new TypeError("keccak256 is locked");cS=e};Object.freeze(p0);const O5="0x0000000000000000000000000000000000000000",ty="0x0000000000000000000000000000000000000000000000000000000000000000",ny=BigInt(0),ry=BigInt(1),iy=BigInt(2),ay=BigInt(27),sy=BigInt(28),HE=BigInt(35),ds={};function oy(e){return Ha(Ve(e),32)}var D4,v4,b4,ma;const It=class It{constructor(u,t,n,r){q(this,D4,void 0);q(this,v4,void 0);q(this,b4,void 0);q(this,ma,void 0);Bd(u,ds,"Signature"),T(this,D4,t),T(this,v4,n),T(this,b4,r),T(this,ma,null)}get r(){return b(this,D4)}set r(u){V(Zs(u)===32,"invalid r","value",u),T(this,D4,Ou(u))}get s(){return b(this,v4)}set s(u){V(Zs(u)===32,"invalid s","value",u);const t=Ou(u);V(parseInt(t.substring(0,3))<8,"non-canonical s","value",t),T(this,v4,t)}get v(){return b(this,b4)}set v(u){const t=Gu(u,"value");V(t===27||t===28,"invalid v","v",u),T(this,b4,t)}get networkV(){return b(this,ma)}get legacyChainId(){const u=this.networkV;return u==null?null:It.getChainId(u)}get yParity(){return this.v===27?0:1}get yParityAndS(){const u=u0(this.s);return this.yParity&&(u[0]|=128),Ou(u)}get compactSerialized(){return R0([this.r,this.yParityAndS])}get serialized(){return R0([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const u=new It(ds,this.r,this.s,this.v);return this.networkV&&T(u,ma,this.networkV),u}toJSON(){const u=this.networkV;return{_type:"signature",networkV:u!=null?u.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(u){const t=Iu(u,"v");return t==ay||t==sy?ny:(V(t>=HE,"invalid EIP-155 v","v",u),(t-HE)/iy)}static getChainIdV(u,t){return Iu(u)*iy+BigInt(35+t-27)}static getNormalizedV(u){const t=Iu(u);return t===ny||t===ay?27:t===ry||t===sy?28:(V(t>=HE,"invalid v","v",u),t&ry?27:28)}static from(u){function t(l,c){V(l,c,"signature",u)}if(u==null)return new It(ds,ty,ty,27);if(typeof u=="string"){const l=u0(u,"signature");if(l.length===64){const c=Ou(l.slice(0,32)),E=l.slice(32,64),d=E[0]&128?28:27;return E[0]&=127,new It(ds,c,Ou(E),d)}if(l.length===65){const c=Ou(l.slice(0,32)),E=l.slice(32,64);t((E[0]&128)===0,"non-canonical s");const d=It.getNormalizedV(l[64]);return new It(ds,c,Ou(E),d)}t(!1,"invalid raw signature length")}if(u instanceof It)return u.clone();const n=u.r;t(n!=null,"missing r");const r=oy(n),i=function(l,c){if(l!=null)return oy(l);if(c!=null){t(h0(c,32),"invalid yParityAndS");const E=u0(c);return E[0]&=127,Ou(E)}t(!1,"missing s")}(u.s,u.yParityAndS);t((u0(i)[0]&128)==0,"non-canonical s");const{networkV:a,v:s}=function(l,c,E){if(l!=null){const d=Iu(l);return{networkV:d>=HE?d:void 0,v:It.getNormalizedV(d)}}if(c!=null)return t(h0(c,32),"invalid yParityAndS"),{v:u0(c)[0]&128?28:27};if(E!=null){switch(Gu(E,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")}(u.v,u.yParityAndS,u.yParity),o=new It(ds,r,i,s);return a&&T(o,ma,a),t(u.yParity==null||Gu(u.yParity,"sig.yParity")===o.yParity,"yParity mismatch"),t(u.yParityAndS==null||u.yParityAndS===o.yParityAndS,"yParityAndS mismatch"),o}};D4=new WeakMap,v4=new WeakMap,b4=new WeakMap,ma=new WeakMap;let Zt=It;var Wn;const Hi=class Hi{constructor(u){q(this,Wn,void 0);V(Zs(u)===32,"invalid private key","privateKey","[REDACTED]"),T(this,Wn,Ou(u))}get privateKey(){return b(this,Wn)}get publicKey(){return Hi.computePublicKey(b(this,Wn))}get compressedPublicKey(){return Hi.computePublicKey(b(this,Wn),!0)}sign(u){V(Zs(u)===32,"invalid digest length","digest",u);const t=Sr.sign(Pe(u),Pe(b(this,Wn)),{lowS:!0});return Zt.from({r:wi(t.r,32),s:wi(t.s,32),v:t.recovery?28:27})}computeSharedSecret(u){const t=Hi.computePublicKey(u);return Ou(Sr.getSharedSecret(Pe(b(this,Wn)),u0(t),!1))}static computePublicKey(u,t){let n=u0(u,"key");if(n.length===32){const i=Sr.getPublicKey(n,!!t);return Ou(i)}if(n.length===64){const i=new Uint8Array(65);i[0]=4,i.set(n,1),n=i}const r=Sr.ProjectivePoint.fromHex(n);return Ou(r.toRawBytes(t))}static recoverPublicKey(u,t){V(Zs(u)===32,"invalid digest length","digest",u);const n=Zt.from(t);let r=Sr.Signature.fromCompact(Pe(R0([n.r,n.s])));r=r.addRecoveryBit(n.yParity);const i=r.recoverPublicKey(Pe(u));return V(i!=null,"invalid signautre for digest","signature",t),"0x"+i.toHex(!1)}static addPoints(u,t,n){const r=Sr.ProjectivePoint.fromHex(Hi.computePublicKey(u).substring(2)),i=Sr.ProjectivePoint.fromHex(Hi.computePublicKey(t).substring(2));return"0x"+r.add(i).toHex(!!n)}};Wn=new WeakMap;let Gl=Hi;const b6u=BigInt(0),w6u=BigInt(36);function ly(e){e=e.toLowerCase();const u=e.substring(2).split(""),t=new Uint8Array(40);for(let r=0;r<40;r++)t[r]=u[r].charCodeAt(0);const n=u0(p0(t));for(let r=0;r<40;r+=2)n[r>>1]>>4>=8&&(u[r]=u[r].toUpperCase()),(n[r>>1]&15)>=8&&(u[r+1]=u[r+1].toUpperCase());return"0x"+u.join("")}const im={};for(let e=0;e<10;e++)im[String(e)]=String(e);for(let e=0;e<26;e++)im[String.fromCharCode(65+e)]=String(10+e);const cy=15;function x6u(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let u=e.split("").map(n=>im[n]).join("");for(;u.length>=cy;){let n=u.substring(0,cy);u=parseInt(n,10)%97+u.substring(n.length)}let t=String(98-parseInt(u,10)%97);for(;t.length<2;)t="0"+t;return t}const k6u=function(){const e={};for(let u=0;u<36;u++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[u];e[t]=BigInt(u)}return e}();function _6u(e){e=e.toLowerCase();let u=b6u;for(let t=0;tu.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return b(this,Aa)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return b(this,Aa)===!0?-1:b(this,Aa)===!1?this.value.length:null}static from(u,t){return new Rn(Nn,u,t)}static uint8(u){return Du(u,8)}static uint16(u){return Du(u,16)}static uint24(u){return Du(u,24)}static uint32(u){return Du(u,32)}static uint40(u){return Du(u,40)}static uint48(u){return Du(u,48)}static uint56(u){return Du(u,56)}static uint64(u){return Du(u,64)}static uint72(u){return Du(u,72)}static uint80(u){return Du(u,80)}static uint88(u){return Du(u,88)}static uint96(u){return Du(u,96)}static uint104(u){return Du(u,104)}static uint112(u){return Du(u,112)}static uint120(u){return Du(u,120)}static uint128(u){return Du(u,128)}static uint136(u){return Du(u,136)}static uint144(u){return Du(u,144)}static uint152(u){return Du(u,152)}static uint160(u){return Du(u,160)}static uint168(u){return Du(u,168)}static uint176(u){return Du(u,176)}static uint184(u){return Du(u,184)}static uint192(u){return Du(u,192)}static uint200(u){return Du(u,200)}static uint208(u){return Du(u,208)}static uint216(u){return Du(u,216)}static uint224(u){return Du(u,224)}static uint232(u){return Du(u,232)}static uint240(u){return Du(u,240)}static uint248(u){return Du(u,248)}static uint256(u){return Du(u,256)}static uint(u){return Du(u,256)}static int8(u){return Du(u,-8)}static int16(u){return Du(u,-16)}static int24(u){return Du(u,-24)}static int32(u){return Du(u,-32)}static int40(u){return Du(u,-40)}static int48(u){return Du(u,-48)}static int56(u){return Du(u,-56)}static int64(u){return Du(u,-64)}static int72(u){return Du(u,-72)}static int80(u){return Du(u,-80)}static int88(u){return Du(u,-88)}static int96(u){return Du(u,-96)}static int104(u){return Du(u,-104)}static int112(u){return Du(u,-112)}static int120(u){return Du(u,-120)}static int128(u){return Du(u,-128)}static int136(u){return Du(u,-136)}static int144(u){return Du(u,-144)}static int152(u){return Du(u,-152)}static int160(u){return Du(u,-160)}static int168(u){return Du(u,-168)}static int176(u){return Du(u,-176)}static int184(u){return Du(u,-184)}static int192(u){return Du(u,-192)}static int200(u){return Du(u,-200)}static int208(u){return Du(u,-208)}static int216(u){return Du(u,-216)}static int224(u){return Du(u,-224)}static int232(u){return Du(u,-232)}static int240(u){return Du(u,-240)}static int248(u){return Du(u,-248)}static int256(u){return Du(u,-256)}static int(u){return Du(u,-256)}static bytes1(u){return Ju(u,1)}static bytes2(u){return Ju(u,2)}static bytes3(u){return Ju(u,3)}static bytes4(u){return Ju(u,4)}static bytes5(u){return Ju(u,5)}static bytes6(u){return Ju(u,6)}static bytes7(u){return Ju(u,7)}static bytes8(u){return Ju(u,8)}static bytes9(u){return Ju(u,9)}static bytes10(u){return Ju(u,10)}static bytes11(u){return Ju(u,11)}static bytes12(u){return Ju(u,12)}static bytes13(u){return Ju(u,13)}static bytes14(u){return Ju(u,14)}static bytes15(u){return Ju(u,15)}static bytes16(u){return Ju(u,16)}static bytes17(u){return Ju(u,17)}static bytes18(u){return Ju(u,18)}static bytes19(u){return Ju(u,19)}static bytes20(u){return Ju(u,20)}static bytes21(u){return Ju(u,21)}static bytes22(u){return Ju(u,22)}static bytes23(u){return Ju(u,23)}static bytes24(u){return Ju(u,24)}static bytes25(u){return Ju(u,25)}static bytes26(u){return Ju(u,26)}static bytes27(u){return Ju(u,27)}static bytes28(u){return Ju(u,28)}static bytes29(u){return Ju(u,29)}static bytes30(u){return Ju(u,30)}static bytes31(u){return Ju(u,31)}static bytes32(u){return Ju(u,32)}static address(u){return new Rn(Nn,"address",u)}static bool(u){return new Rn(Nn,"bool",!!u)}static bytes(u){return new Rn(Nn,"bytes",u)}static string(u){return new Rn(Nn,"string",u)}static array(u,t){throw new Error("not implemented yet")}static tuple(u,t){throw new Error("not implemented yet")}static overrides(u){return new Rn(Nn,"overrides",Object.assign({},u))}static isTyped(u){return u&&typeof u=="object"&&"_typedSymbol"in u&&u._typedSymbol===Ey}static dereference(u,t){if(Rn.isTyped(u)){if(u.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${u.type}`);return u.value}return u}};Aa=new WeakMap;let le=Rn;class P6u extends vr{constructor(u){super("address","address",u,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(u,t){let n=le.dereference(t,"string");try{n=Zu(n)}catch(r){return this._throwError(r.message,t)}return u.writeValue(n)}decode(u){return Zu(wi(u.readValue(),20))}}class T6u extends vr{constructor(t){super(t.name,t.type,"_",t.dynamic);eu(this,"coder");this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,n){return this.coder.encode(t,n)}decode(t){return this.coder.decode(t)}}function dS(e,u,t){let n=[];if(Array.isArray(t))n=t;else if(t&&typeof t=="object"){let o={};n=u.map(l=>{const c=l.localName;return du(c,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:t}),du(!o[c],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:t}),o[c]=!0,t[c]})}else V(!1,"invalid tuple value","tuple",t);V(u.length===n.length,"types/value length mismatch","tuple",t);let r=new P5,i=new P5,a=[];u.forEach((o,l)=>{let c=n[l];if(o.dynamic){let E=i.length;o.encode(i,c);let d=r.writeUpdatableValue();a.push(f=>{d(f+E)})}else o.encode(r,c)}),a.forEach(o=>{o(r.length)});let s=e.appendWriter(r);return s+=e.appendWriter(i),s}function fS(e,u){let t=[],n=[],r=e.subReader(0);return u.forEach(i=>{let a=null;if(i.dynamic){let s=e.readIndex(),o=r.subReader(s);try{a=i.decode(o)}catch(l){if(Dt(l,"BUFFER_OVERRUN"))throw l;a=l,a.baseType=i.name,a.name=i.localName,a.type=i.type}}else try{a=i.decode(e)}catch(s){if(Dt(s,"BUFFER_OVERRUN"))throw s;a=s,a.baseType=i.name,a.name=i.localName,a.type=i.type}if(a==null)throw new Error("investigate");t.push(a),n.push(i.localName||null)}),x2.fromItems(t,n)}class O6u extends vr{constructor(t,n,r){const i=t.type+"["+(n>=0?n:"")+"]",a=n===-1||t.dynamic;super("array",i,r,a);eu(this,"coder");eu(this,"length");Ru(this,{coder:t,length:n})}defaultValue(){const t=this.coder.defaultValue(),n=[];for(let r=0;ra||r<-(a+L6u))&&this._throwError("value out-of-bounds",n),r=Z_(r,8*he)}else(rO3(i,this.size*8))&&this._throwError("value out-of-bounds",n);return t.writeValue(r)}decode(t){let n=O3(t.readValue(),this.size*8);return this.signed&&(n=i6u(n,this.size*8)),n}}class W6u extends pS{constructor(u){super("string",u)}defaultValue(){return""}encode(u,t){return super.encode(u,or(le.dereference(t,"string")))}decode(u){return nm(super.decode(u))}}class GE extends vr{constructor(t,n){let r=!1;const i=[];t.forEach(s=>{s.dynamic&&(r=!0),i.push(s.type)});const a="tuple("+i.join(",")+")";super("tuple",a,n,r);eu(this,"coders");Ru(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach(r=>{t.push(r.defaultValue())});const n=this.coders.reduce((r,i)=>{const a=i.localName;return a&&(r[a]||(r[a]=0),r[a]++),r},{});return this.coders.forEach((r,i)=>{let a=r.localName;!a||n[a]!==1||(a==="length"&&(a="_length"),t[a]==null&&(t[a]=t[i]))}),Object.freeze(t)}encode(t,n){const r=le.dereference(n,"tuple");return dS(t,this.coders,r)}decode(t){return fS(t,this.coders)}}function Ga(e){return p0(or(e))}var q6u="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";const dy=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),fy=4;function H6u(e){let u=0;function t(){return e[u++]<<8|e[u++]}let n=t(),r=1,i=[0,1];for(let w=1;w>--o&1}const E=31,d=2**E,f=d>>>1,p=f>>1,h=d-1;let g=0;for(let w=0;w1;){let N=v+C>>>1;w>>1|c(),k=k<<1^f,j=(j^f)<<1|f|1;m=k,B=1+j-k}let F=n-4;return A.map(w=>{switch(w-F){case 3:return F+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return F+256+(e[s++]<<8|e[s++]);case 1:return F+e[s++];default:return w-1}})}function G6u(e){let u=0;return()=>e[u++]}function hS(e){return G6u(H6u(Q6u(e)))}function Q6u(e){let u=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((r,i)=>u[r.charCodeAt(0)]=i);let t=e.length,n=new Uint8Array(6*t>>3);for(let r=0,i=0,a=0,s=0;r=8&&(n[i++]=s>>(a-=8));return n}function K6u(e){return e&1?~e>>1:e>>1}function V6u(e,u){let t=Array(e);for(let n=0,r=0;n{let u=Ql(e);if(u.length)return u})}function mS(e){let u=[];for(;;){let t=e();if(t==0)break;u.push(J6u(t,e))}for(;;){let t=e()-1;if(t<0)break;u.push(Y6u(t,e))}return u.flat()}function Kl(e){let u=[];for(;;){let t=e(u.length);if(!t)break;u.push(t)}return u}function AS(e,u,t){let n=Array(e).fill().map(()=>[]);for(let r=0;rn[a].push(i));return n}function J6u(e,u){let t=1+u(),n=u(),r=Kl(u);return AS(r.length,1+e,u).flatMap((a,s)=>{let[o,...l]=a;return Array(r[s]).fill().map((c,E)=>{let d=E*n;return[o+E*t,l.map(f=>f+d)]})})}function Y6u(e,u){let t=1+u();return AS(t,1+e,u).map(r=>[r[0],r.slice(1)])}function Z6u(e){let u=[],t=Ql(e);return r(n([]),[]),u;function n(i){let a=e(),s=Kl(()=>{let o=Ql(e).map(l=>t[l]);if(o.length)return n(o)});return{S:a,B:s,Q:i}}function r({S:i,B:a},s,o){if(!(i&4&&o===s[s.length-1])){i&2&&(o=s[s.length-1]),i&1&&u.push(s);for(let l of a)for(let c of l.Q)r(l,[...s,c],o)}}}function X6u(e){return e.toString(16).toUpperCase().padStart(2,"0")}function gS(e){return`{${X6u(e)}}`}function ufu(e){let u=[];for(let t=0,n=e.length;t>24&255}function FS(e){return e&16777215}let I5,py,N5,A9;function ofu(){let e=hS(tfu);I5=new Map(CS(e).flatMap((u,t)=>u.map(n=>[n,t+1<<24]))),py=new Set(Ql(e)),N5=new Map,A9=new Map;for(let[u,t]of mS(e)){if(!py.has(u)&&t.length==2){let[n,r]=t,i=A9.get(n);i||(i=new Map,A9.set(n,i)),i.set(r,u)}N5.set(u,t.reverse())}}function DS(e){return e>=Vl&&e=k2&&e=_2&&uS2&&u0&&r(S2+l)}else{let a=N5.get(i);a?t.push(...a):r(i)}if(!t.length)break;i=t.pop()}if(n&&u.length>1){let i=N3(u[0]);for(let a=1;a0&&r>=a)a==0?(u.push(n,...t),t.length=0,n=s):t.push(s),r=a;else{let o=lfu(n,s);o>=0?n=o:r==0&&a==0?(u.push(n),n=s):(t.push(s),r=a)}}return n>=0&&u.push(n,...t),u}function bS(e){return vS(e).map(FS)}function Efu(e){return cfu(vS(e))}const hy=45,wS=".",xS=65039,kS=1,Ms=e=>Array.from(e);function Jl(e,u){return e.P.has(u)||e.Q.has(u)}class dfu extends Array{get is_emoji(){return!0}}let R5,_S,Xi,z5,SS,Xs,X6,Bs,PS,Cy,j5;function am(){if(R5)return;let e=hS(q6u);const u=()=>Ql(e),t=()=>new Set(u());R5=new Map(mS(e)),_S=t(),Xi=u(),z5=new Set(u().map(c=>Xi[c])),Xi=new Set(Xi),SS=t(),t();let n=CS(e),r=e();const i=()=>new Set(u().flatMap(c=>n[c]).concat(u()));Xs=Kl(c=>{let E=Kl(e).map(d=>d+96);if(E.length){let d=c>=r;E[0]-=32,E=xo(E),d&&(E=`Restricted[${E}]`);let f=i(),p=i(),h=!e();return{N:E,P:f,Q:p,M:h,R:d}}}),X6=t(),Bs=new Map;let a=u().concat(Ms(X6)).sort((c,E)=>c-E);a.forEach((c,E)=>{let d=e(),f=a[E]=d?a[E-d]:{V:[],M:new Map};f.V.push(c),X6.has(c)||Bs.set(c,f)});for(let{V:c,M:E}of new Set(Bs.values())){let d=[];for(let p of c){let h=Xs.filter(A=>Jl(A,p)),g=d.find(({G:A})=>h.some(m=>A.has(m)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),h.forEach(A=>g.G.add(A))}let f=d.flatMap(p=>Ms(p.G));for(let{G:p,V:h}of d){let g=new Set(f.filter(A=>!p.has(A)));for(let A of h)E.set(A,g)}}let s=new Set,o=new Set;const l=c=>s.has(c)?o.add(c):s.add(c);for(let c of Xs){for(let E of c.P)l(E);for(let E of c.Q)l(E)}for(let c of s)!Bs.has(c)&&!o.has(c)&&Bs.set(c,kS);PS=new Set(Ms(s).concat(Ms(bS(s)))),Cy=Z6u(e).map(c=>dfu.from(c)).sort(efu),j5=new Map;for(let c of Cy){let E=[j5];for(let d of c){let f=E.map(p=>{let h=p.get(d);return h||(h=new Map,p.set(d,h)),h});d===xS?E.push(...f):E=f}for(let d of E)d.V=c}}function sm(e){return(TS(e)?"":`${om(Dd([e]))} `)+gS(e)}function om(e){return`"${e}"‎`}function ffu(e){if(e.length>=4&&e[2]==hy&&e[3]==hy)throw new Error(`invalid label extension: "${xo(e.slice(0,4))}"`)}function pfu(e){for(let t=e.lastIndexOf(95);t>0;)if(e[--t]!==95)throw new Error("underscore allowed only at start")}function hfu(e){let u=e[0],t=dy.get(u);if(t)throw Y3(`leading ${t}`);let n=e.length,r=-1;for(let i=1;i{let i=ufu(r),a={input:i,offset:n};n+=i.length+1;try{let s=a.tokens=Dfu(i,u,t),o=s.length,l;if(!o)throw new Error("empty label");let c=a.output=s.flat();if(pfu(c),!(a.emoji=o>1||s[0].is_emoji)&&c.every(d=>d<128))ffu(c),l="ASCII";else{let d=s.flatMap(f=>f.is_emoji?[]:f);if(!d.length)l="Emoji";else{if(Xi.has(c[0]))throw Y3("leading combining mark");for(let h=1;ha.has(s)):Ms(a),!t.length)return}else n.push(r)}if(t){for(let r of t)if(n.every(i=>Jl(r,i)))throw new Error(`whole-script confusable: ${e.N}/${r.N}`)}}function Bfu(e){let u=Xs;for(let t of e){let n=u.filter(r=>Jl(r,t));if(!n.length)throw Xs.some(r=>Jl(r,t))?IS(u[0],t):OS(t);if(u=n,n.length==1)break}return u}function yfu(e){return e.map(({input:u,error:t,output:n})=>{if(t){let r=t.message;throw new Error(e.length==1?r:`Invalid label ${om(Dd(u))}: ${r}`)}return xo(n)}).join(wS)}function OS(e){return new Error(`disallowed character: ${sm(e)}`)}function IS(e,u){let t=sm(u),n=Xs.find(r=>r.P.has(u));return n&&(t=`${n.N} ${t}`),new Error(`illegal mixture: ${e.N} + ${t}`)}function Y3(e){return new Error(`illegal placement: ${e}`)}function Ffu(e,u){for(let t of u)if(!Jl(e,t))throw IS(e,t);if(e.M){let t=bS(u);for(let n=1,r=t.length;nfy)throw new Error(`excessive non-spacing marks: ${om(Dd(t.slice(n-1,i)))} (${i-n}/${fy})`);n=i}}}function Dfu(e,u,t){let n=[],r=[];for(e=e.slice().reverse();e.length;){let i=bfu(e);if(i)r.length&&(n.push(u(r)),r=[]),n.push(t(i));else{let a=e.pop();if(PS.has(a))r.push(a);else{let s=R5.get(a);if(s)r.push(...s);else if(!_S.has(a))throw OS(a)}}}return r.length&&n.push(u(r)),n}function vfu(e){return e.filter(u=>u!=xS)}function bfu(e,u){let t=j5,n,r=e.length;for(;r&&(t=t.get(e[--r]),!!t);){let{V:i}=t;i&&(n=i,u&&u.push(...e.slice(r).reverse()),e.length=r)}return n}const NS=new Uint8Array(32);NS.fill(0);function my(e){return V(e.length!==0,"invalid ENS name; empty component","comp",e),e}function RS(e){const u=or(wfu(e)),t=[];if(e.length===0)return t;let n=0;for(let r=0;r{if(u.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(u.length+1);return t.set(u,1),t[0]=t.length-1,t})))+"00"}function uf(e,u){return{address:Zu(e),storageKeys:u.map((t,n)=>(V(h0(t,32),"invalid slot",`storageKeys[${n}]`,t),t.toLowerCase()))}}function is(e){if(Array.isArray(e))return e.map((t,n)=>Array.isArray(t)?(V(t.length===2,"invalid slot set",`value[${n}]`,t),uf(t[0],t[1])):(V(t!=null&&typeof t=="object","invalid address-slot set","value",e),uf(t.address,t.storageKeys)));V(e!=null&&typeof e=="object","invalid access list","value",e);const u=Object.keys(e).map(t=>{const n=e[t].reduce((r,i)=>(r[i]=!0,r),{});return uf(t,Object.keys(n).sort())});return u.sort((t,n)=>t.address.localeCompare(n.address)),u}function kfu(e){let u;return typeof e=="string"?u=Gl.computePublicKey(e,!1):u=e.publicKey,Zu(p0("0x"+u.substring(4)).substring(26))}function _fu(e,u){return kfu(Gl.recoverPublicKey(e,u))}const _e=BigInt(0),Sfu=BigInt(2),Pfu=BigInt(27),Tfu=BigInt(28),Ofu=BigInt(35),Ifu=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function lm(e){return e==="0x"?null:Zu(e)}function zS(e,u){try{return is(e)}catch(t){V(!1,t.message,u,e)}}function vd(e,u){return e==="0x"?0:Gu(e,u)}function fe(e,u){if(e==="0x")return _e;const t=Iu(e,u);return V(t<=Ifu,"value exceeds uint size",u,t),t}function H0(e,u){const t=Iu(e,"value"),n=Ve(t);return V(n.length<=32,"value too large",`tx.${u}`,t),n}function jS(e){return is(e).map(u=>[u.address,u.storageKeys])}function Nfu(e){const u=rm(e);V(Array.isArray(u)&&(u.length===9||u.length===6),"invalid field count for legacy transaction","data",e);const t={type:0,nonce:vd(u[0],"nonce"),gasPrice:fe(u[1],"gasPrice"),gasLimit:fe(u[2],"gasLimit"),to:lm(u[3]),value:fe(u[4],"value"),data:Ou(u[5]),chainId:_e};if(u.length===6)return t;const n=fe(u[6],"v"),r=fe(u[7],"r"),i=fe(u[8],"s");if(r===_e&&i===_e)t.chainId=n;else{let a=(n-Ofu)/Sfu;a<_e&&(a=_e),t.chainId=a,V(a!==_e||n===Pfu||n===Tfu,"non-canonical legacy v","v",u[6]),t.signature=Zt.from({r:Ha(u[7],32),s:Ha(u[8],32),v:n}),t.hash=p0(e)}return t}function Ay(e,u){const t=[H0(e.nonce||0,"nonce"),H0(e.gasPrice||0,"gasPrice"),H0(e.gasLimit||0,"gasLimit"),e.to!=null?Zu(e.to):"0x",H0(e.value||0,"value"),e.data||"0x"];let n=_e;if(e.chainId!=_e)n=Iu(e.chainId,"tx.chainId"),V(!u||u.networkV==null||u.legacyChainId===n,"tx.chainId/sig.v mismatch","sig",u);else if(e.signature){const i=e.signature.legacyChainId;i!=null&&(n=i)}if(!u)return n!==_e&&(t.push(Ve(n)),t.push("0x"),t.push("0x")),Hl(t);let r=BigInt(27+u.yParity);return n!==_e?r=Zt.getChainIdV(n,u.v):BigInt(u.v)!==r&&V(!1,"tx.chainId/sig.v mismatch","sig",u),t.push(Ve(r)),t.push(Ve(u.r)),t.push(Ve(u.s)),Hl(t)}function MS(e,u){let t;try{if(t=vd(u[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{V(!1,"invalid yParity","yParity",u[0])}const n=Ha(u[1],32),r=Ha(u[2],32),i=Zt.from({r:n,s:r,yParity:t});e.signature=i}function Rfu(e){const u=rm(u0(e).slice(1));V(Array.isArray(u)&&(u.length===9||u.length===12),"invalid field count for transaction type: 2","data",Ou(e));const t=fe(u[2],"maxPriorityFeePerGas"),n=fe(u[3],"maxFeePerGas"),r={type:2,chainId:fe(u[0],"chainId"),nonce:vd(u[1],"nonce"),maxPriorityFeePerGas:t,maxFeePerGas:n,gasPrice:null,gasLimit:fe(u[4],"gasLimit"),to:lm(u[5]),value:fe(u[6],"value"),data:Ou(u[7]),accessList:zS(u[8],"accessList")};return u.length===9||(r.hash=p0(e),MS(r,u.slice(9))),r}function gy(e,u){const t=[H0(e.chainId||0,"chainId"),H0(e.nonce||0,"nonce"),H0(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),H0(e.maxFeePerGas||0,"maxFeePerGas"),H0(e.gasLimit||0,"gasLimit"),e.to!=null?Zu(e.to):"0x",H0(e.value||0,"value"),e.data||"0x",jS(e.accessList||[])];return u&&(t.push(H0(u.yParity,"yParity")),t.push(Ve(u.r)),t.push(Ve(u.s))),R0(["0x02",Hl(t)])}function zfu(e){const u=rm(u0(e).slice(1));V(Array.isArray(u)&&(u.length===8||u.length===11),"invalid field count for transaction type: 1","data",Ou(e));const t={type:1,chainId:fe(u[0],"chainId"),nonce:vd(u[1],"nonce"),gasPrice:fe(u[2],"gasPrice"),gasLimit:fe(u[3],"gasLimit"),to:lm(u[4]),value:fe(u[5],"value"),data:Ou(u[6]),accessList:zS(u[7],"accessList")};return u.length===8||(t.hash=p0(e),MS(t,u.slice(8))),t}function By(e,u){const t=[H0(e.chainId||0,"chainId"),H0(e.nonce||0,"nonce"),H0(e.gasPrice||0,"gasPrice"),H0(e.gasLimit||0,"gasLimit"),e.to!=null?Zu(e.to):"0x",H0(e.value||0,"value"),e.data||"0x",jS(e.accessList||[])];return u&&(t.push(H0(u.yParity,"recoveryParam")),t.push(Ve(u.r)),t.push(Ve(u.s))),R0(["0x01",Hl(t)])}var qn,w4,x4,k4,_4,S4,P4,T4,O4,I4,N4,R4;const Nr=class Nr{constructor(){q(this,qn,void 0);q(this,w4,void 0);q(this,x4,void 0);q(this,k4,void 0);q(this,_4,void 0);q(this,S4,void 0);q(this,P4,void 0);q(this,T4,void 0);q(this,O4,void 0);q(this,I4,void 0);q(this,N4,void 0);q(this,R4,void 0);T(this,qn,null),T(this,w4,null),T(this,k4,0),T(this,_4,BigInt(0)),T(this,S4,null),T(this,P4,null),T(this,T4,null),T(this,x4,"0x"),T(this,O4,BigInt(0)),T(this,I4,BigInt(0)),T(this,N4,null),T(this,R4,null)}get type(){return b(this,qn)}set type(u){switch(u){case null:T(this,qn,null);break;case 0:case"legacy":T(this,qn,0);break;case 1:case"berlin":case"eip-2930":T(this,qn,1);break;case 2:case"london":case"eip-1559":T(this,qn,2);break;default:V(!1,"unsupported transaction type","type",u)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559"}return null}get to(){return b(this,w4)}set to(u){T(this,w4,u==null?null:Zu(u))}get nonce(){return b(this,k4)}set nonce(u){T(this,k4,Gu(u,"value"))}get gasLimit(){return b(this,_4)}set gasLimit(u){T(this,_4,Iu(u))}get gasPrice(){const u=b(this,S4);return u==null&&(this.type===0||this.type===1)?_e:u}set gasPrice(u){T(this,S4,u==null?null:Iu(u,"gasPrice"))}get maxPriorityFeePerGas(){const u=b(this,P4);return u??(this.type===2?_e:null)}set maxPriorityFeePerGas(u){T(this,P4,u==null?null:Iu(u,"maxPriorityFeePerGas"))}get maxFeePerGas(){const u=b(this,T4);return u??(this.type===2?_e:null)}set maxFeePerGas(u){T(this,T4,u==null?null:Iu(u,"maxFeePerGas"))}get data(){return b(this,x4)}set data(u){T(this,x4,Ou(u))}get value(){return b(this,O4)}set value(u){T(this,O4,Iu(u,"value"))}get chainId(){return b(this,I4)}set chainId(u){T(this,I4,Iu(u))}get signature(){return b(this,N4)||null}set signature(u){T(this,N4,u==null?null:Zt.from(u))}get accessList(){const u=b(this,R4)||null;return u??(this.type===1||this.type===2?[]:null)}set accessList(u){T(this,R4,u==null?null:is(u))}get hash(){return this.signature==null?null:p0(this.serialized)}get unsignedHash(){return p0(this.unsignedSerialized)}get from(){return this.signature==null?null:_fu(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:Gl.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){switch(du(this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"}),this.inferType()){case 0:return Ay(this,this.signature);case 1:return By(this,this.signature);case 2:return gy(this,this.signature)}du(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get unsignedSerialized(){switch(this.inferType()){case 0:return Ay(this);case 1:return By(this);case 2:return gy(this)}du(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".unsignedSerialized"})}inferType(){return this.inferTypes().pop()}inferTypes(){const u=this.gasPrice!=null,t=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&du(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),du(!t||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),du(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const r=[];return this.type!=null?r.push(this.type):t?r.push(2):u?(r.push(1),n||r.push(0)):n?(r.push(1),r.push(2)):(r.push(0),r.push(1),r.push(2)),r.sort(),r}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}clone(){return Nr.from(this)}toJSON(){const u=t=>t==null?null:t.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:u(this.gasLimit),gasPrice:u(this.gasPrice),maxPriorityFeePerGas:u(this.maxPriorityFeePerGas),maxFeePerGas:u(this.maxFeePerGas),value:u(this.value),chainId:u(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(u){if(u==null)return new Nr;if(typeof u=="string"){const n=u0(u);if(n[0]>=127)return Nr.from(Nfu(n));switch(n[0]){case 1:return Nr.from(zfu(n));case 2:return Nr.from(Rfu(n))}du(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new Nr;return u.type!=null&&(t.type=u.type),u.to!=null&&(t.to=u.to),u.nonce!=null&&(t.nonce=u.nonce),u.gasLimit!=null&&(t.gasLimit=u.gasLimit),u.gasPrice!=null&&(t.gasPrice=u.gasPrice),u.maxPriorityFeePerGas!=null&&(t.maxPriorityFeePerGas=u.maxPriorityFeePerGas),u.maxFeePerGas!=null&&(t.maxFeePerGas=u.maxFeePerGas),u.data!=null&&(t.data=u.data),u.value!=null&&(t.value=u.value),u.chainId!=null&&(t.chainId=u.chainId),u.signature!=null&&(t.signature=Zt.from(u.signature)),u.accessList!=null&&(t.accessList=u.accessList),u.hash!=null&&(V(t.isSigned(),"unsigned transaction cannot define hash","tx",u),V(t.hash===u.hash,"hash mismatch","tx",u)),u.from!=null&&(V(t.isSigned(),"unsigned transaction cannot define from","tx",u),V(t.from.toLowerCase()===(u.from||"").toLowerCase(),"from mismatch","tx",u)),t}};qn=new WeakMap,w4=new WeakMap,x4=new WeakMap,k4=new WeakMap,_4=new WeakMap,S4=new WeakMap,P4=new WeakMap,T4=new WeakMap,O4=new WeakMap,I4=new WeakMap,N4=new WeakMap,R4=new WeakMap;let T2=Nr;const LS=new Uint8Array(32);LS.fill(0);const jfu=BigInt(-1),US=BigInt(0),$S=BigInt(1),Mfu=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function Lfu(e){const u=u0(e),t=u.length%32;return t?R0([u,LS.slice(t)]):Ou(u)}const Ufu=wi($S,32),$fu=wi(US,32),yy={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ef=["name","version","chainId","verifyingContract","salt"];function Fy(e){return function(u){return V(typeof u=="string",`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,u),u}}const Wfu={name:Fy("name"),version:Fy("version"),chainId:function(e){const u=Iu(e,"domain.chainId");return V(u>=0,"invalid chain ID","domain.chainId",e),Number.isSafeInteger(u)?Number(u):js(u)},verifyingContract:function(e){try{return Zu(e).toLowerCase()}catch{}V(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){const u=u0(e,"domain.salt");return V(u.length===32,'invalid domain value "salt"',"domain.salt",e),Ou(u)}};function tf(e){{const u=e.match(/^(u?)int(\d*)$/);if(u){const t=u[1]==="",n=parseInt(u[2]||"256");V(n%8===0&&n!==0&&n<=256&&(u[2]==null||u[2]===String(n)),"invalid numeric width","type",e);const r=O3(Mfu,t?n-1:n),i=t?(r+$S)*jfu:US;return function(a){const s=Iu(a,"value");return V(s>=i&&s<=r,`value out-of-bounds for ${e}`,"value",s),wi(t?Z_(s,256):s,32)}}}{const u=e.match(/^bytes(\d+)$/);if(u){const t=parseInt(u[1]);return V(t!==0&&t<=32&&u[1]===String(t),"invalid bytes width","type",e),function(n){const r=u0(n);return V(r.length===t,`invalid length for ${e}`,"value",n),Lfu(n)}}}switch(e){case"address":return function(u){return Ha(Zu(u),32)};case"bool":return function(u){return u?Ufu:$fu};case"bytes":return function(u){return p0(u)};case"string":return function(u){return Ga(u)}}return null}function Dy(e,u){return`${e}(${u.map(({name:t,type:n})=>n+" "+t).join(",")})`}var pc,Hn,z4,L2,WS;const it=class it{constructor(u){q(this,L2);eu(this,"primaryType");q(this,pc,void 0);q(this,Hn,void 0);q(this,z4,void 0);T(this,pc,JSON.stringify(u)),T(this,Hn,new Map),T(this,z4,new Map);const t=new Map,n=new Map,r=new Map;Object.keys(u).forEach(s=>{t.set(s,new Set),n.set(s,[]),r.set(s,new Set)});for(const s in u){const o=new Set;for(const l of u[s]){V(!o.has(l.name),`duplicate variable name ${JSON.stringify(l.name)} in ${JSON.stringify(s)}`,"types",u),o.add(l.name);const c=l.type.match(/^([^\x5b]*)(\x5b|$)/)[1]||null;V(c!==s,`circular type reference to ${JSON.stringify(c)}`,"types",u),!tf(c)&&(V(n.has(c),`unknown type ${JSON.stringify(c)}`,"types",u),n.get(c).push(s),t.get(s).add(c))}}const i=Array.from(n.keys()).filter(s=>n.get(s).length===0);V(i.length!==0,"missing primary type","types",u),V(i.length===1,`ambiguous primary types or unused types: ${i.map(s=>JSON.stringify(s)).join(", ")}`,"types",u),Ru(this,{primaryType:i[0]});function a(s,o){V(!o.has(s),`circular type reference to ${JSON.stringify(s)}`,"types",u),o.add(s);for(const l of t.get(s))if(n.has(l)){a(l,o);for(const c of o)r.get(c).add(l)}o.delete(s)}a(this.primaryType,new Set);for(const[s,o]of r){const l=Array.from(o);l.sort(),b(this,Hn).set(s,Dy(s,u[s])+l.map(c=>Dy(c,u[c])).join(""))}}get types(){return JSON.parse(b(this,pc))}getEncoder(u){let t=b(this,z4).get(u);return t||(t=cu(this,L2,WS).call(this,u),b(this,z4).set(u,t)),t}encodeType(u){const t=b(this,Hn).get(u);return V(t,`unknown type: ${JSON.stringify(u)}`,"name",u),t}encodeData(u,t){return this.getEncoder(u)(t)}hashStruct(u,t){return p0(this.encodeData(u,t))}encode(u){return this.encodeData(this.primaryType,u)}hash(u){return this.hashStruct(this.primaryType,u)}_visit(u,t,n){if(tf(u))return n(u,t);const r=u.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r)return V(!r[3]||parseInt(r[3])===t.length,`array length mismatch; expected length ${parseInt(r[3])}`,"value",t),t.map(a=>this._visit(r[1],a,n));const i=this.types[u];if(i)return i.reduce((a,{name:s,type:o})=>(a[s]=this._visit(o,t[s],n),a),{});V(!1,`unknown type: ${u}`,"type",u)}visit(u,t){return this._visit(this.primaryType,u,t)}static from(u){return new it(u)}static getPrimaryType(u){return it.from(u).primaryType}static hashStruct(u,t,n){return it.from(t).hashStruct(u,n)}static hashDomain(u){const t=[];for(const n in u){if(u[n]==null)continue;const r=yy[n];V(r,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",u),t.push({name:n,type:r})}return t.sort((n,r)=>ef.indexOf(n.name)-ef.indexOf(r.name)),it.hashStruct("EIP712Domain",{EIP712Domain:t},u)}static encode(u,t,n){return R0(["0x1901",it.hashDomain(u),it.from(t).hash(n)])}static hash(u,t,n){return p0(it.encode(u,t,n))}static async resolveNames(u,t,n,r){u=Object.assign({},u);for(const s in u)u[s]==null&&delete u[s];const i={};u.verifyingContract&&!h0(u.verifyingContract,20)&&(i[u.verifyingContract]="0x");const a=it.from(t);a.visit(n,(s,o)=>(s==="address"&&!h0(o,20)&&(i[o]="0x"),o));for(const s in i)i[s]=await r(s);return u.verifyingContract&&i[u.verifyingContract]&&(u.verifyingContract=i[u.verifyingContract]),n=a.visit(n,(s,o)=>s==="address"&&i[o]?i[o]:o),{domain:u,value:n}}static getPayload(u,t,n){it.hashDomain(u);const r={},i=[];ef.forEach(o=>{const l=u[o];l!=null&&(r[o]=Wfu[o](l),i.push({name:o,type:yy[o]}))});const a=it.from(t),s=Object.assign({},t);return V(s.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",t),s.EIP712Domain=i,a.encode(n),{types:s,domain:r,primaryType:a.primaryType,message:a.visit(n,(o,l)=>{if(o.match(/^bytes(\d*)/))return Ou(u0(l));if(o.match(/^u?int/))return Iu(l).toString();switch(o){case"address":return l.toLowerCase();case"bool":return!!l;case"string":return V(typeof l=="string","invalid string","value",l),l}V(!1,"unsupported type","type",o)})}}};pc=new WeakMap,Hn=new WeakMap,z4=new WeakMap,L2=new WeakSet,WS=function(u){{const r=tf(u);if(r)return r}const t=u.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const r=t[1],i=this.getEncoder(r);return a=>{V(!t[3]||parseInt(t[3])===a.length,`array length mismatch; expected length ${parseInt(t[3])}`,"value",a);let s=a.map(i);return b(this,Hn).has(r)&&(s=s.map(p0)),p0(R0(s))}}const n=this.types[u];if(n){const r=Ga(b(this,Hn).get(u));return i=>{const a=n.map(({name:s,type:o})=>{const l=this.getEncoder(o)(i[s]);return b(this,Hn).has(o)?p0(l):l});return a.unshift(r),R0(a)}}V(!1,`unknown type: ${u}`,"type",u)};let O2=it;function me(e){const u=new Set;return e.forEach(t=>u.add(t)),Object.freeze(u)}const qfu="external public payable",Hfu=me(qfu.split(" ")),qS="constant external internal payable private public pure view",Gfu=me(qS.split(" ")),HS="constructor error event fallback function receive struct",GS=me(HS.split(" ")),QS="calldata memory storage payable indexed",Qfu=me(QS.split(" ")),Kfu="tuple returns",Vfu=[HS,QS,Kfu,qS].join(" "),Jfu=me(Vfu.split(" ")),Yfu={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Zfu=new RegExp("^(\\s*)"),Xfu=new RegExp("^([0-9]+)"),upu=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),KS=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),VS=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var W0,Lt,hc,L5;const U2=class U2{constructor(u){q(this,hc);q(this,W0,void 0);q(this,Lt,void 0);T(this,W0,0),T(this,Lt,u.slice())}get offset(){return b(this,W0)}get length(){return b(this,Lt).length-b(this,W0)}clone(){return new U2(b(this,Lt))}reset(){T(this,W0,0)}popKeyword(u){const t=this.peek();if(t.type!=="KEYWORD"||!u.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(u){if(this.peek().type!==u)throw new Error(`expected ${u}; got ${JSON.stringify(this.peek())}`);return this.pop().text}popParen(){const u=this.peek();if(u.type!=="OPEN_PAREN")throw new Error("bad start");const t=cu(this,hc,L5).call(this,b(this,W0)+1,u.match+1);return T(this,W0,u.match+1),t}popParams(){const u=this.peek();if(u.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;b(this,W0)=b(this,Lt).length)throw new Error("out-of-bounds");return b(this,Lt)[b(this,W0)]}peekKeyword(u){const t=this.peekType("KEYWORD");return t!=null&&u.has(t)?t:null}peekType(u){if(this.length===0)return null;const t=this.peek();return t.type===u?t.text:null}pop(){const u=this.peek();return br(this,W0)._++,u}toString(){const u=[];for(let t=b(this,W0);t`}};W0=new WeakMap,Lt=new WeakMap,hc=new WeakSet,L5=function(u=0,t=0){return new U2(b(this,Lt).slice(u,t).map(n=>Object.freeze(Object.assign({},n,{match:n.match-u,linkBack:n.linkBack-u,linkNext:n.linkNext-u}))))};let Xt=U2;function Ri(e){const u=[],t=a=>{const s=i0&&u[u.length-1].type==="NUMBER"){const E=u.pop().text;c=E+c,u[u.length-1].value=Gu(E)}if(u.length===0||u[u.length-1].type!=="BRACKET")throw new Error("missing opening bracket");u[u.length-1].text+=c}continue}if(s=a.match(upu),s){if(o.text=s[1],i+=o.text.length,Jfu.has(o.text)){o.type="KEYWORD";continue}if(o.text.match(VS)){o.type="TYPE";continue}o.type="ID";continue}if(s=a.match(Xfu),s){o.text=s[1],o.type="NUMBER",i+=o.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${i}`)}return new Xt(u.map(a=>Object.freeze(a)))}function vy(e,u){let t=[];for(const n in u.keys())e.has(n)&&t.push(n);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function bd(e,u){if(u.peekKeyword(GS)){const t=u.pop().text;if(t!==e)throw new Error(`expected ${e}, got ${t}`)}return u.popType("ID")}function mr(e,u){const t=new Set;for(;;){const n=e.peekType("KEYWORD");if(n==null||u&&!u.has(n))break;if(e.pop(),t.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);t.add(n)}return Object.freeze(t)}function JS(e){let u=mr(e,Gfu);return vy(u,me("constant payable nonpayable".split(" "))),vy(u,me("pure view payable nonpayable".split(" "))),u.has("view")?"view":u.has("pure")?"pure":u.has("payable")?"payable":u.has("nonpayable")?"nonpayable":u.has("constant")?"view":"nonpayable"}function lr(e,u){return e.popParams().map(t=>K0.from(t,u))}function YS(e){if(e.peekType("AT")){if(e.pop(),e.peekType("NUMBER"))return Iu(e.pop().text);throw new Error("invalid gas")}return null}function Qa(e){if(e.length)throw new Error(`unexpected tokens: ${e.toString()}`)}const epu=new RegExp(/^(.*)\[([0-9]*)\]$/);function by(e){const u=e.match(VS);if(V(u,"invalid type","type",e),e==="uint")return"uint256";if(e==="int")return"int256";if(u[2]){const t=parseInt(u[2]);V(t!==0&&t<=32,"invalid bytes length","type",e)}else if(u[3]){const t=parseInt(u[3]);V(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",e)}return e}const f0={},je=Symbol.for("_ethers_internal"),wy="_ParamTypeInternal",xy="_ErrorInternal",ky="_EventInternal",_y="_ConstructorInternal",Sy="_FallbackInternal",Py="_FunctionInternal",Ty="_StructInternal";var j4,g9;const at=class at{constructor(u,t,n,r,i,a,s,o){q(this,j4);eu(this,"name");eu(this,"type");eu(this,"baseType");eu(this,"indexed");eu(this,"components");eu(this,"arrayLength");eu(this,"arrayChildren");if(Bd(u,f0,"ParamType"),Object.defineProperty(this,je,{value:wy}),a&&(a=Object.freeze(a.slice())),r==="array"){if(s==null||o==null)throw new Error("")}else if(s!=null||o!=null)throw new Error("");if(r==="tuple"){if(a==null)throw new Error("")}else if(a!=null)throw new Error("");Ru(this,{name:t,type:n,baseType:r,indexed:i,components:a,arrayLength:s,arrayChildren:o})}format(u){if(u==null&&(u="sighash"),u==="json"){const n=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=n,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const r={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(r.indexed=this.indexed),this.isTuple()&&(r.components=this.components.map(i=>JSON.parse(i.format(u)))),JSON.stringify(r)}let t="";return this.isArray()?(t+=this.arrayChildren.format(u),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?(u!=="sighash"&&(t+=this.type),t+="("+this.components.map(n=>n.format(u)).join(u==="full"?", ":",")+")"):t+=this.type,u!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),u==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(u,t){if(this.isArray()){if(!Array.isArray(u))throw new Error("invalid array value");if(this.arrayLength!==-1&&u.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return u.map(r=>n.arrayChildren.walk(r,t))}if(this.isTuple()){if(!Array.isArray(u))throw new Error("invalid tuple value");if(u.length!==this.components.length)throw new Error("array is wrong length");const n=this;return u.map((r,i)=>n.components[i].walk(r,t))}return t(this.type,u)}async walkAsync(u,t){const n=[],r=[u];return cu(this,j4,g9).call(this,n,u,t,i=>{r[0]=i}),n.length&&await Promise.all(n),r[0]}static from(u,t){if(at.isParamType(u))return u;if(typeof u=="string")try{return at.from(Ri(u),t)}catch{V(!1,"invalid param type","obj",u)}else if(u instanceof Xt){let s="",o="",l=null;mr(u,me(["tuple"])).has("tuple")||u.peekType("OPEN_PAREN")?(o="tuple",l=u.popParams().map(h=>at.from(h)),s=`tuple(${l.map(h=>h.format()).join(",")})`):(s=by(u.popType("TYPE")),o=s);let c=null,E=null;for(;u.length&&u.peekType("BRACKET");){const h=u.pop();c=new at(f0,"",s,o,null,l,E,c),E=h.value,s+=h.text,o="array",l=null}let d=null;if(mr(u,Qfu).has("indexed")){if(!t)throw new Error("");d=!0}const p=u.peekType("ID")?u.pop().text:"";if(u.length)throw new Error("leftover tokens");return new at(f0,p,s,o,d,l,E,c)}const n=u.name;V(!n||typeof n=="string"&&n.match(KS),"invalid name","obj.name",n);let r=u.indexed;r!=null&&(V(t,"parameter cannot be indexed","obj.indexed",u.indexed),r=!!r);let i=u.type,a=i.match(epu);if(a){const s=parseInt(a[2]||"-1"),o=at.from({type:a[1],components:u.components});return new at(f0,n||"",i,"array",r,null,s,o)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const s=u.components!=null?u.components.map(l=>at.from(l)):null;return new at(f0,n||"",i,"tuple",r,s,null,null)}return i=by(u.type),new at(f0,n||"",i,i,r,null,null,null)}static isParamType(u){return u&&u[je]===wy}};j4=new WeakSet,g9=function(u,t,n,r){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const a=this.arrayChildren,s=t.slice();s.forEach((o,l)=>{var c;cu(c=a,j4,g9).call(c,u,o,n,E=>{s[l]=E})}),r(s);return}if(this.isTuple()){const a=this.components;let s;if(Array.isArray(t))s=t.slice();else{if(t==null||typeof t!="object")throw new Error("invalid tuple value");s=a.map(o=>{if(!o.name)throw new Error("cannot use object value with unnamed components");if(!(o.name in t))throw new Error(`missing value for component ${o.name}`);return t[o.name]})}if(s.length!==this.components.length)throw new Error("array is wrong length");s.forEach((o,l)=>{var c;cu(c=a[l],j4,g9).call(c,u,o,n,E=>{s[l]=E})}),r(s);return}const i=n(this.type,t);i.then?u.push(async function(){r(await i)}()):r(i)};let K0=at;class Ka{constructor(u,t,n){eu(this,"type");eu(this,"inputs");Bd(u,f0,"Fragment"),n=Object.freeze(n.slice()),Ru(this,{type:t,inputs:n})}static from(u){if(typeof u=="string"){try{Ka.from(JSON.parse(u))}catch{}return Ka.from(Ri(u))}if(u instanceof Xt)switch(u.peekKeyword(GS)){case"constructor":return rr.from(u);case"error":return Se.from(u);case"event":return Dn.from(u);case"fallback":case"receive":return jn.from(u);case"function":return vn.from(u);case"struct":return Ra.from(u)}else if(typeof u=="object"){switch(u.type){case"constructor":return rr.from(u);case"error":return Se.from(u);case"event":return Dn.from(u);case"fallback":case"receive":return jn.from(u);case"function":return vn.from(u);case"struct":return Ra.from(u)}du(!1,`unsupported type: ${u.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}V(!1,"unsupported frgament object","obj",u)}static isConstructor(u){return rr.isFragment(u)}static isError(u){return Se.isFragment(u)}static isEvent(u){return Dn.isFragment(u)}static isFunction(u){return vn.isFragment(u)}static isStruct(u){return Ra.isFragment(u)}}class wd extends Ka{constructor(t,n,r,i){super(t,n,i);eu(this,"name");V(typeof r=="string"&&r.match(KS),"invalid identifier","name",r),i=Object.freeze(i.slice()),Ru(this,{name:r})}}function Yl(e,u){return"("+u.map(t=>t.format(e)).join(e==="full"?", ":",")+")"}class Se extends wd{constructor(u,t,n){super(u,"error",t,n),Object.defineProperty(this,je,{value:xy})}get selector(){return Ga(this.format("sighash")).substring(0,10)}format(u){if(u==null&&(u="sighash"),u==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(u)))});const t=[];return u!=="sighash"&&t.push("error"),t.push(this.name+Yl(u,this.inputs)),t.join(" ")}static from(u){if(Se.isFragment(u))return u;if(typeof u=="string")return Se.from(Ri(u));if(u instanceof Xt){const t=bd("error",u),n=lr(u);return Qa(u),new Se(f0,t,n)}return new Se(f0,u.name,u.inputs?u.inputs.map(K0.from):[])}static isFragment(u){return u&&u[je]===xy}}class Dn extends wd{constructor(t,n,r,i){super(t,"event",n,r);eu(this,"anonymous");Object.defineProperty(this,je,{value:ky}),Ru(this,{anonymous:i})}get topicHash(){return Ga(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const n=[];return t!=="sighash"&&n.push("event"),n.push(this.name+Yl(t,this.inputs)),t!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(t,n){return n=(n||[]).map(i=>K0.from(i)),new Dn(f0,t,n,!1).topicHash}static from(t){if(Dn.isFragment(t))return t;if(typeof t=="string")try{return Dn.from(Ri(t))}catch{V(!1,"invalid event fragment","obj",t)}else if(t instanceof Xt){const n=bd("event",t),r=lr(t,!0),i=!!mr(t,me(["anonymous"])).has("anonymous");return Qa(t),new Dn(f0,n,r,i)}return new Dn(f0,t.name,t.inputs?t.inputs.map(n=>K0.from(n,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[je]===ky}}class rr extends Ka{constructor(t,n,r,i,a){super(t,n,r);eu(this,"payable");eu(this,"gas");Object.defineProperty(this,je,{value:_y}),Ru(this,{payable:i,gas:a})}format(t){if(du(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const n=[`constructor${Yl(t,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(t){if(rr.isFragment(t))return t;if(typeof t=="string")try{return rr.from(Ri(t))}catch{V(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof Xt){mr(t,me(["constructor"]));const n=lr(t),r=!!mr(t,Hfu).has("payable"),i=YS(t);return Qa(t),new rr(f0,"constructor",n,r,i)}return new rr(f0,"constructor",t.inputs?t.inputs.map(K0.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[je]===_y}}class jn extends Ka{constructor(t,n,r){super(t,"fallback",n);eu(this,"payable");Object.defineProperty(this,je,{value:Sy}),Ru(this,{payable:r})}format(t){const n=this.inputs.length===0?"receive":"fallback";if(t==="json"){const r=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:r})}return`${n}()${this.payable?" payable":""}`}static from(t){if(jn.isFragment(t))return t;if(typeof t=="string")try{return jn.from(Ri(t))}catch{V(!1,"invalid fallback fragment","obj",t)}else if(t instanceof Xt){const n=t.toString(),r=t.peekKeyword(me(["fallback","receive"]));if(V(r,"type must be fallback or receive","obj",n),t.popKeyword(me(["fallback","receive"]))==="receive"){const o=lr(t);return V(o.length===0,"receive cannot have arguments","obj.inputs",o),mr(t,me(["payable"])),Qa(t),new jn(f0,[],!0)}let a=lr(t);a.length?V(a.length===1&&a[0].type==="bytes","invalid fallback inputs","obj.inputs",a.map(o=>o.format("minimal")).join(", ")):a=[K0.from("bytes")];const s=JS(t);if(V(s==="nonpayable"||s==="payable","fallback cannot be constants","obj.stateMutability",s),mr(t,me(["returns"])).has("returns")){const o=lr(t);V(o.length===1&&o[0].type==="bytes","invalid fallback outputs","obj.outputs",o.map(l=>l.format("minimal")).join(", "))}return Qa(t),new jn(f0,a,s==="payable")}if(t.type==="receive")return new jn(f0,[],!0);if(t.type==="fallback"){const n=[K0.from("bytes")],r=t.stateMutability==="payable";return new jn(f0,n,r)}V(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[je]===Sy}}class vn extends wd{constructor(t,n,r,i,a,s){super(t,"function",n,i);eu(this,"constant");eu(this,"outputs");eu(this,"stateMutability");eu(this,"payable");eu(this,"gas");Object.defineProperty(this,je,{value:Py}),a=Object.freeze(a.slice()),Ru(this,{constant:r==="view"||r==="pure",gas:s,outputs:a,payable:r==="payable",stateMutability:r})}get selector(){return Ga(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="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!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t))),outputs:this.outputs.map(r=>JSON.parse(r.format(t)))});const n=[];return t!=="sighash"&&n.push("function"),n.push(this.name+Yl(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(Yl(t,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(t,n){return n=(n||[]).map(i=>K0.from(i)),new vn(f0,t,"view",n,[],null).selector}static from(t){if(vn.isFragment(t))return t;if(typeof t=="string")try{return vn.from(Ri(t))}catch{V(!1,"invalid function fragment","obj",t)}else if(t instanceof Xt){const r=bd("function",t),i=lr(t),a=JS(t);let s=[];mr(t,me(["returns"])).has("returns")&&(s=lr(t));const o=YS(t);return Qa(t),new vn(f0,r,a,i,s,o)}let n=t.stateMutability;return n==null&&(n="payable",typeof t.constant=="boolean"?(n="view",t.constant||(n="payable",typeof t.payable=="boolean"&&!t.payable&&(n="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(n="nonpayable")),new vn(f0,t.name,n,t.inputs?t.inputs.map(K0.from):[],t.outputs?t.outputs.map(K0.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[je]===Py}}class Ra extends wd{constructor(u,t,n){super(u,"struct",t,n),Object.defineProperty(this,je,{value:Ty})}format(){throw new Error("@TODO")}static from(u){if(typeof u=="string")try{return Ra.from(Ri(u))}catch{V(!1,"invalid struct fragment","obj",u)}else if(u instanceof Xt){const t=bd("struct",u),n=lr(u);return Qa(u),new Ra(f0,t,n)}return new Ra(f0,u.name,u.inputs?u.inputs.map(K0.from):[])}static isFragment(u){return u&&u[je]===Ty}}const en=new Map;en.set(0,"GENERIC_PANIC");en.set(1,"ASSERT_FALSE");en.set(17,"OVERFLOW");en.set(18,"DIVIDE_BY_ZERO");en.set(33,"ENUM_RANGE_ERROR");en.set(34,"BAD_STORAGE_DATA");en.set(49,"STACK_UNDERFLOW");en.set(50,"ARRAY_RANGE_ERROR");en.set(65,"OUT_OF_MEMORY");en.set(81,"UNINITIALIZED_FUNCTION_CALL");const tpu=new RegExp(/^bytes([0-9]*)$/),npu=new RegExp(/^(u?int)([0-9]*)$/);let nf=null;function rpu(e,u,t,n){let r="missing revert data",i=null;const a=null;let s=null;if(t){r="execution reverted";const l=u0(t);if(t=Ou(t),l.length===0)r+=" (no data present; likely require(false) occurred",i="require(false)";else if(l.length%32!==4)r+=" (could not decode reason; invalid data length)";else if(Ou(l.slice(0,4))==="0x08c379a0")try{i=n.decode(["string"],l.slice(4))[0],s={signature:"Error(string)",name:"Error",args:[i]},r+=`: ${JSON.stringify(i)}`}catch{r+=" (could not decode reason; invalid string data)"}else if(Ou(l.slice(0,4))==="0x4e487b71")try{const c=Number(n.decode(["uint256"],l.slice(4))[0]);s={signature:"Panic(uint256)",name:"Panic",args:[c]},i=`Panic due to ${en.get(c)||"UNKNOWN"}(${c})`,r+=`: ${i}`}catch{r+=" (could not decode panic code)"}else r+=" (unknown custom error)"}const o={to:u.to?Zu(u.to):null,data:u.data||"0x"};return u.from&&(o.from=Zu(u.from)),_0(r,"CALL_EXCEPTION",{action:e,data:t,reason:i,transaction:o,invocation:a,revert:s})}var Vr,ys;const $2=class $2{constructor(){q(this,Vr)}getDefaultValue(u){const t=u.map(r=>cu(this,Vr,ys).call(this,K0.from(r)));return new GE(t,"_").defaultValue()}encode(u,t){V_(t.length,u.length,"types/values length mismatch");const n=u.map(a=>cu(this,Vr,ys).call(this,K0.from(a))),r=new GE(n,"_"),i=new P5;return r.encode(i,t),i.data}decode(u,t,n){const r=u.map(a=>cu(this,Vr,ys).call(this,K0.from(a)));return new GE(r,"_").decode(new T5(t,n))}static defaultAbiCoder(){return nf==null&&(nf=new $2),nf}static getBuiltinCallException(u,t,n){return rpu(u,t,n,$2.defaultAbiCoder())}};Vr=new WeakSet,ys=function(u){if(u.isArray())return new O6u(cu(this,Vr,ys).call(this,u.arrayChildren),u.arrayLength,u.name);if(u.isTuple())return new GE(u.components.map(n=>cu(this,Vr,ys).call(this,n)),u.name);switch(u.baseType){case"address":return new P6u(u.name);case"bool":return new I6u(u.name);case"string":return new W6u(u.name);case"bytes":return new N6u(u.name);case"":return new j6u(u.name)}let t=u.type.match(npu);if(t){let n=parseInt(t[2]||"256");return V(n!==0&&n<=256&&n%8===0,"invalid "+t[1]+" bit length","param",u),new $6u(n/8,t[1]==="int",u.name)}if(t=u.type.match(tpu),t){let n=parseInt(t[1]);return V(n!==0&&n<=32,"invalid bytes length","param",u),new R6u(n,u.name)}V(!1,"invalid type","type",u.type)};let Zl=$2;class ipu{constructor(u,t,n){eu(this,"fragment");eu(this,"name");eu(this,"signature");eu(this,"topic");eu(this,"args");const r=u.name,i=u.format();Ru(this,{fragment:u,name:r,signature:i,topic:t,args:n})}}class apu{constructor(u,t,n,r){eu(this,"fragment");eu(this,"name");eu(this,"args");eu(this,"signature");eu(this,"selector");eu(this,"value");const i=u.name,a=u.format();Ru(this,{fragment:u,name:i,args:n,signature:a,selector:t,value:r})}}class spu{constructor(u,t,n){eu(this,"fragment");eu(this,"name");eu(this,"args");eu(this,"signature");eu(this,"selector");const r=u.name,i=u.format();Ru(this,{fragment:u,name:r,args:n,signature:i,selector:t})}}class Oy{constructor(u){eu(this,"hash");eu(this,"_isIndexed");Ru(this,{hash:u,_isIndexed:!0})}static isIndexed(u){return!!(u&&u._isIndexed)}}const Iy={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},Ny={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:e=>`reverted with reason string ${JSON.stringify(e)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:e=>{let u="unknown panic code";return e>=0&&e<=255&&Iy[e.toString()]&&(u=Iy[e.toString()]),`reverted with panic code 0x${e.toString(16)} (${u})`}}};var pn,hn,Cn,te,M4,B9,L4,y9;const Ls=class Ls{constructor(u){q(this,M4);q(this,L4);eu(this,"fragments");eu(this,"deploy");eu(this,"fallback");eu(this,"receive");q(this,pn,void 0);q(this,hn,void 0);q(this,Cn,void 0);q(this,te,void 0);let t=[];typeof u=="string"?t=JSON.parse(u):t=u,T(this,Cn,new Map),T(this,pn,new Map),T(this,hn,new Map);const n=[];for(const a of t)try{n.push(Ka.from(a))}catch(s){console.log("EE",s)}Ru(this,{fragments:Object.freeze(n)});let r=null,i=!1;T(this,te,this.getAbiCoder()),this.fragments.forEach((a,s)=>{let o;switch(a.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Ru(this,{deploy:a});return;case"fallback":a.inputs.length===0?i=!0:(V(!r||a.payable!==r.payable,"conflicting fallback fragments",`fragments[${s}]`,a),r=a,i=r.payable);return;case"function":o=b(this,Cn);break;case"event":o=b(this,hn);break;case"error":o=b(this,pn);break;default:return}const l=a.format();o.has(l)||o.set(l,a)}),this.deploy||Ru(this,{deploy:rr.from("constructor()")}),Ru(this,{fallback:r,receive:i})}format(u){const t=u?"minimal":"full";return this.fragments.map(r=>r.format(t))}formatJson(){const u=this.fragments.map(t=>t.format("json"));return JSON.stringify(u.map(t=>JSON.parse(t)))}getAbiCoder(){return Zl.defaultAbiCoder()}getFunctionName(u){const t=cu(this,M4,B9).call(this,u,null,!1);return V(t,"no matching function","key",u),t.name}hasFunction(u){return!!cu(this,M4,B9).call(this,u,null,!1)}getFunction(u,t){return cu(this,M4,B9).call(this,u,t||null,!0)}forEachFunction(u){const t=Array.from(b(this,Cn).keys());t.sort((n,r)=>n.localeCompare(r));for(let n=0;nn.localeCompare(r));for(let n=0;n1){const i=r.map(a=>JSON.stringify(a.format())).join(", ");V(!1,`ambiguous error description (i.e. ${i})`,"name",u)}return r[0]}if(u=Se.from(u).format(),u==="Error(string)")return Se.from("error Error(string)");if(u==="Panic(uint256)")return Se.from("error Panic(uint256)");const n=b(this,pn).get(u);return n||null}forEachError(u){const t=Array.from(b(this,pn).keys());t.sort((n,r)=>n.localeCompare(r));for(let n=0;ni.type==="string"?Ga(a):i.type==="bytes"?p0(Ou(a)):(i.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":i.type.match(/^u?int/)?a=wi(a):i.type.match(/^bytes/)?a=r6u(a,32):i.type==="address"&&b(this,te).encode(["address"],[a]),Ha(Ou(a),32));for(t.forEach((i,a)=>{const s=u.inputs[a];if(!s.indexed){V(i==null,"cannot filter non-indexed parameters; must be null","contract."+s.name,i);return}i==null?n.push(null):s.baseType==="array"||s.baseType==="tuple"?V(!1,"filtering with tuples or arrays not supported","contract."+s.name,i):Array.isArray(i)?n.push(i.map(o=>r(s,o))):n.push(r(s,i))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(u,t){if(typeof u=="string"){const a=this.getEvent(u);V(a,"unknown event","eventFragment",u),u=a}const n=[],r=[],i=[];return u.anonymous||n.push(u.topicHash),V(t.length===u.inputs.length,"event arguments/values mismatch","values",t),u.inputs.forEach((a,s)=>{const o=t[s];if(a.indexed)if(a.type==="string")n.push(Ga(o));else if(a.type==="bytes")n.push(p0(o));else{if(a.baseType==="tuple"||a.baseType==="array")throw new Error("not implemented");n.push(b(this,te).encode([a.type],[o]))}else r.push(a),i.push(o)}),{data:b(this,te).encode(r,i),topics:n}}decodeEventLog(u,t,n){if(typeof u=="string"){const f=this.getEvent(u);V(f,"unknown event","eventFragment",u),u=f}if(n!=null&&!u.anonymous){const f=u.topicHash;V(h0(n[0],32)&&n[0].toLowerCase()===f,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const r=[],i=[],a=[];u.inputs.forEach((f,p)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(r.push(K0.from({type:"bytes32",name:f.name})),a.push(!0)):(r.push(f),a.push(!1)):(i.push(f),a.push(!1))});const s=n!=null?b(this,te).decode(r,R0(n)):null,o=b(this,te).decode(i,t,!0),l=[],c=[];let E=0,d=0;return u.inputs.forEach((f,p)=>{let h=null;if(f.indexed)if(s==null)h=new Oy(null);else if(a[p])h=new Oy(s[d++]);else try{h=s[d++]}catch(g){h=g}else try{h=o[E++]}catch(g){h=g}l.push(h),c.push(f.name||null)}),x2.fromItems(l,c)}parseTransaction(u){const t=u0(u.data,"tx.data"),n=Iu(u.value!=null?u.value:0,"tx.value"),r=this.getFunction(Ou(t.slice(0,4)));if(!r)return null;const i=b(this,te).decode(r.inputs,t.slice(4));return new apu(r,r.selector,i,n)}parseCallResult(u){throw new Error("@TODO")}parseLog(u){const t=this.getEvent(u.topics[0]);return!t||t.anonymous?null:new ipu(t,t.topicHash,this.decodeEventLog(t,u.data,u.topics))}parseError(u){const t=Ou(u),n=this.getError(A0(t,0,4));if(!n)return null;const r=b(this,te).decode(n.inputs,A0(t,4));return new spu(n,n.selector,r)}static from(u){return u instanceof Ls?u:typeof u=="string"?new Ls(JSON.parse(u)):typeof u.format=="function"?new Ls(u.format("json")):new Ls(u)}};pn=new WeakMap,hn=new WeakMap,Cn=new WeakMap,te=new WeakMap,M4=new WeakSet,B9=function(u,t,n){if(h0(u)){const i=u.toLowerCase();for(const a of b(this,Cn).values())if(i===a.selector)return a;return null}if(u.indexOf("(")===-1){const i=[];for(const[a,s]of b(this,Cn))a.split("(")[0]===u&&i.push(s);if(t){const a=t.length>0?t[t.length-1]:null;let s=t.length,o=!0;le.isTyped(a)&&a.type==="overrides"&&(o=!1,s--);for(let l=i.length-1;l>=0;l--){const c=i[l].inputs.length;c!==s&&(!o||c!==s-1)&&i.splice(l,1)}for(let l=i.length-1;l>=0;l--){const c=i[l].inputs;for(let E=0;E=c.length){if(t[E].type==="overrides")continue;i.splice(l,1);break}if(t[E].type!==c[E].baseType){i.splice(l,1);break}}}}if(i.length===1&&t&&t.length!==i[0].inputs.length){const a=t[t.length-1];(a==null||Array.isArray(a)||typeof a!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&n){const a=i.map(s=>JSON.stringify(s.format())).join(", ");V(!1,`ambiguous function description (i.e. matches ${a})`,"key",u)}return i[0]}const r=b(this,Cn).get(vn.from(u).format());return r||null},L4=new WeakSet,y9=function(u,t,n){if(h0(u)){const i=u.toLowerCase();for(const a of b(this,hn).values())if(i===a.topicHash)return a;return null}if(u.indexOf("(")===-1){const i=[];for(const[a,s]of b(this,hn))a.split("(")[0]===u&&i.push(s);if(t){for(let a=i.length-1;a>=0;a--)i[a].inputs.length=0;a--){const s=i[a].inputs;for(let o=0;o1&&n){const a=i.map(s=>JSON.stringify(s.format())).join(", ");V(!1,`ambiguous event description (i.e. matches ${a})`,"key",u)}return i[0]}const r=b(this,hn).get(Dn.from(u).format());return r||null};let U5=Ls;const ZS=BigInt(0);function Z3(e){return e??null}function ae(e){return e==null?null:e.toString()}class Ry{constructor(u,t,n){eu(this,"gasPrice");eu(this,"maxFeePerGas");eu(this,"maxPriorityFeePerGas");Ru(this,{gasPrice:Z3(u),maxFeePerGas:Z3(t),maxPriorityFeePerGas:Z3(n)})}toJSON(){const{gasPrice:u,maxFeePerGas:t,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:ae(u),maxFeePerGas:ae(t),maxPriorityFeePerGas:ae(n)}}}function I2(e){const u={};e.to&&(u.to=e.to),e.from&&(u.from=e.from),e.data&&(u.data=Ou(e.data));const t="chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const r of t)!(r in e)||e[r]==null||(u[r]=Iu(e[r],`request.${r}`));const n="type,nonce".split(/,/);for(const r of n)!(r in e)||e[r]==null||(u[r]=Gu(e[r],`request.${r}`));return e.accessList&&(u.accessList=is(e.accessList)),"blockTag"in e&&(u.blockTag=e.blockTag),"enableCcipRead"in e&&(u.enableCcipRead=!!e.enableCcipRead),"customData"in e&&(u.customData=e.customData),u}var Gn;class opu{constructor(u,t){eu(this,"provider");eu(this,"number");eu(this,"hash");eu(this,"timestamp");eu(this,"parentHash");eu(this,"nonce");eu(this,"difficulty");eu(this,"gasLimit");eu(this,"gasUsed");eu(this,"miner");eu(this,"extraData");eu(this,"baseFeePerGas");q(this,Gn,void 0);T(this,Gn,u.transactions.map(n=>typeof n!="string"?new Xl(n,t):n)),Ru(this,{provider:t,hash:Z3(u.hash),number:u.number,timestamp:u.timestamp,parentHash:u.parentHash,nonce:u.nonce,difficulty:u.difficulty,gasLimit:u.gasLimit,gasUsed:u.gasUsed,miner:u.miner,extraData:u.extraData,baseFeePerGas:Z3(u.baseFeePerGas)})}get transactions(){return b(this,Gn).map(u=>typeof u=="string"?u:u.hash)}get prefetchedTransactions(){const u=b(this,Gn).slice();return u.length===0?[]:(du(typeof u[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),u)}toJSON(){const{baseFeePerGas:u,difficulty:t,extraData:n,gasLimit:r,gasUsed:i,hash:a,miner:s,nonce:o,number:l,parentHash:c,timestamp:E,transactions:d}=this;return{_type:"Block",baseFeePerGas:ae(u),difficulty:ae(t),extraData:n,gasLimit:ae(r),gasUsed:ae(i),hash:a,miner:s,nonce:o,number:l,parentHash:c,timestamp:E,transactions:d}}[Symbol.iterator](){let u=0;const t=this.transactions;return{next:()=>unew lE(r,t))));let n=ZS;u.effectiveGasPrice!=null?n=u.effectiveGasPrice:u.gasPrice!=null&&(n=u.gasPrice),Ru(this,{provider:t,to:u.to,from:u.from,contractAddress:u.contractAddress,hash:u.hash,index:u.index,blockHash:u.blockHash,blockNumber:u.blockNumber,logsBloom:u.logsBloom,gasUsed:u.gasUsed,cumulativeGasUsed:u.cumulativeGasUsed,gasPrice:n,type:u.type,status:u.status,root:u.root})}get logs(){return b(this,Cc)}toJSON(){const{to:u,from:t,contractAddress:n,hash:r,index:i,blockHash:a,blockNumber:s,logsBloom:o,logs:l,status:c,root:E}=this;return{_type:"TransactionReceipt",blockHash:a,blockNumber:s,contractAddress:n,cumulativeGasUsed:ae(this.cumulativeGasUsed),from:t,gasPrice:ae(this.gasPrice),gasUsed:ae(this.gasUsed),hash:r,index:i,logs:l,logsBloom:o,root:E,status:c,to:u}}get length(){return this.logs.length}[Symbol.iterator](){let u=0;return{next:()=>u{if(s)return null;const{blockNumber:d,nonce:f}=await de({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(f{if(d==null||d.status!==0)return d;du(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},c=await this.provider.getTransactionReceipt(this.hash);if(n===0)return l(c);if(c){if(await c.confirmations()>=n)return l(c)}else if(await o(),n===0)return null;return await new Promise((d,f)=>{const p=[],h=()=>{p.forEach(A=>A())};if(p.push(()=>{s=!0}),r>0){const A=setTimeout(()=>{h(),f(_0("wait for transaction timeout","TIMEOUT"))},r);p.push(()=>{clearTimeout(A)})}const g=async A=>{if(await A.confirmations()>=n){h();try{d(l(A))}catch(m){f(m)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),i>=0){const A=async()=>{try{await o()}catch(m){if(Dt(m,"TRANSACTION_REPLACED")){h(),f(m);return}}s||this.provider.once("block",A)};p.push(()=>{this.provider.off("block",A)}),this.provider.once("block",A)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}removedEvent(){return du(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),eP(this)}reorderedEvent(u){return du(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),du(!u||u.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),uP(this,u)}replaceableTransaction(u){V(Number.isInteger(u)&&u>=0,"invalid startBlock","startBlock",u);const t=new mm(this,this.provider);return T(t,Jr,u),t}};Jr=new WeakMap;let Xl=mm;function lpu(e){return{orphan:"drop-block",hash:e.hash,number:e.number}}function uP(e,u){return{orphan:"reorder-transaction",tx:e,other:u}}function eP(e){return{orphan:"drop-transaction",tx:e}}function cpu(e){return{orphan:"drop-log",log:{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,address:e.address,data:e.data,topics:Object.freeze(e.topics.slice()),index:e.index}}}class cm extends lE{constructor(t,n,r){super(t,t.provider);eu(this,"interface");eu(this,"fragment");eu(this,"args");const i=n.decodeEventLog(r,t.data,t.topics);Ru(this,{args:i,fragment:r,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class tP extends lE{constructor(t,n){super(t,t.provider);eu(this,"error");Ru(this,{error:n})}}var U4;class Epu extends XS{constructor(t,n,r){super(r,n);q(this,U4,void 0);T(this,U4,t)}get logs(){return super.logs.map(t=>{const n=t.topics.length?b(this,U4).getEvent(t.topics[0]):null;if(n)try{return new cm(t,b(this,U4),n)}catch(r){return new tP(t,r)}return t})}}U4=new WeakMap;var mc;class Em extends Xl{constructor(t,n,r){super(r,n);q(this,mc,void 0);T(this,mc,t)}async wait(t){const n=await super.wait(t);return n==null?null:new Epu(b(this,mc),this.provider,n)}}mc=new WeakMap;class nP extends X_{constructor(t,n,r,i){super(t,n,r);eu(this,"log");Ru(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class dpu extends nP{constructor(u,t,n,r,i){super(u,t,n,new cm(i,u.interface,r));const a=u.interface.decodeEventLog(r,this.log.data,this.log.topics);Ru(this,{args:a,fragment:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const zy=BigInt(0);function rP(e){return e&&typeof e.call=="function"}function iP(e){return e&&typeof e.estimateGas=="function"}function xd(e){return e&&typeof e.resolveName=="function"}function aP(e){return e&&typeof e.sendTransaction=="function"}function sP(e){if(e!=null){if(xd(e))return e;if(e.provider)return e.provider}}var Ac;class fpu{constructor(u,t,n){q(this,Ac,void 0);eu(this,"fragment");if(Ru(this,{fragment:t}),t.inputs.lengthn[o]==null?null:s.walkAsync(n[o],(c,E)=>c==="address"?Array.isArray(E)?Promise.all(E.map(d=>Ce(d,i))):Ce(E,i):E)));return u.interface.encodeFilterTopics(t,a)}())}getTopicFilter(){return b(this,Ac)}}Ac=new WeakMap;function Va(e,u){return e==null?null:typeof e[u]=="function"?e:e.provider&&typeof e.provider[u]=="function"?e.provider:null}function ua(e){return e==null?null:e.provider||null}async function oP(e,u){const t=le.dereference(e,"overrides");V(typeof t=="object","invalid overrides parameter","overrides",e);const n=I2(t);return V(n.to==null||(u||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),V(n.data==null||(u||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function ppu(e,u,t){const n=Va(e,"resolveName"),r=xd(n)?n:null;return await Promise.all(u.map((i,a)=>i.walkAsync(t[a],(s,o)=>(o=le.dereference(o,s),s==="address"?Ce(o,r):o))))}function hpu(e){const u=async function(a){const s=await oP(a,["data"]);s.to=await e.getAddress(),s.from&&(s.from=await Ce(s.from,sP(e.runner)));const o=e.interface,l=Iu(s.value||zy,"overrides.value")===zy,c=(s.data||"0x")==="0x";o.fallback&&!o.fallback.payable&&o.receive&&!c&&!l&&V(!1,"cannot send data to receive or send value to non-payable fallback","overrides",a),V(o.fallback||c,"cannot send data to receive-only contract","overrides.data",s.data);const E=o.receive||o.fallback&&o.fallback.payable;return V(E||l,"cannot send value to non-payable fallback","overrides.value",s.value),V(o.fallback||c,"cannot send data to receive-only contract","overrides.data",s.data),s},t=async function(a){const s=Va(e.runner,"call");du(rP(s),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const o=await u(a);try{return await s.call(o)}catch(l){throw em(l)&&l.data?e.interface.makeError(l.data,o):l}},n=async function(a){const s=e.runner;du(aP(s),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const o=await s.sendTransaction(await u(a)),l=ua(e.runner);return new Em(e.interface,l,o)},r=async function(a){const s=Va(e.runner,"estimateGas");return du(iP(s),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await s.estimateGas(await u(a))},i=async a=>await n(a);return Ru(i,{_contract:e,estimateGas:r,populateTransaction:u,send:n,staticCall:t}),i}function Cpu(e,u){const t=function(...l){const c=e.interface.getFunction(u,l);return du(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:u,args:l}}),c},n=async function(...l){const c=t(...l);let E={};if(c.inputs.length+1===l.length&&(E=await oP(l.pop()),E.from&&(E.from=await Ce(E.from,sP(e.runner)))),c.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await ppu(e.runner,c.inputs,l);return Object.assign({},E,await de({to:e.getAddress(),data:e.interface.encodeFunctionData(c,d)}))},r=async function(...l){const c=await s(...l);return c.length===1?c[0]:c},i=async function(...l){const c=e.runner;du(aP(c),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const E=await c.sendTransaction(await n(...l)),d=ua(e.runner);return new Em(e.interface,d,E)},a=async function(...l){const c=Va(e.runner,"estimateGas");return du(iP(c),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await c.estimateGas(await n(...l))},s=async function(...l){const c=Va(e.runner,"call");du(rP(c),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const E=await n(...l);let d="0x";try{d=await c.call(E)}catch(p){throw em(p)&&p.data?e.interface.makeError(p.data,E):p}const f=t(...l);return e.interface.decodeFunctionResult(f,d)},o=async(...l)=>t(...l).constant?await r(...l):await i(...l);return Ru(o,{name:e.interface.getFunctionName(u),_contract:e,_key:u,getFragment:t,estimateGas:a,populateTransaction:n,send:i,staticCall:r,staticCallResult:s}),Object.defineProperty(o,"fragment",{configurable:!1,enumerable:!0,get:()=>{const l=e.interface.getFunction(u);return du(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:u}}),l}}),o}function mpu(e,u){const t=function(...r){const i=e.interface.getEvent(u,r);return du(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:u,args:r}}),i},n=function(...r){return new fpu(e,t(...r),r)};return Ru(n,{name:e.interface.getEventName(u),_contract:e,_key:u,getFragment:t}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const r=e.interface.getEvent(u);return du(r,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:u}}),r}}),n}const N2=Symbol.for("_ethersInternal_contract"),lP=new WeakMap;function Apu(e,u){lP.set(e[N2],u)}function Ue(e){return lP.get(e[N2])}function gpu(e){return e&&typeof e=="object"&&"getTopicFilter"in e&&typeof e.getTopicFilter=="function"&&e.fragment}async function dm(e,u){let t,n=null;if(Array.isArray(u)){const i=function(a){if(h0(a,32))return a;const s=e.interface.getEvent(a);return V(s,"unknown fragment","name",a),s.topicHash};t=u.map(a=>a==null?null:Array.isArray(a)?a.map(i):i(a))}else u==="*"?t=[null]:typeof u=="string"?h0(u,32)?t=[u]:(n=e.interface.getEvent(u),V(n,"unknown fragment","event",u),t=[n.topicHash]):gpu(u)?t=await u.getTopicFilter():"fragment"in u?(n=u.fragment,t=[n.topicHash]):V(!1,"unknown event name","event",u);t=t.map(i=>{if(i==null)return null;if(Array.isArray(i)){const a=Array.from(new Set(i.map(s=>s.toLowerCase())).values());return a.length===1?a[0]:(a.sort(),a)}return i.toLowerCase()});const r=t.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:n,tag:r,topics:t}}async function R3(e,u){const{subs:t}=Ue(e);return t.get((await dm(e,u)).tag)||null}async function jy(e,u,t){const n=ua(e.runner);du(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:u});const{fragment:r,tag:i,topics:a}=await dm(e,t),{addr:s,subs:o}=Ue(e);let l=o.get(i);if(!l){const E={address:s||e,topics:a},d=g=>{let A=r;if(A==null)try{A=e.interface.getEvent(g.topics[0])}catch{}if(A){const m=A,B=r?e.interface.decodeEventLog(r,g.data,g.topics):[];W5(e,t,B,F=>new dpu(e,F,t,m,g))}else W5(e,t,[],m=>new nP(e,m,t,g))};let f=[];l={tag:i,listeners:[],start:()=>{f.length||f.push(n.on(E,d))},stop:async()=>{if(f.length==0)return;let g=f;f=[],await Promise.all(g),n.off(E,d)}},o.set(i,l)}return l}let $5=Promise.resolve();async function Bpu(e,u,t,n){await $5;const r=await R3(e,u);if(!r)return!1;const i=r.listeners.length;return r.listeners=r.listeners.filter(({listener:a,once:s})=>{const o=Array.from(t);n&&o.push(n(s?null:a));try{a.call(e,...o)}catch{}return!s}),r.listeners.length===0&&(r.stop(),Ue(e).subs.delete(r.tag)),i>0}async function W5(e,u,t,n){try{await $5}catch{}const r=Bpu(e,u,t,n);return $5=r,await r}const QE=["then"];var g5u;const ul=class ul{constructor(u,t,n,r){eu(this,"target");eu(this,"interface");eu(this,"runner");eu(this,"filters");eu(this,g5u);eu(this,"fallback");V(typeof u=="string"||ES(u),"invalid value for Contract target","target",u),n==null&&(n=null);const i=U5.from(t);Ru(this,{target:u,runner:n,interface:i}),Object.defineProperty(this,N2,{value:{}});let a,s=null,o=null;if(r){const E=ua(n);o=new Em(this.interface,E,r)}let l=new Map;if(typeof u=="string")if(h0(u))s=u,a=Promise.resolve(u);else{const E=Va(n,"resolveName");if(!xd(E))throw _0("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=E.resolveName(u).then(d=>{if(d==null)throw _0("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:u});return Ue(this).addr=d,d})}else a=u.getAddress().then(E=>{if(E==null)throw new Error("TODO");return Ue(this).addr=E,E});Apu(this,{addrPromise:a,addr:s,deployTx:o,subs:l});const c=new Proxy({},{get:(E,d,f)=>{if(typeof d=="symbol"||QE.indexOf(d)>=0)return Reflect.get(E,d,f);try{return this.getEvent(d)}catch(p){if(!Dt(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(E,d)=>QE.indexOf(d)>=0?Reflect.has(E,d):Reflect.has(E,d)||this.interface.hasEvent(String(d))});return Ru(this,{filters:c}),Ru(this,{fallback:i.receive||i.fallback?hpu(this):null}),new Proxy(this,{get:(E,d,f)=>{if(typeof d=="symbol"||d in E||QE.indexOf(d)>=0)return Reflect.get(E,d,f);try{return E.getFunction(d)}catch(p){if(!Dt(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(E,d)=>typeof d=="symbol"||d in E||QE.indexOf(d)>=0?Reflect.has(E,d):E.interface.hasFunction(d)})}connect(u){return new ul(this.target,this.interface,u)}attach(u){return new ul(u,this.interface,this.runner)}async getAddress(){return await Ue(this).addrPromise}async getDeployedCode(){const u=ua(this.runner);du(u,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await u.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const u=this.deploymentTransaction();if(u)return await u.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=ua(this.runner);return du(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((r,i)=>{const a=async()=>{try{if(await this.getDeployedCode()!=null)return r(this);n.once("block",a)}catch(s){i(s)}};a()})}deploymentTransaction(){return Ue(this).deployTx}getFunction(u){return typeof u!="string"&&(u=u.format()),Cpu(this,u)}getEvent(u){return typeof u!="string"&&(u=u.format()),mpu(this,u)}async queryTransaction(u){throw new Error("@TODO")}async queryFilter(u,t,n){t==null&&(t=0),n==null&&(n="latest");const{addr:r,addrPromise:i}=Ue(this),a=r||await i,{fragment:s,topics:o}=await dm(this,u),l={address:a,topics:o,fromBlock:t,toBlock:n},c=ua(this.runner);return du(c,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await c.getLogs(l)).map(E=>{let d=s;if(d==null)try{d=this.interface.getEvent(E.topics[0])}catch{}if(d)try{return new cm(E,this.interface,d)}catch(f){return new tP(E,f)}return new lE(E,c)})}async on(u,t){const n=await jy(this,"on",u);return n.listeners.push({listener:t,once:!1}),n.start(),this}async once(u,t){const n=await jy(this,"once",u);return n.listeners.push({listener:t,once:!0}),n.start(),this}async emit(u,...t){return await W5(this,u,t,null)}async listenerCount(u){if(u){const r=await R3(this,u);return r?r.listeners.length:0}const{subs:t}=Ue(this);let n=0;for(const{listeners:r}of t.values())n+=r.length;return n}async listeners(u){if(u){const r=await R3(this,u);return r?r.listeners.map(({listener:i})=>i):[]}const{subs:t}=Ue(this);let n=[];for(const{listeners:r}of t.values())n=n.concat(r.map(({listener:i})=>i));return n}async off(u,t){const n=await R3(this,u);if(!n)return this;if(t){const r=n.listeners.map(({listener:i})=>i).indexOf(t);r>=0&&n.listeners.splice(r,1)}return(t==null||n.listeners.length===0)&&(n.stop(),Ue(this).subs.delete(n.tag)),this}async removeAllListeners(u){if(u){const t=await R3(this,u);if(!t)return this;t.stop(),Ue(this).subs.delete(t.tag)}else{const{subs:t}=Ue(this);for(const{tag:n,stop:r}of t.values())r(),t.delete(n)}return this}async addListener(u,t){return await this.on(u,t)}async removeListener(u,t){return await this.off(u,t)}static buildClass(u){class t extends ul{constructor(r,i=null){super(r,u,i)}}return t}static from(u,t,n){return n==null&&(n=null),new this(u,t,n)}};g5u=N2;let q5=ul;function ypu(){return q5}let u4=class extends ypu(){};function rf(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):V(!1,"unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}class Fpu{constructor(u){eu(this,"name");Ru(this,{name:u})}connect(u){return this}supportsCoinType(u){return!1}async encodeAddress(u,t){throw new Error("unsupported coin")}async decodeAddress(u,t){throw new Error("unsupported coin")}}const cP=new RegExp("^(ipfs)://(.*)$","i"),My=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),cP,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var Yr,ga,Zr,Fs,W2,EP;const Us=class Us{constructor(u,t,n){q(this,Zr);eu(this,"provider");eu(this,"address");eu(this,"name");q(this,Yr,void 0);q(this,ga,void 0);Ru(this,{provider:u,address:t,name:n}),T(this,Yr,null),T(this,ga,new u4(t,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],u))}async supportsWildcard(){return b(this,Yr)==null&&T(this,Yr,(async()=>{try{return await b(this,ga).supportsInterface("0x9061b923")}catch(u){if(Dt(u,"CALL_EXCEPTION"))return!1;throw T(this,Yr,null),u}})()),await b(this,Yr)}async getAddress(u){if(u==null&&(u=60),u===60)try{const i=await cu(this,Zr,Fs).call(this,"addr(bytes32)");return i==null||i===O5?null:i}catch(i){if(Dt(i,"CALL_EXCEPTION"))return null;throw i}if(u>=0&&u<2147483648){let i=u+2147483648;const a=await cu(this,Zr,Fs).call(this,"addr(bytes32,uint)",[i]);if(h0(a,20))return Zu(a)}let t=null;for(const i of this.provider.plugins)if(i instanceof Fpu&&i.supportsCoinType(u)){t=i;break}if(t==null)return null;const n=await cu(this,Zr,Fs).call(this,"addr(bytes32,uint)",[u]);if(n==null||n==="0x")return null;const r=await t.decodeAddress(u,n);if(r!=null)return r;du(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${u})`,info:{coinType:u,data:n}})}async getText(u){const t=await cu(this,Zr,Fs).call(this,"text(bytes32,string)",[u]);return t==null||t==="0x"?null:t}async getContentHash(){const u=await cu(this,Zr,Fs).call(this,"contenthash(bytes32)");if(u==null||u==="0x")return null;const t=u.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const r=t[1]==="e3010170"?"ipfs":"ipns",i=parseInt(t[4],16);if(t[5].length===i*2)return`${r}://${o6u("0x"+t[2])}`}const n=u.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;du(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:u}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const u=[{type:"name",value:this.name}];try{const t=await this.getText("avatar");if(t==null)return u.push({type:"!avatar",value:""}),{url:null,linkage:u};u.push({type:"avatar",value:t});for(let n=0;n{if(!Array.isArray(u))throw new Error("not an array");return u.map(t=>e(t))}}function cE(e,u){return t=>{const n={};for(const r in e){let i=r;if(u&&r in u&&!(i in t)){for(const a of u[r])if(a in t){i=a;break}}try{const a=e[r](t[i]);a!==void 0&&(n[r]=a)}catch(a){const s=a instanceof Error?a.message:"not-an-error";du(!1,`invalid value for value.${r} (${s})`,"BAD_DATA",{value:t})}}return n}}function Dpu(e){switch(e){case!0:case"true":return!0;case!1:case"false":return!1}V(!1,`invalid boolean; ${JSON.stringify(e)}`,"value",e)}function _o(e){return V(h0(e,!0),"invalid data","value",e),e}function vt(e){return V(h0(e,32),"invalid hash","value",e),e}const vpu=cE({address:Zu,blockHash:vt,blockNumber:Gu,data:_o,index:Gu,removed:c0(Dpu,!1),topics:fm(vt),transactionHash:vt,transactionIndex:Gu},{index:["logIndex"]});function bpu(e){return vpu(e)}const wpu=cE({hash:c0(vt),parentHash:vt,number:Gu,timestamp:Gu,nonce:c0(_o),difficulty:Iu,gasLimit:Iu,gasUsed:Iu,miner:c0(Zu),extraData:_o,baseFeePerGas:c0(Iu)});function xpu(e){const u=wpu(e);return u.transactions=e.transactions.map(t=>typeof t=="string"?t:dP(t)),u}const kpu=cE({transactionIndex:Gu,blockNumber:Gu,transactionHash:vt,address:Zu,topics:fm(vt),data:_o,index:Gu,blockHash:vt},{index:["logIndex"]});function _pu(e){return kpu(e)}const Spu=cE({to:c0(Zu,null),from:c0(Zu,null),contractAddress:c0(Zu,null),index:Gu,root:c0(Ou),gasUsed:Iu,logsBloom:c0(_o),blockHash:vt,hash:vt,logs:fm(_pu),blockNumber:Gu,cumulativeGasUsed:Iu,effectiveGasPrice:c0(Iu),status:c0(Gu),type:c0(Gu,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function Ppu(e){return Spu(e)}function dP(e){e.to&&Iu(e.to)===Ly&&(e.to="0x0000000000000000000000000000000000000000");const u=cE({hash:vt,type:t=>t==="0x"||t==null?0:Gu(t),accessList:c0(is,null),blockHash:c0(vt,null),blockNumber:c0(Gu,null),transactionIndex:c0(Gu,null),from:Zu,gasPrice:c0(Iu),maxPriorityFeePerGas:c0(Iu),maxFeePerGas:c0(Iu),gasLimit:Iu,to:c0(Zu,null),value:Iu,nonce:Gu,data:_o,creates:c0(Zu,null),chainId:c0(Iu,null)},{data:["input"],gasLimit:["gas"]})(e);if(u.to==null&&u.creates==null&&(u.creates=S6u(u)),(e.type===1||e.type===2)&&e.accessList==null&&(u.accessList=[]),e.signature?u.signature=Zt.from(e.signature):u.signature=Zt.from(e),u.chainId==null){const t=u.signature.legacyChainId;t!=null&&(u.chainId=t)}return u.blockHash&&Iu(u.blockHash)===Ly&&(u.blockHash=null),u}const Tpu="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class EE{constructor(u){eu(this,"name");Ru(this,{name:u})}clone(){return new EE(this.name)}}class kd extends EE{constructor(t,n){t==null&&(t=0);super(`org.ethers.network.plugins.GasCost#${t||0}`);eu(this,"effectiveBlock");eu(this,"txBase");eu(this,"txCreate");eu(this,"txDataZero");eu(this,"txDataNonzero");eu(this,"txAccessListStorageKey");eu(this,"txAccessListAddress");const r={effectiveBlock:t};function i(a,s){let o=(n||{})[a];o==null&&(o=s),V(typeof o=="number",`invalud value for ${a}`,"costs",n),r[a]=o}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Ru(this,r)}clone(){return new kd(this.effectiveBlock,this)}}class _d extends EE{constructor(t,n){super("org.ethers.plugins.network.Ens");eu(this,"address");eu(this,"targetNetwork");Ru(this,{address:t||Tpu,targetNetwork:n??1})}clone(){return new _d(this.address,this.targetNetwork)}}var gc,Bc;class fP extends EE{constructor(t,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");q(this,gc,void 0);q(this,Bc,void 0);T(this,gc,t),T(this,Bc,n)}get url(){return b(this,gc)}get processFunc(){return b(this,Bc)}clone(){return this}}gc=new WeakMap,Bc=new WeakMap;const af=new Map;var $4,W4,Xr;const $s=class $s{constructor(u,t){q(this,$4,void 0);q(this,W4,void 0);q(this,Xr,void 0);T(this,$4,u),T(this,W4,Iu(t)),T(this,Xr,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return b(this,$4)}set name(u){T(this,$4,u)}get chainId(){return b(this,W4)}set chainId(u){T(this,W4,Iu(u,"chainId"))}matches(u){if(u==null)return!1;if(typeof u=="string"){try{return this.chainId===Iu(u)}catch{}return this.name===u}if(typeof u=="number"||typeof u=="bigint"){try{return this.chainId===Iu(u)}catch{}return!1}if(typeof u=="object"){if(u.chainId!=null){try{return this.chainId===Iu(u.chainId)}catch{}return!1}return u.name!=null?this.name===u.name:!1}return!1}get plugins(){return Array.from(b(this,Xr).values())}attachPlugin(u){if(b(this,Xr).get(u.name))throw new Error(`cannot replace existing plugin: ${u.name} `);return b(this,Xr).set(u.name,u.clone()),this}getPlugin(u){return b(this,Xr).get(u)||null}getPlugins(u){return this.plugins.filter(t=>t.name.split("#")[0]===u)}clone(){const u=new $s(this.name,this.chainId);return this.plugins.forEach(t=>{u.attachPlugin(t.clone())}),u}computeIntrinsicGas(u){const t=this.getPlugin("org.ethers.plugins.network.GasCost")||new kd;let n=t.txBase;if(u.to==null&&(n+=t.txCreate),u.data)for(let r=2;r9){let r=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||r++,n[1]=r.toString()}return BigInt(n[0]+n[1])}function $y(e){return new fP(e,async(u,t,n)=>{n.setHeader("User-Agent","ethers");let r;try{const[i,a]=await Promise.all([n.send(),u()]);r=i;const s=r.bodyJson.standard;return{gasPrice:a.gasPrice,maxFeePerGas:Uy(s.maxFee,9),maxPriorityFeePerGas:Uy(s.maxPriorityFee,9)}}catch(i){du(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:r,error:i})}})}function Opu(e){return new fP("data:",async(u,t,n)=>{const r=await u();if(r.maxFeePerGas==null||r.maxPriorityFeePerGas==null)return r;const i=r.maxFeePerGas-r.maxPriorityFeePerGas;return{gasPrice:r.gasPrice,maxFeePerGas:i+e,maxPriorityFeePerGas:e}})}let Wy=!1;function Ipu(){if(Wy)return;Wy=!0;function e(u,t,n){const r=function(){const i=new ir(u,t);return n.ensNetwork!=null&&i.attachPlugin(new _d(null,n.ensNetwork)),i.attachPlugin(new kd),(n.plugins||[]).forEach(a=>{i.attachPlugin(a)}),i};ir.register(u,r),ir.register(t,r),n.altNames&&n.altNames.forEach(i=>{ir.register(i,r)})}e("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),e("ropsten",3,{ensNetwork:3}),e("rinkeby",4,{ensNetwork:4}),e("goerli",5,{ensNetwork:5}),e("kovan",42,{ensNetwork:42}),e("sepolia",11155111,{ensNetwork:11155111}),e("classic",61,{}),e("classicKotti",6,{}),e("arbitrum",42161,{ensNetwork:1}),e("arbitrum-goerli",421613,{}),e("bnb",56,{ensNetwork:1}),e("bnbt",97,{}),e("linea",59144,{ensNetwork:1}),e("linea-goerli",59140,{}),e("matic",137,{ensNetwork:1,plugins:[$y("https://gasstation.polygon.technology/v2")]}),e("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[$y("https://gasstation-testnet.polygon.technology/v2")]}),e("optimism",10,{ensNetwork:1,plugins:[Opu(BigInt("1000000"))]}),e("optimism-goerli",420,{}),e("xdai",100,{ensNetwork:1})}function H5(e){return JSON.parse(JSON.stringify(e))}var Qn,dt,ui,mn,q4,F9;class Npu{constructor(u){q(this,q4);q(this,Qn,void 0);q(this,dt,void 0);q(this,ui,void 0);q(this,mn,void 0);T(this,Qn,u),T(this,dt,null),T(this,ui,4e3),T(this,mn,-2)}get pollingInterval(){return b(this,ui)}set pollingInterval(u){T(this,ui,u)}start(){b(this,dt)||(T(this,dt,b(this,Qn)._setTimeout(cu(this,q4,F9).bind(this),b(this,ui))),cu(this,q4,F9).call(this))}stop(){b(this,dt)&&(b(this,Qn)._clearTimeout(b(this,dt)),T(this,dt,null))}pause(u){this.stop(),u&&T(this,mn,-2)}resume(){this.start()}}Qn=new WeakMap,dt=new WeakMap,ui=new WeakMap,mn=new WeakMap,q4=new WeakSet,F9=async function(){try{const u=await b(this,Qn).getBlockNumber();if(b(this,mn)===-2){T(this,mn,u);return}if(u!==b(this,mn)){for(let t=b(this,mn)+1;t<=u;t++){if(b(this,dt)==null)return;await b(this,Qn).emit("block",t)}T(this,mn,u)}}catch{}b(this,dt)!=null&&T(this,dt,b(this,Qn)._setTimeout(cu(this,q4,F9).bind(this),b(this,ui)))};var Ba,ya,ei;class pP{constructor(u){q(this,Ba,void 0);q(this,ya,void 0);q(this,ei,void 0);T(this,Ba,u),T(this,ei,!1),T(this,ya,t=>{this._poll(t,b(this,Ba))})}async _poll(u,t){throw new Error("sub-classes must override this")}start(){b(this,ei)||(T(this,ei,!0),b(this,ya).call(this,-2),b(this,Ba).on("block",b(this,ya)))}stop(){b(this,ei)&&(T(this,ei,!1),b(this,Ba).off("block",b(this,ya)))}pause(u){this.stop()}resume(){this.start()}}Ba=new WeakMap,ya=new WeakMap,ei=new WeakMap;var q2;class Rpu extends pP{constructor(t,n){super(t);q(this,q2,void 0);T(this,q2,H5(n))}async _poll(t,n){throw new Error("@TODO")}}q2=new WeakMap;var H4;class zpu extends pP{constructor(t,n){super(t);q(this,H4,void 0);T(this,H4,n)}async _poll(t,n){const r=await n.getTransactionReceipt(b(this,H4));r&&n.emit(b(this,H4),r)}}H4=new WeakMap;var Kn,G4,Q4,ti,ft,H2,hP;class pm{constructor(u,t){q(this,H2);q(this,Kn,void 0);q(this,G4,void 0);q(this,Q4,void 0);q(this,ti,void 0);q(this,ft,void 0);T(this,Kn,u),T(this,G4,H5(t)),T(this,Q4,cu(this,H2,hP).bind(this)),T(this,ti,!1),T(this,ft,-2)}start(){b(this,ti)||(T(this,ti,!0),b(this,ft)===-2&&b(this,Kn).getBlockNumber().then(u=>{T(this,ft,u)}),b(this,Kn).on("block",b(this,Q4)))}stop(){b(this,ti)&&(T(this,ti,!1),b(this,Kn).off("block",b(this,Q4)))}pause(u){this.stop(),u&&T(this,ft,-2)}resume(){this.start()}}Kn=new WeakMap,G4=new WeakMap,Q4=new WeakMap,ti=new WeakMap,ft=new WeakMap,H2=new WeakSet,hP=async function(u){if(b(this,ft)===-2)return;const t=H5(b(this,G4));t.fromBlock=b(this,ft)+1,t.toBlock=u;const n=await b(this,Kn).getLogs(t);if(n.length===0){b(this,ft){if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const r=Object.keys(n);return r.sort(),r.reduce((i,a)=>(i[a]=n[a],i),{})}return n})}class CP{constructor(u){eu(this,"name");Ru(this,{name:u})}start(){}stop(){}pause(u){}resume(){}}function Lpu(e){return JSON.parse(JSON.stringify(e))}function G5(e){return e=Array.from(new Set(e).values()),e.sort(),e}async function sf(e,u){if(e==null)throw new Error("invalid event");if(Array.isArray(e)&&(e={topics:e}),typeof e=="string")switch(e){case"block":case"pending":case"debug":case"error":case"network":return{type:e,tag:e}}if(h0(e,32)){const t=e.toLowerCase();return{type:"transaction",tag:D9("tx",{hash:t}),hash:t}}if(e.orphan){const t=e;return{type:"orphan",tag:D9("orphan",t),filter:Lpu(t)}}if(e.address||e.topics){const t=e,n={topics:(t.topics||[]).map(r=>r==null?null:Array.isArray(r)?G5(r.map(i=>i.toLowerCase())):r.toLowerCase())};if(t.address){const r=[],i=[],a=s=>{h0(s)?r.push(s):i.push((async()=>{r.push(await Ce(s,u))})())};Array.isArray(t.address)?t.address.forEach(a):a(t.address),i.length&&await Promise.all(i),n.address=G5(r.map(s=>s.toLowerCase()))}return{filter:n,tag:D9("event",n),type:"event"}}V(!1,"unknown ProviderEvent","event",e)}function of(){return new Date().getTime()}const Upu={cacheTimeout:250,pollingInterval:4e3};var ne,ni,re,K4,He,Fa,ri,Vn,yc,pt,V4,J4,ve,rt,Fc,Q5,Dc,K5,Da,z3,vc,V5,va,j3,Y4,v9;class $pu{constructor(u,t){q(this,ve);q(this,Fc);q(this,Dc);q(this,Da);q(this,vc);q(this,va);q(this,Y4);q(this,ne,void 0);q(this,ni,void 0);q(this,re,void 0);q(this,K4,void 0);q(this,He,void 0);q(this,Fa,void 0);q(this,ri,void 0);q(this,Vn,void 0);q(this,yc,void 0);q(this,pt,void 0);q(this,V4,void 0);q(this,J4,void 0);if(T(this,J4,Object.assign({},Upu,t||{})),u==="any")T(this,Fa,!0),T(this,He,null);else if(u){const n=ir.from(u);T(this,Fa,!1),T(this,He,Promise.resolve(n)),setTimeout(()=>{this.emit("network",n,null)},0)}else T(this,Fa,!1),T(this,He,null);T(this,Vn,-1),T(this,ri,new Map),T(this,ne,new Map),T(this,ni,new Map),T(this,re,null),T(this,K4,!1),T(this,yc,1),T(this,pt,new Map),T(this,V4,!1)}get pollingInterval(){return b(this,J4).pollingInterval}get provider(){return this}get plugins(){return Array.from(b(this,ni).values())}attachPlugin(u){if(b(this,ni).get(u.name))throw new Error(`cannot replace existing plugin: ${u.name} `);return b(this,ni).set(u.name,u.connect(this)),this}getPlugin(u){return b(this,ni).get(u)||null}get disableCcipRead(){return b(this,V4)}set disableCcipRead(u){T(this,V4,!!u)}async ccipReadFetch(u,t,n){if(this.disableCcipRead||n.length===0||u.to==null)return null;const r=u.to.toLowerCase(),i=t.toLowerCase(),a=[];for(let s=0;s=500,`response not found during CCIP fetch: ${E}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:u,info:{url:o,errorMessage:E}}),a.push(E)}du(!1,`error encountered during CCIP fetch: ${a.map(s=>JSON.stringify(s)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:u,info:{urls:n,errorMessages:a}})}_wrapBlock(u,t){return new opu(xpu(u),this)}_wrapLog(u,t){return new lE(bpu(u),this)}_wrapTransactionReceipt(u,t){return new XS(Ppu(u),this)}_wrapTransactionResponse(u,t){return new Xl(dP(u),this)}_detectNetwork(){du(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(u){du(!1,`unsupported method: ${u.method}`,"UNSUPPORTED_OPERATION",{operation:u.method,info:u})}async getBlockNumber(){const u=Gu(await cu(this,ve,rt).call(this,{method:"getBlockNumber"}),"%response");return b(this,Vn)>=0&&T(this,Vn,u),u}_getAddress(u){return Ce(u,this)}_getBlockTag(u){if(u==null)return"latest";switch(u){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return u}if(h0(u))return h0(u,32)?u:js(u);if(typeof u=="bigint"&&(u=Gu(u,"blockTag")),typeof u=="number")return u>=0?js(u):b(this,Vn)>=0?js(b(this,Vn)+u):this.getBlockNumber().then(t=>js(t+u));V(!1,"invalid blockTag","blockTag",u)}_getFilter(u){const t=(u.topics||[]).map(o=>o==null?null:Array.isArray(o)?G5(o.map(l=>l.toLowerCase())):o.toLowerCase()),n="blockHash"in u?u.blockHash:void 0,r=(o,l,c)=>{let E;switch(o.length){case 0:break;case 1:E=o[0];break;default:o.sort(),E=o}if(n&&(l!=null||c!=null))throw new Error("invalid filter");const d={};return E&&(d.address=E),t.length&&(d.topics=t),l&&(d.fromBlock=l),c&&(d.toBlock=c),n&&(d.blockHash=n),d};let i=[];if(u.address)if(Array.isArray(u.address))for(const o of u.address)i.push(this._getAddress(o));else i.push(this._getAddress(u.address));let a;"fromBlock"in u&&(a=this._getBlockTag(u.fromBlock));let s;return"toBlock"in u&&(s=this._getBlockTag(u.toBlock)),i.filter(o=>typeof o!="string").length||a!=null&&typeof a!="string"||s!=null&&typeof s!="string"?Promise.all([Promise.all(i),a,s]).then(o=>r(o[0],o[1],o[2])):r(i,a,s)}_getTransactionRequest(u){const t=I2(u),n=[];if(["to","from"].forEach(r=>{if(t[r]==null)return;const i=Ce(t[r],this);KE(i)?n.push(async function(){t[r]=await i}()):t[r]=i}),t.blockTag!=null){const r=this._getBlockTag(t.blockTag);KE(r)?n.push(async function(){t.blockTag=await r}()):t.blockTag=r}return n.length?async function(){return await Promise.all(n),t}():t}async getNetwork(){if(b(this,He)==null){const r=this._detectNetwork().then(i=>(this.emit("network",i,null),i),i=>{throw b(this,He)===r&&T(this,He,null),i});return T(this,He,r),(await r).clone()}const u=b(this,He),[t,n]=await Promise.all([u,this._detectNetwork()]);return t.chainId!==n.chainId&&(b(this,Fa)?(this.emit("network",n,t),b(this,He)===u&&T(this,He,Promise.resolve(n))):du(!1,`network changed: ${t.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),t.clone()}async getFeeData(){const u=await this.getNetwork(),t=async()=>{const{_block:r,gasPrice:i}=await de({_block:cu(this,vc,V5).call(this,"latest",!1),gasPrice:(async()=>{try{const l=await cu(this,ve,rt).call(this,{method:"getGasPrice"});return Iu(l,"%response")}catch{}return null})()});let a=null,s=null;const o=this._wrapBlock(r,u);return o&&o.baseFeePerGas&&(s=BigInt("1000000000"),a=o.baseFeePerGas*jpu+s),new Ry(i,a,s)},n=u.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const r=new Cr(n.url),i=await n.processFunc(t,this,r);return new Ry(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await t()}async estimateGas(u){let t=this._getTransactionRequest(u);return KE(t)&&(t=await t),Iu(await cu(this,ve,rt).call(this,{method:"estimateGas",transaction:t}),"%response")}async call(u){const{tx:t,blockTag:n}=await de({tx:this._getTransactionRequest(u),blockTag:this._getBlockTag(u.blockTag)});return await cu(this,Dc,K5).call(this,cu(this,Fc,Q5).call(this,t,n,u.enableCcipRead?0:-1))}async getBalance(u,t){return Iu(await cu(this,Da,z3).call(this,{method:"getBalance"},u,t),"%response")}async getTransactionCount(u,t){return Gu(await cu(this,Da,z3).call(this,{method:"getTransactionCount"},u,t),"%response")}async getCode(u,t){return Ou(await cu(this,Da,z3).call(this,{method:"getCode"},u,t))}async getStorage(u,t,n){const r=Iu(t,"position");return Ou(await cu(this,Da,z3).call(this,{method:"getStorage",position:r},u,n))}async broadcastTransaction(u){const{blockNumber:t,hash:n,network:r}=await de({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:u}),network:this.getNetwork()}),i=T2.from(u);if(i.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,r).replaceableTransaction(t)}async getBlock(u,t){const{network:n,params:r}=await de({network:this.getNetwork(),params:cu(this,vc,V5).call(this,u,!!t)});return r==null?null:this._wrapBlock(r,n)}async getTransaction(u){const{network:t,params:n}=await de({network:this.getNetwork(),params:cu(this,ve,rt).call(this,{method:"getTransaction",hash:u})});return n==null?null:this._wrapTransactionResponse(n,t)}async getTransactionReceipt(u){const{network:t,params:n}=await de({network:this.getNetwork(),params:cu(this,ve,rt).call(this,{method:"getTransactionReceipt",hash:u})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const r=await cu(this,ve,rt).call(this,{method:"getTransaction",hash:u});if(r==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=r.gasPrice}return this._wrapTransactionReceipt(n,t)}async getTransactionResult(u){const{result:t}=await de({network:this.getNetwork(),result:cu(this,ve,rt).call(this,{method:"getTransactionResult",hash:u})});return t==null?null:Ou(t)}async getLogs(u){let t=this._getFilter(u);KE(t)&&(t=await t);const{network:n,params:r}=await de({network:this.getNetwork(),params:cu(this,ve,rt).call(this,{method:"getLogs",filter:t})});return r.map(i=>this._wrapLog(i,n))}_getProvider(u){du(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(u){return await R2.fromName(this,u)}async getAvatar(u){const t=await this.getResolver(u);return t?await t.getAvatar():null}async resolveName(u){const t=await this.getResolver(u);return t?await t.getAddress():null}async lookupAddress(u){u=Zu(u);const t=M5(u.substring(2).toLowerCase()+".addr.reverse");try{const n=await R2.getEnsAddress(this),i=await new u4(n,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(i==null||i===O5)return null;const s=await new u4(i,["function name(bytes32) view returns (string)"],this).name(t);return await this.resolveName(s)!==u?null:s}catch(n){if(Dt(n,"BAD_DATA")&&n.value==="0x"||Dt(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(u,t,n){const r=t??1;return r===0?this.getTransactionReceipt(u):new Promise(async(i,a)=>{let s=null;const o=async l=>{try{const c=await this.getTransactionReceipt(u);if(c!=null&&l-c.blockNumber+1>=r){i(c),s&&(clearTimeout(s),s=null);return}}catch(c){console.log("EEE",c)}this.once("block",o)};n!=null&&(s=setTimeout(()=>{s!=null&&(s=null,this.off("block",o),a(_0("timeout","TIMEOUT",{reason:"timeout"})))},n)),o(await this.getBlockNumber())})}async waitForBlock(u){du(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(u){const t=b(this,pt).get(u);t&&(t.timer&&clearTimeout(t.timer),b(this,pt).delete(u))}_setTimeout(u,t){t==null&&(t=0);const n=br(this,yc)._++,r=()=>{b(this,pt).delete(n),u()};if(this.paused)b(this,pt).set(n,{timer:null,func:r,time:t});else{const i=setTimeout(r,t);b(this,pt).set(n,{timer:i,func:r,time:of()})}return n}_forEachSubscriber(u){for(const t of b(this,ne).values())u(t.subscriber)}_getSubscriber(u){switch(u.type){case"debug":case"error":case"network":return new CP(u.type);case"block":{const t=new Npu(this);return t.pollingInterval=this.pollingInterval,t}case"event":return new pm(this,u.filter);case"transaction":return new zpu(this,u.hash);case"orphan":return new Rpu(this,u.filter)}throw new Error(`unsupported event: ${u.type}`)}_recoverSubscriber(u,t){for(const n of b(this,ne).values())if(n.subscriber===u){n.started&&n.subscriber.stop(),n.subscriber=t,n.started&&t.start(),b(this,re)!=null&&t.pause(b(this,re));break}}async on(u,t){const n=await cu(this,Y4,v9).call(this,u);return n.listeners.push({listener:t,once:!1}),n.started||(n.subscriber.start(),n.started=!0,b(this,re)!=null&&n.subscriber.pause(b(this,re))),this}async once(u,t){const n=await cu(this,Y4,v9).call(this,u);return n.listeners.push({listener:t,once:!0}),n.started||(n.subscriber.start(),n.started=!0,b(this,re)!=null&&n.subscriber.pause(b(this,re))),this}async emit(u,...t){const n=await cu(this,va,j3).call(this,u,t);if(!n||n.listeners.length===0)return!1;const r=n.listeners.length;return n.listeners=n.listeners.filter(({listener:i,once:a})=>{const s=new X_(this,a?null:i,u);try{i.call(this,...t,s)}catch{}return!a}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),b(this,ne).delete(n.tag)),r>0}async listenerCount(u){if(u){const n=await cu(this,va,j3).call(this,u);return n?n.listeners.length:0}let t=0;for(const{listeners:n}of b(this,ne).values())t+=n.length;return t}async listeners(u){if(u){const n=await cu(this,va,j3).call(this,u);return n?n.listeners.map(({listener:r})=>r):[]}let t=[];for(const{listeners:n}of b(this,ne).values())t=t.concat(n.map(({listener:r})=>r));return t}async off(u,t){const n=await cu(this,va,j3).call(this,u);if(!n)return this;if(t){const r=n.listeners.map(({listener:i})=>i).indexOf(t);r>=0&&n.listeners.splice(r,1)}return(!t||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),b(this,ne).delete(n.tag)),this}async removeAllListeners(u){if(u){const{tag:t,started:n,subscriber:r}=await cu(this,Y4,v9).call(this,u);n&&r.stop(),b(this,ne).delete(t)}else for(const[t,{started:n,subscriber:r}]of b(this,ne))n&&r.stop(),b(this,ne).delete(t);return this}async addListener(u,t){return await this.on(u,t)}async removeListener(u,t){return this.off(u,t)}get destroyed(){return b(this,K4)}destroy(){this.removeAllListeners();for(const u of b(this,pt).keys())this._clearTimeout(u);T(this,K4,!0)}get paused(){return b(this,re)!=null}set paused(u){!!u!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(u){if(T(this,Vn,-1),b(this,re)!=null){if(b(this,re)==!!u)return;du(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(t=>t.pause(u)),T(this,re,!!u);for(const t of b(this,pt).values())t.timer&&clearTimeout(t.timer),t.time=of()-t.time}resume(){if(b(this,re)!=null){this._forEachSubscriber(u=>u.resume()),T(this,re,null);for(const u of b(this,pt).values()){let t=u.time;t<0&&(t=0),u.time=of(),setTimeout(u.func,t)}}}}ne=new WeakMap,ni=new WeakMap,re=new WeakMap,K4=new WeakMap,He=new WeakMap,Fa=new WeakMap,ri=new WeakMap,Vn=new WeakMap,yc=new WeakMap,pt=new WeakMap,V4=new WeakMap,J4=new WeakMap,ve=new WeakSet,rt=async function(u){const t=b(this,J4).cacheTimeout;if(t<0)return await this._perform(u);const n=D9(u.method,u);let r=b(this,ri).get(n);return r||(r=this._perform(u),b(this,ri).set(n,r),setTimeout(()=>{b(this,ri).get(n)===r&&b(this,ri).delete(n)},t)),await r},Fc=new WeakSet,Q5=async function(u,t,n){du(n=0&&t==="latest"&&r.to!=null&&A0(i.data,0,4)==="0x556f1830"){const a=i.data,s=await Ce(r.to,this);let o;try{o=Qpu(A0(i.data,4))}catch(E){du(!1,E.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:r,info:{data:a}})}du(o.sender.toLowerCase()===s.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:a,reason:"OffchainLookup",transaction:r,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:o.errorArgs}});const l=await this.ccipReadFetch(r,o.calldata,o.urls);du(l!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:r,info:{data:i.data,errorArgs:o.errorArgs}});const c={to:s,data:R0([o.selector,Gpu([l,o.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:c});try{const E=await cu(this,Fc,Q5).call(this,c,t,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},c),result:E}),E}catch(E){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},c),error:E}),E}}throw i}},Dc=new WeakSet,K5=async function(u){const{value:t}=await de({network:this.getNetwork(),value:u});return t},Da=new WeakSet,z3=async function(u,t,n){let r=this._getAddress(t),i=this._getBlockTag(n);return(typeof r!="string"||typeof i!="string")&&([r,i]=await Promise.all([r,i])),await cu(this,Dc,K5).call(this,cu(this,ve,rt).call(this,Object.assign(u,{address:r,blockTag:i})))},vc=new WeakSet,V5=async function(u,t){if(h0(u,32))return await cu(this,ve,rt).call(this,{method:"getBlock",blockHash:u,includeTransactions:t});let n=this._getBlockTag(u);return typeof n!="string"&&(n=await n),await cu(this,ve,rt).call(this,{method:"getBlock",blockTag:n,includeTransactions:t})},va=new WeakSet,j3=async function(u,t){let n=await sf(u,this);return n.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(n=await sf({orphan:"drop-log",log:t[0]},this)),b(this,ne).get(n.tag)||null},Y4=new WeakSet,v9=async function(u){const t=await sf(u,this),n=t.tag;let r=b(this,ne).get(n);return r||(r={subscriber:this._getSubscriber(t),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},b(this,ne).set(n,r)),r};function Wpu(e,u){try{const t=J5(e,u);if(t)return nm(t)}catch{}return null}function J5(e,u){if(e==="0x")return null;try{const t=Gu(A0(e,u,u+32)),n=Gu(A0(e,t,t+32));return A0(e,t+32,t+32+n)}catch{}return null}function qy(e){const u=Ve(e);if(u.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(u,32-u.length),t}function qpu(e){if(e.length%32===0)return e;const u=new Uint8Array(Math.ceil(e.length/32)*32);return u.set(e),u}const Hpu=new Uint8Array([]);function Gpu(e){const u=[];let t=0;for(let n=0;n=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=A0(e,0,32);du(A0(t,0,12)===A0(Hy,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),u.sender=A0(t,12);try{const n=[],r=Gu(A0(e,32,64)),i=Gu(A0(e,r,r+32)),a=A0(e,r+32);for(let s=0;su[n]),u}function fs(e,u){if(e.provider)return e.provider;du(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:u})}async function Gy(e,u){let t=I2(u);if(t.to!=null&&(t.to=Ce(t.to,e)),t.from!=null){const n=t.from;t.from=Promise.all([e.getAddress(),Ce(n,e)]).then(([r,i])=>(V(r.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),r))}else t.from=e.getAddress();return await de(t)}class Kpu{constructor(u){eu(this,"provider");Ru(this,{provider:u||null})}async getNonce(u){return fs(this,"getTransactionCount").getTransactionCount(await this.getAddress(),u)}async populateCall(u){return await Gy(this,u)}async populateTransaction(u){const t=fs(this,"populateTransaction"),n=await Gy(this,u);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const r=await this.provider.getNetwork();if(n.chainId!=null){const a=Iu(n.chainId);V(a===r.chainId,"transaction chainId mismatch","tx.chainId",u.chainId)}else n.chainId=r.chainId;const i=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||i)?V(!1,"eip-1559 transaction do not support gasPrice","tx",u):(n.type===0||n.type===1)&&i&&V(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",u),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const a=await t.getFeeData();du(a.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice)}else{const a=await t.getFeeData();if(n.type==null)if(a.maxFeePerGas!=null&&a.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const s=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=s,n.maxPriorityFeePerGas=s}else n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas);else a.gasPrice!=null?(du(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=a.gasPrice),n.type=0):du(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else n.type===2&&(n.maxFeePerGas==null&&(n.maxFeePerGas=a.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=a.maxPriorityFeePerGas))}return await de(n)}async estimateGas(u){return fs(this,"estimateGas").estimateGas(await this.populateCall(u))}async call(u){return fs(this,"call").call(await this.populateCall(u))}async resolveName(u){return await fs(this,"resolveName").resolveName(u)}async sendTransaction(u){const t=fs(this,"sendTransaction"),n=await this.populateTransaction(u);delete n.from;const r=T2.from(n);return await t.broadcastTransaction(await this.signTransaction(r))}}function Vpu(e){return JSON.parse(JSON.stringify(e))}var be,An,ba,ii,wa,Z4,bc,Y5,wc,Z5;class mP{constructor(u){q(this,bc);q(this,wc);q(this,be,void 0);q(this,An,void 0);q(this,ba,void 0);q(this,ii,void 0);q(this,wa,void 0);q(this,Z4,void 0);T(this,be,u),T(this,An,null),T(this,ba,cu(this,bc,Y5).bind(this)),T(this,ii,!1),T(this,wa,null),T(this,Z4,!1)}_subscribe(u){throw new Error("subclasses must override this")}_emitResults(u,t){throw new Error("subclasses must override this")}_recover(u){throw new Error("subclasses must override this")}start(){b(this,ii)||(T(this,ii,!0),cu(this,bc,Y5).call(this,-2))}stop(){b(this,ii)&&(T(this,ii,!1),T(this,Z4,!0),cu(this,wc,Z5).call(this),b(this,be).off("block",b(this,ba)))}pause(u){u&&cu(this,wc,Z5).call(this),b(this,be).off("block",b(this,ba))}resume(){this.start()}}be=new WeakMap,An=new WeakMap,ba=new WeakMap,ii=new WeakMap,wa=new WeakMap,Z4=new WeakMap,bc=new WeakSet,Y5=async function(u){try{b(this,An)==null&&T(this,An,this._subscribe(b(this,be)));let t=null;try{t=await b(this,An)}catch(i){if(!Dt(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(t==null){T(this,An,null),b(this,be)._recoverSubscriber(this,this._recover(b(this,be)));return}const n=await b(this,be).getNetwork();if(b(this,wa)||T(this,wa,n),b(this,wa).chainId!==n.chainId)throw new Error("chaid changed");if(b(this,Z4))return;const r=await b(this,be).send("eth_getFilterChanges",[t]);await this._emitResults(b(this,be),r)}catch(t){console.log("@TODO",t)}b(this,be).once("block",b(this,ba))},wc=new WeakSet,Z5=function(){const u=b(this,An);u&&(T(this,An,null),u.then(t=>{b(this,be).send("eth_uninstallFilter",[t])}))};var xa;class Jpu extends mP{constructor(t,n){super(t);q(this,xa,void 0);T(this,xa,Vpu(n))}_recover(t){return new pm(t,b(this,xa))}async _subscribe(t){return await t.send("eth_newFilter",[b(this,xa)])}async _emitResults(t,n){for(const r of n)t.emit(b(this,xa),t._wrapLog(r,t._network))}}xa=new WeakMap;class Ypu extends mP{async _subscribe(u){return await u.send("eth_newPendingTransactionFilter",[])}async _emitResults(u,t){for(const n of t)u.emit("pending",n)}}const Zpu="bigint,boolean,function,number,string,symbol".split(/,/g);function b9(e){if(e==null||Zpu.indexOf(typeof e)>=0||typeof e.getAddress=="function")return e;if(Array.isArray(e))return e.map(b9);if(typeof e=="object")return Object.keys(e).reduce((u,t)=>(u[t]=e[t],u),{});throw new Error(`should not happen: ${e} (${typeof e})`)}function Xpu(e){return new Promise(u=>{setTimeout(u,e)})}function ps(e){return e&&e.toLowerCase()}function Qy(e){return e&&typeof e.pollingInterval=="number"}const u5u={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class lf extends Kpu{constructor(t,n){super(t);eu(this,"address");n=Zu(n),Ru(this,{address:n})}connect(t){du(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(t){return await this.populateCall(t)}async sendUncheckedTransaction(t){const n=b9(t),r=[];if(n.from){const a=n.from;r.push((async()=>{const s=await Ce(a,this.provider);V(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),n.from=s})())}else n.from=this.address;if(n.gasLimit==null&&r.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const a=n.to;r.push((async()=>{n.to=await Ce(a,this.provider)})())}r.length&&await Promise.all(r);const i=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(t){const n=await this.provider.getBlockNumber(),r=await this.sendUncheckedTransaction(t);return await new Promise((i,a)=>{const s=[1e3,100],o=async()=>{const l=await this.provider.getTransaction(r);if(l!=null){i(l.replaceableTransaction(n));return}this.provider._setTimeout(()=>{o()},s.pop()||4e3)};o()})}async signTransaction(t){const n=b9(t);if(n.from){const i=await Ce(n.from,this.provider);V(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),n.from=i}else n.from=this.address;const r=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[r])}async signMessage(t){const n=typeof t=="string"?or(t):t;return await this.provider.send("personal_sign",[Ou(n),this.address.toLowerCase()])}async signTypedData(t,n,r){const i=b9(r),a=await O2.resolveNames(t,n,i,async s=>{const o=await Ce(s);return V(o!=null,"TypedData does not support null address","value",s),o});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(O2.getPayload(a.domain,n,a.value))])}async unlock(t){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),t,null])}async _legacySignMessage(t){const n=typeof t=="string"?or(t):t;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ou(n)])}}var ka,X4,Jn,gn,Ut,Yn,xc,X5;class e5u extends $pu{constructor(t,n){super(t,n);q(this,xc);q(this,ka,void 0);q(this,X4,void 0);q(this,Jn,void 0);q(this,gn,void 0);q(this,Ut,void 0);q(this,Yn,void 0);T(this,X4,1),T(this,ka,Object.assign({},u5u,n||{})),T(this,Jn,[]),T(this,gn,null),T(this,Yn,null);{let i=null;const a=new Promise(s=>{i=s});T(this,Ut,{promise:a,resolve:i})}const r=this._getOption("staticNetwork");r&&(V(t==null||r.matches(t),"staticNetwork MUST match network object","options",n),T(this,Yn,r))}_getOption(t){return b(this,ka)[t]}get _network(){return du(b(this,Yn),"network is not available yet","NETWORK_ERROR"),b(this,Yn)}async _perform(t){if(t.method==="call"||t.method==="estimateGas"){let r=t.transaction;if(r&&r.type!=null&&Iu(r.type)&&r.maxFeePerGas==null&&r.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(t=Object.assign({},t,{transaction:Object.assign({},r,{type:void 0})}))}}const n=this.getRpcRequest(t);return n!=null?await this.send(n.method,n.args):super._perform(t)}async _detectNetwork(){const t=this._getOption("staticNetwork");if(t)return t;if(this.ready)return ir.from(Iu(await this.send("eth_chainId",[])));const n={id:br(this,X4)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let r;try{r=(await this._send(n))[0]}catch(i){throw this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:r}),"result"in r)return ir.from(Iu(r.result));throw this.getRpcError(n,r)}_start(){b(this,Ut)==null||b(this,Ut).resolve==null||(b(this,Ut).resolve(),T(this,Ut,null),(async()=>{for(;b(this,Yn)==null&&!this.destroyed;)try{T(this,Yn,await this._detectNetwork())}catch(t){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",_0("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:t}})),await Xpu(1e3)}cu(this,xc,X5).call(this)})())}async _waitUntilReady(){if(b(this,Ut)!=null)return await b(this,Ut).promise}_getSubscriber(t){return t.type==="pending"?new Ypu(this):t.type==="event"?this._getOption("polling")?new pm(this,t.filter):new Jpu(this,t.filter):t.type==="orphan"&&t.filter.orphan==="drop-log"?new CP("orphan"):super._getSubscriber(t)}get ready(){return b(this,Ut)==null}getRpcTransaction(t){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(r=>{if(t[r]==null)return;let i=r;r==="gasLimit"&&(i="gas"),n[i]=js(Iu(t[r],`tx.${r}`))}),["from","to","data"].forEach(r=>{t[r]!=null&&(n[r]=Ou(t[r]))}),t.accessList&&(n.accessList=is(t.accessList)),n}getRpcRequest(t){switch(t.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getBalance":return{method:"eth_getBalance",args:[ps(t.address),t.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[ps(t.address),t.blockTag]};case"getCode":return{method:"eth_getCode",args:[ps(t.address),t.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[ps(t.address),"0x"+t.position.toString(16),t.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[t.signedTransaction]};case"getBlock":if("blockTag"in t)return{method:"eth_getBlockByNumber",args:[t.blockTag,!!t.includeTransactions]};if("blockHash"in t)return{method:"eth_getBlockByHash",args:[t.blockHash,!!t.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[t.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[t.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(t.transaction),t.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(t.transaction)]};case"getLogs":return t.filter&&t.filter.address!=null&&(Array.isArray(t.filter.address)?t.filter.address=t.filter.address.map(ps):t.filter.address=ps(t.filter.address)),{method:"eth_getLogs",args:[t.filter]}}return null}getRpcError(t,n){const{method:r}=t,{error:i}=n;if(r==="eth_estimateGas"&&i.message){const o=i.message;if(!o.match(/revert/i)&&o.match(/insufficient funds/i))return _0("insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.params[0],info:{payload:t,error:i}})}if(r==="eth_call"||r==="eth_estimateGas"){const o=uh(i),l=Zl.getBuiltinCallException(r==="eth_call"?"call":"estimateGas",t.params[0],o?o.data:null);return l.info={error:i,payload:t},l}const a=JSON.stringify(r5u(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return _0("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[r]||"unknown",reason:"rejected",info:{payload:t,error:i}});if(r==="eth_sendRawTransaction"||r==="eth_sendTransaction"){const o=t.params[0];if(a.match(/insufficient funds|base fee exceeds gas limit/i))return _0("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:o,info:{error:i}});if(a.match(/nonce/i)&&a.match(/too low/i))return _0("nonce has already been used","NONCE_EXPIRED",{transaction:o,info:{error:i}});if(a.match(/replacement transaction/i)&&a.match(/underpriced/i))return _0("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o,info:{error:i}});if(a.match(/only replay-protected/i))return _0("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:r,info:{transaction:o,info:{error:i}}})}let s=!!a.match(/the method .* does not exist/i);return s||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(s=!0),s?_0("unsupported operation","UNSUPPORTED_OPERATION",{operation:t.method,info:{error:i,payload:t}}):_0("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:t})}send(t,n){if(this.destroyed)return Promise.reject(_0("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t}));const r=br(this,X4)._++,i=new Promise((a,s)=>{b(this,Jn).push({resolve:a,reject:s,payload:{method:t,params:n,id:r,jsonrpc:"2.0"}})});return cu(this,xc,X5).call(this),i}async getSigner(t){t==null&&(t=0);const n=this.send("eth_accounts",[]);if(typeof t=="number"){const i=await n;if(t>=i.length)throw new Error("no such account");return new lf(this,i[t])}const{accounts:r}=await de({network:this.getNetwork(),accounts:n});t=Zu(t);for(const i of r)if(Zu(i)===t)return new lf(this,t);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new lf(this,n))}destroy(){b(this,gn)&&(clearTimeout(b(this,gn)),T(this,gn,null));for(const{payload:t,reject:n}of b(this,Jn))n(_0("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t.method}));T(this,Jn,[]),super.destroy()}}ka=new WeakMap,X4=new WeakMap,Jn=new WeakMap,gn=new WeakMap,Ut=new WeakMap,Yn=new WeakMap,xc=new WeakSet,X5=function(){if(b(this,gn))return;const t=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");T(this,gn,setTimeout(()=>{T(this,gn,null);const n=b(this,Jn);for(T(this,Jn,[]);n.length;){const r=[n.shift()];for(;n.length&&r.length!==b(this,ka).batchMaxCount;)if(r.push(n.shift()),JSON.stringify(r.map(a=>a.payload)).length>b(this,ka).batchMaxSize){n.unshift(r.pop());break}(async()=>{const i=r.length===1?r[0].payload:r.map(a=>a.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const a=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:a});for(const{resolve:s,reject:o,payload:l}of r){if(this.destroyed){o(_0("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:l.method}));continue}const c=a.filter(E=>E.id===l.id)[0];if(c==null){const E=_0("missing response for request","BAD_DATA",{value:a,info:{payload:l}});this.emit("error",E),o(E);continue}if("error"in c){o(this.getRpcError(l,c));continue}s(c.result)}}catch(a){this.emit("debug",{action:"receiveRpcError",error:a});for(const{reject:s}of r)s(a)}})()}},t))};var ai;class t5u extends e5u{constructor(t,n){super(t,n);q(this,ai,void 0);T(this,ai,4e3)}_getSubscriber(t){const n=super._getSubscriber(t);return Qy(n)&&(n.pollingInterval=b(this,ai)),n}get pollingInterval(){return b(this,ai)}set pollingInterval(t){if(!Number.isInteger(t)||t<0)throw new Error("invalid interval");T(this,ai,t),this._forEachSubscriber(n=>{Qy(n)&&(n.pollingInterval=b(this,ai))})}}ai=new WeakMap;var uo;class n5u extends t5u{constructor(t,n,r){t==null&&(t="http://localhost:8545");super(n,r);q(this,uo,void 0);typeof t=="string"?T(this,uo,new Cr(t)):T(this,uo,t.clone())}_getConnection(){return b(this,uo).clone()}async send(t,n){return await this._start(),await super.send(t,n)}async _send(t){const n=this._getConnection();n.body=JSON.stringify(t),n.setHeader("content-type","application/json");const r=await n.send();r.assertOk();let i=r.bodyJson;return Array.isArray(i)||(i=[i]),i}}uo=new WeakMap;function uh(e){if(e==null)return null;if(typeof e.message=="string"&&e.message.match(/revert/i)&&h0(e.data))return{message:e.message,data:e.data};if(typeof e=="object"){for(const u in e){const t=uh(e[u]);if(t)return t}return null}if(typeof e=="string")try{return uh(JSON.parse(e))}catch{}return null}function eh(e,u){if(e!=null){if(typeof e.message=="string"&&u.push(e.message),typeof e=="object")for(const t in e)eh(e[t],u);if(typeof e=="string")try{return eh(JSON.parse(e),u)}catch{}}}function r5u(e){const u=[];return eh(e,u),u}const i5u=u4,a5u=async()=>{const e=new n5u("https://goerli.optimism.io",420);return new i5u(ur[420],Fn.abi,e).balanceOf(ur[420])},s5u=()=>{const{error:e,isLoading:u,data:t}=ldu(["ethers.Contract().balanceOf"],a5u);return u?qu.jsx("div",{children:"'loading balance...'"}):e?(console.error(e),qu.jsx("div",{children:"error loading balance"})):qu.jsx("div",{children:t==null?void 0:t.toString()})},o5u=()=>{const{address:e}=et(),{data:u}=KC(),[t,n]=M.useState([]),r=Fn.events.Transfer({fromBlock:u&&u-BigInt(1e3),args:{to:e}});return VL({...r,address:ur[420],listener:i=>{n([...t,i])}}),qu.jsx("div",{children:qu.jsx("div",{style:{display:"flex",flexDirection:"column-reverse"},children:t.map((i,a)=>qu.jsxs("div",{children:[qu.jsxs("div",{children:["Event ",a]}),qu.jsx("div",{children:JSON.stringify(i)})]}))})})},l5u=()=>{const{address:e,isConnected:u}=et(),{data:t}=Cs({...Fn.read.balanceOf(e),address:ur[420],enabled:u}),{data:n}=Cs({...Fn.read.totalSupply(),address:ur[420],enabled:u}),{data:r}=Cs({...Fn.read.tokenURI(BigInt(1)),address:ur[420],enabled:u}),{data:i}=Cs({...Fn.read.symbol(),address:ur[420],enabled:u}),{data:a}=Cs({...Fn.read.ownerOf(BigInt(1)),address:ur[420],enabled:u});return qu.jsx("div",{children:qu.jsxs("div",{children:[qu.jsxs("div",{children:["balanceOf(",e,"): ",t==null?void 0:t.toString()]}),qu.jsxs("div",{children:["totalSupply(): ",n==null?void 0:n.toString()]}),qu.jsxs("div",{children:["tokenUri(BigInt(1)): ",r==null?void 0:r.toString()]}),qu.jsxs("div",{children:["symbol(): ",i==null?void 0:i.toString()]}),qu.jsxs("div",{children:["ownerOf(BigInt(1)): ",a==null?void 0:a.toString()]})]})})};function c5u(e=1,u=1e9){const t=u-e+1;return Math.floor(Math.random()*t)+e}const E5u=()=>{const{address:e,isConnected:u}=et(),{data:t,refetch:n}=Cs({...Fn.read.balanceOf(e),enabled:u}),{writeAsync:r,data:i}=uU({address:ur[420],...Fn.write.mint});return lU({hash:i==null?void 0:i.hash,onSuccess:a=>{console.log("minted",a),n()}}),qu.jsxs("div",{children:[qu.jsx("div",{children:qu.jsxs("div",{children:["balance: ",t==null?void 0:t.toString()]})}),qu.jsx("button",{type:"button",onClick:()=>r(Fn.write.mint(BigInt(c5u()))),children:"Mint"})]})};function d5u(){const[e,u]=M.useState("unselected"),{isConnected:t}=et(),n={unselected:qu.jsx(qu.Fragment,{children:"Select which component to render"}),reads:qu.jsx(l5u,{}),writes:qu.jsx(E5u,{}),events:qu.jsx(o5u,{}),ethers:qu.jsx(s5u,{})};return qu.jsxs(qu.Fragment,{children:[qu.jsx("h1",{children:"Evmts example"}),qu.jsx(N8,{}),t&&qu.jsxs(qu.Fragment,{children:[qu.jsx("hr",{}),qu.jsx("div",{style:{display:"flex"},children:Object.keys(n).map(r=>qu.jsx("button",{type:"button",onClick:()=>u(r),children:r}))}),qu.jsx("h2",{children:e}),n[e]]})]})}function f5u({rpc:e}){return function(u){const t=e(u);return!t||t.http===""?null:{chain:{...u,rpcUrls:{...u.rpcUrls,default:{http:[t.http]}}},rpcUrls:{http:[t.http],webSocket:t.webSocket?[t.webSocket]:void 0}}}}const p5u="898f836c53a18d0661340823973f0cb4",{chains:AP,publicClient:h5u,webSocketPublicClient:C5u}=MM([$C,wM],[f5u({rpc:e=>{const u={1:{http:"https://mainnet.infura.io/v3/845f07495e374dfabf3a66e3f10ad786"},420:{http:"https://goerli.optimism.io"}};return[1,420].includes(e.id)?u[e.id]:null}})]),{connectors:m5u}=_1u({appName:"My wagmi + RainbowKit App",chains:AP,projectId:p5u}),A5u=e=>vL({autoConnect:!0,connectors:m5u,publicClient:h5u,webSocketPublicClient:C5u,queryClient:e}),Ky=new H1u,gP=document.getElementById("root");if(!gP)throw new Error("No root element found");z_(gP).render(qu.jsx(M.StrictMode,{children:qu.jsx(J1u,{client:Ky,children:qu.jsx(bL,{config:A5u(Ky),children:qu.jsx(tlu,{chains:AP,children:qu.jsx(d5u,{})})})})}));export{Cd as $,hhu as A,phu as B,nhu as C,ghu as D,chu as E,Z5u as F,lhu as G,bhu as H,Ahu as I,uhu as J,V5u as K,J5u as L,St as M,jr as N,shu as O,ihu as P,ahu as Q,g2u as R,md as S,q8 as T,vo as U,Q5u as V,p_ as W,Rhu as X,ehu as Y,Nhu as Z,aE as _,Jz as a,y1 as a$,thu as a0,K5u as a1,dhu as a2,fhu as a3,Ad as a4,X5u as a5,H8 as a6,Chu as a7,Ehu as a8,mhu as a9,L5u as aA,s_ as aB,$9u as aC,L8 as aD,W9u as aE,q9u as aF,G9u as aG,a_ as aH,V9u as aI,Z9u as aJ,e2u as aK,n2u as aL,i2u as aM,l9u as aN,o_ as aO,d2u as aP,f2u as aQ,o2u as aR,E2u as aS,fau as aT,Bau as aU,Bu as aV,c1 as aW,ge as aX,lo as aY,Bl as aZ,WR as a_,zhu as aa,Dhu as ab,Fhu as ac,t1u as ad,Ohu as ae,whu as af,n1u as ag,yhu as ah,Shu as ai,xhu as aj,Phu as ak,Ihu as al,khu as am,_hu as an,Thu as ao,vhu as ap,Q2u as aq,C_ as ar,Q6 as as,$5u as at,W5u as au,Uu as av,Xcu as aw,Yu as ax,rF as ay,U5u as az,Yz as b,pr as b0,Ic as b1,K3 as b2,xn as b3,Zz as c,bb as d,nh as e,Ia as f,zz as g,$u as h,Gt as i,aB as j,th as k,Rz as l,Na as m,l9 as n,Bhu as o,q5u as p,H5u as q,ld as r,G5u as s,Yt as t,f_ as u,ze as v,un as w,Y5u as x,rhu as y,ohu as z}; diff --git a/examples/vite/dist/assets/index-c5a6e03a.js b/examples/vite/dist/assets/index-e3f53129.js similarity index 99% rename from examples/vite/dist/assets/index-c5a6e03a.js rename to examples/vite/dist/assets/index-e3f53129.js index 88972bfdc8..37ef0597b4 100644 --- a/examples/vite/dist/assets/index-c5a6e03a.js +++ b/examples/vite/dist/assets/index-e3f53129.js @@ -1,4 +1,4 @@ -import{aw as Gs,ax as Z,ay as Hi,e as ln,az as Hp,aA as Vp,k as Up}from"./index-51fb98b3.js";import{e as vu}from"./events-372f436e.js";import{p as zp,h as qp}from"./hooks.module-408dc32d.js";function Gp(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var yu={},Pi={},Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.walletLogo=void 0;const Jp=(t,e)=>{let r;switch(t){case"standard":return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};Js.walletLogo=Jp;var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.LINK_API_URL=void 0;Zs.LINK_API_URL="https://www.walletlink.org";var Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.ScopedLocalStorage=void 0;class Zp{constructor(e){this.scope=e}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`${this.scope}:${e}`}}Qs.ScopedLocalStorage=Zp;var Jn={},fn={};Object.defineProperty(fn,"__esModule",{value:!0});const Qp=vu;function Rc(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function Yp(t){const e=t.length,r=new Array(e);for(let n=0;n0&&([o]=r),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const s=i[e];if(s===void 0)return!1;if(typeof s=="function")Rc(s,this,r);else{const o=s.length,a=Yp(s);for(let c=0;c0?u:h},s.min=function(u,h){return u.cmp(h)<0?u:h},s.prototype._init=function(u,h,p){if(typeof u=="number")return this._initNumber(u,h,p);if(typeof u=="object")return this._initArray(u,h,p);h==="hex"&&(h=16),n(h===(h|0)&&h>=2&&h<=36),u=u.toString().replace(/\s+/g,"");var v=0;u[0]==="-"&&(v++,this.negative=1),v=0;v-=3)M=u[v]|u[v-1]<<8|u[v-2]<<16,this.words[w]|=M<>>26-T&67108863,T+=24,T>=26&&(T-=26,w++);else if(p==="le")for(v=0,w=0;v>>26-T&67108863,T+=24,T>=26&&(T-=26,w++);return this._strip()};function a(b,u){var h=b.charCodeAt(u);if(h>=48&&h<=57)return h-48;if(h>=65&&h<=70)return h-55;if(h>=97&&h<=102)return h-87;n(!1,"Invalid character in "+b)}function c(b,u,h){var p=a(b,h);return h-1>=u&&(p|=a(b,h-1)<<4),p}s.prototype._parseHex=function(u,h,p){this.length=Math.ceil((u.length-h)/6),this.words=new Array(this.length);for(var v=0;v=h;v-=2)T=c(u,h,v)<=18?(w-=18,M+=1,this.words[M]|=T>>>26):w+=8;else{var m=u.length-h;for(v=m%2===0?h+1:h;v=18?(w-=18,M+=1,this.words[M]|=T>>>26):w+=8}this._strip()};function l(b,u,h,p){for(var v=0,w=0,M=Math.min(b.length,h),T=u;T=49?w=m-49+10:m>=17?w=m-17+10:w=m,n(m>=0&&w1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{s.prototype.inspect=g}else s.prototype.inspect=g;function g(){return(this.red?""}var y=["","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],A=[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];s.prototype.toString=function(u,h){u=u||10,h=h|0||1;var p;if(u===16||u==="hex"){p="";for(var v=0,w=0,M=0;M>>24-v&16777215,v+=2,v>=26&&(v-=26,M--),w!==0||M!==this.length-1?p=y[6-m.length]+m+p:p=m+p}for(w!==0&&(p=w.toString(16)+p);p.length%h!==0;)p="0"+p;return this.negative!==0&&(p="-"+p),p}if(u===(u|0)&&u>=2&&u<=36){var f=C[u],E=A[u];p="";var U=this.clone();for(U.negative=0;!U.isZero();){var q=U.modrn(E).toString(u);U=U.idivn(E),U.isZero()?p=q+p:p=y[f-q.length]+q+p}for(this.isZero()&&(p="0"+p);p.length%h!==0;)p="0"+p;return this.negative!==0&&(p="-"+p),p}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(u,h){return this.toArrayLike(o,u,h)}),s.prototype.toArray=function(u,h){return this.toArrayLike(Array,u,h)};var D=function(u,h){return u.allocUnsafe?u.allocUnsafe(h):new u(h)};s.prototype.toArrayLike=function(u,h,p){this._strip();var v=this.byteLength(),w=p||Math.max(1,v);n(v<=w,"byte array longer than desired length"),n(w>0,"Requested array length <= 0");var M=D(u,w),T=h==="le"?"LE":"BE";return this["_toArrayLike"+T](M,v),M},s.prototype._toArrayLikeLE=function(u,h){for(var p=0,v=0,w=0,M=0;w>8&255),p>16&255),M===6?(p>24&255),v=0,M=0):(v=T>>>24,M+=2)}if(p=0&&(u[p--]=T>>8&255),p>=0&&(u[p--]=T>>16&255),M===6?(p>=0&&(u[p--]=T>>24&255),v=0,M=0):(v=T>>>24,M+=2)}if(p>=0)for(u[p--]=v;p>=0;)u[p--]=0},Math.clz32?s.prototype._countBits=function(u){return 32-Math.clz32(u)}:s.prototype._countBits=function(u){var h=u,p=0;return h>=4096&&(p+=13,h>>>=13),h>=64&&(p+=7,h>>>=7),h>=8&&(p+=4,h>>>=4),h>=2&&(p+=2,h>>>=2),p+h},s.prototype._zeroBits=function(u){if(u===0)return 26;var h=u,p=0;return h&8191||(p+=13,h>>>=13),h&127||(p+=7,h>>>=7),h&15||(p+=4,h>>>=4),h&3||(p+=2,h>>>=2),h&1||p++,p},s.prototype.bitLength=function(){var u=this.words[this.length-1],h=this._countBits(u);return(this.length-1)*26+h};function N(b){for(var u=new Array(b.bitLength()),h=0;h>>v&1}return u}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,h=0;hu.length?this.clone().ior(u):u.clone().ior(this)},s.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},s.prototype.iuand=function(u){var h;this.length>u.length?h=u:h=this;for(var p=0;pu.length?this.clone().iand(u):u.clone().iand(this)},s.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},s.prototype.iuxor=function(u){var h,p;this.length>u.length?(h=this,p=u):(h=u,p=this);for(var v=0;vu.length?this.clone().ixor(u):u.clone().ixor(this)},s.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},s.prototype.inotn=function(u){n(typeof u=="number"&&u>=0);var h=Math.ceil(u/26)|0,p=u%26;this._expand(h),p>0&&h--;for(var v=0;v0&&(this.words[v]=~this.words[v]&67108863>>26-p),this._strip()},s.prototype.notn=function(u){return this.clone().inotn(u)},s.prototype.setn=function(u,h){n(typeof u=="number"&&u>=0);var p=u/26|0,v=u%26;return this._expand(p+1),h?this.words[p]=this.words[p]|1<u.length?(p=this,v=u):(p=u,v=this);for(var w=0,M=0;M>>26;for(;w!==0&&M>>26;if(this.length=p.length,w!==0)this.words[this.length]=w,this.length++;else if(p!==this)for(;Mu.length?this.clone().iadd(u):u.clone().iadd(this)},s.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var h=this.iadd(u);return u.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var p=this.cmp(u);if(p===0)return this.negative=0,this.length=1,this.words[0]=0,this;var v,w;p>0?(v=this,w=u):(v=u,w=this);for(var M=0,T=0;T>26,this.words[T]=h&67108863;for(;M!==0&&T>26,this.words[T]=h&67108863;if(M===0&&T>>26,U=m&67108863,q=Math.min(f,u.length-1),R=Math.max(0,f-b.length+1);R<=q;R++){var k=f-R|0;v=b.words[k]|0,w=u.words[R]|0,M=v*w+U,E+=M/67108864|0,U=M&67108863}h.words[f]=U|0,m=E|0}return m!==0?h.words[f]=m|0:h.length--,h._strip()}var I=function(u,h,p){var v=u.words,w=h.words,M=p.words,T=0,m,f,E,U=v[0]|0,q=U&8191,R=U>>>13,k=v[1]|0,$=k&8191,V=k>>>13,se=v[2]|0,_=se&8191,S=se>>>13,F=v[3]|0,H=F&8191,re=F>>>13,ie=v[4]|0,ee=ie&8191,de=ie>>>13,Jt=v[5]|0,we=Jt&8191,Se=Jt>>>13,vr=v[6]|0,ve=vr&8191,ye=vr>>>13,ur=v[7]|0,be=ur&8191,pe=ur>>>13,xt=v[8]|0,Ee=xt&8191,xe=xt>>>13,wn=v[9]|0,Me=wn&8191,Ce=wn>>>13,_n=w[0]|0,Re=_n&8191,Ie=_n>>>13,Sn=w[1]|0,Ae=Sn&8191,Te=Sn>>>13,En=w[2]|0,ke=En&8191,Oe=En>>>13,xn=w[3]|0,Ne=xn&8191,Le=xn>>>13,Mn=w[4]|0,Pe=Mn&8191,De=Mn>>>13,Cn=w[5]|0,$e=Cn&8191,Be=Cn>>>13,Rn=w[6]|0,je=Rn&8191,Fe=Rn>>>13,In=w[7]|0,We=In&8191,He=In>>>13,An=w[8]|0,Ve=An&8191,Ue=An>>>13,Tn=w[9]|0,ze=Tn&8191,qe=Tn>>>13;p.negative=u.negative^h.negative,p.length=19,m=Math.imul(q,Re),f=Math.imul(q,Ie),f=f+Math.imul(R,Re)|0,E=Math.imul(R,Ie);var Or=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Or>>>26)|0,Or&=67108863,m=Math.imul($,Re),f=Math.imul($,Ie),f=f+Math.imul(V,Re)|0,E=Math.imul(V,Ie),m=m+Math.imul(q,Ae)|0,f=f+Math.imul(q,Te)|0,f=f+Math.imul(R,Ae)|0,E=E+Math.imul(R,Te)|0;var Nr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,m=Math.imul(_,Re),f=Math.imul(_,Ie),f=f+Math.imul(S,Re)|0,E=Math.imul(S,Ie),m=m+Math.imul($,Ae)|0,f=f+Math.imul($,Te)|0,f=f+Math.imul(V,Ae)|0,E=E+Math.imul(V,Te)|0,m=m+Math.imul(q,ke)|0,f=f+Math.imul(q,Oe)|0,f=f+Math.imul(R,ke)|0,E=E+Math.imul(R,Oe)|0;var Lr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,m=Math.imul(H,Re),f=Math.imul(H,Ie),f=f+Math.imul(re,Re)|0,E=Math.imul(re,Ie),m=m+Math.imul(_,Ae)|0,f=f+Math.imul(_,Te)|0,f=f+Math.imul(S,Ae)|0,E=E+Math.imul(S,Te)|0,m=m+Math.imul($,ke)|0,f=f+Math.imul($,Oe)|0,f=f+Math.imul(V,ke)|0,E=E+Math.imul(V,Oe)|0,m=m+Math.imul(q,Ne)|0,f=f+Math.imul(q,Le)|0,f=f+Math.imul(R,Ne)|0,E=E+Math.imul(R,Le)|0;var Pr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Pr>>>26)|0,Pr&=67108863,m=Math.imul(ee,Re),f=Math.imul(ee,Ie),f=f+Math.imul(de,Re)|0,E=Math.imul(de,Ie),m=m+Math.imul(H,Ae)|0,f=f+Math.imul(H,Te)|0,f=f+Math.imul(re,Ae)|0,E=E+Math.imul(re,Te)|0,m=m+Math.imul(_,ke)|0,f=f+Math.imul(_,Oe)|0,f=f+Math.imul(S,ke)|0,E=E+Math.imul(S,Oe)|0,m=m+Math.imul($,Ne)|0,f=f+Math.imul($,Le)|0,f=f+Math.imul(V,Ne)|0,E=E+Math.imul(V,Le)|0,m=m+Math.imul(q,Pe)|0,f=f+Math.imul(q,De)|0,f=f+Math.imul(R,Pe)|0,E=E+Math.imul(R,De)|0;var Dr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,m=Math.imul(we,Re),f=Math.imul(we,Ie),f=f+Math.imul(Se,Re)|0,E=Math.imul(Se,Ie),m=m+Math.imul(ee,Ae)|0,f=f+Math.imul(ee,Te)|0,f=f+Math.imul(de,Ae)|0,E=E+Math.imul(de,Te)|0,m=m+Math.imul(H,ke)|0,f=f+Math.imul(H,Oe)|0,f=f+Math.imul(re,ke)|0,E=E+Math.imul(re,Oe)|0,m=m+Math.imul(_,Ne)|0,f=f+Math.imul(_,Le)|0,f=f+Math.imul(S,Ne)|0,E=E+Math.imul(S,Le)|0,m=m+Math.imul($,Pe)|0,f=f+Math.imul($,De)|0,f=f+Math.imul(V,Pe)|0,E=E+Math.imul(V,De)|0,m=m+Math.imul(q,$e)|0,f=f+Math.imul(q,Be)|0,f=f+Math.imul(R,$e)|0,E=E+Math.imul(R,Be)|0;var $r=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+($r>>>26)|0,$r&=67108863,m=Math.imul(ve,Re),f=Math.imul(ve,Ie),f=f+Math.imul(ye,Re)|0,E=Math.imul(ye,Ie),m=m+Math.imul(we,Ae)|0,f=f+Math.imul(we,Te)|0,f=f+Math.imul(Se,Ae)|0,E=E+Math.imul(Se,Te)|0,m=m+Math.imul(ee,ke)|0,f=f+Math.imul(ee,Oe)|0,f=f+Math.imul(de,ke)|0,E=E+Math.imul(de,Oe)|0,m=m+Math.imul(H,Ne)|0,f=f+Math.imul(H,Le)|0,f=f+Math.imul(re,Ne)|0,E=E+Math.imul(re,Le)|0,m=m+Math.imul(_,Pe)|0,f=f+Math.imul(_,De)|0,f=f+Math.imul(S,Pe)|0,E=E+Math.imul(S,De)|0,m=m+Math.imul($,$e)|0,f=f+Math.imul($,Be)|0,f=f+Math.imul(V,$e)|0,E=E+Math.imul(V,Be)|0,m=m+Math.imul(q,je)|0,f=f+Math.imul(q,Fe)|0,f=f+Math.imul(R,je)|0,E=E+Math.imul(R,Fe)|0;var Br=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Br>>>26)|0,Br&=67108863,m=Math.imul(be,Re),f=Math.imul(be,Ie),f=f+Math.imul(pe,Re)|0,E=Math.imul(pe,Ie),m=m+Math.imul(ve,Ae)|0,f=f+Math.imul(ve,Te)|0,f=f+Math.imul(ye,Ae)|0,E=E+Math.imul(ye,Te)|0,m=m+Math.imul(we,ke)|0,f=f+Math.imul(we,Oe)|0,f=f+Math.imul(Se,ke)|0,E=E+Math.imul(Se,Oe)|0,m=m+Math.imul(ee,Ne)|0,f=f+Math.imul(ee,Le)|0,f=f+Math.imul(de,Ne)|0,E=E+Math.imul(de,Le)|0,m=m+Math.imul(H,Pe)|0,f=f+Math.imul(H,De)|0,f=f+Math.imul(re,Pe)|0,E=E+Math.imul(re,De)|0,m=m+Math.imul(_,$e)|0,f=f+Math.imul(_,Be)|0,f=f+Math.imul(S,$e)|0,E=E+Math.imul(S,Be)|0,m=m+Math.imul($,je)|0,f=f+Math.imul($,Fe)|0,f=f+Math.imul(V,je)|0,E=E+Math.imul(V,Fe)|0,m=m+Math.imul(q,We)|0,f=f+Math.imul(q,He)|0,f=f+Math.imul(R,We)|0,E=E+Math.imul(R,He)|0;var jr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(jr>>>26)|0,jr&=67108863,m=Math.imul(Ee,Re),f=Math.imul(Ee,Ie),f=f+Math.imul(xe,Re)|0,E=Math.imul(xe,Ie),m=m+Math.imul(be,Ae)|0,f=f+Math.imul(be,Te)|0,f=f+Math.imul(pe,Ae)|0,E=E+Math.imul(pe,Te)|0,m=m+Math.imul(ve,ke)|0,f=f+Math.imul(ve,Oe)|0,f=f+Math.imul(ye,ke)|0,E=E+Math.imul(ye,Oe)|0,m=m+Math.imul(we,Ne)|0,f=f+Math.imul(we,Le)|0,f=f+Math.imul(Se,Ne)|0,E=E+Math.imul(Se,Le)|0,m=m+Math.imul(ee,Pe)|0,f=f+Math.imul(ee,De)|0,f=f+Math.imul(de,Pe)|0,E=E+Math.imul(de,De)|0,m=m+Math.imul(H,$e)|0,f=f+Math.imul(H,Be)|0,f=f+Math.imul(re,$e)|0,E=E+Math.imul(re,Be)|0,m=m+Math.imul(_,je)|0,f=f+Math.imul(_,Fe)|0,f=f+Math.imul(S,je)|0,E=E+Math.imul(S,Fe)|0,m=m+Math.imul($,We)|0,f=f+Math.imul($,He)|0,f=f+Math.imul(V,We)|0,E=E+Math.imul(V,He)|0,m=m+Math.imul(q,Ve)|0,f=f+Math.imul(q,Ue)|0,f=f+Math.imul(R,Ve)|0,E=E+Math.imul(R,Ue)|0;var Fr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,m=Math.imul(Me,Re),f=Math.imul(Me,Ie),f=f+Math.imul(Ce,Re)|0,E=Math.imul(Ce,Ie),m=m+Math.imul(Ee,Ae)|0,f=f+Math.imul(Ee,Te)|0,f=f+Math.imul(xe,Ae)|0,E=E+Math.imul(xe,Te)|0,m=m+Math.imul(be,ke)|0,f=f+Math.imul(be,Oe)|0,f=f+Math.imul(pe,ke)|0,E=E+Math.imul(pe,Oe)|0,m=m+Math.imul(ve,Ne)|0,f=f+Math.imul(ve,Le)|0,f=f+Math.imul(ye,Ne)|0,E=E+Math.imul(ye,Le)|0,m=m+Math.imul(we,Pe)|0,f=f+Math.imul(we,De)|0,f=f+Math.imul(Se,Pe)|0,E=E+Math.imul(Se,De)|0,m=m+Math.imul(ee,$e)|0,f=f+Math.imul(ee,Be)|0,f=f+Math.imul(de,$e)|0,E=E+Math.imul(de,Be)|0,m=m+Math.imul(H,je)|0,f=f+Math.imul(H,Fe)|0,f=f+Math.imul(re,je)|0,E=E+Math.imul(re,Fe)|0,m=m+Math.imul(_,We)|0,f=f+Math.imul(_,He)|0,f=f+Math.imul(S,We)|0,E=E+Math.imul(S,He)|0,m=m+Math.imul($,Ve)|0,f=f+Math.imul($,Ue)|0,f=f+Math.imul(V,Ve)|0,E=E+Math.imul(V,Ue)|0,m=m+Math.imul(q,ze)|0,f=f+Math.imul(q,qe)|0,f=f+Math.imul(R,ze)|0,E=E+Math.imul(R,qe)|0;var Wr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,m=Math.imul(Me,Ae),f=Math.imul(Me,Te),f=f+Math.imul(Ce,Ae)|0,E=Math.imul(Ce,Te),m=m+Math.imul(Ee,ke)|0,f=f+Math.imul(Ee,Oe)|0,f=f+Math.imul(xe,ke)|0,E=E+Math.imul(xe,Oe)|0,m=m+Math.imul(be,Ne)|0,f=f+Math.imul(be,Le)|0,f=f+Math.imul(pe,Ne)|0,E=E+Math.imul(pe,Le)|0,m=m+Math.imul(ve,Pe)|0,f=f+Math.imul(ve,De)|0,f=f+Math.imul(ye,Pe)|0,E=E+Math.imul(ye,De)|0,m=m+Math.imul(we,$e)|0,f=f+Math.imul(we,Be)|0,f=f+Math.imul(Se,$e)|0,E=E+Math.imul(Se,Be)|0,m=m+Math.imul(ee,je)|0,f=f+Math.imul(ee,Fe)|0,f=f+Math.imul(de,je)|0,E=E+Math.imul(de,Fe)|0,m=m+Math.imul(H,We)|0,f=f+Math.imul(H,He)|0,f=f+Math.imul(re,We)|0,E=E+Math.imul(re,He)|0,m=m+Math.imul(_,Ve)|0,f=f+Math.imul(_,Ue)|0,f=f+Math.imul(S,Ve)|0,E=E+Math.imul(S,Ue)|0,m=m+Math.imul($,ze)|0,f=f+Math.imul($,qe)|0,f=f+Math.imul(V,ze)|0,E=E+Math.imul(V,qe)|0;var Hr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,m=Math.imul(Me,ke),f=Math.imul(Me,Oe),f=f+Math.imul(Ce,ke)|0,E=Math.imul(Ce,Oe),m=m+Math.imul(Ee,Ne)|0,f=f+Math.imul(Ee,Le)|0,f=f+Math.imul(xe,Ne)|0,E=E+Math.imul(xe,Le)|0,m=m+Math.imul(be,Pe)|0,f=f+Math.imul(be,De)|0,f=f+Math.imul(pe,Pe)|0,E=E+Math.imul(pe,De)|0,m=m+Math.imul(ve,$e)|0,f=f+Math.imul(ve,Be)|0,f=f+Math.imul(ye,$e)|0,E=E+Math.imul(ye,Be)|0,m=m+Math.imul(we,je)|0,f=f+Math.imul(we,Fe)|0,f=f+Math.imul(Se,je)|0,E=E+Math.imul(Se,Fe)|0,m=m+Math.imul(ee,We)|0,f=f+Math.imul(ee,He)|0,f=f+Math.imul(de,We)|0,E=E+Math.imul(de,He)|0,m=m+Math.imul(H,Ve)|0,f=f+Math.imul(H,Ue)|0,f=f+Math.imul(re,Ve)|0,E=E+Math.imul(re,Ue)|0,m=m+Math.imul(_,ze)|0,f=f+Math.imul(_,qe)|0,f=f+Math.imul(S,ze)|0,E=E+Math.imul(S,qe)|0;var Vr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,m=Math.imul(Me,Ne),f=Math.imul(Me,Le),f=f+Math.imul(Ce,Ne)|0,E=Math.imul(Ce,Le),m=m+Math.imul(Ee,Pe)|0,f=f+Math.imul(Ee,De)|0,f=f+Math.imul(xe,Pe)|0,E=E+Math.imul(xe,De)|0,m=m+Math.imul(be,$e)|0,f=f+Math.imul(be,Be)|0,f=f+Math.imul(pe,$e)|0,E=E+Math.imul(pe,Be)|0,m=m+Math.imul(ve,je)|0,f=f+Math.imul(ve,Fe)|0,f=f+Math.imul(ye,je)|0,E=E+Math.imul(ye,Fe)|0,m=m+Math.imul(we,We)|0,f=f+Math.imul(we,He)|0,f=f+Math.imul(Se,We)|0,E=E+Math.imul(Se,He)|0,m=m+Math.imul(ee,Ve)|0,f=f+Math.imul(ee,Ue)|0,f=f+Math.imul(de,Ve)|0,E=E+Math.imul(de,Ue)|0,m=m+Math.imul(H,ze)|0,f=f+Math.imul(H,qe)|0,f=f+Math.imul(re,ze)|0,E=E+Math.imul(re,qe)|0;var Ur=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,m=Math.imul(Me,Pe),f=Math.imul(Me,De),f=f+Math.imul(Ce,Pe)|0,E=Math.imul(Ce,De),m=m+Math.imul(Ee,$e)|0,f=f+Math.imul(Ee,Be)|0,f=f+Math.imul(xe,$e)|0,E=E+Math.imul(xe,Be)|0,m=m+Math.imul(be,je)|0,f=f+Math.imul(be,Fe)|0,f=f+Math.imul(pe,je)|0,E=E+Math.imul(pe,Fe)|0,m=m+Math.imul(ve,We)|0,f=f+Math.imul(ve,He)|0,f=f+Math.imul(ye,We)|0,E=E+Math.imul(ye,He)|0,m=m+Math.imul(we,Ve)|0,f=f+Math.imul(we,Ue)|0,f=f+Math.imul(Se,Ve)|0,E=E+Math.imul(Se,Ue)|0,m=m+Math.imul(ee,ze)|0,f=f+Math.imul(ee,qe)|0,f=f+Math.imul(de,ze)|0,E=E+Math.imul(de,qe)|0;var zr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(zr>>>26)|0,zr&=67108863,m=Math.imul(Me,$e),f=Math.imul(Me,Be),f=f+Math.imul(Ce,$e)|0,E=Math.imul(Ce,Be),m=m+Math.imul(Ee,je)|0,f=f+Math.imul(Ee,Fe)|0,f=f+Math.imul(xe,je)|0,E=E+Math.imul(xe,Fe)|0,m=m+Math.imul(be,We)|0,f=f+Math.imul(be,He)|0,f=f+Math.imul(pe,We)|0,E=E+Math.imul(pe,He)|0,m=m+Math.imul(ve,Ve)|0,f=f+Math.imul(ve,Ue)|0,f=f+Math.imul(ye,Ve)|0,E=E+Math.imul(ye,Ue)|0,m=m+Math.imul(we,ze)|0,f=f+Math.imul(we,qe)|0,f=f+Math.imul(Se,ze)|0,E=E+Math.imul(Se,qe)|0;var Ko=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Ko>>>26)|0,Ko&=67108863,m=Math.imul(Me,je),f=Math.imul(Me,Fe),f=f+Math.imul(Ce,je)|0,E=Math.imul(Ce,Fe),m=m+Math.imul(Ee,We)|0,f=f+Math.imul(Ee,He)|0,f=f+Math.imul(xe,We)|0,E=E+Math.imul(xe,He)|0,m=m+Math.imul(be,Ve)|0,f=f+Math.imul(be,Ue)|0,f=f+Math.imul(pe,Ve)|0,E=E+Math.imul(pe,Ue)|0,m=m+Math.imul(ve,ze)|0,f=f+Math.imul(ve,qe)|0,f=f+Math.imul(ye,ze)|0,E=E+Math.imul(ye,qe)|0;var Xo=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Xo>>>26)|0,Xo&=67108863,m=Math.imul(Me,We),f=Math.imul(Me,He),f=f+Math.imul(Ce,We)|0,E=Math.imul(Ce,He),m=m+Math.imul(Ee,Ve)|0,f=f+Math.imul(Ee,Ue)|0,f=f+Math.imul(xe,Ve)|0,E=E+Math.imul(xe,Ue)|0,m=m+Math.imul(be,ze)|0,f=f+Math.imul(be,qe)|0,f=f+Math.imul(pe,ze)|0,E=E+Math.imul(pe,qe)|0;var ea=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(ea>>>26)|0,ea&=67108863,m=Math.imul(Me,Ve),f=Math.imul(Me,Ue),f=f+Math.imul(Ce,Ve)|0,E=Math.imul(Ce,Ue),m=m+Math.imul(Ee,ze)|0,f=f+Math.imul(Ee,qe)|0,f=f+Math.imul(xe,ze)|0,E=E+Math.imul(xe,qe)|0;var ta=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(ta>>>26)|0,ta&=67108863,m=Math.imul(Me,ze),f=Math.imul(Me,qe),f=f+Math.imul(Ce,ze)|0,E=Math.imul(Ce,qe);var ra=(T+m|0)+((f&8191)<<13)|0;return T=(E+(f>>>13)|0)+(ra>>>26)|0,ra&=67108863,M[0]=Or,M[1]=Nr,M[2]=Lr,M[3]=Pr,M[4]=Dr,M[5]=$r,M[6]=Br,M[7]=jr,M[8]=Fr,M[9]=Wr,M[10]=Hr,M[11]=Vr,M[12]=Ur,M[13]=zr,M[14]=Ko,M[15]=Xo,M[16]=ea,M[17]=ta,M[18]=ra,T!==0&&(M[19]=T,p.length++),p};Math.imul||(I=x);function O(b,u,h){h.negative=u.negative^b.negative,h.length=b.length+u.length;for(var p=0,v=0,w=0;w>>26)|0,v+=M>>>26,M&=67108863}h.words[w]=T,p=M,M=v}return p!==0?h.words[w]=p:h.length--,h._strip()}function P(b,u,h){return O(b,u,h)}s.prototype.mulTo=function(u,h){var p,v=this.length+u.length;return this.length===10&&u.length===10?p=I(this,u,h):v<63?p=x(this,u,h):v<1024?p=O(this,u,h):p=P(this,u,h),p},s.prototype.mul=function(u){var h=new s(null);return h.words=new Array(this.length+u.length),this.mulTo(u,h)},s.prototype.mulf=function(u){var h=new s(null);return h.words=new Array(this.length+u.length),P(this,u,h)},s.prototype.imul=function(u){return this.clone().mulTo(u,this)},s.prototype.imuln=function(u){var h=u<0;h&&(u=-u),n(typeof u=="number"),n(u<67108864);for(var p=0,v=0;v>=26,p+=w/67108864|0,p+=M>>>26,this.words[v]=M&67108863}return p!==0&&(this.words[v]=p,this.length++),h?this.ineg():this},s.prototype.muln=function(u){return this.clone().imuln(u)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(u){var h=N(u);if(h.length===0)return new s(1);for(var p=this,v=0;v=0);var h=u%26,p=(u-h)/26,v=67108863>>>26-h<<26-h,w;if(h!==0){var M=0;for(w=0;w>>26-h}M&&(this.words[w]=M,this.length++)}if(p!==0){for(w=this.length-1;w>=0;w--)this.words[w+p]=this.words[w];for(w=0;w=0);var v;h?v=(h-h%26)/26:v=0;var w=u%26,M=Math.min((u-w)/26,this.length),T=67108863^67108863>>>w<M)for(this.length-=M,f=0;f=0&&(E!==0||f>=v);f--){var U=this.words[f]|0;this.words[f]=E<<26-w|U>>>w,E=U&T}return m&&E!==0&&(m.words[m.length++]=E),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(u,h,p){return n(this.negative===0),this.iushrn(u,h,p)},s.prototype.shln=function(u){return this.clone().ishln(u)},s.prototype.ushln=function(u){return this.clone().iushln(u)},s.prototype.shrn=function(u){return this.clone().ishrn(u)},s.prototype.ushrn=function(u){return this.clone().iushrn(u)},s.prototype.testn=function(u){n(typeof u=="number"&&u>=0);var h=u%26,p=(u-h)/26,v=1<=0);var h=u%26,p=(u-h)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=p)return this;if(h!==0&&p++,this.length=Math.min(p,this.length),h!==0){var v=67108863^67108863>>>h<=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},s.prototype.isubn=function(u){if(n(typeof u=="number"),n(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h>26)-(m/67108864|0),this.words[w+p]=M&67108863}for(;w>26,this.words[w+p]=M&67108863;if(T===0)return this._strip();for(n(T===-1),T=0,w=0;w>26,this.words[w]=M&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(u,h){var p=this.length-u.length,v=this.clone(),w=u,M=w.words[w.length-1]|0,T=this._countBits(M);p=26-T,p!==0&&(w=w.ushln(p),v.iushln(p),M=w.words[w.length-1]|0);var m=v.length-w.length,f;if(h!=="mod"){f=new s(null),f.length=m+1,f.words=new Array(f.length);for(var E=0;E=0;q--){var R=(v.words[w.length+q]|0)*67108864+(v.words[w.length+q-1]|0);for(R=Math.min(R/M|0,67108863),v._ishlnsubmul(w,R,q);v.negative!==0;)R--,v.negative=0,v._ishlnsubmul(w,1,q),v.isZero()||(v.negative^=1);f&&(f.words[q]=R)}return f&&f._strip(),v._strip(),h!=="div"&&p!==0&&v.iushrn(p),{div:f||null,mod:v}},s.prototype.divmod=function(u,h,p){if(n(!u.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var v,w,M;return this.negative!==0&&u.negative===0?(M=this.neg().divmod(u,h),h!=="mod"&&(v=M.div.neg()),h!=="div"&&(w=M.mod.neg(),p&&w.negative!==0&&w.iadd(u)),{div:v,mod:w}):this.negative===0&&u.negative!==0?(M=this.divmod(u.neg(),h),h!=="mod"&&(v=M.div.neg()),{div:v,mod:M.mod}):this.negative&u.negative?(M=this.neg().divmod(u.neg(),h),h!=="div"&&(w=M.mod.neg(),p&&w.negative!==0&&w.isub(u)),{div:M.div,mod:w}):u.length>this.length||this.cmp(u)<0?{div:new s(0),mod:this}:u.length===1?h==="div"?{div:this.divn(u.words[0]),mod:null}:h==="mod"?{div:null,mod:new s(this.modrn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new s(this.modrn(u.words[0]))}:this._wordDiv(u,h)},s.prototype.div=function(u){return this.divmod(u,"div",!1).div},s.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},s.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},s.prototype.divRound=function(u){var h=this.divmod(u);if(h.mod.isZero())return h.div;var p=h.div.negative!==0?h.mod.isub(u):h.mod,v=u.ushrn(1),w=u.andln(1),M=p.cmp(v);return M<0||w===1&&M===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},s.prototype.modrn=function(u){var h=u<0;h&&(u=-u),n(u<=67108863);for(var p=(1<<26)%u,v=0,w=this.length-1;w>=0;w--)v=(p*v+(this.words[w]|0))%u;return h?-v:v},s.prototype.modn=function(u){return this.modrn(u)},s.prototype.idivn=function(u){var h=u<0;h&&(u=-u),n(u<=67108863);for(var p=0,v=this.length-1;v>=0;v--){var w=(this.words[v]|0)+p*67108864;this.words[v]=w/u|0,p=w%u}return this._strip(),h?this.ineg():this},s.prototype.divn=function(u){return this.clone().idivn(u)},s.prototype.egcd=function(u){n(u.negative===0),n(!u.isZero());var h=this,p=u.clone();h.negative!==0?h=h.umod(u):h=h.clone();for(var v=new s(1),w=new s(0),M=new s(0),T=new s(1),m=0;h.isEven()&&p.isEven();)h.iushrn(1),p.iushrn(1),++m;for(var f=p.clone(),E=h.clone();!h.isZero();){for(var U=0,q=1;!(h.words[0]&q)&&U<26;++U,q<<=1);if(U>0)for(h.iushrn(U);U-- >0;)(v.isOdd()||w.isOdd())&&(v.iadd(f),w.isub(E)),v.iushrn(1),w.iushrn(1);for(var R=0,k=1;!(p.words[0]&k)&&R<26;++R,k<<=1);if(R>0)for(p.iushrn(R);R-- >0;)(M.isOdd()||T.isOdd())&&(M.iadd(f),T.isub(E)),M.iushrn(1),T.iushrn(1);h.cmp(p)>=0?(h.isub(p),v.isub(M),w.isub(T)):(p.isub(h),M.isub(v),T.isub(w))}return{a:M,b:T,gcd:p.iushln(m)}},s.prototype._invmp=function(u){n(u.negative===0),n(!u.isZero());var h=this,p=u.clone();h.negative!==0?h=h.umod(u):h=h.clone();for(var v=new s(1),w=new s(0),M=p.clone();h.cmpn(1)>0&&p.cmpn(1)>0;){for(var T=0,m=1;!(h.words[0]&m)&&T<26;++T,m<<=1);if(T>0)for(h.iushrn(T);T-- >0;)v.isOdd()&&v.iadd(M),v.iushrn(1);for(var f=0,E=1;!(p.words[0]&E)&&f<26;++f,E<<=1);if(f>0)for(p.iushrn(f);f-- >0;)w.isOdd()&&w.iadd(M),w.iushrn(1);h.cmp(p)>=0?(h.isub(p),v.isub(w)):(p.isub(h),w.isub(v))}var U;return h.cmpn(1)===0?U=v:U=w,U.cmpn(0)<0&&U.iadd(u),U},s.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var h=this.clone(),p=u.clone();h.negative=0,p.negative=0;for(var v=0;h.isEven()&&p.isEven();v++)h.iushrn(1),p.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;p.isEven();)p.iushrn(1);var w=h.cmp(p);if(w<0){var M=h;h=p,p=M}else if(w===0||p.cmpn(1)===0)break;h.isub(p)}while(!0);return p.iushln(v)},s.prototype.invm=function(u){return this.egcd(u).a.umod(u)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(u){return this.words[0]&u},s.prototype.bincn=function(u){n(typeof u=="number");var h=u%26,p=(u-h)/26,v=1<>>26,T&=67108863,this.words[M]=T}return w!==0&&(this.words[M]=w,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(u){var h=u<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this._strip();var p;if(this.length>1)p=1;else{h&&(u=-u),n(u<=67108863,"Number is too big");var v=this.words[0]|0;p=v===u?0:vu.length)return 1;if(this.length=0;p--){var v=this.words[p]|0,w=u.words[p]|0;if(v!==w){vw&&(h=1);break}}return h},s.prototype.gtn=function(u){return this.cmpn(u)===1},s.prototype.gt=function(u){return this.cmp(u)===1},s.prototype.gten=function(u){return this.cmpn(u)>=0},s.prototype.gte=function(u){return this.cmp(u)>=0},s.prototype.ltn=function(u){return this.cmpn(u)===-1},s.prototype.lt=function(u){return this.cmp(u)===-1},s.prototype.lten=function(u){return this.cmpn(u)<=0},s.prototype.lte=function(u){return this.cmp(u)<=0},s.prototype.eqn=function(u){return this.cmpn(u)===0},s.prototype.eq=function(u){return this.cmp(u)===0},s.red=function(u){return new Y(u)},s.prototype.toRed=function(u){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(u){return this.red=u,this},s.prototype.forceRed=function(u){return n(!this.red,"Already a number in reduction context"),this._forceRed(u)},s.prototype.redAdd=function(u){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},s.prototype.redIAdd=function(u){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},s.prototype.redSub=function(u){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},s.prototype.redISub=function(u){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},s.prototype.redShl=function(u){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},s.prototype.redMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},s.prototype.redIMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(u){return n(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var L={k256:null,p224:null,p192:null,p25519:null};function B(b,u){this.name=b,this.p=new s(u,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}B.prototype._tmp=function(){var u=new s(null);return u.words=new Array(Math.ceil(this.n/13)),u},B.prototype.ireduce=function(u){var h=u,p;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),p=h.bitLength();while(p>this.n);var v=p0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},B.prototype.split=function(u,h){u.iushrn(this.n,0,h)},B.prototype.imulK=function(u){return u.imul(this.k)};function G(){B.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(G,B),G.prototype.split=function(u,h){for(var p=4194303,v=Math.min(u.length,9),w=0;w>>22,M=T}M>>>=22,u.words[w-10]=M,M===0&&u.length>10?u.length-=10:u.length-=9},G.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var h=0,p=0;p>>=26,u.words[p]=w,h=v}return h!==0&&(u.words[u.length++]=h),u},s._prime=function(u){if(L[u])return L[u];var h;if(u==="k256")h=new G;else if(u==="p224")h=new z;else if(u==="p192")h=new W;else if(u==="p25519")h=new K;else throw new Error("Unknown prime "+u);return L[u]=h,h};function Y(b){if(typeof b=="string"){var u=s._prime(b);this.m=u.p,this.prime=u}else n(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}Y.prototype._verify1=function(u){n(u.negative===0,"red works only with positives"),n(u.red,"red works only with red numbers")},Y.prototype._verify2=function(u,h){n((u.negative|h.negative)===0,"red works only with positives"),n(u.red&&u.red===h.red,"red works only with red numbers")},Y.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):(d(u,u.umod(this.m)._forceRed(this)),u)},Y.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},Y.prototype.add=function(u,h){this._verify2(u,h);var p=u.add(h);return p.cmp(this.m)>=0&&p.isub(this.m),p._forceRed(this)},Y.prototype.iadd=function(u,h){this._verify2(u,h);var p=u.iadd(h);return p.cmp(this.m)>=0&&p.isub(this.m),p},Y.prototype.sub=function(u,h){this._verify2(u,h);var p=u.sub(h);return p.cmpn(0)<0&&p.iadd(this.m),p._forceRed(this)},Y.prototype.isub=function(u,h){this._verify2(u,h);var p=u.isub(h);return p.cmpn(0)<0&&p.iadd(this.m),p},Y.prototype.shl=function(u,h){return this._verify1(u),this.imod(u.ushln(h))},Y.prototype.imul=function(u,h){return this._verify2(u,h),this.imod(u.imul(h))},Y.prototype.mul=function(u,h){return this._verify2(u,h),this.imod(u.mul(h))},Y.prototype.isqr=function(u){return this.imul(u,u.clone())},Y.prototype.sqr=function(u){return this.mul(u,u)},Y.prototype.sqrt=function(u){if(u.isZero())return u.clone();var h=this.m.andln(3);if(n(h%2===1),h===3){var p=this.m.add(new s(1)).iushrn(2);return this.pow(u,p)}for(var v=this.m.subn(1),w=0;!v.isZero()&&v.andln(1)===0;)w++,v.iushrn(1);n(!v.isZero());var M=new s(1).toRed(this),T=M.redNeg(),m=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);this.pow(f,m).cmp(T)!==0;)f.redIAdd(T);for(var E=this.pow(f,v),U=this.pow(u,v.addn(1).iushrn(1)),q=this.pow(u,v),R=w;q.cmp(M)!==0;){for(var k=q,$=0;k.cmp(M)!==0;$++)k=k.redSqr();n($=0;w--){for(var E=h.words[w],U=f-1;U>=0;U--){var q=E>>U&1;if(M!==v[0]&&(M=this.sqr(M)),q===0&&T===0){m=0;continue}T<<=1,T|=q,m++,!(m!==p&&(w!==0||U!==0))&&(M=this.mul(M,v[T]),m=0,T=0)}f=26}return M},Y.prototype.convertTo=function(u){var h=u.umod(this.m);return h===u?h.clone():h},Y.prototype.convertFrom=function(u){var h=u.clone();return h.red=null,h},s.mont=function(u){return new X(u)};function X(b){Y.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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(X,Y),X.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},X.prototype.convertFrom=function(u){var h=this.imod(u.mul(this.rinv));return h.red=null,h},X.prototype.imul=function(u,h){if(u.isZero()||h.isZero())return u.words[0]=0,u.length=1,u;var p=u.imul(h),v=p.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=p.isub(v).iushrn(this.shift),M=w;return w.cmp(this.m)>=0?M=w.isub(this.m):w.cmpn(0)<0&&(M=w.iadd(this.m)),M._forceRed(this)},X.prototype.mul=function(u,h){if(u.isZero()||h.isZero())return new s(0)._forceRed(this);var p=u.mul(h),v=p.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=p.isub(v).iushrn(this.shift),M=w;return w.cmp(this.m)>=0?M=w.isub(this.m):w.cmpn(0)<0&&(M=w.iadd(this.m)),M._forceRed(this)},X.prototype.invm=function(u){var h=this.imod(u._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(t,Z)})(mu);var Ys=mu.exports,ui={};Object.defineProperty(ui,"__esModule",{value:!0});ui.EVENTS=void 0;ui.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var Vi={},wu={},Cr={},Xp=Di;Di.default=Di;Di.stable=qf;Di.stableStringify=qf;var Ls="[...]",Uf="[Circular]",sn=[],Xr=[];function zf(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Di(t,e,r,n){typeof n>"u"&&(n=zf()),za(t,"",0,[],void 0,0,n);var i;try{Xr.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,Gf(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;sn.length!==0;){var s=sn.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Hn(t,e,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:t}),sn.push([n,r,e,i])):Xr.push([e,r,t]):(n[r]=t,sn.push([n,r,e]))}function za(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Hn(Ls,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Hn(Ls,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;ae?1:0}function qf(t,e,r,n){typeof n>"u"&&(n=zf());var i=qa(t,"",0,[],void 0,0,n)||t,s;try{Xr.length===0?s=JSON.stringify(i,e,r):s=JSON.stringify(i,Gf(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;sn.length!==0;){var o=sn.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return s}function qa(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Hn(Ls,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Hn(Ls,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n=1e3&&t<=4999}function i0(t,e){if(e!=="[Circular]")return e}var _u={},Rr={};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.errorValues=Rr.errorCodes=void 0;Rr.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}};Rr.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=Rr,r=Cr,n=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:o(n)};t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function o(y,C=i){if(Number.isInteger(y)){const A=y.toString();if(g(e.errorValues,A))return e.errorValues[A].message;if(l(y))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return C}t.getMessageFromCode=o;function a(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(e.errorValues[C]||l(y))}t.isValidCode=a;function c(y,{fallbackError:C=s,shouldIncludeStack:A=!1}={}){var D,N;if(!C||!Number.isInteger(C.code)||typeof C.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(y instanceof r.EthereumRpcError)return y.serialize();const x={};if(y&&typeof y=="object"&&!Array.isArray(y)&&g(y,"code")&&a(y.code)){const O=y;x.code=O.code,O.message&&typeof O.message=="string"?(x.message=O.message,g(O,"data")&&(x.data=O.data)):(x.message=o(x.code),x.data={originalError:d(y)})}else{x.code=C.code;const O=(D=y)===null||D===void 0?void 0:D.message;x.message=O&&typeof O=="string"?O:C.message,x.data={originalError:d(y)}}const I=(N=y)===null||N===void 0?void 0:N.stack;return A&&y&&I&&typeof I=="string"&&(x.stack=I),x}t.serializeError=c;function l(y){return y>=-32099&&y<=-32e3}function d(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function g(y,C){return Object.prototype.hasOwnProperty.call(y,C)}})(_u);var Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.ethErrors=void 0;const Su=Cr,Zf=_u,dt=Rr;Ks.ethErrors={rpc:{parse:t=>At(dt.errorCodes.rpc.parse,t),invalidRequest:t=>At(dt.errorCodes.rpc.invalidRequest,t),invalidParams:t=>At(dt.errorCodes.rpc.invalidParams,t),methodNotFound:t=>At(dt.errorCodes.rpc.methodNotFound,t),internal:t=>At(dt.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return At(e,t)},invalidInput:t=>At(dt.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>At(dt.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>At(dt.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>At(dt.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>At(dt.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>At(dt.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>_i(dt.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>_i(dt.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>_i(dt.errorCodes.provider.unsupportedMethod,t),disconnected:t=>_i(dt.errorCodes.provider.disconnected,t),chainDisconnected:t=>_i(dt.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Su.EthereumProviderError(e,r,n)}}};function At(t,e){const[r,n]=Qf(e);return new Su.EthereumRpcError(t,r||Zf.getMessageFromCode(t),n)}function _i(t,e){const[r,n]=Qf(e);return new Su.EthereumProviderError(t,r||Zf.getMessageFromCode(t),n)}function Qf(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=Cr;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const r=_u;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=Ks;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=Rr;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(wu);var _e={},Xs={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Web3Method=void 0,function(e){e.requestEthereumAccounts="requestEthereumAccounts",e.signEthereumMessage="signEthereumMessage",e.signEthereumTransaction="signEthereumTransaction",e.submitEthereumTransaction="submitEthereumTransaction",e.ethereumAddressFromSignedMessage="ethereumAddressFromSignedMessage",e.scanQRCode="scanQRCode",e.generic="generic",e.childRequestEthereumAccounts="childRequestEthereumAccounts",e.addEthereumChain="addEthereumChain",e.switchEthereumChain="switchEthereumChain",e.makeEthereumJSONRPCRequest="makeEthereumJSONRPCRequest",e.watchAsset="watchAsset",e.selectProvider="selectProvider"}(t.Web3Method||(t.Web3Method={}))})(Xs);Object.defineProperty(_e,"__esModule",{value:!0});_e.EthereumAddressFromSignedMessageResponse=_e.SubmitEthereumTransactionResponse=_e.SignEthereumTransactionResponse=_e.SignEthereumMessageResponse=_e.isRequestEthereumAccountsResponse=_e.SelectProviderResponse=_e.WatchAssetReponse=_e.RequestEthereumAccountsResponse=_e.SwitchEthereumChainResponse=_e.AddEthereumChainResponse=_e.isErrorResponse=void 0;const ar=Xs;function s0(t){var e,r;return((e=t)===null||e===void 0?void 0:e.method)!==void 0&&((r=t)===null||r===void 0?void 0:r.errorMessage)!==void 0}_e.isErrorResponse=s0;function o0(t){return{method:ar.Web3Method.addEthereumChain,result:t}}_e.AddEthereumChainResponse=o0;function a0(t){return{method:ar.Web3Method.switchEthereumChain,result:t}}_e.SwitchEthereumChainResponse=a0;function u0(t){return{method:ar.Web3Method.requestEthereumAccounts,result:t}}_e.RequestEthereumAccountsResponse=u0;function c0(t){return{method:ar.Web3Method.watchAsset,result:t}}_e.WatchAssetReponse=c0;function l0(t){return{method:ar.Web3Method.selectProvider,result:t}}_e.SelectProviderResponse=l0;function f0(t){return t&&t.method===ar.Web3Method.requestEthereumAccounts}_e.isRequestEthereumAccountsResponse=f0;function h0(t){return{method:ar.Web3Method.signEthereumMessage,result:t}}_e.SignEthereumMessageResponse=h0;function d0(t){return{method:ar.Web3Method.signEthereumTransaction,result:t}}_e.SignEthereumTransactionResponse=d0;function p0(t){return{method:ar.Web3Method.submitEthereumTransaction,result:t}}_e.SubmitEthereumTransactionResponse=p0;function g0(t){return{method:ar.Web3Method.ethereumAddressFromSignedMessage,result:t}}_e.EthereumAddressFromSignedMessageResponse=g0;var ci={};Object.defineProperty(ci,"__esModule",{value:!0});ci.LIB_VERSION=void 0;ci.LIB_VERSION="3.7.2";(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCode=t.serializeError=t.standardErrors=t.standardErrorMessage=t.standardErrorCodes=void 0;const e=wu,r=_e,n=ci;t.standardErrorCodes=Object.freeze(Object.assign(Object.assign({},e.errorCodes),{provider:Object.freeze(Object.assign(Object.assign({},e.errorCodes.provider),{unsupportedChain:4902}))}));function i(d){return d!==void 0?(0,e.getMessageFromCode)(d):"Unknown error"}t.standardErrorMessage=i,t.standardErrors=Object.freeze(Object.assign(Object.assign({},e.ethErrors),{provider:Object.freeze(Object.assign(Object.assign({},e.ethErrors.provider),{unsupportedChain:(d="")=>e.ethErrors.provider.custom({code:t.standardErrorCodes.provider.unsupportedChain,message:`Unrecognized chain ID ${d}. Try adding the chain using wallet_addEthereumChain first.`})}))}));function s(d,g){const y=(0,e.serializeError)(o(d),{shouldIncludeStack:!0}),C=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");C.searchParams.set("version",n.LIB_VERSION),C.searchParams.set("code",y.code.toString());const A=a(y.data,g);return A&&C.searchParams.set("method",A),C.searchParams.set("message",y.message),Object.assign(Object.assign({},y),{docUrl:C.href})}t.serializeError=s;function o(d){return typeof d=="string"?{message:d,code:t.standardErrorCodes.rpc.internal}:(0,r.isErrorResponse)(d)?Object.assign(Object.assign({},d),{message:d.errorMessage,code:d.errorCode,data:{method:d.method,result:d.result}}):d}function a(d,g){var y;const C=(y=d)===null||y===void 0?void 0:y.method;if(C)return C;if(g!==void 0)return typeof g=="string"?g:Array.isArray(g)?g.length>0?g[0].method:void 0:g.method}function c(d){var g;if(typeof d=="number")return d;if(l(d))return(g=d.code)!==null&&g!==void 0?g:d.errorCode}t.getErrorCode=c;function l(d){return typeof d=="object"&&d!==null&&(typeof d.code=="number"||typeof d.errorCode=="number")}})(Vi);var li={},Yf={exports:{}},Ga={exports:{}};typeof Object.create=="function"?Ga.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ga.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var zt=Ga.exports,Ja={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(t,e){var r=Hi,n=r.Buffer;function i(o,a){for(var c in o)a[c]=o[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=s);function s(o,a,c){return n(o,a,c)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(o,a,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,a,c)},s.alloc=function(o,a,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var l=n(o);return a!==void 0?typeof c=="string"?l.fill(a,c):l.fill(a):l.fill(0),l},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(Ja,Ja.exports);var hn=Ja.exports,Kf=hn.Buffer;function eo(t,e){this._block=Kf.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}eo.prototype.update=function(t,e){typeof t=="string"&&(e=e||"utf8",t=Kf.from(t,e));for(var r=this._block,n=this._blockSize,i=t.length,s=this._len,o=0;o=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};eo.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var fi=eo,b0=zt,Xf=fi,v0=hn.Buffer,y0=[1518500249,1859775393,-1894007588,-899497514],m0=new Array(80);function Ui(){this.init(),this._w=m0,Xf.call(this,64,56)}b0(Ui,Xf);Ui.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function w0(t){return t<<5|t>>>27}function _0(t){return t<<30|t>>>2}function S0(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}Ui.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=e[a-3]^e[a-8]^e[a-14]^e[a-16];for(var c=0;c<80;++c){var l=~~(c/20),d=w0(r)+S0(l,n,i,s)+o+e[c]+y0[l]|0;o=s,s=i,i=_0(n),n=r,r=d}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};Ui.prototype._hash=function(){var t=v0.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};var E0=Ui,x0=zt,eh=fi,M0=hn.Buffer,C0=[1518500249,1859775393,-1894007588,-899497514],R0=new Array(80);function zi(){this.init(),this._w=R0,eh.call(this,64,56)}x0(zi,eh);zi.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function I0(t){return t<<1|t>>>31}function A0(t){return t<<5|t>>>27}function T0(t){return t<<30|t>>>2}function k0(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}zi.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=I0(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var c=0;c<80;++c){var l=~~(c/20),d=A0(r)+k0(l,n,i,s)+o+e[c]+C0[l]|0;o=s,s=i,i=T0(n),n=r,r=d}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};zi.prototype._hash=function(){var t=M0.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};var O0=zi,N0=zt,th=fi,L0=hn.Buffer,P0=[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],D0=new Array(64);function qi(){this.init(),this._w=D0,th.call(this,64,56)}N0(qi,th);qi.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function $0(t,e,r){return r^t&(e^r)}function B0(t,e,r){return t&e|r&(t|e)}function j0(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function F0(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function W0(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function H0(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}qi.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=this._f|0,c=this._g|0,l=this._h|0,d=0;d<16;++d)e[d]=t.readInt32BE(d*4);for(;d<64;++d)e[d]=H0(e[d-2])+e[d-7]+W0(e[d-15])+e[d-16]|0;for(var g=0;g<64;++g){var y=l+F0(o)+$0(o,a,c)+P0[g]+e[g]|0,C=j0(r)+B0(r,n,i)|0;l=c,c=a,a=o,o=s+y|0,s=i,i=n,n=r,r=y+C|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0,this._f=a+this._f|0,this._g=c+this._g|0,this._h=l+this._h|0};qi.prototype._hash=function(){var t=L0.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var rh=qi,V0=zt,U0=rh,z0=fi,q0=hn.Buffer,G0=new Array(64);function to(){this.init(),this._w=G0,z0.call(this,64,56)}V0(to,U0);to.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};to.prototype._hash=function(){var t=q0.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var J0=to,Z0=zt,nh=fi,Q0=hn.Buffer,Ic=[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],Y0=new Array(160);function Gi(){this.init(),this._w=Y0,nh.call(this,128,112)}Z0(Gi,nh);Gi.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ac(t,e,r){return r^t&(e^r)}function Tc(t,e,r){return t&e|r&(t|e)}function kc(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function Oc(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function K0(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function X0(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function eg(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function tg(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function it(t,e){return t>>>0>>0?1:0}Gi.prototype._update=function(t){for(var e=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,o=this._eh|0,a=this._fh|0,c=this._gh|0,l=this._hh|0,d=this._al|0,g=this._bl|0,y=this._cl|0,C=this._dl|0,A=this._el|0,D=this._fl|0,N=this._gl|0,x=this._hl|0,I=0;I<32;I+=2)e[I]=t.readInt32BE(I*4),e[I+1]=t.readInt32BE(I*4+4);for(;I<160;I+=2){var O=e[I-30],P=e[I-15*2+1],L=K0(O,P),B=X0(P,O);O=e[I-2*2],P=e[I-2*2+1];var G=eg(O,P),z=tg(P,O),W=e[I-7*2],K=e[I-7*2+1],Y=e[I-16*2],X=e[I-16*2+1],b=B+K|0,u=L+W+it(b,B)|0;b=b+z|0,u=u+G+it(b,z)|0,b=b+X|0,u=u+Y+it(b,X)|0,e[I]=u,e[I+1]=b}for(var h=0;h<160;h+=2){u=e[h],b=e[h+1];var p=Tc(r,n,i),v=Tc(d,g,y),w=kc(r,d),M=kc(d,r),T=Oc(o,A),m=Oc(A,o),f=Ic[h],E=Ic[h+1],U=Ac(o,a,c),q=Ac(A,D,N),R=x+m|0,k=l+T+it(R,x)|0;R=R+q|0,k=k+U+it(R,q)|0,R=R+E|0,k=k+f+it(R,E)|0,R=R+b|0,k=k+u+it(R,b)|0;var $=M+v|0,V=w+p+it($,M)|0;l=c,x=N,c=a,N=D,a=o,D=A,A=C+R|0,o=s+k+it(A,C)|0,s=i,C=y,i=n,y=g,n=r,g=d,d=R+$|0,r=k+V+it(d,R)|0}this._al=this._al+d|0,this._bl=this._bl+g|0,this._cl=this._cl+y|0,this._dl=this._dl+C|0,this._el=this._el+A|0,this._fl=this._fl+D|0,this._gl=this._gl+N|0,this._hl=this._hl+x|0,this._ah=this._ah+r+it(this._al,d)|0,this._bh=this._bh+n+it(this._bl,g)|0,this._ch=this._ch+i+it(this._cl,y)|0,this._dh=this._dh+s+it(this._dl,C)|0,this._eh=this._eh+o+it(this._el,A)|0,this._fh=this._fh+a+it(this._fl,D)|0,this._gh=this._gh+c+it(this._gl,N)|0,this._hh=this._hh+l+it(this._hl,x)|0};Gi.prototype._hash=function(){var t=Q0.allocUnsafe(64);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t};var ih=Gi,rg=zt,ng=ih,ig=fi,sg=hn.Buffer,og=new Array(160);function ro(){this.init(),this._w=og,ig.call(this,128,112)}rg(ro,ng);ro.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};ro.prototype._hash=function(){var t=sg.allocUnsafe(48);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t};var ag=ro,dn=Yf.exports=function(e){e=e.toLowerCase();var r=dn[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};dn.sha=E0;dn.sha1=O0;dn.sha224=J0;dn.sha256=rh;dn.sha384=ag;dn.sha512=ih;var ug=Yf.exports,J={},cg=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0},Nc=typeof Symbol<"u"&&Symbol,lg=cg,fg=function(){return typeof Nc!="function"||typeof Symbol!="function"||typeof Nc("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:lg()},Lc={foo:{}},hg=Object,dg=function(){return{__proto__:Lc}.foo===Lc.foo&&!({__proto__:null}instanceof hg)},pg="Function.prototype.bind called on incompatible ",gg=Object.prototype.toString,bg=Math.max,vg="[object Function]",Pc=function(e,r){for(var n=[],i=0;i"u"||!at?ce:at(Uint8Array),nn={"%AggregateError%":typeof AggregateError>"u"?ce:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ce:ArrayBuffer,"%ArrayIteratorPrototype%":kn&&at?at([][Symbol.iterator]()):ce,"%AsyncFromSyncIteratorPrototype%":ce,"%AsyncFunction%":Bn,"%AsyncGenerator%":Bn,"%AsyncGeneratorFunction%":Bn,"%AsyncIteratorPrototype%":Bn,"%Atomics%":typeof Atomics>"u"?ce:Atomics,"%BigInt%":typeof BigInt>"u"?ce:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ce:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ce:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ce:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?ce:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ce:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ce:FinalizationRegistry,"%Function%":sh,"%GeneratorFunction%":Bn,"%Int8Array%":typeof Int8Array>"u"?ce:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ce:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ce:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":kn&&at?at(at([][Symbol.iterator]())):ce,"%JSON%":typeof JSON=="object"?JSON:ce,"%Map%":typeof Map>"u"?ce:Map,"%MapIteratorPrototype%":typeof Map>"u"||!kn||!at?ce:at(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ce:Promise,"%Proxy%":typeof Proxy>"u"?ce:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?ce:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ce:Set,"%SetIteratorPrototype%":typeof Set>"u"||!kn||!at?ce:at(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ce:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":kn&&at?at(""[Symbol.iterator]()):ce,"%Symbol%":kn?Symbol:ce,"%SyntaxError%":Zn,"%ThrowTypeError%":Cg,"%TypedArray%":Ig,"%TypeError%":Vn,"%Uint8Array%":typeof Uint8Array>"u"?ce:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ce:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ce:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ce:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?ce:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ce:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ce:WeakSet};if(at)try{null.error}catch(t){var Ag=at(at(t));nn["%Error.prototype%"]=Ag}var Tg=function t(e){var r;if(e==="%AsyncFunction%")r=na("async function () {}");else if(e==="%GeneratorFunction%")r=na("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=na("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&at&&(r=at(i.prototype))}return nn[e]=r,r},Dc={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ji=Eu,Ps=Mg,kg=Ji.call(Function.call,Array.prototype.concat),Og=Ji.call(Function.apply,Array.prototype.splice),$c=Ji.call(Function.call,String.prototype.replace),Ds=Ji.call(Function.call,String.prototype.slice),Ng=Ji.call(Function.call,RegExp.prototype.exec),Lg=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Pg=/\\(\\)?/g,Dg=function(e){var r=Ds(e,0,1),n=Ds(e,-1);if(r==="%"&&n!=="%")throw new Zn("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Zn("invalid intrinsic syntax, expected opening `%`");var i=[];return $c(e,Lg,function(s,o,a,c){i[i.length]=a?$c(c,Pg,"$1"):o||s}),i},$g=function(e,r){var n=e,i;if(Ps(Dc,n)&&(i=Dc[n],n="%"+i[0]+"%"),Ps(nn,n)){var s=nn[n];if(s===Bn&&(s=Tg(n)),typeof s>"u"&&!r)throw new Vn("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Zn("intrinsic "+e+" does not exist!")},pn=function(e,r){if(typeof e!="string"||e.length===0)throw new Vn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Vn('"allowMissing" argument must be a boolean');if(Ng(/^%?[^%]*%?$/,e)===null)throw new Zn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Dg(e),i=n.length>0?n[0]:"",s=$g("%"+i+"%",r),o=s.name,a=s.value,c=!1,l=s.alias;l&&(i=l[0],Og(n,kg([0,1],l)));for(var d=1,g=!0;d=n.length){var D=rn(a,y);g=!!D,g&&"get"in D&&!("originalValue"in D.get)?a=D.get:a=a[y]}else g=Ps(a,y),a=a[y];g&&!c&&(nn[o]=a)}}return a},oh={exports:{}},Bg=pn,Za=Bg("%Object.defineProperty%",!0),Qa=function(){if(Za)try{return Za({},"a",{value:1}),!0}catch{return!1}return!1};Qa.hasArrayLengthDefineBug=function(){if(!Qa())return null;try{return Za([],"length",{value:1}).length!==1}catch{return!0}};var ah=Qa,jg=pn,As=jg("%Object.getOwnPropertyDescriptor%",!0);if(As)try{As([],"length")}catch{As=null}var uh=As,Fg=ah(),xu=pn,Ii=Fg&&xu("%Object.defineProperty%",!0);if(Ii)try{Ii({},"a",{value:1})}catch{Ii=!1}var Wg=xu("%SyntaxError%"),On=xu("%TypeError%"),Bc=uh,Hg=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new On("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new On("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new On("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new On("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new On("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new On("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,c=!!Bc&&Bc(e,r);if(Ii)Ii(e,r,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:n,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new Wg("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},ch=pn,jc=Hg,Vg=ah(),Fc=uh,Wc=ch("%TypeError%"),Ug=ch("%Math.floor%"),zg=function(e,r){if(typeof e!="function")throw new Wc("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Ug(r)!==r)throw new Wc("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&Fc){var o=Fc(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(Vg?jc(e,"length",r,!0,!0):jc(e,"length",r)),e};(function(t){var e=Eu,r=pn,n=zg,i=r("%TypeError%"),s=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||e.call(o,s),c=r("%Object.defineProperty%",!0),l=r("%Math.max%");if(c)try{c({},"a",{value:1})}catch{c=null}t.exports=function(y){if(typeof y!="function")throw new i("a function is required");var C=a(e,o,arguments);return n(C,1+l(0,y.length-(arguments.length-1)),!0)};var d=function(){return a(e,s,arguments)};c?c(t.exports,"apply",{value:d}):t.exports.apply=d})(oh);var qg=oh.exports,lh=pn,fh=qg,Gg=fh(lh("String.prototype.indexOf")),Jg=function(e,r){var n=lh(e,!!r);return typeof n=="function"&&Gg(e,".prototype.")>-1?fh(n):n},Mu=typeof Map=="function"&&Map.prototype,sa=Object.getOwnPropertyDescriptor&&Mu?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,$s=Mu&&sa&&typeof sa.get=="function"?sa.get:null,Hc=Mu&&Map.prototype.forEach,Cu=typeof Set=="function"&&Set.prototype,oa=Object.getOwnPropertyDescriptor&&Cu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Bs=Cu&&oa&&typeof oa.get=="function"?oa.get:null,Vc=Cu&&Set.prototype.forEach,Zg=typeof WeakMap=="function"&&WeakMap.prototype,Ai=Zg?WeakMap.prototype.has:null,Qg=typeof WeakSet=="function"&&WeakSet.prototype,Ti=Qg?WeakSet.prototype.has:null,Yg=typeof WeakRef=="function"&&WeakRef.prototype,Uc=Yg?WeakRef.prototype.deref:null,Kg=Boolean.prototype.valueOf,Xg=Object.prototype.toString,eb=Function.prototype.toString,tb=String.prototype.match,Ru=String.prototype.slice,xr=String.prototype.replace,rb=String.prototype.toUpperCase,zc=String.prototype.toLowerCase,hh=RegExp.prototype.test,qc=Array.prototype.concat,tr=Array.prototype.join,nb=Array.prototype.slice,Gc=Math.floor,Ya=typeof BigInt=="function"?BigInt.prototype.valueOf:null,aa=Object.getOwnPropertySymbols,Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",bt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qn||"symbol")?Symbol.toStringTag:null,dh=Object.prototype.propertyIsEnumerable,Jc=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Zc(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||hh.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-Gc(-t):Gc(t);if(n!==t){var i=String(n),s=Ru.call(e,i.length+1);return xr.call(i,r,"$&_")+"."+xr.call(xr.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return xr.call(e,r,"$&_")}var Xa=Gs,Qc=Xa.custom,Yc=gh(Qc)?Qc:null,ib=function t(e,r,n,i){var s=r||{};if(_r(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(_r(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=_r(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(_r(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(_r(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return vh(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?Zc(e,c):c}if(typeof e=="bigint"){var l=String(e)+"n";return a?Zc(e,l):l}var d=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=d&&d>0&&typeof e=="object")return eu(e)?"[Array]":"[Object]";var g=Sb(s,n);if(typeof i>"u")i=[];else if(bh(i,e)>=0)return"[Circular]";function y(b,u,h){if(u&&(i=nb.call(i),i.push(u)),h){var p={depth:s.depth};return _r(s,"quoteStyle")&&(p.quoteStyle=s.quoteStyle),t(b,p,n+1,i)}return t(b,s,n+1,i)}if(typeof e=="function"&&!Kc(e)){var C=db(e),A=ds(e,y);return"[Function"+(C?": "+C:" (anonymous)")+"]"+(A.length>0?" { "+tr.call(A,", ")+" }":"")}if(gh(e)){var D=Qn?xr.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ka.call(e);return typeof e=="object"&&!Qn?Si(D):D}if(mb(e)){for(var N="<"+zc.call(String(e.nodeName)),x=e.attributes||[],I=0;I",N}if(eu(e)){if(e.length===0)return"[]";var O=ds(e,y);return g&&!_b(O)?"["+tu(O,g)+"]":"[ "+tr.call(O,", ")+" ]"}if(ab(e)){var P=ds(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!dh.call(e,"cause")?"{ ["+String(e)+"] "+tr.call(qc.call("[cause]: "+y(e.cause),P),", ")+" }":P.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+tr.call(P,", ")+" }"}if(typeof e=="object"&&o){if(Yc&&typeof e[Yc]=="function"&&Xa)return Xa(e,{depth:d-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(pb(e)){var L=[];return Hc&&Hc.call(e,function(b,u){L.push(y(u,e,!0)+" => "+y(b,e))}),Xc("Map",$s.call(e),L,g)}if(vb(e)){var B=[];return Vc&&Vc.call(e,function(b){B.push(y(b,e))}),Xc("Set",Bs.call(e),B,g)}if(gb(e))return ua("WeakMap");if(yb(e))return ua("WeakSet");if(bb(e))return ua("WeakRef");if(cb(e))return Si(y(Number(e)));if(fb(e))return Si(y(Ya.call(e)));if(lb(e))return Si(Kg.call(e));if(ub(e))return Si(y(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===globalThis)return"{ [object globalThis] }";if(!ob(e)&&!Kc(e)){var G=ds(e,y),z=Jc?Jc(e)===Object.prototype:e instanceof Object||e.constructor===Object,W=e instanceof Object?"":"null prototype",K=!z&&bt&&Object(e)===e&&bt in e?Ru.call(kr(e),8,-1):W?"Object":"",Y=z||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",X=Y+(K||W?"["+tr.call(qc.call([],K||[],W||[]),": ")+"] ":"");return G.length===0?X+"{}":g?X+"{"+tu(G,g)+"}":X+"{ "+tr.call(G,", ")+" }"}return String(e)};function ph(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function sb(t){return xr.call(String(t),/"/g,""")}function eu(t){return kr(t)==="[object Array]"&&(!bt||!(typeof t=="object"&&bt in t))}function ob(t){return kr(t)==="[object Date]"&&(!bt||!(typeof t=="object"&&bt in t))}function Kc(t){return kr(t)==="[object RegExp]"&&(!bt||!(typeof t=="object"&&bt in t))}function ab(t){return kr(t)==="[object Error]"&&(!bt||!(typeof t=="object"&&bt in t))}function ub(t){return kr(t)==="[object String]"&&(!bt||!(typeof t=="object"&&bt in t))}function cb(t){return kr(t)==="[object Number]"&&(!bt||!(typeof t=="object"&&bt in t))}function lb(t){return kr(t)==="[object Boolean]"&&(!bt||!(typeof t=="object"&&bt in t))}function gh(t){if(Qn)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Ka)return!1;try{return Ka.call(t),!0}catch{}return!1}function fb(t){if(!t||typeof t!="object"||!Ya)return!1;try{return Ya.call(t),!0}catch{}return!1}var hb=Object.prototype.hasOwnProperty||function(t){return t in this};function _r(t,e){return hb.call(t,e)}function kr(t){return Xg.call(t)}function db(t){if(t.name)return t.name;var e=tb.call(eb.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function bh(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return vh(Ru.call(t,0,e.maxStringLength),e)+n}var i=xr.call(xr.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,wb);return ph(i,"single",e)}function wb(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+rb.call(e.toString(16))}function Si(t){return"Object("+t+")"}function ua(t){return t+" { ? }"}function Xc(t,e,r,n){var i=n?tu(r,n):tr.call(r,", ");return t+" ("+e+") {"+i+"}"}function _b(t){for(var e=0;en[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var yu={},Pi={},Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.walletLogo=void 0;const Jp=(t,e)=>{let r;switch(t){case"standard":return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};Js.walletLogo=Jp;var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.LINK_API_URL=void 0;Zs.LINK_API_URL="https://www.walletlink.org";var Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.ScopedLocalStorage=void 0;class Zp{constructor(e){this.scope=e}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`${this.scope}:${e}`}}Qs.ScopedLocalStorage=Zp;var Jn={},fn={};Object.defineProperty(fn,"__esModule",{value:!0});const Qp=vu;function Rc(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function Yp(t){const e=t.length,r=new Array(e);for(let n=0;n0&&([o]=r),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const s=i[e];if(s===void 0)return!1;if(typeof s=="function")Rc(s,this,r);else{const o=s.length,a=Yp(s);for(let c=0;c0?u:h},s.min=function(u,h){return u.cmp(h)<0?u:h},s.prototype._init=function(u,h,p){if(typeof u=="number")return this._initNumber(u,h,p);if(typeof u=="object")return this._initArray(u,h,p);h==="hex"&&(h=16),n(h===(h|0)&&h>=2&&h<=36),u=u.toString().replace(/\s+/g,"");var v=0;u[0]==="-"&&(v++,this.negative=1),v=0;v-=3)M=u[v]|u[v-1]<<8|u[v-2]<<16,this.words[w]|=M<>>26-T&67108863,T+=24,T>=26&&(T-=26,w++);else if(p==="le")for(v=0,w=0;v>>26-T&67108863,T+=24,T>=26&&(T-=26,w++);return this._strip()};function a(b,u){var h=b.charCodeAt(u);if(h>=48&&h<=57)return h-48;if(h>=65&&h<=70)return h-55;if(h>=97&&h<=102)return h-87;n(!1,"Invalid character in "+b)}function c(b,u,h){var p=a(b,h);return h-1>=u&&(p|=a(b,h-1)<<4),p}s.prototype._parseHex=function(u,h,p){this.length=Math.ceil((u.length-h)/6),this.words=new Array(this.length);for(var v=0;v=h;v-=2)T=c(u,h,v)<=18?(w-=18,M+=1,this.words[M]|=T>>>26):w+=8;else{var m=u.length-h;for(v=m%2===0?h+1:h;v=18?(w-=18,M+=1,this.words[M]|=T>>>26):w+=8}this._strip()};function l(b,u,h,p){for(var v=0,w=0,M=Math.min(b.length,h),T=u;T=49?w=m-49+10:m>=17?w=m-17+10:w=m,n(m>=0&&w1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=g}catch{s.prototype.inspect=g}else s.prototype.inspect=g;function g(){return(this.red?""}var y=["","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],A=[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];s.prototype.toString=function(u,h){u=u||10,h=h|0||1;var p;if(u===16||u==="hex"){p="";for(var v=0,w=0,M=0;M>>24-v&16777215,v+=2,v>=26&&(v-=26,M--),w!==0||M!==this.length-1?p=y[6-m.length]+m+p:p=m+p}for(w!==0&&(p=w.toString(16)+p);p.length%h!==0;)p="0"+p;return this.negative!==0&&(p="-"+p),p}if(u===(u|0)&&u>=2&&u<=36){var f=C[u],E=A[u];p="";var U=this.clone();for(U.negative=0;!U.isZero();){var q=U.modrn(E).toString(u);U=U.idivn(E),U.isZero()?p=q+p:p=y[f-q.length]+q+p}for(this.isZero()&&(p="0"+p);p.length%h!==0;)p="0"+p;return this.negative!==0&&(p="-"+p),p}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(u,h){return this.toArrayLike(o,u,h)}),s.prototype.toArray=function(u,h){return this.toArrayLike(Array,u,h)};var D=function(u,h){return u.allocUnsafe?u.allocUnsafe(h):new u(h)};s.prototype.toArrayLike=function(u,h,p){this._strip();var v=this.byteLength(),w=p||Math.max(1,v);n(v<=w,"byte array longer than desired length"),n(w>0,"Requested array length <= 0");var M=D(u,w),T=h==="le"?"LE":"BE";return this["_toArrayLike"+T](M,v),M},s.prototype._toArrayLikeLE=function(u,h){for(var p=0,v=0,w=0,M=0;w>8&255),p>16&255),M===6?(p>24&255),v=0,M=0):(v=T>>>24,M+=2)}if(p=0&&(u[p--]=T>>8&255),p>=0&&(u[p--]=T>>16&255),M===6?(p>=0&&(u[p--]=T>>24&255),v=0,M=0):(v=T>>>24,M+=2)}if(p>=0)for(u[p--]=v;p>=0;)u[p--]=0},Math.clz32?s.prototype._countBits=function(u){return 32-Math.clz32(u)}:s.prototype._countBits=function(u){var h=u,p=0;return h>=4096&&(p+=13,h>>>=13),h>=64&&(p+=7,h>>>=7),h>=8&&(p+=4,h>>>=4),h>=2&&(p+=2,h>>>=2),p+h},s.prototype._zeroBits=function(u){if(u===0)return 26;var h=u,p=0;return h&8191||(p+=13,h>>>=13),h&127||(p+=7,h>>>=7),h&15||(p+=4,h>>>=4),h&3||(p+=2,h>>>=2),h&1||p++,p},s.prototype.bitLength=function(){var u=this.words[this.length-1],h=this._countBits(u);return(this.length-1)*26+h};function N(b){for(var u=new Array(b.bitLength()),h=0;h>>v&1}return u}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,h=0;hu.length?this.clone().ior(u):u.clone().ior(this)},s.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},s.prototype.iuand=function(u){var h;this.length>u.length?h=u:h=this;for(var p=0;pu.length?this.clone().iand(u):u.clone().iand(this)},s.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},s.prototype.iuxor=function(u){var h,p;this.length>u.length?(h=this,p=u):(h=u,p=this);for(var v=0;vu.length?this.clone().ixor(u):u.clone().ixor(this)},s.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},s.prototype.inotn=function(u){n(typeof u=="number"&&u>=0);var h=Math.ceil(u/26)|0,p=u%26;this._expand(h),p>0&&h--;for(var v=0;v0&&(this.words[v]=~this.words[v]&67108863>>26-p),this._strip()},s.prototype.notn=function(u){return this.clone().inotn(u)},s.prototype.setn=function(u,h){n(typeof u=="number"&&u>=0);var p=u/26|0,v=u%26;return this._expand(p+1),h?this.words[p]=this.words[p]|1<u.length?(p=this,v=u):(p=u,v=this);for(var w=0,M=0;M>>26;for(;w!==0&&M>>26;if(this.length=p.length,w!==0)this.words[this.length]=w,this.length++;else if(p!==this)for(;Mu.length?this.clone().iadd(u):u.clone().iadd(this)},s.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var h=this.iadd(u);return u.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var p=this.cmp(u);if(p===0)return this.negative=0,this.length=1,this.words[0]=0,this;var v,w;p>0?(v=this,w=u):(v=u,w=this);for(var M=0,T=0;T>26,this.words[T]=h&67108863;for(;M!==0&&T>26,this.words[T]=h&67108863;if(M===0&&T>>26,U=m&67108863,q=Math.min(f,u.length-1),R=Math.max(0,f-b.length+1);R<=q;R++){var k=f-R|0;v=b.words[k]|0,w=u.words[R]|0,M=v*w+U,E+=M/67108864|0,U=M&67108863}h.words[f]=U|0,m=E|0}return m!==0?h.words[f]=m|0:h.length--,h._strip()}var I=function(u,h,p){var v=u.words,w=h.words,M=p.words,T=0,m,f,E,U=v[0]|0,q=U&8191,R=U>>>13,k=v[1]|0,$=k&8191,V=k>>>13,se=v[2]|0,_=se&8191,S=se>>>13,F=v[3]|0,H=F&8191,re=F>>>13,ie=v[4]|0,ee=ie&8191,de=ie>>>13,Jt=v[5]|0,we=Jt&8191,Se=Jt>>>13,vr=v[6]|0,ve=vr&8191,ye=vr>>>13,ur=v[7]|0,be=ur&8191,pe=ur>>>13,xt=v[8]|0,Ee=xt&8191,xe=xt>>>13,wn=v[9]|0,Me=wn&8191,Ce=wn>>>13,_n=w[0]|0,Re=_n&8191,Ie=_n>>>13,Sn=w[1]|0,Ae=Sn&8191,Te=Sn>>>13,En=w[2]|0,ke=En&8191,Oe=En>>>13,xn=w[3]|0,Ne=xn&8191,Le=xn>>>13,Mn=w[4]|0,Pe=Mn&8191,De=Mn>>>13,Cn=w[5]|0,$e=Cn&8191,Be=Cn>>>13,Rn=w[6]|0,je=Rn&8191,Fe=Rn>>>13,In=w[7]|0,We=In&8191,He=In>>>13,An=w[8]|0,Ve=An&8191,Ue=An>>>13,Tn=w[9]|0,ze=Tn&8191,qe=Tn>>>13;p.negative=u.negative^h.negative,p.length=19,m=Math.imul(q,Re),f=Math.imul(q,Ie),f=f+Math.imul(R,Re)|0,E=Math.imul(R,Ie);var Or=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Or>>>26)|0,Or&=67108863,m=Math.imul($,Re),f=Math.imul($,Ie),f=f+Math.imul(V,Re)|0,E=Math.imul(V,Ie),m=m+Math.imul(q,Ae)|0,f=f+Math.imul(q,Te)|0,f=f+Math.imul(R,Ae)|0,E=E+Math.imul(R,Te)|0;var Nr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Nr>>>26)|0,Nr&=67108863,m=Math.imul(_,Re),f=Math.imul(_,Ie),f=f+Math.imul(S,Re)|0,E=Math.imul(S,Ie),m=m+Math.imul($,Ae)|0,f=f+Math.imul($,Te)|0,f=f+Math.imul(V,Ae)|0,E=E+Math.imul(V,Te)|0,m=m+Math.imul(q,ke)|0,f=f+Math.imul(q,Oe)|0,f=f+Math.imul(R,ke)|0,E=E+Math.imul(R,Oe)|0;var Lr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,m=Math.imul(H,Re),f=Math.imul(H,Ie),f=f+Math.imul(re,Re)|0,E=Math.imul(re,Ie),m=m+Math.imul(_,Ae)|0,f=f+Math.imul(_,Te)|0,f=f+Math.imul(S,Ae)|0,E=E+Math.imul(S,Te)|0,m=m+Math.imul($,ke)|0,f=f+Math.imul($,Oe)|0,f=f+Math.imul(V,ke)|0,E=E+Math.imul(V,Oe)|0,m=m+Math.imul(q,Ne)|0,f=f+Math.imul(q,Le)|0,f=f+Math.imul(R,Ne)|0,E=E+Math.imul(R,Le)|0;var Pr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Pr>>>26)|0,Pr&=67108863,m=Math.imul(ee,Re),f=Math.imul(ee,Ie),f=f+Math.imul(de,Re)|0,E=Math.imul(de,Ie),m=m+Math.imul(H,Ae)|0,f=f+Math.imul(H,Te)|0,f=f+Math.imul(re,Ae)|0,E=E+Math.imul(re,Te)|0,m=m+Math.imul(_,ke)|0,f=f+Math.imul(_,Oe)|0,f=f+Math.imul(S,ke)|0,E=E+Math.imul(S,Oe)|0,m=m+Math.imul($,Ne)|0,f=f+Math.imul($,Le)|0,f=f+Math.imul(V,Ne)|0,E=E+Math.imul(V,Le)|0,m=m+Math.imul(q,Pe)|0,f=f+Math.imul(q,De)|0,f=f+Math.imul(R,Pe)|0,E=E+Math.imul(R,De)|0;var Dr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,m=Math.imul(we,Re),f=Math.imul(we,Ie),f=f+Math.imul(Se,Re)|0,E=Math.imul(Se,Ie),m=m+Math.imul(ee,Ae)|0,f=f+Math.imul(ee,Te)|0,f=f+Math.imul(de,Ae)|0,E=E+Math.imul(de,Te)|0,m=m+Math.imul(H,ke)|0,f=f+Math.imul(H,Oe)|0,f=f+Math.imul(re,ke)|0,E=E+Math.imul(re,Oe)|0,m=m+Math.imul(_,Ne)|0,f=f+Math.imul(_,Le)|0,f=f+Math.imul(S,Ne)|0,E=E+Math.imul(S,Le)|0,m=m+Math.imul($,Pe)|0,f=f+Math.imul($,De)|0,f=f+Math.imul(V,Pe)|0,E=E+Math.imul(V,De)|0,m=m+Math.imul(q,$e)|0,f=f+Math.imul(q,Be)|0,f=f+Math.imul(R,$e)|0,E=E+Math.imul(R,Be)|0;var $r=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+($r>>>26)|0,$r&=67108863,m=Math.imul(ve,Re),f=Math.imul(ve,Ie),f=f+Math.imul(ye,Re)|0,E=Math.imul(ye,Ie),m=m+Math.imul(we,Ae)|0,f=f+Math.imul(we,Te)|0,f=f+Math.imul(Se,Ae)|0,E=E+Math.imul(Se,Te)|0,m=m+Math.imul(ee,ke)|0,f=f+Math.imul(ee,Oe)|0,f=f+Math.imul(de,ke)|0,E=E+Math.imul(de,Oe)|0,m=m+Math.imul(H,Ne)|0,f=f+Math.imul(H,Le)|0,f=f+Math.imul(re,Ne)|0,E=E+Math.imul(re,Le)|0,m=m+Math.imul(_,Pe)|0,f=f+Math.imul(_,De)|0,f=f+Math.imul(S,Pe)|0,E=E+Math.imul(S,De)|0,m=m+Math.imul($,$e)|0,f=f+Math.imul($,Be)|0,f=f+Math.imul(V,$e)|0,E=E+Math.imul(V,Be)|0,m=m+Math.imul(q,je)|0,f=f+Math.imul(q,Fe)|0,f=f+Math.imul(R,je)|0,E=E+Math.imul(R,Fe)|0;var Br=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Br>>>26)|0,Br&=67108863,m=Math.imul(be,Re),f=Math.imul(be,Ie),f=f+Math.imul(pe,Re)|0,E=Math.imul(pe,Ie),m=m+Math.imul(ve,Ae)|0,f=f+Math.imul(ve,Te)|0,f=f+Math.imul(ye,Ae)|0,E=E+Math.imul(ye,Te)|0,m=m+Math.imul(we,ke)|0,f=f+Math.imul(we,Oe)|0,f=f+Math.imul(Se,ke)|0,E=E+Math.imul(Se,Oe)|0,m=m+Math.imul(ee,Ne)|0,f=f+Math.imul(ee,Le)|0,f=f+Math.imul(de,Ne)|0,E=E+Math.imul(de,Le)|0,m=m+Math.imul(H,Pe)|0,f=f+Math.imul(H,De)|0,f=f+Math.imul(re,Pe)|0,E=E+Math.imul(re,De)|0,m=m+Math.imul(_,$e)|0,f=f+Math.imul(_,Be)|0,f=f+Math.imul(S,$e)|0,E=E+Math.imul(S,Be)|0,m=m+Math.imul($,je)|0,f=f+Math.imul($,Fe)|0,f=f+Math.imul(V,je)|0,E=E+Math.imul(V,Fe)|0,m=m+Math.imul(q,We)|0,f=f+Math.imul(q,He)|0,f=f+Math.imul(R,We)|0,E=E+Math.imul(R,He)|0;var jr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(jr>>>26)|0,jr&=67108863,m=Math.imul(Ee,Re),f=Math.imul(Ee,Ie),f=f+Math.imul(xe,Re)|0,E=Math.imul(xe,Ie),m=m+Math.imul(be,Ae)|0,f=f+Math.imul(be,Te)|0,f=f+Math.imul(pe,Ae)|0,E=E+Math.imul(pe,Te)|0,m=m+Math.imul(ve,ke)|0,f=f+Math.imul(ve,Oe)|0,f=f+Math.imul(ye,ke)|0,E=E+Math.imul(ye,Oe)|0,m=m+Math.imul(we,Ne)|0,f=f+Math.imul(we,Le)|0,f=f+Math.imul(Se,Ne)|0,E=E+Math.imul(Se,Le)|0,m=m+Math.imul(ee,Pe)|0,f=f+Math.imul(ee,De)|0,f=f+Math.imul(de,Pe)|0,E=E+Math.imul(de,De)|0,m=m+Math.imul(H,$e)|0,f=f+Math.imul(H,Be)|0,f=f+Math.imul(re,$e)|0,E=E+Math.imul(re,Be)|0,m=m+Math.imul(_,je)|0,f=f+Math.imul(_,Fe)|0,f=f+Math.imul(S,je)|0,E=E+Math.imul(S,Fe)|0,m=m+Math.imul($,We)|0,f=f+Math.imul($,He)|0,f=f+Math.imul(V,We)|0,E=E+Math.imul(V,He)|0,m=m+Math.imul(q,Ve)|0,f=f+Math.imul(q,Ue)|0,f=f+Math.imul(R,Ve)|0,E=E+Math.imul(R,Ue)|0;var Fr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Fr>>>26)|0,Fr&=67108863,m=Math.imul(Me,Re),f=Math.imul(Me,Ie),f=f+Math.imul(Ce,Re)|0,E=Math.imul(Ce,Ie),m=m+Math.imul(Ee,Ae)|0,f=f+Math.imul(Ee,Te)|0,f=f+Math.imul(xe,Ae)|0,E=E+Math.imul(xe,Te)|0,m=m+Math.imul(be,ke)|0,f=f+Math.imul(be,Oe)|0,f=f+Math.imul(pe,ke)|0,E=E+Math.imul(pe,Oe)|0,m=m+Math.imul(ve,Ne)|0,f=f+Math.imul(ve,Le)|0,f=f+Math.imul(ye,Ne)|0,E=E+Math.imul(ye,Le)|0,m=m+Math.imul(we,Pe)|0,f=f+Math.imul(we,De)|0,f=f+Math.imul(Se,Pe)|0,E=E+Math.imul(Se,De)|0,m=m+Math.imul(ee,$e)|0,f=f+Math.imul(ee,Be)|0,f=f+Math.imul(de,$e)|0,E=E+Math.imul(de,Be)|0,m=m+Math.imul(H,je)|0,f=f+Math.imul(H,Fe)|0,f=f+Math.imul(re,je)|0,E=E+Math.imul(re,Fe)|0,m=m+Math.imul(_,We)|0,f=f+Math.imul(_,He)|0,f=f+Math.imul(S,We)|0,E=E+Math.imul(S,He)|0,m=m+Math.imul($,Ve)|0,f=f+Math.imul($,Ue)|0,f=f+Math.imul(V,Ve)|0,E=E+Math.imul(V,Ue)|0,m=m+Math.imul(q,ze)|0,f=f+Math.imul(q,qe)|0,f=f+Math.imul(R,ze)|0,E=E+Math.imul(R,qe)|0;var Wr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,m=Math.imul(Me,Ae),f=Math.imul(Me,Te),f=f+Math.imul(Ce,Ae)|0,E=Math.imul(Ce,Te),m=m+Math.imul(Ee,ke)|0,f=f+Math.imul(Ee,Oe)|0,f=f+Math.imul(xe,ke)|0,E=E+Math.imul(xe,Oe)|0,m=m+Math.imul(be,Ne)|0,f=f+Math.imul(be,Le)|0,f=f+Math.imul(pe,Ne)|0,E=E+Math.imul(pe,Le)|0,m=m+Math.imul(ve,Pe)|0,f=f+Math.imul(ve,De)|0,f=f+Math.imul(ye,Pe)|0,E=E+Math.imul(ye,De)|0,m=m+Math.imul(we,$e)|0,f=f+Math.imul(we,Be)|0,f=f+Math.imul(Se,$e)|0,E=E+Math.imul(Se,Be)|0,m=m+Math.imul(ee,je)|0,f=f+Math.imul(ee,Fe)|0,f=f+Math.imul(de,je)|0,E=E+Math.imul(de,Fe)|0,m=m+Math.imul(H,We)|0,f=f+Math.imul(H,He)|0,f=f+Math.imul(re,We)|0,E=E+Math.imul(re,He)|0,m=m+Math.imul(_,Ve)|0,f=f+Math.imul(_,Ue)|0,f=f+Math.imul(S,Ve)|0,E=E+Math.imul(S,Ue)|0,m=m+Math.imul($,ze)|0,f=f+Math.imul($,qe)|0,f=f+Math.imul(V,ze)|0,E=E+Math.imul(V,qe)|0;var Hr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,m=Math.imul(Me,ke),f=Math.imul(Me,Oe),f=f+Math.imul(Ce,ke)|0,E=Math.imul(Ce,Oe),m=m+Math.imul(Ee,Ne)|0,f=f+Math.imul(Ee,Le)|0,f=f+Math.imul(xe,Ne)|0,E=E+Math.imul(xe,Le)|0,m=m+Math.imul(be,Pe)|0,f=f+Math.imul(be,De)|0,f=f+Math.imul(pe,Pe)|0,E=E+Math.imul(pe,De)|0,m=m+Math.imul(ve,$e)|0,f=f+Math.imul(ve,Be)|0,f=f+Math.imul(ye,$e)|0,E=E+Math.imul(ye,Be)|0,m=m+Math.imul(we,je)|0,f=f+Math.imul(we,Fe)|0,f=f+Math.imul(Se,je)|0,E=E+Math.imul(Se,Fe)|0,m=m+Math.imul(ee,We)|0,f=f+Math.imul(ee,He)|0,f=f+Math.imul(de,We)|0,E=E+Math.imul(de,He)|0,m=m+Math.imul(H,Ve)|0,f=f+Math.imul(H,Ue)|0,f=f+Math.imul(re,Ve)|0,E=E+Math.imul(re,Ue)|0,m=m+Math.imul(_,ze)|0,f=f+Math.imul(_,qe)|0,f=f+Math.imul(S,ze)|0,E=E+Math.imul(S,qe)|0;var Vr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,m=Math.imul(Me,Ne),f=Math.imul(Me,Le),f=f+Math.imul(Ce,Ne)|0,E=Math.imul(Ce,Le),m=m+Math.imul(Ee,Pe)|0,f=f+Math.imul(Ee,De)|0,f=f+Math.imul(xe,Pe)|0,E=E+Math.imul(xe,De)|0,m=m+Math.imul(be,$e)|0,f=f+Math.imul(be,Be)|0,f=f+Math.imul(pe,$e)|0,E=E+Math.imul(pe,Be)|0,m=m+Math.imul(ve,je)|0,f=f+Math.imul(ve,Fe)|0,f=f+Math.imul(ye,je)|0,E=E+Math.imul(ye,Fe)|0,m=m+Math.imul(we,We)|0,f=f+Math.imul(we,He)|0,f=f+Math.imul(Se,We)|0,E=E+Math.imul(Se,He)|0,m=m+Math.imul(ee,Ve)|0,f=f+Math.imul(ee,Ue)|0,f=f+Math.imul(de,Ve)|0,E=E+Math.imul(de,Ue)|0,m=m+Math.imul(H,ze)|0,f=f+Math.imul(H,qe)|0,f=f+Math.imul(re,ze)|0,E=E+Math.imul(re,qe)|0;var Ur=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Ur>>>26)|0,Ur&=67108863,m=Math.imul(Me,Pe),f=Math.imul(Me,De),f=f+Math.imul(Ce,Pe)|0,E=Math.imul(Ce,De),m=m+Math.imul(Ee,$e)|0,f=f+Math.imul(Ee,Be)|0,f=f+Math.imul(xe,$e)|0,E=E+Math.imul(xe,Be)|0,m=m+Math.imul(be,je)|0,f=f+Math.imul(be,Fe)|0,f=f+Math.imul(pe,je)|0,E=E+Math.imul(pe,Fe)|0,m=m+Math.imul(ve,We)|0,f=f+Math.imul(ve,He)|0,f=f+Math.imul(ye,We)|0,E=E+Math.imul(ye,He)|0,m=m+Math.imul(we,Ve)|0,f=f+Math.imul(we,Ue)|0,f=f+Math.imul(Se,Ve)|0,E=E+Math.imul(Se,Ue)|0,m=m+Math.imul(ee,ze)|0,f=f+Math.imul(ee,qe)|0,f=f+Math.imul(de,ze)|0,E=E+Math.imul(de,qe)|0;var zr=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(zr>>>26)|0,zr&=67108863,m=Math.imul(Me,$e),f=Math.imul(Me,Be),f=f+Math.imul(Ce,$e)|0,E=Math.imul(Ce,Be),m=m+Math.imul(Ee,je)|0,f=f+Math.imul(Ee,Fe)|0,f=f+Math.imul(xe,je)|0,E=E+Math.imul(xe,Fe)|0,m=m+Math.imul(be,We)|0,f=f+Math.imul(be,He)|0,f=f+Math.imul(pe,We)|0,E=E+Math.imul(pe,He)|0,m=m+Math.imul(ve,Ve)|0,f=f+Math.imul(ve,Ue)|0,f=f+Math.imul(ye,Ve)|0,E=E+Math.imul(ye,Ue)|0,m=m+Math.imul(we,ze)|0,f=f+Math.imul(we,qe)|0,f=f+Math.imul(Se,ze)|0,E=E+Math.imul(Se,qe)|0;var Ko=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Ko>>>26)|0,Ko&=67108863,m=Math.imul(Me,je),f=Math.imul(Me,Fe),f=f+Math.imul(Ce,je)|0,E=Math.imul(Ce,Fe),m=m+Math.imul(Ee,We)|0,f=f+Math.imul(Ee,He)|0,f=f+Math.imul(xe,We)|0,E=E+Math.imul(xe,He)|0,m=m+Math.imul(be,Ve)|0,f=f+Math.imul(be,Ue)|0,f=f+Math.imul(pe,Ve)|0,E=E+Math.imul(pe,Ue)|0,m=m+Math.imul(ve,ze)|0,f=f+Math.imul(ve,qe)|0,f=f+Math.imul(ye,ze)|0,E=E+Math.imul(ye,qe)|0;var Xo=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(Xo>>>26)|0,Xo&=67108863,m=Math.imul(Me,We),f=Math.imul(Me,He),f=f+Math.imul(Ce,We)|0,E=Math.imul(Ce,He),m=m+Math.imul(Ee,Ve)|0,f=f+Math.imul(Ee,Ue)|0,f=f+Math.imul(xe,Ve)|0,E=E+Math.imul(xe,Ue)|0,m=m+Math.imul(be,ze)|0,f=f+Math.imul(be,qe)|0,f=f+Math.imul(pe,ze)|0,E=E+Math.imul(pe,qe)|0;var ea=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(ea>>>26)|0,ea&=67108863,m=Math.imul(Me,Ve),f=Math.imul(Me,Ue),f=f+Math.imul(Ce,Ve)|0,E=Math.imul(Ce,Ue),m=m+Math.imul(Ee,ze)|0,f=f+Math.imul(Ee,qe)|0,f=f+Math.imul(xe,ze)|0,E=E+Math.imul(xe,qe)|0;var ta=(T+m|0)+((f&8191)<<13)|0;T=(E+(f>>>13)|0)+(ta>>>26)|0,ta&=67108863,m=Math.imul(Me,ze),f=Math.imul(Me,qe),f=f+Math.imul(Ce,ze)|0,E=Math.imul(Ce,qe);var ra=(T+m|0)+((f&8191)<<13)|0;return T=(E+(f>>>13)|0)+(ra>>>26)|0,ra&=67108863,M[0]=Or,M[1]=Nr,M[2]=Lr,M[3]=Pr,M[4]=Dr,M[5]=$r,M[6]=Br,M[7]=jr,M[8]=Fr,M[9]=Wr,M[10]=Hr,M[11]=Vr,M[12]=Ur,M[13]=zr,M[14]=Ko,M[15]=Xo,M[16]=ea,M[17]=ta,M[18]=ra,T!==0&&(M[19]=T,p.length++),p};Math.imul||(I=x);function O(b,u,h){h.negative=u.negative^b.negative,h.length=b.length+u.length;for(var p=0,v=0,w=0;w>>26)|0,v+=M>>>26,M&=67108863}h.words[w]=T,p=M,M=v}return p!==0?h.words[w]=p:h.length--,h._strip()}function P(b,u,h){return O(b,u,h)}s.prototype.mulTo=function(u,h){var p,v=this.length+u.length;return this.length===10&&u.length===10?p=I(this,u,h):v<63?p=x(this,u,h):v<1024?p=O(this,u,h):p=P(this,u,h),p},s.prototype.mul=function(u){var h=new s(null);return h.words=new Array(this.length+u.length),this.mulTo(u,h)},s.prototype.mulf=function(u){var h=new s(null);return h.words=new Array(this.length+u.length),P(this,u,h)},s.prototype.imul=function(u){return this.clone().mulTo(u,this)},s.prototype.imuln=function(u){var h=u<0;h&&(u=-u),n(typeof u=="number"),n(u<67108864);for(var p=0,v=0;v>=26,p+=w/67108864|0,p+=M>>>26,this.words[v]=M&67108863}return p!==0&&(this.words[v]=p,this.length++),h?this.ineg():this},s.prototype.muln=function(u){return this.clone().imuln(u)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(u){var h=N(u);if(h.length===0)return new s(1);for(var p=this,v=0;v=0);var h=u%26,p=(u-h)/26,v=67108863>>>26-h<<26-h,w;if(h!==0){var M=0;for(w=0;w>>26-h}M&&(this.words[w]=M,this.length++)}if(p!==0){for(w=this.length-1;w>=0;w--)this.words[w+p]=this.words[w];for(w=0;w=0);var v;h?v=(h-h%26)/26:v=0;var w=u%26,M=Math.min((u-w)/26,this.length),T=67108863^67108863>>>w<M)for(this.length-=M,f=0;f=0&&(E!==0||f>=v);f--){var U=this.words[f]|0;this.words[f]=E<<26-w|U>>>w,E=U&T}return m&&E!==0&&(m.words[m.length++]=E),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(u,h,p){return n(this.negative===0),this.iushrn(u,h,p)},s.prototype.shln=function(u){return this.clone().ishln(u)},s.prototype.ushln=function(u){return this.clone().iushln(u)},s.prototype.shrn=function(u){return this.clone().ishrn(u)},s.prototype.ushrn=function(u){return this.clone().iushrn(u)},s.prototype.testn=function(u){n(typeof u=="number"&&u>=0);var h=u%26,p=(u-h)/26,v=1<=0);var h=u%26,p=(u-h)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=p)return this;if(h!==0&&p++,this.length=Math.min(p,this.length),h!==0){var v=67108863^67108863>>>h<=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},s.prototype.isubn=function(u){if(n(typeof u=="number"),n(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h>26)-(m/67108864|0),this.words[w+p]=M&67108863}for(;w>26,this.words[w+p]=M&67108863;if(T===0)return this._strip();for(n(T===-1),T=0,w=0;w>26,this.words[w]=M&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(u,h){var p=this.length-u.length,v=this.clone(),w=u,M=w.words[w.length-1]|0,T=this._countBits(M);p=26-T,p!==0&&(w=w.ushln(p),v.iushln(p),M=w.words[w.length-1]|0);var m=v.length-w.length,f;if(h!=="mod"){f=new s(null),f.length=m+1,f.words=new Array(f.length);for(var E=0;E=0;q--){var R=(v.words[w.length+q]|0)*67108864+(v.words[w.length+q-1]|0);for(R=Math.min(R/M|0,67108863),v._ishlnsubmul(w,R,q);v.negative!==0;)R--,v.negative=0,v._ishlnsubmul(w,1,q),v.isZero()||(v.negative^=1);f&&(f.words[q]=R)}return f&&f._strip(),v._strip(),h!=="div"&&p!==0&&v.iushrn(p),{div:f||null,mod:v}},s.prototype.divmod=function(u,h,p){if(n(!u.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var v,w,M;return this.negative!==0&&u.negative===0?(M=this.neg().divmod(u,h),h!=="mod"&&(v=M.div.neg()),h!=="div"&&(w=M.mod.neg(),p&&w.negative!==0&&w.iadd(u)),{div:v,mod:w}):this.negative===0&&u.negative!==0?(M=this.divmod(u.neg(),h),h!=="mod"&&(v=M.div.neg()),{div:v,mod:M.mod}):this.negative&u.negative?(M=this.neg().divmod(u.neg(),h),h!=="div"&&(w=M.mod.neg(),p&&w.negative!==0&&w.isub(u)),{div:M.div,mod:w}):u.length>this.length||this.cmp(u)<0?{div:new s(0),mod:this}:u.length===1?h==="div"?{div:this.divn(u.words[0]),mod:null}:h==="mod"?{div:null,mod:new s(this.modrn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new s(this.modrn(u.words[0]))}:this._wordDiv(u,h)},s.prototype.div=function(u){return this.divmod(u,"div",!1).div},s.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},s.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},s.prototype.divRound=function(u){var h=this.divmod(u);if(h.mod.isZero())return h.div;var p=h.div.negative!==0?h.mod.isub(u):h.mod,v=u.ushrn(1),w=u.andln(1),M=p.cmp(v);return M<0||w===1&&M===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},s.prototype.modrn=function(u){var h=u<0;h&&(u=-u),n(u<=67108863);for(var p=(1<<26)%u,v=0,w=this.length-1;w>=0;w--)v=(p*v+(this.words[w]|0))%u;return h?-v:v},s.prototype.modn=function(u){return this.modrn(u)},s.prototype.idivn=function(u){var h=u<0;h&&(u=-u),n(u<=67108863);for(var p=0,v=this.length-1;v>=0;v--){var w=(this.words[v]|0)+p*67108864;this.words[v]=w/u|0,p=w%u}return this._strip(),h?this.ineg():this},s.prototype.divn=function(u){return this.clone().idivn(u)},s.prototype.egcd=function(u){n(u.negative===0),n(!u.isZero());var h=this,p=u.clone();h.negative!==0?h=h.umod(u):h=h.clone();for(var v=new s(1),w=new s(0),M=new s(0),T=new s(1),m=0;h.isEven()&&p.isEven();)h.iushrn(1),p.iushrn(1),++m;for(var f=p.clone(),E=h.clone();!h.isZero();){for(var U=0,q=1;!(h.words[0]&q)&&U<26;++U,q<<=1);if(U>0)for(h.iushrn(U);U-- >0;)(v.isOdd()||w.isOdd())&&(v.iadd(f),w.isub(E)),v.iushrn(1),w.iushrn(1);for(var R=0,k=1;!(p.words[0]&k)&&R<26;++R,k<<=1);if(R>0)for(p.iushrn(R);R-- >0;)(M.isOdd()||T.isOdd())&&(M.iadd(f),T.isub(E)),M.iushrn(1),T.iushrn(1);h.cmp(p)>=0?(h.isub(p),v.isub(M),w.isub(T)):(p.isub(h),M.isub(v),T.isub(w))}return{a:M,b:T,gcd:p.iushln(m)}},s.prototype._invmp=function(u){n(u.negative===0),n(!u.isZero());var h=this,p=u.clone();h.negative!==0?h=h.umod(u):h=h.clone();for(var v=new s(1),w=new s(0),M=p.clone();h.cmpn(1)>0&&p.cmpn(1)>0;){for(var T=0,m=1;!(h.words[0]&m)&&T<26;++T,m<<=1);if(T>0)for(h.iushrn(T);T-- >0;)v.isOdd()&&v.iadd(M),v.iushrn(1);for(var f=0,E=1;!(p.words[0]&E)&&f<26;++f,E<<=1);if(f>0)for(p.iushrn(f);f-- >0;)w.isOdd()&&w.iadd(M),w.iushrn(1);h.cmp(p)>=0?(h.isub(p),v.isub(w)):(p.isub(h),w.isub(v))}var U;return h.cmpn(1)===0?U=v:U=w,U.cmpn(0)<0&&U.iadd(u),U},s.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var h=this.clone(),p=u.clone();h.negative=0,p.negative=0;for(var v=0;h.isEven()&&p.isEven();v++)h.iushrn(1),p.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;p.isEven();)p.iushrn(1);var w=h.cmp(p);if(w<0){var M=h;h=p,p=M}else if(w===0||p.cmpn(1)===0)break;h.isub(p)}while(!0);return p.iushln(v)},s.prototype.invm=function(u){return this.egcd(u).a.umod(u)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(u){return this.words[0]&u},s.prototype.bincn=function(u){n(typeof u=="number");var h=u%26,p=(u-h)/26,v=1<>>26,T&=67108863,this.words[M]=T}return w!==0&&(this.words[M]=w,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(u){var h=u<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this._strip();var p;if(this.length>1)p=1;else{h&&(u=-u),n(u<=67108863,"Number is too big");var v=this.words[0]|0;p=v===u?0:vu.length)return 1;if(this.length=0;p--){var v=this.words[p]|0,w=u.words[p]|0;if(v!==w){vw&&(h=1);break}}return h},s.prototype.gtn=function(u){return this.cmpn(u)===1},s.prototype.gt=function(u){return this.cmp(u)===1},s.prototype.gten=function(u){return this.cmpn(u)>=0},s.prototype.gte=function(u){return this.cmp(u)>=0},s.prototype.ltn=function(u){return this.cmpn(u)===-1},s.prototype.lt=function(u){return this.cmp(u)===-1},s.prototype.lten=function(u){return this.cmpn(u)<=0},s.prototype.lte=function(u){return this.cmp(u)<=0},s.prototype.eqn=function(u){return this.cmpn(u)===0},s.prototype.eq=function(u){return this.cmp(u)===0},s.red=function(u){return new Y(u)},s.prototype.toRed=function(u){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(u){return this.red=u,this},s.prototype.forceRed=function(u){return n(!this.red,"Already a number in reduction context"),this._forceRed(u)},s.prototype.redAdd=function(u){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},s.prototype.redIAdd=function(u){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},s.prototype.redSub=function(u){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},s.prototype.redISub=function(u){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},s.prototype.redShl=function(u){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},s.prototype.redMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},s.prototype.redIMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(u){return n(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var L={k256:null,p224:null,p192:null,p25519:null};function B(b,u){this.name=b,this.p=new s(u,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}B.prototype._tmp=function(){var u=new s(null);return u.words=new Array(Math.ceil(this.n/13)),u},B.prototype.ireduce=function(u){var h=u,p;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),p=h.bitLength();while(p>this.n);var v=p0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},B.prototype.split=function(u,h){u.iushrn(this.n,0,h)},B.prototype.imulK=function(u){return u.imul(this.k)};function G(){B.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(G,B),G.prototype.split=function(u,h){for(var p=4194303,v=Math.min(u.length,9),w=0;w>>22,M=T}M>>>=22,u.words[w-10]=M,M===0&&u.length>10?u.length-=10:u.length-=9},G.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var h=0,p=0;p>>=26,u.words[p]=w,h=v}return h!==0&&(u.words[u.length++]=h),u},s._prime=function(u){if(L[u])return L[u];var h;if(u==="k256")h=new G;else if(u==="p224")h=new z;else if(u==="p192")h=new W;else if(u==="p25519")h=new K;else throw new Error("Unknown prime "+u);return L[u]=h,h};function Y(b){if(typeof b=="string"){var u=s._prime(b);this.m=u.p,this.prime=u}else n(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}Y.prototype._verify1=function(u){n(u.negative===0,"red works only with positives"),n(u.red,"red works only with red numbers")},Y.prototype._verify2=function(u,h){n((u.negative|h.negative)===0,"red works only with positives"),n(u.red&&u.red===h.red,"red works only with red numbers")},Y.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):(d(u,u.umod(this.m)._forceRed(this)),u)},Y.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},Y.prototype.add=function(u,h){this._verify2(u,h);var p=u.add(h);return p.cmp(this.m)>=0&&p.isub(this.m),p._forceRed(this)},Y.prototype.iadd=function(u,h){this._verify2(u,h);var p=u.iadd(h);return p.cmp(this.m)>=0&&p.isub(this.m),p},Y.prototype.sub=function(u,h){this._verify2(u,h);var p=u.sub(h);return p.cmpn(0)<0&&p.iadd(this.m),p._forceRed(this)},Y.prototype.isub=function(u,h){this._verify2(u,h);var p=u.isub(h);return p.cmpn(0)<0&&p.iadd(this.m),p},Y.prototype.shl=function(u,h){return this._verify1(u),this.imod(u.ushln(h))},Y.prototype.imul=function(u,h){return this._verify2(u,h),this.imod(u.imul(h))},Y.prototype.mul=function(u,h){return this._verify2(u,h),this.imod(u.mul(h))},Y.prototype.isqr=function(u){return this.imul(u,u.clone())},Y.prototype.sqr=function(u){return this.mul(u,u)},Y.prototype.sqrt=function(u){if(u.isZero())return u.clone();var h=this.m.andln(3);if(n(h%2===1),h===3){var p=this.m.add(new s(1)).iushrn(2);return this.pow(u,p)}for(var v=this.m.subn(1),w=0;!v.isZero()&&v.andln(1)===0;)w++,v.iushrn(1);n(!v.isZero());var M=new s(1).toRed(this),T=M.redNeg(),m=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);this.pow(f,m).cmp(T)!==0;)f.redIAdd(T);for(var E=this.pow(f,v),U=this.pow(u,v.addn(1).iushrn(1)),q=this.pow(u,v),R=w;q.cmp(M)!==0;){for(var k=q,$=0;k.cmp(M)!==0;$++)k=k.redSqr();n($=0;w--){for(var E=h.words[w],U=f-1;U>=0;U--){var q=E>>U&1;if(M!==v[0]&&(M=this.sqr(M)),q===0&&T===0){m=0;continue}T<<=1,T|=q,m++,!(m!==p&&(w!==0||U!==0))&&(M=this.mul(M,v[T]),m=0,T=0)}f=26}return M},Y.prototype.convertTo=function(u){var h=u.umod(this.m);return h===u?h.clone():h},Y.prototype.convertFrom=function(u){var h=u.clone();return h.red=null,h},s.mont=function(u){return new X(u)};function X(b){Y.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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(X,Y),X.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},X.prototype.convertFrom=function(u){var h=this.imod(u.mul(this.rinv));return h.red=null,h},X.prototype.imul=function(u,h){if(u.isZero()||h.isZero())return u.words[0]=0,u.length=1,u;var p=u.imul(h),v=p.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=p.isub(v).iushrn(this.shift),M=w;return w.cmp(this.m)>=0?M=w.isub(this.m):w.cmpn(0)<0&&(M=w.iadd(this.m)),M._forceRed(this)},X.prototype.mul=function(u,h){if(u.isZero()||h.isZero())return new s(0)._forceRed(this);var p=u.mul(h),v=p.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=p.isub(v).iushrn(this.shift),M=w;return w.cmp(this.m)>=0?M=w.isub(this.m):w.cmpn(0)<0&&(M=w.iadd(this.m)),M._forceRed(this)},X.prototype.invm=function(u){var h=this.imod(u._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(t,Z)})(mu);var Ys=mu.exports,ui={};Object.defineProperty(ui,"__esModule",{value:!0});ui.EVENTS=void 0;ui.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var Vi={},wu={},Cr={},Xp=Di;Di.default=Di;Di.stable=qf;Di.stableStringify=qf;var Ls="[...]",Uf="[Circular]",sn=[],Xr=[];function zf(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Di(t,e,r,n){typeof n>"u"&&(n=zf()),za(t,"",0,[],void 0,0,n);var i;try{Xr.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,Gf(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;sn.length!==0;){var s=sn.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Hn(t,e,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:t}),sn.push([n,r,e,i])):Xr.push([e,r,t]):(n[r]=t,sn.push([n,r,e]))}function za(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Hn(Ls,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Hn(Ls,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;ae?1:0}function qf(t,e,r,n){typeof n>"u"&&(n=zf());var i=qa(t,"",0,[],void 0,0,n)||t,s;try{Xr.length===0?s=JSON.stringify(i,e,r):s=JSON.stringify(i,Gf(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;sn.length!==0;){var o=sn.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return s}function qa(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Hn(Ls,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Hn(Ls,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n=1e3&&t<=4999}function i0(t,e){if(e!=="[Circular]")return e}var _u={},Rr={};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.errorValues=Rr.errorCodes=void 0;Rr.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}};Rr.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=Rr,r=Cr,n=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:o(n)};t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function o(y,C=i){if(Number.isInteger(y)){const A=y.toString();if(g(e.errorValues,A))return e.errorValues[A].message;if(l(y))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return C}t.getMessageFromCode=o;function a(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(e.errorValues[C]||l(y))}t.isValidCode=a;function c(y,{fallbackError:C=s,shouldIncludeStack:A=!1}={}){var D,N;if(!C||!Number.isInteger(C.code)||typeof C.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(y instanceof r.EthereumRpcError)return y.serialize();const x={};if(y&&typeof y=="object"&&!Array.isArray(y)&&g(y,"code")&&a(y.code)){const O=y;x.code=O.code,O.message&&typeof O.message=="string"?(x.message=O.message,g(O,"data")&&(x.data=O.data)):(x.message=o(x.code),x.data={originalError:d(y)})}else{x.code=C.code;const O=(D=y)===null||D===void 0?void 0:D.message;x.message=O&&typeof O=="string"?O:C.message,x.data={originalError:d(y)}}const I=(N=y)===null||N===void 0?void 0:N.stack;return A&&y&&I&&typeof I=="string"&&(x.stack=I),x}t.serializeError=c;function l(y){return y>=-32099&&y<=-32e3}function d(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function g(y,C){return Object.prototype.hasOwnProperty.call(y,C)}})(_u);var Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.ethErrors=void 0;const Su=Cr,Zf=_u,dt=Rr;Ks.ethErrors={rpc:{parse:t=>At(dt.errorCodes.rpc.parse,t),invalidRequest:t=>At(dt.errorCodes.rpc.invalidRequest,t),invalidParams:t=>At(dt.errorCodes.rpc.invalidParams,t),methodNotFound:t=>At(dt.errorCodes.rpc.methodNotFound,t),internal:t=>At(dt.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return At(e,t)},invalidInput:t=>At(dt.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>At(dt.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>At(dt.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>At(dt.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>At(dt.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>At(dt.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>_i(dt.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>_i(dt.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>_i(dt.errorCodes.provider.unsupportedMethod,t),disconnected:t=>_i(dt.errorCodes.provider.disconnected,t),chainDisconnected:t=>_i(dt.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Su.EthereumProviderError(e,r,n)}}};function At(t,e){const[r,n]=Qf(e);return new Su.EthereumRpcError(t,r||Zf.getMessageFromCode(t),n)}function _i(t,e){const[r,n]=Qf(e);return new Su.EthereumProviderError(t,r||Zf.getMessageFromCode(t),n)}function Qf(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=Cr;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const r=_u;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=Ks;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=Rr;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(wu);var _e={},Xs={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Web3Method=void 0,function(e){e.requestEthereumAccounts="requestEthereumAccounts",e.signEthereumMessage="signEthereumMessage",e.signEthereumTransaction="signEthereumTransaction",e.submitEthereumTransaction="submitEthereumTransaction",e.ethereumAddressFromSignedMessage="ethereumAddressFromSignedMessage",e.scanQRCode="scanQRCode",e.generic="generic",e.childRequestEthereumAccounts="childRequestEthereumAccounts",e.addEthereumChain="addEthereumChain",e.switchEthereumChain="switchEthereumChain",e.makeEthereumJSONRPCRequest="makeEthereumJSONRPCRequest",e.watchAsset="watchAsset",e.selectProvider="selectProvider"}(t.Web3Method||(t.Web3Method={}))})(Xs);Object.defineProperty(_e,"__esModule",{value:!0});_e.EthereumAddressFromSignedMessageResponse=_e.SubmitEthereumTransactionResponse=_e.SignEthereumTransactionResponse=_e.SignEthereumMessageResponse=_e.isRequestEthereumAccountsResponse=_e.SelectProviderResponse=_e.WatchAssetReponse=_e.RequestEthereumAccountsResponse=_e.SwitchEthereumChainResponse=_e.AddEthereumChainResponse=_e.isErrorResponse=void 0;const ar=Xs;function s0(t){var e,r;return((e=t)===null||e===void 0?void 0:e.method)!==void 0&&((r=t)===null||r===void 0?void 0:r.errorMessage)!==void 0}_e.isErrorResponse=s0;function o0(t){return{method:ar.Web3Method.addEthereumChain,result:t}}_e.AddEthereumChainResponse=o0;function a0(t){return{method:ar.Web3Method.switchEthereumChain,result:t}}_e.SwitchEthereumChainResponse=a0;function u0(t){return{method:ar.Web3Method.requestEthereumAccounts,result:t}}_e.RequestEthereumAccountsResponse=u0;function c0(t){return{method:ar.Web3Method.watchAsset,result:t}}_e.WatchAssetReponse=c0;function l0(t){return{method:ar.Web3Method.selectProvider,result:t}}_e.SelectProviderResponse=l0;function f0(t){return t&&t.method===ar.Web3Method.requestEthereumAccounts}_e.isRequestEthereumAccountsResponse=f0;function h0(t){return{method:ar.Web3Method.signEthereumMessage,result:t}}_e.SignEthereumMessageResponse=h0;function d0(t){return{method:ar.Web3Method.signEthereumTransaction,result:t}}_e.SignEthereumTransactionResponse=d0;function p0(t){return{method:ar.Web3Method.submitEthereumTransaction,result:t}}_e.SubmitEthereumTransactionResponse=p0;function g0(t){return{method:ar.Web3Method.ethereumAddressFromSignedMessage,result:t}}_e.EthereumAddressFromSignedMessageResponse=g0;var ci={};Object.defineProperty(ci,"__esModule",{value:!0});ci.LIB_VERSION=void 0;ci.LIB_VERSION="3.7.2";(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCode=t.serializeError=t.standardErrors=t.standardErrorMessage=t.standardErrorCodes=void 0;const e=wu,r=_e,n=ci;t.standardErrorCodes=Object.freeze(Object.assign(Object.assign({},e.errorCodes),{provider:Object.freeze(Object.assign(Object.assign({},e.errorCodes.provider),{unsupportedChain:4902}))}));function i(d){return d!==void 0?(0,e.getMessageFromCode)(d):"Unknown error"}t.standardErrorMessage=i,t.standardErrors=Object.freeze(Object.assign(Object.assign({},e.ethErrors),{provider:Object.freeze(Object.assign(Object.assign({},e.ethErrors.provider),{unsupportedChain:(d="")=>e.ethErrors.provider.custom({code:t.standardErrorCodes.provider.unsupportedChain,message:`Unrecognized chain ID ${d}. Try adding the chain using wallet_addEthereumChain first.`})}))}));function s(d,g){const y=(0,e.serializeError)(o(d),{shouldIncludeStack:!0}),C=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");C.searchParams.set("version",n.LIB_VERSION),C.searchParams.set("code",y.code.toString());const A=a(y.data,g);return A&&C.searchParams.set("method",A),C.searchParams.set("message",y.message),Object.assign(Object.assign({},y),{docUrl:C.href})}t.serializeError=s;function o(d){return typeof d=="string"?{message:d,code:t.standardErrorCodes.rpc.internal}:(0,r.isErrorResponse)(d)?Object.assign(Object.assign({},d),{message:d.errorMessage,code:d.errorCode,data:{method:d.method,result:d.result}}):d}function a(d,g){var y;const C=(y=d)===null||y===void 0?void 0:y.method;if(C)return C;if(g!==void 0)return typeof g=="string"?g:Array.isArray(g)?g.length>0?g[0].method:void 0:g.method}function c(d){var g;if(typeof d=="number")return d;if(l(d))return(g=d.code)!==null&&g!==void 0?g:d.errorCode}t.getErrorCode=c;function l(d){return typeof d=="object"&&d!==null&&(typeof d.code=="number"||typeof d.errorCode=="number")}})(Vi);var li={},Yf={exports:{}},Ga={exports:{}};typeof Object.create=="function"?Ga.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ga.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var zt=Ga.exports,Ja={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(t,e){var r=Hi,n=r.Buffer;function i(o,a){for(var c in o)a[c]=o[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=s);function s(o,a,c){return n(o,a,c)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(o,a,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,a,c)},s.alloc=function(o,a,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var l=n(o);return a!==void 0?typeof c=="string"?l.fill(a,c):l.fill(a):l.fill(0),l},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(Ja,Ja.exports);var hn=Ja.exports,Kf=hn.Buffer;function eo(t,e){this._block=Kf.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}eo.prototype.update=function(t,e){typeof t=="string"&&(e=e||"utf8",t=Kf.from(t,e));for(var r=this._block,n=this._blockSize,i=t.length,s=this._len,o=0;o=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};eo.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var fi=eo,b0=zt,Xf=fi,v0=hn.Buffer,y0=[1518500249,1859775393,-1894007588,-899497514],m0=new Array(80);function Ui(){this.init(),this._w=m0,Xf.call(this,64,56)}b0(Ui,Xf);Ui.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function w0(t){return t<<5|t>>>27}function _0(t){return t<<30|t>>>2}function S0(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}Ui.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=e[a-3]^e[a-8]^e[a-14]^e[a-16];for(var c=0;c<80;++c){var l=~~(c/20),d=w0(r)+S0(l,n,i,s)+o+e[c]+y0[l]|0;o=s,s=i,i=_0(n),n=r,r=d}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};Ui.prototype._hash=function(){var t=v0.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};var E0=Ui,x0=zt,eh=fi,M0=hn.Buffer,C0=[1518500249,1859775393,-1894007588,-899497514],R0=new Array(80);function zi(){this.init(),this._w=R0,eh.call(this,64,56)}x0(zi,eh);zi.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function I0(t){return t<<1|t>>>31}function A0(t){return t<<5|t>>>27}function T0(t){return t<<30|t>>>2}function k0(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}zi.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=I0(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var c=0;c<80;++c){var l=~~(c/20),d=A0(r)+k0(l,n,i,s)+o+e[c]+C0[l]|0;o=s,s=i,i=T0(n),n=r,r=d}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};zi.prototype._hash=function(){var t=M0.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};var O0=zi,N0=zt,th=fi,L0=hn.Buffer,P0=[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],D0=new Array(64);function qi(){this.init(),this._w=D0,th.call(this,64,56)}N0(qi,th);qi.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function $0(t,e,r){return r^t&(e^r)}function B0(t,e,r){return t&e|r&(t|e)}function j0(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function F0(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function W0(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function H0(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}qi.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=this._f|0,c=this._g|0,l=this._h|0,d=0;d<16;++d)e[d]=t.readInt32BE(d*4);for(;d<64;++d)e[d]=H0(e[d-2])+e[d-7]+W0(e[d-15])+e[d-16]|0;for(var g=0;g<64;++g){var y=l+F0(o)+$0(o,a,c)+P0[g]+e[g]|0,C=j0(r)+B0(r,n,i)|0;l=c,c=a,a=o,o=s+y|0,s=i,i=n,n=r,r=y+C|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0,this._f=a+this._f|0,this._g=c+this._g|0,this._h=l+this._h|0};qi.prototype._hash=function(){var t=L0.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var rh=qi,V0=zt,U0=rh,z0=fi,q0=hn.Buffer,G0=new Array(64);function to(){this.init(),this._w=G0,z0.call(this,64,56)}V0(to,U0);to.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};to.prototype._hash=function(){var t=q0.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var J0=to,Z0=zt,nh=fi,Q0=hn.Buffer,Ic=[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],Y0=new Array(160);function Gi(){this.init(),this._w=Y0,nh.call(this,128,112)}Z0(Gi,nh);Gi.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ac(t,e,r){return r^t&(e^r)}function Tc(t,e,r){return t&e|r&(t|e)}function kc(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function Oc(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function K0(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function X0(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function eg(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function tg(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function it(t,e){return t>>>0>>0?1:0}Gi.prototype._update=function(t){for(var e=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,o=this._eh|0,a=this._fh|0,c=this._gh|0,l=this._hh|0,d=this._al|0,g=this._bl|0,y=this._cl|0,C=this._dl|0,A=this._el|0,D=this._fl|0,N=this._gl|0,x=this._hl|0,I=0;I<32;I+=2)e[I]=t.readInt32BE(I*4),e[I+1]=t.readInt32BE(I*4+4);for(;I<160;I+=2){var O=e[I-30],P=e[I-15*2+1],L=K0(O,P),B=X0(P,O);O=e[I-2*2],P=e[I-2*2+1];var G=eg(O,P),z=tg(P,O),W=e[I-7*2],K=e[I-7*2+1],Y=e[I-16*2],X=e[I-16*2+1],b=B+K|0,u=L+W+it(b,B)|0;b=b+z|0,u=u+G+it(b,z)|0,b=b+X|0,u=u+Y+it(b,X)|0,e[I]=u,e[I+1]=b}for(var h=0;h<160;h+=2){u=e[h],b=e[h+1];var p=Tc(r,n,i),v=Tc(d,g,y),w=kc(r,d),M=kc(d,r),T=Oc(o,A),m=Oc(A,o),f=Ic[h],E=Ic[h+1],U=Ac(o,a,c),q=Ac(A,D,N),R=x+m|0,k=l+T+it(R,x)|0;R=R+q|0,k=k+U+it(R,q)|0,R=R+E|0,k=k+f+it(R,E)|0,R=R+b|0,k=k+u+it(R,b)|0;var $=M+v|0,V=w+p+it($,M)|0;l=c,x=N,c=a,N=D,a=o,D=A,A=C+R|0,o=s+k+it(A,C)|0,s=i,C=y,i=n,y=g,n=r,g=d,d=R+$|0,r=k+V+it(d,R)|0}this._al=this._al+d|0,this._bl=this._bl+g|0,this._cl=this._cl+y|0,this._dl=this._dl+C|0,this._el=this._el+A|0,this._fl=this._fl+D|0,this._gl=this._gl+N|0,this._hl=this._hl+x|0,this._ah=this._ah+r+it(this._al,d)|0,this._bh=this._bh+n+it(this._bl,g)|0,this._ch=this._ch+i+it(this._cl,y)|0,this._dh=this._dh+s+it(this._dl,C)|0,this._eh=this._eh+o+it(this._el,A)|0,this._fh=this._fh+a+it(this._fl,D)|0,this._gh=this._gh+c+it(this._gl,N)|0,this._hh=this._hh+l+it(this._hl,x)|0};Gi.prototype._hash=function(){var t=Q0.allocUnsafe(64);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t};var ih=Gi,rg=zt,ng=ih,ig=fi,sg=hn.Buffer,og=new Array(160);function ro(){this.init(),this._w=og,ig.call(this,128,112)}rg(ro,ng);ro.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};ro.prototype._hash=function(){var t=sg.allocUnsafe(48);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t};var ag=ro,dn=Yf.exports=function(e){e=e.toLowerCase();var r=dn[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};dn.sha=E0;dn.sha1=O0;dn.sha224=J0;dn.sha256=rh;dn.sha384=ag;dn.sha512=ih;var ug=Yf.exports,J={},cg=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0},Nc=typeof Symbol<"u"&&Symbol,lg=cg,fg=function(){return typeof Nc!="function"||typeof Symbol!="function"||typeof Nc("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:lg()},Lc={foo:{}},hg=Object,dg=function(){return{__proto__:Lc}.foo===Lc.foo&&!({__proto__:null}instanceof hg)},pg="Function.prototype.bind called on incompatible ",gg=Object.prototype.toString,bg=Math.max,vg="[object Function]",Pc=function(e,r){for(var n=[],i=0;i"u"||!at?ce:at(Uint8Array),nn={"%AggregateError%":typeof AggregateError>"u"?ce:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ce:ArrayBuffer,"%ArrayIteratorPrototype%":kn&&at?at([][Symbol.iterator]()):ce,"%AsyncFromSyncIteratorPrototype%":ce,"%AsyncFunction%":Bn,"%AsyncGenerator%":Bn,"%AsyncGeneratorFunction%":Bn,"%AsyncIteratorPrototype%":Bn,"%Atomics%":typeof Atomics>"u"?ce:Atomics,"%BigInt%":typeof BigInt>"u"?ce:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ce:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ce:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ce:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?ce:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ce:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ce:FinalizationRegistry,"%Function%":sh,"%GeneratorFunction%":Bn,"%Int8Array%":typeof Int8Array>"u"?ce:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ce:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ce:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":kn&&at?at(at([][Symbol.iterator]())):ce,"%JSON%":typeof JSON=="object"?JSON:ce,"%Map%":typeof Map>"u"?ce:Map,"%MapIteratorPrototype%":typeof Map>"u"||!kn||!at?ce:at(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ce:Promise,"%Proxy%":typeof Proxy>"u"?ce:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?ce:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ce:Set,"%SetIteratorPrototype%":typeof Set>"u"||!kn||!at?ce:at(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ce:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":kn&&at?at(""[Symbol.iterator]()):ce,"%Symbol%":kn?Symbol:ce,"%SyntaxError%":Zn,"%ThrowTypeError%":Cg,"%TypedArray%":Ig,"%TypeError%":Vn,"%Uint8Array%":typeof Uint8Array>"u"?ce:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ce:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ce:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ce:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?ce:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ce:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ce:WeakSet};if(at)try{null.error}catch(t){var Ag=at(at(t));nn["%Error.prototype%"]=Ag}var Tg=function t(e){var r;if(e==="%AsyncFunction%")r=na("async function () {}");else if(e==="%GeneratorFunction%")r=na("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=na("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&at&&(r=at(i.prototype))}return nn[e]=r,r},Dc={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ji=Eu,Ps=Mg,kg=Ji.call(Function.call,Array.prototype.concat),Og=Ji.call(Function.apply,Array.prototype.splice),$c=Ji.call(Function.call,String.prototype.replace),Ds=Ji.call(Function.call,String.prototype.slice),Ng=Ji.call(Function.call,RegExp.prototype.exec),Lg=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Pg=/\\(\\)?/g,Dg=function(e){var r=Ds(e,0,1),n=Ds(e,-1);if(r==="%"&&n!=="%")throw new Zn("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Zn("invalid intrinsic syntax, expected opening `%`");var i=[];return $c(e,Lg,function(s,o,a,c){i[i.length]=a?$c(c,Pg,"$1"):o||s}),i},$g=function(e,r){var n=e,i;if(Ps(Dc,n)&&(i=Dc[n],n="%"+i[0]+"%"),Ps(nn,n)){var s=nn[n];if(s===Bn&&(s=Tg(n)),typeof s>"u"&&!r)throw new Vn("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new Zn("intrinsic "+e+" does not exist!")},pn=function(e,r){if(typeof e!="string"||e.length===0)throw new Vn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Vn('"allowMissing" argument must be a boolean');if(Ng(/^%?[^%]*%?$/,e)===null)throw new Zn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Dg(e),i=n.length>0?n[0]:"",s=$g("%"+i+"%",r),o=s.name,a=s.value,c=!1,l=s.alias;l&&(i=l[0],Og(n,kg([0,1],l)));for(var d=1,g=!0;d=n.length){var D=rn(a,y);g=!!D,g&&"get"in D&&!("originalValue"in D.get)?a=D.get:a=a[y]}else g=Ps(a,y),a=a[y];g&&!c&&(nn[o]=a)}}return a},oh={exports:{}},Bg=pn,Za=Bg("%Object.defineProperty%",!0),Qa=function(){if(Za)try{return Za({},"a",{value:1}),!0}catch{return!1}return!1};Qa.hasArrayLengthDefineBug=function(){if(!Qa())return null;try{return Za([],"length",{value:1}).length!==1}catch{return!0}};var ah=Qa,jg=pn,As=jg("%Object.getOwnPropertyDescriptor%",!0);if(As)try{As([],"length")}catch{As=null}var uh=As,Fg=ah(),xu=pn,Ii=Fg&&xu("%Object.defineProperty%",!0);if(Ii)try{Ii({},"a",{value:1})}catch{Ii=!1}var Wg=xu("%SyntaxError%"),On=xu("%TypeError%"),Bc=uh,Hg=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new On("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new On("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new On("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new On("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new On("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new On("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,c=!!Bc&&Bc(e,r);if(Ii)Ii(e,r,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:n,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new Wg("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},ch=pn,jc=Hg,Vg=ah(),Fc=uh,Wc=ch("%TypeError%"),Ug=ch("%Math.floor%"),zg=function(e,r){if(typeof e!="function")throw new Wc("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Ug(r)!==r)throw new Wc("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&Fc){var o=Fc(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(Vg?jc(e,"length",r,!0,!0):jc(e,"length",r)),e};(function(t){var e=Eu,r=pn,n=zg,i=r("%TypeError%"),s=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||e.call(o,s),c=r("%Object.defineProperty%",!0),l=r("%Math.max%");if(c)try{c({},"a",{value:1})}catch{c=null}t.exports=function(y){if(typeof y!="function")throw new i("a function is required");var C=a(e,o,arguments);return n(C,1+l(0,y.length-(arguments.length-1)),!0)};var d=function(){return a(e,s,arguments)};c?c(t.exports,"apply",{value:d}):t.exports.apply=d})(oh);var qg=oh.exports,lh=pn,fh=qg,Gg=fh(lh("String.prototype.indexOf")),Jg=function(e,r){var n=lh(e,!!r);return typeof n=="function"&&Gg(e,".prototype.")>-1?fh(n):n},Mu=typeof Map=="function"&&Map.prototype,sa=Object.getOwnPropertyDescriptor&&Mu?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,$s=Mu&&sa&&typeof sa.get=="function"?sa.get:null,Hc=Mu&&Map.prototype.forEach,Cu=typeof Set=="function"&&Set.prototype,oa=Object.getOwnPropertyDescriptor&&Cu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Bs=Cu&&oa&&typeof oa.get=="function"?oa.get:null,Vc=Cu&&Set.prototype.forEach,Zg=typeof WeakMap=="function"&&WeakMap.prototype,Ai=Zg?WeakMap.prototype.has:null,Qg=typeof WeakSet=="function"&&WeakSet.prototype,Ti=Qg?WeakSet.prototype.has:null,Yg=typeof WeakRef=="function"&&WeakRef.prototype,Uc=Yg?WeakRef.prototype.deref:null,Kg=Boolean.prototype.valueOf,Xg=Object.prototype.toString,eb=Function.prototype.toString,tb=String.prototype.match,Ru=String.prototype.slice,xr=String.prototype.replace,rb=String.prototype.toUpperCase,zc=String.prototype.toLowerCase,hh=RegExp.prototype.test,qc=Array.prototype.concat,tr=Array.prototype.join,nb=Array.prototype.slice,Gc=Math.floor,Ya=typeof BigInt=="function"?BigInt.prototype.valueOf:null,aa=Object.getOwnPropertySymbols,Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",bt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qn||"symbol")?Symbol.toStringTag:null,dh=Object.prototype.propertyIsEnumerable,Jc=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Zc(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||hh.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-Gc(-t):Gc(t);if(n!==t){var i=String(n),s=Ru.call(e,i.length+1);return xr.call(i,r,"$&_")+"."+xr.call(xr.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return xr.call(e,r,"$&_")}var Xa=Gs,Qc=Xa.custom,Yc=gh(Qc)?Qc:null,ib=function t(e,r,n,i){var s=r||{};if(_r(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(_r(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=_r(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(_r(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(_r(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return vh(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?Zc(e,c):c}if(typeof e=="bigint"){var l=String(e)+"n";return a?Zc(e,l):l}var d=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=d&&d>0&&typeof e=="object")return eu(e)?"[Array]":"[Object]";var g=Sb(s,n);if(typeof i>"u")i=[];else if(bh(i,e)>=0)return"[Circular]";function y(b,u,h){if(u&&(i=nb.call(i),i.push(u)),h){var p={depth:s.depth};return _r(s,"quoteStyle")&&(p.quoteStyle=s.quoteStyle),t(b,p,n+1,i)}return t(b,s,n+1,i)}if(typeof e=="function"&&!Kc(e)){var C=db(e),A=ds(e,y);return"[Function"+(C?": "+C:" (anonymous)")+"]"+(A.length>0?" { "+tr.call(A,", ")+" }":"")}if(gh(e)){var D=Qn?xr.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ka.call(e);return typeof e=="object"&&!Qn?Si(D):D}if(mb(e)){for(var N="<"+zc.call(String(e.nodeName)),x=e.attributes||[],I=0;I",N}if(eu(e)){if(e.length===0)return"[]";var O=ds(e,y);return g&&!_b(O)?"["+tu(O,g)+"]":"[ "+tr.call(O,", ")+" ]"}if(ab(e)){var P=ds(e,y);return!("cause"in Error.prototype)&&"cause"in e&&!dh.call(e,"cause")?"{ ["+String(e)+"] "+tr.call(qc.call("[cause]: "+y(e.cause),P),", ")+" }":P.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+tr.call(P,", ")+" }"}if(typeof e=="object"&&o){if(Yc&&typeof e[Yc]=="function"&&Xa)return Xa(e,{depth:d-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(pb(e)){var L=[];return Hc&&Hc.call(e,function(b,u){L.push(y(u,e,!0)+" => "+y(b,e))}),Xc("Map",$s.call(e),L,g)}if(vb(e)){var B=[];return Vc&&Vc.call(e,function(b){B.push(y(b,e))}),Xc("Set",Bs.call(e),B,g)}if(gb(e))return ua("WeakMap");if(yb(e))return ua("WeakSet");if(bb(e))return ua("WeakRef");if(cb(e))return Si(y(Number(e)));if(fb(e))return Si(y(Ya.call(e)));if(lb(e))return Si(Kg.call(e));if(ub(e))return Si(y(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===globalThis)return"{ [object globalThis] }";if(!ob(e)&&!Kc(e)){var G=ds(e,y),z=Jc?Jc(e)===Object.prototype:e instanceof Object||e.constructor===Object,W=e instanceof Object?"":"null prototype",K=!z&&bt&&Object(e)===e&&bt in e?Ru.call(kr(e),8,-1):W?"Object":"",Y=z||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",X=Y+(K||W?"["+tr.call(qc.call([],K||[],W||[]),": ")+"] ":"");return G.length===0?X+"{}":g?X+"{"+tu(G,g)+"}":X+"{ "+tr.call(G,", ")+" }"}return String(e)};function ph(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function sb(t){return xr.call(String(t),/"/g,""")}function eu(t){return kr(t)==="[object Array]"&&(!bt||!(typeof t=="object"&&bt in t))}function ob(t){return kr(t)==="[object Date]"&&(!bt||!(typeof t=="object"&&bt in t))}function Kc(t){return kr(t)==="[object RegExp]"&&(!bt||!(typeof t=="object"&&bt in t))}function ab(t){return kr(t)==="[object Error]"&&(!bt||!(typeof t=="object"&&bt in t))}function ub(t){return kr(t)==="[object String]"&&(!bt||!(typeof t=="object"&&bt in t))}function cb(t){return kr(t)==="[object Number]"&&(!bt||!(typeof t=="object"&&bt in t))}function lb(t){return kr(t)==="[object Boolean]"&&(!bt||!(typeof t=="object"&&bt in t))}function gh(t){if(Qn)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Ka)return!1;try{return Ka.call(t),!0}catch{}return!1}function fb(t){if(!t||typeof t!="object"||!Ya)return!1;try{return Ya.call(t),!0}catch{}return!1}var hb=Object.prototype.hasOwnProperty||function(t){return t in this};function _r(t,e){return hb.call(t,e)}function kr(t){return Xg.call(t)}function db(t){if(t.name)return t.name;var e=tb.call(eb.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function bh(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return vh(Ru.call(t,0,e.maxStringLength),e)+n}var i=xr.call(xr.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,wb);return ph(i,"single",e)}function wb(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+rb.call(e.toString(16))}function Si(t){return"Object("+t+")"}function ua(t){return t+" { ? }"}function Xc(t,e,r,n){var i=n?tu(r,n):tr.call(r,", ");return t+" ("+e+") {"+i+"}"}function _b(t){for(var e=0;e=0)return!1;return!0}function Sb(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=tr.call(Array(t.indent+1)," ");else return null;return{base:r,prev:tr.call(Array(e+1),r)}}function tu(t,e){if(t.length===0)return"";var r=` `+e.prev+e.base;return r+tr.call(t,","+r)+` `+e.prev}function ds(t,e){var r=eu(t),n=[];if(r){n.length=t.length;for(var i=0;i1;){var r=e.pop(),n=r.obj[r.prop];if(Zr(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===$b.RFC1738&&(l===40||l===41)){a+=o.charAt(c);continue}if(l<128){a=a+Zt[l];continue}if(l<2048){a=a+(Zt[192|l>>6]+Zt[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Zt[224|l>>12]+Zt[128|l>>6&63]+Zt[128|l&63]);continue}c+=1,l=65536+((l&1023)<<10|o.charCodeAt(c)&1023),a+=Zt[240|l>>18]+Zt[128|l>>12&63]+Zt[128|l>>6&63]+Zt[128|l&63]}return a},Vb=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i"u"&&(O=0)}if(typeof c=="function"?x=c(r,x):x instanceof Date?x=g(x):n==="comma"&&fr(x)&&(x=Ts.maybeMap(x,function(p){return p instanceof Date?g(p):p})),x===null){if(s)return a&&!A?a(r,gt.encoder,D,"key",y):r;x=""}if(Yb(x)||Ts.isBuffer(x)){if(a){var B=A?r:a(r,gt.encoder,D,"key",y);return[C(B)+"="+C(a(x,gt.encoder,D,"value",y))]}return[C(r)+"="+C(String(x))]}var G=[];if(typeof x>"u")return G;var z;if(n==="comma"&&fr(x))A&&a&&(x=Ts.maybeMap(x,a)),z=[{value:x.length>0?x.join(",")||null:void 0}];else if(fr(c))z=c;else{var W=Object.keys(x);z=l?W.sort(l):W}for(var K=i&&fr(x)&&x.length===1?r+"[]":r,Y=0;Y"u"?gt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:gt.charsetSentinel,delimiter:typeof e.delimiter>"u"?gt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:gt.encode,encoder:typeof e.encoder=="function"?e.encoder:gt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:gt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:gt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:gt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:gt.strictNullHandling}},ev=function(t,e){var r=t,n=Xb(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):fr(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in el?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var c=el[a];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=c==="comma"&&e&&e.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var d=wh(),g=0;g0?A+C:""},Yn=mh,ru=Object.prototype.hasOwnProperty,tv=Array.isArray,st={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Yn.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},rv=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Sh=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},nv="utf8=%26%2310003%3B",iv="utf8=%E2%9C%93",sv=function(e,r){var n={__proto__:null},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,c,l=r.charset;if(r.charsetSentinel)for(c=0;c-1&&(A=tv(A)?[A]:A),ru.call(n,C)?n[C]=Yn.combine(n[C],A):n[C]=A}return n},ov=function(t,e,r,n){for(var i=n?e:Sh(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var c=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(c,10);!r.parseArrays&&c===""?o={0:i}:!isNaN(l)&&a!==c&&String(l)===c&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):c!=="__proto__"&&(o[c]=i)}i=o}return i},av=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,c=n.depth>0&&o.exec(s),l=c?s.slice(0,c.index):s,d=[];if(l){if(!n.plainObjects&&ru.call(Object.prototype,l)&&!n.allowPrototypes)return;d.push(l)}for(var g=0;n.depth>0&&(c=a.exec(s))!==null&&g"u"?st.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?st.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:st.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:st.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:st.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:st.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:st.comma,decoder:typeof e.decoder=="function"?e.decoder:st.decoder,delimiter:typeof e.delimiter=="string"||Yn.isRegExp(e.delimiter)?e.delimiter:st.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:st.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:st.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:st.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:st.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:st.strictNullHandling}},cv=function(t,e){var r=uv(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?sv(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;on}t.OpaqueType=e,t.HexString=e(),t.AddressString=e(),t.BigIntString=e();function r(n){return Math.floor(n)}t.IntNumber=r,t.RegExpString=e(),function(n){n.CoinbaseWallet="CoinbaseWallet",n.MetaMask="MetaMask",n.Unselected=""}(t.ProviderType||(t.ProviderType={}))})(Zi);var pv=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(J,"__esModule",{value:!0});J.isInIFrame=J.createQrUrl=J.getFavicon=J.range=J.isBigNumber=J.ensureParsedJSONObject=J.ensureBN=J.ensureRegExpString=J.ensureIntNumber=J.ensureBuffer=J.ensureAddressString=J.ensureEvenLengthHexString=J.ensureHexString=J.isHexString=J.prepend0x=J.strip0x=J.has0xPrefix=J.hexStringFromIntNumber=J.intNumberFromHexString=J.bigIntStringFromBN=J.hexStringFromBuffer=J.hexStringToUint8Array=J.uint8ArrayToHex=J.randomBytesHex=void 0;const Sr=pv(Ys),gv=dv,gn=Vi,Pt=Zi,Eh=/^[0-9]*$/,xh=/^[a-f0-9]*$/;function bv(t){return Mh(crypto.getRandomValues(new Uint8Array(t)))}J.randomBytesHex=bv;function Mh(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}J.uint8ArrayToHex=Mh;function vv(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>parseInt(e,16)))}J.hexStringToUint8Array=vv;function yv(t,e=!1){const r=t.toString("hex");return(0,Pt.HexString)(e?"0x"+r:r)}J.hexStringFromBuffer=yv;function mv(t){return(0,Pt.BigIntString)(t.toString(10))}J.bigIntStringFromBN=mv;function wv(t){return(0,Pt.IntNumber)(new Sr.default(Yi(t,!1),16).toNumber())}J.intNumberFromHexString=wv;function _v(t){return(0,Pt.HexString)("0x"+new Sr.default(t).toString(16))}J.hexStringFromIntNumber=_v;function ku(t){return t.startsWith("0x")||t.startsWith("0X")}J.has0xPrefix=ku;function no(t){return ku(t)?t.slice(2):t}J.strip0x=no;function Ch(t){return ku(t)?"0x"+t.slice(2):"0x"+t}J.prepend0x=Ch;function Qi(t){if(typeof t!="string")return!1;const e=no(t).toLowerCase();return xh.test(e)}J.isHexString=Qi;function Rh(t,e=!1){if(typeof t=="string"){const r=no(t).toLowerCase();if(xh.test(r))return(0,Pt.HexString)(e?"0x"+r:r)}throw gn.standardErrors.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}J.ensureHexString=Rh;function Yi(t,e=!1){let r=Rh(t,!1);return r.length%2===1&&(r=(0,Pt.HexString)("0"+r)),e?(0,Pt.HexString)("0x"+r):r}J.ensureEvenLengthHexString=Yi;function Sv(t){if(typeof t=="string"){const e=no(t).toLowerCase();if(Qi(e)&&e.length===40)return(0,Pt.AddressString)(Ch(e))}throw gn.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}J.ensureAddressString=Sv;function Ev(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string")if(Qi(t)){const e=Yi(t,!1);return Buffer.from(e,"hex")}else return Buffer.from(t,"utf8");throw gn.standardErrors.rpc.invalidParams(`Not binary data: ${String(t)}`)}J.ensureBuffer=Ev;function Ih(t){if(typeof t=="number"&&Number.isInteger(t))return(0,Pt.IntNumber)(t);if(typeof t=="string"){if(Eh.test(t))return(0,Pt.IntNumber)(Number(t));if(Qi(t))return(0,Pt.IntNumber)(new Sr.default(Yi(t,!1),16).toNumber())}throw gn.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}J.ensureIntNumber=Ih;function xv(t){if(t instanceof RegExp)return(0,Pt.RegExpString)(t.toString());throw gn.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(t)}`)}J.ensureRegExpString=xv;function Mv(t){if(t!==null&&(Sr.default.isBN(t)||Ah(t)))return new Sr.default(t.toString(10),10);if(typeof t=="number")return new Sr.default(Ih(t));if(typeof t=="string"){if(Eh.test(t))return new Sr.default(t,10);if(Qi(t))return new Sr.default(Yi(t,!1),16)}throw gn.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}J.ensureBN=Mv;function Cv(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw gn.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}J.ensureParsedJSONObject=Cv;function Ah(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}J.isBigNumber=Ah;function Rv(t,e){return Array.from({length:e-t},(r,n)=>t+n)}J.range=Rv;function Iv(){const t=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:r}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${r}${n}`}J.getFavicon=Iv;function Av(t,e,r,n,i,s){const o=n?"parent-id":"id",a=(0,gv.stringify)({[o]:t,secret:e,server:r,v:i,chainId:s});return`${r}/#/link?${a}`}J.createQrUrl=Av;function Tv(){try{return window.frameElement!==null}catch{return!1}}J.isInIFrame=Tv;Object.defineProperty(li,"__esModule",{value:!0});li.Session=void 0;const rl=ug,nl=J,il="session:id",sl="session:secret",ol="session:linked";class Ou{constructor(e,r,n,i){this._storage=e,this._id=r||(0,nl.randomBytesHex)(16),this._secret=n||(0,nl.randomBytesHex)(32),this._key=new rl.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(e){const r=e.getItem(il),n=e.getItem(ol),i=e.getItem(sl);return r&&i?new Ou(e,r,i,n==="1"):null}static hash(e){return new rl.sha256().update(e).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(il,this._id),this._storage.setItem(sl,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(ol,this._linked?"1":"0")}}li.Session=Ou;var Ut={};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.WalletSDKRelayAbstract=Ut.APP_VERSION_KEY=Ut.LOCAL_STORAGE_ADDRESSES_KEY=Ut.WALLET_USER_NAME_KEY=void 0;const al=Vi;Ut.WALLET_USER_NAME_KEY="walletUsername";Ut.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";Ut.APP_VERSION_KEY="AppVersion";class kv{async makeEthereumJSONRPCRequest(e,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(e),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw al.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,al.serializeError)(s,e.method);return i})}}Ut.WalletSDKRelayAbstract=kv;var nu={exports:{}},Th=vu.EventEmitter,ha,ul;function Ov(){if(ul)return ha;ul=1;function t(A,D){var N=Object.keys(A);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(A);D&&(x=x.filter(function(I){return Object.getOwnPropertyDescriptor(A,I).enumerable})),N.push.apply(N,x)}return N}function e(A){for(var D=1;D0?this.tail.next=x:this.head=x,this.tail=x,++this.length}},{key:"unshift",value:function(N){var x={data:N,next:this.head};this.length===0&&(this.tail=x),this.head=x,++this.length}},{key:"shift",value:function(){if(this.length!==0){var N=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,N}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(N){if(this.length===0)return"";for(var x=this.head,I=""+x.data;x=x.next;)I+=N+x.data;return I}},{key:"concat",value:function(N){if(this.length===0)return l.alloc(0);for(var x=l.allocUnsafe(N>>>0),I=this.head,O=0;I;)C(I.data,x,O),O+=I.data.length,I=I.next;return x}},{key:"consume",value:function(N,x){var I;return NP.length?P.length:N;if(L===P.length?O+=P:O+=P.slice(0,N),N-=L,N===0){L===P.length?(++I,x.next?this.head=x.next:this.head=this.tail=null):(this.head=x,x.data=P.slice(L));break}++I}return this.length-=I,O}},{key:"_getBuffer",value:function(N){var x=l.allocUnsafe(N),I=this.head,O=1;for(I.data.copy(x),N-=I.data.length;I=I.next;){var P=I.data,L=N>P.length?P.length:N;if(P.copy(x,x.length-N,0,L),N-=L,N===0){L===P.length?(++O,I.next?this.head=I.next:this.head=this.tail=null):(this.head=I,I.data=P.slice(L));break}++O}return this.length-=O,x}},{key:y,value:function(N,x){return g(this,e(e({},x),{},{depth:0,customInspect:!1}))}}]),A}(),ha}function Nv(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(iu,this,t)):process.nextTick(iu,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(ks,r):(r._writableState.errorEmitted=!0,process.nextTick(cl,r,s)):process.nextTick(cl,r,s):e?(process.nextTick(ks,r),e(s)):process.nextTick(ks,r)}),this)}function cl(t,e){iu(t,e),ks(t)}function ks(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Lv(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function iu(t,e){t.emit("error",e)}function Pv(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}var kh={destroy:Nv,undestroy:Lv,errorOrDestroy:Pv},bn={};function Dv(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var Oh={};function $t(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){Dv(o,s);function o(a,c,l){return s.call(this,n(a,c,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,Oh[t]=i}function ll(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function $v(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function Bv(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function jv(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}$t("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);$t("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&$v(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(Bv(t," argument"))i="The ".concat(t," ").concat(n," ").concat(ll(e,"type"));else{var s=jv(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(ll(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);$t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");$t("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});$t("ERR_STREAM_PREMATURE_CLOSE","Premature close");$t("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});$t("ERR_MULTIPLE_CALLBACK","Callback called multiple times");$t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");$t("ERR_STREAM_WRITE_AFTER_END","write after end");$t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);$t("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);$t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");bn.codes=Oh;var Fv=bn.codes.ERR_INVALID_OPT_VALUE;function Wv(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Hv(t,e,r,n){var i=Wv(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new Fv(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}var Nh={getHighWaterMark:Hv},Vv=Uv;function Uv(t,e){if(da("noDeprecation"))return t;var r=!1;function n(){if(!r){if(da("throwDeprecation"))throw new Error(e);da("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function da(t){try{if(!globalThis.localStorage)return!1}catch{return!1}var e=globalThis.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}var pa,fl;function Lh(){if(fl)return pa;fl=1,pa=z;function t(R){var k=this;this.next=null,this.entry=null,this.finish=function(){q(k,R)}}var e;z.WritableState=B;var r={deprecate:Vv},n=Th,i=Hi.Buffer,s=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(R){return i.from(R)}function a(R){return i.isBuffer(R)||R instanceof s}var c=kh,l=Nh,d=l.getHighWaterMark,g=bn.codes,y=g.ERR_INVALID_ARG_TYPE,C=g.ERR_METHOD_NOT_IMPLEMENTED,A=g.ERR_MULTIPLE_CALLBACK,D=g.ERR_STREAM_CANNOT_PIPE,N=g.ERR_STREAM_DESTROYED,x=g.ERR_STREAM_NULL_VALUES,I=g.ERR_STREAM_WRITE_AFTER_END,O=g.ERR_UNKNOWN_ENCODING,P=c.errorOrDestroy;zt(z,n);function L(){}function B(R,k,$){e=e||Kn(),R=R||{},typeof $!="boolean"&&($=k instanceof e),this.objectMode=!!R.objectMode,$&&(this.objectMode=this.objectMode||!!R.writableObjectMode),this.highWaterMark=d(this,R,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var V=R.decodeStrings===!1;this.decodeStrings=!V,this.defaultEncoding=R.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(se){p(k,se)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}B.prototype.getBuffer=function(){for(var k=this.bufferedRequest,$=[];k;)$.push(k),k=k.next;return $},function(){try{Object.defineProperty(B.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var G;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(G=Function.prototype[Symbol.hasInstance],Object.defineProperty(z,Symbol.hasInstance,{value:function(k){return G.call(this,k)?!0:this!==z?!1:k&&k._writableState instanceof B}})):G=function(k){return k instanceof this};function z(R){e=e||Kn();var k=this instanceof e;if(!k&&!G.call(z,this))return new z(R);this._writableState=new B(R,this,k),this.writable=!0,R&&(typeof R.write=="function"&&(this._write=R.write),typeof R.writev=="function"&&(this._writev=R.writev),typeof R.destroy=="function"&&(this._destroy=R.destroy),typeof R.final=="function"&&(this._final=R.final)),n.call(this)}z.prototype.pipe=function(){P(this,new D)};function W(R,k){var $=new I;P(R,$),process.nextTick(k,$)}function K(R,k,$,V){var se;return $===null?se=new x:typeof $!="string"&&!k.objectMode&&(se=new y("chunk",["string","Buffer"],$)),se?(P(R,se),process.nextTick(V,se),!1):!0}z.prototype.write=function(R,k,$){var V=this._writableState,se=!1,_=!V.objectMode&&a(R);return _&&!i.isBuffer(R)&&(R=o(R)),typeof k=="function"&&($=k,k=null),_?k="buffer":k||(k=V.defaultEncoding),typeof $!="function"&&($=L),V.ending?W(this,$):(_||K(this,V,R,$))&&(V.pendingcb++,se=X(this,V,_,R,k,$)),se},z.prototype.cork=function(){this._writableState.corked++},z.prototype.uncork=function(){var R=this._writableState;R.corked&&(R.corked--,!R.writing&&!R.corked&&!R.bufferProcessing&&R.bufferedRequest&&M(this,R))},z.prototype.setDefaultEncoding=function(k){if(typeof k=="string"&&(k=k.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((k+"").toLowerCase())>-1))throw new O(k);return this._writableState.defaultEncoding=k,this},Object.defineProperty(z.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Y(R,k,$){return!R.objectMode&&R.decodeStrings!==!1&&typeof k=="string"&&(k=i.from(k,$)),k}Object.defineProperty(z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function X(R,k,$,V,se,_){if(!$){var S=Y(k,V,se);V!==S&&($=!0,se="buffer",V=S)}var F=k.objectMode?1:V.length;k.length+=F;var H=k.length */var dl;function zv(){return dl||(dl=1,function(t,e){var r=Hi,n=r.Buffer;function i(o,a){for(var c in o)a[c]=o[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=s);function s(o,a,c){return n(o,a,c)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(o,a,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,a,c)},s.alloc=function(o,a,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var l=n(o);return a!==void 0?typeof c=="string"?l.fill(a,c):l.fill(a):l.fill(0),l},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}}(bs,bs.exports)),bs.exports}var pl;function gl(){if(pl)return ba;pl=1;var t=zv().Buffer,e=t.isEncoding||function(x){switch(x=""+x,x&&x.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(x){if(!x)return"utf8";for(var I;;)switch(x){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return x;default:if(I)return;x=(""+x).toLowerCase(),I=!0}}function n(x){var I=r(x);if(typeof I!="string"&&(t.isEncoding===e||!e(x)))throw new Error("Unknown encoding: "+x);return I||x}ba.StringDecoder=i;function i(x){this.encoding=n(x);var I;switch(this.encoding){case"utf16le":this.text=g,this.end=y,I=4;break;case"utf8":this.fillLast=c,I=4;break;case"base64":this.text=C,this.end=A,I=3;break;default:this.write=D,this.end=N;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(I)}i.prototype.write=function(x){if(x.length===0)return"";var I,O;if(this.lastNeed){if(I=this.fillLast(x),I===void 0)return"";O=this.lastNeed,this.lastNeed=0}else O=0;return O>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function o(x,I,O){var P=I.length-1;if(P=0?(L>0&&(x.lastNeed=L-1),L):--P=0?(L>0&&(x.lastNeed=L-2),L):--P=0?(L>0&&(L===2?L=0:x.lastNeed=L-3),L):0))}function a(x,I,O){if((I[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&I.length>1){if((I[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&I.length>2&&(I[2]&192)!==128)return x.lastNeed=2,"�"}}function c(x){var I=this.lastTotal-this.lastNeed,O=a(this,x);if(O!==void 0)return O;if(this.lastNeed<=x.length)return x.copy(this.lastChar,I,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,I,0,x.length),this.lastNeed-=x.length}function l(x,I){var O=o(this,x,I);if(!this.lastNeed)return x.toString("utf8",I);this.lastTotal=O;var P=x.length-(O-this.lastNeed);return x.copy(this.lastChar,0,P),x.toString("utf8",I,P)}function d(x){var I=x&&x.length?this.write(x):"";return this.lastNeed?I+"�":I}function g(x,I){if((x.length-I)%2===0){var O=x.toString("utf16le",I);if(O){var P=O.charCodeAt(O.length-1);if(P>=55296&&P<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],O.slice(0,-1)}return O}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",I,x.length-1)}function y(x){var I=x&&x.length?this.write(x):"";if(this.lastNeed){var O=this.lastTotal-this.lastNeed;return I+this.lastChar.toString("utf16le",0,O)}return I}function C(x,I){var O=(x.length-I)%3;return O===0?x.toString("base64",I):(this.lastNeed=3-O,this.lastTotal=3,O===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",I,x.length-O))}function A(x){var I=x&&x.length?this.write(x):"";return this.lastNeed?I+this.lastChar.toString("base64",0,3-this.lastNeed):I}function D(x){return x.toString(this.encoding)}function N(x){return x&&x.length?this.write(x):""}return ba}var bl=bn.codes.ERR_STREAM_PREMATURE_CLOSE;function qv(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if(typeof S!="string"&&!ie.objectMode&&Object.getPrototypeOf(S)!==n.prototype&&(S=s(S)),H)ie.endEmitted?L(_,new x):Y(_,ie,S,!0);else if(ie.ended)L(_,new D);else{if(ie.destroyed)return!1;ie.reading=!1,ie.decoder&&!F?(S=ie.decoder.write(S),ie.objectMode||S.length!==0?Y(_,ie,S,!1):M(_,ie)):Y(_,ie,S,!1)}else H||(ie.reading=!1,M(_,ie))}return!ie.ended&&(ie.length=b?_=b:(_--,_|=_>>>1,_|=_>>>2,_|=_>>>4,_|=_>>>8,_|=_>>>16,_++),_}function h(_,S){return _<=0||S.length===0&&S.ended?0:S.objectMode?1:_!==_?S.flowing&&S.length?S.buffer.head.data.length:S.length:(_>S.highWaterMark&&(S.highWaterMark=u(_)),_<=S.length?_:S.ended?S.length:(S.needReadable=!0,0))}W.prototype.read=function(_){c("read",_),_=parseInt(_,10);var S=this._readableState,F=_;if(_!==0&&(S.emittedReadable=!1),_===0&&S.needReadable&&((S.highWaterMark!==0?S.length>=S.highWaterMark:S.length>0)||S.ended))return c("read: emitReadable",S.length,S.ended),S.length===0&&S.ended?$(this):v(this),null;if(_=h(_,S),_===0&&S.ended)return S.length===0&&$(this),null;var H=S.needReadable;c("need readable",H),(S.length===0||S.length-_0?re=k(_,S):re=null,re===null?(S.needReadable=S.length<=S.highWaterMark,_=0):(S.length-=_,S.awaitDrain=0),S.length===0&&(S.ended||(S.needReadable=!0),F!==_&&S.ended&&$(this)),re!==null&&this.emit("data",re),re};function p(_,S){if(c("onEofChunk"),!S.ended){if(S.decoder){var F=S.decoder.end();F&&F.length&&(S.buffer.push(F),S.length+=S.objectMode?1:F.length)}S.ended=!0,S.sync?v(_):(S.needReadable=!1,S.emittedReadable||(S.emittedReadable=!0,w(_)))}}function v(_){var S=_._readableState;c("emitReadable",S.needReadable,S.emittedReadable),S.needReadable=!1,S.emittedReadable||(c("emitReadable",S.flowing),S.emittedReadable=!0,process.nextTick(w,_))}function w(_){var S=_._readableState;c("emitReadable_",S.destroyed,S.length,S.ended),!S.destroyed&&(S.length||S.ended)&&(_.emit("readable"),S.emittedReadable=!1),S.needReadable=!S.flowing&&!S.ended&&S.length<=S.highWaterMark,R(_)}function M(_,S){S.readingMore||(S.readingMore=!0,process.nextTick(T,_,S))}function T(_,S){for(;!S.reading&&!S.ended&&(S.length1&&se(H.pipes,_)!==-1)&&!we&&(c("false write response, pause",H.awaitDrain),H.awaitDrain++),F.pause())}function ve(pe){c("onerror",pe),be(),_.removeListener("error",ve),e(_,"error")===0&&L(_,pe)}G(_,"error",ve);function ye(){_.removeListener("finish",ur),be()}_.once("close",ye);function ur(){c("onfinish"),_.removeListener("close",ye),be()}_.once("finish",ur);function be(){c("unpipe"),F.unpipe(_)}return _.emit("pipe",F),H.flowing||(c("pipe resume"),F.resume()),_};function m(_){return function(){var F=_._readableState;c("pipeOnDrain",F.awaitDrain),F.awaitDrain&&F.awaitDrain--,F.awaitDrain===0&&e(_,"data")&&(F.flowing=!0,R(_))}}W.prototype.unpipe=function(_){var S=this._readableState,F={hasUnpiped:!1};if(S.pipesCount===0)return this;if(S.pipesCount===1)return _&&_!==S.pipes?this:(_||(_=S.pipes),S.pipes=null,S.pipesCount=0,S.flowing=!1,_&&_.emit("unpipe",this,F),this);if(!_){var H=S.pipes,re=S.pipesCount;S.pipes=null,S.pipesCount=0,S.flowing=!1;for(var ie=0;ie0,H.flowing!==!1&&this.resume()):_==="readable"&&!H.endEmitted&&!H.readableListening&&(H.readableListening=H.needReadable=!0,H.flowing=!1,H.emittedReadable=!1,c("on readable",H.length,H.reading),H.length?v(this):H.reading||process.nextTick(E,this)),F},W.prototype.addListener=W.prototype.on,W.prototype.removeListener=function(_,S){var F=r.prototype.removeListener.call(this,_,S);return _==="readable"&&process.nextTick(f,this),F},W.prototype.removeAllListeners=function(_){var S=r.prototype.removeAllListeners.apply(this,arguments);return(_==="readable"||_===void 0)&&process.nextTick(f,this),S};function f(_){var S=_._readableState;S.readableListening=_.listenerCount("readable")>0,S.resumeScheduled&&!S.paused?S.flowing=!0:_.listenerCount("data")>0&&_.resume()}function E(_){c("readable nexttick read 0"),_.read(0)}W.prototype.resume=function(){var _=this._readableState;return _.flowing||(c("resume"),_.flowing=!_.readableListening,U(this,_)),_.paused=!1,this};function U(_,S){S.resumeScheduled||(S.resumeScheduled=!0,process.nextTick(q,_,S))}function q(_,S){c("resume",S.reading),S.reading||_.read(0),S.resumeScheduled=!1,_.emit("resume"),R(_),S.flowing&&!S.reading&&_.read(0)}W.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function R(_){var S=_._readableState;for(c("flow",S.flowing);S.flowing&&_.read()!==null;);}W.prototype.wrap=function(_){var S=this,F=this._readableState,H=!1;_.on("end",function(){if(c("wrapped end"),F.decoder&&!F.ended){var ee=F.decoder.end();ee&&ee.length&&S.push(ee)}S.push(null)}),_.on("data",function(ee){if(c("wrapped data"),F.decoder&&(ee=F.decoder.write(ee)),!(F.objectMode&&ee==null)&&!(!F.objectMode&&(!ee||!ee.length))){var de=S.push(ee);de||(H=!0,_.pause())}});for(var re in _)this[re]===void 0&&typeof _[re]=="function"&&(this[re]=function(de){return function(){return _[de].apply(_,arguments)}}(re));for(var ie=0;ie=S.length?(S.decoder?F=S.buffer.join(""):S.buffer.length===1?F=S.buffer.first():F=S.buffer.concat(S.length),S.buffer.clear()):F=S.buffer.consume(_,S.decoder),F}function $(_){var S=_._readableState;c("endReadable",S.endEmitted),S.endEmitted||(S.ended=!0,process.nextTick(V,S,_))}function V(_,S){if(c("endReadableNT",_.endEmitted,_.length),!_.endEmitted&&_.length===0&&(_.endEmitted=!0,S.readable=!1,S.emit("end"),_.autoDestroy)){var F=S._writableState;(!F||F.autoDestroy&&F.finished)&&S.destroy()}}typeof Symbol=="function"&&(W.from=function(_,S){return P===void 0&&(P=Qv()),P(W,_,S)});function se(_,S){for(var F=0,H=_.length;F0;return uy(o,c,l,function(d){i||(i=d),d&&s.forEach(Sl),!c&&(s.forEach(Sl),n(i))})});return e.reduce(cy)}var hy=fy;(function(t,e){e=t.exports=Dh(),e.Stream=e,e.Readable=e,e.Writable=Lh(),e.Duplex=Kn(),e.Transform=$h,e.PassThrough=ny,e.finished=Nu,e.pipeline=hy})(nu,nu.exports);var Fh=nu.exports;const{Transform:dy}=Fh;var py=t=>class Wh extends dy{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new Wh(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:gy}=Fh;var by=t=>class Hh extends gy{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new Hh(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const vy=py,yy=by;var my=function(t){const e=vy(t),r=yy(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}},Vh={};const El=[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];Vh.p1600=function(t){for(let e=0;e<24;++e){const r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],c=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],d=t[8]^t[18]^t[28]^t[38]^t[48],g=t[9]^t[19]^t[29]^t[39]^t[49];let y=d^(i<<1|s>>>31),C=g^(s<<1|i>>>31);const A=t[0]^y,D=t[1]^C,N=t[10]^y,x=t[11]^C,I=t[20]^y,O=t[21]^C,P=t[30]^y,L=t[31]^C,B=t[40]^y,G=t[41]^C;y=r^(o<<1|a>>>31),C=n^(a<<1|o>>>31);const z=t[2]^y,W=t[3]^C,K=t[12]^y,Y=t[13]^C,X=t[22]^y,b=t[23]^C,u=t[32]^y,h=t[33]^C,p=t[42]^y,v=t[43]^C;y=i^(c<<1|l>>>31),C=s^(l<<1|c>>>31);const w=t[4]^y,M=t[5]^C,T=t[14]^y,m=t[15]^C,f=t[24]^y,E=t[25]^C,U=t[34]^y,q=t[35]^C,R=t[44]^y,k=t[45]^C;y=o^(d<<1|g>>>31),C=a^(g<<1|d>>>31);const $=t[6]^y,V=t[7]^C,se=t[16]^y,_=t[17]^C,S=t[26]^y,F=t[27]^C,H=t[36]^y,re=t[37]^C,ie=t[46]^y,ee=t[47]^C;y=c^(r<<1|n>>>31),C=l^(n<<1|r>>>31);const de=t[8]^y,Jt=t[9]^C,we=t[18]^y,Se=t[19]^C,vr=t[28]^y,ve=t[29]^C,ye=t[38]^y,ur=t[39]^C,be=t[48]^y,pe=t[49]^C,xt=A,Ee=D,xe=x<<4|N>>>28,wn=N<<4|x>>>28,Me=I<<3|O>>>29,Ce=O<<3|I>>>29,_n=L<<9|P>>>23,Re=P<<9|L>>>23,Ie=B<<18|G>>>14,Sn=G<<18|B>>>14,Ae=z<<1|W>>>31,Te=W<<1|z>>>31,En=Y<<12|K>>>20,ke=K<<12|Y>>>20,Oe=X<<10|b>>>22,xn=b<<10|X>>>22,Ne=h<<13|u>>>19,Le=u<<13|h>>>19,Mn=p<<2|v>>>30,Pe=v<<2|p>>>30,De=M<<30|w>>>2,Cn=w<<30|M>>>2,$e=T<<6|m>>>26,Be=m<<6|T>>>26,Rn=E<<11|f>>>21,je=f<<11|E>>>21,Fe=U<<15|q>>>17,In=q<<15|U>>>17,We=k<<29|R>>>3,He=R<<29|k>>>3,An=$<<28|V>>>4,Ve=V<<28|$>>>4,Ue=_<<23|se>>>9,Tn=se<<23|_>>>9,ze=S<<25|F>>>7,qe=F<<25|S>>>7,Or=H<<21|re>>>11,Nr=re<<21|H>>>11,Lr=ee<<24|ie>>>8,Pr=ie<<24|ee>>>8,Dr=de<<27|Jt>>>5,$r=Jt<<27|de>>>5,Br=we<<20|Se>>>12,jr=Se<<20|we>>>12,Fr=ve<<7|vr>>>25,Wr=vr<<7|ve>>>25,Hr=ye<<8|ur>>>24,Vr=ur<<8|ye>>>24,Ur=be<<14|pe>>>18,zr=pe<<14|be>>>18;t[0]=xt^~En&Rn,t[1]=Ee^~ke&je,t[10]=An^~Br&Me,t[11]=Ve^~jr&Ce,t[20]=Ae^~$e&ze,t[21]=Te^~Be&qe,t[30]=Dr^~xe&Oe,t[31]=$r^~wn&xn,t[40]=De^~Ue&Fr,t[41]=Cn^~Tn&Wr,t[2]=En^~Rn&Or,t[3]=ke^~je&Nr,t[12]=Br^~Me&Ne,t[13]=jr^~Ce&Le,t[22]=$e^~ze&Hr,t[23]=Be^~qe&Vr,t[32]=xe^~Oe&Fe,t[33]=wn^~xn&In,t[42]=Ue^~Fr&_n,t[43]=Tn^~Wr&Re,t[4]=Rn^~Or&Ur,t[5]=je^~Nr&zr,t[14]=Me^~Ne&We,t[15]=Ce^~Le&He,t[24]=ze^~Hr&Ie,t[25]=qe^~Vr&Sn,t[34]=Oe^~Fe&Lr,t[35]=xn^~In&Pr,t[44]=Fr^~_n&Mn,t[45]=Wr^~Re&Pe,t[6]=Or^~Ur&xt,t[7]=Nr^~zr&Ee,t[16]=Ne^~We&An,t[17]=Le^~He&Ve,t[26]=Hr^~Ie&Ae,t[27]=Vr^~Sn&Te,t[36]=Fe^~Lr&Dr,t[37]=In^~Pr&$r,t[46]=_n^~Mn&De,t[47]=Re^~Pe&Cn,t[8]=Ur^~xt&En,t[9]=zr^~Ee&ke,t[18]=We^~An&Br,t[19]=He^~Ve&jr,t[28]=Ie^~Ae&$e,t[29]=Sn^~Te&Be,t[38]=Lr^~Dr&xe,t[39]=Pr^~$r&wn,t[48]=Mn^~De&Ue,t[49]=Pe^~Cn&Tn,t[0]^=El[e*2],t[1]^=El[e*2+1]}};const js=Vh;function di(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}di.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};di.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(js.p1600(this.state),this.count=0);return e};di.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};var wy=di,_y=my(wy);const Sy=_y,Ey=Ys;function Uh(t){return Buffer.allocUnsafe(t).fill(0)}function zh(t,e,r){const n=Uh(e);return t=oo(t),r?t.length"u")throw new Error("Not an array?");if(r=Qh(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Xt(t,e[s]));if(r==="dynamic"){var o=Xt("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Xt("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,on.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Un(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return on.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Un(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=Qr(e),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(Buffer,"be",32)}else if(t.startsWith("int")){if(r=Un(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=Qr(e),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(Buffer,"be",32)}else if(t.startsWith("ufixed")){if(r=xl(t),n=Qr(e),n<0)throw new Error("Supplied ufixed is negative");return Xt("uint256",n.mul(new en(2).pow(new en(r[1]))))}else if(t.startsWith("fixed"))return r=xl(t),Xt("int256",Qr(e).mul(new en(2).pow(new en(r[1]))))}throw new Error("Unsupported or invalid type: "+t)}function Iy(t){return t==="string"||t==="bytes"||Qh(t)==="dynamic"}function Ay(t){return t.lastIndexOf("]")===t.length-1}function Ty(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=Zh(t[s]),a=e[s],c=Xt(o,a);Iy(o)?(r.push(Xt("uint256",i)),n.push(c),i+=c.length):r.push(c)}return Buffer.concat(r.concat(n))}function Yh(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(on.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Un(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=Qr(a),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());i.push(n.toArrayLike(Buffer,"be",r/8))}else if(o.startsWith("int")){if(r=Un(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=Qr(a),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());i.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function ky(t,e){return on.keccak(Yh(t,e))}var Oy={rawEncode:Ty,solidityPack:Yh,soliditySHA3:ky};const Wt=Jh,Oi=Oy,Kh={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},_a={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,c,l)=>{if(r[c]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":Wt.keccak(this.encodeData(c,l,r,n))];if(l===void 0)throw new Error(`missing value for field ${a} of type ${c}`);if(c==="bytes")return["bytes32",Wt.keccak(l)];if(c==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",Wt.keccak(l)];if(c.lastIndexOf("]")===c.length-1){const d=c.slice(0,c.lastIndexOf("[")),g=l.map(y=>o(a,d,y));return["bytes32",Wt.keccak(Oi.rawEncode(g.map(([y])=>y),g.map(([,y])=>y)))]}return[c,l]};for(const a of r[t]){const[c,l]=o(a.name,a.type,e[a.name]);i.push(c),s.push(l)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=Wt.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=Wt.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=Wt.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return Oi.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return Wt.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return Wt.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in Kh.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),Wt.keccak(Buffer.concat(n))}};var Ny={TYPED_MESSAGE_SCHEMA:Kh,TypedDataUtils:_a,hashForSignTypedDataLegacy:function(t){return Ly(t.data)},hashForSignTypedData_v3:function(t){return _a.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return _a.hash(t.data)}};function Ly(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?Wt.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return Oi.soliditySHA3(["bytes32","bytes32"],[Oi.soliditySHA3(new Array(t.length).fill("string"),i),Oi.soliditySHA3(n,r)])}var Xn={};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.filterFromParam=Xn.FilterPolyfill=void 0;const jn=Zi,vt=J,Py=5*60*1e3,Yr={jsonrpc:"2.0",id:0};class Dy{constructor(e){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,jn.IntNumber)(1),this.provider=e}async newFilter(e){const r=Xh(e),n=this.makeFilterId(),i=await this.setInitialCursorPosition(n,r.fromBlock);return console.log(`Installing new log filter(${n}):`,r,"initial cursor position:",i),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,vt.hexStringFromIntNumber)(n)}async newBlockFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.log(`Installing new block filter (${e}) with initial cursor position:`,r),this.blockFilters.add(e),this.setFilterTimeout(e),(0,vt.hexStringFromIntNumber)(e)}async newPendingTransactionFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.log(`Installing new block filter (${e}) with initial cursor position:`,r),this.pendingTransactionFilters.add(e),this.setFilterTimeout(e),(0,vt.hexStringFromIntNumber)(e)}uninstallFilter(e){const r=(0,vt.intNumberFromHexString)(e);return console.log(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(e){const r=(0,vt.intNumberFromHexString)(e);return this.timeouts.has(r)&&this.setFilterTimeout(r),this.logFilters.has(r)?this.getLogFilterChanges(r):this.blockFilters.has(r)?this.getBlockFilterChanges(r):this.pendingTransactionFilters.has(r)?this.getPendingTransactionFilterChanges(r):Promise.resolve(vs())}async getFilterLogs(e){const r=(0,vt.intNumberFromHexString)(e),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},Yr),{method:"eth_getLogs",params:[Ml(n)]})):vs()}makeFilterId(){return(0,jn.IntNumber)(++this.nextFilterId)}sendAsyncPromise(e){return new Promise((r,n)=>{this.provider.sendAsync(e,(i,s)=>{if(i)return n(i);if(Array.isArray(s)||s==null)return n(new Error(`unexpected response received: ${JSON.stringify(s)}`));r(s)})})}deleteFilter(e){console.log(`Deleting filter (${e})`),this.logFilters.delete(e),this.blockFilters.delete(e),this.pendingTransactionFilters.delete(e),this.cursors.delete(e),this.timeouts.delete(e)}async getLogFilterChanges(e){const r=this.logFilters.get(e),n=this.cursors.get(e);if(!n||!r)return vs();const i=await this.getCurrentBlockHeight(),s=r.toBlock==="latest"?i:r.toBlock;if(n>i||n>r.toBlock)return ys();console.log(`Fetching logs from ${n} to ${s} for filter ${e}`);const o=await this.sendAsyncPromise(Object.assign(Object.assign({},Yr),{method:"eth_getLogs",params:[Ml(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:s}))]}));if(Array.isArray(o.result)){const a=o.result.map(l=>(0,vt.intNumberFromHexString)(l.blockNumber||"0x0")),c=Math.max(...a);if(c&&c>n){const l=(0,jn.IntNumber)(c+1);console.log(`Moving cursor position for filter (${e}) from ${n} to ${l}`),this.cursors.set(e,l)}}return o}async getBlockFilterChanges(e){const r=this.cursors.get(e);if(!r)return vs();const n=await this.getCurrentBlockHeight();if(r>n)return ys();console.log(`Fetching blocks from ${r} to ${n} for filter (${e})`);const i=(await Promise.all((0,vt.range)(r,n+1).map(o=>this.getBlockHashByNumber((0,jn.IntNumber)(o))))).filter(o=>!!o),s=(0,jn.IntNumber)(r+i.length);return console.log(`Moving cursor position for filter (${e}) from ${r} to ${s}`),this.cursors.set(e,s),Object.assign(Object.assign({},Yr),{result:i})}async getPendingTransactionFilterChanges(e){return Promise.resolve(ys())}async setInitialCursorPosition(e,r){const n=await this.getCurrentBlockHeight(),i=typeof r=="number"&&r>n?r:n;return this.cursors.set(e,i),i}setFilterTimeout(e){const r=this.timeouts.get(e);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.log(`Filter (${e}) timed out`),this.deleteFilter(e)},Py);this.timeouts.set(e,n)}async getCurrentBlockHeight(){const{result:e}=await this.sendAsyncPromise(Object.assign(Object.assign({},Yr),{method:"eth_blockNumber",params:[]}));return(0,vt.intNumberFromHexString)((0,vt.ensureHexString)(e))}async getBlockHashByNumber(e){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},Yr),{method:"eth_getBlockByNumber",params:[(0,vt.hexStringFromIntNumber)(e),!1]}));return r.result&&typeof r.result.hash=="string"?(0,vt.ensureHexString)(r.result.hash):null}}Xn.FilterPolyfill=Dy;function Xh(t){return{fromBlock:Cl(t.fromBlock),toBlock:Cl(t.toBlock),addresses:t.address===void 0?null:Array.isArray(t.address)?t.address:[t.address],topics:t.topics||[]}}Xn.filterFromParam=Xh;function Ml(t){const e={fromBlock:Rl(t.fromBlock),toBlock:Rl(t.toBlock),topics:t.topics};return t.addresses!==null&&(e.address=t.addresses),e}function Cl(t){if(t===void 0||t==="latest"||t==="pending")return"latest";if(t==="earliest")return(0,jn.IntNumber)(0);if((0,vt.isHexString)(t))return(0,vt.intNumberFromHexString)(t);throw new Error(`Invalid block option: ${String(t)}`)}function Rl(t){return t==="latest"?t:(0,vt.hexStringFromIntNumber)(t)}function vs(){return Object.assign(Object.assign({},Yr),{error:{code:-32e3,message:"filter not found"}})}function ys(){return Object.assign(Object.assign({},Yr),{result:[]})}var ed={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.JSONRPCMethod=void 0,function(e){e.eth_accounts="eth_accounts",e.eth_coinbase="eth_coinbase",e.net_version="net_version",e.eth_chainId="eth_chainId",e.eth_uninstallFilter="eth_uninstallFilter",e.eth_requestAccounts="eth_requestAccounts",e.eth_sign="eth_sign",e.eth_ecRecover="eth_ecRecover",e.personal_sign="personal_sign",e.personal_ecRecover="personal_ecRecover",e.eth_signTransaction="eth_signTransaction",e.eth_sendRawTransaction="eth_sendRawTransaction",e.eth_sendTransaction="eth_sendTransaction",e.eth_signTypedData_v1="eth_signTypedData_v1",e.eth_signTypedData_v2="eth_signTypedData_v2",e.eth_signTypedData_v3="eth_signTypedData_v3",e.eth_signTypedData_v4="eth_signTypedData_v4",e.eth_signTypedData="eth_signTypedData",e.cbWallet_arbitrary="walletlink_arbitrary",e.wallet_addEthereumChain="wallet_addEthereumChain",e.wallet_switchEthereumChain="wallet_switchEthereumChain",e.wallet_watchAsset="wallet_watchAsset",e.eth_subscribe="eth_subscribe",e.eth_unsubscribe="eth_unsubscribe",e.eth_newFilter="eth_newFilter",e.eth_newBlockFilter="eth_newBlockFilter",e.eth_newPendingTransactionFilter="eth_newPendingTransactionFilter",e.eth_getFilterChanges="eth_getFilterChanges",e.eth_getFilterLogs="eth_getFilterLogs"}(t.JSONRPCMethod||(t.JSONRPCMethod={}))})(ed);var ao={},td={},uo={},Lu=$y;function $y(t){t=t||{};var e=t.max||Number.MAX_SAFE_INTEGER,r=typeof t.start<"u"?t.start:Math.floor(Math.random()*e);return function(){return r=r%e,r++}}const Il=(t,e)=>function(){const r=e.promiseModule,n=new Array(arguments.length);for(let i=0;i{e.errorFirst?n.push(function(o,a){if(e.multiArgs){const c=new Array(arguments.length-1);for(let l=1;l{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);const r=i=>{const s=o=>typeof o=="string"?i===o:o.test(i);return e.include?e.include.some(s):!e.exclude.some(s)};let n;typeof t=="function"?n=function(){return e.excludeMain?t.apply(this,arguments):Il(t,e).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(t));for(const i in t){const s=t[i];n[i]=typeof s=="function"&&r(i)?Il(s,e):s}return n},Ki={},jy=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ki,"__esModule",{value:!0});Ki.BaseBlockTracker=void 0;const Fy=jy(fn),Wy=1e3,Hy=(t,e)=>t+e,Al=["sync","latest"];class Vy extends Fy.default{constructor(e){super(),this._blockResetDuration=e.blockResetDuration||20*Wy,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(r=>this.once("latest",r))}removeAllListeners(e){return e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e){Al.includes(e)&&this._maybeStart()}_onRemoveListener(){this._getBlockTrackerEventCount()>0||this._maybeEnd()}async _maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),await this._start(),this.emit("_started"))}async _maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),await this._end(),this.emit("_ended"))}_getBlockTrackerEventCount(){return Al.map(e=>this.listenerCount(e)).reduce(Hy)}_newPotentialLatest(e){const r=this._currentBlock;r&&Tl(e)<=Tl(r)||this._setCurrentBlock(e)}_setCurrentBlock(e){const r=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:r,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}Ki.BaseBlockTracker=Vy;function Tl(t){return Number.parseInt(t,16)}var rd={},nd={},ht={};class id extends TypeError{constructor(e,r){let n;const{message:i,explanation:s,...o}=e,{path:a}=e,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function Uy(t){return Dt(t)&&typeof t[Symbol.iterator]=="function"}function Dt(t){return typeof t=="object"&&t!=null}function kl(t){if(Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function nt(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function zy(t){const{done:e,value:r}=t.next();return e?void 0:r}function qy(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:s}=e,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${nt(n)}\``}=t;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...t,message:c}}function*su(t,e,r,n){Uy(t)||(t=[t]);for(const i of t){const s=qy(i,e,r,n);s&&(yield s)}}function*Pu(t,e,r={}){const{path:n=[],branch:i=[t],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(t=e.coercer(t,a),o&&e.type!=="type"&&Dt(e.schema)&&Dt(t)&&!Array.isArray(t)))for(const l in t)e.schema[l]===void 0&&delete t[l];let c="valid";for(const l of e.validator(t,a))l.explanation=r.message,c="not_valid",yield[l,void 0];for(let[l,d,g]of e.entries(t,a)){const y=Pu(d,g,{path:l===void 0?n:[...n,l],branch:l===void 0?i:[...i,d],coerce:s,mask:o,message:r.message});for(const C of y)C[0]?(c=C[0].refinement!=null?"not_refined":"not_valid",yield[C[0],void 0]):s&&(d=C[1],l===void 0?t=d:t instanceof Map?t.set(l,d):t instanceof Set?t.add(d):Dt(t)&&(d!==void 0||l in t)&&(t[l]=d))}if(c!=="not_valid")for(const l of e.refiner(t,a))l.explanation=r.message,c="not_refined",yield[l,void 0];c==="valid"&&(yield[void 0,t])}class et{constructor(e){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,l)=>{const d=i(c,l);return su(d,l,this,c)}:this.validator=()=>[],s?this.refiner=(c,l)=>{const d=s(c,l);return su(d,l,this,c)}:this.refiner=()=>[]}assert(e,r){return sd(e,this,r)}create(e,r){return od(e,this,r)}is(e){return Du(e,this)}mask(e,r){return ad(e,this,r)}validate(e,r={}){return pi(e,this,r)}}function sd(t,e,r){const n=pi(t,e,{message:r});if(n[0])throw n[0]}function od(t,e,r){const n=pi(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function ad(t,e,r){const n=pi(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Du(t,e){return!pi(t,e)[0]}function pi(t,e,r={}){const n=Pu(t,e,r),i=zy(n);return i[0]?[new id(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function Gy(...t){const e=t[0].type==="type",r=t.map(i=>i.schema),n=Object.assign({},...r);return e?Bu(n):Xi(n)}function Et(t,e){return new et({type:t,schema:null,validator:e})}function Jy(t,e){return new et({...t,refiner:(r,n)=>r===void 0||t.refiner(r,n),validator(r,n){return r===void 0?!0:(e(r,n),t.validator(r,n))}})}function Zy(t){return new et({type:"dynamic",schema:null,*entries(e,r){yield*t(e,r).entries(e,r)},validator(e,r){return t(e,r).validator(e,r)},coercer(e,r){return t(e,r).coercer(e,r)},refiner(e,r){return t(e,r).refiner(e,r)}})}function Qy(t){let e;return new et({type:"lazy",schema:null,*entries(r,n){e??(e=t()),yield*e.entries(r,n)},validator(r,n){return e??(e=t()),e.validator(r,n)},coercer(r,n){return e??(e=t()),e.coercer(r,n)},refiner(r,n){return e??(e=t()),e.refiner(r,n)}})}function Yy(t,e){const{schema:r}=t,n={...r};for(const i of e)delete n[i];switch(t.type){case"type":return Bu(n);default:return Xi(n)}}function Ky(t){const e=t instanceof et?{...t.schema}:{...t};for(const r in e)e[r]=ud(e[r]);return Xi(e)}function Xy(t,e){const{schema:r}=t,n={};for(const i of e)n[i]=r[i];return Xi(n)}function em(t,e){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),Et(t,e)}function tm(){return Et("any",()=>!0)}function rm(t){return new et({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${nt(e)}`}})}function nm(){return Et("bigint",t=>typeof t=="bigint")}function im(){return Et("boolean",t=>typeof t=="boolean")}function sm(){return Et("date",t=>t instanceof Date&&!isNaN(t.getTime())||`Expected a valid \`Date\` object, but received: ${nt(t)}`)}function om(t){const e={},r=t.map(n=>nt(n)).join();for(const n of t)e[n]=n;return new et({type:"enums",schema:e,validator(n){return t.includes(n)||`Expected one of \`${r}\`, but received: ${nt(n)}`}})}function am(){return Et("func",t=>typeof t=="function"||`Expected a function, but received: ${nt(t)}`)}function um(t){return Et("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${nt(e)}`)}function cm(){return Et("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${nt(t)}`)}function lm(t){return new et({type:"intersection",schema:null,*entries(e,r){for(const n of t)yield*n.entries(e,r)},*validator(e,r){for(const n of t)yield*n.validator(e,r)},*refiner(e,r){for(const n of t)yield*n.refiner(e,r)}})}function fm(t){const e=nt(t),r=typeof t;return new et({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${nt(n)}`}})}function hm(t,e){return new et({type:"map",schema:null,*entries(r){if(t&&e&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,t],yield[n,i,e]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${nt(r)}`}})}function $u(){return Et("never",()=>!1)}function dm(t){return new et({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function pm(){return Et("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${nt(t)}`)}function Xi(t){const e=t?Object.keys(t):[],r=$u();return new et({type:"object",schema:t||null,*entries(n){if(t&&Dt(n)){const i=new Set(Object.keys(n));for(const s of e)i.delete(s),yield[s,n[s],t[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return Dt(n)||`Expected an object, but received: ${nt(n)}`},coercer(n){return Dt(n)?{...n}:n}})}function ud(t){return new et({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function gm(t,e){return new et({type:"record",schema:null,*entries(r){if(Dt(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return Dt(r)||`Expected an object, but received: ${nt(r)}`}})}function bm(){return Et("regexp",t=>t instanceof RegExp)}function vm(t){return new et({type:"set",schema:null,*entries(e){if(t&&e instanceof Set)for(const r of e)yield[r,r,t]},coercer(e){return e instanceof Set?new Set(e):e},validator(e){return e instanceof Set||`Expected a \`Set\` object, but received: ${nt(e)}`}})}function cd(){return Et("string",t=>typeof t=="string"||`Expected a string, but received: ${nt(t)}`)}function ym(t){const e=$u();return new et({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;ir.type).join(" | ");return new et({type:"union",schema:null,coercer(r){for(const n of t){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of t){const[...o]=Pu(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${nt(r)}`,...i]}})}function ld(){return Et("unknown",()=>!0)}function ju(t,e,r){return new et({...t,coercer:(n,i)=>Du(n,e)?t.coercer(r(n,i),i):t.coercer(n,i)})}function wm(t,e,r={}){return ju(t,ld(),n=>{const i=typeof e=="function"?e():e;if(n===void 0)return i;if(!r.strict&&kl(n)&&kl(i)){const s={...n};let o=!1;for(const a in i)s[a]===void 0&&(s[a]=i[a],o=!0);if(o)return s}return n})}function _m(t){return ju(t,cd(),e=>e.trim())}function Sm(t){return vn(t,"empty",e=>{const r=fd(e);return r===0||`Expected an empty ${t.type} but received one with a size of \`${r}\``})}function fd(t){return t instanceof Map||t instanceof Set?t.size:t.length}function Em(t,e,r={}){const{exclusive:n}=r;return vn(t,"max",i=>n?in?i>e:i>=e||`Expected a ${t.type} greater than ${n?"":"or equal to "}${e} but received \`${i}\``)}function Mm(t){return vn(t,"nonempty",e=>fd(e)>0||`Expected a nonempty ${t.type} but received an empty one`)}function Cm(t,e){return vn(t,"pattern",r=>e.test(r)||`Expected a ${t.type} matching \`/${e.source}/\` but received "${r}"`)}function Rm(t,e,r=e){const n=`Expected a ${t.type}`,i=e===r?`of \`${e}\``:`between \`${e}\` and \`${r}\``;return vn(t,"size",s=>{if(typeof s=="number"||s instanceof Date)return e<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:o}=s;return e<=o&&o<=r||`${n} with a size ${i} but received one with a size of \`${o}\``}else{const{length:o}=s;return e<=o&&o<=r||`${n} with a length ${i} but received one with a length of \`${o}\``}})}function vn(t,e,r){return new et({...t,*refiner(n,i){yield*t.refiner(n,i);const s=r(n,i),o=su(s,i,t,n);for(const a of o)yield{...a,refinement:e}}})}const Im=Object.freeze(Object.defineProperty({__proto__:null,Struct:et,StructError:id,any:tm,array:rm,assert:sd,assign:Gy,bigint:nm,boolean:im,coerce:ju,create:od,date:sm,defaulted:wm,define:Et,deprecated:Jy,dynamic:Zy,empty:Sm,enums:om,func:am,instance:um,integer:cm,intersection:lm,is:Du,lazy:Qy,literal:fm,map:hm,mask:ad,max:Em,min:xm,never:$u,nonempty:Mm,nullable:dm,number:pm,object:Xi,omit:Yy,optional:ud,partial:Ky,pattern:Cm,pick:Xy,record:gm,refine:vn,regexp:bm,set:vm,size:Rm,string:cd,struct:em,trimmed:_m,tuple:ym,type:Bu,union:mm,unknown:ld,validate:pi},Symbol.toStringTag,{value:"Module"})),yn=ln(Im);Object.defineProperty(ht,"__esModule",{value:!0});ht.assertExhaustive=ht.assertStruct=ht.assert=ht.AssertionError=void 0;const Am=yn;function Tm(t){return typeof t=="object"&&t!==null&&"message"in t}function km(t){var e,r;return typeof((r=(e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===null||r===void 0?void 0:r.name)=="string"}function Om(t){const e=Tm(t)?t.message:String(t);return e.endsWith(".")?e.slice(0,-1):e}function hd(t,e){return km(t)?new t({message:e}):t({message:e})}class Fu extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}ht.AssertionError=Fu;function Nm(t,e="Assertion failed.",r=Fu){if(!t)throw e instanceof Error?e:hd(r,e)}ht.assert=Nm;function Lm(t,e,r="Assertion failed",n=Fu){try{(0,Am.assert)(t,e)}catch(i){throw hd(n,`${r}: ${Om(i)}.`)}}ht.assertStruct=Lm;function Pm(t){throw new Error("Invalid branch reached. Should be detected during compilation.")}ht.assertExhaustive=Pm;var es={};Object.defineProperty(es,"__esModule",{value:!0});es.base64=void 0;const Dm=yn,$m=ht,Bm=(t,e={})=>{var r,n;const i=(r=e.paddingRequired)!==null&&r!==void 0?r:!1,s=(n=e.characterSet)!==null&&n!==void 0?n:"base64";let o;s==="base64"?o=String.raw`[A-Za-z0-9+\/]`:((0,$m.assert)(s==="base64url"),o=String.raw`[-_A-Za-z0-9]`);let a;return i?a=new RegExp(`^(?:${o}{4})*(?:${o}{3}=|${o}{2}==)?$`,"u"):a=new RegExp(`^(?:${o}{4})*(?:${o}{2,3}|${o}{3}=|${o}{2}==)?$`,"u"),(0,Dm.pattern)(t,a)};es.base64=Bm;var fe={},ts={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.remove0x=t.add0x=t.assertIsStrictHexString=t.assertIsHexString=t.isStrictHexString=t.isHexString=t.StrictHexStruct=t.HexStruct=void 0;const e=yn,r=ht;t.HexStruct=(0,e.pattern)((0,e.string)(),/^(?:0x)?[0-9a-f]+$/iu),t.StrictHexStruct=(0,e.pattern)((0,e.string)(),/^0x[0-9a-f]+$/iu);function n(l){return(0,e.is)(l,t.HexStruct)}t.isHexString=n;function i(l){return(0,e.is)(l,t.StrictHexStruct)}t.isStrictHexString=i;function s(l){(0,r.assert)(n(l),"Value must be a hexadecimal string.")}t.assertIsHexString=s;function o(l){(0,r.assert)(i(l),'Value must be a hexadecimal string, starting with "0x".')}t.assertIsStrictHexString=o;function a(l){return l.startsWith("0x")?l:l.startsWith("0X")?`0x${l.substring(2)}`:`0x${l}`}t.add0x=a;function c(l){return l.startsWith("0x")||l.startsWith("0X")?l.substring(2):l}t.remove0x=c})(ts);Object.defineProperty(fe,"__esModule",{value:!0});fe.createDataView=fe.concatBytes=fe.valueToBytes=fe.stringToBytes=fe.numberToBytes=fe.signedBigIntToBytes=fe.bigIntToBytes=fe.hexToBytes=fe.bytesToString=fe.bytesToNumber=fe.bytesToSignedBigInt=fe.bytesToBigInt=fe.bytesToHex=fe.assertIsBytes=fe.isBytes=void 0;const Ct=ht,ou=ts,Ol=48,Nl=58,Ll=87;function jm(){const t=[];return()=>{if(t.length===0)for(let e=0;e<256;e++)t.push(e.toString(16).padStart(2,"0"));return t}}const Fm=jm();function Wu(t){return t instanceof Uint8Array}fe.isBytes=Wu;function gi(t){(0,Ct.assert)(Wu(t),"Value must be a Uint8Array.")}fe.assertIsBytes=gi;function dd(t){if(gi(t),t.length===0)return"0x";const e=Fm(),r=new Array(t.length);for(let n=0;n=BigInt(0),"Value must be a non-negative bigint.");const e=t.toString(16);return co(e)}fe.bigIntToBytes=gd;function Um(t,e){(0,Ct.assert)(e>0);const r=t>>BigInt(31);return!((~t&r)+(t&~r)>>BigInt(e*8+-1))}function zm(t,e){(0,Ct.assert)(typeof t=="bigint","Value must be a bigint."),(0,Ct.assert)(typeof e=="number","Byte length must be a number."),(0,Ct.assert)(e>0,"Byte length must be greater than 0."),(0,Ct.assert)(Um(t,e),"Byte length is too small to represent the given value.");let r=t;const n=new Uint8Array(e);for(let i=0;i>=BigInt(8);return n.reverse()}fe.signedBigIntToBytes=zm;function bd(t){(0,Ct.assert)(typeof t=="number","Value must be a number."),(0,Ct.assert)(t>=0,"Value must be a non-negative number."),(0,Ct.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToBytes` instead.");const e=t.toString(16);return co(e)}fe.numberToBytes=bd;function vd(t){return(0,Ct.assert)(typeof t=="string","Value must be a string."),new TextEncoder().encode(t)}fe.stringToBytes=vd;function yd(t){if(typeof t=="bigint")return gd(t);if(typeof t=="number")return bd(t);if(typeof t=="string")return t.startsWith("0x")?co(t):vd(t);if(Wu(t))return t;throw new TypeError(`Unsupported value type: "${typeof t}".`)}fe.valueToBytes=yd;function qm(t){const e=new Array(t.length);let r=0;for(let i=0;ie.call(r,n,i,this))}get(e){return yt(this,jt,"f").get(e)}has(e){return yt(this,jt,"f").has(e)}keys(){return yt(this,jt,"f").keys()}values(){return yt(this,jt,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([e,r])=>`${String(e)} => ${String(r)}`).join(", ")} `:""}}`}}ei.FrozenMap=Hu;class Vu{constructor(e){Qt.set(this,void 0),_d(this,Qt,new Set(e),"f"),Object.freeze(this)}get size(){return yt(this,Qt,"f").size}[(Qt=new WeakMap,Symbol.iterator)](){return yt(this,Qt,"f")[Symbol.iterator]()}entries(){return yt(this,Qt,"f").entries()}forEach(e,r){return yt(this,Qt,"f").forEach((n,i,s)=>e.call(r,n,i,this))}has(e){return yt(this,Qt,"f").has(e)}keys(){return yt(this,Qt,"f").keys()}values(){return yt(this,Qt,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(e=>String(e)).join(", ")} `:""}}`}}ei.FrozenSet=Vu;Object.freeze(Hu);Object.freeze(Hu.prototype);Object.freeze(Vu);Object.freeze(Vu.prototype);var Sd={},Uu={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateNumberSize=t.calculateStringSize=t.isASCII=t.isPlainObject=t.ESCAPE_CHARACTERS_REGEXP=t.JsonSize=t.hasProperty=t.isObject=t.isNullOrUndefined=t.isNonEmptyArray=void 0;function e(l){return Array.isArray(l)&&l.length>0}t.isNonEmptyArray=e;function r(l){return l==null}t.isNullOrUndefined=r;function n(l){return!!l&&typeof l=="object"&&!Array.isArray(l)}t.isObject=n;const i=(l,d)=>Object.hasOwnProperty.call(l,d);t.hasProperty=i,function(l){l[l.Null=4]="Null",l[l.Comma=1]="Comma",l[l.Wrapper=1]="Wrapper",l[l.True=4]="True",l[l.False=5]="False",l[l.Quote=1]="Quote",l[l.Colon=1]="Colon",l[l.Date=24]="Date"}(t.JsonSize||(t.JsonSize={})),t.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function s(l){if(typeof l!="object"||l===null)return!1;try{let d=l;for(;Object.getPrototypeOf(d)!==null;)d=Object.getPrototypeOf(d);return Object.getPrototypeOf(l)===d}catch{return!1}}t.isPlainObject=s;function o(l){return l.charCodeAt(0)<=127}t.isASCII=o;function a(l){var d;return l.split("").reduce((y,C)=>o(C)?y+1:y+2,0)+((d=l.match(t.ESCAPE_CHARACTERS_REGEXP))!==null&&d!==void 0?d:[]).length}t.calculateStringSize=a;function c(l){return l.toString().length}t.calculateNumberSize=c})(Uu);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateJsonAndGetSize=t.getJsonRpcIdValidator=t.assertIsJsonRpcError=t.isJsonRpcError=t.assertIsJsonRpcFailure=t.isJsonRpcFailure=t.assertIsJsonRpcSuccess=t.isJsonRpcSuccess=t.assertIsJsonRpcResponse=t.isJsonRpcResponse=t.assertIsPendingJsonRpcResponse=t.isPendingJsonRpcResponse=t.JsonRpcResponseStruct=t.JsonRpcFailureStruct=t.JsonRpcSuccessStruct=t.PendingJsonRpcResponseStruct=t.assertIsJsonRpcRequest=t.isJsonRpcRequest=t.assertIsJsonRpcNotification=t.isJsonRpcNotification=t.JsonRpcNotificationStruct=t.JsonRpcRequestStruct=t.JsonRpcParamsStruct=t.JsonRpcErrorStruct=t.JsonRpcIdStruct=t.JsonRpcVersionStruct=t.jsonrpc2=t.isValidJson=t.JsonStruct=void 0;const e=yn,r=ht,n=Uu;t.JsonStruct=(0,e.define)("Json",L=>{const[B]=P(L,!0);return B?!0:"Expected a valid JSON-serializable value"});function i(L){return(0,e.is)(L,t.JsonStruct)}t.isValidJson=i,t.jsonrpc2="2.0",t.JsonRpcVersionStruct=(0,e.literal)(t.jsonrpc2),t.JsonRpcIdStruct=(0,e.nullable)((0,e.union)([(0,e.number)(),(0,e.string)()])),t.JsonRpcErrorStruct=(0,e.object)({code:(0,e.integer)(),message:(0,e.string)(),data:(0,e.optional)(t.JsonStruct),stack:(0,e.optional)((0,e.string)())}),t.JsonRpcParamsStruct=(0,e.optional)((0,e.union)([(0,e.record)((0,e.string)(),t.JsonStruct),(0,e.array)(t.JsonStruct)])),t.JsonRpcRequestStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,method:(0,e.string)(),params:t.JsonRpcParamsStruct}),t.JsonRpcNotificationStruct=(0,e.omit)(t.JsonRpcRequestStruct,["id"]);function s(L){return(0,e.is)(L,t.JsonRpcNotificationStruct)}t.isJsonRpcNotification=s;function o(L,B){(0,r.assertStruct)(L,t.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",B)}t.assertIsJsonRpcNotification=o;function a(L){return(0,e.is)(L,t.JsonRpcRequestStruct)}t.isJsonRpcRequest=a;function c(L,B){(0,r.assertStruct)(L,t.JsonRpcRequestStruct,"Invalid JSON-RPC request",B)}t.assertIsJsonRpcRequest=c,t.PendingJsonRpcResponseStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,result:(0,e.optional)((0,e.unknown)()),error:(0,e.optional)(t.JsonRpcErrorStruct)}),t.JsonRpcSuccessStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,result:t.JsonStruct}),t.JsonRpcFailureStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,error:t.JsonRpcErrorStruct}),t.JsonRpcResponseStruct=(0,e.union)([t.JsonRpcSuccessStruct,t.JsonRpcFailureStruct]);function l(L){return(0,e.is)(L,t.PendingJsonRpcResponseStruct)}t.isPendingJsonRpcResponse=l;function d(L,B){(0,r.assertStruct)(L,t.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",B)}t.assertIsPendingJsonRpcResponse=d;function g(L){return(0,e.is)(L,t.JsonRpcResponseStruct)}t.isJsonRpcResponse=g;function y(L,B){(0,r.assertStruct)(L,t.JsonRpcResponseStruct,"Invalid JSON-RPC response",B)}t.assertIsJsonRpcResponse=y;function C(L){return(0,e.is)(L,t.JsonRpcSuccessStruct)}t.isJsonRpcSuccess=C;function A(L,B){(0,r.assertStruct)(L,t.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",B)}t.assertIsJsonRpcSuccess=A;function D(L){return(0,e.is)(L,t.JsonRpcFailureStruct)}t.isJsonRpcFailure=D;function N(L,B){(0,r.assertStruct)(L,t.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",B)}t.assertIsJsonRpcFailure=N;function x(L){return(0,e.is)(L,t.JsonRpcErrorStruct)}t.isJsonRpcError=x;function I(L,B){(0,r.assertStruct)(L,t.JsonRpcErrorStruct,"Invalid JSON-RPC error",B)}t.assertIsJsonRpcError=I;function O(L){const{permitEmptyString:B,permitFractions:G,permitNull:z}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},L);return K=>!!(typeof K=="number"&&(G||Number.isInteger(K))||typeof K=="string"&&(B||K.length>0)||z&&K===null)}t.getJsonRpcIdValidator=O;function P(L,B=!1){const G=new Set;function z(W,K){if(W===void 0)return[!1,0];if(W===null)return[!0,K?0:n.JsonSize.Null];const Y=typeof W;try{if(Y==="function")return[!1,0];if(Y==="string"||W instanceof String)return[!0,K?0:(0,n.calculateStringSize)(W)+n.JsonSize.Quote*2];if(Y==="boolean"||W instanceof Boolean)return K?[!0,0]:[!0,W==!0?n.JsonSize.True:n.JsonSize.False];if(Y==="number"||W instanceof Number)return K?[!0,0]:[!0,(0,n.calculateNumberSize)(W)];if(W instanceof Date)return K?[!0,0]:[!0,isNaN(W.getDate())?n.JsonSize.Null:n.JsonSize.Date+n.JsonSize.Quote*2]}catch{return[!1,0]}if(!(0,n.isPlainObject)(W)&&!Array.isArray(W))return[!1,0];if(G.has(W))return[!1,0];G.add(W);try{return[!0,Object.entries(W).reduce((X,[b,u],h,p)=>{let[v,w]=z(u,K);if(!v)throw new Error("JSON validation did not pass. Validation process stopped.");if(G.delete(W),K)return 0;const M=Array.isArray(W)?0:b.length+n.JsonSize.Comma+n.JsonSize.Colon*2,T=h0)return o(d);if(y==="number"&&isFinite(d))return g.long?c(d):a(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function o(d){if(d=String(d),!(d.length>100)){var g=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(g){var y=parseFloat(g[1]),C=(g[2]||"ms").toLowerCase();switch(C){case"years":case"year":case"yrs":case"yr":case"y":return y*s;case"weeks":case"week":case"w":return y*i;case"days":case"day":case"d":return y*n;case"hours":case"hour":case"hrs":case"hr":case"h":return y*r;case"minutes":case"minute":case"mins":case"min":case"m":return y*e;case"seconds":case"second":case"secs":case"sec":case"s":return y*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return y;default:return}}}}function a(d){var g=Math.abs(d);return g>=n?Math.round(d/n)+"d":g>=r?Math.round(d/r)+"h":g>=e?Math.round(d/e)+"m":g>=t?Math.round(d/t)+"s":d+"ms"}function c(d){var g=Math.abs(d);return g>=n?l(d,g,n,"day"):g>=r?l(d,g,r,"hour"):g>=e?l(d,g,e,"minute"):g>=t?l(d,g,t,"second"):d+" ms"}function l(d,g,y,C){var A=g>=y*1.5;return Math.round(d/y)+" "+C+(A?"s":"")}return Sa}function s1(t){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=i,r.enabled=o,r.humanize=i1(),r.destroy=l,Object.keys(t).forEach(d=>{r[d]=t[d]}),r.names=[],r.skips=[],r.formatters={};function e(d){let g=0;for(let y=0;y{if(B==="%%")return"%";P++;const z=r.formatters[G];if(typeof z=="function"){const W=N[P];B=z.call(x,W),N.splice(P,1),P--}return B}),r.formatArgs.call(x,N),(x.log||r.log).apply(x,N)}return D.namespace=d,D.useColors=r.useColors(),D.color=r.selectColor(d),D.extend=n,D.destroy=r.destroy,Object.defineProperty(D,"enabled",{enumerable:!0,configurable:!1,get:()=>y!==null?y:(C!==r.namespaces&&(C=r.namespaces,A=r.enabled(d)),A),set:N=>{y=N}}),typeof r.init=="function"&&r.init(D),D}function n(d,g){const y=r(this.namespace+(typeof g>"u"?":":g)+d);return y.log=this.log,y}function i(d){r.save(d),r.namespaces=d,r.names=[],r.skips=[];let g;const y=(typeof d=="string"?d:"").split(/[\s,]+/),C=y.length;for(g=0;g"-"+g)].join(",");return r.enable(""),d}function o(d){if(d[d.length-1]==="*")return!0;let g,y;for(g=0,y=r.skips.length;g{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;c.splice(1,0,l,"color: inherit");let d=0,g=0;c[0].replace(/%[a-zA-Z%]/g,y=>{y!=="%%"&&(d++,y==="%c"&&(g=d))}),c.splice(g,0,l)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function s(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c={}.DEBUG),c}function o(){try{return localStorage}catch{}}t.exports=o1(e);const{formatters:a}=t.exports;a.j=function(c){try{return JSON.stringify(c)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}})(au,au.exports);var a1=au.exports,u1=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ti,"__esModule",{value:!0});ti.createModuleLogger=ti.createProjectLogger=void 0;const c1=u1(a1),l1=(0,c1.default)("metamask");function f1(t){return l1.extend(t)}ti.createProjectLogger=f1;function h1(t,e){return t.extend(e)}ti.createModuleLogger=h1;var ir={};Object.defineProperty(ir,"__esModule",{value:!0});ir.hexToBigInt=ir.hexToNumber=ir.bigIntToHex=ir.numberToHex=void 0;const zn=ht,Bi=ts,d1=t=>((0,zn.assert)(typeof t=="number","Value must be a number."),(0,zn.assert)(t>=0,"Value must be a non-negative number."),(0,zn.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,Bi.add0x)(t.toString(16)));ir.numberToHex=d1;const p1=t=>((0,zn.assert)(typeof t=="bigint","Value must be a bigint."),(0,zn.assert)(t>=0,"Value must be a non-negative bigint."),(0,Bi.add0x)(t.toString(16)));ir.bigIntToHex=p1;const g1=t=>{(0,Bi.assertIsHexString)(t);const e=parseInt(t,16);return(0,zn.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `hexToBigInt` instead."),e};ir.hexToNumber=g1;const b1=t=>((0,Bi.assertIsHexString)(t),BigInt((0,Bi.add0x)(t)));ir.hexToBigInt=b1;var Ed={};Object.defineProperty(Ed,"__esModule",{value:!0});var xd={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.timeSince=t.inMilliseconds=t.Duration=void 0,function(s){s[s.Millisecond=1]="Millisecond",s[s.Second=1e3]="Second",s[s.Minute=6e4]="Minute",s[s.Hour=36e5]="Hour",s[s.Day=864e5]="Day",s[s.Week=6048e5]="Week",s[s.Year=31536e6]="Year"}(t.Duration||(t.Duration={}));const e=s=>Number.isInteger(s)&&s>=0,r=(s,o)=>{if(!e(s))throw new Error(`"${o}" must be a non-negative integer. Received: "${s}".`)};function n(s,o){return r(s,"count"),s*o}t.inMilliseconds=n;function i(s){return r(s,"timestamp"),Date.now()-s}t.timeSince=i})(xd);var Md={},uu={exports:{}};const v1="2.0.0",Cd=256,y1=Number.MAX_SAFE_INTEGER||9007199254740991,m1=16,w1=Cd-6,_1=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var ho={MAX_LENGTH:Cd,MAX_SAFE_COMPONENT_LENGTH:m1,MAX_SAFE_BUILD_LENGTH:w1,MAX_SAFE_INTEGER:y1,RELEASE_TYPES:_1,SEMVER_SPEC_VERSION:v1,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const S1=typeof process=="object"&&process.env&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};var po=S1;(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=ho,s=po;e=t.exports={};const o=e.re=[],a=e.safeRe=[],c=e.src=[],l=e.t={};let d=0;const g="[a-zA-Z0-9-]",y=[["\\s",1],["\\d",i],[g,n]],C=D=>{for(const[N,x]of y)D=D.split(`${N}*`).join(`${N}{0,${x}}`).split(`${N}+`).join(`${N}{1,${x}}`);return D},A=(D,N,x)=>{const I=C(N),O=d++;s(D,O,N),l[D]=O,c[O]=N,o[O]=new RegExp(N,x?"g":void 0),a[O]=new RegExp(I,x?"g":void 0)};A("NUMERICIDENTIFIER","0|[1-9]\\d*"),A("NUMERICIDENTIFIERLOOSE","\\d+"),A("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${g}*`),A("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),A("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),A("PRERELEASEIDENTIFIER",`(?:${c[l.NUMERICIDENTIFIER]}|${c[l.NONNUMERICIDENTIFIER]})`),A("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NUMERICIDENTIFIERLOOSE]}|${c[l.NONNUMERICIDENTIFIER]})`),A("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),A("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),A("BUILDIDENTIFIER",`${g}+`),A("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),A("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),A("FULL",`^${c[l.FULLPLAIN]}$`),A("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),A("LOOSE",`^${c[l.LOOSEPLAIN]}$`),A("GTLT","((?:<|>)?=?)"),A("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),A("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),A("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),A("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),A("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),A("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),A("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),A("COERCERTL",c[l.COERCE],!0),A("LONETILDE","(?:~>?)"),A("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",A("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),A("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),A("LONECARET","(?:\\^)"),A("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",A("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),A("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),A("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),A("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),A("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",A("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),A("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),A("STAR","(<|>)?=?\\s*\\*"),A("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),A("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(uu,uu.exports);var rs=uu.exports;const E1=Object.freeze({loose:!0}),x1=Object.freeze({}),M1=t=>t?typeof t!="object"?E1:t:x1;var zu=M1;const $l=/^[0-9]+$/,Rd=(t,e)=>{const r=$l.test(t),n=$l.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:tRd(e,t);var Id={compareIdentifiers:Rd,rcompareIdentifiers:C1};const ms=po,{MAX_LENGTH:Bl,MAX_SAFE_INTEGER:ws}=ho,{safeRe:jl,t:Fl}=rs,R1=zu,{compareIdentifiers:Nn}=Id;let I1=class Kt{constructor(e,r){if(r=R1(r),e instanceof Kt){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Bl)throw new TypeError(`version is longer than ${Bl} characters`);ms("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=e.trim().match(r.loose?jl[Fl.LOOSE]:jl[Fl.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>ws||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ws||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ws||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),Nn(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var _t=I1;const Wl=_t,A1=(t,e,r=!1)=>{if(t instanceof Wl)return t;try{return new Wl(t,e)}catch(n){if(!r)return null;throw n}};var bi=A1;const T1=bi,k1=(t,e)=>{const r=T1(t,e);return r?r.version:null};var O1=k1;const N1=bi,L1=(t,e)=>{const r=N1(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};var P1=L1;const Hl=_t,D1=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new Hl(t instanceof Hl?t.version:t,r).inc(e,n,i).version}catch{return null}};var $1=D1;const Vl=bi,B1=(t,e)=>{const r=Vl(t,null,!0),n=Vl(e,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,o=s?r:n,a=s?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c)return!a.patch&&!a.minor?"major":o.patch?"patch":o.minor?"minor":"major";const d=c?"pre":"";return r.major!==n.major?d+"major":r.minor!==n.minor?d+"minor":r.patch!==n.patch?d+"patch":"prerelease"};var j1=B1;const F1=_t,W1=(t,e)=>new F1(t,e).major;var H1=W1;const V1=_t,U1=(t,e)=>new V1(t,e).minor;var z1=U1;const q1=_t,G1=(t,e)=>new q1(t,e).patch;var J1=G1;const Z1=bi,Q1=(t,e)=>{const r=Z1(t,e);return r&&r.prerelease.length?r.prerelease:null};var Y1=Q1;const Ul=_t,K1=(t,e,r)=>new Ul(t,r).compare(new Ul(e,r));var qt=K1;const X1=qt,ew=(t,e,r)=>X1(e,t,r);var tw=ew;const rw=qt,nw=(t,e)=>rw(t,e,!0);var iw=nw;const zl=_t,sw=(t,e,r)=>{const n=new zl(t,r),i=new zl(e,r);return n.compare(i)||n.compareBuild(i)};var qu=sw;const ow=qu,aw=(t,e)=>t.sort((r,n)=>ow(r,n,e));var uw=aw;const cw=qu,lw=(t,e)=>t.sort((r,n)=>cw(n,r,e));var fw=lw;const hw=qt,dw=(t,e,r)=>hw(t,e,r)>0;var go=dw;const pw=qt,gw=(t,e,r)=>pw(t,e,r)<0;var Gu=gw;const bw=qt,vw=(t,e,r)=>bw(t,e,r)===0;var Ad=vw;const yw=qt,mw=(t,e,r)=>yw(t,e,r)!==0;var Td=mw;const ww=qt,_w=(t,e,r)=>ww(t,e,r)>=0;var Ju=_w;const Sw=qt,Ew=(t,e,r)=>Sw(t,e,r)<=0;var Zu=Ew;const xw=Ad,Mw=Td,Cw=go,Rw=Ju,Iw=Gu,Aw=Zu,Tw=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return xw(t,r,n);case"!=":return Mw(t,r,n);case">":return Cw(t,r,n);case">=":return Rw(t,r,n);case"<":return Iw(t,r,n);case"<=":return Aw(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};var kd=Tw;const kw=_t,Ow=bi,{safeRe:_s,t:Ss}=rs,Nw=(t,e)=>{if(t instanceof kw)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(_s[Ss.COERCE]);else{let n;for(;(n=_s[Ss.COERCERTL].exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||n.index+n[0].length!==r.index+r[0].length)&&(r=n),_s[Ss.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;_s[Ss.COERCERTL].lastIndex=-1}return r===null?null:Ow(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,e)};var Lw=Nw,Ea,ql;function Pw(){return ql||(ql=1,Ea=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),Ea}var Dw=he;he.Node=an;he.create=he;function he(t){var e=this;if(e instanceof he||(e=new he),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(i){e.push(i)});else if(arguments.length>0)for(var r=0,n=arguments.length;r1)r=e;else if(this.head)n=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var i=0;n!==null;i++)r=t(r,n.value,i),n=n.next;return r};he.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else if(this.tail)n=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var i=this.length-1;n!==null;i--)r=t(r,n.value,i),n=n.prev;return r};he.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;r!==null;e++)t[e]=r.value,r=r.next;return t};he.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;r!==null;e++)t[e]=r.value,r=r.prev;return t};he.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new he;if(ethis.length&&(e=this.length);for(var n=0,i=this.head;i!==null&&nthis.length&&(e=this.length);for(var n=this.length,i=this.tail;i!==null&&n>e;n--)i=i.prev;for(;i!==null&&n>t;n--,i=i.prev)r.push(i.value);return r};he.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,i=this.head;i!==null&&n1;class Ww{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");this[Kr]=e.max||1/0;const r=e.length||xa;if(this[Ln]=typeof r!="function"?xa:r,this[Ni]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[tn]=e.maxAge||0,this[cr]=e.dispose,this[Gl]=e.noDisposeOnSet||!1,this[Od]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[Kr]=e||1/0,Ei(this)}get max(){return this[Kr]}set allowStale(e){this[Ni]=!!e}get allowStale(){return this[Ni]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[tn]=e,Ei(this)}get maxAge(){return this[tn]}set lengthCalculator(e){typeof e!="function"&&(e=xa),e!==this[Ln]&&(this[Ln]=e,this[hr]=0,this[ot].forEach(r=>{r.length=this[Ln](r.value,r.key),this[hr]+=r.length})),Ei(this)}get lengthCalculator(){return this[Ln]}get length(){return this[hr]}get itemCount(){return this[ot].length}rforEach(e,r){r=r||this;for(let n=this[ot].tail;n!==null;){const i=n.prev;Jl(this,e,n,r),n=i}}forEach(e,r){r=r||this;for(let n=this[ot].head;n!==null;){const i=n.next;Jl(this,e,n,r),n=i}}keys(){return this[ot].toArray().map(e=>e.key)}values(){return this[ot].toArray().map(e=>e.value)}reset(){this[cr]&&this[ot]&&this[ot].length&&this[ot].forEach(e=>this[cr](e.key,e.value)),this[Ht]=new Map,this[ot]=new Fw,this[hr]=0}dump(){return this[ot].map(e=>Fs(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[ot]}set(e,r,n){if(n=n||this[tn],n&&typeof n!="number")throw new TypeError("maxAge must be a number");const i=n?Date.now():0,s=this[Ln](r,e);if(this[Ht].has(e)){if(s>this[Kr])return qn(this,this[Ht].get(e)),!1;const c=this[Ht].get(e).value;return this[cr]&&(this[Gl]||this[cr](e,c.value)),c.now=i,c.maxAge=n,c.value=r,this[hr]+=s-c.length,c.length=s,this.get(e),Ei(this),!0}const o=new Hw(e,r,s,i,n);return o.length>this[Kr]?(this[cr]&&this[cr](e,r),!1):(this[hr]+=o.length,this[ot].unshift(o),this[Ht].set(e,this[ot].head),Ei(this),!0)}has(e){if(!this[Ht].has(e))return!1;const r=this[Ht].get(e).value;return!Fs(this,r)}get(e){return Ma(this,e,!0)}peek(e){return Ma(this,e,!1)}pop(){const e=this[ot].tail;return e?(qn(this,e),e.value):null}del(e){qn(this,this[Ht].get(e))}load(e){this.reset();const r=Date.now();for(let n=e.length-1;n>=0;n--){const i=e[n],s=i.e||0;if(s===0)this.set(i.k,i.v);else{const o=s-r;o>0&&this.set(i.k,i.v,o)}}}prune(){this[Ht].forEach((e,r)=>Ma(this,r,!1))}}const Ma=(t,e,r)=>{const n=t[Ht].get(e);if(n){const i=n.value;if(Fs(t,i)){if(qn(t,n),!t[Ni])return}else r&&(t[Od]&&(n.value.now=Date.now()),t[ot].unshiftNode(n));return i.value}},Fs=(t,e)=>{if(!e||!e.maxAge&&!t[tn])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[tn]&&r>t[tn]},Ei=t=>{if(t[hr]>t[Kr])for(let e=t[ot].tail;t[hr]>t[Kr]&&e!==null;){const r=e.prev;qn(t,e),e=r}},qn=(t,e)=>{if(e){const r=e.value;t[cr]&&t[cr](r.key,r.value),t[hr]-=r.length,t[Ht].delete(r.key),t[ot].removeNode(e)}};class Hw{constructor(e,r,n,i,s){this.key=e,this.value=r,this.length=n,this.now=i,this.maxAge=s||0}}const Jl=(t,e,r,n)=>{let i=r.value;Fs(t,i)&&(qn(t,r),t[Ni]||(i=void 0)),i&&e.call(n,i.value,i.key,t)};var Vw=Ww,Ca,Zl;function Gt(){if(Zl)return Ca;Zl=1;class t{constructor(u,h){if(h=n(h),u instanceof t)return u.loose===!!h.loose&&u.includePrerelease===!!h.includePrerelease?u:new t(u.raw,h);if(u instanceof i)return this.raw=u.value,this.set=[[u]],this.format(),this;if(this.options=h,this.loose=!!h.loose,this.includePrerelease=!!h.includePrerelease,this.raw=u.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(p=>this.parseRange(p.trim())).filter(p=>p.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const p=this.set[0];if(this.set=this.set.filter(v=>!A(v[0])),this.set.length===0)this.set=[p];else if(this.set.length>1){for(const v of this.set)if(v.length===1&&D(v[0])){this.set=[v];break}}}this.format()}format(){return this.range=this.set.map(u=>u.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(u){const p=((this.options.includePrerelease&&y)|(this.options.loose&&C))+":"+u,v=r.get(p);if(v)return v;const w=this.options.loose,M=w?a[c.HYPHENRANGELOOSE]:a[c.HYPHENRANGE];u=u.replace(M,Y(this.options.includePrerelease)),s("hyphen replace",u),u=u.replace(a[c.COMPARATORTRIM],l),s("comparator trim",u),u=u.replace(a[c.TILDETRIM],d),s("tilde trim",u),u=u.replace(a[c.CARETTRIM],g),s("caret trim",u);let T=u.split(" ").map(U=>x(U,this.options)).join(" ").split(/\s+/).map(U=>K(U,this.options));w&&(T=T.filter(U=>(s("loose invalid filter",U,this.options),!!U.match(a[c.COMPARATORLOOSE])))),s("range list",T);const m=new Map,f=T.map(U=>new i(U,this.options));for(const U of f){if(A(U))return[U];m.set(U.value,U)}m.size>1&&m.has("")&&m.delete("");const E=[...m.values()];return r.set(p,E),E}intersects(u,h){if(!(u instanceof t))throw new TypeError("a Range is required");return this.set.some(p=>N(p,h)&&u.set.some(v=>N(v,h)&&p.every(w=>v.every(M=>w.intersects(M,h)))))}test(u){if(!u)return!1;if(typeof u=="string")try{u=new o(u,this.options)}catch{return!1}for(let h=0;hb.value==="<0.0.0-0",D=b=>b.value==="",N=(b,u)=>{let h=!0;const p=b.slice();let v=p.pop();for(;h&&p.length;)h=p.every(w=>v.intersects(w,u)),v=p.pop();return h},x=(b,u)=>(s("comp",b,u),b=L(b,u),s("caret",b),b=O(b,u),s("tildes",b),b=G(b,u),s("xrange",b),b=W(b,u),s("stars",b),b),I=b=>!b||b.toLowerCase()==="x"||b==="*",O=(b,u)=>b.trim().split(/\s+/).map(h=>P(h,u)).join(" "),P=(b,u)=>{const h=u.loose?a[c.TILDELOOSE]:a[c.TILDE];return b.replace(h,(p,v,w,M,T)=>{s("tilde",b,p,v,w,M,T);let m;return I(v)?m="":I(w)?m=`>=${v}.0.0 <${+v+1}.0.0-0`:I(M)?m=`>=${v}.${w}.0 <${v}.${+w+1}.0-0`:T?(s("replaceTilde pr",T),m=`>=${v}.${w}.${M}-${T} <${v}.${+w+1}.0-0`):m=`>=${v}.${w}.${M} <${v}.${+w+1}.0-0`,s("tilde return",m),m})},L=(b,u)=>b.trim().split(/\s+/).map(h=>B(h,u)).join(" "),B=(b,u)=>{s("caret",b,u);const h=u.loose?a[c.CARETLOOSE]:a[c.CARET],p=u.includePrerelease?"-0":"";return b.replace(h,(v,w,M,T,m)=>{s("caret",b,v,w,M,T,m);let f;return I(w)?f="":I(M)?f=`>=${w}.0.0${p} <${+w+1}.0.0-0`:I(T)?w==="0"?f=`>=${w}.${M}.0${p} <${w}.${+M+1}.0-0`:f=`>=${w}.${M}.0${p} <${+w+1}.0.0-0`:m?(s("replaceCaret pr",m),w==="0"?M==="0"?f=`>=${w}.${M}.${T}-${m} <${w}.${M}.${+T+1}-0`:f=`>=${w}.${M}.${T}-${m} <${w}.${+M+1}.0-0`:f=`>=${w}.${M}.${T}-${m} <${+w+1}.0.0-0`):(s("no pr"),w==="0"?M==="0"?f=`>=${w}.${M}.${T}${p} <${w}.${M}.${+T+1}-0`:f=`>=${w}.${M}.${T}${p} <${w}.${+M+1}.0-0`:f=`>=${w}.${M}.${T} <${+w+1}.0.0-0`),s("caret return",f),f})},G=(b,u)=>(s("replaceXRanges",b,u),b.split(/\s+/).map(h=>z(h,u)).join(" ")),z=(b,u)=>{b=b.trim();const h=u.loose?a[c.XRANGELOOSE]:a[c.XRANGE];return b.replace(h,(p,v,w,M,T,m)=>{s("xRange",b,p,v,w,M,T,m);const f=I(w),E=f||I(M),U=E||I(T),q=U;return v==="="&&q&&(v=""),m=u.includePrerelease?"-0":"",f?v===">"||v==="<"?p="<0.0.0-0":p="*":v&&q?(E&&(M=0),T=0,v===">"?(v=">=",E?(w=+w+1,M=0,T=0):(M=+M+1,T=0)):v==="<="&&(v="<",E?w=+w+1:M=+M+1),v==="<"&&(m="-0"),p=`${v+w}.${M}.${T}${m}`):E?p=`>=${w}.0.0${m} <${+w+1}.0.0-0`:U&&(p=`>=${w}.${M}.0${m} <${w}.${+M+1}.0-0`),s("xRange return",p),p})},W=(b,u)=>(s("replaceStars",b,u),b.trim().replace(a[c.STAR],"")),K=(b,u)=>(s("replaceGTE0",b,u),b.trim().replace(a[u.includePrerelease?c.GTE0PRE:c.GTE0],"")),Y=b=>(u,h,p,v,w,M,T,m,f,E,U,q,R)=>(I(p)?h="":I(v)?h=`>=${p}.0.0${b?"-0":""}`:I(w)?h=`>=${p}.${v}.0${b?"-0":""}`:M?h=`>=${h}`:h=`>=${h}${b?"-0":""}`,I(f)?m="":I(E)?m=`<${+f+1}.0.0-0`:I(U)?m=`<${f}.${+E+1}.0-0`:q?m=`<=${f}.${E}.${U}-${q}`:b?m=`<${f}.${E}.${+U+1}-0`:m=`<=${m}`,`${h} ${m}`.trim()),X=(b,u,h)=>{for(let p=0;p0){const v=b[p].semver;if(v.major===u.major&&v.minor===u.minor&&v.patch===u.patch)return!0}return!1}return!0};return Ca}var Ra,Ql;function bo(){if(Ql)return Ra;Ql=1;const t=Symbol("SemVer ANY");class e{static get ANY(){return t}constructor(d,g){if(g=r(g),d instanceof e){if(d.loose===!!g.loose)return d;d=d.value}d=d.trim().split(/\s+/).join(" "),o("comparator",d,g),this.options=g,this.loose=!!g.loose,this.parse(d),this.semver===t?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(d){const g=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],y=d.match(g);if(!y)throw new TypeError(`Invalid comparator: ${d}`);this.operator=y[1]!==void 0?y[1]:"",this.operator==="="&&(this.operator=""),y[2]?this.semver=new a(y[2],this.options.loose):this.semver=t}toString(){return this.value}test(d){if(o("Comparator.test",d,this.options.loose),this.semver===t||d===t)return!0;if(typeof d=="string")try{d=new a(d,this.options)}catch{return!1}return s(d,this.operator,this.semver,this.options)}intersects(d,g){if(!(d instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(d.value,g).test(this.value):d.operator===""?d.value===""?!0:new c(this.value,g).test(d.semver):(g=r(g),g.includePrerelease&&(this.value==="<0.0.0-0"||d.value==="<0.0.0-0")||!g.includePrerelease&&(this.value.startsWith("<0.0.0")||d.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&d.operator.startsWith(">")||this.operator.startsWith("<")&&d.operator.startsWith("<")||this.semver.version===d.semver.version&&this.operator.includes("=")&&d.operator.includes("=")||s(this.semver,"<",d.semver,g)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||s(this.semver,">",d.semver,g)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}Ra=e;const r=zu,{safeRe:n,t:i}=rs,s=kd,o=po,a=_t,c=Gt();return Ra}const Uw=Gt(),zw=(t,e,r)=>{try{e=new Uw(e,r)}catch{return!1}return e.test(t)};var vo=zw;const qw=Gt(),Gw=(t,e)=>new qw(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var Jw=Gw;const Zw=_t,Qw=Gt(),Yw=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Qw(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Zw(n,r))}),n};var Kw=Yw;const Xw=_t,e_=Gt(),t_=(t,e,r)=>{let n=null,i=null,s=null;try{s=new e_(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new Xw(n,r))}),n};var r_=t_;const Ia=_t,n_=Gt(),Yl=go,i_=(t,e)=>{t=new n_(t,e);let r=new Ia("0.0.0");if(t.test(r)||(r=new Ia("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{const a=new Ia(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Yl(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||Yl(r,s))&&(r=s)}return r&&t.test(r)?r:null};var s_=i_;const o_=Gt(),a_=(t,e)=>{try{return new o_(t,e).range||"*"}catch{return null}};var u_=a_;const c_=_t,Nd=bo(),{ANY:l_}=Nd,f_=Gt(),h_=vo,Kl=go,Xl=Gu,d_=Zu,p_=Ju,g_=(t,e,r,n)=>{t=new c_(t,n),e=new f_(e,n);let i,s,o,a,c;switch(r){case">":i=Kl,s=d_,o=Xl,a=">",c=">=";break;case"<":i=Xl,s=p_,o=Kl,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(h_(t,e,n))return!1;for(let l=0;l{C.semver===l_&&(C=new Nd(">=0.0.0")),g=g||C,y=y||C,i(C.semver,g.semver,n)?g=C:o(C.semver,y.semver,n)&&(y=C)}),g.operator===a||g.operator===c||(!y.operator||y.operator===a)&&s(t,y.semver))return!1;if(y.operator===c&&o(t,y.semver))return!1}return!0};var Qu=g_;const b_=Qu,v_=(t,e,r)=>b_(t,e,">",r);var y_=v_;const m_=Qu,w_=(t,e,r)=>m_(t,e,"<",r);var __=w_;const ef=Gt(),S_=(t,e,r)=>(t=new ef(t,r),e=new ef(e,r),t.intersects(e,r));var E_=S_;const x_=vo,M_=qt;var C_=(t,e,r)=>{const n=[];let i=null,s=null;const o=t.sort((d,g)=>M_(d,g,r));for(const d of o)x_(d,e,r)?(s=d,i||(i=d)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const a=[];for(const[d,g]of n)d===g?a.push(d):!g&&d===o[0]?a.push("*"):g?d===o[0]?a.push(`<=${g}`):a.push(`${d} - ${g}`):a.push(`>=${d}`);const c=a.join(" || "),l=typeof e.raw=="string"?e.raw:String(e);return c.length{if(t===e)return!0;t=new tf(t,r),e=new tf(e,r);let n=!1;e:for(const i of t.set){for(const s of e.set){const o=A_(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},I_=[new Yu(">=0.0.0-0")],rf=[new Yu(">=0.0.0")],A_=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Aa){if(e.length===1&&e[0].semver===Aa)return!0;r.includePrerelease?t=I_:t=rf}if(e.length===1&&e[0].semver===Aa){if(r.includePrerelease)return!0;e=rf}const n=new Set;let i,s;for(const C of t)C.operator===">"||C.operator===">="?i=nf(i,C,r):C.operator==="<"||C.operator==="<="?s=sf(s,C,r):n.add(C.semver);if(n.size>1)return null;let o;if(i&&s){if(o=Ku(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const C of n){if(i&&!xi(C,String(i),r)||s&&!xi(C,String(s),r))return null;for(const A of e)if(!xi(C,String(A),r))return!1;return!0}let a,c,l,d,g=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,y=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;g&&g.prerelease.length===1&&s.operator==="<"&&g.prerelease[0]===0&&(g=!1);for(const C of e){if(d=d||C.operator===">"||C.operator===">=",l=l||C.operator==="<"||C.operator==="<=",i){if(y&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===y.major&&C.semver.minor===y.minor&&C.semver.patch===y.patch&&(y=!1),C.operator===">"||C.operator===">="){if(a=nf(i,C,r),a===C&&a!==i)return!1}else if(i.operator===">="&&!xi(i.semver,String(C),r))return!1}if(s){if(g&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===g.major&&C.semver.minor===g.minor&&C.semver.patch===g.patch&&(g=!1),C.operator==="<"||C.operator==="<="){if(c=sf(s,C,r),c===C&&c!==s)return!1}else if(s.operator==="<="&&!xi(s.semver,String(C),r))return!1}if(!C.operator&&(s||i)&&o!==0)return!1}return!(i&&l&&!s&&o!==0||s&&d&&!i&&o!==0||y||g)},nf=(t,e,r)=>{if(!t)return e;const n=Ku(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},sf=(t,e,r)=>{if(!t)return e;const n=Ku(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};var T_=R_;const Ta=rs,of=ho,k_=_t,af=Id,O_=bi,N_=O1,L_=P1,P_=$1,D_=j1,$_=H1,B_=z1,j_=J1,F_=Y1,W_=qt,H_=tw,V_=iw,U_=qu,z_=uw,q_=fw,G_=go,J_=Gu,Z_=Ad,Q_=Td,Y_=Ju,K_=Zu,X_=kd,e2=Lw,t2=bo(),r2=Gt(),n2=vo,i2=Jw,s2=Kw,o2=r_,a2=s_,u2=u_,c2=Qu,l2=y_,f2=__,h2=E_,d2=C_,p2=T_;var g2={parse:O_,valid:N_,clean:L_,inc:P_,diff:D_,major:$_,minor:B_,patch:j_,prerelease:F_,compare:W_,rcompare:H_,compareLoose:V_,compareBuild:U_,sort:z_,rsort:q_,gt:G_,lt:J_,eq:Z_,neq:Q_,gte:Y_,lte:K_,cmp:X_,coerce:e2,Comparator:t2,Range:r2,satisfies:n2,toComparators:i2,maxSatisfying:s2,minSatisfying:o2,minVersion:a2,validRange:u2,outside:c2,gtr:l2,ltr:f2,intersects:h2,simplifyRange:d2,subset:p2,SemVer:k_,re:Ta.re,src:Ta.src,tokens:Ta.t,SEMVER_SPEC_VERSION:of.SEMVER_SPEC_VERSION,RELEASE_TYPES:of.RELEASE_TYPES,compareIdentifiers:af.compareIdentifiers,rcompareIdentifiers:af.rcompareIdentifiers};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.satisfiesVersionRange=t.gtRange=t.gtVersion=t.assertIsSemVerRange=t.assertIsSemVerVersion=t.isValidSemVerRange=t.isValidSemVerVersion=t.VersionRangeStruct=t.VersionStruct=void 0;const e=g2,r=yn,n=ht;t.VersionStruct=(0,r.refine)((0,r.string)(),"Version",g=>(0,e.valid)(g)===null?`Expected SemVer version, got "${g}"`:!0),t.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",g=>(0,e.validRange)(g)===null?`Expected SemVer range, got "${g}"`:!0);function i(g){return(0,r.is)(g,t.VersionStruct)}t.isValidSemVerVersion=i;function s(g){return(0,r.is)(g,t.VersionRangeStruct)}t.isValidSemVerRange=s;function o(g){(0,n.assertStruct)(g,t.VersionStruct)}t.assertIsSemVerVersion=o;function a(g){(0,n.assertStruct)(g,t.VersionRangeStruct)}t.assertIsSemVerRange=a;function c(g,y){return(0,e.gt)(g,y)}t.gtVersion=c;function l(g,y){return(0,e.gtr)(g,y)}t.gtRange=l;function d(g,y){return(0,e.satisfies)(g,y,{includePrerelease:!0})}t.satisfiesVersionRange=d})(Md);(function(t){var e=Z&&Z.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=Z&&Z.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),r(ht,t),r(es,t),r(fe,t),r(lo,t),r(nr,t),r(ei,t),r(ts,t),r(Sd,t),r(ti,t),r(Uu,t),r(ir,t),r(Ed,t),r(xd,t),r(Md,t)})(nd);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createModuleLogger=t.projectLogger=void 0;const e=nd;Object.defineProperty(t,"createModuleLogger",{enumerable:!0,get:function(){return e.createModuleLogger}}),t.projectLogger=(0,e.createProjectLogger)("eth-block-tracker")})(rd);var Ld=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(uo,"__esModule",{value:!0});uo.PollingBlockTracker=void 0;const b2=Ld(Lu),v2=Ld(By),y2=Ki,uf=rd,cf=(0,uf.createModuleLogger)(uf.projectLogger,"polling-block-tracker"),m2=(0,b2.default)(),w2=1e3;class _2 extends y2.BaseBlockTracker{constructor(e={}){var r;if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");super({blockResetDuration:(r=e.blockResetDuration)!==null&&r!==void 0?r:e.pollingInterval}),this._provider=e.provider,this._pollingInterval=e.pollingInterval||20*w2,this._retryTimeout=e.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=e.keepEventLoopActive===void 0?!0:e.keepEventLoopActive,this._setSkipCacheFlag=e.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var e;this._isRunning;)try{await this._updateLatestBlock();const r=lf(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await r}catch(r){const n=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block: diff --git a/examples/vite/dist/assets/index.es-8f50e71b.js b/examples/vite/dist/assets/index.es-deb3bc81.js similarity index 99% rename from examples/vite/dist/assets/index.es-8f50e71b.js rename to examples/vite/dist/assets/index.es-deb3bc81.js index 471bcb82d6..e1e528ba17 100644 --- a/examples/vite/dist/assets/index.es-8f50e71b.js +++ b/examples/vite/dist/assets/index.es-deb3bc81.js @@ -1,4 +1,4 @@ -import{e as Ec,f as ie,h as Zv,w as Dl,r as Ll,i as Ic,t as ga,j as em,k as tm,m as _i,D as rm,o as im,N as X,p as nm,q as cc,s as sm,V as am,R as om,F as Fh,K as cm,x as um,L as hm,u as Dh,$ as lm,v as fm,y as Bn,Z as Lh,J as pm,X as dm,_ as ql,z as Fr,A as gm,B as ym,C as hn,E as $t,U as tr,G as wi,H as hr,I as vm,M as ln,O as jl,P as mm,Q as wm,S as _m,T as zl,W as bm,Y as Ml,a0 as Ul,a1 as fn,a2 as uc,a3 as oa,a4 as pn,a5 as Em,a6 as ca,a7 as Im,a8 as xm,a9 as Sm,aa as ta,ab as Pm,ac as Om,ad as Bo,ae as qh,af as Cm,ag as Am,ah as Tm,ai as jh,aj as Rm,ak as Nm,al as $m,am as Fm,an as Dm,ao as Lm,ap as qm,aq as Un,ar as Hl,as as Vo,at as jm,au as zm,av as Mm}from"./index-51fb98b3.js";import{e as kr,E as xc}from"./events-372f436e.js";import{s as Wn,a as ya,i as zh,c as Um,b as Hm,f as Sc,p as km,J as si,d as Pc,e as Oc,g as Cc,h as mi,j as ni,k as Kn,l as Km,m as Bm,H as Ii}from"./http-dcace0d6.js";import"@safe-globalThis/safe-apps-provider";import"@safe-globalThis/safe-apps-sdk";const Vm=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Gm=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Wm=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Jm(o,i){if(o==="__proto__"||o==="constructor"&&i&&typeof i=="object"&&"prototype"in i){Qm(o);return}return i}function Qm(o){console.warn(`[destr] Dropping "${o}" key to prevent prototype pollution.`)}function ra(o,i={}){if(typeof o!="string")return o;const t=o.trim();if(o[0]==='"'&&o.at(-1)==='"'&&!o.includes("\\"))return t.slice(1,-1);if(t.length<=9){const n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!Wm.test(o)){if(i.strict)throw new SyntaxError("[destr] Invalid JSON");return o}try{if(Vm.test(o)||Gm.test(o)){if(i.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(o,Jm)}return JSON.parse(o)}catch(n){if(i.strict)throw n;return o}}function Ym(o){return!o||typeof o.then!="function"?Promise.resolve(o):o}function Mt(o,...i){try{return Ym(o(...i))}catch(t){return Promise.reject(t)}}function Xm(o){const i=typeof o;return o===null||i!=="object"&&i!=="function"}function Zm(o){const i=Object.getPrototypeOf(o);return!i||i.isPrototypeOf(Object)}function ua(o){if(Xm(o))return String(o);if(Zm(o)||Array.isArray(o))return JSON.stringify(o);if(typeof o.toJSON=="function")return ua(o.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function kl(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const hc="base64:";function e1(o){if(typeof o=="string")return o;kl();const i=Buffer.from(o).toString("base64");return hc+i}function t1(o){return typeof o!="string"||!o.startsWith(hc)?o:(kl(),Buffer.from(o.slice(hc.length),"base64"))}function ur(o){return o?o.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function r1(...o){return ur(o.join(":"))}function ia(o){return o=ur(o),o?o+":":""}const i1="memory",n1=()=>{const o=new Map;return{name:i1,options:{},hasItem(i){return o.has(i)},getItem(i){return o.get(i)??null},getItemRaw(i){return o.get(i)??null},setItem(i,t){o.set(i,t)},setItemRaw(i,t){o.set(i,t)},removeItem(i){o.delete(i)},getKeys(){return Array.from(o.keys())},clear(){o.clear()},dispose(){o.clear()}}};function s1(o={}){const i={mounts:{"":o.driver||n1()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=d=>{for(const _ of i.mountpoints)if(d.startsWith(_))return{base:_,relativeKey:d.slice(_.length),driver:i.mounts[_]};return{base:"",relativeKey:d,driver:i.mounts[""]}},n=(d,_)=>i.mountpoints.filter(O=>O.startsWith(d)||_&&d.startsWith(O)).map(O=>({relativeBase:d.length>O.length?d.slice(O.length):void 0,mountpoint:O,driver:i.mounts[O]})),a=(d,_)=>{if(i.watching){_=ur(_);for(const O of i.watchListeners)O(d,_)}},u=async()=>{if(!i.watching){i.watching=!0;for(const d in i.mounts)i.unwatch[d]=await Mh(i.mounts[d],a,d)}},f=async()=>{if(i.watching){for(const d in i.unwatch)await i.unwatch[d]();i.unwatch={},i.watching=!1}},y=(d,_,O)=>{const P=new Map,L=N=>{let K=P.get(N.base);return K||(K={driver:N.driver,base:N.base,items:[]},P.set(N.base,K)),K};for(const N of d){const K=typeof N=="string",re=ur(K?N:N.key),ce=K?void 0:N.value,ue=K||!N.options?_:{..._,...N.options},he=t(re);L(he).items.push({key:re,value:ce,relativeKey:he.relativeKey,options:ue})}return Promise.all([...P.values()].map(N=>O(N))).then(N=>N.flat())},w={hasItem(d,_={}){d=ur(d);const{relativeKey:O,driver:P}=t(d);return Mt(P.hasItem,O,_)},getItem(d,_={}){d=ur(d);const{relativeKey:O,driver:P}=t(d);return Mt(P.getItem,O,_).then(L=>ra(L))},getItems(d,_){return y(d,_,O=>O.driver.getItems?Mt(O.driver.getItems,O.items.map(P=>({key:P.relativeKey,options:P.options})),_).then(P=>P.map(L=>({key:r1(O.base,L.key),value:ra(L.value)}))):Promise.all(O.items.map(P=>Mt(O.driver.getItem,P.relativeKey,P.options).then(L=>({key:P.key,value:ra(L)})))))},getItemRaw(d,_={}){d=ur(d);const{relativeKey:O,driver:P}=t(d);return P.getItemRaw?Mt(P.getItemRaw,O,_):Mt(P.getItem,O,_).then(L=>t1(L))},async setItem(d,_,O={}){if(_===void 0)return w.removeItem(d);d=ur(d);const{relativeKey:P,driver:L}=t(d);L.setItem&&(await Mt(L.setItem,P,ua(_),O),L.watch||a("update",d))},async setItems(d,_){await y(d,_,async O=>{O.driver.setItems&&await Mt(O.driver.setItems,O.items.map(P=>({key:P.relativeKey,value:ua(P.value),options:P.options})),_),O.driver.setItem&&await Promise.all(O.items.map(P=>Mt(O.driver.setItem,P.relativeKey,ua(P.value),P.options)))})},async setItemRaw(d,_,O={}){if(_===void 0)return w.removeItem(d,O);d=ur(d);const{relativeKey:P,driver:L}=t(d);if(L.setItemRaw)await Mt(L.setItemRaw,P,_,O);else if(L.setItem)await Mt(L.setItem,P,e1(_),O);else return;L.watch||a("update",d)},async removeItem(d,_={}){typeof _=="boolean"&&(_={removeMeta:_}),d=ur(d);const{relativeKey:O,driver:P}=t(d);P.removeItem&&(await Mt(P.removeItem,O,_),(_.removeMeta||_.removeMata)&&await Mt(P.removeItem,O+"$",_),P.watch||a("remove",d))},async getMeta(d,_={}){typeof _=="boolean"&&(_={nativeOnly:_}),d=ur(d);const{relativeKey:O,driver:P}=t(d),L=Object.create(null);if(P.getMeta&&Object.assign(L,await Mt(P.getMeta,O,_)),!_.nativeOnly){const N=await Mt(P.getItem,O+"$",_).then(K=>ra(K));N&&typeof N=="object"&&(typeof N.atime=="string"&&(N.atime=new Date(N.atime)),typeof N.mtime=="string"&&(N.mtime=new Date(N.mtime)),Object.assign(L,N))}return L},setMeta(d,_,O={}){return this.setItem(d+"$",_,O)},removeMeta(d,_={}){return this.removeItem(d+"$",_)},async getKeys(d,_={}){d=ia(d);const O=n(d,!0);let P=[];const L=[];for(const N of O){const re=(await Mt(N.driver.getKeys,N.relativeBase,_)).map(ce=>N.mountpoint+ur(ce)).filter(ce=>!P.some(ue=>ce.startsWith(ue)));L.push(...re),P=[N.mountpoint,...P.filter(ce=>!ce.startsWith(N.mountpoint))]}return d?L.filter(N=>N.startsWith(d)&&!N.endsWith("$")):L.filter(N=>!N.endsWith("$"))},async clear(d,_={}){d=ia(d),await Promise.all(n(d,!1).map(async O=>{if(O.driver.clear)return Mt(O.driver.clear,O.relativeBase,_);if(O.driver.removeItem){const P=await O.driver.getKeys(O.relativeBase||"",_);return Promise.all(P.map(L=>O.driver.removeItem(L,_)))}}))},async dispose(){await Promise.all(Object.values(i.mounts).map(d=>Uh(d)))},async watch(d){return await u(),i.watchListeners.push(d),async()=>{i.watchListeners=i.watchListeners.filter(_=>_!==d),i.watchListeners.length===0&&await f()}},async unwatch(){i.watchListeners=[],await f()},mount(d,_){if(d=ia(d),d&&i.mounts[d])throw new Error(`already mounted at ${d}`);return d&&(i.mountpoints.push(d),i.mountpoints.sort((O,P)=>P.length-O.length)),i.mounts[d]=_,i.watching&&Promise.resolve(Mh(_,a,d)).then(O=>{i.unwatch[d]=O}).catch(console.error),w},async unmount(d,_=!0){d=ia(d),!(!d||!i.mounts[d])&&(i.watching&&d in i.unwatch&&(i.unwatch[d](),delete i.unwatch[d]),_&&await Uh(i.mounts[d]),i.mountpoints=i.mountpoints.filter(O=>O!==d),delete i.mounts[d])},getMount(d=""){d=ur(d)+":";const _=t(d);return{driver:_.driver,base:_.base}},getMounts(d="",_={}){return d=ur(d),n(d,_.parents).map(P=>({driver:P.driver,base:P.mountpoint}))}};return w}function Mh(o,i,t){return o.watch?o.watch((n,a)=>i(n,t+a)):()=>{}}async function Uh(o){typeof o.dispose=="function"&&await Mt(o.dispose)}function Mi(o){return new Promise((i,t)=>{o.oncomplete=o.onsuccess=()=>i(o.result),o.onabort=o.onerror=()=>t(o.error)})}function Kl(o,i){const t=indexedDB.open(o);t.onupgradeneeded=()=>t.result.createObjectStore(i);const n=Mi(t);return(a,u)=>n.then(f=>u(f.transaction(i,a).objectStore(i)))}let Go;function Jn(){return Go||(Go=Kl("keyval-store","keyval")),Go}function Hh(o,i=Jn()){return i("readonly",t=>Mi(t.get(o)))}function a1(o,i,t=Jn()){return t("readwrite",n=>(n.put(i,o),Mi(n.transaction)))}function o1(o,i=Jn()){return i("readwrite",t=>(t.delete(o),Mi(t.transaction)))}function c1(o=Jn()){return o("readwrite",i=>(i.clear(),Mi(i.transaction)))}function u1(o,i){return o.openCursor().onsuccess=function(){this.result&&(i(this.result),this.result.continue())},Mi(o.transaction)}function h1(o=Jn()){return o("readonly",i=>{if(i.getAllKeys)return Mi(i.getAllKeys());const t=[];return u1(i,n=>t.push(n.key)).then(()=>t)})}const l1="idb-keyval";var f1=(o={})=>{const i=o.base&&o.base.length>0?`${o.base}:`:"",t=a=>i+a;let n;return o.dbName&&o.storeName&&(n=Kl(o.dbName,o.storeName)),{name:l1,options:o,async hasItem(a){return!(typeof await Hh(t(a),n)>"u")},async getItem(a){return await Hh(t(a),n)??null},setItem(a,u){return a1(t(a),u,n)},removeItem(a){return o1(t(a),n)},getKeys(){return h1(n)},clear(){return c1(n)}}};const p1="WALLET_CONNECT_V2_INDEXED_DB",d1="keyvaluestorage";let g1=class{constructor(){this.indexedDb=s1({driver:f1({dbName:p1,storeName:d1})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(i=>[i.key,i.value])}async getItem(i){const t=await this.indexedDb.getItem(i);if(t!==null)return t}async setItem(i,t){await this.indexedDb.setItem(i,Wn(t))}async removeItem(i){await this.indexedDb.removeItem(i)}};var Wo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},ha={exports:{}};(function(){let o;function i(){}o=i,o.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},o.prototype.setItem=function(t,n){this[t]=String(n)},o.prototype.removeItem=function(t){delete this[t]},o.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(n){t[n]=void 0,delete t[n]})},o.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},o.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Wo<"u"&&Wo.localStorage?ha.exports=Wo.localStorage:typeof window<"u"&&window.localStorage?ha.exports=window.localStorage:ha.exports=new i})();function y1(o){var i;return[o[0],ya((i=o[1])!=null?i:"")]}let v1=class{constructor(){this.localStorage=ha.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(y1)}async getItem(i){const t=this.localStorage.getItem(i);if(t!==null)return ya(t)}async setItem(i,t){this.localStorage.setItem(i,Wn(t))}async removeItem(i){this.localStorage.removeItem(i)}};const m1="wc_storage_version",kh=1,w1=async(o,i,t)=>{const n=m1,a=await i.getItem(n);if(a&&a>=kh){t(i);return}const u=await o.getKeys();if(!u.length){t(i);return}const f=[];for(;u.length;){const y=u.shift();if(!y)continue;const w=y.toLowerCase();if(w.includes("wc@")||w.includes("walletconnect")||w.includes("wc_")||w.includes("wallet_connect")){const d=await o.getItem(y);await i.setItem(y,d),f.push(y)}}await i.setItem(n,kh),t(i),_1(o,f)},_1=async(o,i)=>{i.length&&i.forEach(async t=>{await o.removeItem(t)})};let b1=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const i=new v1;this.storage=i;try{const t=new g1;w1(i,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(i){return await this.initialize(),this.storage.getItem(i)}async setItem(i,t){return await this.initialize(),this.storage.setItem(i,t)}async removeItem(i){return await this.initialize(),this.storage.removeItem(i)}async initialize(){this.initialized||await new Promise(i=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),i())},20)})}};var dn={};/*! ***************************************************************************** +import{e as Ec,f as ie,h as Zv,w as Dl,r as Ll,i as Ic,t as ga,j as em,k as tm,m as _i,D as rm,o as im,N as X,p as nm,q as cc,s as sm,V as am,R as om,F as Fh,K as cm,x as um,L as hm,u as Dh,$ as lm,v as fm,y as Bn,Z as Lh,J as pm,X as dm,_ as ql,z as Fr,A as gm,B as ym,C as hn,E as $t,U as tr,G as wi,H as hr,I as vm,M as ln,O as jl,P as mm,Q as wm,S as _m,T as zl,W as bm,Y as Ml,a0 as Ul,a1 as fn,a2 as uc,a3 as oa,a4 as pn,a5 as Em,a6 as ca,a7 as Im,a8 as xm,a9 as Sm,aa as ta,ab as Pm,ac as Om,ad as Bo,ae as qh,af as Cm,ag as Am,ah as Tm,ai as jh,aj as Rm,ak as Nm,al as $m,am as Fm,an as Dm,ao as Lm,ap as qm,aq as Un,ar as Hl,as as Vo,at as jm,au as zm,av as Mm}from"./index-c212f3ee.js";import{e as kr,E as xc}from"./events-18c74ae2.js";import{s as Wn,a as ya,i as zh,c as Um,b as Hm,f as Sc,p as km,J as si,d as Pc,e as Oc,g as Cc,h as mi,j as ni,k as Kn,l as Km,m as Bm,H as Ii}from"./http-2c4dd3df.js";import"@safe-globalThis/safe-apps-provider";import"@safe-globalThis/safe-apps-sdk";const Vm=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Gm=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Wm=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Jm(o,i){if(o==="__proto__"||o==="constructor"&&i&&typeof i=="object"&&"prototype"in i){Qm(o);return}return i}function Qm(o){console.warn(`[destr] Dropping "${o}" key to prevent prototype pollution.`)}function ra(o,i={}){if(typeof o!="string")return o;const t=o.trim();if(o[0]==='"'&&o.at(-1)==='"'&&!o.includes("\\"))return t.slice(1,-1);if(t.length<=9){const n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!Wm.test(o)){if(i.strict)throw new SyntaxError("[destr] Invalid JSON");return o}try{if(Vm.test(o)||Gm.test(o)){if(i.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(o,Jm)}return JSON.parse(o)}catch(n){if(i.strict)throw n;return o}}function Ym(o){return!o||typeof o.then!="function"?Promise.resolve(o):o}function Mt(o,...i){try{return Ym(o(...i))}catch(t){return Promise.reject(t)}}function Xm(o){const i=typeof o;return o===null||i!=="object"&&i!=="function"}function Zm(o){const i=Object.getPrototypeOf(o);return!i||i.isPrototypeOf(Object)}function ua(o){if(Xm(o))return String(o);if(Zm(o)||Array.isArray(o))return JSON.stringify(o);if(typeof o.toJSON=="function")return ua(o.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function kl(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const hc="base64:";function e1(o){if(typeof o=="string")return o;kl();const i=Buffer.from(o).toString("base64");return hc+i}function t1(o){return typeof o!="string"||!o.startsWith(hc)?o:(kl(),Buffer.from(o.slice(hc.length),"base64"))}function ur(o){return o?o.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function r1(...o){return ur(o.join(":"))}function ia(o){return o=ur(o),o?o+":":""}const i1="memory",n1=()=>{const o=new Map;return{name:i1,options:{},hasItem(i){return o.has(i)},getItem(i){return o.get(i)??null},getItemRaw(i){return o.get(i)??null},setItem(i,t){o.set(i,t)},setItemRaw(i,t){o.set(i,t)},removeItem(i){o.delete(i)},getKeys(){return Array.from(o.keys())},clear(){o.clear()},dispose(){o.clear()}}};function s1(o={}){const i={mounts:{"":o.driver||n1()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=d=>{for(const _ of i.mountpoints)if(d.startsWith(_))return{base:_,relativeKey:d.slice(_.length),driver:i.mounts[_]};return{base:"",relativeKey:d,driver:i.mounts[""]}},n=(d,_)=>i.mountpoints.filter(O=>O.startsWith(d)||_&&d.startsWith(O)).map(O=>({relativeBase:d.length>O.length?d.slice(O.length):void 0,mountpoint:O,driver:i.mounts[O]})),a=(d,_)=>{if(i.watching){_=ur(_);for(const O of i.watchListeners)O(d,_)}},u=async()=>{if(!i.watching){i.watching=!0;for(const d in i.mounts)i.unwatch[d]=await Mh(i.mounts[d],a,d)}},f=async()=>{if(i.watching){for(const d in i.unwatch)await i.unwatch[d]();i.unwatch={},i.watching=!1}},y=(d,_,O)=>{const P=new Map,L=N=>{let K=P.get(N.base);return K||(K={driver:N.driver,base:N.base,items:[]},P.set(N.base,K)),K};for(const N of d){const K=typeof N=="string",re=ur(K?N:N.key),ce=K?void 0:N.value,ue=K||!N.options?_:{..._,...N.options},he=t(re);L(he).items.push({key:re,value:ce,relativeKey:he.relativeKey,options:ue})}return Promise.all([...P.values()].map(N=>O(N))).then(N=>N.flat())},w={hasItem(d,_={}){d=ur(d);const{relativeKey:O,driver:P}=t(d);return Mt(P.hasItem,O,_)},getItem(d,_={}){d=ur(d);const{relativeKey:O,driver:P}=t(d);return Mt(P.getItem,O,_).then(L=>ra(L))},getItems(d,_){return y(d,_,O=>O.driver.getItems?Mt(O.driver.getItems,O.items.map(P=>({key:P.relativeKey,options:P.options})),_).then(P=>P.map(L=>({key:r1(O.base,L.key),value:ra(L.value)}))):Promise.all(O.items.map(P=>Mt(O.driver.getItem,P.relativeKey,P.options).then(L=>({key:P.key,value:ra(L)})))))},getItemRaw(d,_={}){d=ur(d);const{relativeKey:O,driver:P}=t(d);return P.getItemRaw?Mt(P.getItemRaw,O,_):Mt(P.getItem,O,_).then(L=>t1(L))},async setItem(d,_,O={}){if(_===void 0)return w.removeItem(d);d=ur(d);const{relativeKey:P,driver:L}=t(d);L.setItem&&(await Mt(L.setItem,P,ua(_),O),L.watch||a("update",d))},async setItems(d,_){await y(d,_,async O=>{O.driver.setItems&&await Mt(O.driver.setItems,O.items.map(P=>({key:P.relativeKey,value:ua(P.value),options:P.options})),_),O.driver.setItem&&await Promise.all(O.items.map(P=>Mt(O.driver.setItem,P.relativeKey,ua(P.value),P.options)))})},async setItemRaw(d,_,O={}){if(_===void 0)return w.removeItem(d,O);d=ur(d);const{relativeKey:P,driver:L}=t(d);if(L.setItemRaw)await Mt(L.setItemRaw,P,_,O);else if(L.setItem)await Mt(L.setItem,P,e1(_),O);else return;L.watch||a("update",d)},async removeItem(d,_={}){typeof _=="boolean"&&(_={removeMeta:_}),d=ur(d);const{relativeKey:O,driver:P}=t(d);P.removeItem&&(await Mt(P.removeItem,O,_),(_.removeMeta||_.removeMata)&&await Mt(P.removeItem,O+"$",_),P.watch||a("remove",d))},async getMeta(d,_={}){typeof _=="boolean"&&(_={nativeOnly:_}),d=ur(d);const{relativeKey:O,driver:P}=t(d),L=Object.create(null);if(P.getMeta&&Object.assign(L,await Mt(P.getMeta,O,_)),!_.nativeOnly){const N=await Mt(P.getItem,O+"$",_).then(K=>ra(K));N&&typeof N=="object"&&(typeof N.atime=="string"&&(N.atime=new Date(N.atime)),typeof N.mtime=="string"&&(N.mtime=new Date(N.mtime)),Object.assign(L,N))}return L},setMeta(d,_,O={}){return this.setItem(d+"$",_,O)},removeMeta(d,_={}){return this.removeItem(d+"$",_)},async getKeys(d,_={}){d=ia(d);const O=n(d,!0);let P=[];const L=[];for(const N of O){const re=(await Mt(N.driver.getKeys,N.relativeBase,_)).map(ce=>N.mountpoint+ur(ce)).filter(ce=>!P.some(ue=>ce.startsWith(ue)));L.push(...re),P=[N.mountpoint,...P.filter(ce=>!ce.startsWith(N.mountpoint))]}return d?L.filter(N=>N.startsWith(d)&&!N.endsWith("$")):L.filter(N=>!N.endsWith("$"))},async clear(d,_={}){d=ia(d),await Promise.all(n(d,!1).map(async O=>{if(O.driver.clear)return Mt(O.driver.clear,O.relativeBase,_);if(O.driver.removeItem){const P=await O.driver.getKeys(O.relativeBase||"",_);return Promise.all(P.map(L=>O.driver.removeItem(L,_)))}}))},async dispose(){await Promise.all(Object.values(i.mounts).map(d=>Uh(d)))},async watch(d){return await u(),i.watchListeners.push(d),async()=>{i.watchListeners=i.watchListeners.filter(_=>_!==d),i.watchListeners.length===0&&await f()}},async unwatch(){i.watchListeners=[],await f()},mount(d,_){if(d=ia(d),d&&i.mounts[d])throw new Error(`already mounted at ${d}`);return d&&(i.mountpoints.push(d),i.mountpoints.sort((O,P)=>P.length-O.length)),i.mounts[d]=_,i.watching&&Promise.resolve(Mh(_,a,d)).then(O=>{i.unwatch[d]=O}).catch(console.error),w},async unmount(d,_=!0){d=ia(d),!(!d||!i.mounts[d])&&(i.watching&&d in i.unwatch&&(i.unwatch[d](),delete i.unwatch[d]),_&&await Uh(i.mounts[d]),i.mountpoints=i.mountpoints.filter(O=>O!==d),delete i.mounts[d])},getMount(d=""){d=ur(d)+":";const _=t(d);return{driver:_.driver,base:_.base}},getMounts(d="",_={}){return d=ur(d),n(d,_.parents).map(P=>({driver:P.driver,base:P.mountpoint}))}};return w}function Mh(o,i,t){return o.watch?o.watch((n,a)=>i(n,t+a)):()=>{}}async function Uh(o){typeof o.dispose=="function"&&await Mt(o.dispose)}function Mi(o){return new Promise((i,t)=>{o.oncomplete=o.onsuccess=()=>i(o.result),o.onabort=o.onerror=()=>t(o.error)})}function Kl(o,i){const t=indexedDB.open(o);t.onupgradeneeded=()=>t.result.createObjectStore(i);const n=Mi(t);return(a,u)=>n.then(f=>u(f.transaction(i,a).objectStore(i)))}let Go;function Jn(){return Go||(Go=Kl("keyval-store","keyval")),Go}function Hh(o,i=Jn()){return i("readonly",t=>Mi(t.get(o)))}function a1(o,i,t=Jn()){return t("readwrite",n=>(n.put(i,o),Mi(n.transaction)))}function o1(o,i=Jn()){return i("readwrite",t=>(t.delete(o),Mi(t.transaction)))}function c1(o=Jn()){return o("readwrite",i=>(i.clear(),Mi(i.transaction)))}function u1(o,i){return o.openCursor().onsuccess=function(){this.result&&(i(this.result),this.result.continue())},Mi(o.transaction)}function h1(o=Jn()){return o("readonly",i=>{if(i.getAllKeys)return Mi(i.getAllKeys());const t=[];return u1(i,n=>t.push(n.key)).then(()=>t)})}const l1="idb-keyval";var f1=(o={})=>{const i=o.base&&o.base.length>0?`${o.base}:`:"",t=a=>i+a;let n;return o.dbName&&o.storeName&&(n=Kl(o.dbName,o.storeName)),{name:l1,options:o,async hasItem(a){return!(typeof await Hh(t(a),n)>"u")},async getItem(a){return await Hh(t(a),n)??null},setItem(a,u){return a1(t(a),u,n)},removeItem(a){return o1(t(a),n)},getKeys(){return h1(n)},clear(){return c1(n)}}};const p1="WALLET_CONNECT_V2_INDEXED_DB",d1="keyvaluestorage";let g1=class{constructor(){this.indexedDb=s1({driver:f1({dbName:p1,storeName:d1})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(i=>[i.key,i.value])}async getItem(i){const t=await this.indexedDb.getItem(i);if(t!==null)return t}async setItem(i,t){await this.indexedDb.setItem(i,Wn(t))}async removeItem(i){await this.indexedDb.removeItem(i)}};var Wo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},ha={exports:{}};(function(){let o;function i(){}o=i,o.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},o.prototype.setItem=function(t,n){this[t]=String(n)},o.prototype.removeItem=function(t){delete this[t]},o.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(n){t[n]=void 0,delete t[n]})},o.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},o.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Wo<"u"&&Wo.localStorage?ha.exports=Wo.localStorage:typeof window<"u"&&window.localStorage?ha.exports=window.localStorage:ha.exports=new i})();function y1(o){var i;return[o[0],ya((i=o[1])!=null?i:"")]}let v1=class{constructor(){this.localStorage=ha.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(y1)}async getItem(i){const t=this.localStorage.getItem(i);if(t!==null)return ya(t)}async setItem(i,t){this.localStorage.setItem(i,Wn(t))}async removeItem(i){this.localStorage.removeItem(i)}};const m1="wc_storage_version",kh=1,w1=async(o,i,t)=>{const n=m1,a=await i.getItem(n);if(a&&a>=kh){t(i);return}const u=await o.getKeys();if(!u.length){t(i);return}const f=[];for(;u.length;){const y=u.shift();if(!y)continue;const w=y.toLowerCase();if(w.includes("wc@")||w.includes("walletconnect")||w.includes("wc_")||w.includes("wallet_connect")){const d=await o.getItem(y);await i.setItem(y,d),f.push(y)}}await i.setItem(n,kh),t(i),_1(o,f)},_1=async(o,i)=>{i.length&&i.forEach(async t=>{await o.removeItem(t)})};let b1=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const i=new v1;this.storage=i;try{const t=new g1;w1(i,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(i){return await this.initialize(),this.storage.getItem(i)}async setItem(i,t){return await this.initialize(),this.storage.setItem(i,t)}async removeItem(i){return await this.initialize(),this.storage.removeItem(i)}async initialize(){this.initialized||await new Promise(i=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),i())},20)})}};var dn={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -50,4 +50,4 @@ __p += '`),Oe&&(U+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+U+`return __p -}`;var we=Rh(function(){return Fe(g,ee+"return "+U).apply(t,m)});if(we.source=U,Fo(we))throw we;return we}function av(e){return Le(e).toLowerCase()}function ov(e){return Le(e).toUpperCase()}function cv(e,r,s){if(e=Le(e),e&&(s||r===t))return Mc(e);if(!e||!(r=pr(r)))return e;var c=Ar(e),l=Ar(r),g=Uc(c,l),m=Hc(c,l)+1;return yi(c,g,m).join("")}function uv(e,r,s){if(e=Le(e),e&&(s||r===t))return e.slice(0,Kc(e)+1);if(!e||!(r=pr(r)))return e;var c=Ar(e),l=Hc(c,Ar(r))+1;return yi(c,0,l).join("")}function hv(e,r,s){if(e=Le(e),e&&(s||r===t))return e.replace(gt,"");if(!e||!(r=pr(r)))return e;var c=Ar(e),l=Uc(c,Ar(r));return yi(c,l).join("")}function lv(e,r){var s=te,c=Ee;if(ct(r)){var l="separator"in r?r.separator:l;s="length"in r?ve(r.length):s,c="omission"in r?pr(r.omission):c}e=Le(e);var g=e.length;if(Yi(e)){var m=Ar(e);g=m.length}if(s>=g)return e;var b=s-Xi(c);if(b<1)return c;var S=m?yi(m,0,b).join(""):e.slice(0,b);if(l===t)return S+c;if(m&&(b+=S.length-b),Do(l)){if(e.slice(b).search(l)){var q,j=S;for(l.global||(l=Qa(l.source,Le(vr.exec(l))+"g")),l.lastIndex=0;q=l.exec(j);)var U=q.index;S=S.slice(0,U===t?b:U)}}else if(e.indexOf(pr(l),b)!=b){var G=S.lastIndexOf(l);G>-1&&(S=S.slice(0,G))}return S+c}function fv(e){return e=Le(e),e&<.test(e)?e.replace(oi,Uf):e}var pv=an(function(e,r,s){return e+(s?" ":"")+r.toUpperCase()}),jo=Nu("toUpperCase");function Th(e,r,s){return e=Le(e),r=s?t:r,r===t?Lf(e)?Kf(e):Of(e):e.match(r)||[]}var Rh=be(function(e,r){try{return jt(e,t,r)}catch(s){return Fo(s)?s:new le(s)}}),dv=Yr(function(e,r){return wr(r,function(s){s=Ur(s),Jr(e,s,No(e[s],e))}),e});function gv(e){var r=e==null?0:e.length,s=ne();return e=r?it(e,function(c){if(typeof c[1]!="function")throw new _r(f);return[s(c[0]),c[1]]}):[],be(function(c){for(var l=-1;++lJ)return[];var s=V,c=Bt(e,V);r=ne(r),e-=V;for(var l=Ga(c,r);++s0||r<0)?new Se(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),r!==t&&(r=ve(r),s=r<0?s.dropRight(-r):s.take(r-e)),s)},Se.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Se.prototype.toArray=function(){return this.take(V)},zr(Se.prototype,function(e,r){var s=/^(?:filter|find|map|reject)|While$/.test(r),c=/^(?:head|last)$/.test(r),l=p[c?"take"+(r=="last"?"Right":""):r],g=c||/^find/.test(r);l&&(p.prototype[r]=function(){var m=this.__wrapped__,b=c?[1]:arguments,S=m instanceof Se,q=b[0],j=S||ge(m),U=function(Ie){var Oe=l.apply(p,hi([Ie],b));return c&&G?Oe[0]:Oe};j&&s&&typeof q=="function"&&q.length!=1&&(S=j=!1);var G=this.__chain__,ee=!!this.__actions__.length,se=g&&!G,we=S&&!ee;if(!g&&j){m=we?m:new Se(this);var ae=e.apply(m,b);return ae.__actions__.push({func:Gs,args:[U],thisArg:t}),new br(ae,G)}return se&&we?e.apply(this,b):(ae=this.thru(U),se?c?ae.value()[0]:ae.value():ae)})}),wr(["pop","push","shift","sort","splice","unshift"],function(e){var r=ws[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var l=arguments;if(c&&!this.__chain__){var g=this.value();return r.apply(ge(g)?g:[],l)}return this[s](function(m){return r.apply(ge(m)?m:[],l)})}}),zr(Se.prototype,function(e,r){var s=p[r];if(s){var c=s.name+"";je.call(rn,c)||(rn[c]=[]),rn[c].push({name:r,func:s})}}),rn[Ms(t,ce).name]=[{name:"wrapper",func:t}],Se.prototype.clone=fp,Se.prototype.reverse=pp,Se.prototype.value=dp,p.prototype.at=kg,p.prototype.chain=Kg,p.prototype.commit=Bg,p.prototype.next=Vg,p.prototype.plant=Wg,p.prototype.reverse=Jg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Qg,p.prototype.first=p.prototype.head,_n&&(p.prototype[_n]=Gg),p},Zi=Bf();_t?((_t.exports=Zi)._=Zi,Ve._=Zi):Pe._=Zi}).call(Mn)})(wc,wc.exports);var jE=Object.defineProperty,zE=Object.defineProperties,ME=Object.getOwnPropertyDescriptors,Ol=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,HE=Object.prototype.propertyIsEnumerable,Cl=(o,i,t)=>i in o?jE(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,sa=(o,i)=>{for(var t in i||(i={}))UE.call(i,t)&&Cl(o,t,i[t]);if(Ol)for(var t of Ol(i))HE.call(i,t)&&Cl(o,t,i[t]);return o},kE=(o,i)=>zE(o,ME(i));function Ei(o,i,t){var n;const a=jm(o);return((n=i.rpcMap)==null?void 0:n[a.reference])||`${qE}?chainId=${a.namespace}:${a.reference}&projectId=${t}`}function Hi(o){return o.includes(":")?o.split(":")[1]:o}function _f(o){return o.map(i=>`${i.split(":")[0]}:${i.split(":")[1]}`)}function KE(o,i){const t=Object.keys(i.namespaces).filter(a=>a.includes(o));if(!t.length)return[];const n=[];return t.forEach(a=>{const u=i.namespaces[a].accounts;n.push(...u)}),n}function BE(o={},i={}){const t=Al(o),n=Al(i);return wc.exports.merge(t,n)}function Al(o){var i,t,n,a;const u={};if(!ca(o))return u;for(const[f,y]of Object.entries(o)){const w=Hl(f)?[f]:y.chains,d=y.methods||[],_=y.events||[],O=y.rpcMap||{},P=Un(f);u[P]=kE(sa(sa({},u[P]),y),{chains:Vo(w,(i=u[P])==null?void 0:i.chains),methods:Vo(d,(t=u[P])==null?void 0:t.methods),events:Vo(_,(n=u[P])==null?void 0:n.events),rpcMap:sa(sa({},O),(a=u[P])==null?void 0:a.rpcMap)})}return u}function VE(o){return o.includes(":")?o.split(":")[2]:o}function GE(o){const i={};for(const[t,n]of Object.entries(o)){const a=n.methods||[],u=n.events||[],f=n.accounts||[],y=Hl(t)?[t]:n.chains?n.chains:_f(n.accounts);i[t]={chains:y,methods:a,events:u,accounts:f}}return i}function nc(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const bf={},nt=o=>bf[o],sc=(o,i)=>{bf[o]=i};class WE{constructor(i){this.name="polkadot",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getAccounts(){const i=this.namespace.accounts;return i?i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class JE{constructor(i){this.name="eip155",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(i){switch(i.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(i);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(i.request.method)?await this.client.request(i):this.getHttpProvider().request(i.request)}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(parseInt(i),t),this.chainId=parseInt(i),this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}createHttpProvider(i,t){const n=t||Ei(`${this.name}:${i}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=parseInt(Hi(t));i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const i=this.chainId,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}async handleSwitchChain(i){var t,n;let a=i.request.params?(t=i.request.params[0])==null?void 0:t.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:i.topic,request:{method:i.request.method,params:[{chainId:a}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(i){return this.namespace.chains.includes(`${this.name}:${i}`)}}class QE{constructor(i){this.name="solana",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class YE{constructor(i){this.name="cosmos",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class XE{constructor(i){this.name="cip34",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{const n=this.getCardanoRPCUrl(t),a=Hi(t);i[a]=this.createHttpProvider(a,n)}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}getCardanoRPCUrl(i){const t=this.namespace.rpcMap;if(t)return t[i]}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||this.getCardanoRPCUrl(i);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class ZE{constructor(i){this.name="elrond",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class eI{constructor(i){this.name="multiversx",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class tI{constructor(i){this.name="near",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){if(this.chainId=i,!this.httpProviders[i]){const n=t||Ei(`${this.name}:${i}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);this.setHttpProvider(i,n)}this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;i[t]=this.createHttpProvider(t,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace);return typeof n>"u"?void 0:new si(new Ii(n,nt("disableProviderPing")))}}var rI=Object.defineProperty,iI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,Tl=Object.getOwnPropertySymbols,sI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,Rl=(o,i,t)=>i in o?rI(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,aa=(o,i)=>{for(var t in i||(i={}))sI.call(i,t)&&Rl(o,t,i[t]);if(Tl)for(var t of Tl(i))aI.call(i,t)&&Rl(o,t,i[t]);return o},ac=(o,i)=>iI(o,nI(i));class $c{constructor(i){this.events=new xc,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=i,this.logger=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Ce.pino(Ce.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||Sl})),this.disableProviderPing=(i==null?void 0:i.disableProviderPing)||!1}static async init(i){const t=new $c(i);return await t.initialize(),t}async request(i,t){const[n,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:aa({},i),chainId:`${n}:${a}`,topic:this.session.topic})}sendAsync(i,t,n){this.request(i,n).then(a=>t(null,a)).catch(a=>t(a,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var i;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(i=this.session)==null?void 0:i.topic,reason:tr("USER_DISCONNECTED")}),await this.cleanup()}async connect(i){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(i),await this.cleanupPendingPairings(),!i.skipPairing)return await this.pair(i.pairingTopic)}on(i,t){this.events.on(i,t)}once(i,t){this.events.once(i,t)}removeListener(i,t){this.events.removeListener(i,t)}off(i,t){this.events.off(i,t)}get isWalletConnect(){return!0}async pair(i){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:a}=await this.client.connect({pairingTopic:i,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=GE(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==mf)throw u;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(i,t){try{if(!this.session)return;const[n,a]=this.validateChain(i);this.getProvider(n).setDefaultChain(a,t)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(i={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(pn(t)){for(const n of t)i.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const i=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[i]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await $E.init({logger:this.providerOpts.logger||Sl,relayUrl:this.providerOpts.relayUrl||FE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const i=[...new Set(Object.keys(this.session.namespaces).map(t=>Un(t)))];sc("client",this.client),sc("events",this.events),sc("disableProviderPing",this.disableProviderPing),i.forEach(t=>{if(!this.session)return;const n=KE(t,this.session),a=_f(n),u=BE(this.namespaces,this.optionalNamespaces),f=ac(aa({},u[t]),{accounts:n,chains:a});switch(t){case"eip155":this.rpcProviders[t]=new JE({namespace:f});break;case"solana":this.rpcProviders[t]=new QE({namespace:f});break;case"cosmos":this.rpcProviders[t]=new YE({namespace:f});break;case"polkadot":this.rpcProviders[t]=new WE({namespace:f});break;case"cip34":this.rpcProviders[t]=new XE({namespace:f});break;case"elrond":this.rpcProviders[t]=new ZE({namespace:f});break;case"multiversx":this.rpcProviders[t]=new eI({namespace:f});break;case"near":this.rpcProviders[t]=new tI({namespace:f});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",i=>{this.events.emit("session_ping",i)}),this.client.on("session_event",i=>{const{params:t}=i,{event:n}=t;if(n.name==="accountsChanged"){const a=n.data;a&&pn(a)&&this.events.emit("accountsChanged",a.map(VE))}else if(n.name==="chainChanged"){const a=t.chainId,u=t.event.data,f=Un(a),y=nc(a)!==nc(u)?`${f}:${nc(u)}`:a;this.onChainChanged(y)}else this.events.emit(n.name,n.data);this.events.emit("session_event",i)}),this.client.on("session_update",({topic:i,params:t})=>{var n;const{namespaces:a}=t,u=(n=this.client)==null?void 0:n.session.get(i);this.session=ac(aa({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:i,params:t})}),this.client.on("session_delete",async i=>{await this.cleanup(),this.events.emit("session_delete",i),this.events.emit("disconnect",ac(aa({},tr("USER_DISCONNECTED")),{data:i.topic}))}),this.on(ai.DEFAULT_CHAIN_CHANGED,i=>{this.onChainChanged(i,!0)})}getProvider(i){if(!this.rpcProviders[i])throw new Error(`Provider not found: ${i}`);return this.rpcProviders[i]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(i=>{var t;this.getProvider(i).updateNamespace((t=this.session)==null?void 0:t.namespaces[i])})}setNamespaces(i){const{namespaces:t,optionalNamespaces:n,sessionProperties:a}=i;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=a,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(i){const[t,n]=(i==null?void 0:i.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map(f=>Un(f)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const a=Un(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[i]=this.validateChain();return await this.getProvider(i).requestAccounts()}onChainChanged(i,t=!1){var n;if(!this.namespaces)return;const[a,u]=this.validateChain(i);t||this.getProvider(a).setDefaultChain(u),((n=this.namespaces[a])!=null?n:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(i,t){this.client.core.storage.setItem(`${Pl}/${i}`,t)}async getFromStore(i){return await this.client.core.storage.getItem(`${Pl}/${i}`)}}const oI=$c,cI="wc",uI="ethereum_provider",hI=`${cI}@2:${uI}:`,lI="https://rpc.walletconnect.com/v1/",_c=["eth_sendTransaction","personal_sign"],fI=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],bc=["chainChanged","accountsChanged"],pI=["chainChanged","accountsChanged","message","disconnect","connect"];var dI=Object.defineProperty,gI=Object.defineProperties,yI=Object.getOwnPropertyDescriptors,Nl=Object.getOwnPropertySymbols,vI=Object.prototype.hasOwnProperty,mI=Object.prototype.propertyIsEnumerable,$l=(o,i,t)=>i in o?dI(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,kn=(o,i)=>{for(var t in i||(i={}))vI.call(i,t)&&$l(o,t,i[t]);if(Nl)for(var t of Nl(i))mI.call(i,t)&&$l(o,t,i[t]);return o},Fl=(o,i)=>gI(o,yI(i));function da(o){return Number(o[0].split(":")[1])}function oc(o){return`0x${o.toString(16)}`}function wI(o){const{chains:i,optionalChains:t,methods:n,optionalMethods:a,events:u,optionalEvents:f,rpcMap:y}=o;if(!pn(i))throw new Error("Invalid chains");const w={chains:i,methods:n||_c,events:u||bc,rpcMap:kn({},i.length?{[da(i)]:y[da(i)]}:{})},d=u==null?void 0:u.filter(L=>!bc.includes(L)),_=n==null?void 0:n.filter(L=>!_c.includes(L));if(!t&&!f&&!a&&!(d!=null&&d.length)&&!(_!=null&&_.length))return{required:i.length?w:void 0};const O=(d==null?void 0:d.length)&&(_==null?void 0:_.length)||!t,P={chains:[...new Set(O?w.chains.concat(t||[]):t)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:fI))],events:[...new Set(w.events.concat(f!=null&&f.length?f:pI))],rpcMap:y};return{required:i.length?w:void 0,optional:t.length?P:void 0}}class Fc{constructor(){this.events=new kr.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=hI,this.on=(i,t)=>(this.events.on(i,t),this),this.once=(i,t)=>(this.events.once(i,t),this),this.removeListener=(i,t)=>(this.events.removeListener(i,t),this),this.off=(i,t)=>(this.events.off(i,t),this),this.parseAccount=i=>this.isCompatibleChainId(i)?this.parseAccountId(i).address:i,this.signer={},this.rpc={}}static async init(i){const t=new Fc;return await t.initialize(i),t}async request(i){return await this.signer.request(i,this.formatChainId(this.chainId))}sendAsync(i,t){this.signer.sendAsync(i,t,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(i){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(i);const{required:t,optional:n}=wI(this.rpc);try{const a=await new Promise(async(f,y)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),y(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Fl(kn({namespaces:kn({},t&&{[this.namespace]:t})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:i==null?void 0:i.pairingTopic})).then(d=>{f(d)}).catch(d=>{y(new Error(d.message))})});if(!a)return;const u=zm(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:oc(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",i=>{const{params:t}=i,{event:n}=t;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",i)}),this.signer.on("chainChanged",i=>{const t=parseInt(i);this.chainId=t,this.events.emit("chainChanged",oc(this.chainId)),this.persist()}),this.signer.on("session_update",i=>{this.events.emit("session_update",i)}),this.signer.on("session_delete",i=>{this.reset(),this.events.emit("session_delete",i),this.events.emit("disconnect",Fl(kn({},tr("USER_DISCONNECTED")),{data:i.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",i=>{var t,n;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(n=this.modal)==null||n.openModal({uri:i})),this.events.emit("display_uri",i)})}switchEthereumChain(i){this.request({method:"wallet_switchEthereumChain",params:[{chainId:i.toString(16)}]})}isCompatibleChainId(i){return typeof i=="string"?i.startsWith(`${this.namespace}:`):!1}formatChainId(i){return`${this.namespace}:${i}`}parseChainId(i){return Number(i.split(":")[1])}setChainIds(i){const t=i.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",oc(this.chainId)),this.persist())}setChainId(i){if(this.isCompatibleChainId(i)){const t=this.parseChainId(i);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(i){const[t,n,a]=i.split(":");return{chainId:`${t}:${n}`,address:a}}setAccounts(i){this.accounts=i.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(i){var t,n;const a=(t=i==null?void 0:i.chains)!=null?t:[],u=(n=i==null?void 0:i.optionalChains)!=null?n:[],f=a.concat(u);if(!f.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const y=a.length?(i==null?void 0:i.methods)||_c:[],w=a.length?(i==null?void 0:i.events)||bc:[],d=(i==null?void 0:i.optionalMethods)||[],_=(i==null?void 0:i.optionalEvents)||[],O=(i==null?void 0:i.rpcMap)||this.buildRpcMap(f,i.projectId),P=(i==null?void 0:i.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(L=>this.formatChainId(L)),optionalChains:u.map(L=>this.formatChainId(L)),methods:y,events:w,optionalMethods:d,optionalEvents:_,rpcMap:O,showQrModal:!!(i!=null&&i.showQrModal),qrModalOptions:P,projectId:i.projectId,metadata:i.metadata}}buildRpcMap(i,t){const n={};return i.forEach(a=>{n[a]=this.getRpcUrl(a,t)}),n}async initialize(i){if(this.rpc=this.getRpcConfig(i),this.chainId=this.rpc.chains.length?da(this.rpc.chains):da(this.rpc.optionalChains),this.signer=await oI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:i.disableProviderPing,relayUrl:i.relayUrl,storageOptions:i.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:n}=await Mm(()=>import("./index-a570b5c8.js").then(a=>a.i),["assets/index-a570b5c8.js","assets/index-51fb98b3.js","assets/index-882a2daf.css"]);t=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(kn({walletConnectVersion:2,projectId:this.rpc.projectId,standaloneChains:this.rpc.chains},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(i){if(!i)return;const{chains:t,optionalChains:n,rpcMap:a}=i;t&&pn(t)&&(this.rpc.chains=t.map(u=>this.formatChainId(u)),t.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),n&&pn(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(u=>this.formatChainId(u)),n.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(i,t){var n;return((n=this.rpc.rpcMap)==null?void 0:n[i])||`${lI}?chainId=eip155:${i}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const i=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${i}`]?this.session.namespaces[`${this.namespace}:${i}`]:this.session.namespaces[this.namespace];this.setChainIds(i?[this.formatChainId(i)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(i){return typeof i=="string"||i instanceof String?[this.parseAccount(i)]:i.map(t=>this.parseAccount(t))}}const DI=Fc;export{DI as EthereumProvider,pI as OPTIONAL_EVENTS,fI as OPTIONAL_METHODS,bc as REQUIRED_EVENTS,_c as REQUIRED_METHODS,Fc as default}; +}`;var we=Rh(function(){return Fe(g,ee+"return "+U).apply(t,m)});if(we.source=U,Fo(we))throw we;return we}function av(e){return Le(e).toLowerCase()}function ov(e){return Le(e).toUpperCase()}function cv(e,r,s){if(e=Le(e),e&&(s||r===t))return Mc(e);if(!e||!(r=pr(r)))return e;var c=Ar(e),l=Ar(r),g=Uc(c,l),m=Hc(c,l)+1;return yi(c,g,m).join("")}function uv(e,r,s){if(e=Le(e),e&&(s||r===t))return e.slice(0,Kc(e)+1);if(!e||!(r=pr(r)))return e;var c=Ar(e),l=Hc(c,Ar(r))+1;return yi(c,0,l).join("")}function hv(e,r,s){if(e=Le(e),e&&(s||r===t))return e.replace(gt,"");if(!e||!(r=pr(r)))return e;var c=Ar(e),l=Uc(c,Ar(r));return yi(c,l).join("")}function lv(e,r){var s=te,c=Ee;if(ct(r)){var l="separator"in r?r.separator:l;s="length"in r?ve(r.length):s,c="omission"in r?pr(r.omission):c}e=Le(e);var g=e.length;if(Yi(e)){var m=Ar(e);g=m.length}if(s>=g)return e;var b=s-Xi(c);if(b<1)return c;var S=m?yi(m,0,b).join(""):e.slice(0,b);if(l===t)return S+c;if(m&&(b+=S.length-b),Do(l)){if(e.slice(b).search(l)){var q,j=S;for(l.global||(l=Qa(l.source,Le(vr.exec(l))+"g")),l.lastIndex=0;q=l.exec(j);)var U=q.index;S=S.slice(0,U===t?b:U)}}else if(e.indexOf(pr(l),b)!=b){var G=S.lastIndexOf(l);G>-1&&(S=S.slice(0,G))}return S+c}function fv(e){return e=Le(e),e&<.test(e)?e.replace(oi,Uf):e}var pv=an(function(e,r,s){return e+(s?" ":"")+r.toUpperCase()}),jo=Nu("toUpperCase");function Th(e,r,s){return e=Le(e),r=s?t:r,r===t?Lf(e)?Kf(e):Of(e):e.match(r)||[]}var Rh=be(function(e,r){try{return jt(e,t,r)}catch(s){return Fo(s)?s:new le(s)}}),dv=Yr(function(e,r){return wr(r,function(s){s=Ur(s),Jr(e,s,No(e[s],e))}),e});function gv(e){var r=e==null?0:e.length,s=ne();return e=r?it(e,function(c){if(typeof c[1]!="function")throw new _r(f);return[s(c[0]),c[1]]}):[],be(function(c){for(var l=-1;++lJ)return[];var s=V,c=Bt(e,V);r=ne(r),e-=V;for(var l=Ga(c,r);++s0||r<0)?new Se(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),r!==t&&(r=ve(r),s=r<0?s.dropRight(-r):s.take(r-e)),s)},Se.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Se.prototype.toArray=function(){return this.take(V)},zr(Se.prototype,function(e,r){var s=/^(?:filter|find|map|reject)|While$/.test(r),c=/^(?:head|last)$/.test(r),l=p[c?"take"+(r=="last"?"Right":""):r],g=c||/^find/.test(r);l&&(p.prototype[r]=function(){var m=this.__wrapped__,b=c?[1]:arguments,S=m instanceof Se,q=b[0],j=S||ge(m),U=function(Ie){var Oe=l.apply(p,hi([Ie],b));return c&&G?Oe[0]:Oe};j&&s&&typeof q=="function"&&q.length!=1&&(S=j=!1);var G=this.__chain__,ee=!!this.__actions__.length,se=g&&!G,we=S&&!ee;if(!g&&j){m=we?m:new Se(this);var ae=e.apply(m,b);return ae.__actions__.push({func:Gs,args:[U],thisArg:t}),new br(ae,G)}return se&&we?e.apply(this,b):(ae=this.thru(U),se?c?ae.value()[0]:ae.value():ae)})}),wr(["pop","push","shift","sort","splice","unshift"],function(e){var r=ws[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var l=arguments;if(c&&!this.__chain__){var g=this.value();return r.apply(ge(g)?g:[],l)}return this[s](function(m){return r.apply(ge(m)?m:[],l)})}}),zr(Se.prototype,function(e,r){var s=p[r];if(s){var c=s.name+"";je.call(rn,c)||(rn[c]=[]),rn[c].push({name:r,func:s})}}),rn[Ms(t,ce).name]=[{name:"wrapper",func:t}],Se.prototype.clone=fp,Se.prototype.reverse=pp,Se.prototype.value=dp,p.prototype.at=kg,p.prototype.chain=Kg,p.prototype.commit=Bg,p.prototype.next=Vg,p.prototype.plant=Wg,p.prototype.reverse=Jg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Qg,p.prototype.first=p.prototype.head,_n&&(p.prototype[_n]=Gg),p},Zi=Bf();_t?((_t.exports=Zi)._=Zi,Ve._=Zi):Pe._=Zi}).call(Mn)})(wc,wc.exports);var jE=Object.defineProperty,zE=Object.defineProperties,ME=Object.getOwnPropertyDescriptors,Ol=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,HE=Object.prototype.propertyIsEnumerable,Cl=(o,i,t)=>i in o?jE(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,sa=(o,i)=>{for(var t in i||(i={}))UE.call(i,t)&&Cl(o,t,i[t]);if(Ol)for(var t of Ol(i))HE.call(i,t)&&Cl(o,t,i[t]);return o},kE=(o,i)=>zE(o,ME(i));function Ei(o,i,t){var n;const a=jm(o);return((n=i.rpcMap)==null?void 0:n[a.reference])||`${qE}?chainId=${a.namespace}:${a.reference}&projectId=${t}`}function Hi(o){return o.includes(":")?o.split(":")[1]:o}function _f(o){return o.map(i=>`${i.split(":")[0]}:${i.split(":")[1]}`)}function KE(o,i){const t=Object.keys(i.namespaces).filter(a=>a.includes(o));if(!t.length)return[];const n=[];return t.forEach(a=>{const u=i.namespaces[a].accounts;n.push(...u)}),n}function BE(o={},i={}){const t=Al(o),n=Al(i);return wc.exports.merge(t,n)}function Al(o){var i,t,n,a;const u={};if(!ca(o))return u;for(const[f,y]of Object.entries(o)){const w=Hl(f)?[f]:y.chains,d=y.methods||[],_=y.events||[],O=y.rpcMap||{},P=Un(f);u[P]=kE(sa(sa({},u[P]),y),{chains:Vo(w,(i=u[P])==null?void 0:i.chains),methods:Vo(d,(t=u[P])==null?void 0:t.methods),events:Vo(_,(n=u[P])==null?void 0:n.events),rpcMap:sa(sa({},O),(a=u[P])==null?void 0:a.rpcMap)})}return u}function VE(o){return o.includes(":")?o.split(":")[2]:o}function GE(o){const i={};for(const[t,n]of Object.entries(o)){const a=n.methods||[],u=n.events||[],f=n.accounts||[],y=Hl(t)?[t]:n.chains?n.chains:_f(n.accounts);i[t]={chains:y,methods:a,events:u,accounts:f}}return i}function nc(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const bf={},nt=o=>bf[o],sc=(o,i)=>{bf[o]=i};class WE{constructor(i){this.name="polkadot",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getAccounts(){const i=this.namespace.accounts;return i?i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class JE{constructor(i){this.name="eip155",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(i){switch(i.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(i);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(i.request.method)?await this.client.request(i):this.getHttpProvider().request(i.request)}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(parseInt(i),t),this.chainId=parseInt(i),this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}createHttpProvider(i,t){const n=t||Ei(`${this.name}:${i}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=parseInt(Hi(t));i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const i=this.chainId,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}async handleSwitchChain(i){var t,n;let a=i.request.params?(t=i.request.params[0])==null?void 0:t.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:i.topic,request:{method:i.request.method,params:[{chainId:a}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(i){return this.namespace.chains.includes(`${this.name}:${i}`)}}class QE{constructor(i){this.name="solana",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class YE{constructor(i){this.name="cosmos",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class XE{constructor(i){this.name="cip34",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{const n=this.getCardanoRPCUrl(t),a=Hi(t);i[a]=this.createHttpProvider(a,n)}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}getCardanoRPCUrl(i){const t=this.namespace.rpcMap;if(t)return t[i]}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||this.getCardanoRPCUrl(i);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class ZE{constructor(i){this.name="elrond",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class eI{constructor(i){this.name="multiversx",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class tI{constructor(i){this.name="near",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){if(this.chainId=i,!this.httpProviders[i]){const n=t||Ei(`${this.name}:${i}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);this.setHttpProvider(i,n)}this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;i[t]=this.createHttpProvider(t,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace);return typeof n>"u"?void 0:new si(new Ii(n,nt("disableProviderPing")))}}var rI=Object.defineProperty,iI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,Tl=Object.getOwnPropertySymbols,sI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,Rl=(o,i,t)=>i in o?rI(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,aa=(o,i)=>{for(var t in i||(i={}))sI.call(i,t)&&Rl(o,t,i[t]);if(Tl)for(var t of Tl(i))aI.call(i,t)&&Rl(o,t,i[t]);return o},ac=(o,i)=>iI(o,nI(i));class $c{constructor(i){this.events=new xc,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=i,this.logger=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Ce.pino(Ce.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||Sl})),this.disableProviderPing=(i==null?void 0:i.disableProviderPing)||!1}static async init(i){const t=new $c(i);return await t.initialize(),t}async request(i,t){const[n,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:aa({},i),chainId:`${n}:${a}`,topic:this.session.topic})}sendAsync(i,t,n){this.request(i,n).then(a=>t(null,a)).catch(a=>t(a,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var i;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(i=this.session)==null?void 0:i.topic,reason:tr("USER_DISCONNECTED")}),await this.cleanup()}async connect(i){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(i),await this.cleanupPendingPairings(),!i.skipPairing)return await this.pair(i.pairingTopic)}on(i,t){this.events.on(i,t)}once(i,t){this.events.once(i,t)}removeListener(i,t){this.events.removeListener(i,t)}off(i,t){this.events.off(i,t)}get isWalletConnect(){return!0}async pair(i){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:a}=await this.client.connect({pairingTopic:i,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=GE(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==mf)throw u;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(i,t){try{if(!this.session)return;const[n,a]=this.validateChain(i);this.getProvider(n).setDefaultChain(a,t)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(i={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(pn(t)){for(const n of t)i.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const i=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[i]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await $E.init({logger:this.providerOpts.logger||Sl,relayUrl:this.providerOpts.relayUrl||FE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const i=[...new Set(Object.keys(this.session.namespaces).map(t=>Un(t)))];sc("client",this.client),sc("events",this.events),sc("disableProviderPing",this.disableProviderPing),i.forEach(t=>{if(!this.session)return;const n=KE(t,this.session),a=_f(n),u=BE(this.namespaces,this.optionalNamespaces),f=ac(aa({},u[t]),{accounts:n,chains:a});switch(t){case"eip155":this.rpcProviders[t]=new JE({namespace:f});break;case"solana":this.rpcProviders[t]=new QE({namespace:f});break;case"cosmos":this.rpcProviders[t]=new YE({namespace:f});break;case"polkadot":this.rpcProviders[t]=new WE({namespace:f});break;case"cip34":this.rpcProviders[t]=new XE({namespace:f});break;case"elrond":this.rpcProviders[t]=new ZE({namespace:f});break;case"multiversx":this.rpcProviders[t]=new eI({namespace:f});break;case"near":this.rpcProviders[t]=new tI({namespace:f});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",i=>{this.events.emit("session_ping",i)}),this.client.on("session_event",i=>{const{params:t}=i,{event:n}=t;if(n.name==="accountsChanged"){const a=n.data;a&&pn(a)&&this.events.emit("accountsChanged",a.map(VE))}else if(n.name==="chainChanged"){const a=t.chainId,u=t.event.data,f=Un(a),y=nc(a)!==nc(u)?`${f}:${nc(u)}`:a;this.onChainChanged(y)}else this.events.emit(n.name,n.data);this.events.emit("session_event",i)}),this.client.on("session_update",({topic:i,params:t})=>{var n;const{namespaces:a}=t,u=(n=this.client)==null?void 0:n.session.get(i);this.session=ac(aa({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:i,params:t})}),this.client.on("session_delete",async i=>{await this.cleanup(),this.events.emit("session_delete",i),this.events.emit("disconnect",ac(aa({},tr("USER_DISCONNECTED")),{data:i.topic}))}),this.on(ai.DEFAULT_CHAIN_CHANGED,i=>{this.onChainChanged(i,!0)})}getProvider(i){if(!this.rpcProviders[i])throw new Error(`Provider not found: ${i}`);return this.rpcProviders[i]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(i=>{var t;this.getProvider(i).updateNamespace((t=this.session)==null?void 0:t.namespaces[i])})}setNamespaces(i){const{namespaces:t,optionalNamespaces:n,sessionProperties:a}=i;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=a,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(i){const[t,n]=(i==null?void 0:i.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map(f=>Un(f)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const a=Un(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[i]=this.validateChain();return await this.getProvider(i).requestAccounts()}onChainChanged(i,t=!1){var n;if(!this.namespaces)return;const[a,u]=this.validateChain(i);t||this.getProvider(a).setDefaultChain(u),((n=this.namespaces[a])!=null?n:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(i,t){this.client.core.storage.setItem(`${Pl}/${i}`,t)}async getFromStore(i){return await this.client.core.storage.getItem(`${Pl}/${i}`)}}const oI=$c,cI="wc",uI="ethereum_provider",hI=`${cI}@2:${uI}:`,lI="https://rpc.walletconnect.com/v1/",_c=["eth_sendTransaction","personal_sign"],fI=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],bc=["chainChanged","accountsChanged"],pI=["chainChanged","accountsChanged","message","disconnect","connect"];var dI=Object.defineProperty,gI=Object.defineProperties,yI=Object.getOwnPropertyDescriptors,Nl=Object.getOwnPropertySymbols,vI=Object.prototype.hasOwnProperty,mI=Object.prototype.propertyIsEnumerable,$l=(o,i,t)=>i in o?dI(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,kn=(o,i)=>{for(var t in i||(i={}))vI.call(i,t)&&$l(o,t,i[t]);if(Nl)for(var t of Nl(i))mI.call(i,t)&&$l(o,t,i[t]);return o},Fl=(o,i)=>gI(o,yI(i));function da(o){return Number(o[0].split(":")[1])}function oc(o){return`0x${o.toString(16)}`}function wI(o){const{chains:i,optionalChains:t,methods:n,optionalMethods:a,events:u,optionalEvents:f,rpcMap:y}=o;if(!pn(i))throw new Error("Invalid chains");const w={chains:i,methods:n||_c,events:u||bc,rpcMap:kn({},i.length?{[da(i)]:y[da(i)]}:{})},d=u==null?void 0:u.filter(L=>!bc.includes(L)),_=n==null?void 0:n.filter(L=>!_c.includes(L));if(!t&&!f&&!a&&!(d!=null&&d.length)&&!(_!=null&&_.length))return{required:i.length?w:void 0};const O=(d==null?void 0:d.length)&&(_==null?void 0:_.length)||!t,P={chains:[...new Set(O?w.chains.concat(t||[]):t)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:fI))],events:[...new Set(w.events.concat(f!=null&&f.length?f:pI))],rpcMap:y};return{required:i.length?w:void 0,optional:t.length?P:void 0}}class Fc{constructor(){this.events=new kr.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=hI,this.on=(i,t)=>(this.events.on(i,t),this),this.once=(i,t)=>(this.events.once(i,t),this),this.removeListener=(i,t)=>(this.events.removeListener(i,t),this),this.off=(i,t)=>(this.events.off(i,t),this),this.parseAccount=i=>this.isCompatibleChainId(i)?this.parseAccountId(i).address:i,this.signer={},this.rpc={}}static async init(i){const t=new Fc;return await t.initialize(i),t}async request(i){return await this.signer.request(i,this.formatChainId(this.chainId))}sendAsync(i,t){this.signer.sendAsync(i,t,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(i){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(i);const{required:t,optional:n}=wI(this.rpc);try{const a=await new Promise(async(f,y)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),y(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Fl(kn({namespaces:kn({},t&&{[this.namespace]:t})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:i==null?void 0:i.pairingTopic})).then(d=>{f(d)}).catch(d=>{y(new Error(d.message))})});if(!a)return;const u=zm(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:oc(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",i=>{const{params:t}=i,{event:n}=t;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",i)}),this.signer.on("chainChanged",i=>{const t=parseInt(i);this.chainId=t,this.events.emit("chainChanged",oc(this.chainId)),this.persist()}),this.signer.on("session_update",i=>{this.events.emit("session_update",i)}),this.signer.on("session_delete",i=>{this.reset(),this.events.emit("session_delete",i),this.events.emit("disconnect",Fl(kn({},tr("USER_DISCONNECTED")),{data:i.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",i=>{var t,n;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(n=this.modal)==null||n.openModal({uri:i})),this.events.emit("display_uri",i)})}switchEthereumChain(i){this.request({method:"wallet_switchEthereumChain",params:[{chainId:i.toString(16)}]})}isCompatibleChainId(i){return typeof i=="string"?i.startsWith(`${this.namespace}:`):!1}formatChainId(i){return`${this.namespace}:${i}`}parseChainId(i){return Number(i.split(":")[1])}setChainIds(i){const t=i.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",oc(this.chainId)),this.persist())}setChainId(i){if(this.isCompatibleChainId(i)){const t=this.parseChainId(i);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(i){const[t,n,a]=i.split(":");return{chainId:`${t}:${n}`,address:a}}setAccounts(i){this.accounts=i.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(i){var t,n;const a=(t=i==null?void 0:i.chains)!=null?t:[],u=(n=i==null?void 0:i.optionalChains)!=null?n:[],f=a.concat(u);if(!f.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const y=a.length?(i==null?void 0:i.methods)||_c:[],w=a.length?(i==null?void 0:i.events)||bc:[],d=(i==null?void 0:i.optionalMethods)||[],_=(i==null?void 0:i.optionalEvents)||[],O=(i==null?void 0:i.rpcMap)||this.buildRpcMap(f,i.projectId),P=(i==null?void 0:i.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(L=>this.formatChainId(L)),optionalChains:u.map(L=>this.formatChainId(L)),methods:y,events:w,optionalMethods:d,optionalEvents:_,rpcMap:O,showQrModal:!!(i!=null&&i.showQrModal),qrModalOptions:P,projectId:i.projectId,metadata:i.metadata}}buildRpcMap(i,t){const n={};return i.forEach(a=>{n[a]=this.getRpcUrl(a,t)}),n}async initialize(i){if(this.rpc=this.getRpcConfig(i),this.chainId=this.rpc.chains.length?da(this.rpc.chains):da(this.rpc.optionalChains),this.signer=await oI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:i.disableProviderPing,relayUrl:i.relayUrl,storageOptions:i.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:n}=await Mm(()=>import("./index-60c46f87.js").then(a=>a.i),["assets/index-60c46f87.js","assets/index-c212f3ee.js","assets/index-882a2daf.css"]);t=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(kn({walletConnectVersion:2,projectId:this.rpc.projectId,standaloneChains:this.rpc.chains},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(i){if(!i)return;const{chains:t,optionalChains:n,rpcMap:a}=i;t&&pn(t)&&(this.rpc.chains=t.map(u=>this.formatChainId(u)),t.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),n&&pn(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(u=>this.formatChainId(u)),n.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(i,t){var n;return((n=this.rpc.rpcMap)==null?void 0:n[i])||`${lI}?chainId=eip155:${i}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const i=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${i}`]?this.session.namespaces[`${this.namespace}:${i}`]:this.session.namespaces[this.namespace];this.setChainIds(i?[this.formatChainId(i)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(i){return typeof i=="string"||i instanceof String?[this.parseAccount(i)]:i.map(t=>this.parseAccount(t))}}const DI=Fc;export{DI as EthereumProvider,pI as OPTIONAL_EVENTS,fI as OPTIONAL_METHODS,bc as REQUIRED_EVENTS,_c as REQUIRED_METHODS,Fc as default}; diff --git a/examples/vite/dist/index.html b/examples/vite/dist/index.html index af1c2dad60..b870e11e39 100644 --- a/examples/vite/dist/index.html +++ b/examples/vite/dist/index.html @@ -5,7 +5,7 @@ wagmi - + diff --git a/examples/vite/src/contracts/WagmiMintExample.s.sol b/examples/vite/src/contracts/WagmiMintExample.s.sol new file mode 100644 index 0000000000..34855d9aa7 --- /dev/null +++ b/examples/vite/src/contracts/WagmiMintExample.s.sol @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.8.16; + +import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; +import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; +import "@openzeppelin/contracts/utils/Base64.sol"; + +/// @author Wagmi +/// @author EVMts +/// @title WagmiMintExample +/// @notice An example token original from the wagmi template +contract WagmiMintExample is ERC721 { + uint256 public totalSupply; + + uint256 private nextTokenId = 0; + + constructor() ERC721("wagmi", "WAGMI") {} + + /// @notice Allows an address to mint + function mint() external { + uint256 tokenId = nextTokenId; + while (_exists(tokenId)) { + unchecked { + tokenId++; + } + } + _safeMint(msg.sender, tokenId); + unchecked { + totalSupply++; + nextTokenId = tokenId + 1; + } + } + + /// @notice Returns the token URI for a given token by ID + /// @param tokenId Token ID to mint. + function mint(uint256 tokenId) external { + require(!_exists(tokenId), "Token ID is taken"); + _safeMint(msg.sender, tokenId); + unchecked { + totalSupply++; + } + } + + /// @notice Returns the token URI for a given token by ID + /// @param tokenId Token ID to query. + /// @return uri_ Token URI for the given token by ID. + function tokenURI( + uint256 tokenId + ) public pure override returns (string memory) { + uint256 foregroundHue = uint256( + keccak256(abi.encodePacked("foreground", tokenId)) + ) % 360; + uint256 backgroundHue = uint256( + keccak256(abi.encodePacked("background", tokenId)) + ) % 360; + string memory json = Base64.encode( + bytes( + abi.encodePacked( + '{"name": "wagmi #', + toString(tokenId), + '", "image": "data:image/svg+xml;base64,', + Base64.encode( + bytes( + abi.encodePacked( + '' + ) + ) + ), + '"}' + ) + ) + ); + string memory output = string( + abi.encodePacked("data:application/json;base64,", json) + ); + return output; + } + + function toString(uint256 value) internal pure returns (string memory) { + // Inspired by OraclizeAPI's implementation - MIT licence + // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol + + if (value == 0) { + return "0"; + } + uint256 temp = value; + uint256 digits; + while (temp != 0) { + digits++; + temp /= 10; + } + bytes memory buffer = new bytes(digits); + while (value != 0) { + digits -= 1; + buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); + value /= 10; + } + return string(buffer); + } +} diff --git a/packages/core/docs/modules.md b/packages/core/docs/modules.md index bea950c58f..a042c9589d 100644 --- a/packages/core/docs/modules.md +++ b/packages/core/docs/modules.md @@ -18,7 +18,7 @@ ### EvmtsContract -Ƭ **EvmtsContract**\<`TName`, `THumanReadableAbi`\>: `Object` +Ƭ **EvmtsContract**\<`TName`, `THumanReadableAbi`, `TBytecode`\>: `Object` #### Type parameters @@ -26,12 +26,14 @@ | :------ | :------ | | `TName` | extends `string` | | `THumanReadableAbi` | extends `ReadonlyArray`\<`string`\> | +| `TBytecode` | extends `Hex` \| `undefined` | #### Type declaration | Name | Type | | :------ | :------ | | `abi` | `ParseAbi`\<`THumanReadableAbi`\> | +| `bytecode` | `TBytecode` | | `events` | `Events`\<`TName`, `THumanReadableAbi`\> | | `humanReadableAbi` | `THumanReadableAbi` | | `name` | `TName` | @@ -40,13 +42,13 @@ #### Defined in -[packages/core/src/EvmtsContract.ts:6](https://github.com/evmts/evmts-monorepo/blob/main/packages/core/src/EvmtsContract.ts#L6) +[packages/core/src/EvmtsContract.ts:7](https://github.com/evmts/evmts-monorepo/blob/main/packages/core/src/EvmtsContract.ts#L7) ## Functions ### evmtsContractFactory -▸ **evmtsContractFactory**\<`TName`, `THumanReadableAbi`\>(`«destructured»`): [`EvmtsContract`](modules.md#evmtscontract)\<`TName`, `THumanReadableAbi`\> +▸ **evmtsContractFactory**\<`TName`, `THumanReadableAbi`, `TBytecode`\>(`«destructured»`): [`EvmtsContract`](modules.md#evmtscontract)\<`TName`, `THumanReadableAbi`, `TBytecode`\> #### Type parameters @@ -54,20 +56,21 @@ | :------ | :------ | | `TName` | extends `string` | | `THumanReadableAbi` | extends readonly `string`[] | +| `TBytecode` | extends `undefined` \| \`0x$\{string}\` | #### Parameters | Name | Type | | :------ | :------ | -| `«destructured»` | `Pick`\<[`EvmtsContract`](modules.md#evmtscontract)\<`TName`, `THumanReadableAbi`\>, ``"name"`` \| ``"humanReadableAbi"``\> | +| `«destructured»` | `Pick`\<[`EvmtsContract`](modules.md#evmtscontract)\<`TName`, `THumanReadableAbi`, `TBytecode`\>, ``"name"`` \| ``"humanReadableAbi"`` \| ``"bytecode"``\> | #### Returns -[`EvmtsContract`](modules.md#evmtscontract)\<`TName`, `THumanReadableAbi`\> +[`EvmtsContract`](modules.md#evmtscontract)\<`TName`, `THumanReadableAbi`, `TBytecode`\> #### Defined in -[packages/core/src/evmtsContractFactory.ts:7](https://github.com/evmts/evmts-monorepo/blob/main/packages/core/src/evmtsContractFactory.ts#L7) +[packages/core/src/evmtsContractFactory.ts:8](https://github.com/evmts/evmts-monorepo/blob/main/packages/core/src/evmtsContractFactory.ts#L8) ___ diff --git a/packages/core/src/EvmtsContract.ts b/packages/core/src/EvmtsContract.ts index 1e23197cd7..d045437e94 100644 --- a/packages/core/src/EvmtsContract.ts +++ b/packages/core/src/EvmtsContract.ts @@ -2,12 +2,15 @@ import type { Events } from './event/Event' import type { Read } from './read/Read' import type { Write } from './write/Write' import type { ParseAbi } from 'abitype' +import type { Hex } from 'viem' export type EvmtsContract< TName extends string, THumanReadableAbi extends ReadonlyArray, + TBytecode extends Hex | undefined, > = { abi: ParseAbi + bytecode: TBytecode humanReadableAbi: THumanReadableAbi name: TName events: Events diff --git a/packages/core/src/event/eventFactory.spec.ts b/packages/core/src/event/eventFactory.spec.ts index 70b6a05a10..1c7c81ba1c 100644 --- a/packages/core/src/event/eventFactory.spec.ts +++ b/packages/core/src/event/eventFactory.spec.ts @@ -7,6 +7,7 @@ import { describe, expect, it } from 'vitest' const contract = evmtsContractFactory({ humanReadableAbi: formatAbi(dummyAbi), name: 'DummyContract', + bytecode: undefined, }) const dummyAbiNoEvent = dummyAbi.filter((abi) => abi.type !== 'event') @@ -14,6 +15,7 @@ const dummyAbiNoEvent = dummyAbi.filter((abi) => abi.type !== 'event') const contractNoEvent = evmtsContractFactory({ humanReadableAbi: formatAbi(dummyAbiNoEvent), name: 'DummyContract', + bytecode: undefined, }) describe(eventsFactory.name, () => { diff --git a/packages/core/src/evmtsContractFactory.spec.ts b/packages/core/src/evmtsContractFactory.spec.ts index d70c6bb46d..b607b02081 100644 --- a/packages/core/src/evmtsContractFactory.spec.ts +++ b/packages/core/src/evmtsContractFactory.spec.ts @@ -5,6 +5,7 @@ import { describe, expect, it } from 'vitest' describe(evmtsContractFactory.name, () => { const contract = evmtsContractFactory({ + bytecode: undefined, humanReadableAbi: formatAbi(dummyAbi), name: 'DummyContract', }) diff --git a/packages/core/src/evmtsContractFactory.ts b/packages/core/src/evmtsContractFactory.ts index 8af74df599..8932318dee 100644 --- a/packages/core/src/evmtsContractFactory.ts +++ b/packages/core/src/evmtsContractFactory.ts @@ -3,22 +3,26 @@ import { eventsFactory } from './event/eventFactory' import { readFactory } from './read/readFactory' import { writeFactory } from './write/writeFactory' import { parseAbi } from 'abitype' +import type { Hex } from 'viem' export const evmtsContractFactory = < TName extends string, THumanReadableAbi extends readonly string[], + TBytecode extends Hex | undefined, >({ humanReadableAbi, name, + bytecode, }: Pick< - EvmtsContract, - 'name' | 'humanReadableAbi' ->): EvmtsContract => { + EvmtsContract, + 'name' | 'humanReadableAbi' | 'bytecode' +>): EvmtsContract => { const abi = parseAbi(humanReadableAbi as any) const methods = abi.filter((field) => { return field.type === 'function' }) return { + bytecode, name, abi: abi as any, humanReadableAbi, diff --git a/packages/core/src/read/readFactory.spec.ts b/packages/core/src/read/readFactory.spec.ts index 1ec1524363..0f72b351cb 100644 --- a/packages/core/src/read/readFactory.spec.ts +++ b/packages/core/src/read/readFactory.spec.ts @@ -7,6 +7,7 @@ import { describe, expect, it } from 'vitest' const contract = evmtsContractFactory({ humanReadableAbi: formatAbi(dummyAbi), name: 'DummyContract', + bytecode: undefined, }) describe(readFactory.name, () => { diff --git a/packages/core/src/write/writeFactory.spec.ts b/packages/core/src/write/writeFactory.spec.ts index 1db19a1fd2..1720aeac1b 100644 --- a/packages/core/src/write/writeFactory.spec.ts +++ b/packages/core/src/write/writeFactory.spec.ts @@ -7,6 +7,7 @@ import { describe, expect, it } from 'vitest' const contract = evmtsContractFactory({ humanReadableAbi: formatAbi(dummyAbi), name: 'DummyContract', + bytecode: undefined, }) describe('write', () => {