@dodoex/wallet-web3 0.0.43-0 → 0.0.43-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tslib-f431f494.js +1 -0
- package/dist/alchemy-provider-5870b6fa-031aa534.js +1 -0
- package/dist/alchemy-websocket-provider-213da986-9c604721.js +1 -0
- package/dist/blocto-3a3f2a16.js +1 -0
- package/dist/ccip-1ab01249.js +1 -0
- package/dist/cjs/__tslib-aa1ec370.cjs +1 -0
- package/dist/cjs/alchemy-provider-5870b6fa-d45451fd.cjs +1 -0
- package/dist/cjs/alchemy-websocket-provider-213da986-10a4b9e7.cjs +1 -0
- package/dist/cjs/blocto-f0c00f7e.cjs +1 -0
- package/dist/cjs/ccip-b407d523.cjs +1 -0
- package/dist/cjs/{draggabilly-2a4e5cff.cjs → draggabilly-5bb01089.cjs} +1 -1
- package/dist/cjs/ethers-d83228c8.cjs +1 -0
- package/dist/cjs/id-36ab9f54.cjs +1 -0
- package/dist/cjs/index-05d4740c.cjs +1 -0
- package/dist/cjs/index-12d8477a.cjs +1 -0
- package/dist/cjs/{index-38a6dc28.cjs → index-169ca3cc.cjs} +3 -3
- package/dist/cjs/index-264347ec.cjs +1 -0
- package/dist/cjs/{index-eb09e54d.cjs → index-35edc6a0.cjs} +1 -1
- package/dist/cjs/index-4f989ef8.cjs +1 -0
- package/dist/cjs/{index-f78f51c3.cjs → index-58fb77bb.cjs} +1 -1
- package/dist/cjs/index-8aff1799.cjs +6 -0
- package/dist/cjs/{index-df8e5839.cjs → index-9f2a69d5.cjs} +1 -1
- package/dist/{index-c8e896d5.js → cjs/index-a56bd128.cjs} +2 -2
- package/dist/cjs/index-dac27dde.cjs +1 -0
- package/dist/cjs/index-e628770e.cjs +15 -0
- package/dist/cjs/index-f21b6f0e.cjs +28 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.es-4b60988b.cjs +9 -0
- package/dist/cjs/{interface-a109a0d8.cjs → interface-fe98cff9.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-06843b62.cjs → lib-typedarrays-bdffcb4b.cjs} +1 -1
- package/dist/cjs/{portis-92310876.cjs → portis-9753b80e.cjs} +1 -1
- package/dist/cjs/provider-4316abb1.cjs +1 -0
- package/dist/cjs/providers/connector/alchemy/index.d.ts +136 -0
- package/dist/cjs/providers/connector/alchemy/provider.d.ts +138 -0
- package/dist/cjs/providers/connector/alchemy/signer.d.ts +23 -0
- package/dist/cjs/providers/connector/index.d.ts +175 -43
- package/dist/cjs/providers/connector/ledgerUSB/index.d.ts +43 -43
- package/dist/cjs/providers/connector/ledgerUSB/provider.d.ts +10 -10
- package/dist/cjs/providers/connector/types.d.ts +4 -0
- package/dist/cjs/providers/connector/uniPass/index.d.ts +43 -43
- package/dist/cjs/providers/connector/uniPass/provider.d.ts +10 -10
- package/dist/cjs/providers/wallets/index.d.ts +2 -1
- package/dist/cjs/providers/wallets/standalone.d.ts +1 -0
- package/dist/cjs/providers/wallets/types.d.ts +1 -0
- package/dist/cjs/rainbow-a0174e93.cjs +1 -0
- package/dist/cjs/{sha224-a9b32339.cjs → sha224-c50de689.cjs} +1 -1
- package/dist/cjs/sha256-42051c0c.cjs +1 -0
- package/dist/cjs/typed-data-0289b33b.cjs +1 -0
- package/dist/cjs/uAuth-f3a2ae4c.cjs +1 -0
- package/dist/cjs/walletConnect-8352f639.cjs +1 -0
- package/dist/cjs/walletLink-9d46eb6c.cjs +3 -0
- package/dist/{draggabilly-12ef51c6.js → draggabilly-61827e22.js} +1 -1
- package/dist/ethers-f88617c3.js +1 -0
- package/dist/id-25fee670.js +1 -0
- package/dist/index-1f8e0dfc.js +1 -0
- package/dist/{cjs/index-afa45043.cjs → index-253349c9.js} +2 -2
- package/dist/{index-9b0e9b64.js → index-47f5d198.js} +3 -3
- package/dist/index-4a956840.js +15 -0
- package/dist/{index-0ee5ef8d.js → index-65d96278.js} +1 -1
- package/dist/index-81bcae82.js +1 -0
- package/dist/index-ccba79a0.js +1 -0
- package/dist/index-d7a9192b.js +28 -0
- package/dist/index-d95400e0.js +1 -0
- package/dist/index-eaf1a7e1.js +1 -0
- package/dist/{index-e0d3617a.js → index-f08d6a6b.js} +1 -1
- package/dist/index-f7199a2b.js +1 -0
- package/dist/{index-2e23cc8c.js → index-f99975f1.js} +2 -2
- package/dist/index.es-4b977259.js +9 -0
- package/dist/index.js +1 -1
- package/dist/{interface-a6f33bb4.js → interface-1e8a49c4.js} +1 -1
- package/dist/{lib-typedarrays-60e6aa6b.js → lib-typedarrays-fa31fa82.js} +1 -1
- package/dist/{portis-19afe2ea.js → portis-6f76b8e1.js} +1 -1
- package/dist/provider-036433d0.js +1 -0
- package/dist/providers/connector/alchemy/index.d.ts +136 -0
- package/dist/providers/connector/alchemy/provider.d.ts +138 -0
- package/dist/providers/connector/alchemy/signer.d.ts +23 -0
- package/dist/providers/connector/index.d.ts +175 -43
- package/dist/providers/connector/ledgerUSB/index.d.ts +43 -43
- package/dist/providers/connector/ledgerUSB/provider.d.ts +10 -10
- package/dist/providers/connector/types.d.ts +4 -0
- package/dist/providers/connector/uniPass/index.d.ts +43 -43
- package/dist/providers/connector/uniPass/provider.d.ts +10 -10
- package/dist/providers/wallets/index.d.ts +2 -1
- package/dist/providers/wallets/standalone.d.ts +1 -0
- package/dist/providers/wallets/types.d.ts +1 -0
- package/dist/rainbow-3661e3f6.js +1 -0
- package/dist/sha224-8a20d072.js +1 -0
- package/dist/sha256-bfa39a7c.js +1 -0
- package/dist/typed-data-78d999f6.js +1 -0
- package/dist/uAuth-f0f55294.js +1 -0
- package/dist/walletConnect-9def1feb.js +1 -0
- package/dist/walletLink-ec8614d0.js +3 -0
- package/package.json +11 -4
- package/dist/DefaultJsonRpcProvider-d03291cf.js +0 -1
- package/dist/__node-resolve_empty-7cc52421.js +0 -1
- package/dist/__tslib-c18c68ca.js +0 -1
- package/dist/blocto-4f268393.js +0 -1
- package/dist/bn-cd5d9c7e.js +0 -1
- package/dist/browser-ponyfill-0d656c3b.js +0 -1
- package/dist/cjs/DefaultJsonRpcProvider-fe0308e2.cjs +0 -1
- package/dist/cjs/__node-resolve_empty-8a1ddcdf.cjs +0 -1
- package/dist/cjs/__tslib-eb9eb2b7.cjs +0 -1
- package/dist/cjs/blocto-d45a7d82.cjs +0 -1
- package/dist/cjs/bn-94c30d2e.cjs +0 -1
- package/dist/cjs/browser-ponyfill-b3718e5b.cjs +0 -1
- package/dist/cjs/ethers-f94c032f.cjs +0 -1
- package/dist/cjs/id-52024487.cjs +0 -1
- package/dist/cjs/index-0740e7fe.cjs +0 -1
- package/dist/cjs/index-2eb62a28.cjs +0 -15
- package/dist/cjs/index-8a11ae09.cjs +0 -1
- package/dist/cjs/index-8cd59ca8.cjs +0 -1
- package/dist/cjs/index-9dc5efa7.cjs +0 -1
- package/dist/cjs/index-d886349d.cjs +0 -9
- package/dist/cjs/index-dd475117.cjs +0 -1
- package/dist/cjs/index-e0461bd6.cjs +0 -6
- package/dist/cjs/index-f6a4cadd.cjs +0 -1
- package/dist/cjs/index.es-e2c97fd8.cjs +0 -9
- package/dist/cjs/provider-a2e5d503.cjs +0 -1
- package/dist/cjs/rainbow-8c27c228.cjs +0 -1
- package/dist/cjs/sha256-2e691c21.cjs +0 -1
- package/dist/cjs/uAuth-323e7587.cjs +0 -1
- package/dist/cjs/walletConnect-39af2510.cjs +0 -1
- package/dist/cjs/walletLink-cb148ef1.cjs +0 -3
- package/dist/ethers-20b88c06.js +0 -1
- package/dist/id-5fb9d202.js +0 -1
- package/dist/index-198785fa.js +0 -1
- package/dist/index-53bc60c6.js +0 -1
- package/dist/index-6e0697ab.js +0 -9
- package/dist/index-8d5315df.js +0 -1
- package/dist/index-a35d2562.js +0 -15
- package/dist/index-d00482ad.js +0 -1
- package/dist/index-d1fdba35.js +0 -1
- package/dist/index-d605fbc1.js +0 -1
- package/dist/index-ec6e039e.js +0 -1
- package/dist/index.es-9e9bc056.js +0 -9
- package/dist/provider-6f989b4e.js +0 -1
- package/dist/rainbow-463c6dc0.js +0 -1
- package/dist/sha224-fc7a621b.js +0 -1
- package/dist/sha256-3d0dbba6.js +0 -1
- package/dist/uAuth-d42a0af6.js +0 -1
- package/dist/walletConnect-380a5d1c.js +0 -1
- package/dist/walletLink-b1651399.js +0 -3
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{c as e,g as t,_ as r,i as n,d as i}from"./index-6e0697ab.js";import{e as s}from"./index-d00482ad.js";import o from"events";import a from"buffer";import{r as c}from"./__node-resolve_empty-7cc52421.js";import{i as l}from"./inherits_browser-51bb8c3c.js";import{s as u}from"./index-6be6f872.js";import{r as d}from"./__tslib-c18c68ca.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/address";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/properties";import"@ethersproject/transactions";import"@ethersproject/bytes";import"util";var h={},f={},p={},g={},_={};Object.defineProperty(_,"__esModule",{value:!0}),_.errorValues=_.standardErrorCodes=void 0,_.standardErrorCodes={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,unsupportedChain:4902}},_.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."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var m={};Object.defineProperty(m,"__esModule",{value:!0}),m.standardErrors=void 0;const y=_;function b(e){if(e&&Number.isInteger(e)){const n=e.toString();if(t=y.errorValues,r=n,Object.prototype.hasOwnProperty.call(t,r))return y.errorValues[n].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return"Unspecified server error."}var t,r;return"Unspecified error message."}function v(e,t){const[r,n]=E(t);return new S(e,r||b(e),n)}function w(e,t){const[r,n]=E(t);return new k(e,r||b(e),n)}function E(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}m.standardErrors={rpc:{parse:e=>v(y.standardErrorCodes.rpc.parse,e),invalidRequest:e=>v(y.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>v(y.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>v(y.standardErrorCodes.rpc.methodNotFound,e),internal:e=>v(y.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return v(t,e)},invalidInput:e=>v(y.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>v(y.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>v(y.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>v(y.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>v(y.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>v(y.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>w(y.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>w(y.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>w(y.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>w(y.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>w(y.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>w(y.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new k(t,r,n)}}};class S extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}}class k extends S{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=void 0;var t=_;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});var r=m;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}})}(g),Object.defineProperty(p,"__esModule",{value:!0}),p.getErrorForInvalidRequestArgs=void 0;const C=g;p.getErrorForInvalidRequestArgs=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return C.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:r}=e;return"string"!=typeof t||0===t.length?C.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e}):void 0===r||Array.isArray(r)||"object"==typeof r&&null!==r?void 0:C.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e})};var R,I={},x={};function M(){return e=>e}Object.defineProperty(x,"__esModule",{value:!0}),x.ProviderType=x.RegExpString=x.IntNumber=x.BigIntString=x.AddressString=x.HexString=x.OpaqueType=void 0,x.OpaqueType=M,x.HexString=e=>e,x.AddressString=e=>e,x.BigIntString=e=>e,x.IntNumber=function(e){return Math.floor(e)},x.RegExpString=e=>e,function(e){e.CoinbaseWallet="CoinbaseWallet",e.MetaMask="MetaMask",e.Unselected=""}(R||(x.ProviderType=R={})),Object.defineProperty(I,"__esModule",{value:!0}),I.showDeprecationWarning=I.areAddressArraysEqual=I.getFavicon=I.range=I.isBigNumber=I.ensureParsedJSONObject=I.ensureBigInt=I.ensureRegExpString=I.ensureIntNumber=I.ensureBuffer=I.ensureAddressString=I.ensureEvenLengthHexString=I.ensureHexString=I.isHexString=I.prepend0x=I.strip0x=I.has0xPrefix=I.hexStringFromIntNumber=I.intNumberFromHexString=I.bigIntStringFromBigInt=I.hexStringFromBuffer=I.hexStringToUint8Array=I.uint8ArrayToHex=I.randomBytesHex=void 0;const T=g,A=x,L=/^[0-9]*$/,P=/^[a-f0-9]*$/;function N(e){return[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function j(e){return e.startsWith("0x")||e.startsWith("0X")}function B(e){return j(e)?e.slice(2):e}function O(e){return j(e)?`0x${e.slice(2)}`:`0x${e}`}function F(e){if("string"!=typeof e)return!1;const t=B(e).toLowerCase();return P.test(t)}function D(e,t=!1){if("string"==typeof e){const r=B(e).toLowerCase();if(P.test(r))return(0,A.HexString)(t?`0x${r}`:r)}throw T.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function U(e,t=!1){let r=D(e,!1);return r.length%2==1&&(r=(0,A.HexString)(`0${r}`)),t?(0,A.HexString)(`0x${r}`):r}function H(e){if("number"==typeof e&&Number.isInteger(e))return(0,A.IntNumber)(e);if("string"==typeof e){if(L.test(e))return(0,A.IntNumber)(Number(e));if(F(e))return(0,A.IntNumber)(Number(BigInt(U(e,!0))))}throw T.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}function W(e){if(null==e||"function"!=typeof e.constructor)return!1;const{constructor:t}=e;return"function"==typeof t.config&&"number"==typeof t.EUCLID}I.randomBytesHex=function(e){return N(crypto.getRandomValues(new Uint8Array(e)))},I.uint8ArrayToHex=N,I.hexStringToUint8Array=function(e){return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},I.hexStringFromBuffer=function(e,t=!1){const r=e.toString("hex");return(0,A.HexString)(t?`0x${r}`:r)},I.bigIntStringFromBigInt=function(e){return(0,A.BigIntString)(e.toString(10))},I.intNumberFromHexString=function(e){return(0,A.IntNumber)(Number(BigInt(U(e,!0))))},I.hexStringFromIntNumber=function(e){return(0,A.HexString)(`0x${BigInt(e).toString(16)}`)},I.has0xPrefix=j,I.strip0x=B,I.prepend0x=O,I.isHexString=F,I.ensureHexString=D,I.ensureEvenLengthHexString=U,I.ensureAddressString=function(e){if("string"==typeof e){const t=B(e).toLowerCase();if(F(t)&&40===t.length)return(0,A.AddressString)(O(t))}throw T.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)},I.ensureBuffer=function(e){if(Buffer.isBuffer(e))return e;if("string"==typeof e){if(F(e)){const t=U(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw T.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)},I.ensureIntNumber=H,I.ensureRegExpString=function(e){if(e instanceof RegExp)return(0,A.RegExpString)(e.toString());throw T.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)},I.ensureBigInt=function(e){if(null!==e&&("bigint"==typeof e||W(e)))return BigInt(e.toString(10));if("number"==typeof e)return BigInt(H(e));if("string"==typeof e){if(L.test(e))return BigInt(e);if(F(e))return BigInt(U(e,!0))}throw T.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)},I.ensureParsedJSONObject=function(e){if("string"==typeof e)return JSON.parse(e);if("object"==typeof e)return e;throw T.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)},I.isBigNumber=W,I.range=function(e,t){return Array.from({length:t-e},((t,r)=>e+r))},I.getFavicon=function(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`},I.areAddressArraysEqual=function(e,t){return e.length===t.length&&e.every(((e,r)=>e===t[r]))},I.showDeprecationWarning=function(e,t){console.warn(`EIP1193Provider: ${e} is deprecated. Please ${t} instead.`)};var q={},V={};Object.defineProperty(V,"__esModule",{value:!0}),V.filterFromParam=V.FilterPolyfill=void 0;const z=x,$=I;function J(e){return{fromBlock:G(e.fromBlock),toBlock:G(e.toBlock),addresses:void 0===e.address?null:Array.isArray(e.address)?e.address:[e.address],topics:e.topics||[]}}function K(e){const t={fromBlock:Z(e.fromBlock),toBlock:Z(e.toBlock),topics:e.topics};return null!==e.addresses&&(t.address=e.addresses),t}function G(e){if(void 0===e||"latest"===e||"pending"===e)return"latest";if("earliest"===e)return(0,z.IntNumber)(0);if((0,$.isHexString)(e))return(0,$.intNumberFromHexString)(e);throw new Error(`Invalid block option: ${String(e)}`)}function Z(e){return"latest"===e?e:(0,$.hexStringFromIntNumber)(e)}V.FilterPolyfill=class{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,z.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=e}async newFilter(e){const t=J(e),r=this.makeFilterId(),n=await this.setInitialCursorPosition(r,t.fromBlock);return console.info(`Installing new log filter(${r}):`,t,"initial cursor position:",n),this.logFilters.set(r,t),this.setFilterTimeout(r),(0,$.hexStringFromIntNumber)(r)}async newBlockFilter(){const e=this.makeFilterId(),t=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,t),this.blockFilters.add(e),this.setFilterTimeout(e),(0,$.hexStringFromIntNumber)(e)}async newPendingTransactionFilter(){const e=this.makeFilterId(),t=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,t),this.pendingTransactionFilters.add(e),this.setFilterTimeout(e),(0,$.hexStringFromIntNumber)(e)}uninstallFilter(e){const t=(0,$.intNumberFromHexString)(e);return console.info(`Uninstalling filter (${t})`),this.deleteFilter(t),!0}getFilterChanges(e){const t=(0,$.intNumberFromHexString)(e);return this.timeouts.has(t)&&this.setFilterTimeout(t),this.logFilters.has(t)?this.getLogFilterChanges(t):this.blockFilters.has(t)?this.getBlockFilterChanges(t):this.pendingTransactionFilters.has(t)?this.getPendingTransactionFilterChanges(t):Promise.resolve({error:{code:-32e3,message:"filter not found"}})}async getFilterLogs(e){const t=(0,$.intNumberFromHexString)(e),r=this.logFilters.get(t);return r?this.sendAsyncPromise({method:"eth_getLogs",params:[K(r)]}):{error:{code:-32e3,message:"filter not found"}}}makeFilterId(){return(0,z.IntNumber)(++this.nextFilterId)}async legacySendAsync(e,t){try{const r=await this.provider.request(e);t(null,{result:r})}catch(e){t(e,null)}}sendAsyncPromise(e){return new Promise(((t,r)=>{this.legacySendAsync(e,((e,n)=>e?r(e):Array.isArray(n)||null==n?r(new Error(`unexpected response received: ${JSON.stringify(n)}`)):void t(n)))}))}deleteFilter(e){console.info(`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 t=this.logFilters.get(e),r=this.cursors.get(e);if(!r||!t)return{error:{code:-32e3,message:"filter not found"}};const n=await this.getCurrentBlockHeight(),i="latest"===t.toBlock?n:t.toBlock;if(r>n)return{result:[]};if(r>Number(t.toBlock))return{result:[]};console.info(`Fetching logs from ${r} to ${i} for filter ${e}`);const s=await this.sendAsyncPromise({method:"eth_getLogs",params:[K(Object.assign(Object.assign({},t),{fromBlock:r,toBlock:i}))]});if(Array.isArray(s.result)){const t=s.result.map((e=>(0,$.intNumberFromHexString)(e.blockNumber||"0x0"))),n=Math.max(...t);if(n&&n>r){const t=(0,z.IntNumber)(n+1);console.info(`Moving cursor position for filter (${e}) from ${r} to ${t}`),this.cursors.set(e,t)}}return s}async getBlockFilterChanges(e){const t=this.cursors.get(e);if(!t)return{error:{code:-32e3,message:"filter not found"}};const r=await this.getCurrentBlockHeight();if(t>r)return{result:[]};console.info(`Fetching blocks from ${t} to ${r} for filter (${e})`);const n=(await Promise.all((0,$.range)(t,r+1).map((e=>this.getBlockHashByNumber((0,z.IntNumber)(e)))))).filter((e=>!!e)),i=(0,z.IntNumber)(t+n.length);return console.info(`Moving cursor position for filter (${e}) from ${t} to ${i}`),this.cursors.set(e,i),{result:n}}async getPendingTransactionFilterChanges(e){return Promise.resolve({result:[]})}async setInitialCursorPosition(e,t){const r=await this.getCurrentBlockHeight(),n="number"==typeof t&&t>r?t:r;return this.cursors.set(e,n),n}setFilterTimeout(e){const t=this.timeouts.get(e);t&&window.clearTimeout(t);const r=window.setTimeout((()=>{console.info(`Filter (${e}) timed out`),this.deleteFilter(e)}),3e5);this.timeouts.set(e,r)}async getCurrentBlockHeight(){const e=new Date;if(e.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=e;const t=await this._getCurrentBlockHeight();this.currentBlockHeight=t,this.resolvers.forEach((e=>e(t))),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise((e=>this.resolvers.push(e)))}async _getCurrentBlockHeight(){const{result:e}=await this.sendAsyncPromise({method:"eth_blockNumber",params:[]});return(0,$.intNumberFromHexString)((0,$.ensureHexString)(e))}async getBlockHashByNumber(e){var t;const r=null===(t=(await this.sendAsyncPromise({method:"eth_getBlockByNumber",params:[(0,$.hexStringFromIntNumber)(e),!1]})).result)||void 0===t?void 0:t.hash;return r?(0,$.ensureHexString)(r):null}},V.filterFromParam=J,Object.defineProperty(q,"__esModule",{value:!0}),q.FilterRequestHandler=void 0;const Q=V,Y=g,X=I;q.FilterRequestHandler=class{constructor({provider:e}){this.filterPolyfill=new Q.FilterPolyfill(e)}handleRequest(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_newFilter":return this.eth_newFilter(r);case"eth_newBlockFilter":return this.eth_newBlockFilter();case"eth_newPendingTransactionFilter":return this.eth_newPendingTransactionFilter();case"eth_getFilterChanges":return this.eth_getFilterChanges(r);case"eth_getFilterLogs":return this.eth_getFilterLogs(r);case"eth_uninstallFilter":return this.eth_uninstallFilter(r)}return Promise.reject(Y.standardErrors.rpc.methodNotFound())}async eth_newFilter(e){const t=e[0];return{result:await this.filterPolyfill.newFilter(t)}}async eth_newBlockFilter(){return{result:await this.filterPolyfill.newBlockFilter()}}async eth_newPendingTransactionFilter(){return{result:await this.filterPolyfill.newPendingTransactionFilter()}}async eth_uninstallFilter(e){const t=(0,X.ensureHexString)(e[0]);return{result:this.filterPolyfill.uninstallFilter(t)}}eth_getFilterChanges(e){const t=(0,X.ensureHexString)(e[0]);return this.filterPolyfill.getFilterChanges(t)}eth_getFilterLogs(e){const t=(0,X.ensureHexString)(e[0]);return this.filterPolyfill.getFilterLogs(t)}canHandleRequest(e){return["eth_newFilter","eth_newBlockFilter","eth_newPendingTransactionFilter","eth_getFilterChanges","eth_getFilterLogs"].includes(e.method)}};var ee={};Object.defineProperty(ee,"__esModule",{value:!0}),ee.StateRequestHandler=void 0;const te=g;ee.StateRequestHandler=class{async handleRequest(e,t,r){switch(e.method){case"eth_chainId":case"net_version":return r.id;case"eth_accounts":return this.eth_accounts(t);case"eth_coinbase":return this.eth_accounts(t)[0]}return Promise.reject(te.standardErrors.rpc.methodNotFound())}eth_accounts(e){if(!e)throw te.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before 'eth_accounts'");return e}canHandleRequest(e){return["eth_chainId","eth_accounts","eth_coinbase","net_version"].includes(e.method)}};var re={};Object.defineProperty(re,"__esModule",{value:!0}),re.RPCFetchRequestHandler=void 0;const ne=g;re.RPCFetchRequestHandler=class{canHandleRequest(e){return!0}async handleRequest(e,t,r){if(!r.rpcUrl)throw ne.standardErrors.rpc.internal("No RPC URL set for chain");const n=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),i=await window.fetch(r.rpcUrl,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json"}});return await i.json()}};var ie={},se={},oe={};Object.defineProperty(oe,"__esModule",{value:!0}),oe.LIB_VERSION=void 0,oe.LIB_VERSION="4.0.0-beta.0";var ae={};Object.defineProperty(ae,"__esModule",{value:!0}),ae.decryptContent=ae.encryptContent=ae.importKeyFromHexString=ae.exportKeyToHexString=ae.decrypt=ae.encrypt=ae.deriveSharedSecret=ae.generateKeyPair=void 0;const ce=I;async function le(e,t){const r=crypto.getRandomValues(new Uint8Array(12));return{iv:r,cipherText:await crypto.subtle.encrypt({name:"AES-GCM",iv:r},e,(new TextEncoder).encode(t))}}async function ue(e,{iv:t,cipherText:r}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,r);return(new TextDecoder).decode(n)}function de(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}ae.generateKeyPair=async function(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])},ae.deriveSharedSecret=async function(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])},ae.encrypt=le,ae.decrypt=ue,ae.exportKeyToHexString=async function(e,t){const r=de(e),n=await crypto.subtle.exportKey(r,t);return(0,ce.uint8ArrayToHex)(new Uint8Array(n))},ae.importKeyFromHexString=async function(e,t){const r=de(e),n=(0,ce.hexStringToUint8Array)(t).buffer;return await crypto.subtle.importKey(r,n,{name:"ECDH",namedCurve:"P-256"},!0,"private"===e?["deriveKey"]:[])},ae.encryptContent=async function(e,t){const r=JSON.stringify(e,((e,t)=>{if(!(t instanceof Error))return t;const r=t;return Object.assign(Object.assign({},r.code?{code:r.code}:{}),{message:r.message})}));return le(t,r)},ae.decryptContent=async function(e,t){return JSON.parse(await ue(t,e))};var he,fe={};Object.defineProperty(fe,"__esModule",{value:!0}),fe.SupportedEthereumMethods=void 0,function(e){e.EthRequestAccounts="eth_requestAccounts",e.EthSendTransaction="eth_sendTransaction",e.EthSignTransaction="eth_signTransaction",e.EthSendRawTransaction="eth_sendRawTransaction",e.EthSign="eth_sign",e.PersonalSign="personal_sign",e.EthSignTypedDataV1="eth_signTypedData_v1",e.EthSignTypedDataV3="eth_signTypedData_v3",e.EthSignTypedDataV4="eth_signTypedData_v4",e.WalletSwitchEthereumChain="wallet_switchEthereumChain",e.WalletAddEthereumChain="wallet_addEthereumChain"}(he||(fe.SupportedEthereumMethods=he={}));var pe={},ge={};Object.defineProperty(ge,"__esModule",{value:!0}),ge.ScopedLocalStorage=void 0;class _e{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let r=0;r<localStorage.length;r++){const n=localStorage.key(r);"string"==typeof n&&n.startsWith(e)&&t.push(n)}t.forEach((e=>localStorage.removeItem(e)))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new _e("CBWSDK").clear(),new _e("walletlink").clear()}}ge.ScopedLocalStorage=_e,Object.defineProperty(pe,"__esModule",{value:!0}),pe.SCWKeyManager=void 0;const me=ae,ye=ge,be={storageKey:"ownPrivateKey",keyType:"private"},ve={storageKey:"ownPublicKey",keyType:"public"},we={storageKey:"peerPublicKey",keyType:"public"};pe.SCWKeyManager=class{constructor(){this.storage=new ye.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(we,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(ve.storageKey),this.storage.removeItem(be.storageKey),this.storage.removeItem(we.storageKey)}async generateKeyPair(){const e=await(0,me.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(be,e.privateKey),await this.storeKey(ve,e.publicKey)}async loadKeysIfNeeded(){if(null===this.ownPrivateKey&&(this.ownPrivateKey=await this.loadKey(be)),null===this.ownPublicKey&&(this.ownPublicKey=await this.loadKey(ve)),null!==this.ownPrivateKey&&null!==this.ownPublicKey||await this.generateKeyPair(),null===this.peerPublicKey&&(this.peerPublicKey=await this.loadKey(we)),null===this.sharedSecret){if(null===this.ownPrivateKey||null===this.peerPublicKey)return;this.sharedSecret=await(0,me.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const t=this.storage.getItem(e.storageKey);return t?(0,me.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){const r=await(0,me.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,r)}};var Ee={};Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.SCWStateManager=void 0;const Se=ge,ke="accounts",Ce="activeChain",Re="availableChains";Ee.SCWStateManager=class{get accounts(){return this._accounts}get activeChain(){return this._activeChain}constructor(e){this.storage=new Se.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(Re);const t=this.loadItemFromStorage(ke),r=this.loadItemFromStorage(Ce);t&&this.updateListener.onAccountsUpdate({accounts:t,source:"storage"}),r&&this.updateListener.onChainUpdate({chain:r,source:"storage"}),this._accounts=t||[],this._activeChain=r||{id:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(ke,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const r=null===(t=this.availableChains)||void 0===t?void 0:t.find((t=>t.id===e));return!!r&&(r===this._activeChain||(this._activeChain=r,this.storeItemToStorage(Ce,r),this.updateListener.onChainUpdate({chain:r,source:"wallet"})),!0)}updateAvailableChains(e){if(!e||0===Object.keys(e).length)return;const t=Object.entries(e).map((([e,t])=>({id:Number(e),rpcUrl:t})));this.availableChains=t,this.storeItemToStorage(Re,t),this.switchChain(this._activeChain.id)}storeItemToStorage(e,t){this.storage.setItem(e,JSON.stringify(t))}loadItemFromStorage(e){const t=this.storage.getItem(e);return t?JSON.parse(t):void 0}clear(){this.storage.clear()}},Object.defineProperty(se,"__esModule",{value:!0}),se.SCWSigner=void 0;const Ie=oe,xe=ae,Me=fe,Te=pe,Ae=Ee,Le=g,Pe=I;se.SCWSigner=class{constructor(e){this.appName=e.appName,this.appLogoUrl=e.appLogoUrl,this.appChainIds=e.appChainIds,this.puc=e.puc,this.keyManager=new Te.SCWKeyManager,this.stateManager=new Ae.SCWStateManager({updateListener:{onAccountsUpdate:(...t)=>e.updateListener.onAccountsUpdate(this,...t),onChainUpdate:(...t)=>e.updateListener.onChainUpdate(this,...t)}}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){this.puc.connected||await this.puc.connect();const e=await this.createRequestMessage({handshake:{method:Me.SupportedEthereumMethods.EthRequestAccounts,params:{dappName:this.appName,dappLogoUrl:this.appLogoUrl,chainIds:this.appChainIds}}}),t=await this.puc.request(e);if("failure"in t.content)throw t.content.failure;const r=await(0,xe.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(r);const n=await this.decryptResponseMessage(t);this.updateInternalState({method:Me.SupportedEthereumMethods.EthRequestAccounts},n);const i=n.result;if("error"in i)throw i.error;return this.stateManager.accounts}async request(e){const t=this.tryLocalHandling(e);if(void 0!==t){if(t instanceof Error)throw t;return t}const r=await this.sendEncryptedRequest(e),n=await this.decryptResponseMessage(r);this.updateInternalState(e,n);const i=n.result;if("error"in i)throw i.error;return i.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;if(e.method===Me.SupportedEthereumMethods.WalletSwitchEthereumChain){const r=e.params;if(!r||!(null===(t=r[0])||void 0===t?void 0:t.chainId))throw Le.standardErrors.rpc.invalidParams();const n=(0,Pe.ensureIntNumber)(r[0].chainId);return this.stateManager.switchChain(n)?null:void 0}}async sendEncryptedRequest(e){this.puc.connected||await this.puc.connect();const t=await this.keyManager.getSharedSecret();if(!t)throw Le.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const r=await(0,xe.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),n=await this.createRequestMessage({encrypted:r});return await this.puc.request(n)}async createRequestMessage(e){const t=await(0,xe.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{type:"scw",id:crypto.randomUUID(),sender:t,content:e,version:Ie.LIB_VERSION,timestamp:new Date}}async decryptResponseMessage(e){const t=e.content;if("failure"in t)throw t.failure;const r=await this.keyManager.getSharedSecret();if(!r)throw Le.standardErrors.provider.unauthorized("Invalid session");return(0,xe.decryptContent)(t.encrypted,r)}updateInternalState(e,t){var r;const n=null===(r=t.data)||void 0===r?void 0:r.chains;n&&this.stateManager.updateAvailableChains(n);const i=t.result;if(!("error"in i))switch(e.method){case Me.SupportedEthereumMethods.EthRequestAccounts:{const e=i.value;this.stateManager.updateAccounts(e);break}case Me.SupportedEthereumMethods.WalletSwitchEthereumChain:{if(null!==i.value)return;const t=e.params,r=(0,Pe.ensureIntNumber)(t[0].chainId);this.stateManager.switchChain(r);break}}}};var Ne,je,Be={},Oe={};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.isConfigMessage=Oe.HostConfigEventType=Oe.ClientConfigEventType=void 0,function(e){e.SelectConnectionType="selectConnectionType",e.DappOriginMessage="dappOriginMessage",e.WalletLinkUrl="walletLinkUrl",e.WalletLinkQrScanned="walletLinkQrScanned"}(Ne||(Oe.ClientConfigEventType=Ne={})),function(e){e.PopupListenerAdded="popupListenerAdded",e.PopupReadyForRequest="popupReadyForRequest",e.ConnectionTypeSelected="connectionTypeSelected",e.RequestWalletLinkUrl="requestWalletLinkUrl",e.PopupUnload="popupUnload"}(je||(Oe.HostConfigEventType=je={})),Oe.isConfigMessage=function(e){return"config"===e.type&&"event"in e};var Fe={};Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.CrossDomainCommunicator=void 0;const De=g;Fe.CrossDomainCommunicator=class{constructor(){this.url=void 0,this._connected=!1,this.peerWindow=null}get connected(){return this._connected}async connect(){window.addEventListener("message",this.onEvent.bind(this)),await this.onConnect()}disconnect(){this._connected=!1,this.onDisconnect()}postMessage(e,t){var r,n;let i=null===(r=this.url)||void 0===r?void 0:r.origin;if(void 0===i){if(!(null==t?void 0:t.bypassTargetOriginCheck))throw De.standardErrors.rpc.internal("Communicator: No target origin");i="*"}null===(n=this.peerWindow)||void 0===n||n.postMessage(e,i)}},Object.defineProperty(Be,"__esModule",{value:!0}),Be.PopUpCommunicator=void 0;const Ue=Oe,He=Fe,We=g;class qe extends He.CrossDomainCommunicator{constructor({url:e}){super(),this.requestMap=new Map,this.url=new URL(e)}setWLQRCodeUrlCallback(e){this.wlQRCodeUrlCallback=e}onConnect(){return new Promise(((e,t)=>{this.resolvePopupReady=e,this.openFixedSizePopUpWindow(),this.peerWindow||t(We.standardErrors.rpc.internal("No pop up window opened"))}))}respondToWlQRCodeUrlRequest(){if(!this.wlQRCodeUrlCallback)throw We.standardErrors.rpc.internal("PopUpCommunicator.wlQRCodeUrlCallback not set! make sure .setWLQRCodeUrlCallback is called first");const e=this.wlQRCodeUrlCallback(),t={type:"config",id:crypto.randomUUID(),event:{type:Ue.ClientConfigEventType.WalletLinkUrl,value:e}};this.postMessage(t)}onEvent(e){var t,r;if(e.origin!==(null===(t=this.url)||void 0===t?void 0:t.origin))return;const n=e.data;if((0,Ue.isConfigMessage)(n))return void this.handleConfigMessage(n);if(!this._connected)return;if(!("requestId"in n))return;const i=n.requestId,s=null===(r=this.requestMap.get(i))||void 0===r?void 0:r.resolve;this.requestMap.delete(i),null==s||s(n)}handleConfigMessage(e){var t,r;switch(e.event.type){case Ue.HostConfigEventType.PopupListenerAdded:this.postClientConfigMessage(Ue.ClientConfigEventType.DappOriginMessage);break;case Ue.HostConfigEventType.PopupReadyForRequest:this._connected=!0,null===(t=this.resolvePopupReady)||void 0===t||t.call(this),this.resolvePopupReady=void 0;break;case Ue.HostConfigEventType.ConnectionTypeSelected:if(!this._connected)return;null===(r=this.resolveConnectionType)||void 0===r||r.call(this,e.event.value),this.resolveConnectionType=void 0;break;case Ue.HostConfigEventType.RequestWalletLinkUrl:if(!this._connected)return;if(!this.wlQRCodeUrlCallback)throw We.standardErrors.rpc.internal("PopUpCommunicator.wlQRCodeUrlCallback not set! should never happen");this.respondToWlQRCodeUrlRequest();break;case Ue.HostConfigEventType.PopupUnload:this.disconnect()}}selectConnectionType({connectionPreference:e}){return new Promise(((t,r)=>{this.peerWindow||r(We.standardErrors.rpc.internal("No pop up window found. Make sure to run .connect() before .send()")),this.resolveConnectionType=t,this.postClientConfigMessage(Ue.ClientConfigEventType.SelectConnectionType,{connectionPreference:e})}))}walletLinkQrScanned(){this.postClientConfigMessage(Ue.ClientConfigEventType.WalletLinkQrScanned)}postClientConfigMessage(e,t){if(t&&e!==Ue.ClientConfigEventType.SelectConnectionType)throw We.standardErrors.rpc.internal("ClientConfigEvent does not accept options");const r={type:"config",id:crypto.randomUUID(),event:{type:e,value:t}};this.postMessage(r)}request(e){return new Promise(((t,r)=>{this.peerWindow||r(We.standardErrors.rpc.internal("No pop up window found. Make sure to run .connect() before .send()")),this.postMessage(e);const n={message:e,resolve:t,reject:r};this.requestMap.set(e.id,n)}))}onDisconnect(){this._connected=!1,this.closeChildWindow(),this.requestMap.forEach(((e,t,r)=>{e.reject(We.standardErrors.provider.userRejectedRequest("Request rejected")),r.delete(t)}))}openFixedSizePopUpWindow(){const e=(window.innerWidth-420)/2+window.screenX,t=(window.innerHeight-540)/2+window.screenY,r=new URLSearchParams;if(r.append("opener",encodeURIComponent(window.location.href)),!this.url)throw We.standardErrors.rpc.internal("No url provided in PopUpCommunicator");const n=new URL(this.url);n.search=r.toString();const i=window.open(n,"SCW Child Window",`width=420, height=540, left=${e}, top=${t}`);this.peerWindow=i,null==i||i.focus()}closeChildWindow(){this.peerWindow&&!this.peerWindow.closed&&this.peerWindow.close(),this.peerWindow=null}}Be.PopUpCommunicator=qe;var Ve,ze,$e={},Je={},Ke={exports:{}},Ge=o.EventEmitter;function Ze(){if(ze)return Ve;function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){r(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function r(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}ze=1;var s=a.Buffer,o=c.inspect,l=o&&o.custom||"inspect";return Ve=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var r,i,a;return r=e,i=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return s.alloc(0);for(var t,r,n,i=s.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,s.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,s=e>i.length?i.length:e;if(s===i.length?n+=i:n+=i.slice(0,e),0==(e-=s)){s===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(s));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=s.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:l,value:function(e,r){return o(this,t(t({},r),{},{depth:0,customInspect:!1}))}}],i&&n(r.prototype,i),a&&n(r,a),Object.defineProperty(r,"prototype",{writable:!1}),e}(),Ve}function Qe(e,t){Xe(e,t),Ye(e)}function Ye(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Xe(e,t){e.emit("error",t)}var et={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(Xe,this,e)):process.nextTick(Xe,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?process.nextTick(Ye,r):(r._writableState.errorEmitted=!0,process.nextTick(Qe,r,e)):process.nextTick(Qe,r,e):t?(process.nextTick(Ye,r),t(e)):process.nextTick(Ye,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}},tt={};var rt={};function nt(e,t,r){r||(r=Error);var n=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);n.prototype.name=r.name,n.prototype.code=e,rt[e]=n}function it(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}nt("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),nt("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,s,o;if("string"==typeof t&&(i="not ",t.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))o="The ".concat(e," ").concat(n," ").concat(it(t,"type"));else{var a=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(it(t,"type"))}return o+=". Received type ".concat(typeof r)}),TypeError),nt("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),nt("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),nt("ERR_STREAM_PREMATURE_CLOSE","Premature close"),nt("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),nt("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),nt("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),nt("ERR_STREAM_WRITE_AFTER_END","write after end"),nt("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),nt("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),nt("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),tt.codes=rt;var st=tt.codes.ERR_INVALID_OPT_VALUE;var ot,at,ct,lt,ut,dt,ht={getHighWaterMark:function(e,t,r,n){var i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new st(n?r:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}};function ft(){if(at)return ot;function t(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}return at=1,ot=function(e,r){if(t("noDeprecation"))return e;var n=!1;return function(){if(!n){if(t("throwDeprecation"))throw new Error(r);t("traceDeprecation")?console.trace(r):console.warn(r),n=!0}return e.apply(this,arguments)}},ot}function pt(){if(lt)return ct;function t(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var r;lt=1,ct=k,k.WritableState=S;var n={deprecate:ft()},i=Ge,s=a.Buffer,o=(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,u=et,d=ht.getHighWaterMark,h=tt.codes,f=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,g=h.ERR_MULTIPLE_CALLBACK,_=h.ERR_STREAM_CANNOT_PIPE,m=h.ERR_STREAM_DESTROYED,y=h.ERR_STREAM_NULL_VALUES,b=h.ERR_STREAM_WRITE_AFTER_END,v=h.ERR_UNKNOWN_ENCODING,w=u.errorOrDestroy;function E(){}function S(e,n,i){r=r||gt(),e=e||{},"boolean"!=typeof i&&(i=n instanceof r),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=d(this,e,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(T,e,t),e._writableState.errorEmitted=!0,w(e,n)):(i(n),e._writableState.errorEmitted=!0,w(e,n),T(e,t))}(e,r,n,t,i);else{var s=x(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||I(e,r),n?process.nextTick(R,e,r,s,i):R(e,r,s,i)}}(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function k(e){var t=this instanceof(r=r||gt());if(!t&&!c.call(k,this))return new k(e);this._writableState=new S(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function C(e,t,r,n,i,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function R(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),T(e,t)}function I(e,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(e._writev&&n&&n.next){var i=r.bufferedRequestCount,s=new Array(i),o=r.corkedRequestsFree;o.entry=n;for(var a=0,c=!0;n;)s[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;s.allBuffers=c,C(e,r,!0,r.length,s,"",o.finish),r.pendingcb++,r.lastBufferedRequest=null,o.next?(r.corkedRequestsFree=o.next,o.next=null):r.corkedRequestsFree=new t(r),r.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,d=n.callback;if(C(e,r,!1,r.objectMode?1:l.length,l,u,d),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function M(e,t){e._final((function(r){t.pendingcb--,r&&w(e,r),t.prefinished=!0,e.emit("prefinish"),T(e,t)}))}function T(e,t){var r=x(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(M,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}return l.exports(k,i),S.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(S.prototype,"buffer",{get:n.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(e){return!!c.call(this,e)||this===k&&(e&&e._writableState instanceof S)}})):c=function(e){return e instanceof this},k.prototype.pipe=function(){w(this,new _)},k.prototype.write=function(e,t,r){var n,i=this._writableState,a=!1,c=!i.objectMode&&(n=e,s.isBuffer(n)||n instanceof o);return c&&!s.isBuffer(e)&&(e=function(e){return s.from(e)}(e)),"function"==typeof t&&(r=t,t=null),c?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=E),i.ending?function(e,t){var r=new b;w(e,r),process.nextTick(t,r)}(this,r):(c||function(e,t,r,n){var i;return null===r?i=new y:"string"==typeof r||t.objectMode||(i=new f("chunk",["string","Buffer"],r)),!i||(w(e,i),process.nextTick(n,i),!1)}(this,i,e,r))&&(i.pendingcb++,a=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var c=t.objectMode?1:n.length;t.length+=c;var l=t.length<t.highWaterMark;l||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else C(e,t,!1,c,n,i,o);return l}(this,i,c,e,t,r)),a},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||I(this,e))},k.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new v(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),k.prototype._write=function(e,t,r){r(new p("_write()"))},k.prototype._writev=null,k.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,T(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),k.prototype.destroy=u.destroy,k.prototype._undestroy=u.undestroy,k.prototype._destroy=function(e,t){t(e)},ct}function gt(){if(dt)return ut;dt=1;var e=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};ut=o;var t=Tt(),r=pt();l.exports(o,t);for(var n=e(r.prototype),i=0;i<n.length;i++){var s=n[i];o.prototype[s]||(o.prototype[s]=r.prototype[s])}function o(e){if(!(this instanceof o))return new o(e);t.call(this,e),r.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||process.nextTick(c,this)}function c(e){e.end()}return Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),ut}var _t,mt={},yt={exports:{}};function bt(){if(_t)return mt;_t=1;var e=yt.exports.Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(r);if("string"!=typeof n&&(e.isEncoding===t||!t(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=s,this.end=o,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=c,n=3;break;default:return this.write=l,void(this.end=u)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(n)}function n(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function s(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function o(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function a(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function u(e){return e&&e.length?this.write(e):""}return mt.StringDecoder=r,r.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var s=n(t[i]);if(s>=0)return s>0&&(e.lastNeed=s-1),s;if(--i<r||-2===s)return 0;if(s=n(t[i]),s>=0)return s>0&&(e.lastNeed=s-2),s;if(--i<r||-2===s)return 0;if(s=n(t[i]),s>=0)return s>0&&(2===s?s=0:e.lastNeed=s-3),s;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},r.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},mt}
|
|
2
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3
|
-
!function(e,t){var r=a,n=r.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),s.prototype=Object.create(n.prototype),i(n,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(yt,yt.exports);var vt=tt.codes.ERR_STREAM_PREMATURE_CLOSE;function wt(){}var Et,St,kt,Ct,Rt,It,xt=function e(t,r,n){if("function"==typeof r)return e(t,null,r);r||(r={}),n=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(n||wt);var i=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,o=function(){t.writable||c()},a=t._writableState&&t._writableState.finished,c=function(){s=!1,a=!0,i||n.call(t)},l=t._readableState&&t._readableState.endEmitted,u=function(){i=!1,l=!0,s||n.call(t)},d=function(e){n.call(t,e)},h=function(){var e;return i&&!l?(t._readableState&&t._readableState.ended||(e=new vt),n.call(t,e)):s&&!a?(t._writableState&&t._writableState.ended||(e=new vt),n.call(t,e)):void 0},f=function(){t.req.on("finish",c)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?s&&!t._writableState&&(t.on("end",o),t.on("close",o)):(t.on("complete",c),t.on("abort",h),t.req?f():t.on("request",f)),t.on("end",u),t.on("finish",c),!1!==r.error&&t.on("error",d),t.on("close",h),function(){t.removeListener("complete",c),t.removeListener("abort",h),t.removeListener("request",f),t.req&&t.req.removeListener("finish",c),t.removeListener("end",o),t.removeListener("close",o),t.removeListener("finish",c),t.removeListener("end",u),t.removeListener("error",d),t.removeListener("close",h)}};function Mt(){if(St)return Et;var e;function t(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}St=1;var r=xt,n=Symbol("lastResolve"),i=Symbol("lastReject"),s=Symbol("error"),o=Symbol("ended"),a=Symbol("lastPromise"),c=Symbol("handlePromise"),l=Symbol("stream");function u(e,t){return{value:e,done:t}}function d(e){var t=e[n];if(null!==t){var r=e[l].read();null!==r&&(e[a]=null,e[n]=null,e[i]=null,t(u(r,!1)))}}function h(e){process.nextTick(d,e)}var f=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((e={get stream(){return this[l]},next:function(){var e=this,t=this[s];if(null!==t)return Promise.reject(t);if(this[o])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise((function(t,r){process.nextTick((function(){e[s]?r(e[s]):t(u(void 0,!0))}))}));var r,n=this[a];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[o]?r(u(void 0,!0)):t[c](r,n)}),n)}}(n,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(u(i,!1));r=new Promise(this[c])}return this[a]=r,r}},t(e,Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,r){e[l].destroy(null,(function(e){e?r(e):t(u(void 0,!0))}))}))})),e),f);return Et=function(e){var d,f=Object.create(p,(t(d={},l,{value:e,writable:!0}),t(d,n,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,s,{value:null,writable:!0}),t(d,o,{value:e._readableState.endEmitted,writable:!0}),t(d,c,{value:function(e,t){var r=f[l].read();r?(f[a]=null,f[n]=null,f[i]=null,e(u(r,!1))):(f[n]=e,f[i]=t)},writable:!0}),d));return f[a]=null,r(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=f[i];return null!==t&&(f[a]=null,f[n]=null,f[i]=null,t(e)),void(f[s]=e)}var r=f[n];null!==r&&(f[a]=null,f[n]=null,f[i]=null,r(u(void 0,!0))),f[o]=!0})),e.on("readable",h.bind(null,f)),f}}function Tt(){if(It)return Rt;var t;It=1,Rt=R,R.ReadableState=C,o.EventEmitter;var r=function(e,t){return e.listeners(t).length},n=Ge,i=a.Buffer,s=(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var u,d=c;u=d&&d.debuglog?d.debuglog("stream"):function(){};var h,f,p,g=Ze(),_=et,m=ht.getHighWaterMark,y=tt.codes,b=y.ERR_INVALID_ARG_TYPE,v=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,E=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;l.exports(R,n);var S=_.errorOrDestroy,k=["error","close","destroy","pause","resume"];function C(e,r,n){t=t||gt(),e=e||{},"boolean"!=typeof n&&(n=r instanceof t),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(h||(h=bt().StringDecoder),this.decoder=new h(e.encoding),this.encoding=e.encoding)}function R(e){if(t=t||gt(),!(this instanceof R))return new R(e);var r=this instanceof t;this._readableState=new C(e,this,r),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),n.call(this)}function I(e,t,r,n,o){u("readableAddChunk",t);var a,c=e._readableState;if(null===t)c.reading=!1,function(e,t){if(u("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?A(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,L(e)))}(e,c);else if(o||(a=function(e,t){var r;n=t,i.isBuffer(n)||n instanceof s||"string"==typeof t||void 0===t||e.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(c,t)),a)S(e,a);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===i.prototype||(t=function(e){return i.from(e)}(t)),n)c.endEmitted?S(e,new E):x(e,c,t,!0);else if(c.ended)S(e,new v);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?x(e,c,t,!1):P(e,c)):x(e,c,t,!1)}else n||(c.reading=!1,P(e,c));return!c.ended&&(c.length<c.highWaterMark||0===c.length)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&A(e)),P(e,t)}Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),R.prototype.destroy=_.destroy,R.prototype._undestroy=_.undestroy,R.prototype._destroy=function(e,t){t(e)},R.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=i.from(e,t),t=""),r=!0),I(this,e,t,!1,r)},R.prototype.unshift=function(e){return I(this,e,null,!0,!1)},R.prototype.isPaused=function(){return!1===this._readableState.flowing},R.prototype.setEncoding=function(e){h||(h=bt().StringDecoder);var t=new h(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var M=1073741824;function T(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=M?e=M:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(L,e))}function L(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,F(e)}function P(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(N,e,t))}function N(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(u("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function j(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function B(e){u("readable nexttick read 0"),e.read(0)}function O(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),F(e),t.flowing&&!t.reading&&e.read(0)}function F(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function D(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function U(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(H,t,e))}function H(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function W(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}return R.prototype.read=function(e){u("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?U(this):A(this),null;if(0===(e=T(e,t))&&t.ended)return 0===t.length&&U(this),null;var n,i=t.needReadable;return u("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&u("length less than watermark",i=!0),t.ended||t.reading?u("reading or ended",i=!1):i&&(u("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=T(r,t))),null===(n=e>0?D(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&U(this)),null!==n&&this.emit("data",n),n},R.prototype._read=function(e){S(this,new w("_read()"))},R.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,u("pipe count=%d opts=%j",i.pipesCount,t);var s=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?a:g;function o(t,r){u("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",c),e.removeListener("error",h),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",g),n.removeListener("data",d),l=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function a(){u("onend"),e.end()}i.endEmitted?process.nextTick(s):n.once("end",s),e.on("unpipe",o);var c=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&r(e,"data")&&(t.flowing=!0,F(e))}}(n);e.on("drain",c);var l=!1;function d(t){u("ondata");var r=e.write(t);u("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==W(i.pipes,e))&&!l&&(u("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function h(t){u("onerror",t),g(),e.removeListener("error",h),0===r(e,"error")&&S(e,t)}function f(){e.removeListener("finish",p),g()}function p(){u("onfinish"),e.removeListener("close",f),g()}function g(){u("unpipe"),n.unpipe(e)}return n.on("data",d),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",h),e.once("close",f),e.once("finish",p),e.emit("pipe",n),i.flowing||(u("pipe resume"),n.resume()),e},R.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=W(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},R.prototype.on=function(e,t){var r=n.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?A(this):i.reading||process.nextTick(B,this))),r},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(e,t){var r=n.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(j,this),r},R.prototype.removeAllListeners=function(e){var t=n.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(j,this),t},R.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(O,e,t))}(this,e)),e.paused=!1,this},R.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},R.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(u("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<k.length;s++)e.on(k[s],this.emit.bind(this,k[s]));return this._read=function(t){u("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(R.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=Mt()),f(this)}),Object.defineProperty(R.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(R.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(R.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),R._fromList=D,Object.defineProperty(R.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(R.from=function(e,t){return void 0===p&&(p=Ct?kt:(Ct=1,kt=function(){throw new Error("Readable.from is not available in the browser")})),p(R,e,t)}),Rt}var At=Dt,Lt=tt.codes,Pt=Lt.ERR_METHOD_NOT_IMPLEMENTED,Nt=Lt.ERR_MULTIPLE_CALLBACK,jt=Lt.ERR_TRANSFORM_ALREADY_TRANSFORMING,Bt=Lt.ERR_TRANSFORM_WITH_LENGTH_0,Ot=gt();function Ft(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new Nt);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Dt(e){if(!(this instanceof Dt))return new Dt(e);Ot.call(this,e),this._transformState={afterTransform:Ft.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Ut)}function Ut(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Ht(this,null,null):this._flush((function(t,r){Ht(e,t,r)}))}function Ht(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Bt;if(e._transformState.transforming)throw new jt;return e.push(null)}l.exports(Dt,Ot),Dt.prototype.push=function(e,t){return this._transformState.needTransform=!1,Ot.prototype.push.call(this,e,t)},Dt.prototype._transform=function(e,t,r){r(new Pt("_transform()"))},Dt.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Dt.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},Dt.prototype._destroy=function(e,t){Ot.prototype._destroy.call(this,e,(function(e){t(e)}))};var Wt,qt=zt,Vt=At;function zt(e){if(!(this instanceof zt))return new zt(e);Vt.call(this,e)}l.exports(zt,Vt),zt.prototype._transform=function(e,t,r){r(null,e)};var $t=tt.codes,Jt=$t.ERR_MISSING_ARGS,Kt=$t.ERR_STREAM_DESTROYED;function Gt(e){if(e)throw e}function Zt(e){e()}function Qt(e,t){return e.pipe(t)}var Yt=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=function(e){return e.length?"function"!=typeof e[e.length-1]?Gt:e.pop():Gt}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Jt("streams");var s=t.map((function(e,r){var o=r<t.length-1;return function(e,t,r,n){n=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(n);var i=!1;e.on("close",(function(){i=!0})),void 0===Wt&&(Wt=xt),Wt(e,{readable:t,writable:r},(function(e){if(e)return n(e);i=!0,n()}));var s=!1;return function(t){if(!i&&!s)return s=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void n(t||new Kt("pipe"))}}(e,o,r>0,(function(e){n||(n=e),e&&s.forEach(Zt),o||(s.forEach(Zt),i(n))}))}));return t.reduce(Qt)};!function(e,t){(t=Ke.exports=Tt()).Stream=t,t.Readable=t,t.Writable=pt(),t.Duplex=gt(),t.Transform=At,t.PassThrough=qt,t.finished=xt,t.pipeline=Yt}(0,Ke.exports);const{Transform:Xt}=Ke.exports;const{Transform:er}=Ke.exports;const tr=e=>class t extends Xt{constructor(t,r,n,i,s){super(s),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=i,this._options=s,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}},rr=e=>class t extends er{constructor(t,r,n,i){super(i),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._options=i,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(e);return void 0!==t&&(r=r.toString(t)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}};var nr={};const ir=[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];nr.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],o=e[4]^e[14]^e[24]^e[34]^e[44],a=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],u=e[8]^e[18]^e[28]^e[38]^e[48],d=e[9]^e[19]^e[29]^e[39]^e[49];let h=u^(i<<1|s>>>31),f=d^(s<<1|i>>>31);const p=e[0]^h,g=e[1]^f,_=e[10]^h,m=e[11]^f,y=e[20]^h,b=e[21]^f,v=e[30]^h,w=e[31]^f,E=e[40]^h,S=e[41]^f;h=r^(o<<1|a>>>31),f=n^(a<<1|o>>>31);const k=e[2]^h,C=e[3]^f,R=e[12]^h,I=e[13]^f,x=e[22]^h,M=e[23]^f,T=e[32]^h,A=e[33]^f,L=e[42]^h,P=e[43]^f;h=i^(c<<1|l>>>31),f=s^(l<<1|c>>>31);const N=e[4]^h,j=e[5]^f,B=e[14]^h,O=e[15]^f,F=e[24]^h,D=e[25]^f,U=e[34]^h,H=e[35]^f,W=e[44]^h,q=e[45]^f;h=o^(u<<1|d>>>31),f=a^(d<<1|u>>>31);const V=e[6]^h,z=e[7]^f,$=e[16]^h,J=e[17]^f,K=e[26]^h,G=e[27]^f,Z=e[36]^h,Q=e[37]^f,Y=e[46]^h,X=e[47]^f;h=c^(r<<1|n>>>31),f=l^(n<<1|r>>>31);const ee=e[8]^h,te=e[9]^f,re=e[18]^h,ne=e[19]^f,ie=e[28]^h,se=e[29]^f,oe=e[38]^h,ae=e[39]^f,ce=e[48]^h,le=e[49]^f,ue=p,de=g,he=m<<4|_>>>28,fe=_<<4|m>>>28,pe=y<<3|b>>>29,ge=b<<3|y>>>29,_e=w<<9|v>>>23,me=v<<9|w>>>23,ye=E<<18|S>>>14,be=S<<18|E>>>14,ve=k<<1|C>>>31,we=C<<1|k>>>31,Ee=I<<12|R>>>20,Se=R<<12|I>>>20,ke=x<<10|M>>>22,Ce=M<<10|x>>>22,Re=A<<13|T>>>19,Ie=T<<13|A>>>19,xe=L<<2|P>>>30,Me=P<<2|L>>>30,Te=j<<30|N>>>2,Ae=N<<30|j>>>2,Le=B<<6|O>>>26,Pe=O<<6|B>>>26,Ne=D<<11|F>>>21,je=F<<11|D>>>21,Be=U<<15|H>>>17,Oe=H<<15|U>>>17,Fe=q<<29|W>>>3,De=W<<29|q>>>3,Ue=V<<28|z>>>4,He=z<<28|V>>>4,We=J<<23|$>>>9,qe=$<<23|J>>>9,Ve=K<<25|G>>>7,ze=G<<25|K>>>7,$e=Z<<21|Q>>>11,Je=Q<<21|Z>>>11,Ke=X<<24|Y>>>8,Ge=Y<<24|X>>>8,Ze=ee<<27|te>>>5,Qe=te<<27|ee>>>5,Ye=re<<20|ne>>>12,Xe=ne<<20|re>>>12,et=se<<7|ie>>>25,tt=ie<<7|se>>>25,rt=oe<<8|ae>>>24,nt=ae<<8|oe>>>24,it=ce<<14|le>>>18,st=le<<14|ce>>>18;e[0]=ue^~Ee&Ne,e[1]=de^~Se&je,e[10]=Ue^~Ye&pe,e[11]=He^~Xe&ge,e[20]=ve^~Le&Ve,e[21]=we^~Pe&ze,e[30]=Ze^~he&ke,e[31]=Qe^~fe&Ce,e[40]=Te^~We&et,e[41]=Ae^~qe&tt,e[2]=Ee^~Ne&$e,e[3]=Se^~je&Je,e[12]=Ye^~pe&Re,e[13]=Xe^~ge&Ie,e[22]=Le^~Ve&rt,e[23]=Pe^~ze&nt,e[32]=he^~ke&Be,e[33]=fe^~Ce&Oe,e[42]=We^~et&_e,e[43]=qe^~tt&me,e[4]=Ne^~$e&it,e[5]=je^~Je&st,e[14]=pe^~Re&Fe,e[15]=ge^~Ie&De,e[24]=Ve^~rt&ye,e[25]=ze^~nt&be,e[34]=ke^~Be&Ke,e[35]=Ce^~Oe&Ge,e[44]=et^~_e&xe,e[45]=tt^~me&Me,e[6]=$e^~it&ue,e[7]=Je^~st&de,e[16]=Re^~Fe&Ue,e[17]=Ie^~De&He,e[26]=rt^~ye&ve,e[27]=nt^~be&we,e[36]=Be^~Ke&Ze,e[37]=Oe^~Ge&Qe,e[46]=_e^~xe&Te,e[47]=me^~Me&Ae,e[8]=it^~ue&Ee,e[9]=st^~de&Se,e[18]=Fe^~Ue&Ye,e[19]=De^~He&Xe,e[28]=ye^~ve&Le,e[29]=be^~we&Pe,e[38]=Ke^~Ze&he,e[39]=Ge^~Qe&fe,e[48]=xe^~Te&We,e[49]=Me^~Ae&qe,e[0]^=ir[2*t],e[1]^=ir[2*t+1]}};const sr=nr;function or(){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}or.prototype.initialize=function(e,t){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},or.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<this.count%4*8,this.count+=1,this.count===this.blockSize&&(sr.p1600(this.state),this.count=0)},or.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<this.count%4*8,0!=(128&e)&&this.count===this.blockSize-1&&sr.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<(this.blockSize-1)%4*8,sr.p1600(this.state),this.count=0,this.squeezing=!0},or.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);const t=Buffer.alloc(e);for(let r=0;r<e;++r)t[r]=this.state[~~(this.count/4)]>>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(sr.p1600(this.state),this.count=0);return t},or.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var ar=function(e){const t=tr(e),r=rr(e);return function(e,n){switch("string"==typeof e?e.toLowerCase():e){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+e)}}}(or);const cr=ar;function lr(e){return Buffer.allocUnsafe(e).fill(0)}function ur(e,t){let r=e.toString(16);r.length%2!=0&&(r="0"+r);const n=r.match(/.{1,2}/g).map((e=>parseInt(e,16)));for(;n.length<t;)n.unshift(0);return Buffer.from(n)}function dr(e,t,r){const n=lr(t);return e=hr(e),r?e.length<t?(e.copy(n),n):e.slice(0,t):e.length<t?(e.copy(n,t-e.length),n):e.slice(-t)}function hr(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);else if("string"==typeof e)e=fr(e)?Buffer.from((t=pr(e)).length%2?"0"+t:t,"hex"):Buffer.from(e);else if("number"==typeof e)e=intToBuffer(e);else if(null==e)e=Buffer.allocUnsafe(0);else if("bigint"==typeof e)e=ur(e);else{if(!e.toArray)throw new Error("invalid type");e=Buffer.from(e.toArray())}var t;return e}function fr(e){return"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]*$/)}function pr(e){return"string"==typeof e&&e.startsWith("0x")?e.slice(2):e}var gr={zeros:lr,setLength:dr,setLengthRight:function(e,t){return dr(e,t,!0)},isHexString:fr,stripHexPrefix:pr,toBuffer:hr,bufferToHex:function(e){return"0x"+(e=hr(e)).toString("hex")},keccak:function(e,t){return e=hr(e),t||(t=256),cr("keccak"+t).update(e).digest()},bitLengthFromBigInt:function(e){return e.toString(2).length},bufferBEFromBigInt:ur,twosFromBigInt:function(e,t){let r;if(e<0n){r=(~e&(1n<<BigInt(t))-1n)+1n}else r=e;return r&=(1n<<BigInt(t))-1n,r}};const _r=gr;function mr(e){return e.startsWith("int[")?"int256"+e.slice(3):"int"===e?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):"uint"===e?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):"fixed"===e?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):"ufixed"===e?"ufixed128x128":e}function yr(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function br(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function vr(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?""===t[2]?"dynamic":parseInt(t[2],10):null}function wr(e){var t=typeof e;if("string"===t||"number"===t)return BigInt(e);if("bigint"===t)return e;throw new Error("Argument is not a number")}function Er(e,t){var r,n,i,s;if("address"===e)return Er("uint160",wr(t));if("bool"===e)return Er("uint8",t?1:0);if("string"===e)return Er("bytes",new Buffer(t,"utf8"));if(function(e){return e.lastIndexOf("]")===e.length-1}(e)){if(void 0===t.length)throw new Error("Not an array?");if("dynamic"!==(r=vr(e))&&0!==r&&t.length>r)throw new Error("Elements exceed array size: "+r);for(s in i=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof t&&(t=JSON.parse(t)),t)i.push(Er(e,t[s]));if("dynamic"===r){var o=Er("uint256",t.length);i.unshift(o)}return Buffer.concat(i)}if("bytes"===e)return t=new Buffer(t),i=Buffer.concat([Er("uint256",t.length),t]),t.length%32!=0&&(i=Buffer.concat([i,_r.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if((r=yr(e))<1||r>32)throw new Error("Invalid bytes<N> width: "+r);return _r.setLengthRight(t,32)}if(e.startsWith("uint")){if((r=yr(e))%8||r<8||r>256)throw new Error("Invalid uint<N> width: "+r);n=wr(t);const i=_r.bitLengthFromBigInt(n);if(i>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+i);if(n<0)throw new Error("Supplied uint is negative");return _r.bufferBEFromBigInt(n,32)}if(e.startsWith("int")){if((r=yr(e))%8||r<8||r>256)throw new Error("Invalid int<N> width: "+r);n=wr(t);const i=_r.bitLengthFromBigInt(n);if(i>r)throw new Error("Supplied int exceeds width: "+r+" vs "+i);const s=_r.twosFromBigInt(n,256);return _r.bufferBEFromBigInt(s,32)}if(e.startsWith("ufixed")){if(r=br(e),(n=wr(t))<0)throw new Error("Supplied ufixed is negative");return Er("uint256",n*BigInt(2)**BigInt(r[1]))}if(e.startsWith("fixed"))return r=br(e),Er("int256",wr(t)*BigInt(2)**BigInt(r[1]));throw new Error("Unsupported or invalid type: "+e)}function Sr(e){return"string"===e||"bytes"===e||"dynamic"===vr(e)}function kr(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s<e.length;s++){var o=mr(e[s]),a=t[s];if("bytes"===o)i.push(a);else if("string"===o)i.push(new Buffer(a,"utf8"));else if("bool"===o)i.push(new Buffer(a?"01":"00","hex"));else if("address"===o)i.push(_r.setLength(a,20));else if(o.startsWith("bytes")){if((r=yr(o))<1||r>32)throw new Error("Invalid bytes<N> width: "+r);i.push(_r.setLengthRight(a,r))}else if(o.startsWith("uint")){if((r=yr(o))%8||r<8||r>256)throw new Error("Invalid uint<N> width: "+r);n=wr(a);const e=_r.bitLengthFromBigInt(n);if(e>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+e);i.push(_r.bufferBEFromBigInt(n,r/8))}else{if(!o.startsWith("int"))throw new Error("Unsupported or invalid type: "+o);{if((r=yr(o))%8||r<8||r>256)throw new Error("Invalid int<N> width: "+r);n=wr(a);const e=_r.bitLengthFromBigInt(n);if(e>r)throw new Error("Supplied int exceeds width: "+r+" vs "+e);const t=_r.twosFromBigInt(n,r);i.push(_r.bufferBEFromBigInt(t,r/8))}}}return Buffer.concat(i)}var Cr={rawEncode:function(e,t){var r=[],n=[],i=32*e.length;for(var s in e){var o=mr(e[s]),a=Er(o,t[s]);Sr(o)?(r.push(Er("uint256",i)),n.push(a),i+=a.length):r.push(a)}return Buffer.concat(r.concat(n))},solidityPack:kr,soliditySHA3:function(e,t){return _r.keccak(kr(e,t))}};const Rr=gr,Ir=Cr,xr={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"]},Mr={encodeData(e,t,r,n=!0){const i=["bytes32"],s=[this.hashType(e,r)];if(n){const o=(e,t,i)=>{if(void 0!==r[t])return["bytes32",null==i?"0x0000000000000000000000000000000000000000000000000000000000000000":Rr.keccak(this.encodeData(t,i,r,n))];if(void 0===i)throw new Error(`missing value for field ${e} of type ${t}`);if("bytes"===t)return["bytes32",Rr.keccak(i)];if("string"===t)return"string"==typeof i&&(i=Buffer.from(i,"utf8")),["bytes32",Rr.keccak(i)];if(t.lastIndexOf("]")===t.length-1){const r=t.slice(0,t.lastIndexOf("[")),n=i.map((t=>o(e,r,t)));return["bytes32",Rr.keccak(Ir.rawEncode(n.map((([e])=>e)),n.map((([,e])=>e))))]}return[t,i]};for(const n of r[e]){const[e,r]=o(n.name,n.type,t[n.name]);i.push(e),s.push(r)}}else for(const o of r[e]){let e=t[o.name];if(void 0!==e)if("bytes"===o.type)i.push("bytes32"),e=Rr.keccak(e),s.push(e);else if("string"===o.type)i.push("bytes32"),"string"==typeof e&&(e=Buffer.from(e,"utf8")),e=Rr.keccak(e),s.push(e);else if(void 0!==r[o.type])i.push("bytes32"),e=Rr.keccak(this.encodeData(o.type,e,r,n)),s.push(e);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(e)}}return Ir.rawEncode(i,s)},encodeType(e,t){let r="",n=this.findTypeDependencies(e,t).filter((t=>t!==e));n=[e].concat(n.sort());for(const e of n){if(!t[e])throw new Error("No type definition specified: "+e);r+=e+"("+t[e].map((({name:e,type:t})=>t+" "+e)).join(",")+")"}return r},findTypeDependencies(e,t,r=[]){if(e=e.match(/^\w*/)[0],r.includes(e)||void 0===t[e])return r;r.push(e);for(const n of t[e])for(const e of this.findTypeDependencies(n.type,t,r))!r.includes(e)&&r.push(e);return r},hashStruct(e,t,r,n=!0){return Rr.keccak(this.encodeData(e,t,r,n))},hashType(e,t){return Rr.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const r in xr.properties)e[r]&&(t[r]=e[r]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const r=this.sanitizeData(e),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,t)),"EIP712Domain"!==r.primaryType&&n.push(this.hashStruct(r.primaryType,r.message,r.types,t)),Rr.keccak(Buffer.concat(n))}};var Tr={TYPED_MESSAGE_SCHEMA:xr,TypedDataUtils:Mr,hashForSignTypedDataLegacy:function(e){return function(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;const r=e.map((function(e){return"bytes"===e.type?Rr.toBuffer(e.value):e.value})),n=e.map((function(e){return e.type})),i=e.map((function(e){if(!e.name)throw t;return e.type+" "+e.name}));return Ir.soliditySHA3(["bytes32","bytes32"],[Ir.soliditySHA3(new Array(e.length).fill("string"),i),Ir.soliditySHA3(n,r)])}(e.data)},hashForSignTypedData_v3:function(e){return Mr.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Mr.hash(e.data)}};var Ar={};Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.RelayAbstract=Ar.APP_VERSION_KEY=Ar.LOCAL_STORAGE_ADDRESSES_KEY=Ar.WALLET_USER_NAME_KEY=void 0,Ar.WALLET_USER_NAME_KEY="walletUsername",Ar.LOCAL_STORAGE_ADDRESSES_KEY="Addresses",Ar.APP_VERSION_KEY="AppVersion";Ar.RelayAbstract=class{};var Lr={};Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.RelayEventManager=void 0;const Pr=I;Lr.RelayEventManager=class{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,Pr.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}};var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.isErrorResponse=void 0,Nr.isErrorResponse=function(e){return void 0!==e.errorMessage};var jr={},Br={},Or={};Object.defineProperty(Or,"__esModule",{value:!0}),Or.EVENTS=void 0,Or.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",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var Fr={},Dr={exports:{}},Ur=yt.exports.Buffer;function Hr(e,t){this._block=Ur.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hr.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=Ur.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,o=0;o<i;){for(var a=s%n,c=Math.min(i-o,n-a),l=0;l<c;l++)r[a+l]=e[o+l];o+=c,(s+=c)%n==0&&this._update(r)}return this._len+=i,this},Hr.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>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 e?s.toString(e):s},Hr.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Wr=Hr,qr=l.exports,Vr=Wr,zr=yt.exports.Buffer,$r=[1518500249,1859775393,-1894007588,-899497514],Jr=new Array(80);function Kr(){this.init(),this._w=Jr,Vr.call(this,64,56)}function Gr(e){return e<<30|e>>>2}function Zr(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}qr(Kr,Vr),Kr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Kr.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,o=0|this._d,a=0|this._e,c=0;c<16;++c)r[c]=e.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var l=0;l<80;++l){var u=~~(l/20),d=0|((t=n)<<5|t>>>27)+Zr(u,i,s,o)+a+r[l]+$r[u];a=o,o=s,s=Gr(i),i=n,n=d}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},Kr.prototype._hash=function(){var e=zr.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Qr=Kr,Yr=l.exports,Xr=Wr,en=yt.exports.Buffer,tn=[1518500249,1859775393,-1894007588,-899497514],rn=new Array(80);function nn(){this.init(),this._w=rn,Xr.call(this,64,56)}function sn(e){return e<<5|e>>>27}function on(e){return e<<30|e>>>2}function an(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Yr(nn,Xr),nn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},nn.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,s=0|this._c,o=0|this._d,a=0|this._e,c=0;c<16;++c)r[c]=e.readInt32BE(4*c);for(;c<80;++c)r[c]=(t=r[c-3]^r[c-8]^r[c-14]^r[c-16])<<1|t>>>31;for(var l=0;l<80;++l){var u=~~(l/20),d=sn(n)+an(u,i,s,o)+a+r[l]+tn[u]|0;a=o,o=s,s=on(i),i=n,n=d}this._a=n+this._a|0,this._b=i+this._b|0,this._c=s+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0},nn.prototype._hash=function(){var e=en.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var cn=nn,ln=l.exports,un=Wr,dn=yt.exports.Buffer,hn=[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],fn=new Array(64);function pn(){this.init(),this._w=fn,un.call(this,64,56)}function gn(e,t,r){return r^e&(t^r)}function _n(e,t,r){return e&t|r&(e|t)}function mn(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function yn(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function bn(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function vn(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}ln(pn,un),pn.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},pn.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,s=0|this._d,o=0|this._e,a=0|this._f,c=0|this._g,l=0|this._h,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<64;++u)t[u]=vn(t[u-2])+t[u-7]+bn(t[u-15])+t[u-16]|0;for(var d=0;d<64;++d){var h=l+yn(o)+gn(o,a,c)+hn[d]+t[d]|0,f=mn(r)+_n(r,n,i)|0;l=c,c=a,a=o,o=s+h|0,s=i,i=n,n=r,r=h+f|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},pn.prototype._hash=function(){var e=dn.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var wn=pn,En=l.exports,Sn=wn,kn=Wr,Cn=yt.exports.Buffer,Rn=new Array(64);function In(){this.init(),this._w=Rn,kn.call(this,64,56)}En(In,Sn),In.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},In.prototype._hash=function(){var e=Cn.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var xn=In,Mn=l.exports,Tn=Wr,An=yt.exports.Buffer,Ln=[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],Pn=new Array(160);function Nn(){this.init(),this._w=Pn,Tn.call(this,128,112)}function jn(e,t,r){return r^e&(t^r)}function Bn(e,t,r){return e&t|r&(e|t)}function On(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function Fn(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Dn(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Un(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Hn(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Wn(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function qn(e,t){return e>>>0<t>>>0?1:0}Mn(Nn,Tn),Nn.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},Nn.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,s=0|this._dh,o=0|this._eh,a=0|this._fh,c=0|this._gh,l=0|this._hh,u=0|this._al,d=0|this._bl,h=0|this._cl,f=0|this._dl,p=0|this._el,g=0|this._fl,_=0|this._gl,m=0|this._hl,y=0;y<32;y+=2)t[y]=e.readInt32BE(4*y),t[y+1]=e.readInt32BE(4*y+4);for(;y<160;y+=2){var b=t[y-30],v=t[y-30+1],w=Dn(b,v),E=Un(v,b),S=Hn(b=t[y-4],v=t[y-4+1]),k=Wn(v,b),C=t[y-14],R=t[y-14+1],I=t[y-32],x=t[y-32+1],M=E+R|0,T=w+C+qn(M,E)|0;T=(T=T+S+qn(M=M+k|0,k)|0)+I+qn(M=M+x|0,x)|0,t[y]=T,t[y+1]=M}for(var A=0;A<160;A+=2){T=t[A],M=t[A+1];var L=Bn(r,n,i),P=Bn(u,d,h),N=On(r,u),j=On(u,r),B=Fn(o,p),O=Fn(p,o),F=Ln[A],D=Ln[A+1],U=jn(o,a,c),H=jn(p,g,_),W=m+O|0,q=l+B+qn(W,m)|0;q=(q=(q=q+U+qn(W=W+H|0,H)|0)+F+qn(W=W+D|0,D)|0)+T+qn(W=W+M|0,M)|0;var V=j+P|0,z=N+L+qn(V,j)|0;l=c,m=_,c=a,_=g,a=o,g=p,o=s+q+qn(p=f+W|0,f)|0,s=i,f=h,i=n,h=d,n=r,d=u,r=q+z+qn(u=W+V|0,W)|0}this._al=this._al+u|0,this._bl=this._bl+d|0,this._cl=this._cl+h|0,this._dl=this._dl+f|0,this._el=this._el+p|0,this._fl=this._fl+g|0,this._gl=this._gl+_|0,this._hl=this._hl+m|0,this._ah=this._ah+r+qn(this._al,u)|0,this._bh=this._bh+n+qn(this._bl,d)|0,this._ch=this._ch+i+qn(this._cl,h)|0,this._dh=this._dh+s+qn(this._dl,f)|0,this._eh=this._eh+o+qn(this._el,p)|0,this._fh=this._fh+a+qn(this._fl,g)|0,this._gh=this._gh+c+qn(this._gl,_)|0,this._hh=this._hh+l+qn(this._hl,m)|0},Nn.prototype._hash=function(){var e=An.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Vn=Nn,zn=l.exports,$n=Vn,Jn=Wr,Kn=yt.exports.Buffer,Gn=new Array(160);function Zn(){this.init(),this._w=Gn,Jn.call(this,128,112)}zn(Zn,$n),Zn.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},Zn.prototype._hash=function(){var e=Kn.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Qn=Zn,Yn=Dr.exports=function(e){e=e.toLowerCase();var t=Yn[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};Yn.sha=Qr,Yn.sha1=cn,Yn.sha224=xn,Yn.sha256=wn,Yn.sha384=Qn,Yn.sha512=Vn,Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.WalletLinkSession=void 0;const Xn=Dr.exports,ei=I,ti="session:id",ri="session:secret",ni="session:linked";class ii{constructor(e,t,r,n){this._storage=e,this._id=t||(0,ei.randomBytesHex)(16),this._secret=r||(0,ei.randomBytesHex)(32),this._key=(new Xn.sha256).update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!n}static load(e){const t=e.getItem(ti),r=e.getItem(ni),n=e.getItem(ri);return t&&n?new ii(e,t,n,"1"===r):null}static hash(e){return(new Xn.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(ti,this._id),this._storage.setItem(ri,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(ni,this._linked?"1":"0")}}Fr.WalletLinkSession=ii;var si={};Object.defineProperty(si,"__esModule",{value:!0}),si.WalletLinkCipher=void 0;const oi=I;si.WalletLinkCipher=class{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.importKey("raw",(0,oi.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,s=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},n,i.encode(e)),o=s.slice(s.byteLength-16),a=s.slice(0,s.byteLength-16),c=new Uint8Array(o),l=new Uint8Array(a),u=new Uint8Array([...r,...c,...l]);return(0,oi.uint8ArrayToHex)(u)}async decrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");return new Promise(((r,n)=>{!async function(){const i=await crypto.subtle.importKey("raw",(0,oi.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=(0,oi.hexStringToUint8Array)(e),o=s.slice(0,12),a=s.slice(12,28),c=s.slice(28),l=new Uint8Array([...c,...a]),u={name:"AES-GCM",iv:new Uint8Array(o)};try{const e=await window.crypto.subtle.decrypt(u,i,l),t=new TextDecoder;r(t.decode(e))}catch(e){n(e)}}()}))}};var ai={};Object.defineProperty(ai,"__esModule",{value:!0}),ai.WalletLinkHTTP=void 0;ai.WalletLinkHTTP=class{constructor(e,t,r){this.linkAPIUrl=e,this.sessionId=t;const n=`${t}:${r}`;this.auth=`Basic ${btoa(n)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map((e=>fetch(`${this.linkAPIUrl}/events/${e.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}})))).catch((e=>console.error("Unabled to mark event as failed:",e)))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:r,error:n}=await t.json();if(n)throw new Error(`Check unseen events failed: ${n}`);const i=null!==(e=null==r?void 0:r.filter((e=>"Web3Response"===e.event)).map((e=>({type:"Event",sessionId:this.sessionId,eventId:e.id,event:e.event,data:e.data}))))&&void 0!==e?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${t.status}`)}};var ci,li={};Object.defineProperty(li,"__esModule",{value:!0}),li.WalletLinkWebSocket=li.ConnectionState=void 0,function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"}(ci||(li.ConnectionState=ci={}));li.WalletLinkWebSocket=class{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise(((e,t)=>{var r;let n;try{this.webSocket=n=new this.WebSocketClass(this.url)}catch(e){return void t(e)}null===(r=this.connectionStateListener)||void 0===r||r.call(this,ci.CONNECTING),n.onclose=e=>{var r;this.clearWebSocket(),t(new Error(`websocket error ${e.code}: ${e.reason}`)),null===(r=this.connectionStateListener)||void 0===r||r.call(this,ci.DISCONNECTED)},n.onopen=t=>{var r;if(e(),null===(r=this.connectionStateListener)||void 0===r||r.call(this,ci.CONNECTED),this.pendingData.length>0){[...this.pendingData].forEach((e=>this.sendData(e))),this.pendingData=[]}},n.onmessage=e=>{var t,r;if("h"===e.data)null===(t=this.incomingDataListener)||void 0===t||t.call(this,{type:"Heartbeat"});else try{const t=JSON.parse(e.data);null===(r=this.incomingDataListener)||void 0===r||r.call(this,t)}catch(e){}}}))}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),null===(e=this.connectionStateListener)||void 0===e||e.call(this,ci.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch(e){}}}sendData(e){const{webSocket:t}=this;if(!t)return this.pendingData.push(e),void this.connect();t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}},Object.defineProperty(Br,"__esModule",{value:!0}),Br.WalletLinkConnection=void 0;const ui=Or,di=Ar,hi=Fr,fi=si,pi=ai,gi=li,_i=x;Br.WalletLinkConnection=class{constructor({session:e,linkAPIUrl:t,listener:r,diagnostic:n,WebSocketClass:i=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,_i.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=e=>{if(!e)return;const t=new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",t=>e.JsonRpcUrl&&this.handleChainUpdated(t,e.JsonRpcUrl)]]);t.forEach(((t,r)=>{const n=e[r];void 0!==n&&t(n)}))},this.handleDestroyed=e=>{var t,r;"1"===e&&(null===(t=this.listener)||void 0===t||t.resetAndReload(),null===(r=this.diagnostic)||void 0===r||r.log(ui.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:hi.WalletLinkSession.hash(this.session.id)}))},this.handleAccountUpdated=async e=>{var t,r;try{const r=await this.cipher.decrypt(e);null===(t=this.listener)||void 0===t||t.accountUpdated(r)}catch(e){null===(r=this.diagnostic)||void 0===r||r.log(ui.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(e,t)=>{var r,n;try{const n=await this.cipher.decrypt(t);null===(r=this.listener)||void 0===r||r.metadataUpdated(e,n)}catch(t){null===(n=this.diagnostic)||void 0===n||n.log(ui.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:e})}},this.handleWalletUsernameUpdated=async e=>{this.handleMetadataUpdated(di.WALLET_USER_NAME_KEY,e)},this.handleAppVersionUpdated=async e=>{this.handleMetadataUpdated(di.APP_VERSION_KEY,e)},this.handleChainUpdated=async(e,t)=>{var r,n;try{const n=await this.cipher.decrypt(e),i=await this.cipher.decrypt(t);null===(r=this.listener)||void 0===r||r.chainUpdated(n,i)}catch(e){null===(n=this.diagnostic)||void 0===n||n.log(ui.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=e,this.cipher=new fi.WalletLinkCipher(e.secret),this.diagnostic=n,this.listener=r;const s=new gi.WalletLinkWebSocket(`${t}/rpc`,i);s.setConnectionStateListener((async t=>{var r;null===(r=this.diagnostic)||void 0===r||r.log(ui.EVENTS.CONNECTED_STATE_CHANGE,{state:t,sessionIdHash:hi.WalletLinkSession.hash(e.id)});let n=!1;switch(t){case gi.ConnectionState.DISCONNECTED:if(!this.destroyed){const e=async()=>{await new Promise((e=>setTimeout(e,5e3))),this.destroyed||s.connect().catch((()=>{e()}))};e()}break;case gi.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),n=!0}catch(e){}this.updateLastHeartbeat(),setInterval((()=>{this.heartbeat()}),1e4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();case gi.ConnectionState.CONNECTING:}this.connected!==n&&(this.connected=n)})),s.setIncomingDataListener((t=>{var r,n,i;switch(t.type){case"Heartbeat":return void this.updateLastHeartbeat();case"IsLinkedOK":case"Linked":{const n="IsLinkedOK"===t.type?t.linked:void 0;null===(r=this.diagnostic)||void 0===r||r.log(ui.EVENTS.LINKED,{sessionIdHash:hi.WalletLinkSession.hash(e.id),linked:n,type:t.type,onlineGuests:t.onlineGuests}),this.linked=n||t.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":null===(n=this.diagnostic)||void 0===n||n.log(ui.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:hi.WalletLinkSession.hash(e.id),metadata_keys:t&&t.metadata?Object.keys(t.metadata):void 0}),this.handleSessionMetadataUpdated(t.metadata);break;case"Event":this.handleIncomingEvent(t)}void 0!==t.id&&(null===(i=this.requestResolutions.get(t.id))||void 0===i||i(t))})),this.ws=s,this.http=new pi.WalletLinkHTTP(t,e.id,e.key)}connect(){var e;if(this.destroyed)throw new Error("instance is destroyed");null===(e=this.diagnostic)||void 0===e||e.log(ui.EVENTS.STARTED_CONNECTING,{sessionIdHash:hi.WalletLinkSession.hash(this.session.id)}),this.ws.connect()}destroy(){var e;this.destroyed=!0,this.ws.disconnect(),null===(e=this.diagnostic)||void 0===e||e.log(ui.EVENTS.DISCONNECTED,{sessionIdHash:hi.WalletLinkSession.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t;this._connected=e,e&&(null===(t=this.onceConnected)||void 0===t||t.call(this))}setOnceConnected(e){return new Promise((t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}}))}get linked(){return this._linked}set linked(e){var t,r;this._linked=e,e&&(null===(t=this.onceLinked)||void 0===t||t.call(this)),null===(r=this.listener)||void 0===r||r.linkedUpdated(e)}setOnceLinked(e){return new Promise((t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}}))}async handleIncomingEvent(e){var t,r;if("Event"===e.type&&"Web3Response"===e.event)try{const r=await this.cipher.decrypt(e.data),n=JSON.parse(r);if("WEB3_RESPONSE"!==n.type)return;null===(t=this.listener)||void 0===t||t.handleWeb3ResponseMessage(n)}catch(e){null===(r=this.diagnostic)||void 0===r||r.log(ui.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(this.connected){await new Promise((e=>setTimeout(e,250)));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}else this.shouldFetchUnseenEventsOnConnect=!0}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1;(await this.http.fetchUnseenEvents()).forEach((e=>this.handleIncomingEvent(e)))}async setSessionMetadata(e,t){const r={type:"SetSessionConfig",id:(0,_i.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected((async()=>{const e=await this.makeRequest(r);if("Fail"===e.type)throw new Error(e.error||"failed to set session metadata")}))}async publishEvent(e,t,r=!1){const n=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,_i.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:n,callWebhook:r};return this.setOnceLinked((async()=>{const e=await this.makeRequest(i);if("Fail"===e.type)throw new Error(e.error||"failed to publish event");return e.eventId}))}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>2e4)this.ws.disconnect();else try{this.ws.sendData("h")}catch(e){}}async makeRequest(e,t=6e4){const r=e.id;let n;return this.sendData(e),Promise.race([new Promise(((e,i)=>{n=window.setTimeout((()=>{i(new Error(`request ${r} timed out`))}),t)})),new Promise((e=>{this.requestResolutions.set(r,(t=>{clearTimeout(n),e(t),this.requestResolutions.delete(r)}))}))])}async authenticate(){const e={type:"HostSession",id:(0,_i.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if("Fail"===t.type)throw new Error(t.error||"failed to authentcate")}sendIsLinked(){const e={type:"IsLinked",id:(0,_i.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,_i.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}};var mi={};Object.defineProperty(mi,"__esModule",{value:!0}),mi.isDarkMode=mi.isMobileWeb=mi.getLocation=mi.createQrUrl=void 0,mi.createQrUrl=function(e,t,r,n,i,s){return`${r}/#/link?${new URLSearchParams({[n?"parent-id":"id"]:e,secret:t,server:r,v:i,chainId:s.toString()}).toString()}`},mi.getLocation=function(){try{return function(){try{return null!==window.frameElement}catch(e){return!1}}()&&window.top?window.top.location:window.location}catch(e){return window.location}},mi.isMobileWeb=function(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.userAgent)},mi.isDarkMode=function(){var e,t;return null!==(t=null===(e=null===window||void 0===window?void 0:window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)&&void 0!==t&&t};var yi={},bi={},vi={};Object.defineProperty(vi,"__esModule",{value:!0}),vi.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var wi=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(bi,"__esModule",{value:!0}),bi.injectCssReset=void 0;const Ei=wi(vi);bi.injectCssReset=function(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Ei.default)),document.documentElement.appendChild(e)};var Si={};function ki(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=ki(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Ci(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=ki(e))&&(n&&(n+=" "),n+=t);return n}var Ri,Ii,xi,Mi,Ti,Ai,Li,Pi,Ni,ji,Bi,Oi,Fi=t(Object.freeze({__proto__:null,clsx:Ci,default:Ci})),Di={},Ui=[],Hi=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Wi=Array.isArray;function qi(e,t){for(var r in t)e[r]=t[r];return e}function Vi(e){var t=e.parentNode;t&&t.removeChild(e)}function zi(e,t,r){var n,i,s,o={};for(s in t)"key"==s?n=t[s]:"ref"==s?i=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?Ri.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===o[s]&&(o[s]=e.defaultProps[s]);return $i(e,o,n,i,null)}function $i(e,t,r,n,i){var s={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==i?++xi:i,__i:-1,__u:0};return null==i&&null!=Ii.vnode&&Ii.vnode(s),s}function Ji(e){return e.children}function Ki(e,t){this.props=e,this.context=t}function Gi(e,t){if(null==t)return e.__?Gi(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?Gi(e):null}function Zi(e){var t,r;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e){e.__e=e.__c.base=r.__e;break}return Zi(e)}}function Qi(e){(!e.__d&&(e.__d=!0)&&Ti.push(e)&&!Yi.__r++||Ai!==Ii.debounceRendering)&&((Ai=Ii.debounceRendering)||Li)(Yi)}function Yi(){var e,t,r,n,i,s,o,a;for(Ti.sort(Pi);e=Ti.shift();)e.__d&&(t=Ti.length,n=void 0,s=(i=(r=e).__v).__e,o=[],a=[],r.__P&&((n=qi({},i)).__v=i.__v+1,Ii.vnode&&Ii.vnode(n),ss(r.__P,n,i,r.__n,void 0!==r.__P.ownerSVGElement,32&i.__u?[s]:null,o,null==s?Gi(i):s,!!(32&i.__u),a),n.__v=i.__v,n.__.__k[n.__i]=n,os(o,n,a),n.__e!=s&&Zi(n)),Ti.length>t&&Ti.sort(Pi));Yi.__r=0}function Xi(e,t,r,n,i,s,o,a,c,l,u){var d,h,f,p,g,_=n&&n.__k||Ui,m=t.length;for(r.__d=c,function(e,t,r){var n,i,s,o,a,c=t.length,l=r.length,u=l,d=0;for(e.__k=[],n=0;n<c;n++)o=n+d,null!=(i=e.__k[n]=null==(i=t[n])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?$i(null,i,null,null,null):Wi(i)?$i(Ji,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?$i(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=e,i.__b=e.__b+1,a=ts(i,r,o,u),i.__i=a,s=null,-1!==a&&(u--,(s=r[a])&&(s.__u|=131072)),null==s||null===s.__v?(-1==a&&d--,"function"!=typeof i.type&&(i.__u|=65536)):a!==o&&(a===o+1?d++:a>o?u>c-o?d+=a-o:d--:a<o?a==o-1&&(d=a-o):d=0,a!==n+d&&(i.__u|=65536))):(s=r[o])&&null==s.key&&s.__e&&0==(131072&s.__u)&&(s.__e==e.__d&&(e.__d=Gi(s)),ls(s,s,!1),r[o]=null,u--);if(u)for(n=0;n<l;n++)null!=(s=r[n])&&0==(131072&s.__u)&&(s.__e==e.__d&&(e.__d=Gi(s)),ls(s,s))}(r,t,_),c=r.__d,d=0;d<m;d++)null!=(f=r.__k[d])&&"boolean"!=typeof f&&"function"!=typeof f&&(h=-1===f.__i?Di:_[f.__i]||Di,f.__i=d,ss(e,f,h,i,s,o,a,c,l,u),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&cs(h.ref,null,f),u.push(f.ref,f.__c||p,f)),null==g&&null!=p&&(g=p),65536&f.__u||h.__k===f.__k?(c&&!c.isConnected&&(c=Gi(h)),c=es(f,c,e)):"function"==typeof f.type&&void 0!==f.__d?c=f.__d:p&&(c=p.nextSibling),f.__d=void 0,f.__u&=-196609);r.__d=c,r.__e=g}function es(e,t,r){var n,i;if("function"==typeof e.type){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,t=es(n[i],t,r));return t}e.__e!=t&&(r.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8===t.nodeType);return t}function ts(e,t,r,n){var i=e.key,s=e.type,o=r-1,a=r+1,c=t[r];if(null===c||c&&i==c.key&&s===c.type&&0==(131072&c.__u))return r;if(n>(null!=c&&0==(131072&c.__u)?1:0))for(;o>=0||a<t.length;){if(o>=0){if((c=t[o])&&0==(131072&c.__u)&&i==c.key&&s===c.type)return o;o--}if(a<t.length){if((c=t[a])&&0==(131072&c.__u)&&i==c.key&&s===c.type)return a;a++}}return-1}function rs(e,t,r){"-"===t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||Hi.test(t)?r:r+"px"}function ns(e,t,r,n,i){var s;e:if("style"===t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof n&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||rs(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||rs(e.style,t,r[t])}else if("o"===t[0]&&"n"===t[1])s=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||"onFocusOut"===t||"onFocusIn"===t?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?n?r.u=n.u:(r.u=Ni,e.addEventListener(t,s?Bi:ji,s)):e.removeEventListener(t,s?Bi:ji,s);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&t in e)try{e[t]=null==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,r))}}function is(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t.t)t.t=Ni++;else if(t.t<r.u)return;return r(Ii.event?Ii.event(t):t)}}}function ss(e,t,r,n,i,s,o,a,c,l){var u,d,h,f,p,g,_,m,y,b,v,w,E,S,k,C=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(c=!!(32&r.__u),s=[a=t.__e=r.__e]),(u=Ii.__b)&&u(t);e:if("function"==typeof C)try{if(m=t.props,y=(u=C.contextType)&&n[u.__c],b=u?y?y.props.value:u.__:n,r.__c?_=(d=t.__c=r.__c).__=d.__E:("prototype"in C&&C.prototype.render?t.__c=d=new C(m,b):(t.__c=d=new Ki(m,b),d.constructor=C,d.render=us),y&&y.sub(d),d.props=m,d.state||(d.state={}),d.context=b,d.__n=n,h=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=qi({},d.__s)),qi(d.__s,C.getDerivedStateFromProps(m,d.__s))),f=d.props,p=d.state,d.__v=t,h)null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==C.getDerivedStateFromProps&&m!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,b),!d.__e&&(null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,b)||t.__v===r.__v)){for(t.__v!==r.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.forEach((function(e){e&&(e.__=t)})),v=0;v<d._sb.length;v++)d.__h.push(d._sb[v]);d._sb=[],d.__h.length&&o.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,b),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(f,p,g)}))}if(d.context=b,d.props=m,d.__P=e,d.__e=!1,w=Ii.__r,E=0,"prototype"in C&&C.prototype.render){for(d.state=d.__s,d.__d=!1,w&&w(t),u=d.render(d.props,d.state,d.context),S=0;S<d._sb.length;S++)d.__h.push(d._sb[S]);d._sb=[]}else do{d.__d=!1,w&&w(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++E<25);d.state=d.__s,null!=d.getChildContext&&(n=qi(qi({},n),d.getChildContext())),h||null==d.getSnapshotBeforeUpdate||(g=d.getSnapshotBeforeUpdate(f,p)),Xi(e,Wi(k=null!=u&&u.type===Ji&&null==u.key?u.props.children:u)?k:[k],t,r,n,i,s,o,a,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),_&&(d.__E=d.__=null)}catch(e){t.__v=null,c||null!=s?(t.__e=a,t.__u|=c?160:32,s[s.indexOf(a)]=null):(t.__e=r.__e,t.__k=r.__k),Ii.__e(e,t,r)}else null==s&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=as(r.__e,t,r,n,i,s,o,c,l);(u=Ii.diffed)&&u(t)}function os(e,t,r){t.__d=void 0;for(var n=0;n<r.length;n++)cs(r[n],r[++n],r[++n]);Ii.__c&&Ii.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Ii.__e(e,t.__v)}}))}function as(e,t,r,n,i,s,o,a,c){var l,u,d,h,f,p,g,_=r.props,m=t.props,y=t.type;if("svg"===y&&(i=!0),null!=s)for(l=0;l<s.length;l++)if((f=s[l])&&"setAttribute"in f==!!y&&(y?f.localName===y:3===f.nodeType)){e=f,s[l]=null;break}if(null==e){if(null===y)return document.createTextNode(m);e=i?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,m.is&&m),s=null,a=!1}if(null===y)_===m||a&&e.data===m||(e.data=m);else{if(s=s&&Ri.call(e.childNodes),_=r.props||Di,!a&&null!=s)for(_={},l=0;l<e.attributes.length;l++)_[(f=e.attributes[l]).name]=f.value;for(l in _)f=_[l],"children"==l||("dangerouslySetInnerHTML"==l?d=f:"key"===l||l in m||ns(e,l,null,f,i));for(l in m)f=m[l],"children"==l?h=f:"dangerouslySetInnerHTML"==l?u=f:"value"==l?p=f:"checked"==l?g=f:"key"===l||a&&"function"!=typeof f||_[l]===f||ns(e,l,f,_[l],i);if(u)a||d&&(u.__html===d.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),Xi(e,Wi(h)?h:[h],t,r,n,i&&"foreignObject"!==y,s,o,s?s[0]:r.__k&&Gi(r,0),a,c),null!=s)for(l=s.length;l--;)null!=s[l]&&Vi(s[l]);a||(l="value",void 0!==p&&(p!==e[l]||"progress"===y&&!p||"option"===y&&p!==_[l])&&ns(e,l,p,_[l],!1),l="checked",void 0!==g&&g!==e[l]&&ns(e,l,g,_[l],!1))}return e}function cs(e,t,r){try{"function"==typeof e?e(t):e.current=t}catch(e){Ii.__e(e,r)}}function ls(e,t,r){var n,i;if(Ii.unmount&&Ii.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||cs(n,null,t)),null!=(n=e.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(e){Ii.__e(e,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&ls(n[i],t,r||"function"!=typeof e.type);r||null==e.__e||Vi(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function us(e,t,r){return this.constructor(e,r)}function ds(e,t,r){var n,i,s,o;Ii.__&&Ii.__(e,t),i=(n="function"==typeof r)?null:r&&r.__k||t.__k,s=[],o=[],ss(t,e=(!n&&r||t).__k=zi(Ji,null,[e]),i||Di,Di,void 0!==t.ownerSVGElement,!n&&r?[r]:i?null:t.firstChild?Ri.call(t.childNodes):null,s,!n&&r?r:i?i.__e:t.firstChild,n,o),os(s,e,o)}Ri=Ui.slice,Ii={__e:function(e,t,r,n){for(var i,s,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&null!=s.getDerivedStateFromError&&(i.setState(s.getDerivedStateFromError(e)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,n||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},xi=0,Mi=function(e){return null!=e&&null==e.constructor},Ki.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=qi({},this.state),"function"==typeof e&&(e=e(qi({},r),this.props)),e&&qi(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),Qi(this))},Ki.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Qi(this))},Ki.prototype.render=Ji,Ti=[],Li="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Pi=function(e,t){return e.__v.__b-t.__v.__b},Yi.__r=0,Ni=0,ji=is(!1),Bi=is(!0),Oi=0;var hs,fs,ps,gs,_s=Object.freeze({__proto__:null,Component:Ki,Fragment:Ji,cloneElement:function(e,t,r){var n,i,s,o,a=qi({},e.props);for(s in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==s?n=t[s]:"ref"==s?i=t[s]:a[s]=void 0===t[s]&&void 0!==o?o[s]:t[s];return arguments.length>2&&(a.children=arguments.length>3?Ri.call(arguments,2):r),$i(e.type,a,n||e.key,i||e.ref,null)},createContext:function(e,t){var r={__c:t="__cC"+Oi++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var r,n;return this.getChildContext||(r=[],(n={})[t]=this,this.getChildContext=function(){return n},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&r.some((function(e){e.__e=!0,Qi(e)}))},this.sub=function(e){r.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r.splice(r.indexOf(e),1),t&&t.call(e)}}),e.children}};return r.Provider.__=r.Consumer.contextType=r},createElement:zi,createRef:function(){return{current:null}},h:zi,hydrate:function e(t,r){ds(t,r,e)},get isValidElement(){return Mi},get options(){return Ii},render:ds,toChildArray:function e(t,r){return r=r||[],null==t||"boolean"==typeof t||(Wi(t)?t.some((function(t){e(t,r)})):r.push(t)),r}}),ms=t(_s),ys=0,bs=[],vs=[],ws=Ii,Es=ws.__b,Ss=ws.__r,ks=ws.diffed,Cs=ws.__c,Rs=ws.unmount,Is=ws.__;function xs(e,t){ws.__h&&ws.__h(fs,e,ys||t),ys=0;var r=fs.__H||(fs.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({__V:vs}),r.__[e]}function Ms(e){return ys=1,Ts(Ds,e)}function Ts(e,t,r){var n=xs(hs++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):Ds(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],r=n.t(t,e);t!==r&&(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=fs,!fs.u)){var i=function(e,t,r){if(!n.__c.__H)return!0;var i=n.__c.__H.__.filter((function(e){return!!e.__c}));if(i.every((function(e){return!e.__N})))return!s||s.call(this,e,t,r);var o=!1;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),!(!o&&n.__c.props===e)&&(!s||s.call(this,e,t,r))};fs.u=!0;var s=fs.shouldComponentUpdate,o=fs.componentWillUpdate;fs.componentWillUpdate=function(e,t,r){if(this.__e){var n=s;s=void 0,i(e,t,r),s=n}o&&o.call(this,e,t,r)},fs.shouldComponentUpdate=i}return n.__N||n.__}function As(e,t){var r=xs(hs++,4);!ws.__s&&Fs(r.__H,t)&&(r.__=e,r.i=t,fs.__h.push(r))}function Ls(e,t){var r=xs(hs++,7);return Fs(r.__H,t)?(r.__V=e(),r.i=t,r.__h=e,r.__V):r.__}function Ps(){for(var e;e=bs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Bs),e.__H.__h.forEach(Os),e.__H.__h=[]}catch(t){e.__H.__h=[],ws.__e(t,e.__v)}}ws.__b=function(e){fs=null,Es&&Es(e)},ws.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Is&&Is(e,t)},ws.__r=function(e){Ss&&Ss(e),hs=0;var t=(fs=e.__c).__H;t&&(ps===fs?(t.__h=[],fs.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=vs,e.__N=e.i=void 0}))):(t.__h.forEach(Bs),t.__h.forEach(Os),t.__h=[],hs=0)),ps=fs},ws.diffed=function(e){ks&&ks(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==bs.push(t)&&gs===ws.requestAnimationFrame||((gs=ws.requestAnimationFrame)||js)(Ps)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==vs&&(e.__=e.__V),e.i=void 0,e.__V=vs}))),ps=fs=null},ws.__c=function(e,t){t.some((function(e){try{e.__h.forEach(Bs),e.__h=e.__h.filter((function(e){return!e.__||Os(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],ws.__e(r,e.__v)}})),Cs&&Cs(e,t)},ws.unmount=function(e){Rs&&Rs(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach((function(e){try{Bs(e)}catch(e){t=e}})),r.__H=void 0,t&&ws.__e(t,r.__v))};var Ns="function"==typeof requestAnimationFrame;function js(e){var t,r=function(){clearTimeout(n),Ns&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Ns&&(t=requestAnimationFrame(r))}function Bs(e){var t=fs,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),fs=t}function Os(e){var t=fs;e.__c=e.__(),fs=t}function Fs(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function Ds(e,t){return"function"==typeof t?t(e):t}var Us=Object.freeze({__proto__:null,useCallback:function(e,t){return ys=8,Ls((function(){return e}),t)},useContext:function(e){var t=fs.context[e.__c],r=xs(hs++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(fs)),t.props.value):e.__},useDebugValue:function(e,t){ws.useDebugValue&&ws.useDebugValue(t?t(e):e)},useEffect:function(e,t){var r=xs(hs++,3);!ws.__s&&Fs(r.__H,t)&&(r.__=e,r.i=t,fs.__H.__h.push(r))},useErrorBoundary:function(e){var t=xs(hs++,10),r=Ms();return t.__=e,fs.componentDidCatch||(fs.componentDidCatch=function(e,n){t.__&&t.__(e,n),r[1](e)}),[r[0],function(){r[1](void 0)}]},useId:function(){var e=xs(hs++,11);if(!e.__){for(var t=fs.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__},useImperativeHandle:function(e,t,r){ys=6,As((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==r?r:r.concat(e))},useLayoutEffect:As,useMemo:Ls,useReducer:Ts,useRef:function(e){return ys=5,Ls((function(){return{current:e}}),[])},useState:Ms}),Hs=t(Us),Ws={};Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",function(t){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const n=r(Fi),i=ms,s=Hs,o=mi,a=r(Ws);t.Snackbar=class{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,o.isDarkMode)()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const t=this.nextItemKey++;return this.items.set(t,e),this.render(),()=>{this.items.delete(t),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,i.render)((0,i.h)("div",null,(0,i.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map((([e,r])=>(0,i.h)(t.SnackbarInstance,Object.assign({},r,{key:e})))))),this.root)}};t.SnackbarContainer=e=>(0,i.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-container")},(0,i.h)("style",null,a.default),(0,i.h)("div",{class:"-cbwsdk-snackbar"},e.children));t.SnackbarInstance=({autoExpand:e,message:t,menuItems:r})=>{const[o,a]=(0,s.useState)(!0),[c,l]=(0,s.useState)(null!=e&&e);(0,s.useEffect)((()=>{const e=[window.setTimeout((()=>{a(!1)}),1),window.setTimeout((()=>{l(!0)}),1e4)];return()=>{e.forEach(window.clearTimeout)}}));return(0,i.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-instance",o&&"-cbwsdk-snackbar-instance-hidden",c&&"-cbwsdk-snackbar-instance-expanded")},(0,i.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:()=>{l(!c)}},(0,i.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,i.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),(0,i.h)("div",{class:"-gear-container"},!c&&(0,i.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,i.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=",class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&(0,i.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map(((e,t)=>(0,i.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-instance-menu-item",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:e.onClick,key:t},(0,i.h)("svg",{width:e.svgWidth,height:e.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,i.h)("path",{"fill-rule":e.defaultFillRule,"clip-rule":e.defaultClipRule,d:e.path,fill:"#AAAAAA"})),(0,i.h)("span",{class:(0,n.default)("-cbwsdk-snackbar-instance-menu-item-info",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},e.info))))))}}(Si),Object.defineProperty(yi,"__esModule",{value:!0}),yi.WalletLinkRelayUI=void 0;const qs=bi,Vs=Si;yi.WalletLinkRelayUI=class{constructor(){this.attached=!1,this.snackbar=new Vs.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.snackbar.attach(t),this.attached=!0,(0,qs.injectCssReset)()}showConnecting(e){let t;return t=e.isUnlinkedErrorState?{autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:{message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}reloadUI(){document.location.reload()}};var zs={},$s={},Js={};Object.defineProperty(Js,"__esModule",{value:!0}),Js.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var Ks=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($s,"__esModule",{value:!0}),$s.RedirectDialog=void 0;const Gs=Ks(Fi),Zs=ms,Qs=bi,Ys=Si,Xs=mi,eo=Ks(Js);$s.RedirectDialog=class{constructor(){this.root=null,this.darkMode=(0,Xs.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Qs.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,Zs.render)(null,this.root),e&&(0,Zs.render)((0,Zs.h)(to,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}};const to=({title:e,buttonText:t,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return(0,Zs.h)(Ys.SnackbarContainer,{darkMode:r},(0,Zs.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Zs.h)("style",null,eo.default),(0,Zs.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),(0,Zs.h)("div",{class:(0,Gs.default)("-cbwsdk-redirect-dialog-box",s)},(0,Zs.h)("p",null,e),(0,Zs.h)("button",{onClick:n},t))))};var ro={};Object.defineProperty(ro,"__esModule",{value:!0}),ro.CBW_MOBILE_DEEPLINK_URL=ro.WALLETLINK_URL=ro.CB_KEYS_URL=void 0,ro.CB_KEYS_URL="https://keys.coinbase.com/connect",ro.WALLETLINK_URL="https://www.walletlink.org",ro.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink",Object.defineProperty(zs,"__esModule",{value:!0}),zs.WLMobileRelayUI=void 0;const no=$s,io=mi,so=ro;zs.WLMobileRelayUI=class{constructor(){this.attached=!1,this.redirectDialog=new no.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const t=new URL(so.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,io.getLocation)().href),e&&t.searchParams.append("wl_url",e);const r=document.createElement("a");r.target="cbw-opener",r.href=t.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout((()=>{this.redirectToCoinbaseWallet(e)}),99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}reloadUI(){}},Object.defineProperty(jr,"__esModule",{value:!0}),jr.WalletLinkRelay=void 0;const oo=oe,ao=Br,co=Or,lo=Ar,uo=Lr,ho=Fr,fo=Nr,po=mi,go=yi,_o=zs,mo=g,yo=I;class bo extends lo.RelayAbstract{constructor(e){var t;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,po.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=e=>{var t;this.isLinked=e;const r=this.storage.getItem(lo.LOCAL_STORAGE_ADDRESSES_KEY);if(e&&(this._session.linked=e),this.isUnlinkedErrorState=!1,r){const n=r.split(" "),i="true"===this.storage.getItem("IsStandaloneSigning");if(""!==n[0]&&!e&&this._session.linked&&!i){this.isUnlinkedErrorState=!0;const e=this.getSessionIdHash();null===(t=this.diagnostic)||void 0===t||t.log(co.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:e})}}},this.metadataUpdated=(e,t)=>{this.storage.setItem(e,t)},this.chainUpdated=(e,t)=>{this.chainCallbackParams.chainId===e&&this.chainCallbackParams.jsonRpcUrl===t||(this.chainCallbackParams={chainId:e,jsonRpcUrl:t},this.chainCallback&&this.chainCallback(e,t))},this.accountUpdated=e=>{this.accountsCallback&&this.accountsCallback([e]),bo.accountRequestCallbackIds.size>0&&(Array.from(bo.accountRequestCallbackIds.values()).forEach((t=>{const r={type:"WEB3_RESPONSE",id:t,response:{method:"requestEthereumAccounts",result:[e]}};this.invokeCallback(Object.assign(Object.assign({},r),{id:t}))})),bo.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:r,ui:n,connection:i}=this.subscribe();this._session=r,this.connection=i,this.relayEventManager=new uo.RelayEventManager,this.diagnostic=e.diagnosticLogger,this._reloadOnDisconnect=null!==(t=e.reloadOnDisconnect)&&void 0!==t&&t,this.ui=n}subscribe(){const e=ho.WalletLinkSession.load(this.storage)||new ho.WalletLinkSession(this.storage).save(),{linkAPIUrl:t,diagnostic:r}=this,n=new ao.WalletLinkConnection({session:e,linkAPIUrl:t,diagnostic:r,listener:this}),i=this.isMobileWeb?new _o.WLMobileRelayUI:new go.WalletLinkRelayUI;return n.connect(),{session:e,ui:i,connection:n}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise((e=>setTimeout((()=>e(null)),1e3)))]).then((()=>{var e,t;null===(e=this.diagnostic)||void 0===e||e.log(co.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const r=ho.WalletLinkSession.load(this.storage);if((null==r?void 0:r.id)===this._session.id?this.storage.clear():r&&(null===(t=this.diagnostic)||void 0===t||t.log(co.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:ho.WalletLinkSession.hash(r.id)})),this._reloadOnDisconnect)return void this.ui.reloadUI();this.accountsCallback&&this.accountsCallback([],!0);const{session:n,ui:i,connection:s}=this.subscribe();this._session=n,this.connection=s,this.ui=i,this.attachUI()})).catch((e=>{var t;null===(t=this.diagnostic)||void 0===t||t.log(co.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${e}`,sessionIdHash:this.getSessionIdHash()})}))}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,r,n){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,yo.hexStringFromBuffer)(e,!0),address:t,addPrefix:r,typedDataJson:n||null}})}ethereumAddressFromSignedMessage(e,t,r){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,yo.hexStringFromBuffer)(e,!0),signature:(0,yo.hexStringFromBuffer)(t,!0),addPrefix:r}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,yo.bigIntStringFromBigInt)(e.weiValue),data:(0,yo.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,yo.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,yo.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,yo.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,yo.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,yo.bigIntStringFromBigInt)(e.weiValue),data:(0,yo.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,yo.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,yo.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,yo.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,yo.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,yo.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getQRCodeUrl(){return(0,po.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,oo.LIB_VERSION,this.dappDefaultChain)}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null;const r=(0,yo.randomBytesHex)(8),n=n=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,n),null==t||t()};return{promise:new Promise(((i,s)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:n,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,(e=>{if(null==t||t(),(0,fo.isErrorResponse)(e))return s(new Error(e.errorMessage));i(e)})),this.publishWeb3RequestEvent(r,e)})),cancel:n}}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){var r;const n={type:"WEB3_REQUEST",id:e,request:t},i=ho.WalletLinkSession.load(this.storage);null===(r=this.diagnostic)||void 0===r||r.log(co.EVENTS.WEB3_REQUEST,{eventId:n.id,method:`relay::${t.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:i?ho.WalletLinkSession.hash(i.id):"",isSessionMismatched:((null==i?void 0:i.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",n,!0).then((e=>{var r;null===(r=this.diagnostic)||void 0===r||r.log(co.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:n.id,method:`relay::${t.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:i?ho.WalletLinkSession.hash(i.id):"",isSessionMismatched:((null==i?void 0:i.id)!==this._session.id).toString()})})).catch((e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n.id,response:{method:t.method,errorMessage:e.message}})})),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(!(this.ui instanceof _o.WLMobileRelayUI))return;let t=!1;switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:t=!0,this.ui.openCoinbaseWalletDeeplink()}t&&window.addEventListener("blur",(()=>{window.addEventListener("focus",(()=>{this.connection.checkUnseenEvents()}),{once:!0})}),{once:!0})}publishWeb3RequestCanceledEvent(e){const t={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",t,!1).then()}publishEvent(e,t,r){return this.connection.publishEvent(e,t,r)}handleWeb3ResponseMessage(e){var t;const{response:r}=e;if(null===(t=this.diagnostic)||void 0===t||t.log(co.EVENTS.WEB3_RESPONSE,{eventId:e.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash()}),"requestEthereumAccounts"===r.method)return bo.accountRequestCallbackIds.forEach((t=>this.invokeCallback(Object.assign(Object.assign({},e),{id:t})))),void bo.accountRequestCallbackIds.clear();this.invokeCallback(e)}handleErrorResponse(e,t,r){var n;const i=null!==(n=null==r?void 0:r.message)&&void 0!==n?n:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:i}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,yo.randomBytesHex)(8);return{promise:new Promise(((r,n)=>{this.relayEventManager.callbacks.set(t,(e=>{if((0,fo.isErrorResponse)(e))return n(new Error(e.errorMessage));r(e)})),bo.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)})),cancel:r=>{this.publishWeb3RequestCanceledEvent(t),this.handleErrorResponse(t,e.method,r)}}}watchAsset(e,t,r,n,i,s){const o={method:"watchAsset",params:{type:e,options:{address:t,symbol:r,decimals:n,image:i},chainId:s}};let a=null;const c=(0,yo.randomBytesHex)(8),l=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,o.method,e),null==a||a()};a=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload});return{cancel:l,promise:new Promise(((e,t)=>{this.relayEventManager.callbacks.set(c,(r=>{if(null==a||a(),(0,fo.isErrorResponse)(r))return t(new Error(r.errorMessage));e(r)})),this.publishWeb3RequestEvent(c,o)}))}}addEthereumChain(e,t,r,n,i,s){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:n,chainName:i,iconUrls:r,nativeCurrency:s}};let a=null;const c=(0,yo.randomBytesHex)(8),l=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,o.method,e),null==a||a()};a=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload});return{promise:new Promise(((e,t)=>{this.relayEventManager.callbacks.set(c,(r=>{if(null==a||a(),(0,fo.isErrorResponse)(r))return t(new Error(r.errorMessage));e(r)})),this.publishWeb3RequestEvent(c,o)})),cancel:l}}switchEthereumChain(e,t){const r={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},n=(0,yo.randomBytesHex)(8);return{promise:new Promise(((e,t)=>{this.relayEventManager.callbacks.set(n,(r=>(0,fo.isErrorResponse)(r)&&r.errorCode?t(mo.standardErrors.provider.custom({code:r.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."})):(0,fo.isErrorResponse)(r)?t(new Error(r.errorMessage)):void e(r))),this.publishWeb3RequestEvent(n,r)})),cancel:e=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,e)}}}getSessionIdHash(){return ho.WalletLinkSession.hash(this._session.id)}}jr.WalletLinkRelay=bo,bo.accountRequestCallbackIds=new Set;var vo=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Je,"__esModule",{value:!0}),Je.WLRelayAdapter=void 0;const wo=vo(Tr),Eo=Ar,So=Lr,ko=Nr,Co=jr,Ro=g,Io=ge,xo=I,Mo="DefaultChainId",To="DefaultJsonRpcUrl";Je.WLRelayAdapter=class{constructor(e){this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1,this._appName=e.appName,this._appLogoUrl=e.appLogoUrl,this._walletlinkUrl=e.walletlinkUrl,this._storage=new Io.ScopedLocalStorage("walletlink",this._walletlinkUrl),this.updateListener=e.updateListener,this._relayEventManager=new So.RelayEventManager,this._jsonRpcUrlFromOpts="";const t=this._storage.getItem(Eo.LOCAL_STORAGE_ADDRESSES_KEY);if(t){const e=t.split(" ");""!==e[0]&&(this._addresses=e.map((e=>(0,xo.ensureAddressString)(e))),this.updateListener.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(Mo)&&(this.updateListener.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0)}getQRCodeUrl(){return this.initializeRelay().getQRCodeUrl()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return null!==(e=this._storage.getItem(To))&&void 0!==e?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(To,e)}updateProviderInfo(e,t){this.jsonRpcUrl=e;const r=this.getChainId();this._storage.setItem(Mo,t.toString(10));!((0,xo.ensureIntNumber)(t)!==r)&&this.hasMadeFirstChainChangedEmission||(this.updateListener.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,r,n,i,s){const o=this.initializeRelay(),a=await o.watchAsset(e,t,r,n,i,null==s?void 0:s.toString()).promise;return!(0,ko.isErrorResponse)(a)&&!!a.result}async addEthereumChain(e,t,r,n,i,s){var o,a;if((0,xo.ensureIntNumber)(e)===this.getChainId())return!1;const c=this.initializeRelay();this._isAuthorized()||await c.requestEthereumAccounts().promise;const l=await c.addEthereumChain(e.toString(),t,i,r,n,s).promise;return!(0,ko.isErrorResponse)(l)&&(!0===(null===(o=l.result)||void 0===o?void 0:o.isApproved)&&this.updateProviderInfo(t[0],e),!0===(null===(a=l.result)||void 0===a?void 0:a.isApproved))}async switchEthereumChain(e){const t=this.initializeRelay(),r=await t.switchEthereumChain(e.toString(10),this.selectedAddress||void 0).promise;if((0,ko.isErrorResponse)(r)){if(!r.errorCode)return;throw r.errorCode===Ro.standardErrorCodes.provider.unsupportedChain?Ro.standardErrors.provider.unsupportedChain():Ro.standardErrors.provider.custom({message:r.errorMessage,code:r.errorCode})}const n=r.result;n.isApproved&&n.rpcUrl.length>0&&this.updateProviderInfo(n.rpcUrl,e)}async close(){this.initializeRelay().resetAndReload()}async request(e){try{return this._request(e).catch((e=>{throw e}))}catch(e){return Promise.reject(e)}}async _request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw Ro.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:r}=e;if("string"!=typeof t||0===t.length)throw Ro.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(void 0!==r&&!Array.isArray(r)&&("object"!=typeof r||null===r))throw Ro.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const n=void 0===r?[]:r,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:n,jsonrpc:"2.0",id:i})).result}_setAddresses(e,t){if(!Array.isArray(e))throw new Error("addresses is not an array");const r=e.map((e=>(0,xo.ensureAddressString)(e)));JSON.stringify(r)!==JSON.stringify(this._addresses)&&(this._addresses=r,this.updateListener.onAccountsUpdate({accounts:r,source:"wallet"}),this._storage.setItem(Eo.LOCAL_STORAGE_ADDRESSES_KEY,r.join(" ")))}_sendRequestAsync(e){return new Promise(((t,r)=>{try{const r=this._handleSynchronousMethods(e);if(void 0!==r)return t({jsonrpc:"2.0",id:e.id,result:r})}catch(e){return r(e)}this._handleAsynchronousMethods(e).then((r=>r&&t(Object.assign(Object.assign({},r),{id:e.id})))).catch((e=>r(e)))}))}_handleSynchronousMethods(e){const{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(r);case"eth_ecRecover":return this._eth_ecRecover(r);case"personal_sign":return this._personal_sign(r);case"personal_ecRecover":return this._personal_ecRecover(r);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(r);case"eth_signTypedData_v2":default:return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(r);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(r);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(r);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(r);case"wallet_watchAsset":return this._wallet_watchAsset(r)}}_isKnownAddress(e){try{const t=(0,xo.ensureAddressString)(e);return this._addresses.map((e=>(0,xo.ensureAddressString)(e))).includes(t)}catch(e){}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,xo.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);return{fromAddress:t,toAddress:e.to?(0,xo.ensureAddressString)(e.to):null,weiValue:null!=e.value?(0,xo.ensureBigInt)(e.value):BigInt(0),data:e.data?(0,xo.ensureBuffer)(e.data):Buffer.alloc(0),nonce:null!=e.nonce?(0,xo.ensureIntNumber)(e.nonce):null,gasPriceInWei:null!=e.gasPrice?(0,xo.ensureBigInt)(e.gasPrice):null,maxFeePerGas:null!=e.maxFeePerGas?(0,xo.ensureBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:null!=e.maxPriorityFeePerGas?(0,xo.ensureBigInt)(e.maxPriorityFeePerGas):null,gasLimit:null!=e.gas?(0,xo.ensureBigInt)(e.gas):null,chainId:e.chainId?(0,xo.ensureIntNumber)(e.chainId):this.getChainId()}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw Ro.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw Ro.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,r,n){this._ensureKnownAddress(t);try{const i=this.initializeRelay(),s=await i.signEthereumMessage(e,t,r,n).promise;if((0,ko.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Ro.standardErrors.provider.userRejectedRequest("User denied message signature");throw e}}async _ethereumAddressFromSignedMessage(e,t,r){const n=this.initializeRelay(),i=await n.ethereumAddressFromSignedMessage(e,t,r).promise;if((0,ko.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,xo.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(Mo);if(!e)return(0,xo.ensureIntNumber)(1);const t=parseInt(e,10);return(0,xo.ensureIntNumber)(t)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let e;try{const t=this.initializeRelay();if(e=await t.requestEthereumAccounts().promise,(0,ko.isErrorResponse)(e))throw new Error(e.errorMessage)}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Ro.standardErrors.provider.userRejectedRequest("User denied account authorization");throw e}if(!e.result)throw new Error("accounts received is empty");return this._setAddresses(e.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const t=(0,xo.ensureAddressString)(e[0]),r=(0,xo.ensureBuffer)(e[1]);return this._signEthereumMessage(r,t,!1)}_eth_ecRecover(e){const t=(0,xo.ensureBuffer)(e[0]),r=(0,xo.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,xo.ensureBuffer)(e[0]),r=(0,xo.ensureAddressString)(e[1]);return this._signEthereumMessage(t,r,!0)}_personal_ecRecover(e){const t=(0,xo.ensureBuffer)(e[0]),r=(0,xo.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=this.initializeRelay(),r=await e.signEthereumTransaction(t).promise;if((0,ko.isErrorResponse)(r))throw new Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Ro.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw e}}async _eth_sendRawTransaction(e){const t=(0,xo.ensureBuffer)(e[0]),r=this.initializeRelay(),n=await r.submitEthereumTransaction(t,this.getChainId()).promise;if((0,ko.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=this.initializeRelay(),r=await e.signAndSubmitEthereumTransaction(t).promise;if((0,ko.isErrorResponse)(r))throw new Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw Ro.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw e}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,xo.ensureParsedJSONObject)(e[0]),r=(0,xo.ensureAddressString)(e[1]);this._ensureKnownAddress(r);const n=wo.default.hashForSignTypedDataLegacy({data:t}),i=JSON.stringify(t,null,2);return this._signEthereumMessage(n,r,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,xo.ensureAddressString)(e[0]),r=(0,xo.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const n=wo.default.hashForSignTypedData_v3({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(n,t,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,xo.ensureAddressString)(e[0]),r=(0,xo.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const n=wo.default.hashForSignTypedData_v4({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(n,t,!1,i)}async _wallet_addEthereumChain(e){var t,r,n,i;const s=e[0];if(0===(null===(t=s.rpcUrls)||void 0===t?void 0:t.length))return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!s.chainName||""===s.chainName.trim())throw Ro.standardErrors.rpc.invalidParams("chainName is a required field");if(!s.nativeCurrency)throw Ro.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const o=parseInt(s.chainId,16);return await this.addEthereumChain(o,null!==(r=s.rpcUrls)&&void 0!==r?r:[],null!==(n=s.blockExplorerUrls)&&void 0!==n?n:[],s.chainName,null!==(i=s.iconUrls)&&void 0!==i?i:[],s.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const t=Array.isArray(e)?e[0]:e;if(!t.type)throw Ro.standardErrors.rpc.invalidParams("Type is required");if("ERC20"!==(null==t?void 0:t.type))throw Ro.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(null==t?void 0:t.options))throw Ro.standardErrors.rpc.invalidParams("Options are required");if(!(null==t?void 0:t.options.address))throw Ro.standardErrors.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:n,symbol:i,image:s,decimals:o}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,n,i,o,s,r)}}initializeRelay(){if(!this._relay){const e=new Co.WalletLinkRelay({linkAPIUrl:this._walletlinkUrl,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback(((e,t)=>this._setAddresses(e,t))),e.setChainCallback(((e,t)=>{this.updateProviderInfo(t,parseInt(e,10))})),this._relay=e}return this._relay}},Object.defineProperty($e,"__esModule",{value:!0}),$e.WLSigner=void 0;const Ao=Je,Lo=ro;$e.WLSigner=class{constructor(e){this.adapter=new Ao.WLRelayAdapter(Object.assign(Object.assign({},e),{walletlinkUrl:Lo.WALLETLINK_URL,updateListener:{onAccountsUpdate:(...t)=>e.updateListener.onAccountsUpdate(this,...t),onChainUpdate:(...t)=>e.updateListener.onChainUpdate(this,...t)}}))}async handshake(){return await this.request({method:"eth_requestAccounts"})}async request(e){return this.adapter.request(e)}getQRCodeUrl(){return this.adapter.getQRCodeUrl()}async disconnect(){await this.adapter.close()}},Object.defineProperty(ie,"__esModule",{value:!0}),ie.SignRequestHandler=void 0;const Po=se,No=Be,jo=$e,Bo=ro,Oo=g,Fo=ge,Do="SignerType";ie.SignRequestHandler=class{constructor(e){var t;this.signerTypeStorage=new Fo.ScopedLocalStorage("CBWSDK","SignRequestHandler"),this.updateRelay={onAccountsUpdate:(e,...t)=>{this.signer&&e!==this.signer||this.updateListener.onAccountsUpdate(...t)},onChainUpdate:(e,...t)=>{var r;this.signer&&e!==this.signer||(e instanceof jo.WLSigner&&(null===(r=this.connectionTypeSelectionResolver)||void 0===r||r.call(this,"walletlink")),this.updateListener.onChainUpdate(...t))}},this.initSigner=()=>{"scw"===this.connectionType?this.initScwSigner():"walletlink"===this.connectionType&&this.initWalletLinkSigner()},this.popupCommunicator=new No.PopUpCommunicator({url:e.scwUrl||Bo.CB_KEYS_URL}),this.updateListener=e.updateListener,this.getWalletLinkUrl=this.getWalletLinkUrl.bind(this),this.popupCommunicator.setWLQRCodeUrlCallback(this.getWalletLinkUrl),this.appName=e.appName,this.appLogoUrl=null!==(t=e.appLogoUrl)&&void 0!==t?t:null,this.appChainIds=e.appChainIds;const r=this.signerTypeStorage.getItem(Do);this.connectionType=r,this.connectionPreference=e.connectionPreference,r&&this.initSigner(),this.setConnectionType=this.setConnectionType.bind(this),this.initWalletLinkSigner=this.initWalletLinkSigner.bind(this)}initScwSigner(){this.signer instanceof Po.SCWSigner||(this.signer=new Po.SCWSigner({appName:this.appName,appLogoUrl:this.appLogoUrl,appChainIds:this.appChainIds,puc:this.popupCommunicator,updateListener:this.updateRelay}))}initWalletLinkSigner(){this.signer instanceof jo.WLSigner||(this.signer=new jo.WLSigner({appName:this.appName,appLogoUrl:this.appLogoUrl,updateListener:this.updateRelay}))}async onDisconnect(){var e;this.connectionType=null,this.signerTypeStorage.removeItem(Do),await(null===(e=this.signer)||void 0===e?void 0:e.disconnect())}async handleRequest(e,t){try{if("eth_requestAccounts"===e.method)return await this.eth_requestAccounts(t);if(!this.signer||t.length<=0)throw Oo.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");return await this.signer.request(e)}catch(e){throw(null==e?void 0:e.code)===Oo.standardErrorCodes.provider.unauthorized&&this.updateListener.onResetConnection(),e}}async eth_requestAccounts(e){var t;if(e.length>0)return this.updateListener.onConnect(),Promise.resolve(e);if(!this.connectionType){const e=await this.completeConnectionTypeSelection();this.setConnectionType(e)}try{this.initSigner();const e=await(null===(t=this.signer)||void 0===t?void 0:t.handshake());return Array.isArray(e)?("walletlink"===this.connectionType&&this.popupCommunicator.walletLinkQrScanned(),this.updateListener.onConnect(),Promise.resolve(e)):Promise.reject(Oo.standardErrors.rpc.internal("Failed to get accounts"))}catch(e){throw"walletlink"===this.connectionType&&(this.popupCommunicator.disconnect(),this.onDisconnect()),e}}getWalletLinkUrl(){if(this.initWalletLinkSigner(),!(this.signer instanceof jo.WLSigner))throw Oo.standardErrors.rpc.internal("Signer not initialized or Signer.getWalletLinkUrl not defined");return this.signer.getQRCodeUrl()}async completeConnectionTypeSelection(){return await this.popupCommunicator.connect(),new Promise((e=>{this.connectionTypeSelectionResolver=e.bind(this),this.popupCommunicator.selectConnectionType({connectionPreference:this.connectionPreference}).then((t=>{e(t)}))}))}setConnectionType(e){this.connectionType!==e&&(this.connectionType=e,this.signerTypeStorage.setItem(Do,this.connectionType))}canHandleRequest(e){return["eth_requestAccounts","eth_sign","eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset"].includes(e.method)}};var Uo={},Ho={},Wo={},qo=function(e){var t=(e=e||{}).max||Number.MAX_SAFE_INTEGER,r=void 0!==e.start?e.start:Math.floor(Math.random()*t);return function(){return r%=t,r++}};const Vo=(e,t)=>function(){const r=t.promiseModule,n=new Array(arguments.length);for(let e=0;e<arguments.length;e++)n[e]=arguments[e];return new r(((r,i)=>{t.errorFirst?n.push((function(e,n){if(t.multiArgs){const t=new Array(arguments.length-1);for(let e=1;e<arguments.length;e++)t[e-1]=arguments[e];e?(t.unshift(e),i(t)):r(t)}else e?i(e):r(n)})):n.push((function(e){if(t.multiArgs){const e=new Array(arguments.length-1);for(let t=0;t<arguments.length;t++)e[t]=arguments[t];r(e)}else r(e)})),e.apply(this,n)}))};var zo={},$o={};Object.defineProperty($o,"__esModule",{value:!0});const Jo=o;function Ko(e,t,r){try{Reflect.apply(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}class Go extends Jo.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const i=n[e];if(void 0===i)return!1;if("function"==typeof i)Ko(i,this,t);else{const e=i.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}(i);for(let n=0;n<e;n+=1)Ko(r[n],this,t)}return!0}}$o.default=Go;var Zo=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zo,"__esModule",{value:!0}),zo.BaseBlockTracker=void 0;const Qo=Zo($o),Yo=(e,t)=>e+t,Xo=["sync","latest"];class ea extends Qo.default{constructor(e){super(),this._blockResetDuration=e.blockResetDuration||2e4,this._usePastBlocks=e.usePastBlocks||!1,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(){if(this._currentBlock)return this._currentBlock;return await new Promise((e=>this.once("latest",e)))}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){Xo.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 Xo.map((e=>this.listenerCount(e))).reduce(Yo)}_shouldUseNewBlock(e){const t=this._currentBlock;if(!t)return!0;const r=ta(e),n=ta(t);return this._usePastBlocks&&r<n||r>n}_newPotentialLatest(e){this._shouldUseNewBlock(e)&&this._setCurrentBlock(e)}_setCurrentBlock(e){const t=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:t,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}}function ta(e){return Number.parseInt(e,16)}zo.BaseBlockTracker=ea;var ra={},na={},ia={};class sa extends TypeError{constructor(e,t){let r;const{message:n,explanation:i,...s}=e,{path:o}=e,a=0===o.length?n:`At path: ${o.join(".")} -- ${n}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function oa(e){return"object"==typeof e&&null!=e}function aa(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function ca(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function la(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${ca(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*ua(e,t,r,n){(function(e){return oa(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const i of e){const e=la(i,t,r,n);e&&(yield e)}}function*da(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&"type"!==t.type&&oa(t.schema)&&oa(e)&&!Array.isArray(e)))for(const r in e)void 0===t.schema[r]&&delete e[r];let c="valid";for(const n of t.validator(e,a))n.explanation=r.message,c="not_valid",yield[n,void 0];for(let[l,u,d]of t.entries(e,a)){const t=da(u,d,{path:void 0===l?n:[...n,l],branch:void 0===l?i:[...i,u],coerce:s,mask:o,message:r.message});for(const r of t)r[0]?(c=null!=r[0].refinement?"not_refined":"not_valid",yield[r[0],void 0]):s&&(u=r[1],void 0===l?e=u:e instanceof Map?e.set(l,u):e instanceof Set?e.add(u):oa(e)&&(void 0!==u||l in e)&&(e[l]=u))}if("not_valid"!==c)for(const n of t.refiner(e,a))n.explanation=r.message,c="not_refined",yield[n,void 0];"valid"===c&&(yield[void 0,e])}class ha{constructor(e){const{type:t,schema:r,validator:n,refiner:i,coercer:s=(e=>e),entries:o=function*(){}}=e;this.type=t,this.schema=r,this.entries=o,this.coercer=s,this.validator=n?(e,t)=>ua(n(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>ua(i(e,t),t,this,e):()=>[]}assert(e,t){return fa(e,this,t)}create(e,t){return pa(e,this,t)}is(e){return _a(e,this)}mask(e,t){return ga(e,this,t)}validate(e,t={}){return ma(e,this,t)}}function fa(e,t,r){const n=ma(e,t,{message:r});if(n[0])throw n[0]}function pa(e,t,r){const n=ma(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function ga(e,t,r){const n=ma(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function _a(e,t){return!ma(e,t)[0]}function ma(e,t,r={}){const n=da(e,t,r),i=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(i[0]){const e=new sa(i[0],(function*(){for(const e of n)e[0]&&(yield e[0])}));return[e,void 0]}return[void 0,i[1]]}function ya(e,t){return new ha({type:e,schema:null,validator:t})}function ba(){return ya("never",(()=>!1))}function va(e){const t=e?Object.keys(e):[],r=ba();return new ha({type:"object",schema:e||null,*entries(n){if(e&&oa(n)){const i=new Set(Object.keys(n));for(const r of t)i.delete(r),yield[r,n[r],e[r]];for(const e of i)yield[e,n[e],r]}},validator:e=>oa(e)||`Expected an object, but received: ${ca(e)}`,coercer:e=>oa(e)?{...e}:e})}function wa(e){return new ha({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function Ea(){return ya("string",(e=>"string"==typeof e||`Expected a string, but received: ${ca(e)}`))}function Sa(e){const t=Object.keys(e);return new ha({type:"type",schema:e,*entries(r){if(oa(r))for(const n of t)yield[n,r[n],e[n]]},validator:e=>oa(e)||`Expected an object, but received: ${ca(e)}`,coercer:e=>oa(e)?{...e}:e})}function ka(){return ya("unknown",(()=>!0))}function Ca(e,t,r){return new ha({...e,coercer:(n,i)=>_a(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function Ra(e){return e instanceof Map||e instanceof Set?e.size:e.length}function Ia(e,t,r){return new ha({...e,*refiner(n,i){yield*e.refiner(n,i);const s=ua(r(n,i),i,e,n);for(const e of s)yield{...e,refinement:t}}})}var xa=Object.freeze({__proto__:null,Struct:ha,StructError:sa,any:function(){return ya("any",(()=>!0))},array:function(e){return new ha({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${ca(e)}`})},assert:fa,assign:function(...e){const t="type"===e[0].type,r=e.map((e=>e.schema)),n=Object.assign({},...r);return t?Sa(n):va(n)},bigint:function(){return ya("bigint",(e=>"bigint"==typeof e))},boolean:function(){return ya("boolean",(e=>"boolean"==typeof e))},coerce:Ca,create:pa,date:function(){return ya("date",(e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${ca(e)}`))},defaulted:function(e,t,r={}){return Ca(e,ka(),(e=>{const n="function"==typeof t?t():t;if(void 0===e)return n;if(!r.strict&&aa(e)&&aa(n)){const t={...e};let r=!1;for(const e in n)void 0===t[e]&&(t[e]=n[e],r=!0);if(r)return t}return e}))},define:ya,deprecated:function(e,t){return new ha({...e,refiner:(t,r)=>void 0===t||e.refiner(t,r),validator:(r,n)=>void 0===r||(t(r,n),e.validator(r,n))})},dynamic:function(e){return new ha({type:"dynamic",schema:null,*entries(t,r){const n=e(t,r);yield*n.entries(t,r)},validator:(t,r)=>e(t,r).validator(t,r),coercer:(t,r)=>e(t,r).coercer(t,r),refiner:(t,r)=>e(t,r).refiner(t,r)})},empty:function(e){return Ia(e,"empty",(t=>{const r=Ra(t);return 0===r||`Expected an empty ${e.type} but received one with a size of \`${r}\``}))},enums:function(e){const t={},r=e.map((e=>ca(e))).join();for(const r of e)t[r]=r;return new ha({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${r}\`, but received: ${ca(t)}`})},func:function(){return ya("func",(e=>"function"==typeof e||`Expected a function, but received: ${ca(e)}`))},instance:function(e){return ya("instance",(t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${ca(t)}`))},integer:function(){return ya("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${ca(e)}`))},intersection:function(e){return new ha({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})},is:_a,lazy:function(e){let t;return new ha({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator:(r,n)=>(t??(t=e()),t.validator(r,n)),coercer:(r,n)=>(t??(t=e()),t.coercer(r,n)),refiner:(r,n)=>(t??(t=e()),t.refiner(r,n))})},literal:function(e){const t=ca(e),r=typeof e;return new ha({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${ca(r)}`})},map:function(e,t){return new ha({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||`Expected a \`Map\` object, but received: ${ca(e)}`})},mask:ga,max:function(e,t,r={}){const{exclusive:n}=r;return Ia(e,"max",(r=>n?r<t:r<=t||`Expected a ${e.type} less than ${n?"":"or equal to "}${t} but received \`${r}\``))},min:function(e,t,r={}){const{exclusive:n}=r;return Ia(e,"min",(r=>n?r>t:r>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${r}\``))},never:ba,nonempty:function(e){return Ia(e,"nonempty",(t=>Ra(t)>0||`Expected a nonempty ${e.type} but received an empty one`))},nullable:function(e){return new ha({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})},number:function(){return ya("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${ca(e)}`))},object:va,omit:function(e,t){const{schema:r}=e,n={...r};for(const e of t)delete n[e];return"type"===e.type?Sa(n):va(n)},optional:wa,partial:function(e){const t=e instanceof ha?{...e.schema}:{...e};for(const e in t)t[e]=wa(t[e]);return va(t)},pattern:function(e,t){return Ia(e,"pattern",(r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`))},pick:function(e,t){const{schema:r}=e,n={};for(const e of t)n[e]=r[e];return va(n)},record:function(e,t){return new ha({type:"record",schema:null,*entries(r){if(oa(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>oa(e)||`Expected an object, but received: ${ca(e)}`})},refine:Ia,regexp:function(){return ya("regexp",(e=>e instanceof RegExp))},set:function(e){return new ha({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||`Expected a \`Set\` object, but received: ${ca(e)}`})},size:function(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return Ia(e,"size",(e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=r||`${n} ${i} but received \`${e}\``;if(e instanceof Map||e instanceof Set){const{size:s}=e;return t<=s&&s<=r||`${n} with a size ${i} but received one with a size of \`${s}\``}{const{length:s}=e;return t<=s&&s<=r||`${n} with a length ${i} but received one with a length of \`${s}\``}}))},string:Ea,struct:function(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),ya(e,t)},trimmed:function(e){return Ca(e,Ea(),(e=>e.trim()))},tuple:function(e){const t=ba();return new ha({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${ca(e)}`})},type:Sa,union:function(e){const t=e.map((e=>e.type)).join(" | ");return new ha({type:"union",schema:null,coercer(t){for(const r of e){const[e,n]=r.validate(t,{coerce:!0});if(!e)return n}return t},validator(r,n){const i=[];for(const t of e){const[...e]=da(r,t,n),[s]=e;if(!s[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ca(r)}`,...i]}})},unknown:ka,validate:ma}),Ma=t(xa);Object.defineProperty(ia,"__esModule",{value:!0}),ia.assertExhaustive=ia.assertStruct=ia.assert=ia.AssertionError=void 0;const Ta=Ma;function Aa(e,t){return r=e,Boolean("string"==typeof(null===(i=null===(n=null==r?void 0:r.prototype)||void 0===n?void 0:n.constructor)||void 0===i?void 0:i.name))?new e({message:t}):e({message:t});var r,n,i}class La extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}ia.AssertionError=La,ia.assert=function(e,t="Assertion failed.",r=La){if(!e){if(t instanceof Error)throw t;throw Aa(r,t)}},ia.assertStruct=function(e,t,r="Assertion failed",n=La){try{(0,Ta.assert)(e,t)}catch(e){throw Aa(n,`${r}: ${function(e){const t=function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}(e)}.`)}},ia.assertExhaustive=function(e){throw new Error("Invalid branch reached. Should be detected during compilation.")};var Pa={};Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.base64=void 0;const Na=Ma,ja=ia;Pa.base64=(e,t={})=>{var r,n;const i=null!==(r=t.paddingRequired)&&void 0!==r&&r,s=null!==(n=t.characterSet)&&void 0!==n?n:"base64";let o,a;return"base64"===s?o=String.raw`[A-Za-z0-9+\/]`:((0,ja.assert)("base64url"===s),o=String.raw`[-_A-Za-z0-9]`),a=i?new RegExp(`^(?:${o}{4})*(?:${o}{3}=|${o}{2}==)?$`,"u"):new RegExp(`^(?:${o}{4})*(?:${o}{2,3}|${o}{3}=|${o}{2}==)?$`,"u"),(0,Na.pattern)(e,a)};var Ba={},Oa={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.StrictHexStruct=e.HexStruct=void 0;const t=Ma,r=ia;function n(r){return(0,t.is)(r,e.HexStruct)}function i(r){return(0,t.is)(r,e.StrictHexStruct)}e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu),e.isHexString=n,e.isStrictHexString=i,e.assertIsHexString=function(e){(0,r.assert)(n(e),"Value must be a hexadecimal string.")},e.assertIsStrictHexString=function(e){(0,r.assert)(i(e),'Value must be a hexadecimal string, starting with "0x".')},e.add0x=function(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`},e.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}}(Oa),Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.createDataView=Ba.concatBytes=Ba.valueToBytes=Ba.stringToBytes=Ba.numberToBytes=Ba.signedBigIntToBytes=Ba.bigIntToBytes=Ba.hexToBytes=Ba.bytesToString=Ba.bytesToNumber=Ba.bytesToSignedBigInt=Ba.bytesToBigInt=Ba.bytesToHex=Ba.assertIsBytes=Ba.isBytes=void 0;const Fa=ia,Da=Oa,Ua=48,Ha=58,Wa=87;const qa=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function Va(e){return e instanceof Uint8Array}function za(e){(0,Fa.assert)(Va(e),"Value must be a Uint8Array.")}function $a(e){if(za(e),0===e.length)return"0x";const t=qa(),r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=t[e[n]];return(0,Da.add0x)(r.join(""))}function Ja(e){za(e);const t=$a(e);return BigInt(t)}function Ka(e){var t;if("0x"===(null===(t=null==e?void 0:e.toLowerCase)||void 0===t?void 0:t.call(e)))return new Uint8Array;(0,Da.assertIsHexString)(e);const r=(0,Da.remove0x)(e).toLowerCase(),n=r.length%2==0?r:`0${r}`,i=new Uint8Array(n.length/2);for(let e=0;e<i.length;e++){const t=n.charCodeAt(2*e),r=n.charCodeAt(2*e+1),s=t-(t<Ha?Ua:Wa),o=r-(r<Ha?Ua:Wa);i[e]=16*s+o}return i}function Ga(e){(0,Fa.assert)("bigint"==typeof e,"Value must be a bigint."),(0,Fa.assert)(e>=BigInt(0),"Value must be a non-negative bigint.");return Ka(e.toString(16))}function Za(e){(0,Fa.assert)("number"==typeof e,"Value must be a number."),(0,Fa.assert)(e>=0,"Value must be a non-negative number."),(0,Fa.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");return Ka(e.toString(16))}function Qa(e){return(0,Fa.assert)("string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function Ya(e){if("bigint"==typeof e)return Ga(e);if("number"==typeof e)return Za(e);if("string"==typeof e)return e.startsWith("0x")?Ka(e):Qa(e);if(Va(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}Ba.isBytes=Va,Ba.assertIsBytes=za,Ba.bytesToHex=$a,Ba.bytesToBigInt=Ja,Ba.bytesToSignedBigInt=function(e){za(e);let t=BigInt(0);for(const r of e)t=(t<<BigInt(8))+BigInt(r);return BigInt.asIntN(8*e.length,t)},Ba.bytesToNumber=function(e){za(e);const t=Ja(e);return(0,Fa.assert)(t<=BigInt(Number.MAX_SAFE_INTEGER),"Number is not a safe integer. Use `bytesToBigInt` instead."),Number(t)},Ba.bytesToString=function(e){return za(e),(new TextDecoder).decode(e)},Ba.hexToBytes=Ka,Ba.bigIntToBytes=Ga,Ba.signedBigIntToBytes=function(e,t){(0,Fa.assert)("bigint"==typeof e,"Value must be a bigint."),(0,Fa.assert)("number"==typeof t,"Byte length must be a number."),(0,Fa.assert)(t>0,"Byte length must be greater than 0."),(0,Fa.assert)(function(e,t){(0,Fa.assert)(t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(8*t-1))}(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let e=0;e<n.length;e++)n[e]=Number(BigInt.asUintN(8,r)),r>>=BigInt(8);return n.reverse()},Ba.numberToBytes=Za,Ba.stringToBytes=Qa,Ba.valueToBytes=Ya,Ba.concatBytes=function(e){const t=new Array(e.length);let r=0;for(let n=0;n<e.length;n++){const i=Ya(e[n]);t[n]=i,r+=i.length}const n=new Uint8Array(r);for(let e=0,r=0;e<t.length;e++)n.set(t[e],r),r+=t[e].length;return n},Ba.createDataView=function(e){if("undefined"!=typeof Buffer&&e instanceof Buffer){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new DataView(t)}return new DataView(e.buffer,e.byteOffset,e.byteLength)};var Xa={};Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.ChecksumStruct=void 0;const ec=Ma,tc=Pa;Xa.ChecksumStruct=(0,ec.size)((0,tc.base64)((0,ec.string)(),{paddingRequired:!0}),44,44);var rc={};Object.defineProperty(rc,"__esModule",{value:!0}),rc.createHex=rc.createBytes=rc.createBigInt=rc.createNumber=void 0;const nc=Ma,ic=ia,sc=Ba,oc=Oa,ac=(0,nc.union)([(0,nc.number)(),(0,nc.bigint)(),(0,nc.string)(),oc.StrictHexStruct]),cc=(0,nc.coerce)((0,nc.number)(),ac,Number),lc=(0,nc.coerce)((0,nc.bigint)(),ac,BigInt);(0,nc.union)([oc.StrictHexStruct,(0,nc.instance)(Uint8Array)]);const uc=(0,nc.coerce)((0,nc.instance)(Uint8Array),(0,nc.union)([oc.StrictHexStruct]),sc.hexToBytes),dc=(0,nc.coerce)(oc.StrictHexStruct,(0,nc.instance)(Uint8Array),sc.bytesToHex);rc.createNumber=function(e){try{const t=(0,nc.create)(e,cc);return(0,ic.assert)(Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){if(t instanceof nc.StructError)throw new Error(`Expected a number-like value, got "${e}".`);throw t}},rc.createBigInt=function(e){try{return(0,nc.create)(e,lc)}catch(e){if(e instanceof nc.StructError)throw new Error(`Expected a number-like value, got "${String(e.value)}".`);throw e}},rc.createBytes=function(e){if("string"==typeof e&&"0x"===e.toLowerCase())return new Uint8Array;try{return(0,nc.create)(e,uc)}catch(e){if(e instanceof nc.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}},rc.createHex=function(e){if(e instanceof Uint8Array&&0===e.length||"string"==typeof e&&"0x"===e.toLowerCase())return"0x";try{return(0,nc.create)(e,dc)}catch(e){if(e instanceof nc.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}};var hc,fc,pc={},gc=e&&e.__classPrivateFieldSet||function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},_c=e&&e.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(pc,"__esModule",{value:!0}),pc.FrozenSet=pc.FrozenMap=void 0;class mc{constructor(e){hc.set(this,void 0),gc(this,hc,new Map(e),"f"),Object.freeze(this)}get size(){return _c(this,hc,"f").size}[(hc=new WeakMap,Symbol.iterator)](){return _c(this,hc,"f")[Symbol.iterator]()}entries(){return _c(this,hc,"f").entries()}forEach(e,t){return _c(this,hc,"f").forEach(((r,n,i)=>e.call(t,r,n,this)))}get(e){return _c(this,hc,"f").get(e)}has(e){return _c(this,hc,"f").has(e)}keys(){return _c(this,hc,"f").keys()}values(){return _c(this,hc,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map((([e,t])=>`${String(e)} => ${String(t)}`)).join(", ")} `:""}}`}}pc.FrozenMap=mc;class yc{constructor(e){fc.set(this,void 0),gc(this,fc,new Set(e),"f"),Object.freeze(this)}get size(){return _c(this,fc,"f").size}[(fc=new WeakMap,Symbol.iterator)](){return _c(this,fc,"f")[Symbol.iterator]()}entries(){return _c(this,fc,"f").entries()}forEach(e,t){return _c(this,fc,"f").forEach(((r,n,i)=>e.call(t,r,n,this)))}has(e){return _c(this,fc,"f").has(e)}keys(){return _c(this,fc,"f").keys()}values(){return _c(this,fc,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map((e=>String(e))).join(", ")} `:""}}`}}pc.FrozenSet=yc,Object.freeze(mc),Object.freeze(mc.prototype),Object.freeze(yc),Object.freeze(yc.prototype);var bc={};Object.defineProperty(bc,"__esModule",{value:!0});var vc={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=void 0;const t=Ma,r=ia;e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),(0,t.define)("finite number",(e=>(0,t.is)(e,(0,t.number)())&&Number.isFinite(e))),(0,t.string)(),(0,t.array)((0,t.lazy)((()=>e.UnsafeJsonStruct))),(0,t.record)((0,t.string)(),(0,t.lazy)((()=>e.UnsafeJsonStruct)))]),e.JsonStruct=(0,t.define)("Json",((t,r)=>{function n(e,t){const n=[...t.validator(e,r)];return!(n.length>0)||n}try{const r=n(t,e.UnsafeJsonStruct);return!0!==r?r:n(JSON.parse(JSON.stringify(t)),e.UnsafeJsonStruct)}catch(e){return e instanceof RangeError&&"Circular reference detected"}})),e.isValidJson=function(r){return(0,t.is)(r,e.JsonStruct)},e.getJsonSize=function(t){(0,r.assertStruct)(t,e.JsonStruct,"Invalid JSON value");const n=JSON.stringify(t);return(new TextEncoder).encode(n).byteLength},e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]),e.isJsonRpcNotification=function(r){return(0,t.is)(r,e.JsonRpcNotificationStruct)},e.assertIsJsonRpcNotification=function(t,n){(0,r.assertStruct)(t,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",n)},e.isJsonRpcRequest=function(r){return(0,t.is)(r,e.JsonRpcRequestStruct)},e.assertIsJsonRpcRequest=function(t,n){(0,r.assertStruct)(t,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",n)},e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]),e.isPendingJsonRpcResponse=function(r){return(0,t.is)(r,e.PendingJsonRpcResponseStruct)},e.assertIsPendingJsonRpcResponse=function(t,n){(0,r.assertStruct)(t,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",n)},e.isJsonRpcResponse=function(r){return(0,t.is)(r,e.JsonRpcResponseStruct)},e.assertIsJsonRpcResponse=function(t,n){(0,r.assertStruct)(t,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",n)},e.isJsonRpcSuccess=function(r){return(0,t.is)(r,e.JsonRpcSuccessStruct)},e.assertIsJsonRpcSuccess=function(t,n){(0,r.assertStruct)(t,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",n)},e.isJsonRpcFailure=function(r){return(0,t.is)(r,e.JsonRpcFailureStruct)},e.assertIsJsonRpcFailure=function(t,n){(0,r.assertStruct)(t,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",n)},e.isJsonRpcError=function(r){return(0,t.is)(r,e.JsonRpcErrorStruct)},e.assertIsJsonRpcError=function(t,n){(0,r.assertStruct)(t,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",n)},e.getJsonRpcIdValidator=function(e){const{permitEmptyString:t,permitFractions:r,permitNull:n}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},e);return e=>Boolean("number"==typeof e&&(r||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||n&&null===e)}}(vc);var wc={};Object.defineProperty(wc,"__esModule",{value:!0});var Ec,Sc,kc={},Cc={exports:{}};function Rc(){if(Sc)return Ec;Sc=1;var e=1e3,t=60*e,r=60*t,n=24*r,i=7*n,s=365.25*n;function o(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}return Ec=function(a,c){c=c||{};var l=typeof a;if("string"===l&&a.length>0)return function(o){if((o=String(o)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===l&&isFinite(a))return c.long?function(i){var s=Math.abs(i);if(s>=n)return o(i,s,n,"day");if(s>=r)return o(i,s,r,"hour");if(s>=t)return o(i,s,t,"minute");if(s>=e)return o(i,s,e,"second");return i+" ms"}(a):function(i){var s=Math.abs(i);if(s>=n)return Math.round(i/n)+"d";if(s>=r)return Math.round(i/r)+"h";if(s>=t)return Math.round(i/t)+"m";if(s>=e)return Math.round(i/e)+"s";return i+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))},Ec}var Ic=function(e){function t(e){let n,i,s,o=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date),s=i-(n||i);r.diff=s,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";o++;const s=t.formatters[i];if("function"==typeof s){const t=e[o];n=s.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Rc(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.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"],t.log=console.debug||console.log||(()=>{}),e.exports=Ic(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Cc,Cc.exports);var xc=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kc,"__esModule",{value:!0}),kc.createModuleLogger=kc.createProjectLogger=void 0;const Mc=(0,xc(Cc.exports).default)("metamask");kc.createProjectLogger=function(e){return Mc.extend(e)},kc.createModuleLogger=function(e,t){return e.extend(t)};var Tc={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0,e.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},e.isNullOrUndefined=function(e){return null==e},e.isObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};var t;function r(e){return e.charCodeAt(0)<=127}e.hasProperty=(e,t)=>Object.hasOwnProperty.call(e,t),(t=e.JsonSize||(e.JsonSize={}))[t.Null=4]="Null",t[t.Comma=1]="Comma",t[t.Wrapper=1]="Wrapper",t[t.True=4]="True",t[t.False=5]="False",t[t.Quote=1]="Quote",t[t.Colon=1]="Colon",t[t.Date=24]="Date",e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu,e.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}},e.isASCII=r,e.calculateStringSize=function(t){var n;return t.split("").reduce(((e,t)=>r(t)?e+1:e+2),0)+(null!==(n=t.match(e.ESCAPE_CHARACTERS_REGEXP))&&void 0!==n?n:[]).length},e.calculateNumberSize=function(e){return e.toString().length}}(Tc);var Ac={};Object.defineProperty(Ac,"__esModule",{value:!0}),Ac.hexToBigInt=Ac.hexToNumber=Ac.bigIntToHex=Ac.numberToHex=void 0;const Lc=ia,Pc=Oa;Ac.numberToHex=e=>((0,Lc.assert)("number"==typeof e,"Value must be a number."),(0,Lc.assert)(e>=0,"Value must be a non-negative number."),(0,Lc.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,Pc.add0x)(e.toString(16)));Ac.bigIntToHex=e=>((0,Lc.assert)("bigint"==typeof e,"Value must be a bigint."),(0,Lc.assert)(e>=0,"Value must be a non-negative bigint."),(0,Pc.add0x)(e.toString(16)));Ac.hexToNumber=e=>{(0,Pc.assertIsHexString)(e);const t=parseInt(e,16);return(0,Lc.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};Ac.hexToBigInt=e=>((0,Pc.assertIsHexString)(e),BigInt((0,Pc.add0x)(e)));var Nc={};Object.defineProperty(Nc,"__esModule",{value:!0});var jc={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,(t=e.Duration||(e.Duration={}))[t.Millisecond=1]="Millisecond",t[t.Second=1e3]="Second",t[t.Minute=6e4]="Minute",t[t.Hour=36e5]="Hour",t[t.Day=864e5]="Day",t[t.Week=6048e5]="Week",t[t.Year=31536e6]="Year";const r=(e,t)=>{if(!(e=>Number.isInteger(e)&&e>=0)(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};e.inMilliseconds=function(e,t){return r(e,"count"),e*t},e.timeSince=function(e){return r(e,"timestamp"),Date.now()-e}}(jc);var Bc={};Object.defineProperty(Bc,"__esModule",{value:!0});var Oc={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.satisfiesVersionRange=e.gtRange=e.gtVersion=e.assertIsSemVerRange=e.assertIsSemVerVersion=e.isValidSemVerRange=e.isValidSemVerVersion=e.VersionRangeStruct=e.VersionStruct=void 0;const t=u,r=Ma,n=ia;e.VersionStruct=(0,r.refine)((0,r.string)(),"Version",(e=>null!==(0,t.valid)(e)||`Expected SemVer version, got "${e}"`)),e.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",(e=>null!==(0,t.validRange)(e)||`Expected SemVer range, got "${e}"`)),e.isValidSemVerVersion=function(t){return(0,r.is)(t,e.VersionStruct)},e.isValidSemVerRange=function(t){return(0,r.is)(t,e.VersionRangeStruct)},e.assertIsSemVerVersion=function(t){(0,n.assertStruct)(t,e.VersionStruct)},e.assertIsSemVerRange=function(t){(0,n.assertStruct)(t,e.VersionRangeStruct)},e.gtVersion=function(e,r){return(0,t.gt)(e,r)},e.gtRange=function(e,r){return(0,t.gtr)(e,r)},e.satisfiesVersionRange=function(e,r){return(0,t.satisfies)(e,r,{includePrerelease:!0})}}(Oc),function(t){var r=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=e&&e.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(ia,t),n(Pa,t),n(Ba,t),n(Xa,t),n(rc,t),n(pc,t),n(bc,t),n(Oa,t),n(vc,t),n(wc,t),n(kc,t),n(Tc,t),n(Ac,t),n(Nc,t),n(jc,t),n(Bc,t),n(Oc,t)}(na),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createModuleLogger=e.projectLogger=void 0;const t=na;Object.defineProperty(e,"createModuleLogger",{enumerable:!0,get:function(){return t.createModuleLogger}}),e.projectLogger=(0,t.createProjectLogger)("eth-block-tracker")}(ra);var Fc=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.PollingBlockTracker=void 0;const Dc=Fc(qo),Uc=Fc(((e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=e=>{const r=t=>"string"==typeof t?e===t:t.test(e);return t.include?t.include.some(r):!t.exclude.some(r)};let n;n="function"==typeof e?function(){return t.excludeMain?e.apply(this,arguments):Vo(e,t).apply(this,arguments)}:Object.create(Object.getPrototypeOf(e));for(const i in e){const s=e[i];n[i]="function"==typeof s&&r(i)?Vo(s,t):s}return n})),Hc=zo,Wc=(0,ra.createModuleLogger)(ra.projectLogger,"polling-block-tracker"),qc=(0,Dc.default)();class Vc extends Hc.BaseBlockTracker{constructor(e={}){var t;if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},e),{blockResetDuration:null!==(t=e.blockResetDuration)&&void 0!==t?t:e.pollingInterval})),this._provider=e.provider,this._pollingInterval=e.pollingInterval||2e4,this._retryTimeout=e.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=void 0===e.keepEventLoopActive||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 e=zc(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await e}catch(t){const r=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:\n${null!==(e=t.stack)&&void 0!==e?e:t}`);try{this.emit("error",r)}catch(e){console.error(r)}const n=zc(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await n}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const e={jsonrpc:"2.0",id:qc(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0),Wc("Making request",e);const t=await(0,Uc.default)((t=>this._provider.sendAsync(e,t)))();if(Wc("Got response",t),t.error)throw new Error(`PollingBlockTracker - encountered error fetching block:\n${t.error.message}`);return t.result}}function zc(e,t){return new Promise((r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()}))}Wo.PollingBlockTracker=Vc;var $c={},Jc=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($c,"__esModule",{value:!0}),$c.SubscribeBlockTracker=void 0;const Kc=Jc(qo),Gc=zo,Zc=(0,Kc.default)();class Qc extends Gc.BaseBlockTracker{constructor(e={}){if(!e.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(e),this._provider=e.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(void 0===this._subscriptionId||null===this._subscriptionId)try{const e=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(e)}catch(e){this.emit("error",e)}}async _end(){if(null!==this._subscriptionId&&void 0!==this._subscriptionId)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(e){this.emit("error",e)}}_call(e,...t){return new Promise(((r,n)=>{this._provider.sendAsync({id:Zc(),method:e,params:t,jsonrpc:"2.0"},((e,t)=>{e?n(e):r(t.result)}))}))}_handleSubData(e,t){var r;"eth_subscription"===t.method&&(null===(r=t.params)||void 0===r?void 0:r.subscription)===this._subscriptionId&&this._newPotentialLatest(t.params.result.number)}}$c.SubscribeBlockTracker=Qc,function(t){var r=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=e&&e.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(Wo,t),n($c,t)}(Ho);var Yc={};Object.defineProperty(Yc,"__esModule",{value:!0});const Xc=o;function el(e,t,r){try{Reflect.apply(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}class tl extends Xc.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const i=n[e];if(void 0===i)return!1;if("function"==typeof i)el(i,this,t);else{const e=i.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}(i);for(let n=0;n<e;n+=1)el(r[n],this,t)}return!0}}Yc.default=tl;var rl={},nl={},il={};Object.defineProperty(il,"__esModule",{value:!0}),il.getUniqueId=void 0;const sl=4294967295;let ol=Math.floor(Math.random()*sl);il.getUniqueId=function(){return ol=(ol+1)%sl,ol},Object.defineProperty(nl,"__esModule",{value:!0}),nl.createIdRemapMiddleware=void 0;const al=il;nl.createIdRemapMiddleware=function(){return(e,t,r,n)=>{const i=e.id,s=al.getUniqueId();e.id=s,t.id=s,r((r=>{e.id=i,t.id=i,r()}))}};var cl={};Object.defineProperty(cl,"__esModule",{value:!0}),cl.createAsyncMiddleware=void 0,cl.createAsyncMiddleware=function(e){return async(t,r,n,i)=>{let s;const o=new Promise((e=>{s=e}));let a=null,c=!1;const l=async()=>{c=!0,n((e=>{a=e,s()})),await o};try{await e(t,r,l),c?(await o,a(null)):i(null)}catch(e){a?a(e):i(e)}}};var ll={};Object.defineProperty(ll,"__esModule",{value:!0}),ll.createScaffoldMiddleware=void 0,ll.createScaffoldMiddleware=function(e){return(t,r,n,i)=>{const s=e[t.method];return void 0===s?n():"function"==typeof s?s(t,r,n,i):(r.result=s,i())}};var ul={},dl={};Object.defineProperty(dl,"__esModule",{value:!0});const hl=o;function fl(e,t,r){try{Reflect.apply(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}class pl extends hl.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const i=n[e];if(void 0===i)return!1;if("function"==typeof i)fl(i,this,t);else{const e=i.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}(i);for(let n=0;n<e;n+=1)fl(r[n],this,t)}return!0}}dl.default=pl;var gl={},_l={},ml=Sl;Sl.default=Sl,Sl.stable=Il,Sl.stableStringify=Il;var yl="[...]",bl="[Circular]",vl=[],wl=[];function El(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Sl(e,t,r,n){var i;void 0===n&&(n=El()),Cl(e,"",0,[],void 0,0,n);try{i=0===wl.length?JSON.stringify(e,t,r):JSON.stringify(e,Ml(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==vl.length;){var s=vl.pop();4===s.length?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function kl(e,t,r,n){var i=Object.getOwnPropertyDescriptor(n,r);void 0!==i.get?i.configurable?(Object.defineProperty(n,r,{value:e}),vl.push([n,r,t,i])):wl.push([t,r,e]):(n[r]=e,vl.push([n,r,t]))}function Cl(e,t,r,n,i,s,o){var a;if(s+=1,"object"==typeof e&&null!==e){for(a=0;a<n.length;a++)if(n[a]===e)return void kl(bl,e,t,i);if(void 0!==o.depthLimit&&s>o.depthLimit)return void kl(yl,e,t,i);if(void 0!==o.edgesLimit&&r+1>o.edgesLimit)return void kl(yl,e,t,i);if(n.push(e),Array.isArray(e))for(a=0;a<e.length;a++)Cl(e[a],a,a,n,e,s,o);else{var c=Object.keys(e);for(a=0;a<c.length;a++){var l=c[a];Cl(e[l],l,a,n,e,s,o)}}n.pop()}}function Rl(e,t){return e<t?-1:e>t?1:0}function Il(e,t,r,n){void 0===n&&(n=El());var i,s=xl(e,"",0,[],void 0,0,n)||e;try{i=0===wl.length?JSON.stringify(s,t,r):JSON.stringify(s,Ml(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==vl.length;){var o=vl.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function xl(e,t,r,n,i,s,o){var a;if(s+=1,"object"==typeof e&&null!==e){for(a=0;a<n.length;a++)if(n[a]===e)return void kl(bl,e,t,i);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==o.depthLimit&&s>o.depthLimit)return void kl(yl,e,t,i);if(void 0!==o.edgesLimit&&r+1>o.edgesLimit)return void kl(yl,e,t,i);if(n.push(e),Array.isArray(e))for(a=0;a<e.length;a++)xl(e[a],a,a,n,e,s,o);else{var c={},l=Object.keys(e).sort(Rl);for(a=0;a<l.length;a++){var u=l[a];xl(e[u],u,a,n,e,s,o),c[u]=e[u]}if(void 0===i)return c;vl.push([i,t,e]),i[t]=c}n.pop()}}function Ml(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(wl.length>0)for(var n=0;n<wl.length;n++){var i=wl[n];if(i[1]===t&&i[0]===r){r=i[2],wl.splice(n,1);break}}return e.call(this,t,r)}}Object.defineProperty(_l,"__esModule",{value:!0}),_l.EthereumProviderError=_l.EthereumRpcError=void 0;const Tl=ml;class Al extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return Tl.default(this.serialize(),Ll,2)}}_l.EthereumRpcError=Al;function Ll(e,t){if("[Circular]"!==t)return t}_l.EthereumProviderError=class extends Al{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}};var Pl={},Nl={};Object.defineProperty(Nl,"__esModule",{value:!0}),Nl.errorValues=Nl.errorCodes=void 0,Nl.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}},Nl.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(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Nl,r=_l,n=t.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:o(n)};function o(r,n=i){if(Number.isInteger(r)){const n=r.toString();if(u(t.errorValues,n))return t.errorValues[n].message;if(c(r))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return n}function a(e){if(!Number.isInteger(e))return!1;const r=e.toString();return!!t.errorValues[r]||!!c(e)}function c(e){return e>=-32099&&e<=-32e3}function l(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=o,e.isValidCode=a,e.serializeError=function(e,{fallbackError:t=s,shouldIncludeStack:n=!1}={}){var i,c;if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw new Error("Must provide fallback error with integer number code and string message.");if(e instanceof r.EthereumRpcError)return e.serialize();const d={};if(e&&"object"==typeof e&&!Array.isArray(e)&&u(e,"code")&&a(e.code)){const t=e;d.code=t.code,t.message&&"string"==typeof t.message?(d.message=t.message,u(t,"data")&&(d.data=t.data)):(d.message=o(d.code),d.data={originalError:l(e)})}else{d.code=t.code;const r=null===(i=e)||void 0===i?void 0:i.message;d.message=r&&"string"==typeof r?r:t.message,d.data={originalError:l(e)}}const h=null===(c=e)||void 0===c?void 0:c.stack;return n&&e&&h&&"string"==typeof h&&(d.stack=h),d}}(Pl);var jl={};Object.defineProperty(jl,"__esModule",{value:!0}),jl.ethErrors=void 0;const Bl=_l,Ol=Pl,Fl=Nl;function Dl(e,t){const[r,n]=Hl(t);return new Bl.EthereumRpcError(e,r||Ol.getMessageFromCode(e),n)}function Ul(e,t){const[r,n]=Hl(t);return new Bl.EthereumProviderError(e,r||Ol.getMessageFromCode(e),n)}function Hl(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}jl.ethErrors={rpc:{parse:e=>Dl(Fl.errorCodes.rpc.parse,e),invalidRequest:e=>Dl(Fl.errorCodes.rpc.invalidRequest,e),invalidParams:e=>Dl(Fl.errorCodes.rpc.invalidParams,e),methodNotFound:e=>Dl(Fl.errorCodes.rpc.methodNotFound,e),internal:e=>Dl(Fl.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Dl(t,e)},invalidInput:e=>Dl(Fl.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>Dl(Fl.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>Dl(Fl.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>Dl(Fl.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>Dl(Fl.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>Dl(Fl.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Ul(Fl.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>Ul(Fl.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>Ul(Fl.errorCodes.provider.unsupportedMethod,e),disconnected:e=>Ul(Fl.errorCodes.provider.disconnected,e),chainDisconnected:e=>Ul(Fl.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new Bl.EthereumProviderError(t,r,n)}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=_l;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const r=Pl;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=jl;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=Nl;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})}(gl);var Wl=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ul,"__esModule",{value:!0}),ul.JsonRpcEngine=void 0;const ql=Wl(dl),Vl=gl;class zl extends ql.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,t){if(t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?this._handleBatch(e,t):this._handleBatch(e):t?this._handle(e,t):this._promiseHandle(e)}asMiddleware(){return async(e,t,r,n)=>{try{const[i,s,o]=await zl._runAllMiddleware(e,t,this._middleware);return s?(await zl._runReturnHandlers(o),n(i)):r((async e=>{try{await zl._runReturnHandlers(o)}catch(t){return e(t)}return e()}))}catch(e){return n(e)}}}async _handleBatch(e,t){try{const r=await Promise.all(e.map(this._promiseHandle.bind(this)));return t?t(null,r):r}catch(e){if(t)return t(e);throw e}}_promiseHandle(e){return new Promise((t=>{this._handle(e,((e,r)=>{t(r)}))}))}async _handle(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){const r=new Vl.EthereumRpcError(Vl.errorCodes.rpc.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(r,{id:void 0,jsonrpc:"2.0",error:r})}if("string"!=typeof e.method){const r=new Vl.EthereumRpcError(Vl.errorCodes.rpc.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return t(r,{id:e.id,jsonrpc:"2.0",error:r})}const r=Object.assign({},e),n={id:r.id,jsonrpc:r.jsonrpc};let i=null;try{await this._processRequest(r,n)}catch(e){i=e}return i&&(delete n.result,n.error||(n.error=Vl.serializeError(i))),t(i,n)}async _processRequest(e,t){const[r,n,i]=await zl._runAllMiddleware(e,t,this._middleware);if(zl._checkForCompletion(e,t,n),await zl._runReturnHandlers(i),r)throw r}static async _runAllMiddleware(e,t,r){const n=[];let i=null,s=!1;for(const o of r)if([i,s]=await zl._runMiddleware(e,t,o,n),s)break;return[i,s,n.reverse()]}static _runMiddleware(e,t,r,n){return new Promise((i=>{const s=e=>{const r=e||t.error;r&&(t.error=Vl.serializeError(r)),i([r,!0])},o=r=>{t.error?s(t.error):(r&&("function"!=typeof r&&s(new Vl.EthereumRpcError(Vl.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof r}" for request:\n${$l(e)}`,{request:e})),n.push(r)),i([null,!1]))};try{r(e,t,o,s)}catch(e){s(e)}}))}static async _runReturnHandlers(e){for(const t of e)await new Promise(((e,r)=>{t((t=>t?r(t):e()))}))}static _checkForCompletion(e,t,r){if(!("result"in t)&&!("error"in t))throw new Vl.EthereumRpcError(Vl.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:\n${$l(e)}`,{request:e});if(!r)throw new Vl.EthereumRpcError(Vl.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:\n${$l(e)}`,{request:e})}}function $l(e){return JSON.stringify(e,null,2)}ul.JsonRpcEngine=zl;var Jl={};Object.defineProperty(Jl,"__esModule",{value:!0}),Jl.mergeMiddleware=void 0;const Kl=ul;Jl.mergeMiddleware=function(e){const t=new Kl.JsonRpcEngine;return e.forEach((e=>t.push(e))),t.asMiddleware()},function(t){var r=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=e&&e.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(nl,t),n(cl,t),n(ll,t),n(il,t),n(ul,t),n(Jl,t)}(rl);var Gl={},Zl={},Ql={};Object.defineProperty(Ql,"__esModule",{value:!0});var Yl=d,Xl=function(){function e(e){if(this._maxConcurrency=e,this._queue=[],e<=0)throw new Error("semaphore must be initialized to a positive value");this._value=e}return e.prototype.acquire=function(){var e=this,t=this.isLocked(),r=new Promise((function(t){return e._queue.push(t)}));return t||this._dispatch(),r},e.prototype.runExclusive=function(e){return Yl.__awaiter(this,void 0,void 0,(function(){var t,r,n;return Yl.__generator(this,(function(i){switch(i.label){case 0:return[4,this.acquire()];case 1:t=i.sent(),r=t[0],n=t[1],i.label=2;case 2:return i.trys.push([2,,4,5]),[4,e(r)];case 3:return[2,i.sent()];case 4:return n(),[7];case 5:return[2]}}))}))},e.prototype.isLocked=function(){return this._value<=0},e.prototype.release=function(){if(this._maxConcurrency>1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var e=this._currentReleaser;this._currentReleaser=void 0,e()}},e.prototype._dispatch=function(){var e=this,t=this._queue.shift();if(t){var r=!1;this._currentReleaser=function(){r||(r=!0,e._value++,e._dispatch())},t([this._value--,this._currentReleaser])}},e}();Ql.default=Xl,Object.defineProperty(Zl,"__esModule",{value:!0});var eu=d,tu=Ql,ru=function(){function e(){this._semaphore=new tu.default(1)}return e.prototype.acquire=function(){return eu.__awaiter(this,void 0,void 0,(function(){var e;return eu.__generator(this,(function(t){switch(t.label){case 0:return[4,this._semaphore.acquire()];case 1:return e=t.sent(),[2,e[1]]}}))}))},e.prototype.runExclusive=function(e){return this._semaphore.runExclusive((function(){return e()}))},e.prototype.isLocked=function(){return this._semaphore.isLocked()},e.prototype.release=function(){this._semaphore.release()},e}();Zl.default=ru;var nu={};Object.defineProperty(nu,"__esModule",{value:!0}),nu.withTimeout=void 0;var iu=d;nu.withTimeout=function(e,t,r){var n=this;return void 0===r&&(r=new Error("timeout")),{acquire:function(){return new Promise((function(i,s){return iu.__awaiter(n,void 0,void 0,(function(){var n,o;return iu.__generator(this,(function(a){switch(a.label){case 0:return n=!1,setTimeout((function(){n=!0,s(r)}),t),[4,e.acquire()];case 1:return o=a.sent(),n?(Array.isArray(o)?o[1]:o)():i(o),[2]}}))}))}))},runExclusive:function(e){return iu.__awaiter(this,void 0,void 0,(function(){var t,r;return iu.__generator(this,(function(n){switch(n.label){case 0:t=function(){},n.label=1;case 1:return n.trys.push([1,,7,8]),[4,this.acquire()];case 2:return r=n.sent(),Array.isArray(r)?(t=r[1],[4,e(r[0])]):[3,4];case 3:return[2,n.sent()];case 4:return t=r,[4,e()];case 5:return[2,n.sent()];case 6:return[3,8];case 7:return t(),[7];case 8:return[2]}}))}))},release:function(){e.release()},isLocked:function(){return e.isLocked()}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.withTimeout=e.Semaphore=e.Mutex=void 0;var t=Zl;Object.defineProperty(e,"Mutex",{enumerable:!0,get:function(){return t.default}});var r=Ql;Object.defineProperty(e,"Semaphore",{enumerable:!0,get:function(){return r.default}});var n=nu;Object.defineProperty(e,"withTimeout",{enumerable:!0,get:function(){return n.withTimeout}})}(Gl);var su=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var n in r)ou.call(r,n)&&(e[n]=r[n])}return e},ou=Object.prototype.hasOwnProperty;const au=su,cu=qo();var lu=uu;function uu(e){this.currentProvider=e}function du(e){return function(){var t=[].slice.call(arguments),r=t.pop();this.sendAsync({method:e,params:t},r)}}function hu(e,t){return function(){var r=[].slice.call(arguments),n=r.pop();r.length<e&&r.push("latest"),this.sendAsync({method:t,params:r},n)}}uu.prototype.getBalance=hu(2,"eth_getBalance"),uu.prototype.getCode=hu(2,"eth_getCode"),uu.prototype.getTransactionCount=hu(2,"eth_getTransactionCount"),uu.prototype.getStorageAt=hu(3,"eth_getStorageAt"),uu.prototype.call=hu(2,"eth_call"),uu.prototype.protocolVersion=du("eth_protocolVersion"),uu.prototype.syncing=du("eth_syncing"),uu.prototype.coinbase=du("eth_coinbase"),uu.prototype.mining=du("eth_mining"),uu.prototype.hashrate=du("eth_hashrate"),uu.prototype.gasPrice=du("eth_gasPrice"),uu.prototype.accounts=du("eth_accounts"),uu.prototype.blockNumber=du("eth_blockNumber"),uu.prototype.getBlockTransactionCountByHash=du("eth_getBlockTransactionCountByHash"),uu.prototype.getBlockTransactionCountByNumber=du("eth_getBlockTransactionCountByNumber"),uu.prototype.getUncleCountByBlockHash=du("eth_getUncleCountByBlockHash"),uu.prototype.getUncleCountByBlockNumber=du("eth_getUncleCountByBlockNumber"),uu.prototype.sign=du("eth_sign"),uu.prototype.sendTransaction=du("eth_sendTransaction"),uu.prototype.sendRawTransaction=du("eth_sendRawTransaction"),uu.prototype.estimateGas=du("eth_estimateGas"),uu.prototype.getBlockByHash=du("eth_getBlockByHash"),uu.prototype.getBlockByNumber=du("eth_getBlockByNumber"),uu.prototype.getTransactionByHash=du("eth_getTransactionByHash"),uu.prototype.getTransactionByBlockHashAndIndex=du("eth_getTransactionByBlockHashAndIndex"),uu.prototype.getTransactionByBlockNumberAndIndex=du("eth_getTransactionByBlockNumberAndIndex"),uu.prototype.getTransactionReceipt=du("eth_getTransactionReceipt"),uu.prototype.getUncleByBlockHashAndIndex=du("eth_getUncleByBlockHashAndIndex"),uu.prototype.getUncleByBlockNumberAndIndex=du("eth_getUncleByBlockNumberAndIndex"),uu.prototype.getCompilers=du("eth_getCompilers"),uu.prototype.compileLLL=du("eth_compileLLL"),uu.prototype.compileSolidity=du("eth_compileSolidity"),uu.prototype.compileSerpent=du("eth_compileSerpent"),uu.prototype.newFilter=du("eth_newFilter"),uu.prototype.newBlockFilter=du("eth_newBlockFilter"),uu.prototype.newPendingTransactionFilter=du("eth_newPendingTransactionFilter"),uu.prototype.uninstallFilter=du("eth_uninstallFilter"),uu.prototype.getFilterChanges=du("eth_getFilterChanges"),uu.prototype.getFilterLogs=du("eth_getFilterLogs"),uu.prototype.getLogs=du("eth_getLogs"),uu.prototype.getWork=du("eth_getWork"),uu.prototype.submitWork=du("eth_submitWork"),uu.prototype.submitHashrate=du("eth_submitHashrate"),uu.prototype.sendAsync=function(e,t){var r;this.currentProvider.sendAsync((r=e,au({id:cu(),jsonrpc:"2.0",params:[]},r)),(function(e,r){if(!e&&r.error&&(e=new Error("EthQuery - RPC Error - "+r.error.message)),e)return t(e);t(null,r.result)}))};const fu=(e,t,r,n)=>function(...i){return new(0,t.promiseModule)(((s,o)=>{t.multiArgs?i.push(((...e)=>{t.errorFirst?e[0]?o(e):(e.shift(),s(e)):s(e)})):t.errorFirst?i.push(((e,t)=>{e?o(e):s(t)})):i.push(s);const a=this===r?n:this;Reflect.apply(e,a,i)}))},pu=new WeakMap;const gu=Yc.default;var _u=class extends gu{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(e){this.updates=this.updates.concat(e),e.forEach((e=>this.emit("update",e)))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}};const mu=_u;var yu={minBlockRef:function(...e){return bu(e)[0]},maxBlockRef:function(...e){const t=bu(e);return t[t.length-1]},sortBlockRefs:bu,bnToHex:function(e){return"0x"+e.toString(16)},blockRefIsNumber:function(e){return e&&!["earliest","latest","pending"].includes(e)},hexToInt:vu,incrementHexInt:function(e){if(null==e)return e;return wu(vu(e)+1)},intToHex:wu,unsafeRandomBytes:function(e){let t="0x";for(let r=0;r<e;r++)t+=Eu(),t+=Eu();return t}};function bu(e){return e.sort(((e,t)=>"latest"===e||"earliest"===t?1:"latest"===t||"earliest"===e?-1:vu(e)-vu(t)))}function vu(e){return null==e?e:Number.parseInt(e,16)}function wu(e){if(null==e)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function Eu(){return Math.floor(16*Math.random()).toString(16)}const Su=lu,ku=(e,t)=>{t={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...t};const r=typeof e;if(null===e||"object"!==r&&"function"!==r)throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${null===e?"null":r}\``);const n=new WeakMap,i=new Proxy(e,{apply(e,r,s){const o=n.get(e);if(o)return Reflect.apply(o,r,s);const a=t.excludeMain?e:fu(e,t,i,e);return n.set(e,a),Reflect.apply(a,r,s)},get(e,r){const s=e[r];if(!((e,r)=>{let n=pu.get(e);if(n||(n={},pu.set(e,n)),r in n)return n[r];const i=e=>"string"==typeof e||"symbol"==typeof r?r===e:e.test(r),s=Reflect.getOwnPropertyDescriptor(e,r),o=void 0===s||s.writable||s.configurable,a=(t.include?t.include.some(i):!t.exclude.some(i))&&o;return n[r]=a,a})(e,r)||s===Function.prototype[r])return s;const o=n.get(s);if(o)return o;if("function"==typeof s){const r=fu(s,t,i,e);return n.set(s,r),r}return s}});return i},Cu=class extends mu{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}},{bnToHex:Ru,hexToInt:Iu,incrementHexInt:xu,minBlockRef:Mu,blockRefIsNumber:Tu}=yu;var Au=class extends Cu{constructor({provider:e,params:t}){super(),this.type="log",this.ethQuery=new Su(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},t),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map((e=>e.toLowerCase())))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const r=Mu(this.params.toBlock,e),n=Object.assign({},this.params,{toBlock:r}),i=await this._fetchLogs(n);this.addInitialResults(i)}async update({oldBlock:e,newBlock:t}){const r=t;let n;n=e?xu(e):t;const i=Object.assign({},this.params,{fromBlock:n,toBlock:r}),s=(await this._fetchLogs(i)).filter((e=>this.matchLog(e)));this.addResults(s)}async _fetchLogs(e){return await ku((t=>this.ethQuery.getLogs(e,t)))()}matchLog(e){if(Iu(this.params.fromBlock)>=Iu(e.blockNumber))return!1;if(Tu(this.params.toBlock)&&Iu(this.params.toBlock)<=Iu(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();if(this.params.address&&t&&!this.params.address.includes(t))return!1;return this.params.topics.every(((t,r)=>{let n=e.topics[r];if(!n)return!1;n=n.toLowerCase();let i=Array.isArray(t)?t:[t];if(i.includes(null))return!0;i=i.map((e=>e.toLowerCase()));return i.includes(n)}))}},Lu=async function({provider:e,fromBlock:t,toBlock:r}){t||(t=r);const n=Pu(t),i=Pu(r),s=Array(i-n+1).fill().map(((e,t)=>n+t)).map(Nu);let o=await Promise.all(s.map((t=>async function(e,t,r){for(let n=0;n<3;n++)try{return await ju(e,{id:1,jsonrpc:"2.0",method:t,params:r})}catch(e){console.error(`provider.sendAsync failed: ${e.stack||e.message||e}`)}return null}(e,"eth_getBlockByNumber",[t,!1]))));return o=o.filter((e=>null!==e)),o};function Pu(e){return null==e?e:Number.parseInt(e,16)}function Nu(e){if(null==e)return e;return"0x"+e.toString(16)}function ju(e,t){return new Promise(((r,n)=>{e.sendAsync(t,((e,t)=>{e?n(e):t.error?n(t.error):t.result?r(t.result):n(new Error("Result was empty"))}))}))}const Bu=_u,Ou=Lu,{incrementHexInt:Fu}=yu;var Du=class extends Bu{constructor({provider:e,params:t}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:t}){const r=t,n=Fu(e),i=(await Ou({provider:this.provider,fromBlock:n,toBlock:r})).map((e=>e.hash));this.addResults(i)}};const Uu=_u,Hu=Lu,{incrementHexInt:Wu}=yu;var qu=class extends Uu{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const t=e,r=Wu(e),n=await Hu({provider:this.provider,fromBlock:r,toBlock:t}),i=[];for(const e of n)i.push(...e.transactions);this.addResults(i)}};const Vu=Gl.Mutex,{createAsyncMiddleware:zu,createScaffoldMiddleware:$u}=rl,Ju=Au,Ku=Du,Gu=qu,{intToHex:Zu,hexToInt:Qu}=yu;var Yu=function({blockTracker:e,provider:t}){let r=0,n={};const i=new Vu,s=function({mutex:e}){return t=>async(r,n,i,s)=>{(await e.acquire())(),t(r,n,i,s)}}({mutex:i}),o=$u({eth_newFilter:s(Xu(c)),eth_newBlockFilter:s(Xu(l)),eth_newPendingTransactionFilter:s(Xu(u)),eth_uninstallFilter:s(ed(f)),eth_getFilterChanges:s(ed(d)),eth_getFilterLogs:s(ed(h))}),a=async({oldBlock:e,newBlock:t})=>{if(0===n.length)return;const r=await i.acquire();try{await Promise.all(td(n).map((async r=>{try{await r.update({oldBlock:e,newBlock:t})}catch(e){console.error(e)}})))}catch(e){console.error(e)}r()};return o.newLogFilter=c,o.newBlockFilter=l,o.newPendingTransactionFilter=u,o.uninstallFilter=f,o.getFilterChanges=d,o.getFilterLogs=h,o.destroy=()=>{!async function(){const e=td(n).length;n={},g({prevFilterCount:e,newFilterCount:0})}()},o;async function c(e){const r=new Ju({provider:t,params:e});return await p(r),r}async function l(){const e=new Ku({provider:t});return await p(e),e}async function u(){const e=new Gu({provider:t});return await p(e),e}async function d(e){const t=Qu(e),r=n[t];if(!r)throw new Error(`No filter for index "${t}"`);return r.getChangesAndClear()}async function h(e){const t=Qu(e),r=n[t];if(!r)throw new Error(`No filter for index "${t}"`);let i=[];return"log"===r.type&&(i=r.getAllResults()),i}async function f(e){const t=Qu(e),r=n[t],i=Boolean(r);return i&&await async function(e){const t=td(n).length;delete n[e];const r=td(n).length;g({prevFilterCount:t,newFilterCount:r})}(t),i}async function p(t){const i=td(n).length,s=await e.getLatestBlock();await t.initialize({currentBlock:s}),r++,n[r]=t,t.id=r,t.idHex=Zu(r);return g({prevFilterCount:i,newFilterCount:td(n).length}),r}function g({prevFilterCount:t,newFilterCount:r}){0===t&&r>0?e.on("sync",a):t>0&&0===r&&e.removeListener("sync",a)}};function Xu(e){return ed((async(...t)=>{const r=await e(...t);return Zu(r.id)}))}function ed(e){return zu((async(t,r)=>{const n=await e.apply(null,t.params);r.result=n}))}function td(e,t){const r=[];for(let t in e)r.push(e[t]);return r}const rd=Yc.default,{createAsyncMiddleware:nd,createScaffoldMiddleware:id}=rl,sd=Yu,{unsafeRandomBytes:od,incrementHexInt:ad}=yu,cd=Lu;var ld=function({blockTracker:e,provider:t}){const r={},n=sd({blockTracker:e,provider:t});let i=!1;const s=new rd,o=id({eth_subscribe:nd((async function(s,o){if(i)throw new Error("SubscriptionManager - attempting to use after destroying");const c=s.params[0],l=od(16);let u;switch(c){case"newHeads":u=d({subId:l});break;case"logs":const e=s.params[1];u=h({subId:l,filter:await n.newLogFilter(e)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${c}"`)}return r[l]=u,void(o.result=l);function d({subId:r}){const n={type:c,destroy:async()=>{e.removeListener("sync",n.update)},update:async({oldBlock:e,newBlock:n})=>{const i=n,s=ad(e);(await cd({provider:t,fromBlock:s,toBlock:i})).map(ud).filter((e=>null!==e)).forEach((e=>{a(r,e)}))}};return e.on("sync",n.update),n}function h({subId:e,filter:t}){t.on("update",(t=>a(e,t)));return{type:c,destroy:async()=>await n.uninstallFilter(t.idHex)}}})),eth_unsubscribe:nd((async function(e,t){if(i)throw new Error("SubscriptionManager - attempting to use after destroying");const n=e.params[0],s=r[n];if(!s)return void(t.result=!1);delete r[n],await s.destroy(),t.result=!0}))});return o.destroy=function(){s.removeAllListeners();for(const e in r)r[e].destroy(),delete r[e];i=!0},{events:s,middleware:o};function a(e,t){s.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}};function ud(e){return null==e?null:{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.SubscriptionRequestHandler=void 0;const dd=Ho,hd=ld,fd=()=>{};Uo.SubscriptionRequestHandler=class{constructor({provider:e}){const t=new dd.PollingBlockTracker({provider:e,pollingInterval:15e3,setSkipCacheFlag:!0}),{events:r,middleware:n}=hd({blockTracker:t,provider:e});this.events=r,this.subscriptionMiddleware=n}canHandleRequest(e){return["eth_subscribe","eth_unsubscribe"].includes(e.method)}async handleRequest(e){const t={};return await this.subscriptionMiddleware(e,t,fd,fd),t}async onDisconnect(){this.subscriptionMiddleware.destroy()}};var pd=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(f,"__esModule",{value:!0}),f.CoinbaseWalletProvider=void 0;const gd=pd(s.exports),_d=p,md=g,yd=I,bd=q,vd=ee,wd=re,Ed=ie,Sd=Uo;class kd extends gd.default{get chainId(){return this.chain.id}constructor(e){var t,r;super(),this.accounts=[],this.chain={id:null!==(r=null===(t=e.appChainIds)||void 0===t?void 0:t[0])&&void 0!==r?r:1},this.handlers=[new vd.StateRequestHandler,new Ed.SignRequestHandler(Object.assign(Object.assign({},e),{updateListener:{onAccountsUpdate:this.setAccounts.bind(this),onChainUpdate:this.setChain.bind(this),onConnect:this.emitConnectEvent.bind(this),onResetConnection:this.disconnect.bind(this)}})),new bd.FilterRequestHandler({provider:this}),new Sd.SubscriptionRequestHandler({provider:this}),new wd.RPCFetchRequestHandler]}get connected(){return this.accounts.length>0}async disconnect(){const e=md.standardErrors.provider.disconnected("User initiated disconnection");this.accounts=[],this.chain={id:1},await Promise.all(this.handlers.map((async e=>{var t;await(null===(t=e.onDisconnect)||void 0===t?void 0:t.call(e))}))),this.emit("disconnect",e)}async request(e){const t=(0,_d.getErrorForInvalidRequestArgs)(e);if(t)throw t;const r=this.handlers.find((t=>t.canHandleRequest(e)));return null==r?void 0:r.handleRequest(e,this.accounts,this.chain)}async enable(){return(0,yd.showDeprecationWarning)("enable",'use request({ method: "eth_requestAccounts" })'),await this.request({method:"eth_requestAccounts"})}emitConnectEvent(){this.emit("connect",{chainId:(0,yd.prepend0x)(this.chain.id.toString(16))})}setAccounts({accounts:e,source:t}){(0,yd.areAddressArraysEqual)(this.accounts,e)||(this.accounts=e,"storage"!==t&&this.emit("accountsChanged",this.accounts))}setChain({chain:e,source:t}){e.id===this.chain.id&&e.rpcUrl===this.chain.rpcUrl||(this.chain=e,"storage"!==t&&this.emit("chainChanged",(0,yd.prepend0x)(e.id.toString(16))))}}f.CoinbaseWalletProvider=kd;var Cd={},Rd={};Object.defineProperty(Rd,"__esModule",{value:!0}),Rd.walletLogo=void 0;Rd.walletLogo=(e,t)=>{let r;switch(e){case"standard":default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' 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=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' 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*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' 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*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' 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*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' 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*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' 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`}},Object.defineProperty(Cd,"__esModule",{value:!0}),Cd.CoinbaseWalletSDK=void 0;const Id=Rd,xd=f,Md=ge,Td=I,Ad=oe;function Ld({chainId:e,rpcUrl:t,appName:s,appLogoUrl:o,darkMode:a},c){return r(this,void 0,void 0,(function*(){if(window.ethereum&&(window.ethereum.isWalletLink||window.ethereum.isToshi))return n(window.ethereum,c);if(!s)throw new Error("walletLink need appName");const e=new h.CoinbaseWalletSDK({appName:s,appLogoUrl:o}).makeWeb3Provider();return yield e.request({method:"eth_requestAccounts"}),e.on("connect",c.connect),e.on("disconnect",c.disconnect),e.on("accountsChanged",c.accountsChanged),e.on("chainChanged",c.chainChanged),i(e)}))}Cd.CoinbaseWalletSDK=class{constructor(e){this.connectionPreference=e.connectionPreference||"default",this.chainIds=e.chainIds?e.chainIds.map(Number):[],this.appName=e.appName||"DApp",this.appLogoUrl=e.appLogoUrl||(0,Td.getFavicon)(),this.storeLatestVersion()}storeLatestVersion(){new Md.ScopedLocalStorage("CBWSDK").setItem("VERSION",Ad.LIB_VERSION)}makeWeb3Provider(){var e;if("embedded"!==this.connectionPreference){const t=this.walletExtension;if(t)return null===(e=t.setAppInfo)||void 0===e||e.call(t,this.appName,this.appLogoUrl),t}const t=this.coinbaseBrowser;return t||new xd.CoinbaseWalletProvider({appName:this.appName,appLogoUrl:this.appLogoUrl,appChainIds:this.chainIds,connectionPreference:this.connectionPreference})}disconnect(){var e;const t=null==this?void 0:this.walletExtension;t?null===(e=t.close)||void 0===e||e.call(t):Md.ScopedLocalStorage.clearAll()}getCoinbaseWalletLogo(e,t=240){return(0,Id.walletLogo)(e,t)}get walletExtension(){return window.coinbaseWalletExtension}get coinbaseBrowser(){var e,t;try{const r=null!==(e=window.ethereum)&&void 0!==e?e:null===(t=window.top)||void 0===t?void 0:t.ethereum;if(!r)return;return"isCoinbaseBrowser"in r&&r.isCoinbaseBrowser?r:void 0}catch(e){return}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CoinbaseWalletSDK=void 0;const t=f,r=Cd;var n=Cd;Object.defineProperty(e,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}}),e.default=r.CoinbaseWalletSDK,"undefined"!=typeof window&&(window.CoinbaseWalletSDK=r.CoinbaseWalletSDK,window.CoinbaseWalletProvider=t.CoinbaseWalletProvider)}(h);export{Ld as default};
|