@reown/appkit-cdn 0.0.3

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.
@@ -0,0 +1,7 @@
1
+ "use strict";const p=require("./W3MFrameProviderSingleton-BpWUndnw.cjs"),D=require("./hooks.module-BmccViTi.cjs");var Pi={},Ot={},Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.walletLogo=void 0;const Ta=(t,e)=>{let r;switch(t){case"standard":return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};Sr.walletLogo=Ta;var Cr={};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.LINK_API_URL=void 0;Cr.LINK_API_URL="https://www.walletlink.org";var v={},Bt={},je={};Object.defineProperty(je,"__esModule",{value:!0});je.errorValues=je.standardErrorCodes=void 0;je.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}};je.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 kr={},Rr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serialize=t.getErrorCode=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=je,r="Unspecified error message.";t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(h,f=r){if(h&&Number.isInteger(h)){const g=h.toString();if(u(e.errorValues,g))return e.errorValues[g].message;if(l(h))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return f}t.getMessageFromCode=n;function s(h){if(!Number.isInteger(h))return!1;const f=h.toString();return!!(e.errorValues[f]||l(h))}t.isValidCode=s;function i(h){var f;if(typeof h=="number")return h;if(o(h))return(f=h.code)!==null&&f!==void 0?f:h.errorCode}t.getErrorCode=i;function o(h){return typeof h=="object"&&h!==null&&(typeof h.code=="number"||typeof h.errorCode=="number")}function a(h,{shouldIncludeStack:f=!1}={}){const g={};if(h&&typeof h=="object"&&!Array.isArray(h)&&u(h,"code")&&s(h.code)){const y=h;g.code=y.code,y.message&&typeof y.message=="string"?(g.message=y.message,u(y,"data")&&(g.data=y.data)):(g.message=n(g.code),g.data={originalError:c(h)})}else g.code=e.standardErrorCodes.rpc.internal,g.message=d(h,"message")?h.message:r,g.data={originalError:c(h)};return f&&(g.stack=d(h,"stack")?h.stack:void 0),g}t.serialize=a;function l(h){return h>=-32099&&h<=-32e3}function c(h){return h&&typeof h=="object"&&!Array.isArray(h)?Object.assign({},h):h}function u(h,f){return Object.prototype.hasOwnProperty.call(h,f)}function d(h,f){return typeof h=="object"&&h!==null&&f in h&&typeof h[f]=="string"}})(Rr);Object.defineProperty(kr,"__esModule",{value:!0});kr.standardErrors=void 0;const ee=je,Oi=Rr;kr.standardErrors={rpc:{parse:t=>pe(ee.standardErrorCodes.rpc.parse,t),invalidRequest:t=>pe(ee.standardErrorCodes.rpc.invalidRequest,t),invalidParams:t=>pe(ee.standardErrorCodes.rpc.invalidParams,t),methodNotFound:t=>pe(ee.standardErrorCodes.rpc.methodNotFound,t),internal:t=>pe(ee.standardErrorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return pe(e,t)},invalidInput:t=>pe(ee.standardErrorCodes.rpc.invalidInput,t),resourceNotFound:t=>pe(ee.standardErrorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>pe(ee.standardErrorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>pe(ee.standardErrorCodes.rpc.transactionRejected,t),methodNotSupported:t=>pe(ee.standardErrorCodes.rpc.methodNotSupported,t),limitExceeded:t=>pe(ee.standardErrorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>nt(ee.standardErrorCodes.provider.userRejectedRequest,t),unauthorized:t=>nt(ee.standardErrorCodes.provider.unauthorized,t),unsupportedMethod:t=>nt(ee.standardErrorCodes.provider.unsupportedMethod,t),disconnected:t=>nt(ee.standardErrorCodes.provider.disconnected,t),chainDisconnected:t=>nt(ee.standardErrorCodes.provider.chainDisconnected,t),unsupportedChain:t=>nt(ee.standardErrorCodes.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Bi(e,r,n)}}};function pe(t,e){const[r,n]=ji(e);return new xi(t,r||(0,Oi.getMessageFromCode)(t),n)}function nt(t,e){const[r,n]=ji(e);return new Bi(t,r||(0,Oi.getMessageFromCode)(t),n)}function ji(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}let xi=class extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}},Bi=class extends xi{constructor(e,r,n){if(!$a(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}};function $a(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}var Ir={},vt={};Object.defineProperty(vt,"__esModule",{value:!0});vt.isErrorResponse=void 0;function Pa(t){return t.errorMessage!==void 0}vt.isErrorResponse=Pa;var St={};Object.defineProperty(St,"__esModule",{value:!0});St.LIB_VERSION=void 0;St.LIB_VERSION="3.9.3";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.serializeError=void 0;const Oa=vt,ja=St,xa=je,Ba=Rr;function Fa(t,e){const r=(0,Ba.serialize)(Da(t),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",ja.LIB_VERSION),n.searchParams.set("code",r.code.toString());const s=Ha(r.data,e);return s&&n.searchParams.set("method",s),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}Ir.serializeError=Fa;function Da(t){return typeof t=="string"?{message:t,code:xa.standardErrorCodes.rpc.internal}:(0,Oa.isErrorResponse)(t)?Object.assign(Object.assign({},t),{message:t.errorMessage,code:t.errorCode,data:{method:t.method}}):t}function Ha(t,e){const r=t==null?void 0:t.method;if(r)return r;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.standardErrors=t.standardErrorCodes=t.serializeError=t.getMessageFromCode=t.getErrorCode=void 0;const e=je;Object.defineProperty(t,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});const r=kr;Object.defineProperty(t,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=Ir;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const s=Rr;Object.defineProperty(t,"getErrorCode",{enumerable:!0,get:function(){return s.getErrorCode}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return s.getMessageFromCode}})})(Bt);var Z={};Object.defineProperty(Z,"__esModule",{value:!0});Z.ProviderType=Z.RegExpString=Z.IntNumber=Z.BigIntString=Z.AddressString=Z.HexString=Z.OpaqueType=void 0;function Ft(){return t=>t}Z.OpaqueType=Ft;Z.HexString=Ft();Z.AddressString=Ft();Z.BigIntString=Ft();function Ua(t){return Math.floor(t)}Z.IntNumber=Ua;Z.RegExpString=Ft();var Ss;(function(t){t.CoinbaseWallet="CoinbaseWallet",t.MetaMask="MetaMask",t.Unselected=""})(Ss||(Z.ProviderType=Ss={}));var Va=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(v,"__esModule",{value:!0});v.isMobileWeb=v.getLocation=v.isInIFrame=v.createQrUrl=v.getFavicon=v.range=v.isBigNumber=v.ensureParsedJSONObject=v.ensureBN=v.ensureRegExpString=v.ensureIntNumber=v.ensureBuffer=v.ensureAddressString=v.ensureEvenLengthHexString=v.ensureHexString=v.isHexString=v.prepend0x=v.strip0x=v.has0xPrefix=v.hexStringFromIntNumber=v.intNumberFromHexString=v.bigIntStringFromBN=v.hexStringFromBuffer=v.hexStringToUint8Array=v.uint8ArrayToHex=v.randomBytesHex=void 0;const Fe=Va(p.bnExports),et=Bt,we=Z,Fi=/^[0-9]*$/,Di=/^[a-f0-9]*$/;function Wa(t){return Hi(crypto.getRandomValues(new Uint8Array(t)))}v.randomBytesHex=Wa;function Hi(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}v.uint8ArrayToHex=Hi;function za(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>parseInt(e,16)))}v.hexStringToUint8Array=za;function Ga(t,e=!1){const r=t.toString("hex");return(0,we.HexString)(e?`0x${r}`:r)}v.hexStringFromBuffer=Ga;function qa(t){return(0,we.BigIntString)(t.toString(10))}v.bigIntStringFromBN=qa;function Ja(t){return(0,we.IntNumber)(new Fe.default(Ht(t,!1),16).toNumber())}v.intNumberFromHexString=Ja;function Za(t){return(0,we.HexString)(`0x${new Fe.default(t).toString(16)}`)}v.hexStringFromIntNumber=Za;function Dn(t){return t.startsWith("0x")||t.startsWith("0X")}v.has0xPrefix=Dn;function Ar(t){return Dn(t)?t.slice(2):t}v.strip0x=Ar;function Ui(t){return Dn(t)?`0x${t.slice(2)}`:`0x${t}`}v.prepend0x=Ui;function Dt(t){if(typeof t!="string")return!1;const e=Ar(t).toLowerCase();return Di.test(e)}v.isHexString=Dt;function Vi(t,e=!1){if(typeof t=="string"){const r=Ar(t).toLowerCase();if(Di.test(r))return(0,we.HexString)(e?`0x${r}`:r)}throw et.standardErrors.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}v.ensureHexString=Vi;function Ht(t,e=!1){let r=Vi(t,!1);return r.length%2===1&&(r=(0,we.HexString)(`0${r}`)),e?(0,we.HexString)(`0x${r}`):r}v.ensureEvenLengthHexString=Ht;function Qa(t){if(typeof t=="string"){const e=Ar(t).toLowerCase();if(Dt(e)&&e.length===40)return(0,we.AddressString)(Ui(e))}throw et.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}v.ensureAddressString=Qa;function Ka(t){if(p.Buffer.isBuffer(t))return t;if(typeof t=="string"){if(Dt(t)){const e=Ht(t,!1);return p.Buffer.from(e,"hex")}return p.Buffer.from(t,"utf8")}throw et.standardErrors.rpc.invalidParams(`Not binary data: ${String(t)}`)}v.ensureBuffer=Ka;function Wi(t){if(typeof t=="number"&&Number.isInteger(t))return(0,we.IntNumber)(t);if(typeof t=="string"){if(Fi.test(t))return(0,we.IntNumber)(Number(t));if(Dt(t))return(0,we.IntNumber)(new Fe.default(Ht(t,!1),16).toNumber())}throw et.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}v.ensureIntNumber=Wi;function Xa(t){if(t instanceof RegExp)return(0,we.RegExpString)(t.toString());throw et.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(t)}`)}v.ensureRegExpString=Xa;function Ya(t){if(t!==null&&(Fe.default.isBN(t)||zi(t)))return new Fe.default(t.toString(10),10);if(typeof t=="number")return new Fe.default(Wi(t));if(typeof t=="string"){if(Fi.test(t))return new Fe.default(t,10);if(Dt(t))return new Fe.default(Ht(t,!1),16)}throw et.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}v.ensureBN=Ya;function ec(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw et.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}v.ensureParsedJSONObject=ec;function zi(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}v.isBigNumber=zi;function tc(t,e){return Array.from({length:e-t},(r,n)=>t+n)}v.range=tc;function rc(){const t=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:r}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${r}${n}`}v.getFavicon=rc;function nc(t,e,r,n,s,i){const o=n?"parent-id":"id",a=new URLSearchParams({[o]:t,secret:e,server:r,v:s,chainId:i.toString()}).toString();return`${r}/#/link?${a}`}v.createQrUrl=nc;function Gi(){try{return window.frameElement!==null}catch{return!1}}v.isInIFrame=Gi;function sc(){try{return Gi()&&window.top?window.top.location:window.location}catch{return window.location}}v.getLocation=sc;function ic(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}v.isMobileWeb=ic;var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.ScopedLocalStorage=void 0;class oc{constructor(e){this.scope=e}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;n<localStorage.length;n++){const s=localStorage.key(n);typeof s=="string"&&s.startsWith(e)&&r.push(s)}r.forEach(n=>localStorage.removeItem(n))}scopedKey(e){return`${this.scope}:${e}`}}Nr.ScopedLocalStorage=oc;var pt={},Ut={},Vt={},Ct={};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.EVENTS=void 0;Ct.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 ye={};Object.defineProperty(ye,"__esModule",{value:!0});ye.RelayAbstract=ye.APP_VERSION_KEY=ye.LOCAL_STORAGE_ADDRESSES_KEY=ye.WALLET_USER_NAME_KEY=void 0;const Cs=Bt;ye.WALLET_USER_NAME_KEY="walletUsername";ye.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";ye.APP_VERSION_KEY="AppVersion";class ac{async makeEthereumJSONRPCRequest(e,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(e),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw Cs.standardErrors.rpc.parse({});const s=n,{error:i}=s;if(i)throw(0,Cs.serializeError)(i,e.method);return s})}}ye.RelayAbstract=ac;var kt={};Object.defineProperty(kt,"__esModule",{value:!0});kt.Session=void 0;const ks=p.sha_jsExports,Rs=v,Is="session:id",As="session:secret",Ns="session:linked";class Hn{constructor(e,r,n,s){this._storage=e,this._id=r||(0,Rs.randomBytesHex)(16),this._secret=n||(0,Rs.randomBytesHex)(32),this._key=new ks.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const r=e.getItem(Is),n=e.getItem(Ns),s=e.getItem(As);return r&&s?new Hn(e,r,s,n==="1"):null}static hash(e){return new ks.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(Is,this._id),this._storage.setItem(As,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Ns,this._linked?"1":"0")}}kt.Session=Hn;var Mr={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.Cipher=void 0;const ir=v;class cc{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.importKey("raw",(0,ir.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},s,i.encode(e)),a=16,l=o.slice(o.byteLength-a),c=o.slice(0,o.byteLength-a),u=new Uint8Array(l),d=new Uint8Array(c),h=new Uint8Array([...n,...u,...d]);return(0,ir.uint8ArrayToHex)(h)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,s)=>{(async function(){const i=await crypto.subtle.importKey("raw",(0,ir.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=(0,ir.hexStringToUint8Array)(e),a=o.slice(0,12),l=o.slice(12,28),c=o.slice(28),u=new Uint8Array([...c,...l]),d={name:"AES-GCM",iv:new Uint8Array(a)};try{const h=await window.crypto.subtle.decrypt(d,i,u),f=new TextDecoder;n(f.decode(h))}catch(h){s(h)}})()})}}Lr.Cipher=cc;var Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.WalletLinkHTTP=void 0;class lc{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const s=`${r}:${n}`;this.auth=`Basic ${btoa(s)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:s}=await r.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${r.status}`)}}Tr.WalletLinkHTTP=lc;var mt={};Object.defineProperty(mt,"__esModule",{value:!0});mt.WalletLinkWebSocket=mt.ConnectionState=void 0;var ut;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(ut||(mt.ConnectionState=ut={}));class uc{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,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,r)=>{var n;let s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){r(i);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,ut.CONNECTING),s.onclose=i=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${i.code}: ${i.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,ut.DISCONNECTED)},s.onopen=i=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,ut.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(l=>this.sendData(l)),this.pendingData=[])},s.onmessage=i=>{var o,a;if(i.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const l=JSON.parse(i.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,l)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,ut.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}mt.WalletLinkWebSocket=uc;Object.defineProperty(Mr,"__esModule",{value:!0});Mr.WalletLinkConnection=void 0;const st=Z,dc=Lr,ke=Ct,Ms=ye,it=kt,hc=Tr,or=mt,Ls=1e4,fc=6e4;class gc{constructor({session:e,linkAPIUrl:r,listener:n,diagnostic:s,WebSocketClass:i=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,st.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=a=>{if(!a)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",c=>a.JsonRpcUrl&&this.handleChainUpdated(c,a.JsonRpcUrl)]]).forEach((c,u)=>{const d=a[u];d!==void 0&&c(d)})},this.handleDestroyed=a=>{var l,c;a==="1"&&((l=this.listener)===null||l===void 0||l.resetAndReload(),(c=this.diagnostic)===null||c===void 0||c.log(ke.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:it.Session.hash(this.session.id)}))},this.handleAccountUpdated=async a=>{var l,c;try{const u=await this.cipher.decrypt(a);(l=this.listener)===null||l===void 0||l.accountUpdated(u)}catch{(c=this.diagnostic)===null||c===void 0||c.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(a,l)=>{var c,u;try{const d=await this.cipher.decrypt(l);(c=this.listener)===null||c===void 0||c.metadataUpdated(a,d)}catch{(u=this.diagnostic)===null||u===void 0||u.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:a})}},this.handleWalletUsernameUpdated=async a=>{this.handleMetadataUpdated(Ms.WALLET_USER_NAME_KEY,a)},this.handleAppVersionUpdated=async a=>{this.handleMetadataUpdated(Ms.APP_VERSION_KEY,a)},this.handleChainUpdated=async(a,l)=>{var c,u;try{const d=await this.cipher.decrypt(a),h=await this.cipher.decrypt(l);(c=this.listener)===null||c===void 0||c.chainUpdated(d,h)}catch{(u=this.diagnostic)===null||u===void 0||u.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=e,this.cipher=new dc.Cipher(e.secret),this.diagnostic=s,this.listener=n;const o=new or.WalletLinkWebSocket(`${r}/rpc`,i);o.setConnectionStateListener(async a=>{var l;(l=this.diagnostic)===null||l===void 0||l.log(ke.EVENTS.CONNECTED_STATE_CHANGE,{state:a,sessionIdHash:it.Session.hash(e.id)});let c=!1;switch(a){case or.ConnectionState.DISCONNECTED:if(!this.destroyed){const u=async()=>{await new Promise(d=>setTimeout(d,5e3)),this.destroyed||o.connect().catch(()=>{u()})};u()}break;case or.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),c=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Ls),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case or.ConnectionState.CONNECTING:break}this.connected!==c&&(this.connected=c)}),o.setIncomingDataListener(a=>{var l,c,u;switch(a.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const d=a.type==="IsLinkedOK"?a.linked:void 0;(l=this.diagnostic)===null||l===void 0||l.log(ke.EVENTS.LINKED,{sessionIdHash:it.Session.hash(e.id),linked:d,type:a.type,onlineGuests:a.onlineGuests}),this.linked=d||a.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(c=this.diagnostic)===null||c===void 0||c.log(ke.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:it.Session.hash(e.id),metadata_keys:a&&a.metadata?Object.keys(a.metadata):void 0}),this.handleSessionMetadataUpdated(a.metadata);break}case"Event":{this.handleIncomingEvent(a);break}}a.id!==void 0&&((u=this.requestResolutions.get(a.id))===null||u===void 0||u(a))}),this.ws=o,this.http=new hc.WalletLinkHTTP(r,e.id,e.key)}connect(){var e;if(this.destroyed)throw new Error("instance is destroyed");(e=this.diagnostic)===null||e===void 0||e.log(ke.EVENTS.STARTED_CONNECTING,{sessionIdHash:it.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var e;this.destroyed=!0,this.ws.disconnect(),(e=this.diagnostic)===null||e===void 0||e.log(ke.EVENTS.DISCONNECTED,{sessionIdHash:it.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var r,n;this._connected=e,e&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(e)}setOnceConnected(e){return new Promise(r=>{this.connected?e().then(r):this.onceConnected=()=>{e().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r,n;if(!(e.type!=="Event"||e.event!=="Web3Response"))try{const s=await this.cipher.decrypt(e.data),i=JSON.parse(s);if(i.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(i)}catch{(n=this.diagnostic)===null||n===void 0||n.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(e,r){const n={type:"SetSessionConfig",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:r}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(n);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,r,n=!1){const s=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:s,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(i);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Ls*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r=fc){const n=e.id;this.sendData(e);let s;return Promise.race([new Promise((i,o)=>{s=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r)}),new Promise(i=>{this.requestResolutions.set(n,o=>{clearTimeout(s),i(o),this.requestResolutions.delete(n)})})])}async authenticate(){const e={type:"HostSession",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(e);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const e={type:"IsLinked",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}Mr.WalletLinkConnection=gc;var Wt={},zt={},Un={};Object.defineProperty(Un,"__esModule",{value:!0});Un.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 pc=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zt,"__esModule",{value:!0});zt.injectCssReset=void 0;const mc=pc(Un);function bc(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(mc.default)),document.documentElement.appendChild(t)}zt.injectCssReset=bc;var $r={},Pr={},bt={},Or={};Object.defineProperty(Or,"__esModule",{value:!0});Or.CloseIcon=void 0;const Ts=D.require$$1;function yc(t){return(0,Ts.h)("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),(0,Ts.h)("path",{d:"M13.7677 13L12.3535 14.4142L18.3535 20.4142L12.3535 26.4142L13.7677 27.8284L19.7677 21.8284L25.7677 27.8284L27.1819 26.4142L21.1819 20.4142L27.1819 14.4142L25.7677 13L19.7677 19L13.7677 13Z"}))}Or.CloseIcon=yc;var jr={};Object.defineProperty(jr,"__esModule",{value:!0});jr.CoinbaseWalletRound=void 0;const ar=D.require$$1;function wc(t){return(0,ar.h)("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),(0,ar.h)("circle",{cx:"14",cy:"14",r:"14",fill:"#0052FF"}),(0,ar.h)("path",{d:"M23.8521 14.0003C23.8521 19.455 19.455 23.8521 14.0003 23.8521C8.54559 23.8521 4.14844 19.455 4.14844 14.0003C4.14844 8.54559 8.54559 4.14844 14.0003 4.14844C19.455 4.14844 23.8521 8.54559 23.8521 14.0003Z",fill:"white"}),(0,ar.h)("path",{d:"M11.1855 12.5042C11.1855 12.0477 11.1855 11.7942 11.2835 11.642C11.3814 11.4899 11.4793 11.3377 11.6261 11.287C11.8219 11.1855 12.0178 11.1855 12.5073 11.1855H15.4934C15.983 11.1855 16.1788 11.1855 16.3746 11.287C16.5215 11.3884 16.6683 11.4899 16.7173 11.642C16.8152 11.8449 16.8152 12.0477 16.8152 12.5042V15.4965C16.8152 15.953 16.8152 16.2066 16.7173 16.3587C16.6194 16.5109 16.5215 16.663 16.3746 16.7137C16.1788 16.8152 15.983 16.8152 15.4934 16.8152H12.5073C12.0178 16.8152 11.8219 16.8152 11.6261 16.7137C11.4793 16.6123 11.3324 16.5109 11.2835 16.3587C11.1855 16.1558 11.1855 15.953 11.1855 15.4965V12.5042Z",fill:"#0052FF"}))}jr.CoinbaseWalletRound=wc;var xr={};Object.defineProperty(xr,"__esModule",{value:!0});xr.QRCodeIcon=void 0;const Mt=D.require$$1;function Ec(t){return(0,Mt.h)("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t),(0,Mt.h)("path",{d:"M3 3V8.99939L5 8.99996V5H9V3H3Z"}),(0,Mt.h)("path",{d:"M15 21L21 21V15.0006L19 15V19L15 19V21Z"}),(0,Mt.h)("path",{d:"M21 9H19V5H15.0006L15 3H21V9Z"}),(0,Mt.h)("path",{d:"M3 15V21H8.99939L8.99996 19H5L5 15H3Z"}))}xr.QRCodeIcon=Ec;var Br={};function qi(t){this.mode=he.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,r=this.data.length;e<r;e++){var n=[],s=this.data.charCodeAt(e);s>65536?(n[0]=240|(s&1835008)>>>18,n[1]=128|(s&258048)>>>12,n[2]=128|(s&4032)>>>6,n[3]=128|s&63):s>2048?(n[0]=224|(s&61440)>>>12,n[1]=128|(s&4032)>>>6,n[2]=128|s&63):s>128?(n[0]=192|(s&1984)>>>6,n[1]=128|s&63):n[0]=s,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}qi.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e<r;e++)t.put(this.parsedData[e],8)}};function Le(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}Le.prototype={addData:function(t){var e=new qi(t);this.dataList.push(e),this.dataCache=null},isDark:function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(t,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[r][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=Le.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[t+r][e+n]=!0:this.modules[t+r][e+n]=!1)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=V.getLostPoint(this);(r==0||t>n)&&(t=n,e=r)}return e},createMovieClip:function(t,e,r){var n=t.createEmptyMovieClip(e,r),s=1;this.make();for(var i=0;i<this.modules.length;i++)for(var o=i*s,a=0;a<this.modules[i].length;a++){var l=a*s,c=this.modules[i][a];c&&(n.beginFill(0,100),n.moveTo(l,o),n.lineTo(l+s,o),n.lineTo(l+s,o+s),n.lineTo(l,o+s),n.endFill())}return n},setupTimingPattern:function(){for(var t=8;t<this.moduleCount-8;t++)this.modules[t][6]==null&&(this.modules[t][6]=t%2==0);for(var e=8;e<this.moduleCount-8;e++)this.modules[6][e]==null&&(this.modules[6][e]=e%2==0)},setupPositionAdjustPattern:function(){for(var t=V.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var r=0;r<t.length;r++){var n=t[e],s=t[r];if(this.modules[n][s]==null)for(var i=-2;i<=2;i++)for(var o=-2;o<=2;o++)i==-2||i==2||o==-2||o==2||i==0&&o==0?this.modules[n+i][s+o]=!0:this.modules[n+i][s+o]=!1}},setupTypeNumber:function(t){for(var e=V.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var n=!t&&(e>>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!t&&(e>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,n=V.getBCHTypeInfo(r),s=0;s<15;s++){var i=!t&&(n>>s&1)==1;s<6?this.modules[s][8]=i:s<8?this.modules[s+1][8]=i:this.modules[this.moduleCount-15+s][8]=i}for(var s=0;s<15;s++){var i=!t&&(n>>s&1)==1;s<8?this.modules[8][this.moduleCount-s-1]=i:s<9?this.modules[8][15-s-1+1]=i:this.modules[8][15-s-1]=i}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,n=this.moduleCount-1,s=7,i=0,o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(var a=0;a<2;a++)if(this.modules[n][o-a]==null){var l=!1;i<t.length&&(l=(t[i]>>>s&1)==1);var c=V.getMask(e,n,o-a);c&&(l=!l),this.modules[n][o-a]=l,s--,s==-1&&(i++,s=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};Le.PAD0=236;Le.PAD1=17;Le.createData=function(t,e,r){for(var n=Me.getRSBlocks(t,e),s=new Ji,i=0;i<r.length;i++){var o=r[i];s.put(o.mode,4),s.put(o.getLength(),V.getLengthInBits(o.mode,t)),o.write(s)}for(var a=0,i=0;i<n.length;i++)a+=n[i].dataCount;if(s.getLengthInBits()>a*8)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+a*8+")");for(s.getLengthInBits()+4<=a*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=a*8||(s.put(Le.PAD0,8),s.getLengthInBits()>=a*8));)s.put(Le.PAD1,8);return Le.createBytes(s,n)};Le.createBytes=function(t,e){for(var r=0,n=0,s=0,i=new Array(e.length),o=new Array(e.length),a=0;a<e.length;a++){var l=e[a].dataCount,c=e[a].totalCount-l;n=Math.max(n,l),s=Math.max(s,c),i[a]=new Array(l);for(var u=0;u<i[a].length;u++)i[a][u]=255&t.buffer[u+r];r+=l;var d=V.getErrorCorrectPolynomial(c),h=new dt(i[a],d.getLength()-1),f=h.mod(d);o[a]=new Array(d.getLength()-1);for(var u=0;u<o[a].length;u++){var g=u+f.getLength()-o[a].length;o[a][u]=g>=0?f.get(g):0}}for(var y=0,u=0;u<e.length;u++)y+=e[u].totalCount;for(var w=new Array(y),S=0,u=0;u<n;u++)for(var a=0;a<e.length;a++)u<i[a].length&&(w[S++]=i[a][u]);for(var u=0;u<s;u++)for(var a=0;a<e.length;a++)u<o[a].length&&(w[S++]=o[a][u]);return w};var he={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},De={L:1,M:0,Q:3,H:2},xe={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},V={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var e=t<<10;V.getBCHDigit(e)-V.getBCHDigit(V.G15)>=0;)e^=V.G15<<V.getBCHDigit(e)-V.getBCHDigit(V.G15);return(t<<10|e)^V.G15_MASK},getBCHTypeNumber:function(t){for(var e=t<<12;V.getBCHDigit(e)-V.getBCHDigit(V.G18)>=0;)e^=V.G18<<V.getBCHDigit(e)-V.getBCHDigit(V.G18);return t<<12|e},getBCHDigit:function(t){for(var e=0;t!=0;)e++,t>>>=1;return e},getPatternPosition:function(t){return V.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case xe.PATTERN000:return(e+r)%2==0;case xe.PATTERN001:return e%2==0;case xe.PATTERN010:return r%3==0;case xe.PATTERN011:return(e+r)%3==0;case xe.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case xe.PATTERN101:return e*r%2+e*r%3==0;case xe.PATTERN110:return(e*r%2+e*r%3)%2==0;case xe.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new dt([1],0),r=0;r<t;r++)e=e.multiply(new dt([1,Y.gexp(r)],0));return e},getLengthInBits:function(t,e){if(1<=e&&e<10)switch(t){case he.MODE_NUMBER:return 10;case he.MODE_ALPHA_NUM:return 9;case he.MODE_8BIT_BYTE:return 8;case he.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(e<27)switch(t){case he.MODE_NUMBER:return 12;case he.MODE_ALPHA_NUM:return 11;case he.MODE_8BIT_BYTE:return 16;case he.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else if(e<41)switch(t){case he.MODE_NUMBER:return 14;case he.MODE_ALPHA_NUM:return 13;case he.MODE_8BIT_BYTE:return 16;case he.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}else throw new Error("type:"+e)},getLostPoint:function(t){for(var e=t.getModuleCount(),r=0,n=0;n<e;n++)for(var s=0;s<e;s++){for(var i=0,o=t.isDark(n,s),a=-1;a<=1;a++)if(!(n+a<0||e<=n+a))for(var l=-1;l<=1;l++)s+l<0||e<=s+l||a==0&&l==0||o==t.isDark(n+a,s+l)&&i++;i>5&&(r+=3+i-5)}for(var n=0;n<e-1;n++)for(var s=0;s<e-1;s++){var c=0;t.isDark(n,s)&&c++,t.isDark(n+1,s)&&c++,t.isDark(n,s+1)&&c++,t.isDark(n+1,s+1)&&c++,(c==0||c==4)&&(r+=3)}for(var n=0;n<e;n++)for(var s=0;s<e-6;s++)t.isDark(n,s)&&!t.isDark(n,s+1)&&t.isDark(n,s+2)&&t.isDark(n,s+3)&&t.isDark(n,s+4)&&!t.isDark(n,s+5)&&t.isDark(n,s+6)&&(r+=40);for(var s=0;s<e;s++)for(var n=0;n<e-6;n++)t.isDark(n,s)&&!t.isDark(n+1,s)&&t.isDark(n+2,s)&&t.isDark(n+3,s)&&t.isDark(n+4,s)&&!t.isDark(n+5,s)&&t.isDark(n+6,s)&&(r+=40);for(var u=0,s=0;s<e;s++)for(var n=0;n<e;n++)t.isDark(n,s)&&u++;var d=Math.abs(100*u/e/e-50)/5;return r+=d*10,r}},Y={glog:function(t){if(t<1)throw new Error("glog("+t+")");return Y.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return Y.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var te=0;te<8;te++)Y.EXP_TABLE[te]=1<<te;for(var te=8;te<256;te++)Y.EXP_TABLE[te]=Y.EXP_TABLE[te-4]^Y.EXP_TABLE[te-5]^Y.EXP_TABLE[te-6]^Y.EXP_TABLE[te-8];for(var te=0;te<255;te++)Y.LOG_TABLE[Y.EXP_TABLE[te]]=te;function dt(t,e){if(t.length==null)throw new Error(t.length+"/"+e);for(var r=0;r<t.length&&t[r]==0;)r++;this.num=new Array(t.length-r+e);for(var n=0;n<t.length-r;n++)this.num[n]=t[n+r]}dt.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var e=new Array(this.getLength()+t.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<t.getLength();n++)e[r+n]^=Y.gexp(Y.glog(this.get(r))+Y.glog(t.get(n)));return new dt(e,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=Y.glog(this.get(0))-Y.glog(t.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(var n=0;n<t.getLength();n++)r[n]^=Y.gexp(Y.glog(t.get(n))+e);return new dt(r,0).mod(t)}};function Me(t,e){this.totalCount=t,this.dataCount=e}Me.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];Me.getRSBlocks=function(t,e){var r=Me.getRsBlockTable(t,e);if(r==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var n=r.length/3,s=[],i=0;i<n;i++)for(var o=r[i*3+0],a=r[i*3+1],l=r[i*3+2],c=0;c<o;c++)s.push(new Me(a,l));return s};Me.getRsBlockTable=function(t,e){switch(e){case De.L:return Me.RS_BLOCK_TABLE[(t-1)*4+0];case De.M:return Me.RS_BLOCK_TABLE[(t-1)*4+1];case De.Q:return Me.RS_BLOCK_TABLE[(t-1)*4+2];case De.H:return Me.RS_BLOCK_TABLE[(t-1)*4+3];default:return}};function Ji(){this.buffer=[],this.length=0}Ji.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var gn=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function Zi(t){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof t=="string"&&(t={content:t}),t)for(var e in t)this.options[e]=t[e];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(l){switch(l){case"L":return De.L;case"M":return De.M;case"Q":return De.Q;case"H":return De.H;default:throw new Error("Unknwon error correction level: "+l)}}function n(l,c){for(var u=s(l),d=1,h=0,f=0,g=gn.length;f<=g;f++){var y=gn[f];if(!y)throw new Error("Content too long: expected "+h+" but got "+u);switch(c){case"L":h=y[0];break;case"M":h=y[1];break;case"Q":h=y[2];break;case"H":h=y[3];break;default:throw new Error("Unknwon error correction level: "+c)}if(u<=h)break;d++}if(d>gn.length)throw new Error("Content too long");return d}function s(l){var c=encodeURI(l).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return c.length+(c.length!=l?3:0)}var i=this.options.content,o=n(i,this.options.ecl),a=r(this.options.ecl);this.qrcode=new Le(o,a),this.qrcode.addData(i),this.qrcode.make()}Zi.prototype.svg=function(t){var e=this.options||{},r=this.qrcode.modules;typeof t>"u"&&(t={container:e.container||"svg"});for(var n=typeof e.pretty<"u"?!!e.pretty:!0,s=n?" ":"",i=n?`\r
2
+ `:"",o=e.width,a=e.height,l=r.length,c=o/(l+2*e.padding),u=a/(l+2*e.padding),d=typeof e.join<"u"?!!e.join:!1,h=typeof e.swap<"u"?!!e.swap:!1,f=typeof e.xmlDeclaration<"u"?!!e.xmlDeclaration:!0,g=typeof e.predefined<"u"?!!e.predefined:!1,y=g?s+'<defs><path id="qrmodule" d="M0 0 h'+u+" v"+c+' H0 z" style="fill:'+e.color+';shape-rendering:crispEdges;" /></defs>'+i:"",w=s+'<rect x="0" y="0" width="'+o+'" height="'+a+'" style="fill:'+e.background+';shape-rendering:crispEdges;"/>'+i,S="",C="",m=0;m<l;m++)for(var B=0;B<l;B++){var _=r[B][m];if(_){var M=B*c+e.padding*c,z=m*u+e.padding*u;if(h){var ne=M;M=z,z=ne}if(d){var le=c+M,K=u+z;M=Number.isInteger(M)?Number(M):M.toFixed(2),z=Number.isInteger(z)?Number(z):z.toFixed(2),le=Number.isInteger(le)?Number(le):le.toFixed(2),K=Number.isInteger(K)?Number(K):K.toFixed(2),C+="M"+M+","+z+" V"+K+" H"+le+" V"+z+" H"+M+" Z "}else g?S+=s+'<use x="'+M.toString()+'" y="'+z.toString()+'" href="#qrmodule" />'+i:S+=s+'<rect x="'+M.toString()+'" y="'+z.toString()+'" width="'+c+'" height="'+u+'" style="fill:'+e.color+';shape-rendering:crispEdges;"/>'+i}}d&&(S=s+'<path x="0" y="0" style="fill:'+e.color+';shape-rendering:crispEdges;" d="'+C+'" />');let ge="";if(this.options.image!==void 0&&this.options.image.svg){const sr=o*this.options.image.width/100,E=a*this.options.image.height/100,b=o/2-sr/2,I=a/2-E/2;ge+=`<svg x="${b}" y="${I}" width="${sr}" height="${E}" viewBox="0 0 100 100" preserveAspectRatio="xMinYMin meet">`,ge+=this.options.image.svg+i,ge+="</svg>"}var X="";switch(t.container){case"svg":f&&(X+='<?xml version="1.0" standalone="yes"?>'+i),X+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+o+'" height="'+a+'">'+i,X+=y+w+S,X+=ge,X+="</svg>";break;case"svg-viewbox":f&&(X+='<?xml version="1.0" standalone="yes"?>'+i),X+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 '+o+" "+a+'">'+i,X+=y+w+S,X+=ge,X+="</svg>";break;case"g":X+='<g width="'+o+'" height="'+a+'">'+i,X+=y+w+S,X+=ge,X+="</g>";break;default:X+=(y+w+S+ge).replace(/^\s+/,"");break}return X};var _c=Zi,vc=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Br,"__esModule",{value:!0});Br.QRCode=void 0;const Sc=D.require$$1,$s=D.require$$2,Cc=vc(_c),kc=t=>{const[e,r]=(0,$s.useState)("");return(0,$s.useEffect)(()=>{var n,s;const i=new Cc.default({content:t.content,background:t.bgColor||"#ffffff",color:t.fgColor||"#000000",container:"svg",ecl:"M",width:(n=t.width)!==null&&n!==void 0?n:256,height:(s=t.height)!==null&&s!==void 0?s:256,padding:0,image:t.image}),o=p.Buffer.from(i.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${o}`)},[t.bgColor,t.content,t.fgColor,t.height,t.image,t.width]),e?(0,Sc.h)("img",{src:e,alt:"QR Code"}):null};Br.QRCode=kc;var Fr={},Vn={};Object.defineProperty(Vn,"__esModule",{value:!0});Vn.default=".-cbwsdk-css-reset .-cbwsdk-spinner{display:inline-block}.-cbwsdk-css-reset .-cbwsdk-spinner svg{display:inline-block;animation:2s linear infinite -cbwsdk-spinner-svg}.-cbwsdk-css-reset .-cbwsdk-spinner svg circle{animation:1.9s ease-in-out infinite both -cbwsdk-spinner-circle;display:block;fill:rgba(0,0,0,0);stroke-dasharray:283;stroke-dashoffset:280;stroke-linecap:round;stroke-width:10px;transform-origin:50% 50%}@keyframes -cbwsdk-spinner-svg{0%{transform:rotateZ(0deg)}100%{transform:rotateZ(360deg)}}@keyframes -cbwsdk-spinner-circle{0%,25%{stroke-dashoffset:280;transform:rotate(0)}50%,75%{stroke-dashoffset:75;transform:rotate(45deg)}100%{stroke-dashoffset:280;transform:rotate(360deg)}}";var Rc=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.Spinner=void 0;const cr=D.require$$1,Ic=Rc(Vn),Ac=t=>{var e;const r=(e=t.size)!==null&&e!==void 0?e:64,n=t.color||"#000";return(0,cr.h)("div",{class:"-cbwsdk-spinner"},(0,cr.h)("style",null,Ic.default),(0,cr.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,cr.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};Fr.Spinner=Ac;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.default=".-cbwsdk-css-reset .-cbwsdk-connect-content{height:430px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-connect-content.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-header{display:flex;align-items:center;justify-content:space-between;margin:0 0 30px}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading{font-style:normal;font-weight:500;font-size:28px;line-height:36px;margin:0}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-layout{display:flex;flex-direction:row}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-left{margin-right:30px;display:flex;flex-direction:column;justify-content:space-between}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-right{flex:25%;margin-right:34px}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-wrapper{width:220px;height:220px;border-radius:12px;display:flex;justify-content:center;align-items:center;background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light{background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light>p{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark{background-color:rgba(10,11,13,.9)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark>p{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting>p{font-size:12px;font-weight:bold;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app{border-radius:8px;font-size:14px;line-height:20px;padding:12px;width:339px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.light{background:#eef0f3;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.dark{background:#1e2025;color:#8a919e}.-cbwsdk-css-reset .-cbwsdk-cancel-button{-webkit-appearance:none;border:none;background:none;cursor:pointer;padding:0;margin:0}.-cbwsdk-css-reset .-cbwsdk-cancel-button-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-wallet-steps{padding:0 0 0 16px;margin:0;width:100%;list-style:decimal}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item{list-style-type:decimal;display:list-item;font-style:normal;font-weight:400;font-size:16px;line-height:24px;margin-top:20px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item-wrapper{display:flex;align-items:center}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-pad-left{margin-left:6px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon{display:flex;border-radius:50%;height:24px;width:24px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.light{background:#0052ff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.dark{background:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item{align-items:center;display:flex;flex-direction:row;padding:16px 24px;gap:12px;cursor:pointer;border-radius:100px;font-weight:600}.-cbwsdk-css-reset .-cbwsdk-connect-item.light{background:#f5f8ff;color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-connect-item.dark{background:#001033;color:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item-copy-wrapper{margin:0 4px 0 8px}.-cbwsdk-css-reset .-cbwsdk-connect-item-title{margin:0 0 0;font-size:16px;line-height:24px;font-weight:500}.-cbwsdk-css-reset .-cbwsdk-connect-item-description{font-weight:400;font-size:14px;line-height:20px;margin:0}";var Qi=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bt,"__esModule",{value:!0});bt.CoinbaseWalletSteps=bt.ConnectContent=void 0;const Ke=Qi(D.require$$0),j=D.require$$1,Nc=v,Mc=St,Lc=Or,Tc=jr,$c=xr,Pc=Br,Oc=Fr,jc=Qi(Wn),pn={title:"Coinbase Wallet app",description:"Connect with your self-custody wallet",steps:Ki},xc=t=>t==="light"?"#FFFFFF":"#0A0B0D";function Bc(t){const{theme:e}=t,r=(0,Nc.createQrUrl)(t.sessionId,t.sessionSecret,t.linkAPIUrl,t.isParentConnection,t.version,t.chainId),n=pn.steps;return(0,j.h)("div",{"data-testid":"connect-content",className:(0,Ke.default)("-cbwsdk-connect-content",e)},(0,j.h)("style",null,jc.default),(0,j.h)("div",{className:"-cbwsdk-connect-content-header"},(0,j.h)("h2",{className:(0,Ke.default)("-cbwsdk-connect-content-heading",e)},"Scan to connect with our mobile app"),t.onCancel&&(0,j.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:t.onCancel},(0,j.h)(Lc.CloseIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,j.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,j.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,j.h)(Fc,{title:pn.title,description:pn.description,theme:e})),(0,j.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,j.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,j.h)(Pc.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,j.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:Mc.LIB_VERSION}),(0,j.h)("input",{type:"hidden",value:r})),(0,j.h)(n,{theme:e}),!t.isConnected&&(0,j.h)("div",{"data-testid":"connecting-spinner",className:(0,Ke.default)("-cbwsdk-connect-content-qr-connecting",e)},(0,j.h)(Oc.Spinner,{size:36,color:e==="dark"?"#FFF":"#000"}),(0,j.h)("p",null,"Connecting...")))))}bt.ConnectContent=Bc;function Fc({title:t,description:e,theme:r}){return(0,j.h)("div",{className:(0,Ke.default)("-cbwsdk-connect-item",r)},(0,j.h)("div",null,(0,j.h)(Tc.CoinbaseWalletRound,null)),(0,j.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,j.h)("h3",{className:"-cbwsdk-connect-item-title"},t),(0,j.h)("p",{className:"-cbwsdk-connect-item-description"},e)))}function Ki({theme:t}){return(0,j.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,j.h)("li",{className:(0,Ke.default)("-cbwsdk-wallet-steps-item",t)},(0,j.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,j.h)("li",{className:(0,Ke.default)("-cbwsdk-wallet-steps-item",t)},(0,j.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,j.h)("span",null,"Tap ",(0,j.h)("strong",null,"Scan")," "),(0,j.h)("span",{className:(0,Ke.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",t)},(0,j.h)($c.QRCodeIcon,{fill:xc(t)})))))}bt.CoinbaseWalletSteps=Ki;var Dr={},Hr={};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.ArrowLeftIcon=void 0;const Ps=D.require$$1;function Dc(t){return(0,Ps.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},t),(0,Ps.h)("path",{d:"M8.60675 0.155884L7.37816 1.28209L12.7723 7.16662H0V8.83328H12.6548L6.82149 14.6666L8 15.8451L15.8201 8.02501L8.60675 0.155884Z"}))}Hr.ArrowLeftIcon=Dc;var Ur={};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.LaptopIcon=void 0;const mn=D.require$$1;function Hc(t){return(0,mn.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},t),(0,mn.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,mn.h)("path",{d:"M13.4001 10.2002H0.600098C0.600098 11.0838 1.31644 11.8002 2.2001 11.8002H11.8001C12.6838 11.8002 13.4001 11.0838 13.4001 10.2002Z"}))}Ur.LaptopIcon=Hc;var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.SafeIcon=void 0;const Os=D.require$$1;function Uc(t){return(0,Os.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},t),(0,Os.h)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.600098 0.600098V11.8001H13.4001V0.600098H0.600098ZM7.0001 9.2001C5.3441 9.2001 4.0001 7.8561 4.0001 6.2001C4.0001 4.5441 5.3441 3.2001 7.0001 3.2001C8.6561 3.2001 10.0001 4.5441 10.0001 6.2001C10.0001 7.8561 8.6561 9.2001 7.0001 9.2001ZM0.600098 12.6001H3.8001V13.4001H0.600098V12.6001ZM10.2001 12.6001H13.4001V13.4001H10.2001V12.6001ZM8.8001 6.2001C8.8001 7.19421 7.99421 8.0001 7.0001 8.0001C6.00598 8.0001 5.2001 7.19421 5.2001 6.2001C5.2001 5.20598 6.00598 4.4001 7.0001 4.4001C7.99421 4.4001 8.8001 5.20598 8.8001 6.2001Z"}))}Vr.SafeIcon=Uc;var zn={};Object.defineProperty(zn,"__esModule",{value:!0});zn.default=".-cbwsdk-css-reset .-cbwsdk-try-extension{display:flex;margin-top:12px;height:202px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-try-extension.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-column-half{flex:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading{font-style:normal;font-weight:500;font-size:25px;line-height:32px;margin:0;max-width:204px}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta{appearance:none;border:none;background:none;color:#0052ff;cursor:pointer;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.light{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.dark{color:#588af5}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-wrapper{display:flex;align-items:center;margin-top:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-icon{display:block;margin-left:4px;height:14px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list{display:flex;flex-direction:column;justify-content:center;align-items:center;margin:0;padding:0;list-style:none;height:100%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item{display:flex;align-items:center;flex-flow:nowrap;margin-top:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item:first-of-type{margin-top:0}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon-wrapper{display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon{display:flex;height:32px;width:32px;border-radius:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.light{background:#eef0f3}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.dark{background:#1e2025}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy{display:block;font-weight:400;font-size:14px;line-height:20px;padding-left:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.light{color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.dark{color:#8a919e}";var Xi=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TryExtensionContent=void 0;const Ve=Xi(D.require$$0),J=D.require$$1,bn=D.require$$2,Vc=Hr,Wc=Ur,zc=Vr,Gc=Xi(zn);function qc({theme:t}){const[e,r]=(0,bn.useState)(!1),n=(0,bn.useCallback)(()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")},[]),s=(0,bn.useCallback)(()=>{e?window.location.reload():(n(),r(!0))},[n,e]);return(0,J.h)("div",{class:(0,Ve.default)("-cbwsdk-try-extension",t)},(0,J.h)("style",null,Gc.default),(0,J.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,J.h)("h3",{class:(0,Ve.default)("-cbwsdk-try-extension-heading",t)},"Or try the Coinbase Wallet browser extension"),(0,J.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,J.h)("button",{class:(0,Ve.default)("-cbwsdk-try-extension-cta",t),onClick:s},e?"Refresh":"Install"),(0,J.h)("div",null,!e&&(0,J.h)(Vc.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:t==="light"?"#0052FF":"#588AF5"})))),(0,J.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,J.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,J.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,J.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,J.h)("span",{class:(0,Ve.default)("-cbwsdk-try-extension-list-item-icon",t)},(0,J.h)(Wc.LaptopIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,J.h)("div",{class:(0,Ve.default)("-cbwsdk-try-extension-list-item-copy",t)},"Connect with dapps with just one click on your desktop browser")),(0,J.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,J.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,J.h)("span",{class:(0,Ve.default)("-cbwsdk-try-extension-list-item-icon",t)},(0,J.h)(zc.SafeIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,J.h)("div",{class:(0,Ve.default)("-cbwsdk-try-extension-list-item-copy",t)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))}Dr.TryExtensionContent=qc;var Gn={};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.default=".-cbwsdk-css-reset .-cbwsdk-connect-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.light{background-color:rgba(0,0,0,.5)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.dark{background-color:rgba(50,53,61,.4)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box{display:flex;position:relative;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container-hidden{display:none}";var Yi=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.ConnectDialog=void 0;const yn=Yi(D.require$$0),We=D.require$$1,wn=D.require$$2,Jc=bt,Zc=Dr,Qc=Yi(Gn),Kc=t=>{const{isOpen:e,darkMode:r}=t,[n,s]=(0,wn.useState)(!e),[i,o]=(0,wn.useState)(!e);(0,wn.useEffect)(()=>{const l=[window.setTimeout(()=>{o(!e)},10)];return e?s(!1):l.push(window.setTimeout(()=>{s(!0)},360)),()=>{l.forEach(window.clearTimeout)}},[e]);const a=r?"dark":"light";return(0,We.h)("div",{class:(0,yn.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,We.h)("style",null,Qc.default),(0,We.h)("div",{class:(0,yn.default)("-cbwsdk-connect-dialog-backdrop",a,i&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,We.h)("div",{class:"-cbwsdk-connect-dialog"},(0,We.h)("div",{class:(0,yn.default)("-cbwsdk-connect-dialog-box",i&&"-cbwsdk-connect-dialog-box-hidden")},t.connectDisabled?null:(0,We.h)(Jc.ConnectContent,{theme:a,version:t.version,sessionId:t.sessionId,sessionSecret:t.sessionSecret,linkAPIUrl:t.linkAPIUrl,isConnected:t.isConnected,isParentConnection:t.isParentConnection,chainId:t.chainId,onCancel:t.onCancel}),(0,We.h)(Zc.TryExtensionContent,{theme:a}))))};Pr.ConnectDialog=Kc;Object.defineProperty($r,"__esModule",{value:!0});$r.LinkFlow=void 0;const En=D.require$$1,Xc=Pr;class Yc{constructor(e){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=e.darkMode,this.version=e.version,this.sessionId=e.sessionId,this.sessionSecret=e.sessionSecret,this.linkAPIUrl=e.linkAPIUrl,this.isParentConnection=e.isParentConnection}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",e.appendChild(this.root),this.render()}setConnected(e){this.connected!==e&&(this.connected=e,this.render())}setChainId(e){this.chainId!==e&&(this.chainId=e,this.render())}detach(){var e;this.root&&((0,En.render)(null,this.root),(e=this.root.parentElement)===null||e===void 0||e.removeChild(this.root))}setConnectDisabled(e){this.connectDisabled=e}open(e){this.isOpen=!0,this.onCancel=e.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,En.render)((0,En.h)(Xc.ConnectDialog,{darkMode:this.darkMode,version:this.version,sessionId:this.sessionId,sessionSecret:this.sessionSecret,linkAPIUrl:this.linkAPIUrl,isOpen:this.isOpen,isConnected:this.connected,isParentConnection:this.isParentConnection,chainId:this.chainId,onCancel:this.onCancel,connectDisabled:this.connectDisabled}),this.root)}}$r.LinkFlow=Yc;var qn={},Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.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 e=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const r=e(D.require$$0),n=D.require$$1,s=D.require$$2,i=e(Jn),o="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",a="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class l{constructor(h){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=h.darkMode}attach(h){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",h.appendChild(this.root),this.render()}presentItem(h){const f=this.nextItemKey++;return this.items.set(f,h),this.render(),()=>{this.items.delete(f),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,n.render)((0,n.h)("div",null,(0,n.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([h,f])=>(0,n.h)(t.SnackbarInstance,Object.assign({},f,{key:h}))))),this.root)}}t.Snackbar=l;const c=d=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,n.h)("style",null,i.default),(0,n.h)("div",{class:"-cbwsdk-snackbar"},d.children));t.SnackbarContainer=c;const u=({autoExpand:d,message:h,menuItems:f})=>{const[g,y]=(0,s.useState)(!0),[w,S]=(0,s.useState)(d??!1);(0,s.useEffect)(()=>{const m=[window.setTimeout(()=>{y(!1)},1),window.setTimeout(()=>{S(!0)},1e4)];return()=>{m.forEach(window.clearTimeout)}});const C=()=>{S(!w)};return(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",g&&"-cbwsdk-snackbar-instance-hidden",w&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:C},(0,n.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},h),(0,n.h)("div",{class:"-gear-container"},!w&&(0,n.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,n.h)("img",{src:a,class:"-gear-icon",title:"Expand"}))),f&&f.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},f.map((m,B)=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",m.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:m.onClick,key:B},(0,n.h)("svg",{width:m.svgWidth,height:m.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":m.defaultFillRule,"clip-rule":m.defaultClipRule,d:m.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",m.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},m.info)))))};t.SnackbarInstance=u})(qn);Object.defineProperty(Wt,"__esModule",{value:!0});Wt.WalletLinkRelayUI=void 0;const el=zt,tl=$r,rl=qn;class nl{constructor(e){this.standalone=null,this.attached=!1,this.snackbar=new rl.Snackbar({darkMode:e.darkMode}),this.linkFlow=new tl.LinkFlow({darkMode:e.darkMode,version:e.version,sessionId:e.session.id,sessionSecret:e.session.secret,linkAPIUrl:e.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.linkFlow.attach(r),this.snackbar.attach(r),this.attached=!0,(0,el.injectCssReset)()}setConnected(e){this.linkFlow.setConnected(e)}setChainId(e){this.linkFlow.setChainId(e)}setConnectDisabled(e){this.linkFlow.setConnectDisabled(e)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(e){this.linkFlow.open({onCancel:e.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(e){let r;return e.isUnlinkedErrorState?r={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}]}:r={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(r)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(e){this.standalone=e}isStandalone(){var e;return(e=this.standalone)!==null&&e!==void 0?e:!1}}Wt.WalletLinkRelayUI=nl;Object.defineProperty(Vt,"__esModule",{value:!0});Vt.WalletLinkRelay=void 0;const ot=Bt,sl=Z,U=v,ze=Ct,js=ye,Be=kt,il=Mr,Ge=vt,ol=Wt;class Oe extends js.RelayAbstract{constructor(e){var r;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=o=>{var a;this.isLinked=o;const l=this.storage.getItem(js.LOCAL_STORAGE_ADDRESSES_KEY);if(o&&(this.session.linked=o),this.isUnlinkedErrorState=!1,l){const c=l.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";if(c[0]!==""&&!o&&this.session.linked&&!u){this.isUnlinkedErrorState=!0;const d=this.getSessionIdHash();(a=this.diagnostic)===null||a===void 0||a.log(ze.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:d})}}},this.metadataUpdated=(o,a)=>{this.storage.setItem(o,a)},this.chainUpdated=(o,a)=>{this.chainCallbackParams.chainId===o&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:o,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(o,a))},this.accountUpdated=o=>{this.accountsCallback&&this.accountsCallback([o]),Oe.accountRequestCallbackIds.size>0&&(Array.from(Oe.accountRequestCallbackIds.values()).forEach(a=>{const l={type:"WEB3_RESPONSE",id:a,response:{method:"requestEthereumAccounts",result:[o]}};this.invokeCallback(Object.assign(Object.assign({},l),{id:a}))}),Oe.accountRequestCallbackIds.clear())},this.connectedUpdated=o=>{this.ui.setConnected(o)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.options=e;const{session:n,ui:s,connection:i}=this.subscribe();this._session=n,this.connection=i,this.relayEventManager=e.relayEventManager,this.diagnostic=e.diagnosticLogger,this._reloadOnDisconnect=(r=e.reloadOnDisconnect)!==null&&r!==void 0?r:!0,this.ui=s}subscribe(){const e=Be.Session.load(this.storage)||new Be.Session(this.storage).save(),{linkAPIUrl:r,diagnostic:n}=this,s=new il.WalletLinkConnection({session:e,linkAPIUrl:r,diagnostic:n,listener:this}),{version:i,darkMode:o}=this.options,a=this.options.uiConstructor({linkAPIUrl:r,version:i,darkMode:o,session:e});return s.connect(),{session:e,ui:a,connection:s}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(e=>setTimeout(()=>e(null),1e3))]).then(()=>{var e,r;const n=this.ui.isStandalone();(e=this.diagnostic)===null||e===void 0||e.log(ze.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const s=Be.Session.load(this.storage);if((s==null?void 0:s.id)===this._session.id?this.storage.clear():s&&((r=this.diagnostic)===null||r===void 0||r.log(ze.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:Be.Session.hash(s.id)})),this._reloadOnDisconnect){this.ui.reloadUI();return}this.accountsCallback&&this.accountsCallback([],!0);const{session:i,ui:o,connection:a}=this.subscribe();this._session=i,this.connection=a,this.ui=o,n&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()}).catch(e=>{var r;(r=this.diagnostic)===null||r===void 0||r.log(ze.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${e}`,sessionIdHash:this.getSessionIdHash()})})}setAppInfo(e,r){this.appName=e,this.appLogoUrl=r}getStorageItem(e){return this.storage.getItem(e)}get session(){return this._session}setStorageItem(e,r){this.storage.setItem(e,r)}signEthereumMessage(e,r,n,s){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,U.hexStringFromBuffer)(e,!0),address:r,addPrefix:n,typedDataJson:s||null}})}ethereumAddressFromSignedMessage(e,r,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,U.hexStringFromBuffer)(e,!0),signature:(0,U.hexStringFromBuffer)(r,!0),addPrefix:n}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,U.bigIntStringFromBN)(e.weiValue),data:(0,U.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,U.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,U.bigIntStringFromBN)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,U.bigIntStringFromBN)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,U.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,U.bigIntStringFromBN)(e.weiValue),data:(0,U.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,U.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,U.bigIntStringFromBN)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,U.bigIntStringFromBN)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,U.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,U.hexStringFromBuffer)(e,!0),chainId:r}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getQRCodeUrl(){return(0,U.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(e,r){return this.sendRequest({method:"generic",params:{action:r,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let r=null;const n=(0,U.randomBytesHex)(8),s=o=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,o),r==null||r()};return{promise:new Promise((o,a)=>{this.ui.isStandalone()||(r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(n,l=>{if(r==null||r(),(0,Ge.isErrorResponse)(l))return a(new Error(l.errorMessage));o(l)}),this.ui.isStandalone()?this.sendRequestStandalone(n,e):this.publishWeb3RequestEvent(n,e)}),cancel:s}}setConnectDisabled(e){this.ui.setConnectDisabled(e)}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e,this.ui instanceof ol.WalletLinkRelayUI&&this.ui.setChainId(e)}publishWeb3RequestEvent(e,r){var n;const s={type:"WEB3_REQUEST",id:e,request:r},i=Be.Session.load(this.storage);(n=this.diagnostic)===null||n===void 0||n.log(ze.EVENTS.WEB3_REQUEST,{eventId:s.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:i?Be.Session.hash(i.id):"",isSessionMismatched:((i==null?void 0:i.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",s,!0).then(o=>{var a;(a=this.diagnostic)===null||a===void 0||a.log(ze.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:s.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:i?Be.Session.hash(i.id):"",isSessionMismatched:((i==null?void 0:i.id)!==this._session.id).toString()})}).catch(o=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:s.id,response:{method:r.method,errorMessage:o.message}})})}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e){var r;const{response:n}=e;if((r=this.diagnostic)===null||r===void 0||r.log(ze.EVENTS.WEB3_RESPONSE,{eventId:e.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash()}),n.method==="requestEthereumAccounts"){Oe.accountRequestCallbackIds.forEach(s=>this.invokeCallback(Object.assign(Object.assign({},e),{id:s}))),Oe.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,r,n,s){var i;const o=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:(0,ot.getMessageFromCode)(s);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:r,errorMessage:o,errorCode:s}})}invokeCallback(e){const r=this.relayEventManager.callbacks.get(e.id);r&&(r(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},r=(0,U.randomBytesHex)(8),n=i=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,i)};return{promise:new Promise((i,o)=>{if(this.relayEventManager.callbacks.set(r,a=>{if(this.ui.hideRequestEthereumAccounts(),(0,Ge.isErrorResponse)(a))return o(new Error(a.errorMessage));i(a)}),this.ui.inlineAccountsResponse()){const a=l=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"requestEthereumAccounts",result:l}})};this.ui.requestEthereumAccounts({onCancel:n,onAccounts:a})}else{const a=ot.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>n(a)})}Oe.accountRequestCallbackIds.add(r),!this.ui.inlineAccountsResponse()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(r,e)}),cancel:n}}selectProvider(e){const r={method:"selectProvider",params:{providerOptions:e}},n=(0,U.randomBytesHex)(8),s=o=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,o)},i=new Promise((o,a)=>{this.relayEventManager.callbacks.set(n,u=>{if((0,Ge.isErrorResponse)(u))return a(new Error(u.errorMessage));o(u)});const l=u=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:sl.ProviderType.Unselected}})},c=u=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:u}})};this.ui.selectProvider&&this.ui.selectProvider({onApprove:c,onCancel:l,providerOptions:e})});return{cancel:s,promise:i}}watchAsset(e,r,n,s,i,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:s,image:i},chainId:o}};let l=null;const c=(0,U.randomBytesHex)(8),u=h=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,h),l==null||l()};this.ui.inlineWatchAsset()||(l=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:u,onResetConnection:this.resetAndReload}));const d=new Promise((h,f)=>{this.relayEventManager.callbacks.set(c,w=>{if(l==null||l(),(0,Ge.isErrorResponse)(w))return f(new Error(w.errorMessage));h(w)});const g=w=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"watchAsset",result:!1}})},y=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:y,onCancel:g,type:e,address:r,symbol:n,decimals:s,image:i,chainId:o}),!this.ui.inlineWatchAsset()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(c,a)});return{cancel:u,promise:d}}addEthereumChain(e,r,n,s,i,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:s,chainName:i,iconUrls:n,nativeCurrency:o}};let l=null;const c=(0,U.randomBytesHex)(8),u=h=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,h),l==null||l()};return this.ui.inlineAddEthereumChain(e)||(l=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:u,onResetConnection:this.resetAndReload})),{promise:new Promise((h,f)=>{this.relayEventManager.callbacks.set(c,w=>{if(l==null||l(),(0,Ge.isErrorResponse)(w))return f(new Error(w.errorMessage));h(w)});const g=w=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},y=w=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:w}}})};this.ui.inlineAddEthereumChain(e)&&this.ui.addEthereumChain({onCancel:g,onApprove:y,chainId:a.params.chainId,rpcUrls:a.params.rpcUrls,blockExplorerUrls:a.params.blockExplorerUrls,chainName:a.params.chainName,iconUrls:a.params.iconUrls,nativeCurrency:a.params.nativeCurrency}),!this.ui.inlineAddEthereumChain(e)&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(c,a)}),cancel:u}}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})},s=(0,U.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a)};return{promise:new Promise((a,l)=>{this.relayEventManager.callbacks.set(s,d=>{if((0,Ge.isErrorResponse)(d)&&d.errorCode)return l(ot.standardErrors.provider.custom({code:d.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Ge.isErrorResponse)(d))return l(new Error(d.errorMessage));a(d)});const c=d=>{var h;if(d){const f=(h=(0,ot.getErrorCode)(d))!==null&&h!==void 0?h:ot.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(s,"switchEthereumChain",d instanceof Error?d:ot.standardErrors.provider.unsupportedChain(e),f)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:s,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},u=d=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:s,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:d}}})};this.ui.switchEthereumChain({onCancel:c,onApprove:u,chainId:n.params.chainId,address:n.params.address}),!this.ui.inlineSwitchEthereumChain()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(s,n)}),cancel:i}}inlineAddEthereumChain(e){return this.ui.inlineAddEthereumChain(e)}getSessionIdHash(){return Be.Session.hash(this._session.id)}sendRequestStandalone(e,r){const n=i=>{this.handleErrorResponse(e,r.method,i)},s=i=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:i})};switch(r.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:r,onSuccess:s,onCancel:n});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:r,onSuccess:s,onCancel:n});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:r,onSuccess:s,onCancel:n});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:r,onSuccess:s});break;default:n();break}}}Vt.WalletLinkRelay=Oe;Oe.accountRequestCallbackIds=new Set;var Gt={},Wr={},eo={};(function(t){var e=p.commonjsGlobal&&p.commonjsGlobal.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i);var a=Object.getOwnPropertyDescriptor(s,i);(!a||("get"in a?!s.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,o,a)}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=p.commonjsGlobal&&p.commonjsGlobal.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(qn,t)})(eo);var Zn={};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.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 to=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.RedirectDialog=void 0;const al=to(D.require$$0),Ne=D.require$$1,cl=zt,ll=eo,ul=to(Zn);class dl{constructor(){this.root=null}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,cl.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,Ne.render)(null,this.root),e&&(0,Ne.render)((0,Ne.h)(hl,Object.assign({},e,{onDismiss:()=>{this.clear()}})),this.root))}}Wr.RedirectDialog=dl;const hl=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:s})=>{const i=r?"dark":"light";return(0,Ne.h)(ll.SnackbarContainer,{darkMode:r},(0,Ne.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Ne.h)("style",null,ul.default),(0,Ne.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,Ne.h)("div",{class:(0,al.default)("-cbwsdk-redirect-dialog-box",i)},(0,Ne.h)("p",null,t),(0,Ne.h)("button",{onClick:n},e))))};Object.defineProperty(Gt,"__esModule",{value:!0});Gt.MobileRelayUI=void 0;const fl=Wr;class gl{constructor(e){this.attached=!1,this.darkMode=!1,this.redirectDialog=new fl.RedirectDialog,this.darkMode=e.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(e){}redirectToCoinbaseWallet(e){const r=new URL("https://go.cb-w.com/walletlink");r.searchParams.append("redirect_url",window.location.href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}}Gt.MobileRelayUI=gl;Object.defineProperty(Ut,"__esModule",{value:!0});Ut.MobileRelay=void 0;const pl=v,ml=Vt,bl=Gt;class yl extends ml.WalletLinkRelay{constructor(e){var r;super(e),this._enableMobileWalletLink=(r=e.enableMobileWalletLink)!==null&&r!==void 0?r:!1}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise(()=>{const e=(0,pl.getLocation)();e.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(e.href)}`}),cancel:()=>{}}}publishWeb3RequestEvent(e,r){if(super.publishWeb3RequestEvent(e,r),!(this._enableMobileWalletLink&&this.ui instanceof bl.MobileRelayUI))return;let n=!1;switch(r.method){case"requestEthereumAccounts":case"connectAndSignIn":n=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:n=!0,this.ui.openCoinbaseWalletDeeplink();break}n&&window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0})}handleWeb3ResponseMessage(e){super.handleWeb3ResponseMessage(e)}connectAndSignIn(e){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:e.nonce,iat:new Date().toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:e.statement,resources:e.resources}})}}Ut.MobileRelay=yl;const wl=D.js,El=p.bnExports;function ro(t){return p.Buffer.allocUnsafe(t).fill(0)}function no(t,e,r){const n=ro(e);return t=zr(t),r?t.length<e?(t.copy(n),n):t.slice(0,e):t.length<e?(t.copy(n,e-t.length),n):t.slice(-e)}function _l(t,e){return no(t,e,!0)}function zr(t){if(!p.Buffer.isBuffer(t))if(Array.isArray(t))t=p.Buffer.from(t);else if(typeof t=="string")so(t)?t=p.Buffer.from(Cl(io(t)),"hex"):t=p.Buffer.from(t);else if(typeof t=="number")t=intToBuffer(t);else if(t==null)t=p.Buffer.allocUnsafe(0);else if(El.isBN(t))t=t.toArrayLike(p.Buffer);else if(t.toArray)t=p.Buffer.from(t.toArray());else throw new Error("invalid type");return t}function vl(t){return t=zr(t),"0x"+t.toString("hex")}function Sl(t,e){return t=zr(t),e||(e=256),wl("keccak"+e).update(t).digest()}function Cl(t){return t.length%2?"0"+t:t}function so(t){return typeof t=="string"&&t.match(/^0x[0-9A-Fa-f]*$/)}function io(t){return typeof t=="string"&&t.startsWith("0x")?t.slice(2):t}var oo={zeros:ro,setLength:no,setLengthRight:_l,isHexString:so,stripHexPrefix:io,toBuffer:zr,bufferToHex:vl,keccak:Sl};const Xe=oo,Ze=p.bnExports;function ao(t){return t.startsWith("int[")?"int256"+t.slice(3):t==="int"?"int256":t.startsWith("uint[")?"uint256"+t.slice(4):t==="uint"?"uint256":t.startsWith("fixed[")?"fixed128x128"+t.slice(5):t==="fixed"?"fixed128x128":t.startsWith("ufixed[")?"ufixed128x128"+t.slice(6):t==="ufixed"?"ufixed128x128":t}function ht(t){return parseInt(/^\D+(\d+)$/.exec(t)[1],10)}function xs(t){var e=/^\D+(\d+)x(\d+)$/.exec(t);return[parseInt(e[1],10),parseInt(e[2],10)]}function co(t){var e=t.match(/(.*)\[(.*?)\]$/);return e?e[2]===""?"dynamic":parseInt(e[2],10):null}function qe(t){var e=typeof t;if(e==="string")return Xe.isHexString(t)?new Ze(Xe.stripHexPrefix(t),16):new Ze(t,10);if(e==="number")return new Ze(t);if(t.toArray)return t;throw new Error("Argument is not a number")}function Ae(t,e){var r,n,s,i;if(t==="address")return Ae("uint160",qe(e));if(t==="bool")return Ae("uint8",e?1:0);if(t==="string")return Ae("bytes",new p.Buffer(e,"utf8"));if(Rl(t)){if(typeof e.length>"u")throw new Error("Not an array?");if(r=co(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);s=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(i in e)s.push(Ae(t,e[i]));if(r==="dynamic"){var o=Ae("uint256",e.length);s.unshift(o)}return p.Buffer.concat(s)}else{if(t==="bytes")return e=new p.Buffer(e),s=p.Buffer.concat([Ae("uint256",e.length),e]),e.length%32!==0&&(s=p.Buffer.concat([s,Xe.zeros(32-e.length%32)])),s;if(t.startsWith("bytes")){if(r=ht(t),r<1||r>32)throw new Error("Invalid bytes<N> width: "+r);return Xe.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=ht(t),r%8||r<8||r>256)throw new Error("Invalid uint<N> width: "+r);if(n=qe(e),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(p.Buffer,"be",32)}else if(t.startsWith("int")){if(r=ht(t),r%8||r<8||r>256)throw new Error("Invalid int<N> width: "+r);if(n=qe(e),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(p.Buffer,"be",32)}else if(t.startsWith("ufixed")){if(r=xs(t),n=qe(e),n<0)throw new Error("Supplied ufixed is negative");return Ae("uint256",n.mul(new Ze(2).pow(new Ze(r[1]))))}else if(t.startsWith("fixed"))return r=xs(t),Ae("int256",qe(e).mul(new Ze(2).pow(new Ze(r[1]))))}throw new Error("Unsupported or invalid type: "+t)}function kl(t){return t==="string"||t==="bytes"||co(t)==="dynamic"}function Rl(t){return t.lastIndexOf("]")===t.length-1}function Il(t,e){var r=[],n=[],s=32*t.length;for(var i in t){var o=ao(t[i]),a=e[i],l=Ae(o,a);kl(o)?(r.push(Ae("uint256",s)),n.push(l),s+=l.length):r.push(l)}return p.Buffer.concat(r.concat(n))}function lo(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,s=[],i=0;i<t.length;i++){var o=ao(t[i]),a=e[i];if(o==="bytes")s.push(a);else if(o==="string")s.push(new p.Buffer(a,"utf8"));else if(o==="bool")s.push(new p.Buffer(a?"01":"00","hex"));else if(o==="address")s.push(Xe.setLength(a,20));else if(o.startsWith("bytes")){if(r=ht(o),r<1||r>32)throw new Error("Invalid bytes<N> width: "+r);s.push(Xe.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=ht(o),r%8||r<8||r>256)throw new Error("Invalid uint<N> width: "+r);if(n=qe(a),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());s.push(n.toArrayLike(p.Buffer,"be",r/8))}else if(o.startsWith("int")){if(r=ht(o),r%8||r<8||r>256)throw new Error("Invalid int<N> width: "+r);if(n=qe(a),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());s.push(n.toTwos(r).toArrayLike(p.Buffer,"be",r/8))}else throw new Error("Unsupported or invalid type: "+o)}return p.Buffer.concat(s)}function Al(t,e){return Xe.keccak(lo(t,e))}var Nl={rawEncode:Il,solidityPack:lo,soliditySHA3:Al};const ve=oo,Pt=Nl,uo={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"]},_n={encodeData(t,e,r,n=!0){const s=["bytes32"],i=[this.hashType(t,r)];if(n){const o=(a,l,c)=>{if(r[l]!==void 0)return["bytes32",c==null?"0x0000000000000000000000000000000000000000000000000000000000000000":ve.keccak(this.encodeData(l,c,r,n))];if(c===void 0)throw new Error(`missing value for field ${a} of type ${l}`);if(l==="bytes")return["bytes32",ve.keccak(c)];if(l==="string")return typeof c=="string"&&(c=p.Buffer.from(c,"utf8")),["bytes32",ve.keccak(c)];if(l.lastIndexOf("]")===l.length-1){const u=l.slice(0,l.lastIndexOf("[")),d=c.map(h=>o(a,u,h));return["bytes32",ve.keccak(Pt.rawEncode(d.map(([h])=>h),d.map(([,h])=>h)))]}return[l,c]};for(const a of r[t]){const[l,c]=o(a.name,a.type,e[a.name]);s.push(l),i.push(c)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")s.push("bytes32"),a=ve.keccak(a),i.push(a);else if(o.type==="string")s.push("bytes32"),typeof a=="string"&&(a=p.Buffer.from(a,"utf8")),a=ve.keccak(a),i.push(a);else if(r[o.type]!==void 0)s.push("bytes32"),a=ve.keccak(this.encodeData(o.type,a,r,n)),i.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(o.type),i.push(a)}}return Pt.rawEncode(s,i)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(s=>s!==t);n=[t].concat(n.sort());for(const s of n){if(!e[s])throw new Error("No type definition specified: "+s);r+=s+"("+e[s].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const s of this.findTypeDependencies(n.type,e,r))!r.includes(s)&&r.push(s);return r},hashStruct(t,e,r,n=!0){return ve.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return ve.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in uo.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[p.Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),ve.keccak(p.Buffer.concat(n))}};var Ml={TYPED_MESSAGE_SCHEMA:uo,TypedDataUtils:_n,hashForSignTypedDataLegacy:function(t){return Ll(t.data)},hashForSignTypedData_v3:function(t){return _n.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return _n.hash(t.data)}};function Ll(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(i){return i.type==="bytes"?ve.toBuffer(i.value):i.value}),n=t.map(function(i){return i.type}),s=t.map(function(i){if(!i.name)throw e;return i.type+" "+i.name});return Pt.soliditySHA3(["bytes32","bytes32"],[Pt.soliditySHA3(new Array(t.length).fill("string"),s),Pt.soliditySHA3(n,r)])}var yt={};Object.defineProperty(yt,"__esModule",{value:!0});yt.filterFromParam=yt.FilterPolyfill=void 0;const lt=Z,ie=v,Tl=5*60*1e3,Je={jsonrpc:"2.0",id:0};class $l{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,lt.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=e}async newFilter(e){const r=ho(e),n=this.makeFilterId(),s=await this.setInitialCursorPosition(n,r.fromBlock);return console.info(`Installing new log filter(${n}):`,r,"initial cursor position:",s),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,ie.hexStringFromIntNumber)(n)}async newBlockFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,r),this.blockFilters.add(e),this.setFilterTimeout(e),(0,ie.hexStringFromIntNumber)(e)}async newPendingTransactionFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,r),this.pendingTransactionFilters.add(e),this.setFilterTimeout(e),(0,ie.hexStringFromIntNumber)(e)}uninstallFilter(e){const r=(0,ie.intNumberFromHexString)(e);return console.info(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(e){const r=(0,ie.intNumberFromHexString)(e);return this.timeouts.has(r)&&this.setFilterTimeout(r),this.logFilters.has(r)?this.getLogFilterChanges(r):this.blockFilters.has(r)?this.getBlockFilterChanges(r):this.pendingTransactionFilters.has(r)?this.getPendingTransactionFilterChanges(r):Promise.resolve(lr())}async getFilterLogs(e){const r=(0,ie.intNumberFromHexString)(e),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},Je),{method:"eth_getLogs",params:[Bs(n)]})):lr()}makeFilterId(){return(0,lt.IntNumber)(++this.nextFilterId)}sendAsyncPromise(e){return new Promise((r,n)=>{this.provider.sendAsync(e,(s,i)=>{if(s)return n(s);if(Array.isArray(i)||i==null)return n(new Error(`unexpected response received: ${JSON.stringify(i)}`));r(i)})})}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 r=this.logFilters.get(e),n=this.cursors.get(e);if(!n||!r)return lr();const s=await this.getCurrentBlockHeight(),i=r.toBlock==="latest"?s:r.toBlock;if(n>s||n>Number(r.toBlock))return ur();console.info(`Fetching logs from ${n} to ${i} for filter ${e}`);const o=await this.sendAsyncPromise(Object.assign(Object.assign({},Je),{method:"eth_getLogs",params:[Bs(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:i}))]}));if(Array.isArray(o.result)){const a=o.result.map(c=>(0,ie.intNumberFromHexString)(c.blockNumber||"0x0")),l=Math.max(...a);if(l&&l>n){const c=(0,lt.IntNumber)(l+1);console.info(`Moving cursor position for filter (${e}) from ${n} to ${c}`),this.cursors.set(e,c)}}return o}async getBlockFilterChanges(e){const r=this.cursors.get(e);if(!r)return lr();const n=await this.getCurrentBlockHeight();if(r>n)return ur();console.info(`Fetching blocks from ${r} to ${n} for filter (${e})`);const s=(await Promise.all((0,ie.range)(r,n+1).map(o=>this.getBlockHashByNumber((0,lt.IntNumber)(o))))).filter(o=>!!o),i=(0,lt.IntNumber)(r+s.length);return console.info(`Moving cursor position for filter (${e}) from ${r} to ${i}`),this.cursors.set(e,i),Object.assign(Object.assign({},Je),{result:s})}async getPendingTransactionFilterChanges(e){return Promise.resolve(ur())}async setInitialCursorPosition(e,r){const n=await this.getCurrentBlockHeight(),s=typeof r=="number"&&r>n?r:n;return this.cursors.set(e,s),s}setFilterTimeout(e){const r=this.timeouts.get(e);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.info(`Filter (${e}) timed out`),this.deleteFilter(e)},Tl);this.timeouts.set(e,n)}async getCurrentBlockHeight(){const e=new Date;if(e.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=e;const r=await this._getCurrentBlockHeight();this.currentBlockHeight=r,this.resolvers.forEach(n=>n(r)),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise(r=>this.resolvers.push(r))}async _getCurrentBlockHeight(){const{result:e}=await this.sendAsyncPromise(Object.assign(Object.assign({},Je),{method:"eth_blockNumber",params:[]}));return(0,ie.intNumberFromHexString)((0,ie.ensureHexString)(e))}async getBlockHashByNumber(e){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},Je),{method:"eth_getBlockByNumber",params:[(0,ie.hexStringFromIntNumber)(e),!1]}));return r.result&&typeof r.result.hash=="string"?(0,ie.ensureHexString)(r.result.hash):null}}yt.FilterPolyfill=$l;function ho(t){return{fromBlock:Fs(t.fromBlock),toBlock:Fs(t.toBlock),addresses:t.address===void 0?null:Array.isArray(t.address)?t.address:[t.address],topics:t.topics||[]}}yt.filterFromParam=ho;function Bs(t){const e={fromBlock:Ds(t.fromBlock),toBlock:Ds(t.toBlock),topics:t.topics};return t.addresses!==null&&(e.address=t.addresses),e}function Fs(t){if(t===void 0||t==="latest"||t==="pending")return"latest";if(t==="earliest")return(0,lt.IntNumber)(0);if((0,ie.isHexString)(t))return(0,ie.intNumberFromHexString)(t);throw new Error(`Invalid block option: ${String(t)}`)}function Ds(t){return t==="latest"?t:(0,ie.hexStringFromIntNumber)(t)}function lr(){return Object.assign(Object.assign({},Je),{error:{code:-32e3,message:"filter not found"}})}function ur(){return Object.assign(Object.assign({},Je),{result:[]})}var Gr={},fo={},qr={},Qn=Pl;function Pl(t){t=t||{};var e=t.max||Number.MAX_SAFE_INTEGER,r=typeof t.start<"u"?t.start:Math.floor(Math.random()*e);return function(){return r=r%e,r++}}const Hs=(t,e)=>function(){const r=e.promiseModule,n=new Array(arguments.length);for(let s=0;s<arguments.length;s++)n[s]=arguments[s];return new r((s,i)=>{e.errorFirst?n.push(function(o,a){if(e.multiArgs){const l=new Array(arguments.length-1);for(let c=1;c<arguments.length;c++)l[c-1]=arguments[c];o?(l.unshift(o),i(l)):s(l)}else o?i(o):s(a)}):n.push(function(o){if(e.multiArgs){const a=new Array(arguments.length-1);for(let l=0;l<arguments.length;l++)a[l]=arguments[l];s(a)}else s(o)}),t.apply(this,n)})};var Ol=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);const r=s=>{const i=o=>typeof o=="string"?s===o:o.test(s);return e.include?e.include.some(i):!e.exclude.some(i)};let n;typeof t=="function"?n=function(){return e.excludeMain?t.apply(this,arguments):Hs(t,e).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(t));for(const s in t){const i=t[s];n[s]=typeof i=="function"&&r(s)?Hs(i,e):i}return n},qt={},Jt={};Object.defineProperty(Jt,"__esModule",{value:!0});const jl=p.eventsExports;function Us(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function xl(t){const e=t.length,r=new Array(e);for(let n=0;n<e;n+=1)r[n]=t[n];return r}let Bl=class extends jl.EventEmitter{emit(e,...r){let n=e==="error";const s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){let o;if(r.length>0&&([o]=r),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const i=s[e];if(i===void 0)return!1;if(typeof i=="function")Us(i,this,r);else{const o=i.length,a=xl(i);for(let l=0;l<o;l+=1)Us(a[l],this,r)}return!0}};Jt.default=Bl;var Fl=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qt,"__esModule",{value:!0});qt.BaseBlockTracker=void 0;const Dl=Fl(Jt),Hl=1e3,Ul=(t,e)=>t+e,Vs=["sync","latest"];class Vl extends Dl.default{constructor(e){super(),this._blockResetDuration=e.blockResetDuration||20*Hl,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(){return this._currentBlock?this._currentBlock:await new Promise(r=>this.once("latest",r))}removeAllListeners(e){return e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e){Vs.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 Vs.map(e=>this.listenerCount(e)).reduce(Ul)}_shouldUseNewBlock(e){const r=this._currentBlock;if(!r)return!0;const n=Ws(e),s=Ws(r);return this._usePastBlocks&&n<s||n>s}_newPotentialLatest(e){this._shouldUseNewBlock(e)&&this._setCurrentBlock(e)}_setCurrentBlock(e){const r=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:r,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}qt.BaseBlockTracker=Vl;function Ws(t){return Number.parseInt(t,16)}var go={},po={},re={};class mo extends TypeError{constructor(e,r){let n;const{message:s,explanation:i,...o}=e,{path:a}=e,l=a.length===0?s:`At path: ${a.join(".")} -- ${s}`;super(i??l),i!=null&&(this.cause=l),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function Wl(t){return Ee(t)&&typeof t[Symbol.iterator]=="function"}function Ee(t){return typeof t=="object"&&t!=null}function zs(t){if(Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Q(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function zl(t){const{done:e,value:r}=t.next();return e?void 0:r}function Gl(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:s,branch:i}=e,{type:o}=r,{refinement:a,message:l=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${Q(n)}\``}=t;return{value:n,type:o,refinement:a,key:s[s.length-1],path:s,branch:i,...t,message:l}}function*$n(t,e,r,n){Wl(t)||(t=[t]);for(const s of t){const i=Gl(s,e,r,n);i&&(yield i)}}function*Kn(t,e,r={}){const{path:n=[],branch:s=[t],coerce:i=!1,mask:o=!1}=r,a={path:n,branch:s};if(i&&(t=e.coercer(t,a),o&&e.type!=="type"&&Ee(e.schema)&&Ee(t)&&!Array.isArray(t)))for(const c in t)e.schema[c]===void 0&&delete t[c];let l="valid";for(const c of e.validator(t,a))c.explanation=r.message,l="not_valid",yield[c,void 0];for(let[c,u,d]of e.entries(t,a)){const h=Kn(u,d,{path:c===void 0?n:[...n,c],branch:c===void 0?s:[...s,u],coerce:i,mask:o,message:r.message});for(const f of h)f[0]?(l=f[0].refinement!=null?"not_refined":"not_valid",yield[f[0],void 0]):i&&(u=f[1],c===void 0?t=u:t instanceof Map?t.set(c,u):t instanceof Set?t.add(u):Ee(t)&&(u!==void 0||c in t)&&(t[c]=u))}if(l!=="not_valid")for(const c of e.refiner(t,a))c.explanation=r.message,l="not_refined",yield[c,void 0];l==="valid"&&(yield[void 0,t])}class G{constructor(e){const{type:r,schema:n,validator:s,refiner:i,coercer:o=l=>l,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=o,s?this.validator=(l,c)=>{const u=s(l,c);return $n(u,c,this,l)}:this.validator=()=>[],i?this.refiner=(l,c)=>{const u=i(l,c);return $n(u,c,this,l)}:this.refiner=()=>[]}assert(e,r){return bo(e,this,r)}create(e,r){return yo(e,this,r)}is(e){return Xn(e,this)}mask(e,r){return wo(e,this,r)}validate(e,r={}){return Rt(e,this,r)}}function bo(t,e,r){const n=Rt(t,e,{message:r});if(n[0])throw n[0]}function yo(t,e,r){const n=Rt(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function wo(t,e,r){const n=Rt(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Xn(t,e){return!Rt(t,e)[0]}function Rt(t,e,r={}){const n=Kn(t,e,r),s=zl(n);return s[0]?[new mo(s[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,s[1]]}function ql(...t){const e=t[0].type==="type",r=t.map(s=>s.schema),n=Object.assign({},...r);return e?Qt(n):Zt(n)}function ce(t,e){return new G({type:t,schema:null,validator:e})}function Jl(t,e){return new G({...t,refiner:(r,n)=>r===void 0||t.refiner(r,n),validator(r,n){return r===void 0?!0:(e(r,n),t.validator(r,n))}})}function Zl(t){return new G({type:"dynamic",schema:null,*entries(e,r){yield*t(e,r).entries(e,r)},validator(e,r){return t(e,r).validator(e,r)},coercer(e,r){return t(e,r).coercer(e,r)},refiner(e,r){return t(e,r).refiner(e,r)}})}function Ql(t){let e;return new G({type:"lazy",schema:null,*entries(r,n){e??(e=t()),yield*e.entries(r,n)},validator(r,n){return e??(e=t()),e.validator(r,n)},coercer(r,n){return e??(e=t()),e.coercer(r,n)},refiner(r,n){return e??(e=t()),e.refiner(r,n)}})}function Kl(t,e){const{schema:r}=t,n={...r};for(const s of e)delete n[s];switch(t.type){case"type":return Qt(n);default:return Zt(n)}}function Xl(t){const e=t instanceof G,r=e?{...t.schema}:{...t};for(const n in r)r[n]=Eo(r[n]);return e&&t.type==="type"?Qt(r):Zt(r)}function Yl(t,e){const{schema:r}=t,n={};for(const s of e)n[s]=r[s];switch(t.type){case"type":return Qt(n);default:return Zt(n)}}function eu(t,e){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),ce(t,e)}function tu(){return ce("any",()=>!0)}function ru(t){return new G({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${Q(e)}`}})}function nu(){return ce("bigint",t=>typeof t=="bigint")}function su(){return ce("boolean",t=>typeof t=="boolean")}function iu(){return ce("date",t=>t instanceof Date&&!isNaN(t.getTime())||`Expected a valid \`Date\` object, but received: ${Q(t)}`)}function ou(t){const e={},r=t.map(n=>Q(n)).join();for(const n of t)e[n]=n;return new G({type:"enums",schema:e,validator(n){return t.includes(n)||`Expected one of \`${r}\`, but received: ${Q(n)}`}})}function au(){return ce("func",t=>typeof t=="function"||`Expected a function, but received: ${Q(t)}`)}function cu(t){return ce("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${Q(e)}`)}function lu(){return ce("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${Q(t)}`)}function uu(t){return new G({type:"intersection",schema:null,*entries(e,r){for(const n of t)yield*n.entries(e,r)},*validator(e,r){for(const n of t)yield*n.validator(e,r)},*refiner(e,r){for(const n of t)yield*n.refiner(e,r)}})}function du(t){const e=Q(t),r=typeof t;return new G({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${Q(n)}`}})}function hu(t,e){return new G({type:"map",schema:null,*entries(r){if(t&&e&&r instanceof Map)for(const[n,s]of r.entries())yield[n,n,t],yield[n,s,e]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${Q(r)}`}})}function Yn(){return ce("never",()=>!1)}function fu(t){return new G({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function gu(){return ce("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${Q(t)}`)}function Zt(t){const e=t?Object.keys(t):[],r=Yn();return new G({type:"object",schema:t||null,*entries(n){if(t&&Ee(n)){const s=new Set(Object.keys(n));for(const i of e)s.delete(i),yield[i,n[i],t[i]];for(const i of s)yield[i,n[i],r]}},validator(n){return Ee(n)||`Expected an object, but received: ${Q(n)}`},coercer(n){return Ee(n)?{...n}:n}})}function Eo(t){return new G({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function pu(t,e){return new G({type:"record",schema:null,*entries(r){if(Ee(r))for(const n in r){const s=r[n];yield[n,n,t],yield[n,s,e]}},validator(r){return Ee(r)||`Expected an object, but received: ${Q(r)}`}})}function mu(){return ce("regexp",t=>t instanceof RegExp)}function bu(t){return new G({type:"set",schema:null,*entries(e){if(t&&e instanceof Set)for(const r of e)yield[r,r,t]},coercer(e){return e instanceof Set?new Set(e):e},validator(e){return e instanceof Set||`Expected a \`Set\` object, but received: ${Q(e)}`}})}function _o(){return ce("string",t=>typeof t=="string"||`Expected a string, but received: ${Q(t)}`)}function yu(t){const e=Yn();return new G({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let s=0;s<n;s++)yield[s,r[s],t[s]||e]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${Q(r)}`}})}function Qt(t){const e=Object.keys(t);return new G({type:"type",schema:t,*entries(r){if(Ee(r))for(const n of e)yield[n,r[n],t[n]]},validator(r){return Ee(r)||`Expected an object, but received: ${Q(r)}`},coercer(r){return Ee(r)?{...r}:r}})}function wu(t){const e=t.map(r=>r.type).join(" | ");return new G({type:"union",schema:null,coercer(r){for(const n of t){const[s,i]=n.validate(r,{coerce:!0});if(!s)return i}return r},validator(r,n){const s=[];for(const i of t){const[...o]=Kn(r,i,n),[a]=o;if(a[0])for(const[l]of o)l&&s.push(l);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${Q(r)}`,...s]}})}function vo(){return ce("unknown",()=>!0)}function es(t,e,r){return new G({...t,coercer:(n,s)=>Xn(n,e)?t.coercer(r(n,s),s):t.coercer(n,s)})}function Eu(t,e,r={}){return es(t,vo(),n=>{const s=typeof e=="function"?e():e;if(n===void 0)return s;if(!r.strict&&zs(n)&&zs(s)){const i={...n};let o=!1;for(const a in s)i[a]===void 0&&(i[a]=s[a],o=!0);if(o)return i}return n})}function _u(t){return es(t,_o(),e=>e.trim())}function vu(t){return tt(t,"empty",e=>{const r=So(e);return r===0||`Expected an empty ${t.type} but received one with a size of \`${r}\``})}function So(t){return t instanceof Map||t instanceof Set?t.size:t.length}function Su(t,e,r={}){const{exclusive:n}=r;return tt(t,"max",s=>n?s<e:s<=e||`Expected a ${t.type} less than ${n?"":"or equal to "}${e} but received \`${s}\``)}function Cu(t,e,r={}){const{exclusive:n}=r;return tt(t,"min",s=>n?s>e:s>=e||`Expected a ${t.type} greater than ${n?"":"or equal to "}${e} but received \`${s}\``)}function ku(t){return tt(t,"nonempty",e=>So(e)>0||`Expected a nonempty ${t.type} but received an empty one`)}function Ru(t,e){return tt(t,"pattern",r=>e.test(r)||`Expected a ${t.type} matching \`/${e.source}/\` but received "${r}"`)}function Iu(t,e,r=e){const n=`Expected a ${t.type}`,s=e===r?`of \`${e}\``:`between \`${e}\` and \`${r}\``;return tt(t,"size",i=>{if(typeof i=="number"||i instanceof Date)return e<=i&&i<=r||`${n} ${s} but received \`${i}\``;if(i instanceof Map||i instanceof Set){const{size:o}=i;return e<=o&&o<=r||`${n} with a size ${s} but received one with a size of \`${o}\``}else{const{length:o}=i;return e<=o&&o<=r||`${n} with a length ${s} but received one with a length of \`${o}\``}})}function tt(t,e,r){return new G({...t,*refiner(n,s){yield*t.refiner(n,s);const i=r(n,s),o=$n(i,s,t,n);for(const a of o)yield{...a,refinement:e}}})}const Au=Object.freeze(Object.defineProperty({__proto__:null,Struct:G,StructError:mo,any:tu,array:ru,assert:bo,assign:ql,bigint:nu,boolean:su,coerce:es,create:yo,date:iu,defaulted:Eu,define:ce,deprecated:Jl,dynamic:Zl,empty:vu,enums:ou,func:au,instance:cu,integer:lu,intersection:uu,is:Xn,lazy:Ql,literal:du,map:hu,mask:wo,max:Su,min:Cu,never:Yn,nonempty:ku,nullable:fu,number:gu,object:Zt,omit:Kl,optional:Eo,partial:Xl,pattern:Ru,pick:Yl,record:pu,refine:tt,regexp:mu,set:bu,size:Iu,string:_o,struct:eu,trimmed:_u,tuple:yu,type:Qt,union:wu,unknown:vo,validate:Rt},Symbol.toStringTag,{value:"Module"})),rt=p.getAugmentedNamespace(Au);Object.defineProperty(re,"__esModule",{value:!0});re.assertExhaustive=re.assertStruct=re.assert=re.AssertionError=void 0;const Nu=rt;function Mu(t){return typeof t=="object"&&t!==null&&"message"in t}function Lu(t){var e,r;return typeof((r=(e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===null||r===void 0?void 0:r.name)=="string"}function Tu(t){const e=Mu(t)?t.message:String(t);return e.endsWith(".")?e.slice(0,-1):e}function Co(t,e){return Lu(t)?new t({message:e}):t({message:e})}class ts extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}re.AssertionError=ts;function $u(t,e="Assertion failed.",r=ts){if(!t)throw e instanceof Error?e:Co(r,e)}re.assert=$u;function Pu(t,e,r="Assertion failed",n=ts){try{(0,Nu.assert)(t,e)}catch(s){throw Co(n,`${r}: ${Tu(s)}.`)}}re.assertStruct=Pu;function Ou(t){throw new Error("Invalid branch reached. Should be detected during compilation.")}re.assertExhaustive=Ou;var Kt={};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.base64=void 0;const ju=rt,xu=re,Bu=(t,e={})=>{var r,n;const s=(r=e.paddingRequired)!==null&&r!==void 0?r:!1,i=(n=e.characterSet)!==null&&n!==void 0?n:"base64";let o;i==="base64"?o=String.raw`[A-Za-z0-9+\/]`:((0,xu.assert)(i==="base64url"),o=String.raw`[-_A-Za-z0-9]`);let a;return s?a=new RegExp(`^(?:${o}{4})*(?:${o}{3}=|${o}{2}==)?$`,"u"):a=new RegExp(`^(?:${o}{4})*(?:${o}{2,3}|${o}{3}=|${o}{2}==)?$`,"u"),(0,ju.pattern)(t,a)};Kt.base64=Bu;var x={},Xt={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.remove0x=t.add0x=t.assertIsStrictHexString=t.assertIsHexString=t.isStrictHexString=t.isHexString=t.StrictHexStruct=t.HexStruct=void 0;const e=rt,r=re;t.HexStruct=(0,e.pattern)((0,e.string)(),/^(?:0x)?[0-9a-f]+$/iu),t.StrictHexStruct=(0,e.pattern)((0,e.string)(),/^0x[0-9a-f]+$/iu);function n(c){return(0,e.is)(c,t.HexStruct)}t.isHexString=n;function s(c){return(0,e.is)(c,t.StrictHexStruct)}t.isStrictHexString=s;function i(c){(0,r.assert)(n(c),"Value must be a hexadecimal string.")}t.assertIsHexString=i;function o(c){(0,r.assert)(s(c),'Value must be a hexadecimal string, starting with "0x".')}t.assertIsStrictHexString=o;function a(c){return c.startsWith("0x")?c:c.startsWith("0X")?`0x${c.substring(2)}`:`0x${c}`}t.add0x=a;function l(c){return c.startsWith("0x")||c.startsWith("0X")?c.substring(2):c}t.remove0x=l})(Xt);Object.defineProperty(x,"__esModule",{value:!0});x.createDataView=x.concatBytes=x.valueToBytes=x.stringToBytes=x.numberToBytes=x.signedBigIntToBytes=x.bigIntToBytes=x.hexToBytes=x.bytesToString=x.bytesToNumber=x.bytesToSignedBigInt=x.bytesToBigInt=x.bytesToHex=x.assertIsBytes=x.isBytes=void 0;const fe=re,Pn=Xt,Gs=48,qs=58,Js=87;function Fu(){const t=[];return()=>{if(t.length===0)for(let e=0;e<256;e++)t.push(e.toString(16).padStart(2,"0"));return t}}const Du=Fu();function rs(t){return t instanceof Uint8Array}x.isBytes=rs;function It(t){(0,fe.assert)(rs(t),"Value must be a Uint8Array.")}x.assertIsBytes=It;function ko(t){if(It(t),t.length===0)return"0x";const e=Du(),r=new Array(t.length);for(let n=0;n<t.length;n++)r[n]=e[t[n]];return(0,Pn.add0x)(r.join(""))}x.bytesToHex=ko;function Ro(t){It(t);const e=ko(t);return BigInt(e)}x.bytesToBigInt=Ro;function Hu(t){It(t);let e=BigInt(0);for(const r of t)e=(e<<BigInt(8))+BigInt(r);return BigInt.asIntN(t.length*8,e)}x.bytesToSignedBigInt=Hu;function Uu(t){It(t);const e=Ro(t);return(0,fe.assert)(e<=BigInt(Number.MAX_SAFE_INTEGER),"Number is not a safe integer. Use `bytesToBigInt` instead."),Number(e)}x.bytesToNumber=Uu;function Vu(t){return It(t),new TextDecoder().decode(t)}x.bytesToString=Vu;function Jr(t){var e;if(((e=t==null?void 0:t.toLowerCase)===null||e===void 0?void 0:e.call(t))==="0x")return new Uint8Array;(0,Pn.assertIsHexString)(t);const r=(0,Pn.remove0x)(t).toLowerCase(),n=r.length%2===0?r:`0${r}`,s=new Uint8Array(n.length/2);for(let i=0;i<s.length;i++){const o=n.charCodeAt(i*2),a=n.charCodeAt(i*2+1),l=o-(o<qs?Gs:Js),c=a-(a<qs?Gs:Js);s[i]=l*16+c}return s}x.hexToBytes=Jr;function Io(t){(0,fe.assert)(typeof t=="bigint","Value must be a bigint."),(0,fe.assert)(t>=BigInt(0),"Value must be a non-negative bigint.");const e=t.toString(16);return Jr(e)}x.bigIntToBytes=Io;function Wu(t,e){(0,fe.assert)(e>0);const r=t>>BigInt(31);return!((~t&r)+(t&~r)>>BigInt(e*8+-1))}function zu(t,e){(0,fe.assert)(typeof t=="bigint","Value must be a bigint."),(0,fe.assert)(typeof e=="number","Byte length must be a number."),(0,fe.assert)(e>0,"Byte length must be greater than 0."),(0,fe.assert)(Wu(t,e),"Byte length is too small to represent the given value.");let r=t;const n=new Uint8Array(e);for(let s=0;s<n.length;s++)n[s]=Number(BigInt.asUintN(8,r)),r>>=BigInt(8);return n.reverse()}x.signedBigIntToBytes=zu;function Ao(t){(0,fe.assert)(typeof t=="number","Value must be a number."),(0,fe.assert)(t>=0,"Value must be a non-negative number."),(0,fe.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToBytes` instead.");const e=t.toString(16);return Jr(e)}x.numberToBytes=Ao;function No(t){return(0,fe.assert)(typeof t=="string","Value must be a string."),new TextEncoder().encode(t)}x.stringToBytes=No;function Mo(t){if(typeof t=="bigint")return Io(t);if(typeof t=="number")return Ao(t);if(typeof t=="string")return t.startsWith("0x")?Jr(t):No(t);if(rs(t))return t;throw new TypeError(`Unsupported value type: "${typeof t}".`)}x.valueToBytes=Mo;function Gu(t){const e=new Array(t.length);let r=0;for(let s=0;s<t.length;s++){const i=Mo(t[s]);e[s]=i,r+=i.length}const n=new Uint8Array(r);for(let s=0,i=0;s<e.length;s++)n.set(e[s],i),i+=e[s].length;return n}x.concatBytes=Gu;function qu(t){if(typeof p.Buffer<"u"&&t instanceof p.Buffer){const e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return new DataView(e)}return new DataView(t.buffer,t.byteOffset,t.byteLength)}x.createDataView=qu;var Zr={};Object.defineProperty(Zr,"__esModule",{value:!0});Zr.ChecksumStruct=void 0;const Zs=rt,Ju=Kt;Zr.ChecksumStruct=(0,Zs.size)((0,Ju.base64)((0,Zs.string)(),{paddingRequired:!0}),44,44);var Te={};Object.defineProperty(Te,"__esModule",{value:!0});Te.createHex=Te.createBytes=Te.createBigInt=Te.createNumber=void 0;const W=rt,Zu=re,Lo=x,Qr=Xt,To=(0,W.union)([(0,W.number)(),(0,W.bigint)(),(0,W.string)(),Qr.StrictHexStruct]),Qu=(0,W.coerce)((0,W.number)(),To,Number),Ku=(0,W.coerce)((0,W.bigint)(),To,BigInt);(0,W.union)([Qr.StrictHexStruct,(0,W.instance)(Uint8Array)]);const Xu=(0,W.coerce)((0,W.instance)(Uint8Array),(0,W.union)([Qr.StrictHexStruct]),Lo.hexToBytes),Yu=(0,W.coerce)(Qr.StrictHexStruct,(0,W.instance)(Uint8Array),Lo.bytesToHex);function ed(t){try{const e=(0,W.create)(t,Qu);return(0,Zu.assert)(Number.isFinite(e),`Expected a number-like value, got "${t}".`),e}catch(e){throw e instanceof W.StructError?new Error(`Expected a number-like value, got "${t}".`):e}}Te.createNumber=ed;function td(t){try{return(0,W.create)(t,Ku)}catch(e){throw e instanceof W.StructError?new Error(`Expected a number-like value, got "${String(e.value)}".`):e}}Te.createBigInt=td;function rd(t){if(typeof t=="string"&&t.toLowerCase()==="0x")return new Uint8Array;try{return(0,W.create)(t,Xu)}catch(e){throw e instanceof W.StructError?new Error(`Expected a bytes-like value, got "${String(e.value)}".`):e}}Te.createBytes=rd;function nd(t){if(t instanceof Uint8Array&&t.length===0||typeof t=="string"&&t.toLowerCase()==="0x")return"0x";try{return(0,W.create)(t,Yu)}catch(e){throw e instanceof W.StructError?new Error(`Expected a bytes-like value, got "${String(e.value)}".`):e}}Te.createHex=nd;var wt={},$o=p.commonjsGlobal&&p.commonjsGlobal.__classPrivateFieldSet||function(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r},oe=p.commonjsGlobal&&p.commonjsGlobal.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},_e,Re;Object.defineProperty(wt,"__esModule",{value:!0});wt.FrozenSet=wt.FrozenMap=void 0;class ns{constructor(e){_e.set(this,void 0),$o(this,_e,new Map(e),"f"),Object.freeze(this)}get size(){return oe(this,_e,"f").size}[(_e=new WeakMap,Symbol.iterator)](){return oe(this,_e,"f")[Symbol.iterator]()}entries(){return oe(this,_e,"f").entries()}forEach(e,r){return oe(this,_e,"f").forEach((n,s,i)=>e.call(r,n,s,this))}get(e){return oe(this,_e,"f").get(e)}has(e){return oe(this,_e,"f").has(e)}keys(){return oe(this,_e,"f").keys()}values(){return oe(this,_e,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([e,r])=>`${String(e)} => ${String(r)}`).join(", ")} `:""}}`}}wt.FrozenMap=ns;class ss{constructor(e){Re.set(this,void 0),$o(this,Re,new Set(e),"f"),Object.freeze(this)}get size(){return oe(this,Re,"f").size}[(Re=new WeakMap,Symbol.iterator)](){return oe(this,Re,"f")[Symbol.iterator]()}entries(){return oe(this,Re,"f").entries()}forEach(e,r){return oe(this,Re,"f").forEach((n,s,i)=>e.call(r,n,s,this))}has(e){return oe(this,Re,"f").has(e)}keys(){return oe(this,Re,"f").keys()}values(){return oe(this,Re,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(e=>String(e)).join(", ")} `:""}}`}}wt.FrozenSet=ss;Object.freeze(ns);Object.freeze(ns.prototype);Object.freeze(ss);Object.freeze(ss.prototype);var Po={};Object.defineProperty(Po,"__esModule",{value:!0});var Oo={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getJsonRpcIdValidator=t.assertIsJsonRpcError=t.isJsonRpcError=t.assertIsJsonRpcFailure=t.isJsonRpcFailure=t.assertIsJsonRpcSuccess=t.isJsonRpcSuccess=t.assertIsJsonRpcResponse=t.isJsonRpcResponse=t.assertIsPendingJsonRpcResponse=t.isPendingJsonRpcResponse=t.JsonRpcResponseStruct=t.JsonRpcFailureStruct=t.JsonRpcSuccessStruct=t.PendingJsonRpcResponseStruct=t.assertIsJsonRpcRequest=t.isJsonRpcRequest=t.assertIsJsonRpcNotification=t.isJsonRpcNotification=t.JsonRpcNotificationStruct=t.JsonRpcRequestStruct=t.JsonRpcParamsStruct=t.JsonRpcErrorStruct=t.JsonRpcIdStruct=t.JsonRpcVersionStruct=t.jsonrpc2=t.getJsonSize=t.isValidJson=t.JsonStruct=t.UnsafeJsonStruct=void 0;const e=rt,r=re,n=()=>(0,e.define)("finite number",_=>(0,e.is)(_,(0,e.number)())&&Number.isFinite(_));t.UnsafeJsonStruct=(0,e.union)([(0,e.literal)(null),(0,e.boolean)(),n(),(0,e.string)(),(0,e.array)((0,e.lazy)(()=>t.UnsafeJsonStruct)),(0,e.record)((0,e.string)(),(0,e.lazy)(()=>t.UnsafeJsonStruct))]),t.JsonStruct=(0,e.define)("Json",(_,M)=>{function z(ne,le){const ge=[...le.validator(ne,M)];return ge.length>0?ge:!0}try{const ne=z(_,t.UnsafeJsonStruct);return ne!==!0?ne:z(JSON.parse(JSON.stringify(_)),t.UnsafeJsonStruct)}catch(ne){return ne instanceof RangeError?"Circular reference detected":!1}});function s(_){return(0,e.is)(_,t.JsonStruct)}t.isValidJson=s;function i(_){(0,r.assertStruct)(_,t.JsonStruct,"Invalid JSON value");const M=JSON.stringify(_);return new TextEncoder().encode(M).byteLength}t.getJsonSize=i,t.jsonrpc2="2.0",t.JsonRpcVersionStruct=(0,e.literal)(t.jsonrpc2),t.JsonRpcIdStruct=(0,e.nullable)((0,e.union)([(0,e.number)(),(0,e.string)()])),t.JsonRpcErrorStruct=(0,e.object)({code:(0,e.integer)(),message:(0,e.string)(),data:(0,e.optional)(t.JsonStruct),stack:(0,e.optional)((0,e.string)())}),t.JsonRpcParamsStruct=(0,e.optional)((0,e.union)([(0,e.record)((0,e.string)(),t.JsonStruct),(0,e.array)(t.JsonStruct)])),t.JsonRpcRequestStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,method:(0,e.string)(),params:t.JsonRpcParamsStruct}),t.JsonRpcNotificationStruct=(0,e.omit)(t.JsonRpcRequestStruct,["id"]);function o(_){return(0,e.is)(_,t.JsonRpcNotificationStruct)}t.isJsonRpcNotification=o;function a(_,M){(0,r.assertStruct)(_,t.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",M)}t.assertIsJsonRpcNotification=a;function l(_){return(0,e.is)(_,t.JsonRpcRequestStruct)}t.isJsonRpcRequest=l;function c(_,M){(0,r.assertStruct)(_,t.JsonRpcRequestStruct,"Invalid JSON-RPC request",M)}t.assertIsJsonRpcRequest=c,t.PendingJsonRpcResponseStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,result:(0,e.optional)((0,e.unknown)()),error:(0,e.optional)(t.JsonRpcErrorStruct)}),t.JsonRpcSuccessStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,result:t.JsonStruct}),t.JsonRpcFailureStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,error:t.JsonRpcErrorStruct}),t.JsonRpcResponseStruct=(0,e.union)([t.JsonRpcSuccessStruct,t.JsonRpcFailureStruct]);function u(_){return(0,e.is)(_,t.PendingJsonRpcResponseStruct)}t.isPendingJsonRpcResponse=u;function d(_,M){(0,r.assertStruct)(_,t.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",M)}t.assertIsPendingJsonRpcResponse=d;function h(_){return(0,e.is)(_,t.JsonRpcResponseStruct)}t.isJsonRpcResponse=h;function f(_,M){(0,r.assertStruct)(_,t.JsonRpcResponseStruct,"Invalid JSON-RPC response",M)}t.assertIsJsonRpcResponse=f;function g(_){return(0,e.is)(_,t.JsonRpcSuccessStruct)}t.isJsonRpcSuccess=g;function y(_,M){(0,r.assertStruct)(_,t.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",M)}t.assertIsJsonRpcSuccess=y;function w(_){return(0,e.is)(_,t.JsonRpcFailureStruct)}t.isJsonRpcFailure=w;function S(_,M){(0,r.assertStruct)(_,t.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",M)}t.assertIsJsonRpcFailure=S;function C(_){return(0,e.is)(_,t.JsonRpcErrorStruct)}t.isJsonRpcError=C;function m(_,M){(0,r.assertStruct)(_,t.JsonRpcErrorStruct,"Invalid JSON-RPC error",M)}t.assertIsJsonRpcError=m;function B(_){const{permitEmptyString:M,permitFractions:z,permitNull:ne}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},_);return K=>!!(typeof K=="number"&&(z||Number.isInteger(K))||typeof K=="string"&&(M||K.length>0)||ne&&K===null)}t.getJsonRpcIdValidator=B})(Oo);var jo={};Object.defineProperty(jo,"__esModule",{value:!0});var Et={},On={exports:{}},vn,Qs;function sd(){if(Qs)return vn;Qs=1;var t=1e3,e=t*60,r=e*60,n=r*24,s=n*7,i=n*365.25;vn=function(u,d){d=d||{};var h=typeof u;if(h==="string"&&u.length>0)return o(u);if(h==="number"&&isFinite(u))return d.long?l(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function o(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var h=parseFloat(d[1]),f=(d[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return h*i;case"weeks":case"week":case"w":return h*s;case"days":case"day":case"d":return h*n;case"hours":case"hour":case"hrs":case"hr":case"h":return h*r;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function a(u){var d=Math.abs(u);return d>=n?Math.round(u/n)+"d":d>=r?Math.round(u/r)+"h":d>=e?Math.round(u/e)+"m":d>=t?Math.round(u/t)+"s":u+"ms"}function l(u){var d=Math.abs(u);return d>=n?c(u,d,n,"day"):d>=r?c(u,d,r,"hour"):d>=e?c(u,d,e,"minute"):d>=t?c(u,d,t,"second"):u+" ms"}function c(u,d,h,f){var g=d>=h*1.5;return Math.round(u/h)+" "+f+(g?"s":"")}return vn}function id(t){r.debug=r,r.default=r,r.coerce=l,r.disable=i,r.enable=s,r.enabled=o,r.humanize=sd(),r.destroy=c,Object.keys(t).forEach(u=>{r[u]=t[u]}),r.names=[],r.skips=[],r.formatters={};function e(u){let d=0;for(let h=0;h<u.length;h++)d=(d<<5)-d+u.charCodeAt(h),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(u){let d,h=null,f,g;function y(...w){if(!y.enabled)return;const S=y,C=Number(new Date),m=C-(d||C);S.diff=m,S.prev=d,S.curr=C,d=C,w[0]=r.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let B=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(M,z)=>{if(M==="%%")return"%";B++;const ne=r.formatters[z];if(typeof ne=="function"){const le=w[B];M=ne.call(S,le),w.splice(B,1),B--}return M}),r.formatArgs.call(S,w),(S.log||r.log).apply(S,w)}return y.namespace=u,y.useColors=r.useColors(),y.color=r.selectColor(u),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(f!==r.namespaces&&(f=r.namespaces,g=r.enabled(u)),g),set:w=>{h=w}}),typeof r.init=="function"&&r.init(y),y}function n(u,d){const h=r(this.namespace+(typeof d>"u"?":":d)+u);return h.log=this.log,h}function s(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let d;const h=(typeof u=="string"?u:"").split(/[\s,]+/),f=h.length;for(d=0;d<f;d++)h[d]&&(u=h[d].replace(/\*/g,".*?"),u[0]==="-"?r.skips.push(new RegExp("^"+u.slice(1)+"$")):r.names.push(new RegExp("^"+u+"$")))}function i(){const u=[...r.names.map(a),...r.skips.map(a).map(d=>"-"+d)].join(",");return r.enable(""),u}function o(u){if(u[u.length-1]==="*")return!0;let d,h;for(d=0,h=r.skips.length;d<h;d++)if(r.skips[d].test(u))return!1;for(d=0,h=r.names.length;d<h;d++)if(r.names[d].test(u))return!0;return!1}function a(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var od=id;(function(t,e){e.formatArgs=n,e.save=s,e.load=i,e.useColors=r,e.storage=o(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let l;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;l.splice(1,0,c,"color: inherit");let u=0,d=0;l[0].replace(/%[a-zA-Z%]/g,h=>{h!=="%%"&&(u++,h==="%c"&&(d=u))}),l.splice(d,0,c)}e.log=console.debug||console.log||(()=>{});function s(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function i(){let l;try{l=e.storage.getItem("debug")}catch{}return!l&&typeof p.process$1<"u"&&"env"in p.process$1&&(l=p.process$1.env.DEBUG),l}function o(){try{return localStorage}catch{}}t.exports=od(e);const{formatters:a}=t.exports;a.j=function(l){try{return JSON.stringify(l)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}})(On,On.exports);var ad=On.exports,cd=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Et,"__esModule",{value:!0});Et.createModuleLogger=Et.createProjectLogger=void 0;const ld=cd(ad),ud=(0,ld.default)("metamask");function dd(t){return ud.extend(t)}Et.createProjectLogger=dd;function hd(t,e){return t.extend(e)}Et.createModuleLogger=hd;var xo={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateNumberSize=t.calculateStringSize=t.isASCII=t.isPlainObject=t.ESCAPE_CHARACTERS_REGEXP=t.JsonSize=t.hasProperty=t.isObject=t.isNullOrUndefined=t.isNonEmptyArray=void 0;function e(c){return Array.isArray(c)&&c.length>0}t.isNonEmptyArray=e;function r(c){return c==null}t.isNullOrUndefined=r;function n(c){return!!c&&typeof c=="object"&&!Array.isArray(c)}t.isObject=n;const s=(c,u)=>Object.hasOwnProperty.call(c,u);t.hasProperty=s,function(c){c[c.Null=4]="Null",c[c.Comma=1]="Comma",c[c.Wrapper=1]="Wrapper",c[c.True=4]="True",c[c.False=5]="False",c[c.Quote=1]="Quote",c[c.Colon=1]="Colon",c[c.Date=24]="Date"}(t.JsonSize||(t.JsonSize={})),t.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function i(c){if(typeof c!="object"||c===null)return!1;try{let u=c;for(;Object.getPrototypeOf(u)!==null;)u=Object.getPrototypeOf(u);return Object.getPrototypeOf(c)===u}catch{return!1}}t.isPlainObject=i;function o(c){return c.charCodeAt(0)<=127}t.isASCII=o;function a(c){var u;return c.split("").reduce((h,f)=>o(f)?h+1:h+2,0)+((u=c.match(t.ESCAPE_CHARACTERS_REGEXP))!==null&&u!==void 0?u:[]).length}t.calculateStringSize=a;function l(c){return c.toString().length}t.calculateNumberSize=l})(xo);var $e={};Object.defineProperty($e,"__esModule",{value:!0});$e.hexToBigInt=$e.hexToNumber=$e.bigIntToHex=$e.numberToHex=void 0;const ft=re,jt=Xt,fd=t=>((0,ft.assert)(typeof t=="number","Value must be a number."),(0,ft.assert)(t>=0,"Value must be a non-negative number."),(0,ft.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,jt.add0x)(t.toString(16)));$e.numberToHex=fd;const gd=t=>((0,ft.assert)(typeof t=="bigint","Value must be a bigint."),(0,ft.assert)(t>=0,"Value must be a non-negative bigint."),(0,jt.add0x)(t.toString(16)));$e.bigIntToHex=gd;const pd=t=>{(0,jt.assertIsHexString)(t);const e=parseInt(t,16);return(0,ft.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `hexToBigInt` instead."),e};$e.hexToNumber=pd;const md=t=>((0,jt.assertIsHexString)(t),BigInt((0,jt.add0x)(t)));$e.hexToBigInt=md;var Bo={};Object.defineProperty(Bo,"__esModule",{value:!0});var Fo={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.timeSince=t.inMilliseconds=t.Duration=void 0,function(i){i[i.Millisecond=1]="Millisecond",i[i.Second=1e3]="Second",i[i.Minute=6e4]="Minute",i[i.Hour=36e5]="Hour",i[i.Day=864e5]="Day",i[i.Week=6048e5]="Week",i[i.Year=31536e6]="Year"}(t.Duration||(t.Duration={}));const e=i=>Number.isInteger(i)&&i>=0,r=(i,o)=>{if(!e(i))throw new Error(`"${o}" must be a non-negative integer. Received: "${i}".`)};function n(i,o){return r(i,"count"),i*o}t.inMilliseconds=n;function s(i){return r(i,"timestamp"),Date.now()-i}t.timeSince=s})(Fo);var Do={};Object.defineProperty(Do,"__esModule",{value:!0});var Ho={},jn={exports:{}};const bd="2.0.0",Uo=256,yd=Number.MAX_SAFE_INTEGER||9007199254740991,wd=16,Ed=Uo-6,_d=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Kr={MAX_LENGTH:Uo,MAX_SAFE_COMPONENT_LENGTH:wd,MAX_SAFE_BUILD_LENGTH:Ed,MAX_SAFE_INTEGER:yd,RELEASE_TYPES:_d,SEMVER_SPEC_VERSION:bd,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const vd=typeof p.process$1=="object"&&p.process$1.env&&p.process$1.env.NODE_DEBUG&&/\bsemver\b/i.test(p.process$1.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};var Xr=vd;(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=Kr,i=Xr;e=t.exports={};const o=e.re=[],a=e.safeRe=[],l=e.src=[],c=e.t={};let u=0;const d="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",s],[d,n]],f=y=>{for(const[w,S]of h)y=y.split(`${w}*`).join(`${w}{0,${S}}`).split(`${w}+`).join(`${w}{1,${S}}`);return y},g=(y,w,S)=>{const C=f(w),m=u++;i(y,m,w),c[y]=m,l[m]=w,o[m]=new RegExp(w,S?"g":void 0),a[m]=new RegExp(C,S?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*"),g("NUMERICIDENTIFIERLOOSE","\\d+"),g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),g("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),g("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASEIDENTIFIER",`(?:${l[c.NUMERICIDENTIFIER]}|${l[c.NONNUMERICIDENTIFIER]})`),g("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NUMERICIDENTIFIERLOOSE]}|${l[c.NONNUMERICIDENTIFIER]})`),g("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),g("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),g("BUILDIDENTIFIER",`${d}+`),g("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),g("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),g("FULL",`^${l[c.FULLPLAIN]}$`),g("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),g("LOOSE",`^${l[c.LOOSEPLAIN]}$`),g("GTLT","((?:<|>)?=?)"),g("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),g("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),g("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),g("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),g("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),g("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),g("COERCE",`${l[c.COERCEPLAIN]}(?:$|[^\\d])`),g("COERCEFULL",l[c.COERCEPLAIN]+`(?:${l[c.PRERELEASE]})?(?:${l[c.BUILD]})?(?:$|[^\\d])`),g("COERCERTL",l[c.COERCE],!0),g("COERCERTLFULL",l[c.COERCEFULL],!0),g("LONETILDE","(?:~>?)"),g("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",g("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),g("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),g("LONECARET","(?:\\^)"),g("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",g("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),g("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),g("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),g("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),g("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",g("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),g("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),g("STAR","(<|>)?=?\\s*\\*"),g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(jn,jn.exports);var Yt=jn.exports;const Sd=Object.freeze({loose:!0}),Cd=Object.freeze({}),kd=t=>t?typeof t!="object"?Sd:t:Cd;var is=kd;const Ks=/^[0-9]+$/,Vo=(t,e)=>{const r=Ks.test(t),n=Ks.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Rd=(t,e)=>Vo(e,t);var Wo={compareIdentifiers:Vo,rcompareIdentifiers:Rd};const dr=Xr,{MAX_LENGTH:Xs,MAX_SAFE_INTEGER:hr}=Kr,{safeRe:Ys,t:ei}=Yt,Id=is,{compareIdentifiers:at}=Wo;let Ad=class Ie{constructor(e,r){if(r=Id(r),e instanceof Ie){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Xs)throw new TypeError(`version is longer than ${Xs} characters`);dr("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=e.trim().match(r.loose?Ys[ei.LOOSE]:Ys[ei.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>hr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>hr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>hr||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){const i=+s;if(i>=0&&i<hr)return i}return s}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(dr("SemVer.compare",this.version,this.options,e),!(e instanceof Ie)){if(typeof e=="string"&&e===this.version)return 0;e=new Ie(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof Ie||(e=new Ie(e,this.options)),at(this.major,e.major)||at(this.minor,e.minor)||at(this.patch,e.patch)}comparePre(e){if(e instanceof Ie||(e=new Ie(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],s=e.prerelease[r];if(dr("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return at(n,s)}while(++r)}compareBuild(e){e instanceof Ie||(e=new Ie(e,this.options));let r=0;do{const n=this.build[r],s=e.build[r];if(dr("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return at(n,s)}while(++r)}inc(e,r,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const s=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),at(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var ae=Ad;const ti=ae,Nd=(t,e,r=!1)=>{if(t instanceof ti)return t;try{return new ti(t,e)}catch(n){if(!r)return null;throw n}};var At=Nd;const Md=At,Ld=(t,e)=>{const r=Md(t,e);return r?r.version:null};var Td=Ld;const $d=At,Pd=(t,e)=>{const r=$d(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};var Od=Pd;const ri=ae,jd=(t,e,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new ri(t instanceof ri?t.version:t,r).inc(e,n,s).version}catch{return null}};var xd=jd;const ni=At,Bd=(t,e)=>{const r=ni(t,null,!0),n=ni(e,null,!0),s=r.compare(n);if(s===0)return null;const i=s>0,o=i?r:n,a=i?n:r,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l)return!a.patch&&!a.minor?"major":o.patch?"patch":o.minor?"minor":"major";const u=l?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};var Fd=Bd;const Dd=ae,Hd=(t,e)=>new Dd(t,e).major;var Ud=Hd;const Vd=ae,Wd=(t,e)=>new Vd(t,e).minor;var zd=Wd;const Gd=ae,qd=(t,e)=>new Gd(t,e).patch;var Jd=qd;const Zd=At,Qd=(t,e)=>{const r=Zd(t,e);return r&&r.prerelease.length?r.prerelease:null};var Kd=Qd;const si=ae,Xd=(t,e,r)=>new si(t,r).compare(new si(e,r));var Se=Xd;const Yd=Se,eh=(t,e,r)=>Yd(e,t,r);var th=eh;const rh=Se,nh=(t,e)=>rh(t,e,!0);var sh=nh;const ii=ae,ih=(t,e,r)=>{const n=new ii(t,r),s=new ii(e,r);return n.compare(s)||n.compareBuild(s)};var os=ih;const oh=os,ah=(t,e)=>t.sort((r,n)=>oh(r,n,e));var ch=ah;const lh=os,uh=(t,e)=>t.sort((r,n)=>lh(n,r,e));var dh=uh;const hh=Se,fh=(t,e,r)=>hh(t,e,r)>0;var Yr=fh;const gh=Se,ph=(t,e,r)=>gh(t,e,r)<0;var as=ph;const mh=Se,bh=(t,e,r)=>mh(t,e,r)===0;var zo=bh;const yh=Se,wh=(t,e,r)=>yh(t,e,r)!==0;var Go=wh;const Eh=Se,_h=(t,e,r)=>Eh(t,e,r)>=0;var cs=_h;const vh=Se,Sh=(t,e,r)=>vh(t,e,r)<=0;var ls=Sh;const Ch=zo,kh=Go,Rh=Yr,Ih=cs,Ah=as,Nh=ls,Mh=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return Ch(t,r,n);case"!=":return kh(t,r,n);case">":return Rh(t,r,n);case">=":return Ih(t,r,n);case"<":return Ah(t,r,n);case"<=":return Nh(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};var qo=Mh;const Lh=ae,Th=At,{safeRe:fr,t:gr}=Yt,$h=(t,e)=>{if(t instanceof Lh)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?fr[gr.COERCEFULL]:fr[gr.COERCE]);else{const l=e.includePrerelease?fr[gr.COERCERTLFULL]:fr[gr.COERCERTL];let c;for(;(c=l.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),l.lastIndex=c.index+c[1].length+c[2].length;l.lastIndex=-1}if(r===null)return null;const n=r[2],s=r[3]||"0",i=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Th(`${n}.${s}.${i}${o}${a}`,e)};var Ph=$h;class Oh{constructor(){this.max=1e3,this.map=new Map}get(e){const r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(e,r)}return this}}var jh=Oh,Sn,oi;function Ce(){if(oi)return Sn;oi=1;const t=/\s+/g;class e{constructor(b,I){if(I=s(I),b instanceof e)return b.loose===!!I.loose&&b.includePrerelease===!!I.includePrerelease?b:new e(b.raw,I);if(b instanceof i)return this.raw=b.value,this.set=[[b]],this.formatted=void 0,this;if(this.options=I,this.loose=!!I.loose,this.includePrerelease=!!I.includePrerelease,this.raw=b.trim().replace(t," "),this.set=this.raw.split("||").map(k=>this.parseRange(k.trim())).filter(k=>k.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const k=this.set[0];if(this.set=this.set.filter(A=>!y(A[0])),this.set.length===0)this.set=[k];else if(this.set.length>1){for(const A of this.set)if(A.length===1&&w(A[0])){this.set=[A];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let b=0;b<this.set.length;b++){b>0&&(this.formatted+="||");const I=this.set[b];for(let k=0;k<I.length;k++)k>0&&(this.formatted+=" "),this.formatted+=I[k].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(b){const k=((this.options.includePrerelease&&f)|(this.options.loose&&g))+":"+b,A=n.get(k);if(A)return A;const R=this.options.loose,L=R?l[c.HYPHENRANGELOOSE]:l[c.HYPHENRANGE];b=b.replace(L,X(this.options.includePrerelease)),o("hyphen replace",b),b=b.replace(l[c.COMPARATORTRIM],u),o("comparator trim",b),b=b.replace(l[c.TILDETRIM],d),o("tilde trim",b),b=b.replace(l[c.CARETTRIM],h),o("caret trim",b);let F=b.split(" ").map(q=>C(q,this.options)).join(" ").split(/\s+/).map(q=>ge(q,this.options));R&&(F=F.filter(q=>(o("loose invalid filter",q,this.options),!!q.match(l[c.COMPARATORLOOSE])))),o("range list",F);const P=new Map,H=F.map(q=>new i(q,this.options));for(const q of H){if(y(q))return[q];P.set(q.value,q)}P.size>1&&P.has("")&&P.delete("");const ue=[...P.values()];return n.set(k,ue),ue}intersects(b,I){if(!(b instanceof e))throw new TypeError("a Range is required");return this.set.some(k=>S(k,I)&&b.set.some(A=>S(A,I)&&k.every(R=>A.every(L=>R.intersects(L,I)))))}test(b){if(!b)return!1;if(typeof b=="string")try{b=new a(b,this.options)}catch{return!1}for(let I=0;I<this.set.length;I++)if(sr(this.set[I],b,this.options))return!0;return!1}}Sn=e;const r=jh,n=new r,s=is,i=en(),o=Xr,a=ae,{safeRe:l,t:c,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:h}=Yt,{FLAG_INCLUDE_PRERELEASE:f,FLAG_LOOSE:g}=Kr,y=E=>E.value==="<0.0.0-0",w=E=>E.value==="",S=(E,b)=>{let I=!0;const k=E.slice();let A=k.pop();for(;I&&k.length;)I=k.every(R=>A.intersects(R,b)),A=k.pop();return I},C=(E,b)=>(o("comp",E,b),E=M(E,b),o("caret",E),E=B(E,b),o("tildes",E),E=ne(E,b),o("xrange",E),E=K(E,b),o("stars",E),E),m=E=>!E||E.toLowerCase()==="x"||E==="*",B=(E,b)=>E.trim().split(/\s+/).map(I=>_(I,b)).join(" "),_=(E,b)=>{const I=b.loose?l[c.TILDELOOSE]:l[c.TILDE];return E.replace(I,(k,A,R,L,F)=>{o("tilde",E,k,A,R,L,F);let P;return m(A)?P="":m(R)?P=`>=${A}.0.0 <${+A+1}.0.0-0`:m(L)?P=`>=${A}.${R}.0 <${A}.${+R+1}.0-0`:F?(o("replaceTilde pr",F),P=`>=${A}.${R}.${L}-${F} <${A}.${+R+1}.0-0`):P=`>=${A}.${R}.${L} <${A}.${+R+1}.0-0`,o("tilde return",P),P})},M=(E,b)=>E.trim().split(/\s+/).map(I=>z(I,b)).join(" "),z=(E,b)=>{o("caret",E,b);const I=b.loose?l[c.CARETLOOSE]:l[c.CARET],k=b.includePrerelease?"-0":"";return E.replace(I,(A,R,L,F,P)=>{o("caret",E,A,R,L,F,P);let H;return m(R)?H="":m(L)?H=`>=${R}.0.0${k} <${+R+1}.0.0-0`:m(F)?R==="0"?H=`>=${R}.${L}.0${k} <${R}.${+L+1}.0-0`:H=`>=${R}.${L}.0${k} <${+R+1}.0.0-0`:P?(o("replaceCaret pr",P),R==="0"?L==="0"?H=`>=${R}.${L}.${F}-${P} <${R}.${L}.${+F+1}-0`:H=`>=${R}.${L}.${F}-${P} <${R}.${+L+1}.0-0`:H=`>=${R}.${L}.${F}-${P} <${+R+1}.0.0-0`):(o("no pr"),R==="0"?L==="0"?H=`>=${R}.${L}.${F}${k} <${R}.${L}.${+F+1}-0`:H=`>=${R}.${L}.${F}${k} <${R}.${+L+1}.0-0`:H=`>=${R}.${L}.${F} <${+R+1}.0.0-0`),o("caret return",H),H})},ne=(E,b)=>(o("replaceXRanges",E,b),E.split(/\s+/).map(I=>le(I,b)).join(" ")),le=(E,b)=>{E=E.trim();const I=b.loose?l[c.XRANGELOOSE]:l[c.XRANGE];return E.replace(I,(k,A,R,L,F,P)=>{o("xRange",E,k,A,R,L,F,P);const H=m(R),ue=H||m(L),q=ue||m(F),Nt=q;return A==="="&&Nt&&(A=""),P=b.includePrerelease?"-0":"",H?A===">"||A==="<"?k="<0.0.0-0":k="*":A&&Nt?(ue&&(L=0),F=0,A===">"?(A=">=",ue?(R=+R+1,L=0,F=0):(L=+L+1,F=0)):A==="<="&&(A="<",ue?R=+R+1:L=+L+1),A==="<"&&(P="-0"),k=`${A+R}.${L}.${F}${P}`):ue?k=`>=${R}.0.0${P} <${+R+1}.0.0-0`:q&&(k=`>=${R}.${L}.0${P} <${R}.${+L+1}.0-0`),o("xRange return",k),k})},K=(E,b)=>(o("replaceStars",E,b),E.trim().replace(l[c.STAR],"")),ge=(E,b)=>(o("replaceGTE0",E,b),E.trim().replace(l[b.includePrerelease?c.GTE0PRE:c.GTE0],"")),X=E=>(b,I,k,A,R,L,F,P,H,ue,q,Nt)=>(m(k)?I="":m(A)?I=`>=${k}.0.0${E?"-0":""}`:m(R)?I=`>=${k}.${A}.0${E?"-0":""}`:L?I=`>=${I}`:I=`>=${I}${E?"-0":""}`,m(H)?P="":m(ue)?P=`<${+H+1}.0.0-0`:m(q)?P=`<${H}.${+ue+1}.0-0`:Nt?P=`<=${H}.${ue}.${q}-${Nt}`:E?P=`<${H}.${ue}.${+q+1}-0`:P=`<=${P}`,`${I} ${P}`.trim()),sr=(E,b,I)=>{for(let k=0;k<E.length;k++)if(!E[k].test(b))return!1;if(b.prerelease.length&&!I.includePrerelease){for(let k=0;k<E.length;k++)if(o(E[k].semver),E[k].semver!==i.ANY&&E[k].semver.prerelease.length>0){const A=E[k].semver;if(A.major===b.major&&A.minor===b.minor&&A.patch===b.patch)return!0}return!1}return!0};return Sn}var Cn,ai;function en(){if(ai)return Cn;ai=1;const t=Symbol("SemVer ANY");class e{static get ANY(){return t}constructor(u,d){if(d=r(d),u instanceof e){if(u.loose===!!d.loose)return u;u=u.value}u=u.trim().split(/\s+/).join(" "),o("comparator",u,d),this.options=d,this.loose=!!d.loose,this.parse(u),this.semver===t?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(u){const d=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],h=u.match(d);if(!h)throw new TypeError(`Invalid comparator: ${u}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new a(h[2],this.options.loose):this.semver=t}toString(){return this.value}test(u){if(o("Comparator.test",u,this.options.loose),this.semver===t||u===t)return!0;if(typeof u=="string")try{u=new a(u,this.options)}catch{return!1}return i(u,this.operator,this.semver,this.options)}intersects(u,d){if(!(u instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new l(u.value,d).test(this.value):u.operator===""?u.value===""?!0:new l(this.value,d).test(u.semver):(d=r(d),d.includePrerelease&&(this.value==="<0.0.0-0"||u.value==="<0.0.0-0")||!d.includePrerelease&&(this.value.startsWith("<0.0.0")||u.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&u.operator.startsWith(">")||this.operator.startsWith("<")&&u.operator.startsWith("<")||this.semver.version===u.semver.version&&this.operator.includes("=")&&u.operator.includes("=")||i(this.semver,"<",u.semver,d)&&this.operator.startsWith(">")&&u.operator.startsWith("<")||i(this.semver,">",u.semver,d)&&this.operator.startsWith("<")&&u.operator.startsWith(">")))}}Cn=e;const r=is,{safeRe:n,t:s}=Yt,i=qo,o=Xr,a=ae,l=Ce();return Cn}const xh=Ce(),Bh=(t,e,r)=>{try{e=new xh(e,r)}catch{return!1}return e.test(t)};var tn=Bh;const Fh=Ce(),Dh=(t,e)=>new Fh(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var Hh=Dh;const Uh=ae,Vh=Ce(),Wh=(t,e,r)=>{let n=null,s=null,i=null;try{i=new Vh(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new Uh(n,r))}),n};var zh=Wh;const Gh=ae,qh=Ce(),Jh=(t,e,r)=>{let n=null,s=null,i=null;try{i=new qh(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new Gh(n,r))}),n};var Zh=Jh;const kn=ae,Qh=Ce(),ci=Yr,Kh=(t,e)=>{t=new Qh(t,e);let r=new kn("0.0.0");if(t.test(r)||(r=new kn("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){const s=t.set[n];let i=null;s.forEach(o=>{const a=new kn(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||ci(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||ci(r,i))&&(r=i)}return r&&t.test(r)?r:null};var Xh=Kh;const Yh=Ce(),ef=(t,e)=>{try{return new Yh(t,e).range||"*"}catch{return null}};var tf=ef;const rf=ae,Jo=en(),{ANY:nf}=Jo,sf=Ce(),of=tn,li=Yr,ui=as,af=ls,cf=cs,lf=(t,e,r,n)=>{t=new rf(t,n),e=new sf(e,n);let s,i,o,a,l;switch(r){case">":s=li,i=af,o=ui,a=">",l=">=";break;case"<":s=ui,i=cf,o=li,a="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(of(t,e,n))return!1;for(let c=0;c<e.set.length;++c){const u=e.set[c];let d=null,h=null;if(u.forEach(f=>{f.semver===nf&&(f=new Jo(">=0.0.0")),d=d||f,h=h||f,s(f.semver,d.semver,n)?d=f:o(f.semver,h.semver,n)&&(h=f)}),d.operator===a||d.operator===l||(!h.operator||h.operator===a)&&i(t,h.semver))return!1;if(h.operator===l&&o(t,h.semver))return!1}return!0};var us=lf;const uf=us,df=(t,e,r)=>uf(t,e,">",r);var hf=df;const ff=us,gf=(t,e,r)=>ff(t,e,"<",r);var pf=gf;const di=Ce(),mf=(t,e,r)=>(t=new di(t,r),e=new di(e,r),t.intersects(e,r));var bf=mf;const yf=tn,wf=Se;var Ef=(t,e,r)=>{const n=[];let s=null,i=null;const o=t.sort((u,d)=>wf(u,d,r));for(const u of o)yf(u,e,r)?(i=u,s||(s=u)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);const a=[];for(const[u,d]of n)u===d?a.push(u):!d&&u===o[0]?a.push("*"):d?u===o[0]?a.push(`<=${d}`):a.push(`${u} - ${d}`):a.push(`>=${u}`);const l=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return l.length<c.length?l:e};const hi=Ce(),ds=en(),{ANY:Rn}=ds,Lt=tn,hs=Se,_f=(t,e,r={})=>{if(t===e)return!0;t=new hi(t,r),e=new hi(e,r);let n=!1;e:for(const s of t.set){for(const i of e.set){const o=Sf(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},vf=[new ds(">=0.0.0-0")],fi=[new ds(">=0.0.0")],Sf=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Rn){if(e.length===1&&e[0].semver===Rn)return!0;r.includePrerelease?t=vf:t=fi}if(e.length===1&&e[0].semver===Rn){if(r.includePrerelease)return!0;e=fi}const n=new Set;let s,i;for(const f of t)f.operator===">"||f.operator===">="?s=gi(s,f,r):f.operator==="<"||f.operator==="<="?i=pi(i,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(s&&i){if(o=hs(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(const f of n){if(s&&!Lt(f,String(s),r)||i&&!Lt(f,String(i),r))return null;for(const g of e)if(!Lt(f,String(g),r))return!1;return!0}let a,l,c,u,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(const f of e){if(u=u||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",s){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator===">"||f.operator===">="){if(a=gi(s,f,r),a===f&&a!==s)return!1}else if(s.operator===">="&&!Lt(s.semver,String(f),r))return!1}if(i){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator==="<"||f.operator==="<="){if(l=pi(i,f,r),l===f&&l!==i)return!1}else if(i.operator==="<="&&!Lt(i.semver,String(f),r))return!1}if(!f.operator&&(i||s)&&o!==0)return!1}return!(s&&c&&!i&&o!==0||i&&u&&!s&&o!==0||h||d)},gi=(t,e,r)=>{if(!t)return e;const n=hs(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},pi=(t,e,r)=>{if(!t)return e;const n=hs(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};var Cf=_f;const In=Yt,mi=Kr,kf=ae,bi=Wo,Rf=At,If=Td,Af=Od,Nf=xd,Mf=Fd,Lf=Ud,Tf=zd,$f=Jd,Pf=Kd,Of=Se,jf=th,xf=sh,Bf=os,Ff=ch,Df=dh,Hf=Yr,Uf=as,Vf=zo,Wf=Go,zf=cs,Gf=ls,qf=qo,Jf=Ph,Zf=en(),Qf=Ce(),Kf=tn,Xf=Hh,Yf=zh,e0=Zh,t0=Xh,r0=tf,n0=us,s0=hf,i0=pf,o0=bf,a0=Ef,c0=Cf;var l0={parse:Rf,valid:If,clean:Af,inc:Nf,diff:Mf,major:Lf,minor:Tf,patch:$f,prerelease:Pf,compare:Of,rcompare:jf,compareLoose:xf,compareBuild:Bf,sort:Ff,rsort:Df,gt:Hf,lt:Uf,eq:Vf,neq:Wf,gte:zf,lte:Gf,cmp:qf,coerce:Jf,Comparator:Zf,Range:Qf,satisfies:Kf,toComparators:Xf,maxSatisfying:Yf,minSatisfying:e0,minVersion:t0,validRange:r0,outside:n0,gtr:s0,ltr:i0,intersects:o0,simplifyRange:a0,subset:c0,SemVer:kf,re:In.re,src:In.src,tokens:In.t,SEMVER_SPEC_VERSION:mi.SEMVER_SPEC_VERSION,RELEASE_TYPES:mi.RELEASE_TYPES,compareIdentifiers:bi.compareIdentifiers,rcompareIdentifiers:bi.rcompareIdentifiers};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.satisfiesVersionRange=t.gtRange=t.gtVersion=t.assertIsSemVerRange=t.assertIsSemVerVersion=t.isValidSemVerRange=t.isValidSemVerVersion=t.VersionRangeStruct=t.VersionStruct=void 0;const e=l0,r=rt,n=re;t.VersionStruct=(0,r.refine)((0,r.string)(),"Version",d=>(0,e.valid)(d)===null?`Expected SemVer version, got "${d}"`:!0),t.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",d=>(0,e.validRange)(d)===null?`Expected SemVer range, got "${d}"`:!0);function s(d){return(0,r.is)(d,t.VersionStruct)}t.isValidSemVerVersion=s;function i(d){return(0,r.is)(d,t.VersionRangeStruct)}t.isValidSemVerRange=i;function o(d){(0,n.assertStruct)(d,t.VersionStruct)}t.assertIsSemVerVersion=o;function a(d){(0,n.assertStruct)(d,t.VersionRangeStruct)}t.assertIsSemVerRange=a;function l(d,h){return(0,e.gt)(d,h)}t.gtVersion=l;function c(d,h){return(0,e.gtr)(d,h)}t.gtRange=c;function u(d,h){return(0,e.satisfies)(d,h,{includePrerelease:!0})}t.satisfiesVersionRange=u})(Ho);(function(t){var e=p.commonjsGlobal&&p.commonjsGlobal.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i);var a=Object.getOwnPropertyDescriptor(s,i);(!a||("get"in a?!s.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,o,a)}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=p.commonjsGlobal&&p.commonjsGlobal.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(re,t),r(Kt,t),r(x,t),r(Zr,t),r(Te,t),r(wt,t),r(Po,t),r(Xt,t),r(Oo,t),r(jo,t),r(Et,t),r(xo,t),r($e,t),r(Bo,t),r(Fo,t),r(Do,t),r(Ho,t)})(po);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createModuleLogger=t.projectLogger=void 0;const e=po;Object.defineProperty(t,"createModuleLogger",{enumerable:!0,get:function(){return e.createModuleLogger}}),t.projectLogger=(0,e.createProjectLogger)("eth-block-tracker")})(go);var Zo=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qr,"__esModule",{value:!0});qr.PollingBlockTracker=void 0;const u0=Zo(Qn),d0=Zo(Ol),h0=qt,yi=go,wi=(0,yi.createModuleLogger)(yi.projectLogger,"polling-block-tracker"),f0=(0,u0.default)(),g0=1e3;class p0 extends h0.BaseBlockTracker{constructor(e={}){var r;if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},e),{blockResetDuration:(r=e.blockResetDuration)!==null&&r!==void 0?r:e.pollingInterval})),this._provider=e.provider,this._pollingInterval=e.pollingInterval||20*g0,this._retryTimeout=e.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=e.keepEventLoopActive===void 0?!0:e.keepEventLoopActive,this._setSkipCacheFlag=e.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var e;this._isRunning;)try{await this._updateLatestBlock();const r=Ei(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await r}catch(r){const n=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:
3
+ ${(e=r.stack)!==null&&e!==void 0?e:r}`);try{this.emit("error",n)}catch{console.error(n)}const s=Ei(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await s}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const e={jsonrpc:"2.0",id:f0(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0),wi("Making request",e);const r=await(0,d0.default)(n=>this._provider.sendAsync(e,n))();if(wi("Got response",r),r.error)throw new Error(`PollingBlockTracker - encountered error fetching block:
4
+ ${r.error.message}`);return r.result}}qr.PollingBlockTracker=p0;function Ei(t,e){return new Promise(r=>{const n=setTimeout(r,t);n.unref&&e&&n.unref()})}var rn={},m0=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rn,"__esModule",{value:!0});rn.SubscribeBlockTracker=void 0;const b0=m0(Qn),y0=qt,w0=(0,b0.default)();class E0 extends y0.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(this._subscriptionId===void 0||this._subscriptionId===null)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(this._subscriptionId!==null&&this._subscriptionId!==void 0)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(e){this.emit("error",e)}}_call(e,...r){return new Promise((n,s)=>{this._provider.sendAsync({id:w0(),method:e,params:r,jsonrpc:"2.0"},(i,o)=>{i?s(i):n(o.result)})})}_handleSubData(e,r){var n;r.method==="eth_subscription"&&((n=r.params)===null||n===void 0?void 0:n.subscription)===this._subscriptionId&&this._newPotentialLatest(r.params.result.number)}}rn.SubscribeBlockTracker=E0;(function(t){var e=p.commonjsGlobal&&p.commonjsGlobal.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i),Object.defineProperty(n,o,{enumerable:!0,get:function(){return s[i]}})}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=p.commonjsGlobal&&p.commonjsGlobal.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(qr,t),r(rn,t)})(fo);var fs={},nn={},er={};Object.defineProperty(er,"__esModule",{value:!0});er.getUniqueId=void 0;const Qo=4294967295;let An=Math.floor(Math.random()*Qo);function _0(){return An=(An+1)%Qo,An}er.getUniqueId=_0;Object.defineProperty(nn,"__esModule",{value:!0});nn.createIdRemapMiddleware=void 0;const v0=er;function S0(){return(t,e,r,n)=>{const s=t.id,i=v0.getUniqueId();t.id=i,e.id=i,r(o=>{t.id=s,e.id=s,o()})}}nn.createIdRemapMiddleware=S0;var sn={};Object.defineProperty(sn,"__esModule",{value:!0});sn.createAsyncMiddleware=void 0;function C0(t){return async(e,r,n,s)=>{let i;const o=new Promise(u=>{i=u});let a=null,l=!1;const c=async()=>{l=!0,n(u=>{a=u,i()}),await o};try{await t(e,r,c),l?(await o,a(null)):s(null)}catch(u){a?a(u):s(u)}}}sn.createAsyncMiddleware=C0;var on={};Object.defineProperty(on,"__esModule",{value:!0});on.createScaffoldMiddleware=void 0;function k0(t){return(e,r,n,s)=>{const i=t[e.method];return i===void 0?n():typeof i=="function"?i(e,r,n,s):(r.result=i,s())}}on.createScaffoldMiddleware=k0;var tr={},gs={};Object.defineProperty(gs,"__esModule",{value:!0});const R0=p.eventsExports;function _i(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function I0(t){const e=t.length,r=new Array(e);for(let n=0;n<e;n+=1)r[n]=t[n];return r}let A0=class extends R0.EventEmitter{emit(e,...r){let n=e==="error";const s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){let o;if(r.length>0&&([o]=r),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const i=s[e];if(i===void 0)return!1;if(typeof i=="function")_i(i,this,r);else{const o=i.length,a=I0(i);for(let l=0;l<o;l+=1)_i(a[l],this,r)}return!0}};gs.default=A0;var Ko={},He={},N0=xt;xt.default=xt;xt.stable=ea;xt.stableStringify=ea;var wr="[...]",Xo="[Circular]",Ye=[],Qe=[];function Yo(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function xt(t,e,r,n){typeof n>"u"&&(n=Yo()),xn(t,"",0,[],void 0,0,n);var s;try{Qe.length===0?s=JSON.stringify(t,e,r):s=JSON.stringify(t,ta(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Ye.length!==0;){var i=Ye.pop();i.length===4?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}}return s}function gt(t,e,r,n){var s=Object.getOwnPropertyDescriptor(n,r);s.get!==void 0?s.configurable?(Object.defineProperty(n,r,{value:t}),Ye.push([n,r,e,s])):Qe.push([e,r,t]):(n[r]=t,Ye.push([n,r,e]))}function xn(t,e,r,n,s,i,o){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;a<n.length;a++)if(n[a]===t){gt(Xo,t,e,s);return}if(typeof o.depthLimit<"u"&&i>o.depthLimit){gt(wr,t,e,s);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){gt(wr,t,e,s);return}if(n.push(t),Array.isArray(t))for(a=0;a<t.length;a++)xn(t[a],a,a,n,t,i,o);else{var l=Object.keys(t);for(a=0;a<l.length;a++){var c=l[a];xn(t[c],c,a,n,t,i,o)}}n.pop()}}function M0(t,e){return t<e?-1:t>e?1:0}function ea(t,e,r,n){typeof n>"u"&&(n=Yo());var s=Bn(t,"",0,[],void 0,0,n)||t,i;try{Qe.length===0?i=JSON.stringify(s,e,r):i=JSON.stringify(s,ta(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Ye.length!==0;){var o=Ye.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function Bn(t,e,r,n,s,i,o){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;a<n.length;a++)if(n[a]===t){gt(Xo,t,e,s);return}try{if(typeof t.toJSON=="function")return}catch{return}if(typeof o.depthLimit<"u"&&i>o.depthLimit){gt(wr,t,e,s);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){gt(wr,t,e,s);return}if(n.push(t),Array.isArray(t))for(a=0;a<t.length;a++)Bn(t[a],a,a,n,t,i,o);else{var l={},c=Object.keys(t).sort(M0);for(a=0;a<c.length;a++){var u=c[a];Bn(t[u],u,a,n,t,i,o),l[u]=t[u]}if(typeof s<"u")Ye.push([s,e,t]),s[e]=l;else return l}n.pop()}}function ta(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(Qe.length>0)for(var n=0;n<Qe.length;n++){var s=Qe[n];if(s[1]===e&&s[0]===r){r=s[2],Qe.splice(n,1);break}}return t.call(this,e,r)}}Object.defineProperty(He,"__esModule",{value:!0});He.EthereumProviderError=He.EthereumRpcError=void 0;const L0=N0;class ra extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}serialize(){const e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return L0.default(this.serialize(),P0,2)}}He.EthereumRpcError=ra;class T0 extends ra{constructor(e,r,n){if(!$0(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}}He.EthereumProviderError=T0;function $0(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function P0(t,e){if(e!=="[Circular]")return e}var ps={},Ue={};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.errorValues=Ue.errorCodes=void 0;Ue.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}};Ue.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=Ue,r=He,n=e.errorCodes.rpc.internal,s="Unspecified error message. This is a bug, please report it.",i={code:n,message:o(n)};t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function o(h,f=s){if(Number.isInteger(h)){const g=h.toString();if(d(e.errorValues,g))return e.errorValues[g].message;if(c(h))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return f}t.getMessageFromCode=o;function a(h){if(!Number.isInteger(h))return!1;const f=h.toString();return!!(e.errorValues[f]||c(h))}t.isValidCode=a;function l(h,{fallbackError:f=i,shouldIncludeStack:g=!1}={}){var y,w;if(!f||!Number.isInteger(f.code)||typeof f.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(h instanceof r.EthereumRpcError)return h.serialize();const S={};if(h&&typeof h=="object"&&!Array.isArray(h)&&d(h,"code")&&a(h.code)){const m=h;S.code=m.code,m.message&&typeof m.message=="string"?(S.message=m.message,d(m,"data")&&(S.data=m.data)):(S.message=o(S.code),S.data={originalError:u(h)})}else{S.code=f.code;const m=(y=h)===null||y===void 0?void 0:y.message;S.message=m&&typeof m=="string"?m:f.message,S.data={originalError:u(h)}}const C=(w=h)===null||w===void 0?void 0:w.stack;return g&&h&&C&&typeof C=="string"&&(S.stack=C),S}t.serializeError=l;function c(h){return h>=-32099&&h<=-32e3}function u(h){return h&&typeof h=="object"&&!Array.isArray(h)?Object.assign({},h):h}function d(h,f){return Object.prototype.hasOwnProperty.call(h,f)}})(ps);var an={};Object.defineProperty(an,"__esModule",{value:!0});an.ethErrors=void 0;const ms=He,na=ps,se=Ue;an.ethErrors={rpc:{parse:t=>me(se.errorCodes.rpc.parse,t),invalidRequest:t=>me(se.errorCodes.rpc.invalidRequest,t),invalidParams:t=>me(se.errorCodes.rpc.invalidParams,t),methodNotFound:t=>me(se.errorCodes.rpc.methodNotFound,t),internal:t=>me(se.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return me(e,t)},invalidInput:t=>me(se.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>me(se.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>me(se.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>me(se.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>me(se.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>me(se.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Tt(se.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>Tt(se.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>Tt(se.errorCodes.provider.unsupportedMethod,t),disconnected:t=>Tt(se.errorCodes.provider.disconnected,t),chainDisconnected:t=>Tt(se.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new ms.EthereumProviderError(e,r,n)}}};function me(t,e){const[r,n]=sa(e);return new ms.EthereumRpcError(t,r||na.getMessageFromCode(t),n)}function Tt(t,e){const[r,n]=sa(e);return new ms.EthereumProviderError(t,r||na.getMessageFromCode(t),n)}function sa(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=He;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const r=ps;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=an;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const s=Ue;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return s.errorCodes}})})(Ko);var O0=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tr,"__esModule",{value:!0});tr.JsonRpcEngine=void 0;const j0=O0(gs),be=Ko;class Pe extends j0.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?r?this._handleBatch(e,r):this._handleBatch(e):r?this._handle(e,r):this._promiseHandle(e)}asMiddleware(){return async(e,r,n,s)=>{try{const[i,o,a]=await Pe._runAllMiddleware(e,r,this._middleware);return o?(await Pe._runReturnHandlers(a),s(i)):n(async l=>{try{await Pe._runReturnHandlers(a)}catch(c){return l(c)}return l()})}catch(i){return s(i)}}}async _handleBatch(e,r){try{const n=await Promise.all(e.map(this._promiseHandle.bind(this)));return r?r(null,n):n}catch(n){if(r)return r(n);throw n}}_promiseHandle(e){return new Promise(r=>{this._handle(e,(n,s)=>{r(s)})})}async _handle(e,r){if(!e||Array.isArray(e)||typeof e!="object"){const o=new be.EthereumRpcError(be.errorCodes.rpc.invalidRequest,`Requests must be plain objects. Received: ${typeof e}`,{request:e});return r(o,{id:void 0,jsonrpc:"2.0",error:o})}if(typeof e.method!="string"){const o=new be.EthereumRpcError(be.errorCodes.rpc.invalidRequest,`Must specify a string method. Received: ${typeof e.method}`,{request:e});return r(o,{id:e.id,jsonrpc:"2.0",error:o})}const n=Object.assign({},e),s={id:n.id,jsonrpc:n.jsonrpc};let i=null;try{await this._processRequest(n,s)}catch(o){i=o}return i&&(delete s.result,s.error||(s.error=be.serializeError(i))),r(i,s)}async _processRequest(e,r){const[n,s,i]=await Pe._runAllMiddleware(e,r,this._middleware);if(Pe._checkForCompletion(e,r,s),await Pe._runReturnHandlers(i),n)throw n}static async _runAllMiddleware(e,r,n){const s=[];let i=null,o=!1;for(const a of n)if([i,o]=await Pe._runMiddleware(e,r,a,s),o)break;return[i,o,s.reverse()]}static _runMiddleware(e,r,n,s){return new Promise(i=>{const o=l=>{const c=l||r.error;c&&(r.error=be.serializeError(c)),i([c,!0])},a=l=>{r.error?o(r.error):(l&&(typeof l!="function"&&o(new be.EthereumRpcError(be.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof l}" for request:
5
+ ${Nn(e)}`,{request:e})),s.push(l)),i([null,!1]))};try{n(e,r,a,o)}catch(l){o(l)}})}static async _runReturnHandlers(e){for(const r of e)await new Promise((n,s)=>{r(i=>i?s(i):n())})}static _checkForCompletion(e,r,n){if(!("result"in r)&&!("error"in r))throw new be.EthereumRpcError(be.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:
6
+ ${Nn(e)}`,{request:e});if(!n)throw new be.EthereumRpcError(be.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:
7
+ ${Nn(e)}`,{request:e})}}tr.JsonRpcEngine=Pe;function Nn(t){return JSON.stringify(t,null,2)}var cn={};Object.defineProperty(cn,"__esModule",{value:!0});cn.mergeMiddleware=void 0;const x0=tr;function B0(t){const e=new x0.JsonRpcEngine;return t.forEach(r=>e.push(r)),e.asMiddleware()}cn.mergeMiddleware=B0;(function(t){var e=p.commonjsGlobal&&p.commonjsGlobal.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i),Object.defineProperty(n,o,{enumerable:!0,get:function(){return s[i]}})}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=p.commonjsGlobal&&p.commonjsGlobal.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(nn,t),r(sn,t),r(on,t),r(er,t),r(tr,t),r(cn,t)})(fs);var ia={},bs={},Fn=function(t,e){return Fn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Fn(t,e)};function oa(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Fn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Er=function(){return Er=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Er.apply(this,arguments)};function aa(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function ca(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function la(t,e){return function(r,n){e(r,n,t)}}function F0(t,e,r,n,s,i){function o(S){if(S!==void 0&&typeof S!="function")throw new TypeError("Function expected");return S}for(var a=n.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,u=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),d,h=!1,f=r.length-1;f>=0;f--){var g={};for(var y in n)g[y]=y==="access"?{}:n[y];for(var y in n.access)g.access[y]=n.access[y];g.addInitializer=function(S){if(h)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(S||null))};var w=(0,r[f])(a==="accessor"?{get:u.get,set:u.set}:u[l],g);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(d=o(w.get))&&(u.get=d),(d=o(w.set))&&(u.set=d),(d=o(w.init))&&s.unshift(d)}else(d=o(w))&&(a==="field"?s.unshift(d):u[l]=d)}c&&Object.defineProperty(c,n.name,u),h=!0}function D0(t,e,r){for(var n=arguments.length>2,s=0;s<e.length;s++)r=n?e[s].call(t,r):e[s].call(t);return n?r:void 0}function H0(t){return typeof t=="symbol"?t:"".concat(t)}function U0(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function ua(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function da(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(n.next(u))}catch(d){o(d)}}function l(u){try{c(n.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}function ha(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,s=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(u){c=[6,u],s=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}var ln=Object.create?function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};function fa(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ln(e,t,r)}function _r(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ys(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function ga(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(ys(arguments[e]));return t}function pa(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,s++)n[s]=i[o];return n}function ma(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function _t(t){return this instanceof _t?(this.v=t,this):new _t(t)}function ba(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(f){return function(g){return Promise.resolve(g).then(f,d)}}function a(f,g){n[f]&&(s[f]=function(y){return new Promise(function(w,S){i.push([f,y,w,S])>1||l(f,y)})},g&&(s[f]=g(s[f])))}function l(f,g){try{c(n[f](g))}catch(y){h(i[0][3],y)}}function c(f){f.value instanceof _t?Promise.resolve(f.value.v).then(u,d):h(i[0][2],f)}function u(f){l("next",f)}function d(f){l("throw",f)}function h(f,g){f(g),i.shift(),i.length&&l(i[0][0],i[0][1])}}function ya(t){var e,r;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=t[s]?function(o){return(r=!r)?{value:_t(t[s](o)),done:!1}:i?i(o):o}:i}}function wa(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof _r=="function"?_r(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),s(a,l,o.done,o.value)})}}function s(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function Ea(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var V0=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function _a(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ln(e,t,r);return V0(e,t),e}function va(t){return t&&t.__esModule?t:{default:t}}function Sa(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function Ca(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r}function ka(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Ra(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,s;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(s=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");s&&(n=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}var W0=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};function Ia(t){function e(i){t.error=t.hasError?new W0(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function s(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(s);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(s,function(o){return e(o),s()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return s()}const z0={__extends:oa,__assign:Er,__rest:aa,__decorate:ca,__param:la,__metadata:ua,__awaiter:da,__generator:ha,__createBinding:ln,__exportStar:fa,__values:_r,__read:ys,__spread:ga,__spreadArrays:pa,__spreadArray:ma,__await:_t,__asyncGenerator:ba,__asyncDelegator:ya,__asyncValues:wa,__makeTemplateObject:Ea,__importStar:_a,__importDefault:va,__classPrivateFieldGet:Sa,__classPrivateFieldSet:Ca,__classPrivateFieldIn:ka,__addDisposableResource:Ra,__disposeResources:Ia},G0=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:Ra,get __assign(){return Er},__asyncDelegator:ya,__asyncGenerator:ba,__asyncValues:wa,__await:_t,__awaiter:da,__classPrivateFieldGet:Sa,__classPrivateFieldIn:ka,__classPrivateFieldSet:Ca,__createBinding:ln,__decorate:ca,__disposeResources:Ia,__esDecorate:F0,__exportStar:fa,__extends:oa,__generator:ha,__importDefault:va,__importStar:_a,__makeTemplateObject:Ea,__metadata:ua,__param:la,__propKey:H0,__read:ys,__rest:aa,__runInitializers:D0,__setFunctionName:U0,__spread:ga,__spreadArray:ma,__spreadArrays:pa,__values:_r,default:z0},Symbol.toStringTag,{value:"Module"})),ws=p.getAugmentedNamespace(G0);var un={};Object.defineProperty(un,"__esModule",{value:!0});var vi=ws,q0=function(){function t(e){if(this._maxConcurrency=e,this._queue=[],e<=0)throw new Error("semaphore must be initialized to a positive value");this._value=e}return t.prototype.acquire=function(){var e=this,r=this.isLocked(),n=new Promise(function(s){return e._queue.push(s)});return r||this._dispatch(),n},t.prototype.runExclusive=function(e){return vi.__awaiter(this,void 0,void 0,function(){var r,n,s;return vi.__generator(this,function(i){switch(i.label){case 0:return[4,this.acquire()];case 1:r=i.sent(),n=r[0],s=r[1],i.label=2;case 2:return i.trys.push([2,,4,5]),[4,e(n)];case 3:return[2,i.sent()];case 4:return s(),[7];case 5:return[2]}})})},t.prototype.isLocked=function(){return this._value<=0},t.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()}},t.prototype._dispatch=function(){var e=this,r=this._queue.shift();if(r){var n=!1;this._currentReleaser=function(){n||(n=!0,e._value++,e._dispatch())},r([this._value--,this._currentReleaser])}},t}();un.default=q0;Object.defineProperty(bs,"__esModule",{value:!0});var Si=ws,J0=un,Z0=function(){function t(){this._semaphore=new J0.default(1)}return t.prototype.acquire=function(){return Si.__awaiter(this,void 0,void 0,function(){var e,r;return Si.__generator(this,function(n){switch(n.label){case 0:return[4,this._semaphore.acquire()];case 1:return e=n.sent(),r=e[1],[2,r]}})})},t.prototype.runExclusive=function(e){return this._semaphore.runExclusive(function(){return e()})},t.prototype.isLocked=function(){return this._semaphore.isLocked()},t.prototype.release=function(){this._semaphore.release()},t}();bs.default=Z0;var dn={};Object.defineProperty(dn,"__esModule",{value:!0});dn.withTimeout=void 0;var pr=ws;function Q0(t,e,r){var n=this;return r===void 0&&(r=new Error("timeout")),{acquire:function(){return new Promise(function(s,i){return pr.__awaiter(n,void 0,void 0,function(){var o,a,l;return pr.__generator(this,function(c){switch(c.label){case 0:return o=!1,setTimeout(function(){o=!0,i(r)},e),[4,t.acquire()];case 1:return a=c.sent(),o?(l=Array.isArray(a)?a[1]:a,l()):s(a),[2]}})})})},runExclusive:function(s){return pr.__awaiter(this,void 0,void 0,function(){var i,o;return pr.__generator(this,function(a){switch(a.label){case 0:i=function(){},a.label=1;case 1:return a.trys.push([1,,7,8]),[4,this.acquire()];case 2:return o=a.sent(),Array.isArray(o)?(i=o[1],[4,s(o[0])]):[3,4];case 3:return[2,a.sent()];case 4:return i=o,[4,s()];case 5:return[2,a.sent()];case 6:return[3,8];case 7:return i(),[7];case 8:return[2]}})})},release:function(){t.release()},isLocked:function(){return t.isLocked()}}}dn.withTimeout=Q0;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.withTimeout=t.Semaphore=t.Mutex=void 0;var e=bs;Object.defineProperty(t,"Mutex",{enumerable:!0,get:function(){return e.default}});var r=un;Object.defineProperty(t,"Semaphore",{enumerable:!0,get:function(){return r.default}});var n=dn;Object.defineProperty(t,"withTimeout",{enumerable:!0,get:function(){return n.withTimeout}})})(ia);var K0=Y0,X0=Object.prototype.hasOwnProperty;function Y0(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var n in r)X0.call(r,n)&&(t[n]=r[n])}return t}const e1=K0,t1=Qn();var r1=N;function N(t){const e=this;e.currentProvider=t}N.prototype.getBalance=rr(2,"eth_getBalance");N.prototype.getCode=rr(2,"eth_getCode");N.prototype.getTransactionCount=rr(2,"eth_getTransactionCount");N.prototype.getStorageAt=rr(3,"eth_getStorageAt");N.prototype.call=rr(2,"eth_call");N.prototype.protocolVersion=$("eth_protocolVersion");N.prototype.syncing=$("eth_syncing");N.prototype.coinbase=$("eth_coinbase");N.prototype.mining=$("eth_mining");N.prototype.hashrate=$("eth_hashrate");N.prototype.gasPrice=$("eth_gasPrice");N.prototype.accounts=$("eth_accounts");N.prototype.blockNumber=$("eth_blockNumber");N.prototype.getBlockTransactionCountByHash=$("eth_getBlockTransactionCountByHash");N.prototype.getBlockTransactionCountByNumber=$("eth_getBlockTransactionCountByNumber");N.prototype.getUncleCountByBlockHash=$("eth_getUncleCountByBlockHash");N.prototype.getUncleCountByBlockNumber=$("eth_getUncleCountByBlockNumber");N.prototype.sign=$("eth_sign");N.prototype.sendTransaction=$("eth_sendTransaction");N.prototype.sendRawTransaction=$("eth_sendRawTransaction");N.prototype.estimateGas=$("eth_estimateGas");N.prototype.getBlockByHash=$("eth_getBlockByHash");N.prototype.getBlockByNumber=$("eth_getBlockByNumber");N.prototype.getTransactionByHash=$("eth_getTransactionByHash");N.prototype.getTransactionByBlockHashAndIndex=$("eth_getTransactionByBlockHashAndIndex");N.prototype.getTransactionByBlockNumberAndIndex=$("eth_getTransactionByBlockNumberAndIndex");N.prototype.getTransactionReceipt=$("eth_getTransactionReceipt");N.prototype.getUncleByBlockHashAndIndex=$("eth_getUncleByBlockHashAndIndex");N.prototype.getUncleByBlockNumberAndIndex=$("eth_getUncleByBlockNumberAndIndex");N.prototype.getCompilers=$("eth_getCompilers");N.prototype.compileLLL=$("eth_compileLLL");N.prototype.compileSolidity=$("eth_compileSolidity");N.prototype.compileSerpent=$("eth_compileSerpent");N.prototype.newFilter=$("eth_newFilter");N.prototype.newBlockFilter=$("eth_newBlockFilter");N.prototype.newPendingTransactionFilter=$("eth_newPendingTransactionFilter");N.prototype.uninstallFilter=$("eth_uninstallFilter");N.prototype.getFilterChanges=$("eth_getFilterChanges");N.prototype.getFilterLogs=$("eth_getFilterLogs");N.prototype.getLogs=$("eth_getLogs");N.prototype.getWork=$("eth_getWork");N.prototype.submitWork=$("eth_submitWork");N.prototype.submitHashrate=$("eth_submitHashrate");N.prototype.sendAsync=function(t,e){this.currentProvider.sendAsync(n1(t),function(n,s){if(!n&&s.error&&(n=new Error("EthQuery - RPC Error - "+s.error.message)),n)return e(n);e(null,s.result)})};function $(t){return function(){const e=this;var r=[].slice.call(arguments),n=r.pop();e.sendAsync({method:t,params:r},n)}}function rr(t,e){return function(){const r=this;var n=[].slice.call(arguments),s=n.pop();n.length<t&&n.push("latest"),r.sendAsync({method:e,params:n},s)}}function n1(t){return e1({id:t1(),jsonrpc:"2.0",params:[]},t)}const Ci=(t,e,r,n)=>function(...s){const i=e.promiseModule;return new i((o,a)=>{e.multiArgs?s.push((...c)=>{e.errorFirst?c[0]?a(c):(c.shift(),o(c)):o(c)}):e.errorFirst?s.push((c,u)=>{c?a(c):o(u)}):s.push(o),Reflect.apply(t,this===r?n:this,s)})},ki=new WeakMap;var s1=(t,e)=>{e={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...e};const r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);const n=(o,a)=>{let l=ki.get(o);if(l||(l={},ki.set(o,l)),a in l)return l[a];const c=g=>typeof g=="string"||typeof a=="symbol"?a===g:g.test(a),u=Reflect.getOwnPropertyDescriptor(o,a),d=u===void 0||u.writable||u.configurable,f=(e.include?e.include.some(c):!e.exclude.some(c))&&d;return l[a]=f,f},s=new WeakMap,i=new Proxy(t,{apply(o,a,l){const c=s.get(o);if(c)return Reflect.apply(c,a,l);const u=e.excludeMain?o:Ci(o,e,i,o);return s.set(o,u),Reflect.apply(u,a,l)},get(o,a){const l=o[a];if(!n(o,a)||l===Function.prototype[a])return l;const c=s.get(l);if(c)return c;if(typeof l=="function"){const u=Ci(l,e,i,o);return s.set(l,u),u}return l}});return i};const i1=Jt.default;let o1=class extends i1{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(r=>this.emit("update",r))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}};var Es=o1;const a1=Es;let c1=class extends a1{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}};var l1=c1,nr={minBlockRef:u1,maxBlockRef:d1,sortBlockRefs:_s,bnToHex:h1,blockRefIsNumber:f1,hexToInt:vr,incrementHexInt:g1,intToHex:Aa,unsafeRandomBytes:p1};function u1(...t){return _s(t)[0]}function d1(...t){const e=_s(t);return e[e.length-1]}function _s(t){return t.sort((e,r)=>e==="latest"||r==="earliest"?1:r==="latest"||e==="earliest"?-1:vr(e)-vr(r))}function h1(t){return"0x"+t.toString(16)}function f1(t){return t&&!["earliest","latest","pending"].includes(t)}function vr(t){return t==null?t:Number.parseInt(t,16)}function g1(t){if(t==null)return t;const e=vr(t);return Aa(e+1)}function Aa(t){if(t==null)return t;let e=t.toString(16);return e.length%2&&(e="0"+e),"0x"+e}function p1(t){let e="0x";for(let r=0;r<t;r++)e+=Ri(),e+=Ri();return e}function Ri(){return Math.floor(Math.random()*16).toString(16)}const m1=r1,b1=s1,y1=l1,{bnToHex:Mg,hexToInt:mr,incrementHexInt:w1,minBlockRef:E1,blockRefIsNumber:_1}=nr;let v1=class extends y1{constructor({provider:e,params:r}){super(),this.type="log",this.ethQuery=new m1(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},r),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map(n=>n.toLowerCase()))}async initialize({currentBlock:e}){let r=this.params.fromBlock;["latest","pending"].includes(r)&&(r=e),r==="earliest"&&(r="0x0"),this.params.fromBlock=r;const n=E1(this.params.toBlock,e),s=Object.assign({},this.params,{toBlock:n}),i=await this._fetchLogs(s);this.addInitialResults(i)}async update({oldBlock:e,newBlock:r}){const n=r;let s;e?s=w1(e):s=r;const i=Object.assign({},this.params,{fromBlock:s,toBlock:n}),a=(await this._fetchLogs(i)).filter(l=>this.matchLog(l));this.addResults(a)}async _fetchLogs(e){return await b1(n=>this.ethQuery.getLogs(e,n))()}matchLog(e){if(mr(this.params.fromBlock)>=mr(e.blockNumber)||_1(this.params.toBlock)&&mr(this.params.toBlock)<=mr(e.blockNumber))return!1;const r=e.address&&e.address.toLowerCase();return this.params.address&&r&&!this.params.address.includes(r)?!1:this.params.topics.every((s,i)=>{let o=e.topics[i];if(!o)return!1;o=o.toLowerCase();let a=Array.isArray(s)?s:[s];return a.includes(null)?!0:(a=a.map(u=>u.toLowerCase()),a.includes(o))})}};var S1=v1,vs=C1;async function C1({provider:t,fromBlock:e,toBlock:r}){e||(e=r);const n=Ii(e),i=Ii(r)-n+1,o=Array(i).fill().map((l,c)=>n+c).map(k1);let a=await Promise.all(o.map(l=>I1(t,"eth_getBlockByNumber",[l,!1])));return a=a.filter(l=>l!==null),a}function Ii(t){return t==null?t:Number.parseInt(t,16)}function k1(t){return t==null?t:"0x"+t.toString(16)}function R1(t,e){return new Promise((r,n)=>{t.sendAsync(e,(s,i)=>{s?n(s):i.error?n(i.error):i.result?r(i.result):n(new Error("Result was empty"))})})}async function I1(t,e,r){for(let n=0;n<3;n++)try{return await R1(t,{id:1,jsonrpc:"2.0",method:e,params:r})}catch(s){console.error(`provider.sendAsync failed: ${s.stack||s.message||s}`)}return null}const A1=Es,N1=vs,{incrementHexInt:M1}=nr;let L1=class extends A1{constructor({provider:e,params:r}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:r}){const n=r,s=M1(e),o=(await N1({provider:this.provider,fromBlock:s,toBlock:n})).map(a=>a.hash);this.addResults(o)}};var T1=L1;const $1=Es,P1=vs,{incrementHexInt:O1}=nr;let j1=class extends $1{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const r=e,n=O1(e),s=await P1({provider:this.provider,fromBlock:n,toBlock:r}),i=[];for(const o of s)i.push(...o.transactions);this.addResults(i)}};var x1=j1;const B1=ia.Mutex,{createAsyncMiddleware:F1,createScaffoldMiddleware:D1}=fs,H1=S1,U1=T1,V1=x1,{intToHex:Na,hexToInt:Mn}=nr;var W1=z1;function z1({blockTracker:t,provider:e}){let r=0,n={};const s=new B1,i=G1({mutex:s}),o=D1({eth_newFilter:i(Ln(l)),eth_newBlockFilter:i(Ln(c)),eth_newPendingTransactionFilter:i(Ln(u)),eth_uninstallFilter:i(yr(f)),eth_getFilterChanges:i(yr(d)),eth_getFilterLogs:i(yr(h))}),a=async({oldBlock:C,newBlock:m})=>{if(n.length===0)return;const B=await s.acquire();try{await Promise.all(ct(n).map(async _=>{try{await _.update({oldBlock:C,newBlock:m})}catch(M){console.error(M)}}))}catch(_){console.error(_)}B()};return o.newLogFilter=l,o.newBlockFilter=c,o.newPendingTransactionFilter=u,o.uninstallFilter=f,o.getFilterChanges=d,o.getFilterLogs=h,o.destroy=()=>{w()},o;async function l(C){const m=new H1({provider:e,params:C});return await g(m),m}async function c(){const C=new U1({provider:e});return await g(C),C}async function u(){const C=new V1({provider:e});return await g(C),C}async function d(C){const m=Mn(C),B=n[m];if(!B)throw new Error(`No filter for index "${m}"`);return B.getChangesAndClear()}async function h(C){const m=Mn(C),B=n[m];if(!B)throw new Error(`No filter for index "${m}"`);let _=[];return B.type==="log"&&(_=B.getAllResults()),_}async function f(C){const m=Mn(C),_=!!n[m];return _&&await y(m),_}async function g(C){const m=ct(n).length,B=await t.getLatestBlock();await C.initialize({currentBlock:B}),r++,n[r]=C,C.id=r,C.idHex=Na(r);const _=ct(n).length;return S({prevFilterCount:m,newFilterCount:_}),r}async function y(C){const m=ct(n).length;delete n[C];const B=ct(n).length;S({prevFilterCount:m,newFilterCount:B})}async function w(){const C=ct(n).length;n={},S({prevFilterCount:C,newFilterCount:0})}function S({prevFilterCount:C,newFilterCount:m}){if(C===0&&m>0){t.on("sync",a);return}if(C>0&&m===0){t.removeListener("sync",a);return}}}function Ln(t){return yr(async(...e)=>{const r=await t(...e);return Na(r.id)})}function yr(t){return F1(async(e,r)=>{const n=await t.apply(null,e.params);r.result=n})}function G1({mutex:t}){return e=>async(r,n,s,i)=>{(await t.acquire())(),e(r,n,s,i)}}function ct(t,e){const r=[];for(let n in t)r.push(t[n]);return r}const q1=Jt.default,{createAsyncMiddleware:Ai,createScaffoldMiddleware:J1}=fs,Z1=W1,{unsafeRandomBytes:Q1,incrementHexInt:K1}=nr,X1=vs;var Y1=eg;function eg({blockTracker:t,provider:e}){const r={},n=Z1({blockTracker:t,provider:e});let s=!1;const i=new q1,o=J1({eth_subscribe:Ai(a),eth_unsubscribe:Ai(l)});return o.destroy=u,{events:i,middleware:o};async function a(d,h){if(s)throw new Error("SubscriptionManager - attempting to use after destroying");const f=d.params[0],g=Q1(16);let y;switch(f){case"newHeads":y=w({subId:g});break;case"logs":const C=d.params[1],m=await n.newLogFilter(C);y=S({subId:g,filter:m});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${f}"`)}r[g]=y,h.result=g;return;function w({subId:C}){const m={type:f,destroy:async()=>{t.removeListener("sync",m.update)},update:async({oldBlock:B,newBlock:_})=>{const M=_,z=K1(B);(await X1({provider:e,fromBlock:z,toBlock:M})).map(tg).filter(K=>K!==null).forEach(K=>{c(C,K)})}};return t.on("sync",m.update),m}function S({subId:C,filter:m}){return m.on("update",_=>c(C,_)),{type:f,destroy:async()=>await n.uninstallFilter(m.idHex)}}}async function l(d,h){if(s)throw new Error("SubscriptionManager - attempting to use after destroying");const f=d.params[0],g=r[f];if(!g){h.result=!1;return}delete r[f],await g.destroy(),h.result=!0}function c(d,h){i.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:d,result:h}})}function u(){i.removeAllListeners();for(const d in r)r[d].destroy(),delete r[d];s=!0}}function tg(t){return t==null?null:{hash:t.hash,parentHash:t.parentHash,sha3Uncles:t.sha3Uncles,miner:t.miner,stateRoot:t.stateRoot,transactionsRoot:t.transactionsRoot,receiptsRoot:t.receiptsRoot,logsBloom:t.logsBloom,difficulty:t.difficulty,number:t.number,gasLimit:t.gasLimit,gasUsed:t.gasUsed,nonce:t.nonce,mixHash:t.mixHash,timestamp:t.timestamp,extraData:t.extraData}}Object.defineProperty(Gr,"__esModule",{value:!0});Gr.SubscriptionManager=void 0;const rg=fo,ng=Y1,Ni=()=>{};class sg{constructor(e){const r=new rg.PollingBlockTracker({provider:e,pollingInterval:15e3,setSkipCacheFlag:!0}),{events:n,middleware:s}=ng({blockTracker:r,provider:e});this.events=n,this.subscriptionMiddleware=s}async handleRequest(e){const r={};return await this.subscriptionMiddleware(e,r,Ni,Ni),r}destroy(){this.subscriptionMiddleware.destroy()}}Gr.SubscriptionManager=sg;var Ma=p.commonjsGlobal&&p.commonjsGlobal.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pt,"__esModule",{value:!0});pt.CoinbaseWalletProvider=void 0;const ig=Ma(p.bnExports),og=p.eventemitter3Exports,O=Bt,T=v,ag=Ut,Mi=ye,br=kt,de=vt,Tn=Ma(Ml),$t=Ct,cg=yt,lg=Gr,Li="DefaultChainId",Ti="DefaultJsonRpcUrl";class ug extends og.EventEmitter{constructor(e){var r,n;super(),this._filterPolyfill=new cg.FilterPolyfill(this),this._subscriptionManager=new lg.SubscriptionManager(this),this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1,this.setProviderInfo=this.setProviderInfo.bind(this),this.updateProviderInfo=this.updateProviderInfo.bind(this),this.getChainId=this.getChainId.bind(this),this.setAppInfo=this.setAppInfo.bind(this),this.enable=this.enable.bind(this),this.close=this.close.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this.request=this.request.bind(this),this._setAddresses=this._setAddresses.bind(this),this.scanQRCode=this.scanQRCode.bind(this),this.genericRequest=this.genericRequest.bind(this),this._chainIdFromOpts=e.chainId,this._jsonRpcUrlFromOpts=e.jsonRpcUrl,this._overrideIsMetaMask=e.overrideIsMetaMask,this._relayProvider=e.relayProvider,this._storage=e.storage,this._relayEventManager=e.relayEventManager,this.diagnostic=e.diagnosticLogger,this.reloadOnDisconnect=!0,this.isCoinbaseWallet=(r=e.overrideIsCoinbaseWallet)!==null&&r!==void 0?r:!0,this.isCoinbaseBrowser=(n=e.overrideIsCoinbaseBrowser)!==null&&n!==void 0?n:!1,this.qrUrl=e.qrUrl;const s=this.getChainId(),i=(0,T.prepend0x)(s.toString(16));this.emit("connect",{chainIdStr:i});const o=this._storage.getItem(Mi.LOCAL_STORAGE_ADDRESSES_KEY);if(o){const a=o.split(" ");a[0]!==""&&(this._addresses=a.map(l=>(0,T.ensureAddressString)(l)),this.emit("accountsChanged",a))}this._subscriptionManager.events.on("notification",a=>{this.emit("message",{type:a.method,data:a.params})}),this._isAuthorized()&&this.initializeRelay(),window.addEventListener("message",a=>{var l;if(!(a.origin!==location.origin||a.source!==window)&&a.data.type==="walletLinkMessage"&&a.data.data.action==="dappChainSwitched"){const c=a.data.data.chainId,u=(l=a.data.data.jsonRpcUrl)!==null&&l!==void 0?l:this.jsonRpcUrl;this.updateProviderInfo(u,Number(c))}})}get selectedAddress(){return this._addresses[0]||void 0}get networkVersion(){return this.getChainId().toString(10)}get chainId(){return(0,T.prepend0x)(this.getChainId().toString(16))}get isWalletLink(){return!0}get isMetaMask(){return this._overrideIsMetaMask}get host(){return this.jsonRpcUrl}get connected(){return!0}isConnected(){return!0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(Ti))!==null&&e!==void 0?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(Ti,e)}disableReloadOnDisconnect(){this.reloadOnDisconnect=!1}setProviderInfo(e,r){this.isCoinbaseBrowser||(this._chainIdFromOpts=r,this._jsonRpcUrlFromOpts=e),this.updateProviderInfo(this.jsonRpcUrl,this.getChainId())}updateProviderInfo(e,r){this.jsonRpcUrl=e;const n=this.getChainId();this._storage.setItem(Li,r.toString(10)),((0,T.ensureIntNumber)(r)!==n||!this.hasMadeFirstChainChangedEmission)&&(this.emit("chainChanged",this.getChainId()),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,r,n,s,i,o){const l=await(await this.initializeRelay()).watchAsset(e,r,n,s,i,o==null?void 0:o.toString()).promise;return(0,de.isErrorResponse)(l)?!1:!!l.result}async addEthereumChain(e,r,n,s,i,o){var a,l;if((0,T.ensureIntNumber)(e)===this.getChainId())return!1;const c=await this.initializeRelay(),u=c.inlineAddEthereumChain(e.toString());!this._isAuthorized()&&!u&&await c.requestEthereumAccounts().promise;const d=await c.addEthereumChain(e.toString(),r,i,n,s,o).promise;return(0,de.isErrorResponse)(d)?!1:(((a=d.result)===null||a===void 0?void 0:a.isApproved)===!0&&this.updateProviderInfo(r[0],e),((l=d.result)===null||l===void 0?void 0:l.isApproved)===!0)}async switchEthereumChain(e){const n=await(await this.initializeRelay()).switchEthereumChain(e.toString(10),this.selectedAddress||void 0).promise;if((0,de.isErrorResponse)(n)){if(!n.errorCode)return;throw n.errorCode===O.standardErrorCodes.provider.unsupportedChain?O.standardErrors.provider.unsupportedChain():O.standardErrors.provider.custom({message:n.errorMessage,code:n.errorCode})}const s=n.result;s.isApproved&&s.rpcUrl.length>0&&this.updateProviderInfo(s.rpcUrl,e)}setAppInfo(e,r){this.initializeRelay().then(n=>n.setAppInfo(e,r))}async enable(){var e;return(e=this.diagnostic)===null||e===void 0||e.log($t.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::enable",addresses_length:this._addresses.length,sessionIdHash:this._relay?br.Session.hash(this._relay.session.id):void 0}),this._isAuthorized()?[...this._addresses]:await this.send("eth_requestAccounts")}async close(){(await this.initializeRelay()).resetAndReload()}send(e,r){try{const n=this._send(e,r);if(n instanceof Promise)return n.catch(s=>{throw(0,O.serializeError)(s,e)})}catch(n){throw(0,O.serializeError)(n,e)}}_send(e,r){if(typeof e=="string"){const s=e,i=Array.isArray(r)?r:r!==void 0?[r]:[],o={jsonrpc:"2.0",id:0,method:s,params:i};return this._sendRequestAsync(o).then(a=>a.result)}if(typeof r=="function"){const s=e,i=r;return this._sendAsync(s,i)}if(Array.isArray(e))return e.map(i=>this._sendRequest(i));const n=e;return this._sendRequest(n)}async sendAsync(e,r){try{return this._sendAsync(e,r).catch(n=>{throw(0,O.serializeError)(n,e)})}catch(n){return Promise.reject((0,O.serializeError)(n,e))}}async _sendAsync(e,r){if(typeof r!="function")throw new Error("callback is required");if(Array.isArray(e)){const s=r;this._sendMultipleRequestsAsync(e).then(i=>s(null,i)).catch(i=>s(i,null));return}const n=r;return this._sendRequestAsync(e).then(s=>n(null,s)).catch(s=>n(s,null))}async request(e){try{return this._request(e).catch(r=>{throw(0,O.serializeError)(r,e.method)})}catch(r){return Promise.reject((0,O.serializeError)(r,e.method))}}async _request(e){if(!e||typeof e!="object"||Array.isArray(e))throw O.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:r,params:n}=e;if(typeof r!="string"||r.length===0)throw O.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw O.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const s=n===void 0?[]:n,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:r,params:s,jsonrpc:"2.0",id:i})).result}async scanQRCode(e){const n=await(await this.initializeRelay()).scanQRCode((0,T.ensureRegExpString)(e)).promise;if((0,de.isErrorResponse)(n))throw(0,O.serializeError)(n.errorMessage,"scanQRCode");if(typeof n.result!="string")throw(0,O.serializeError)("result was not a string","scanQRCode");return n.result}async genericRequest(e,r){const s=await(await this.initializeRelay()).genericRequest(e,r).promise;if((0,de.isErrorResponse)(s))throw(0,O.serializeError)(s.errorMessage,"generic");if(typeof s.result!="string")throw(0,O.serializeError)("result was not a string","generic");return s.result}async connectAndSignIn(e){var r;(r=this.diagnostic)===null||r===void 0||r.log($t.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::connectAndSignIn",sessionIdHash:this._relay?br.Session.hash(this._relay.session.id):void 0});let n;try{const i=await this.initializeRelay();if(!(i instanceof ag.MobileRelay))throw new Error("connectAndSignIn is only supported on mobile");if(n=await i.connectAndSignIn(e).promise,(0,de.isErrorResponse)(n))throw new Error(n.errorMessage)}catch(i){throw typeof i.message=="string"&&i.message.match(/(denied|rejected)/i)?O.standardErrors.provider.userRejectedRequest("User denied account authorization"):i}if(!n.result)throw new Error("accounts received is empty");const{accounts:s}=n.result;return this._setAddresses(s),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),n.result}async selectProvider(e){const n=await(await this.initializeRelay()).selectProvider(e).promise;if((0,de.isErrorResponse)(n))throw(0,O.serializeError)(n.errorMessage,"selectProvider");if(typeof n.result!="string")throw(0,O.serializeError)("result was not a string","selectProvider");return n.result}supportsSubscriptions(){return!1}subscribe(){throw new Error("Subscriptions are not supported")}unsubscribe(){throw new Error("Subscriptions are not supported")}disconnect(){return!0}_sendRequest(e){const r={jsonrpc:"2.0",id:e.id},{method:n}=e;if(r.result=this._handleSynchronousMethods(e),r.result===void 0)throw new Error(`Coinbase Wallet does not support calling ${n} synchronously without a callback. Please provide a callback parameter to call ${n} asynchronously.`);return r}_setAddresses(e,r){if(!Array.isArray(e))throw new Error("addresses is not an array");const n=e.map(s=>(0,T.ensureAddressString)(s));JSON.stringify(n)!==JSON.stringify(this._addresses)&&(this._addresses=n,this.emit("accountsChanged",this._addresses),this._storage.setItem(Mi.LOCAL_STORAGE_ADDRESSES_KEY,n.join(" ")))}_sendRequestAsync(e){return new Promise((r,n)=>{try{const s=this._handleSynchronousMethods(e);if(s!==void 0)return r({jsonrpc:"2.0",id:e.id,result:s});const i=this._handleAsynchronousFilterMethods(e);if(i!==void 0){i.then(a=>r(Object.assign(Object.assign({},a),{id:e.id}))).catch(a=>n(a));return}const o=this._handleSubscriptionMethods(e);if(o!==void 0){o.then(a=>r({jsonrpc:"2.0",id:e.id,result:a.result})).catch(a=>n(a));return}}catch(s){return n(s)}this._handleAsynchronousMethods(e).then(s=>s&&r(Object.assign(Object.assign({},s),{id:e.id}))).catch(s=>n(s))})}_sendMultipleRequestsAsync(e){return Promise.all(e.map(r=>this._sendRequestAsync(r)))}_handleSynchronousMethods(e){const{method:r}=e,n=e.params||[];switch(r){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"eth_uninstallFilter":return this._eth_uninstallFilter(n);case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:r}=e,n=e.params||[];switch(r){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(n);case"eth_ecRecover":return this._eth_ecRecover(n);case"personal_sign":return this._personal_sign(n);case"personal_ecRecover":return this._personal_ecRecover(n);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(n);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(n);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(n);case"cbWallet_arbitrary":return this._cbwallet_arbitrary(n);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(n);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(n);case"wallet_watchAsset":return this._wallet_watchAsset(n)}return(await this.initializeRelay()).makeEthereumJSONRPCRequest(e,this.jsonRpcUrl).catch(i=>{var o;throw(i.code===O.standardErrorCodes.rpc.methodNotFound||i.code===O.standardErrorCodes.rpc.methodNotSupported)&&((o=this.diagnostic)===null||o===void 0||o.log($t.EVENTS.METHOD_NOT_IMPLEMENTED,{method:e.method,sessionIdHash:this._relay?br.Session.hash(this._relay.session.id):void 0})),i})}_handleAsynchronousFilterMethods(e){const{method:r}=e,n=e.params||[];switch(r){case"eth_newFilter":return this._eth_newFilter(n);case"eth_newBlockFilter":return this._eth_newBlockFilter();case"eth_newPendingTransactionFilter":return this._eth_newPendingTransactionFilter();case"eth_getFilterChanges":return this._eth_getFilterChanges(n);case"eth_getFilterLogs":return this._eth_getFilterLogs(n)}}_handleSubscriptionMethods(e){switch(e.method){case"eth_subscribe":case"eth_unsubscribe":return this._subscriptionManager.handleRequest(e)}}_isKnownAddress(e){try{const r=(0,T.ensureAddressString)(e);return this._addresses.map(s=>(0,T.ensureAddressString)(s)).includes(r)}catch{}return!1}_ensureKnownAddress(e){var r;if(!this._isKnownAddress(e))throw(r=this.diagnostic)===null||r===void 0||r.log($t.EVENTS.UNKNOWN_ADDRESS_ENCOUNTERED),new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?(0,T.ensureAddressString)(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?(0,T.ensureAddressString)(e.to):null,s=e.value!=null?(0,T.ensureBN)(e.value):new ig.default(0),i=e.data?(0,T.ensureBuffer)(e.data):p.Buffer.alloc(0),o=e.nonce!=null?(0,T.ensureIntNumber)(e.nonce):null,a=e.gasPrice!=null?(0,T.ensureBN)(e.gasPrice):null,l=e.maxFeePerGas!=null?(0,T.ensureBN)(e.maxFeePerGas):null,c=e.maxPriorityFeePerGas!=null?(0,T.ensureBN)(e.maxPriorityFeePerGas):null,u=e.gas!=null?(0,T.ensureBN)(e.gas):null,d=e.chainId?(0,T.ensureIntNumber)(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:s,data:i,nonce:o,gasPriceInWei:a,maxFeePerGas:l,maxPriorityFeePerGas:c,gasLimit:u,chainId:d}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw O.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw O.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,r,n,s){this._ensureKnownAddress(r);try{const o=await(await this.initializeRelay()).signEthereumMessage(e,r,n,s).promise;if((0,de.isErrorResponse)(o))throw new Error(o.errorMessage);return{jsonrpc:"2.0",id:0,result:o.result}}catch(i){throw typeof i.message=="string"&&i.message.match(/(denied|rejected)/i)?O.standardErrors.provider.userRejectedRequest("User denied message signature"):i}}async _ethereumAddressFromSignedMessage(e,r,n){const i=await(await this.initializeRelay()).ethereumAddressFromSignedMessage(e,r,n).promise;if((0,de.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,T.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(Li);if(!e)return(0,T.ensureIntNumber)(this._chainIdFromOpts);const r=parseInt(e,10);return(0,T.ensureIntNumber)(r)}async _eth_requestAccounts(){var e;if((e=this.diagnostic)===null||e===void 0||e.log($t.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::_eth_requestAccounts",addresses_length:this._addresses.length,sessionIdHash:this._relay?br.Session.hash(this._relay.session.id):void 0}),this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let r;try{if(r=await(await this.initializeRelay()).requestEthereumAccounts().promise,(0,de.isErrorResponse)(r))throw new Error(r.errorMessage)}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?O.standardErrors.provider.userRejectedRequest("User denied account authorization"):n}if(!r.result)throw new Error("accounts received is empty");return this._setAddresses(r.result),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const r=(0,T.ensureAddressString)(e[0]),n=(0,T.ensureBuffer)(e[1]);return this._signEthereumMessage(n,r,!1)}_eth_ecRecover(e){const r=(0,T.ensureBuffer)(e[0]),n=(0,T.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(r,n,!1)}_personal_sign(e){this._requireAuthorization();const r=(0,T.ensureBuffer)(e[0]),n=(0,T.ensureAddressString)(e[1]);return this._signEthereumMessage(r,n,!0)}_personal_ecRecover(e){const r=(0,T.ensureBuffer)(e[0]),n=(0,T.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(r,n,!0)}async _eth_signTransaction(e){this._requireAuthorization();const r=this._prepareTransactionParams(e[0]||{});try{const s=await(await this.initializeRelay()).signEthereumTransaction(r).promise;if((0,de.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?O.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}async _eth_sendRawTransaction(e){const r=(0,T.ensureBuffer)(e[0]),s=await(await this.initializeRelay()).submitEthereumTransaction(r,this.getChainId()).promise;if((0,de.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}async _eth_sendTransaction(e){this._requireAuthorization();const r=this._prepareTransactionParams(e[0]||{});try{const s=await(await this.initializeRelay()).signAndSubmitEthereumTransaction(r).promise;if((0,de.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?O.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}async _eth_signTypedData_v1(e){this._requireAuthorization();const r=(0,T.ensureParsedJSONObject)(e[0]),n=(0,T.ensureAddressString)(e[1]);this._ensureKnownAddress(n);const s=Tn.default.hashForSignTypedDataLegacy({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(s,n,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const r=(0,T.ensureAddressString)(e[0]),n=(0,T.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(r);const s=Tn.default.hashForSignTypedData_v3({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(s,r,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const r=(0,T.ensureAddressString)(e[0]),n=(0,T.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(r);const s=Tn.default.hashForSignTypedData_v4({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(s,r,!1,i)}async _cbwallet_arbitrary(e){const r=e[0],n=e[1];if(typeof n!="string")throw new Error("parameter must be a string");if(typeof r!="object"||r===null)throw new Error("parameter must be an object");return{jsonrpc:"2.0",id:0,result:await this.genericRequest(r,n)}}async _wallet_addEthereumChain(e){var r,n,s,i;const o=e[0];if(((r=o.rpcUrls)===null||r===void 0?void 0:r.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!o.chainName||o.chainName.trim()==="")throw O.standardErrors.rpc.invalidParams("chainName is a required field");if(!o.nativeCurrency)throw O.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const a=parseInt(o.chainId,16);return await this.addEthereumChain(a,(n=o.rpcUrls)!==null&&n!==void 0?n:[],(s=o.blockExplorerUrls)!==null&&s!==void 0?s:[],o.chainName,(i=o.iconUrls)!==null&&i!==void 0?i:[],o.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 r=e[0];return await this.switchEthereumChain(parseInt(r.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw O.standardErrors.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw O.standardErrors.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw O.standardErrors.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw O.standardErrors.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:s,symbol:i,image:o,decimals:a}=r.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(r.type,s,i,a,o,n)}}_eth_uninstallFilter(e){const r=(0,T.ensureHexString)(e[0]);return this._filterPolyfill.uninstallFilter(r)}async _eth_newFilter(e){const r=e[0];return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newFilter(r)}}async _eth_newBlockFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newBlockFilter()}}async _eth_newPendingTransactionFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newPendingTransactionFilter()}}_eth_getFilterChanges(e){const r=(0,T.ensureHexString)(e[0]);return this._filterPolyfill.getFilterChanges(r)}_eth_getFilterLogs(e){const r=(0,T.ensureHexString)(e[0]);return this._filterPolyfill.getFilterLogs(r)}initializeRelay(){return this._relay?Promise.resolve(this._relay):this._relayProvider().then(e=>(e.setAccountsCallback((r,n)=>this._setAddresses(r,n)),e.setChainCallback((r,n)=>{this.updateProviderInfo(n,parseInt(r,10))}),e.setDappDefaultChainCallback(this._chainIdFromOpts),this._relay=e,e))}}pt.CoinbaseWalletProvider=ug;var hn={};Object.defineProperty(hn,"__esModule",{value:!0});hn.RelayEventManager=void 0;const dg=v;class hg{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=(0,dg.prepend0x)(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}hn.RelayEventManager=hg;Object.defineProperty(Ot,"__esModule",{value:!0});Ot.CoinbaseWalletSDK=void 0;const fg=Sr,gg=Cr,$i=v,pg=Nr,mg=pt,bg=Ut,yg=Gt,wg=hn,Eg=Wt,_g=Vt,La=St;class fn{constructor(e){var r,n,s;this._appName="",this._appLogoUrl=null,this._relay=null,this._relayEventManager=null;const i=e.linkAPIUrl||gg.LINK_API_URL;typeof e.overrideIsMetaMask>"u"?this._overrideIsMetaMask=!1:this._overrideIsMetaMask=e.overrideIsMetaMask,this._overrideIsCoinbaseWallet=(r=e.overrideIsCoinbaseWallet)!==null&&r!==void 0?r:!0,this._overrideIsCoinbaseBrowser=(n=e.overrideIsCoinbaseBrowser)!==null&&n!==void 0?n:!1,this._diagnosticLogger=e.diagnosticLogger,this._reloadOnDisconnect=(s=e.reloadOnDisconnect)!==null&&s!==void 0?s:!0;const o=new URL(i),a=`${o.protocol}//${o.host}`;if(this._storage=new pg.ScopedLocalStorage(`-walletlink:${a}`),this._storage.setItem("version",fn.VERSION),this.walletExtension||this.coinbaseBrowser)return;this._relayEventManager=new wg.RelayEventManager;const l=(0,$i.isMobileWeb)(),c=e.uiConstructor||(d=>l?new yg.MobileRelayUI(d):new Eg.WalletLinkRelayUI(d)),u={linkAPIUrl:i,version:La.LIB_VERSION,darkMode:!!e.darkMode,headlessMode:!!e.headlessMode,uiConstructor:c,storage:this._storage,relayEventManager:this._relayEventManager,diagnosticLogger:this._diagnosticLogger,reloadOnDisconnect:this._reloadOnDisconnect,enableMobileWalletLink:e.enableMobileWalletLink};this._relay=l?new bg.MobileRelay(u):new _g.WalletLinkRelay(u),this.setAppInfo(e.appName,e.appLogoUrl),!e.headlessMode&&this._relay.attachUI()}makeWeb3Provider(e="",r=1){const n=this.walletExtension;if(n)return this.isCipherProvider(n)||n.setProviderInfo(e,r),this._reloadOnDisconnect===!1&&typeof n.disableReloadOnDisconnect=="function"&&n.disableReloadOnDisconnect(),n;const s=this.coinbaseBrowser;if(s)return s;const i=this._relay;if(!i||!this._relayEventManager||!this._storage)throw new Error("Relay not initialized, should never happen");return e||i.setConnectDisabled(!0),new mg.CoinbaseWalletProvider({relayProvider:()=>Promise.resolve(i),relayEventManager:this._relayEventManager,storage:this._storage,jsonRpcUrl:e,chainId:r,qrUrl:this.getQrUrl(),diagnosticLogger:this._diagnosticLogger,overrideIsMetaMask:this._overrideIsMetaMask,overrideIsCoinbaseWallet:this._overrideIsCoinbaseWallet,overrideIsCoinbaseBrowser:this._overrideIsCoinbaseBrowser})}setAppInfo(e,r){var n;this._appName=e||"DApp",this._appLogoUrl=r||(0,$i.getFavicon)();const s=this.walletExtension;s?this.isCipherProvider(s)||s.setAppInfo(this._appName,this._appLogoUrl):(n=this._relay)===null||n===void 0||n.setAppInfo(this._appName,this._appLogoUrl)}disconnect(){var e;const r=this===null||this===void 0?void 0:this.walletExtension;r?r.close():(e=this._relay)===null||e===void 0||e.resetAndReload()}getQrUrl(){var e,r;return(r=(e=this._relay)===null||e===void 0?void 0:e.getQRCodeUrl())!==null&&r!==void 0?r:null}getCoinbaseWalletLogo(e,r=240){return(0,fg.walletLogo)(e,r)}get walletExtension(){var e;return(e=window.coinbaseWalletExtension)!==null&&e!==void 0?e:window.walletLinkExtension}get coinbaseBrowser(){var e,r;try{const n=(e=window.ethereum)!==null&&e!==void 0?e:(r=window.top)===null||r===void 0?void 0:r.ethereum;return n&&"isCoinbaseBrowser"in n&&n.isCoinbaseBrowser?n:void 0}catch{return}}isCipherProvider(e){return typeof e.isCipher=="boolean"&&e.isCipher}}Ot.CoinbaseWalletSDK=fn;fn.VERSION=La.LIB_VERSION;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CoinbaseWalletProvider=t.CoinbaseWalletSDK=void 0;const e=Ot,r=pt;var n=Ot;Object.defineProperty(t,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}});var s=pt;Object.defineProperty(t,"CoinbaseWalletProvider",{enumerable:!0,get:function(){return s.CoinbaseWalletProvider}}),t.default=e.CoinbaseWalletSDK,typeof window<"u"&&(window.CoinbaseWalletSDK=e.CoinbaseWalletSDK,window.CoinbaseWalletProvider=r.CoinbaseWalletProvider,window.WalletLink=e.CoinbaseWalletSDK,window.WalletLinkProvider=r.CoinbaseWalletProvider)})(Pi);const vg=p.getDefaultExportFromCjs(Pi),Sg=Object.freeze(Object.defineProperty({__proto__:null,default:vg},Symbol.toStringTag,{value:"Module"}));exports.index=Sg;